refactor(ComparisonView): unify pretext font string generation with a utility function

This commit is contained in:
Ilia Mashkov
2026-04-20 11:13:54 +03:00
parent 836b83f75d
commit a73bd75947
5 changed files with 55 additions and 6 deletions
@@ -24,6 +24,7 @@ import {
import { typographySettingsStore } from '$features/SetupFont/model';
import { createPersistentStore } from '$shared/lib';
import { untrack } from 'svelte';
import { getPretextFontString } from '../../lib';
/**
* Storage schema for comparison state
@@ -205,8 +206,8 @@ export class ComparisonStore {
return;
}
const fontAString = `${weight} ${size}px "${fontAName}"`;
const fontBString = `${weight} ${size}px "${fontBName}"`;
const fontAString = getPretextFontString(weight, size, fontAName);
const fontBString = getPretextFontString(weight, size, fontBName);
// Check if already loaded to avoid UI flash
const isALoaded = document.fonts.check(fontAString);