- Gate ingest rendering until required faces and script fallbacks resolve - Key CanvasKit artifacts by font registration generation and invalidate affected nodes - Load character-aware remote subsets with cumulative coverage and exact render aliases - Use BCP-47 language hints for shaping and CJK fallback order - Keep baked .fig glyphs as an exhaustion-only fallback
20 lines
865 B
TypeScript
20 lines
865 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
|
|
import { normalizedCoverageText, webFontSubsetsForText } from '@open-pencil/core/text'
|
|
|
|
describe('web font coverage requests', () => {
|
|
test('normalizes coverage without splitting supplementary code points', () => {
|
|
expect(normalizedCoverageText('界A界𠀀A')).toBe(normalizedCoverageText('A界𠀀'))
|
|
expect(Array.from(normalizedCoverageText('𠀀'))).toEqual(['𠀀'])
|
|
})
|
|
|
|
test('requests script-specific subsets instead of Latin only', () => {
|
|
expect(webFontSubsetsForText('مرحبا')).toContain('arabic')
|
|
expect(webFontSubsetsForText('한글')).toContain('korean')
|
|
expect(webFontSubsetsForText('かな')).toContain('japanese')
|
|
expect(webFontSubsetsForText('你好')).toEqual(
|
|
expect.arrayContaining(['chinese-simplified', 'chinese-traditional', 'japanese'])
|
|
)
|
|
})
|
|
})
|