mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-08 18:51:35 +00:00
Legacy type in a composite font such as HeiseiMin-W3-83pv-RKSJ-H was decoded one byte to a character, so Japanese, Chinese and Korean type opened as unrelated single-byte characters, and the font name kept the CMap. Tf now finds a predefined CMap at the end of the font name, unless a TZ gives the font encoding pairs, and the font is the name without it. Strings in that font are read by the CMap's code space, mapped to CIDs with the predefined CMaps craft-pdf carries, then to Unicode by the character collection's CID-to-Unicode CMap. Codes the CMap doesn't map are dropped. A -V CMap is read with its -H form's codes. Codes in the Unicode CMaps (UCS2, UTF8, UTF16, UTF32) are read as Unicode; those helpers follow mockydevs' #6067. A 0x0D byte ends a paragraph and a 0x09 byte is a tab in these fonts too. The predefined CMaps craft-pdf doesn't carry (RKSJ, 78-RKSJ, 78ms-RKSJ, 78-EUC, 78, Add, Ext, NWP, GB, CNS1, KSC, B5 and the Hong Kong B5 sets other than HKscs-B5) are read with the nearest carried CMap, which can give a different character for some codes. GBT, GBT-EUC, GBTpc-EUC, CNS2 and KSC-Johab type still decodes byte by byte, with the CMap removed from the font name. Docs: docs/file-format-parity.md.