fix(tasks): 小条的状态词与活动行统一字体(修掉 1px 基线错位)

用户反馈「运行中和正在分析请求没对齐」。实测是字体度量差异,不是布局:
两者行盒完全一致(11px/14px、align-items: center 下同一位置),但 11px 下
sans 字族的 fontBoundingBox ascent/descent 是 11/2,mono 字族是 10/3 ——
基线低 1px。中文在 mono 栈里本来就走同一个 CJK 回退(PingFang SC),
mono 只改到句中的拉丁片段,等于半句等宽 + 整体低一像素。

修法:.barActivity 不再声明 font-family,两段文字共用小条自己的字族;
机器文本的等宽语气保留在 meta 行 / 后台任务行 / 终端输出井。
theme.spec 新增守护(.barActivity 不得声明 font-family)。

真机证据:真实运行中卡片的小条(3× DPR 截图 17-bar-real.png)两段同处一行,
两个 span 的 font-family 计算值完全相同;此前同一小条 3× 截图里蓝字明显偏低。

验证:typecheck / lint ✅;pnpm test 1257 passed / 9 skipped(新增 1 例)。

(cherry picked from commit 6816af76828a436eaf201205e385c1aa4f77dcd5)
This commit is contained in:
Menghuan1918
2026-09-27 22:18:57 +08:00
parent 7cce50c493
commit 421fd3fde7
3 changed files with 35 additions and 2 deletions
+9 -2
View File
@@ -370,11 +370,18 @@
}
/* The merged activity: the main agent's own wording for the node's newest
range, in the mono voice the page uses for machine text. */
range. It deliberately keeps the BAR's font — no mono family. The state word
beside it is UI copy, and the two stacks do not share metrics: measured at
11px, the sans stack reports ascent/descent 11/2 against the mono stack's
10/3, so a mono activity line sits 1px LOWER than the state word it follows
(the reader reported exactly that misalignment). The mono face bought
nothing here either: every CJK glyph in this line comes from the same
fallback family, so only the Latin fragments changed face — half a sentence
in mono, one pixel off. Machine text keeps its mono voice where it belongs
(the meta row above, the job rows, the terminal well). */
.barActivity {
flex: 1;
min-width: 0;
font-family: var(--ds-font-family-code, monospace);
color: var(--dsw-alias-state-business-primary);
white-space: nowrap;
overflow: hidden;