Repository navigation
Commit 130391e
fix(web-ui): center CJK text and the device mark on glyph ink
A line box is split by a font's ascent and descent, not by the glyphs drawn in
it. HarmonyOS Sans declares 92.8% / 24.4%, while its ideographs draw from 84.5%
above the baseline to 7.5% below it, so a Chinese line box kept about 0.043em
more room under its glyphs than over them: a selected line read as an uneven
band (1.13px more space below than above at 14px) and message text sat high in
its bubble.
Split the same 117.2% as 97.1% / 20.1% on the SC face only, which moves the
shared baseline down by exactly that 0.043em before the glyphs are painted. The
sum is what `line-height: normal` and `1lh` resolve to, and the product sets an
explicit numeric leading on every other text it lays out, so no laid out box
changes size. The Latin-first base face, the code face, and the zh-TW system
stack keep their own metrics.
The nav panel footer pushed its device mark down a pixel to follow that text,
but the marks that reach this row state their own `opticalShift` as 0, so the
nudge left the mark 1.31px below the label's ink centre instead of 0.31px.
Remove it and record the measurement in the comment.
Measured at 8x device pixels: the selected-line gap difference drops from 1.13px
to 0.13px, and the device mark from 1.31px to 0.31px below its label.
Verified with the NavPanel suite (34 files, 204 tests), the web font profile
guard (7 tests), and the typography token audit (15 tests plus a zero-violation
audit run).
Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.com>1 parent b2ad0c1 commit 130391e
2 files changed
Lines changed: 36 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1398 | 1402 | | |
1399 | 1403 | | |
1400 | 1404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
16 | 44 | | |
17 | 45 | | |
18 | 46 | | |
| |||
0 commit comments