Repository navigation
ui: the interface prefers the platform's UI faces, rendered text keeps the print ones - #1322
Conversation
b60d240 to
923dca8
Compare
|
Thanks @FeiLiuEM! These fallback lists also drive composition text layout ( |
|
Both points are right, thank you. The layout coupling is the one that matters. PMingLiU: you are right and my rationale is wrong — it is MingLiU's proportional sibling, not a screen face in the sense Meiryo UI is. The three font-link pairs I would defend are Meiryo/Meiryo UI, MS Gothic/MS UI Gothic and Yu Gothic/Yu Gothic UI; on the Chinese side the honest statement is that Windows ships a UI variant of YaHei and JhengHei, which is why those two went first, and PMingLiU is in the list for its proportional spacing rather than as a sibling of MingLiU. I will fix the comment with whatever this PR becomes. |
|
Done that way, and thank you for catching it before it landed.
One thing I could not verify here: on Linux none of those families resolve, so the test asserts the list rather than the selection. On a Windows box with the faces installed the choice goes through the same |
|
Thank you for this contribution! We reviewed it for today's community batch, and it needs a few changes before it can land: Sloppy in places. Suggested next step: Fix the double cjk_locale and move the test so it doesn't split the #394 doc comment. Rebase after #1395. The face preferences are Windows-only and untestable in CI, so they need a maintainer eyeball. Once it is updated we will take another look. If you have not already, please join us on Discord: https://discord.gg/artcraft |
…s the print ones Windows ships a UI variant of its Japanese and Chinese families (`Meiryo`/`Meiryo UI`, `Yu Gothic`/`Yu Gothic UI`, `MS Gothic`/`MS UI Gothic`, `Microsoft YaHei`/`Microsoft YaHei UI`, `Microsoft JhengHei`/`Microsoft JhengHei UI`) whose kana and kanji are drawn for the screen, and its own link table for `Segoe UI` picks the UI one for everything it draws. The interface should ask for it - but the same lists feed `fonts::fallback_for`, which shapes composed frames, so reordering them would change how existing projects render. The two orders are therefore separate: this leaves `crates/text/src/fonts.rs` exactly as it is and gives the interface its own candidate list in `install_script_fallbacks`, which falls back to the shared choice when the platform has no UI variant, none is installed, or it does not cover the probe. `PMingLiU` is in the interface list for its proportional spacing, not as a sibling of `MingLiU`: it is MingLiU's proportional relative. The rendered order is pinned by a test now: the Japanese list keeps `Yu Gothic` ahead of `Yu Gothic UI`, and no UI name appears in the lists a document renders with. `the_interface_asks_for_the_ platforms_ui_faces` pins the interface list and checks that every other script the install probes has none, so a script that draws correctly in any face keeps the shared order. Review fixes: the locale is mapped once (the call passes the language, the helper maps it), the new test sits after the storytold#394 test it had split from its doc comment, and the fonts.rs test asserts instead of panicking inside a closure. Rebased on current main; storytold#1395 has not landed yet, so there is nothing to rebase after it.
|
Thank you — all three are fixed, in one commit rebased on current main (
On rebasing after #1395: it is still open, so there was nothing to rebase after yet — this is on current You are right that the face preferences cannot be tested in CI: the tests pin the candidate lists and the rendered order, not the selection, and the body says so. A maintainer eyeball on Windows is the right gate for the rest. Thanks for the Discord link. |
d73775a to
2fbcc6b
Compare
Windows ships two faces per family for what it draws on screen and what it prints —
Meiryo/Meiryo UI,Yu Gothic/Yu Gothic UI,MS Gothic/MS UI Gothic,Microsoft YaHei/Microsoft YaHei UI,Microsoft JhengHei/Microsoft JhengHei UI— and its own link table forSegoe UI(FontLink\SystemLink) picks the UI one. Its kana are narrower and its spacing tighter, which is what an interface at 12 px wants.The first version of this PR put those faces at the head of the lists in
crates/text/src/fonts.rs, and @bflatastic was right to stop it: those same lists feedfonts::fallback_for, which shapes composed frames, so the reorder would have changed how existing projects render. The two orders are separate now.What changed
crates/text/src/fonts.rsis untouched, exactly asmainhas it. A document keeps rendering in the platform's print order, and a new test pins that:Yu Gothicstays ahead ofYu Gothic UI, and no UI name appears in the lists a document renders with.install_script_fallbacks(the interface's own install) has a candidate list of its own:["Meiryo UI", "Yu Gothic UI", "MS UI Gothic"]for kana and for the Han ideographs of a Japanese interface,["Microsoft YaHei UI"]for Simplified Chinese,["Microsoft JhengHei UI", "PMingLiU"]for Traditional. It is used only when the family resolves, is not missing, and covers the probe; otherwise the shared choice stands. Every other script the install probes has an empty list — those faces draw their script correctly at any size, and their order should not depend on the chrome.PMingLiUstays, with the right reason: it isMingLiU's proportional relative, not a screen sibling, and proportional spacing is what makes the chrome read better in it.the_interface_asks_for_the_platforms_ui_facespins the interface list, including that the other scripts have none.What this does not do
It does not make the selection testable on Linux:
resolvefinds noMeiryo UIhere, and the test asserts the list rather than the choice. The path the choice goes through (fonts::resolve+FaceId::missing+Face::has_char) is the same one the neighbouring probes already use.The
PingFang SC/PingFang TCside is untouched: macOS ships no UI sibling for either, so there is nothing to prefer there.Summary by CodeRabbit