// Regression: ligatures must not read as system-font glyphs. STAR DASH's "Outfits, ..." caption failed `shots check` // with `i drawn with a system font` although Montserrat drew every glyph: the per-character probe spans sat side by // side, Chrome shaped "f" + "i" into the fi ligature across them and the lone "i" span reported no glyph of ours. // The fixture is a real Google Fonts css2 `text=` subset of Montserrat (as `shots fonts` downloads it; OFL, see // fixtures/fonts/Montserrat-OFL.txt); it keeps the GSUB ligatures (ff, fi, ffi). Skips when no Chromium can launch. import { afterAll, describe, expect, test } from 'bun:test'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import { measureFonts } from '../cli/shots/glyphs'; // eslint-disable-next-line @typescript-eslint/no-explicit-any let browser: any = null; let skipWhy = ''; try { const { chromium } = await import('playwright-core'); try { browser = await chromium.launch({ headless: true }); } catch { browser = await chromium.launch({ headless: true, channel: 'chrome' }); } } catch (e) { skipWhy = (e as Error).message.split('\n')[0]!; } if (!browser) console.warn(`glyph ligature test skipped: no Chromium could launch (${skipWhy}). Run \`bunx playwright install chromium\`.`); afterAll(async () => { await browser?.close(); }, 30_000); const font = readFileSync(join(import.meta.dir, 'fixtures', 'fonts', 'montserrat-text-subset.woff2')).toString('base64'); const TEXT = 'Outfits, fit, office, affine'; describe.skipIf(!browser)('shots font usage: ligatures', () => { for (const weight of [400, 600, 800]) test(`"${TEXT}" in a Montserrat text= subset, weight ${weight}: zero system-font glyphs`, async () => { const page = await browser.newPage(); try { await page.setContent(`
${TEXT}