Repository navigation
fix: 修正带注音歌词行的基线对齐 - #4
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动类型
是否包含破坏性变更
改动说明
开启「显示词内注音」(
showRuby),且渲染引擎为默认时,带注音的单词会比同一行其它文字低几个像素,且偏移量随歌词字号线性放大。原因是
.lp-main > span { vertical-align: middle }:注音会让<ruby>的盒子变高,而middle是按盒子中心对齐的,于是这个单词整体下沉。同文件里.lp-word-roman与.lp-emp-wrapper本来就各自覆盖成了vertical-align: bottom,只有这条基础规则是middle,看起来是遗漏。改为
bottom后整行按底边对齐,带不带注音都齐平,也与 AMLL 渲染器的做法一致(AMLL 把注音用 flex 列排在文字上方 +vertical-align: bottom,所以没有这个问题)。改动仅一处 CSS 声明 + 一行说明注释,不涉及引擎逻辑与对外 API。
关联 Issue
无
测试情况
在 Chromium(Electron 内核)下用同一份构建产物做 A/B 对照,只切换这一条声明,用
Range.getBoundingClientRect()量文字实际框底边:middle(改动前)bottom(改动后)另外确认:注音文本仍完整可见;歌词行框高度未变化;无注音的普通行不受影响。
仓库自检命令均通过:
pnpm test(34 用例)、pnpm lint、pnpm typecheck、biome format无待格式化改动。测试平台为 Windows 11。截图 / 录屏
before

after

(改前 / 改后各一张,同一首带
[kana:]注音的日语 QRC 歌词,歌词引擎选「默认」)自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.ts(本仓库无原生模块,不适用)dev分支提交(本仓库无dev分支,目标为main)