Commit dd0eecc
authored
Sort the Skia typefaces in a font style set into a consistent order (flutter#11056)
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 flutter#312121 parent 942e631 commit dd0eecc
1 file changed
+17
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 212 | + | |
215 | 213 | | |
216 | | - | |
217 | | - | |
| 214 | + | |
218 | 215 | | |
219 | 216 | | |
220 | | - | |
221 | | - | |
| 217 | + | |
| 218 | + | |
222 | 219 | | |
| 220 | + | |
223 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
224 | 233 | | |
225 | 234 | | |
226 | | - | |
| 235 | + | |
227 | 236 | | |
228 | 237 | | |
229 | 238 | | |
230 | | - | |
231 | | - | |
232 | 239 | | |
233 | 240 | | |
234 | 241 | | |
| |||
0 commit comments