refactor(fonts): use DEFAULT_FONTS as settings fallback

Avoids leaking a pairing's id/label into the stored book fonts.
This commit is contained in:
pj committed 2026-06-22 14:34:45 -04:00
1 parent baf1154683
commit ecc94e6c31
1 file changed
+2 -1
+2 -1
View File
@@ -6,6 +6,7 @@ import {
type BookFonts, type BookFonts,
type FontRef, type FontRef,
BUNDLED_FONTS, BUNDLED_FONTS,
DEFAULT_FONTS,
FONT_PAIRINGS, FONT_PAIRINGS,
decodeRef, decodeRef,
encodeRef, encodeRef,
@@ -80,7 +81,7 @@ export function Settings({ onClose, onSave }: { onClose: () => void; onSave: ()
isbn: book?.metadata.isbn ?? "", isbn: book?.metadata.isbn ?? "",
language: book?.metadata.language ?? "en", language: book?.metadata.language ?? "en",
bleed: book?.settings.bleed ?? true, bleed: book?.settings.bleed ?? true,
fonts: book?.settings.fonts ?? FONT_PAIRINGS[0], fonts: book?.settings.fonts ?? DEFAULT_FONTS,
})); }));
const [system, setSystem] = useState<string[]>(() => systemFontCache ?? []); const [system, setSystem] = useState<string[]>(() => systemFontCache ?? []);
const [advanced, setAdvanced] = useState(() => pairingFor(draft.fonts) === null); const [advanced, setAdvanced] = useState(() => pairingFor(draft.fonts) === null);