Commit 41aa2db
committed
terminal: fix CJK fallback font loading
clearing font charset restrictions by copying a font descriptor's attributes and
re-creating it sometimes doesn't work; for example, with 'PingFang SC Regular'
(derived from '.AppleSystemUIFontMonospaced'), `face.hasCodepoint(cp, p_mode)`
will erroneously return false after copying, and the font will be rejected. this
causes fallback font lookup to fail when trying to render a CJK character.
(note: if you first render a non-CJK character that loads a font that contains
CJK characters, everything will work fine as the CJK fallback path isn't hit.)
I'm fixing this by only clearing charset restrictions if we know that we've applied
them to the font (using `CoreText.discover(...)`, not hitting the special CJK path),
but I'm not sure how fragile the charset restriction clearing is for other fonts.1 parent e7c1b4d commit 41aa2db
1 file changed
+9
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
375 | 376 | | |
376 | 377 | | |
377 | 378 | | |
| |||
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
| 413 | + | |
412 | 414 | | |
413 | 415 | | |
414 | 416 | | |
| |||
433 | 435 | | |
434 | 436 | | |
435 | 437 | | |
| 438 | + | |
436 | 439 | | |
437 | 440 | | |
438 | 441 | | |
| |||
828 | 831 | | |
829 | 832 | | |
830 | 833 | | |
| 834 | + | |
| 835 | + | |
831 | 836 | | |
832 | 837 | | |
833 | 838 | | |
| |||
845 | 850 | | |
846 | 851 | | |
847 | 852 | | |
848 | | - | |
849 | 853 | | |
850 | 854 | | |
851 | 855 | | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
852 | 860 | | |
853 | 861 | | |
854 | 862 | | |
| |||
0 commit comments