Appearance
Bug #003: 字体大小调节不生效
现象
排版控制中行间距调节正常,但字体大小(A⁻/A⁺)按钮点击后 toast 提示正常,视觉上无变化。
根因
epub.js 的 addStylesheetRules 以对象格式注入 CSS 规则时({ body: { 'font-size': '80%' } }),生成的规则没有 !important。epub 文件自带的 CSS 中可能已设置 body { font-size: ... },由于样式表插入位置和优先级关系,注入规则被 epub 原有规则覆盖。
修复
所有注入的 CSS 属性值追加 !important,确保覆盖 epub 自带样式:
js
{
body: {
'font-size': currentFontSize + '% !important',
'line-height': currentLineHeight + ' !important',
background: colors.background + ' !important',
color: colors.color + ' !important'
}
}注意:epub.js 的对象格式不支持原生的 !important 标记(需数组格式的第三个参数),通过字符串拼接绕过。
关联文件
public/books/reader-money-dog.htmlpublic/books/reader-rich-dad.html