Repository navigation
Description
Why
ISO 32000-1, 9.8.2 (Table 123 and the paragraph after it) and ISO 32000-2, 9.8.2: the Nonsymbolic flag says the font's character set is the Adobe standard Latin set or a subset of it; "if the font contains any glyphs outside this set, the Symbolic flag shall be set and the Nonsymbolic flag shall be clear". ISO 19005-2, 6.2.11.2 and ISO 14289-1, 7.21.2 make the file conform to 9.6 and 9.7 and the font specifications they cite. The set is the table of D.2 "Latin Character Set and Encodings" in the held ISO 32000-1.
TrueTypeFontEmbedder.BuildFontDescriptor starts every descriptor at flags = 32 (Nonsymbolic), adding FixedPitch and Italic from the post table, and never sets Symbolic (TrueTypeFontEmbedder.cs, var flags = 32; // Nonsymbolic).
Measured on origin/main 8c39d8d: the in-tree DejaVu Sans, a Kernel page showing Hello, wörld € Ω ☃ (a Greek capital omega and a snowman, neither in D.2), saved under no claim. The descriptor's /Flags has bit 6 set (Nonsymbolic) and bit 3 clear (Symbolic); the skipped test asserts the reverse and fails with "Expected: 4, Actual: 0". The same holds for the emoji and mathematical-alphanumeric subset (U+1F600, U+1D538) and for the Source Sans 3 Extra Light fixture.
Every fixture passes veraPDF 1.30.4 under 2b, 2u, 2a and UA-1 while carrying the flag. Its rules that read the flag (6.2.11.6-1 to 6-4 and 7.21.6-1 to 6-4) do not fire on these files: the embedded programs have no cmap table, and the first rule would fail a Nonsymbolic program without one, so the profile applies them to simple fonts only. The flag only chooses an implicit base encoding for a simple font, so no reader is known to draw differently; the text is what is wrong.
Sweep: git grep -n -w Flags over src on origin/main, leaving out Reader, Conformance and doc comments, finds the descriptor key in TrueTypeFontEmbedder.cs and the link annotation's F entry in PdfLinkAnnotation.cs, which is a different key. Layout, Signing, Barcodes, Cli and Fonts.Standard14 write no font descriptor. The one writer of a font descriptor is the one above.
Proposal
Set Symbolic and clear Nonsymbolic when any character of the subset (the code points the embedder holds, which it already tracks) is outside D.2's Latin set; the library's WinAnsiEncoding table is a close stand-in for it, plus the characters D.2 adds. Keep Nonsymbolic for a subset that is entirely Latin. The output changes only for subsets with a non-Latin glyph, and every such descriptor's /Flags moves from 32 to 4 plus the pitch and italic bits.
Acceptance
- The skipped test
ConformanceAuditG2Tests.Iso32000_1_9_8_2_ASubsetWithGlyphsOutsideTheLatinSetIsMarkedSymbolicruns and passes. - A subset of Latin characters only keeps
/Flags32, byte for byte. - veraPDF 2b, 2u, 2a and UA-1 still accept every fixture of
ConformanceAuditG2Tests.
Activity
test: pin text and font output to its ISO clauses (#755)