LibPDF: Use Appendix A instead of Appendix C for standard names

From "10 String INDEX":

"Further space saving is obtained by allocating commonly occurring
strings to predefined SIDs. These strings, known as the standard
strings, describe all the names used in the ISOAdobe and Expert
character sets along with a few other strings common to Type 1 fonts. A
complete list of standard strings is given in Appendix A.  The client
program will contain an array of standard strings with nStoStrings
elements. Thus, the standard strings take SIDs in the range 0 to
(nStaStrings-1)."

And "13 Charsets" says that charsets store SIDs.

Fixes all

    "Couldn't find string for SID $n, going with space"

messages when going through the encoding pages (page 1010 and
thereabouts) in the PDF 1.7 spec.
This commit is contained in:
Nico Weber 2023-10-13 11:53:18 -04:00 committed by Andreas Kling
parent aba787a441
commit 8060957d8d
Notes: sideshowbarker 2024-07-17 10:54:57 +09:00

View file

@ -153,7 +153,7 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
return cff;
}
/// Appendix C: Predefined Charsets
/// Appendix A: Standard Strings
static constexpr Array s_cff_builtin_names {
".notdef"sv,
"space"sv,
@ -384,6 +384,168 @@ static constexpr Array s_cff_builtin_names {
"yacute"sv,
"ydieresis"sv,
"zcaron"sv,
"exclamsmall"sv,
"Hungarumlautsmall"sv,
"dollaroldstyle"sv,
"dollarsuperior"sv,
"ampersandsmall"sv,
"Acutesmall"sv,
"parenleftsuperior"sv,
"parenrightsuperior"sv,
"twodotenleader"sv,
"onedotenleader"sv,
"zerooldstyle"sv,
"oneoldstyle"sv,
"twooldstyle"sv,
"threeoldstyle"sv,
"fouroldstyle"sv,
"fiveoldstyle"sv,
"sixoldstyle"sv,
"sevenoldstyle"sv,
"eightoldstyle"sv,
"nineoldstyle"sv,
"commasuperior"sv,
"threequartersemdash"sv,
"periodsuperior"sv,
"questionsmall"sv,
"asuperior"sv,
"bsuperior"sv,
"centsuperior"sv,
"dsuperior"sv,
"esuperior"sv,
"isuperior"sv,
"lsuperior"sv,
"msuperior"sv,
"nsuperior"sv,
"osuperior"sv,
"rsuperior"sv,
"ssuperior"sv,
"tsuperior"sv,
"ff"sv,
"ffi"sv,
"ffl"sv,
"parenleftinferior"sv,
"parenrightinferior"sv,
"Circumflexsmall"sv,
"hyphensuperior"sv,
"Gravesmall"sv,
"Asmall"sv,
"Bsmall"sv,
"Csmall"sv,
"Dsmall"sv,
"Esmall"sv,
"Fsmall"sv,
"Gsmall"sv,
"Hsmall"sv,
"Ismall"sv,
"Jsmall"sv,
"Ksmall"sv,
"Lsmall"sv,
"Msmall"sv,
"Nsmall"sv,
"Osmall"sv,
"Psmall"sv,
"Qsmall"sv,
"Rsmall"sv,
"Ssmall"sv,
"Tsmall"sv,
"Usmall"sv,
"Vsmall"sv,
"Wsmall"sv,
"Xsmall"sv,
"Ysmall"sv,
"Zsmall"sv,
"colonmonetary"sv,
"onefitted"sv,
"rupiah"sv,
"Tildesmall"sv,
"exclamdownsmall"sv,
"centoldstyle"sv,
"Lslashsmall"sv,
"Scaronsmall"sv,
"Zcaronsmall"sv,
"Dieresissmall"sv,
"Brevesmall"sv,
"Caronsmall"sv,
"Dotaccentsmall"sv,
"Macronsmall"sv,
"figuredash"sv,
"hypheninferior"sv,
"Ogoneksmall"sv,
"Ringsmall"sv,
"Cedillasmall"sv,
"questiondownsmall"sv,
"oneeighth"sv,
"threeeighths"sv,
"fiveeighths"sv,
"seveneighths"sv,
"onethird"sv,
"twothirds"sv,
"zerosuperior"sv,
"foursuperior"sv,
"fivesuperior"sv,
"sixsuperior"sv,
"sevensuperior"sv,
"eightsuperior"sv,
"ninesuperior"sv,
"zeroinferior"sv,
"oneinferior"sv,
"twoinferior"sv,
"threeinferior"sv,
"fourinferior"sv,
"fiveinferior"sv,
"sixinferior"sv,
"seveninferior"sv,
"eightinferior"sv,
"nineinferior"sv,
"centinferior"sv,
"dollarinferior"sv,
"periodinferior"sv,
"commainferior"sv,
"Agravesmall"sv,
"Aacutesmall"sv,
"Acircumflexsmall"sv,
"Atildesmall"sv,
"Adieresissmall"sv,
"Aringsmall"sv,
"AEsmall"sv,
"Ccedillasmall"sv,
"Egravesmall"sv,
"Eacutesmall"sv,
"Ecircumflexsmall"sv,
"Edieresissmall"sv,
"Igravesmall"sv,
"Iacutesmall"sv,
"Icircumflexsmall"sv,
"Idieresissmall"sv,
"Ethsmall"sv,
"Ntildesmall"sv,
"Ogravesmall"sv,
"Oacutesmall"sv,
"Ocircumflexsmall"sv,
"Otildesmall"sv,
"Odieresissmall"sv,
"OEsmall"sv,
"Oslashsmall"sv,
"Ugravesmall"sv,
"Uacutesmall"sv,
"Ucircumflexsmall"sv,
"Udieresissmall"sv,
"Yacutesmall"sv,
"Thornsmall"sv,
"Ydieresissmall"sv,
"001.000"sv,
"001.001"sv,
"001.002"sv,
"001.003"sv,
"Black"sv,
"Bold"sv,
"Book"sv,
"Light"sv,
"Medium"sv,
"Regular"sv,
"Roman"sv,
"Semibold"sv,
};
PDFErrorOr<Vector<StringView>> CFF::parse_strings(Reader& reader)