Repository navigation
[vector_graphics_compiler] Fix em units in text positions - #13388
Merged
auto-submit[bot] merged 7 commits intoOct 29, 2026
Merged
Conversation
Text `x`, `y`, `dx` and `dy` values in `em` were parsed with the unit stripped, so `dy=".35em"` moved the text by 0.35 pixels. They are now multiplied by the element's font size, falling back to the same default of 16 used when drawing the text. Fixes flutter/flutter#158758
rohanjariwala03
marked this pull request as ready for review
October 22, 2026 18:39
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for 'em' units in SVG text positions (x, y, dx, dy) by updating the DoubleOrPercentage class to parse and calculate values relative to the font size. Feedback suggests converting the parsed string to lowercase to ensure case-insensitive matching of the 'em' unit.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
gaaclarke
self-requested a review
October 26, 2026 18:22
gaaclarke
requested changes
Oct 27, 2026
# Conflicts: # packages/vector_graphics_compiler/CHANGELOG.md
Contributor
Author
|
@gaaclarke Thanks for the review! Merged upstream. Since 1.3.3 is now the coordinate list change, I moved this entry to 1.3.4. |
gaaclarke
approved these changes
Oct 28, 2026
Member
|
@flar can you be a second review on this please? |
flar
requested changes
Oct 28, 2026
flar
left a comment
Contributor
There was a problem hiding this comment.
Mostly LGTM, but there's a nit that I'd like to hear back about...
Contributor
Author
|
@gaaclarke @flar I've merged the main branch and updated the PR. Can you merge this? |
flutter-zl
pushed a commit
to flutter-zl/flutter
that referenced
this pull request
Oct 30, 2026
flutter/packages@0b72e92...3742a4e 2026-10-30 [email protected] [pigeon] Allow event channel unregistration (flutter/packages#13438) 2026-10-30 [email protected] [material_ui] Fix Escape key not closing MenuAnchor opened by tap or click (flutter/packages#13430) 2026-10-30 [email protected] manual roll and manual build and copy (flutter/packages#13495) 2026-10-29 [email protected] [pigeon] Separate native interop Dart bindings into a conditionally imported companion file (flutter/packages#13393) 2026-10-29 [email protected] [image_picker_ios] PR 4/5 Migrate the view provider, PHPicker save operation, and image utilities to Swift (flutter/packages#13394) 2026-10-29 [email protected] Sync release-material_ui-1.9.0 to main (flutter/packages#13479) 2026-10-29 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: time_picker_test (flutter/packages#13471) 2026-10-29 [email protected] [vector_graphics] Dispose pictures decoded after their VectorGraphic is removed (flutter/packages#13435) 2026-10-29 [email protected] [camera_android_x] implement CameraX RecordingStats and VideoRecordEvent APIs (flutter/packages#13330) 2026-10-29 [email protected] Sync release-go_router-18.1.2 to main (flutter/packages#13480) 2026-10-29 [email protected] Sync release-cupertino_ui-1.1.5 to main (flutter/packages#13481) 2026-10-29 [email protected] [vector_graphics_compiler] Fix em units in text positions (flutter/packages#13388) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gmackall
pushed a commit
to gmackall/flutter
that referenced
this pull request
Nov 3, 2026
flutter/packages@0b72e92...3742a4e 2026-10-30 [email protected] [pigeon] Allow event channel unregistration (flutter/packages#13438) 2026-10-30 [email protected] [material_ui] Fix Escape key not closing MenuAnchor opened by tap or click (flutter/packages#13430) 2026-10-30 [email protected] manual roll and manual build and copy (flutter/packages#13495) 2026-10-29 [email protected] [pigeon] Separate native interop Dart bindings into a conditionally imported companion file (flutter/packages#13393) 2026-10-29 [email protected] [image_picker_ios] PR 4/5 Migrate the view provider, PHPicker save operation, and image utilities to Swift (flutter/packages#13394) 2026-10-29 [email protected] Sync release-material_ui-1.9.0 to main (flutter/packages#13479) 2026-10-29 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: time_picker_test (flutter/packages#13471) 2026-10-29 [email protected] [vector_graphics] Dispose pictures decoded after their VectorGraphic is removed (flutter/packages#13435) 2026-10-29 [email protected] [camera_android_x] implement CameraX RecordingStats and VideoRecordEvent APIs (flutter/packages#13330) 2026-10-29 [email protected] Sync release-go_router-18.1.2 to main (flutter/packages#13480) 2026-10-29 [email protected] Sync release-cupertino_ui-1.1.5 to main (flutter/packages#13481) 2026-10-29 [email protected] [vector_graphics_compiler] Fix em units in text positions (flutter/packages#13388) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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.
Text
x,y,dxanddyvalues inemwere treated as pixels. For example,dy=".35em"withfont-size="425px"moved the text down by 0.35 pixels instead of about 149, so text centered this way was drawn too high.DoubleOrPercentage.fromStringstripped the unit withparseDouble, so anemvalue ended up the same as a plain number. Now it remembers that the value is inem, andcomputeTextPositionmultiplies it by the element's font size, including one inherited from a parent. Without a font size it useskDefaultFontSize(16), the same defaultcomputeTextConfiguses when drawing the text. The bug is invector_graphics_compiler, whichflutter_svguses to parse SVGs.Fixes flutter/flutter#158758
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot 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.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2