If a new fallback font is discovered during paragraph layout, the fallback
font cache in txt::FontCollection will use that font in future layouts.
However, that cache is not available if the new fallback font needs to be
used for other characters within the current layout. This PR adds a cache
to minikin::FontCollection and checks whether fonts in the cache can handle
a character before calling the fallback font provider.
See https://github.com/flutter/engine/pull/13257
* Check for special case index out of bounds condition for leading space
* Add TODO
* Rework to pass tests
* More robust check for leading
* Minor adjustment
* Fix order bug
* Do not modify for leading space
* Fix test value
* Condition
When Minikin searches for a font based on a font style, it will score the fonts
in the family and choose the best match. However, multiple fonts may have
equal scores (e.g. searching for a font with weight 600 when the set includes
fonts with weights 500 and 700). In this case Minikin will select the first
font in the list with the best score.
However, the fonts in a font family's SkFontStyleSet may not always be provided
in a consistent order by the SkFontMgr. So if the minikin::FontFamily list is
populated based on the SkFontStyleSet order, then a query for a given style might
not always return the same font.
This change sorts the typefaces in the SkFontStyleSet before converting them
into a Minikin font family.
Fixes https://github.com/flutter/flutter/issues/31212