forked from akai/readest
Two issues caused embedded EPUB fonts to fail: 1. Adobe font deobfuscation (http://ns.adobe.com/pdf/enc#RC) derived the XOR key from the wrong UUID. getUUID() picked the first UUID across all dc:identifier elements (e.g. Calibre's internal UUID) instead of the book's unique-identifier. Also fixed getElementById not working on DOMParser-parsed XML (no DTD), and made UUID regex case-insensitive. 2. transformStylesheet replaced generic font families (sans-serif, serif, monospace) with CSS var() references without fallback values. In fixed-layout iframes where setStyles doesn't inject the variables, the undefined var() invalidated the entire font-family declaration per CSS spec, causing all fonts to fall back to system defaults. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -794,9 +794,9 @@ export const transformStylesheet = (css: string, vw: number, vh: number, vertica
|
||||
.replace(/([\s;])-o-user-select\s*:\s*none/gi, '$1-o-user-select: unset')
|
||||
.replace(/([\s;])user-select\s*:\s*none/gi, '$1user-select: unset')
|
||||
.replace(/(font-family\s*:[^;]*?)\bsans-serif\b/gi, '$1READEST_SS_PLACEHOLDER')
|
||||
.replace(/(font-family\s*:[^;]*?)\bserif\b(?!-)/gi, '$1var(--serif)')
|
||||
.replace(/READEST_SS_PLACEHOLDER/g, 'var(--sans-serif)')
|
||||
.replace(/(font-family\s*:[^;]*?)\bmonospace\b/gi, '$1var(--monospace)')
|
||||
.replace(/(font-family\s*:[^;]*?)\bserif\b(?!-)/gi, '$1var(--serif, serif)')
|
||||
.replace(/READEST_SS_PLACEHOLDER/g, 'var(--sans-serif, sans-serif)')
|
||||
.replace(/(font-family\s*:[^;]*?)\bmonospace\b/gi, '$1var(--monospace, monospace)')
|
||||
.replace(/([\s;])font-weight\s*:\s*normal/gi, '$1font-weight: var(--font-weight)')
|
||||
.replace(/([\s;])color\s*:\s*black/gi, '$1color: var(--theme-fg-color)')
|
||||
.replace(/([\s;])color\s*:\s*#000000/gi, '$1color: var(--theme-fg-color)')
|
||||
|
||||
+1
-1
Submodule packages/foliate-js updated: 2300db0dee...837c98fae0
Reference in New Issue
Block a user