Skip to content

GoogleSymbols icons are not properly vertically centered by Flutter rendering logic #138592

@jacobsimionato

Description

@jacobsimionato

Summary of the issue:

  • GoogleSymbols are being rendered in Flutter with incorrect vertical centering. When teams try to migrate from other icon libraries, their layouts break.
  • After some discussion about whether there's an issue in the symbol font, it seems like the issue is that the way that Flutter determines the center of the symbol isn't compatible with the way this particular symbol library is represented - from @tphinney in b/267281950, flutter "does the centering by using one of the top vertical values (NOT cap height!) from the font, and the baseline, rather than the top and bottom. It is unfortunate; if they had used cap height and baseline, we would have been OK. Their approach will probably work with many symbol fonts, but is not so great in our particular case."
  • It's difficult to change the values in the symbol font file we ship, because the same font is used across many platforms/products/clients etc and the change would not be backwards compatible. Possibly someone could create a tool that transforms the upstream font to a special Flutter-compatible version, though that seems a little messy and confusing.

Maybe there's some change that could be made to Flutter's rendering logic that would fix rendering for this symbol font without breaking rendering for other fonts? It sounds like maybe there's some ambiguity in the best way to center symbols. Could someone on the Flutter engine team provide an opinion on this? We need a fix or workaround for this issue somewhere in the stack, it's just unclear where the most elegant place for that is.

Example of the bug:

9rJw3jgfyskRULh

There is a lot of discussion about this floating around in #102560, google/material-design-icons#1500 and Google bug b/267281950, but I wanted to create an issue specifically for the vertical centering problem seeing as it's starting to create work for Google teams to add a proliferation of workarounds.

Metadata

Metadata

Labels

P0Critical issues such as a build break or regressiona: typographyText rendering, possibly libtxtcustomer: googleVarious Google teamsteam-frameworkOwned by Framework team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions