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
@@ -0,0 +1,11 @@
/**
* Formats a font configuration into a string format required by @chenglou/pretext.
*
* @param weight - Numeric font weight (e.g., 400).
* @param sizePx - Font size in pixels.
* @param fontName - The font family name.
* @returns A formatted font string: `"weight sizepx \"fontName\""`.
*/
export function getPretextFontString(weight: number, sizePx: number, fontName: string): string {
return `${weight} ${sizePx}px "${fontName}"`;
}