Repository navigation
Resolve em and ex in shape geometry against the font size of the element - #549
Merged
Merged
Conversation
width="2em" in a group with font-size="10px" was 32 user units instead of 20: convert_length_attrs() used 16px for em unless the caller passed a base, and only text did. The root <svg> now uses its own font-size for width and height in em too.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
emandexin the geometry of a shape always use 16px, whatever thefont-size:convert_length_attrs()uses 16px foremunless the caller passes a base, and only text does. It now uses the font size of the node, fromfindFontSize(), when no base is given and one of the values is inemorex. For the root<svg>, which is an lxml element without a parent, it usesroot_font_size, so<svg width="1em" font-size="20px">is 15pt wide instead of 12pt.Lengths without
em/exdon't callfindFontSize(), so nothing changes for them. Tests:test_em_uses_font_size_of_shape(inherited and ownfont-size,emandex) andtest_em_on_root_uses_root_font_size; both fail without the change.