You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 10f15b3
Browse filesBrowse the repository at this point in the historyBrowse files
[vector_graphics_compiler] Fix em units in text positions (flutter#13388)
Text `x`, `y`, `dx` and `dy` values in `em` were treated as pixels. For example, `dy=".35em"` with `font-size="425px"` moved the text down by 0.35 pixels instead of about 149, so text centered this way was drawn too high.
`DoubleOrPercentage.fromString` stripped the unit with `parseDouble`, so an `em` value ended up the same as a plain number. Now it remembers that the value is in `em`, and `computeTextPosition` multiplies it by the element's font size, including one inherited from a parent. Without a font size it uses `kDefaultFontSize` (16), the same default `computeTextConfig` uses when drawing the text. The bug is in `vector_graphics_compiler`, which `flutter_svg` uses to parse SVGs.
Fixesflutter/flutter#158758
## Pre-Review Checklist
**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
0 commit comments