Repository navigation
Commit 9075389
Hayate Aizawa
Tolerate sub-pixel height shortfall in adjustsFontSizeToFit on iOS
Yoga snaps each edge of a node to the pixel grid independently and
derives the height from their difference. On screens whose scale is not
a power of two, a node far enough down the screen can get a frame one
float ULP short of its `lineHeight` (19.999992 for 20, react/yoga#2011).
`compareToSize:` had no tolerance on the height, and the line height
does not change when the font is scaled, so such a row never fit and
was scaled down to `minimumFontSize` even though the text fit (#52642).
Treat a height shortfall smaller than one physical pixel as fitting.
Width keeps its existing check. Adds an RNTester example that reproduces
the condition on a 3x device.1 parent 618b844 commit 9075389
2 files changed
Lines changed: 56 additions & 1 deletion
File tree
- packages
- react-native/Libraries/Text/Text
- rn-tester/js/examples/Text
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
92 | 102 | | |
93 | 103 | | |
94 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
281 | 319 | | |
282 | 320 | | |
283 | 321 | | |
| |||
1424 | 1462 | | |
1425 | 1463 | | |
1426 | 1464 | | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1427 | 1472 | | |
1428 | 1473 | | |
1429 | 1474 | | |
| |||
0 commit comments