feat(shared): add getPretextFontString formatter

This commit is contained in:
Ilia Mashkov
2026-06-24 13:49:02 +03:00
parent f29e0b0c7c
commit dbd48b287d
3 changed files with 32 additions and 0 deletions
@@ -0,0 +1,15 @@
import {
describe,
expect,
it,
} from 'vitest';
import { getPretextFontString } from './getPretextFontString';
describe('getPretextFontString', () => {
it('formats weight, px size and quoted family for pretext/canvas', () => {
expect(getPretextFontString(400, 48, 'Inter')).toBe('400 48px "Inter"');
});
it('preserves fractional sizes and quotes multi-word family names', () => {
expect(getPretextFontString(700, 12.5, 'PT Serif')).toBe('700 12.5px "PT Serif"');
});
});