Files
genoffice/apps/docs/tests/pua-blank-font.test.ts
T
merrick-2002andGenOffice 6d9b6812dd Sync snapshot (2026-08-23) (#130)
- Convert scanned PDFs to editable text with local OCR, running through the operating system's own engine on macOS and Windows
- Add a much richer AI workflow to Docs, PDF, and Markdown: selection-scoped questions, batched edits, character-level edits, comment and tracked-change awareness, citations back to the source block, and in-document image generation
- Let Slides open the same presentation in a second window and edit it from both
- Improve PDF to Excel table recovery: tables spanning pages merge into one worksheet, and label/value grids and rule-less statement bands become real rows
- Fix a large wave of Word layout fidelity in Docs, Excel parity in Sheets, and PowerPoint import fidelity in Slides

Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
2026-08-23 23:10:02 +08:00

27 lines
1.0 KiB
TypeScript

/**
* Contract of the bundled PUA blanker (tools/build-pua-blank-font.py): every
* BMP Private Use codepoint maps to a blank 1em glyph, so AI-residue PUA
* tokens stay invisible (Chromium never system-falls-back for PUA and would
* otherwise draw the primary font's .notdef box).
*/
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import { advanceEm, readWoff2 } from './helpers/woff2-metrics'
const font = readWoff2(join(__dirname, '../src/renderer/fonts/GenOfficePUABlank.woff2'))
describe('GenOffice PUA Blank', () => {
it('covers the whole BMP Private Use Area at a 1em advance', () => {
for (const cp of [0xe000, 0xe200, 0xe202, 0xf0b7, 0xf8ff]) {
expect(font.cmap.get(cp)).toBeDefined()
expect(advanceEm(font, cp)).toBe(1)
}
expect(font.cmap.get(0xdfff)).toBeUndefined()
expect(font.cmap.get(0xf900)).toBeUndefined()
})
it('maps everything to one glyph besides .notdef (blank by construction)', () => {
expect(new Set(font.cmap.values()).size).toBe(1)
})
})