Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render: use style.font-size attribute #250

Merged
merged 7 commits into from
Nov 30, 2022

Conversation

gavin-ts
Copy link
Contributor

@gavin-ts gavin-ts commented Nov 29, 2022

Summary

Render shape and connection labels with the font size specified in the style.font-size attribute.
Update text measurement to support loading a new font size on demand.
Previously the font-size attribute would be ignored on shapes, and would always be measured at the default 16 for connections.

Details

before

Screen Shot 2022-11-29 at 1 28 38 PM

after

Screen Shot 2022-11-29 at 1 31 13 PM

font_sizes test (dagre)

_Users_gavinnishizawa_github_repos_d2_e2etests_testdata_stable_font_sizes_dagre_sketch exp svg (1)

todo test related to #19

Screen Shot 2022-11-29 at 3 32 04 PM

@gavin-ts gavin-ts force-pushed the support-all-font-sizes-in-range branch 3 times, most recently from 92f27f4 to 56331b1 Compare November 29, 2022 23:19
@gavin-ts gavin-ts marked this pull request as ready for review November 29, 2022 23:39
@gavin-ts gavin-ts requested review from alixander and a team November 29, 2022 23:39
d2graph/d2graph.go Outdated Show resolved Hide resolved
d2renderers/textmeasure/textmeasure.go Outdated Show resolved Hide resolved
d2renderers/textmeasure/textmeasure.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 very nice

@gavin-ts gavin-ts force-pushed the support-all-font-sizes-in-range branch from 6ddadc5 to 2f96210 Compare November 30, 2022 19:47
@gavin-ts gavin-ts merged commit bf5b8c6 into terrastruct:master Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

render: font color and size
3 participants