Repository navigation
Commit 2b08f9a
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 2b08f9a
2 files changed
Lines changed: 46 additions & 2 deletions
File tree
- packages
- react-native/Libraries/Text/Text
- rn-tester/js/examples/Text
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | | - | |
91 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
| 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 | + | |
281 | 314 | | |
282 | 315 | | |
283 | 316 | | |
| |||
1424 | 1457 | | |
1425 | 1458 | | |
1426 | 1459 | | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
1427 | 1467 | | |
1428 | 1468 | | |
1429 | 1469 | | |
| |||
0 commit comments