forked from linebender/piet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Because SVG uses the baseline to position text, while we use the top-left of the text, we need to convert between the two. Before this PR, the whole font height was used, which pushes the text down too far. After this PR, we tell SVG to use the top of the ascender as our anchor point (`dominant-baseline: hanging`), with an additional fiddle factor of 0.06 * font height because we actually want the top of the line, not the ascender. The fiddle factor was worked out by eye looking at the default sans-serif font, comparing the svg to a png generated by piet-cairo. Use `dominant-baseline` for text positioning.
- Loading branch information
1 parent
f467cd4
commit 07318d3
Showing
3 changed files
with
10 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters