pdf: split oversized Rust files under the 500-line limit
- Commit
72caadcd92ba7edc214fde8299629005e8ff5a46- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 20:22 UTC (4 days ago)
- Parents
f45e4cc
afm.rs (1282), glyphlist.rs (1214), cff.rs (674), color.rs (548) and filters.rs (506) all exceeded the rustFileLength limit of 500 lines enforced by the Gradle build. Split each along its existing include! part pattern: pure data tables (AFM widths, glyph lists, CFF encoding names) and whole functions (colour-space array parsing, LZW decoding) move verbatim into new *_partN.rs files spliced into the same module, so every item, visibility and call path is identical and no public or crate-internal surface changes. Doc comments that documented the moved items move with them. Verified: cargo fmt -p pdf_render -- --check clean and cargo test -p pdf_render --locked green (676 passed).
Diff
pdf/src/main/rust/src/afm.rs
diff --git a/pdf/src/main/rust/src/afm.rs b/pdf/src/main/rust/src/afm.rsindex 5d22547c53..fcdfdbabf2 100644--- a/pdf/src/main/rust/src/afm.rs+++ b/pdf/src/main/rust/src/afm.rs@@ -118,1165 +118,7 @@ fn build_courier() -> HashMap<String, f64> { // accented glyphs and punctuation). // --------------------------------------------------------------------------- -static HELVETICA: &[(&str, u16)] = &[- ("Euro", 556),- ("space", 278),- ("exclam", 278),- ("quotedbl", 355),- ("numbersign", 556),- ("dollar", 556),- ("percent", 889),- ("ampersand", 667),- ("quotesingle", 191),- ("quoteright", 222),- ("parenleft", 333),- ("parenright", 333),- ("asterisk", 389),- ("plus", 584),- ("comma", 278),- ("hyphen", 333),- ("period", 278),- ("slash", 278),- ("zero", 556),- ("one", 556),- ("two", 556),- ("three", 556),- ("four", 556),- ("five", 556),- ("six", 556),- ("seven", 556),- ("eight", 556),- ("nine", 556),- ("colon", 278),- ("semicolon", 278),- ("less", 584),- ("equal", 584),- ("greater", 584),- ("question", 556),- ("at", 1015),- ("A", 667),- ("B", 667),- ("C", 722),- ("D", 722),- ("E", 667),- ("F", 611),- ("G", 778),- ("H", 722),- ("I", 278),- ("J", 500),- ("K", 667),- ("L", 556),- ("M", 833),- ("N", 722),- ("O", 778),- ("P", 667),- ("Q", 778),- ("R", 722),- ("S", 667),- ("T", 611),- ("U", 722),- ("V", 667),- ("W", 944),- ("X", 667),- ("Y", 667),- ("Z", 611),- ("bracketleft", 278),- ("backslash", 278),- ("bracketright", 278),- ("asciicircum", 469),- ("underscore", 556),- ("grave", 333),- ("quoteleft", 222),- ("a", 556),- ("b", 556),- ("c", 500),- ("d", 556),- ("e", 556),- ("f", 278),- ("g", 556),- ("h", 556),- ("i", 222),- ("j", 222),- ("k", 500),- ("l", 222),- ("m", 833),- ("n", 556),- ("o", 556),- ("p", 556),- ("q", 556),- ("r", 333),- ("s", 500),- ("t", 278),- ("u", 556),- ("v", 500),- ("w", 722),- ("x", 500),- ("y", 500),- ("z", 500),- ("braceleft", 334),- ("bar", 260),- ("braceright", 334),- ("asciitilde", 584),- // Latin-1 / punctuation extras.- ("exclamdown", 333),- ("cent", 556),- ("sterling", 556),- ("fraction", 167),- ("yen", 556),- ("florin", 556),- ("section", 556),- ("currency", 556),- ("quotedblleft", 333),- ("guillemotleft", 556),- ("guilsinglleft", 333),- ("guilsinglright", 333),- ("fi", 500),- ("fl", 500),- ("endash", 556),- ("dagger", 556),- ("daggerdbl", 556),- ("periodcentered", 278),- ("paragraph", 537),- ("bullet", 350),- ("quotesinglbase", 222),- ("quotedblbase", 333),- ("quotedblright", 333),- ("guillemotright", 556),- ("ellipsis", 1000),- ("perthousand", 1000),- ("questiondown", 611),- ("acute", 333),- ("circumflex", 333),- ("tilde", 333),- ("macron", 333),- ("breve", 333),- ("dotaccent", 333),- ("dieresis", 333),- ("ring", 333),- ("cedilla", 333),- ("hungarumlaut", 333),- ("ogonek", 333),- ("caron", 333),- ("emdash", 1000),- ("AE", 1000),- ("ordfeminine", 370),- ("Lslash", 556),- ("Oslash", 778),- ("OE", 1000),- ("ordmasculine", 365),- ("ae", 889),- ("dotlessi", 278),- ("lslash", 222),- ("oslash", 611),- ("oe", 944),- ("germandbls", 611),- ("Aacute", 667),- ("Acircumflex", 667),- ("Adieresis", 667),- ("Agrave", 667),- ("Aring", 667),- ("Atilde", 667),- ("Ccedilla", 722),- ("Eacute", 667),- ("Ecircumflex", 667),- ("Edieresis", 667),- ("Egrave", 667),- ("Iacute", 278),- ("Icircumflex", 278),- ("Idieresis", 278),- ("Igrave", 278),- ("Ntilde", 722),- ("Oacute", 778),- ("Ocircumflex", 778),- ("Odieresis", 778),- ("Ograve", 778),- ("Otilde", 778),- ("Scaron", 667),- ("Uacute", 722),- ("Ucircumflex", 722),- ("Udieresis", 722),- ("Ugrave", 722),- ("Yacute", 667),- ("Ydieresis", 667),- ("Zcaron", 611),- ("Thorn", 667),- ("Eth", 722),- ("aacute", 556),- ("acircumflex", 556),- ("adieresis", 556),- ("agrave", 556),- ("aring", 556),- ("atilde", 556),- ("ccedilla", 500),- ("eacute", 556),- ("ecircumflex", 556),- ("edieresis", 556),- ("egrave", 556),- ("iacute", 278),- ("icircumflex", 278),- ("idieresis", 278),- ("igrave", 278),- ("ntilde", 556),- ("oacute", 556),- ("ocircumflex", 556),- ("odieresis", 556),- ("ograve", 556),- ("otilde", 556),- ("scaron", 500),- ("uacute", 556),- ("ucircumflex", 556),- ("udieresis", 556),- ("ugrave", 556),- ("yacute", 500),- ("ydieresis", 500),- ("zcaron", 500),- ("thorn", 556),- ("eth", 556),- ("mu", 556),- ("degree", 400),- ("plusminus", 584),- ("twosuperior", 333),- ("threesuperior", 333),- ("onesuperior", 333),- ("onehalf", 834),- ("onequarter", 834),- ("threequarters", 834),- ("multiply", 584),- ("divide", 584),- ("brokenbar", 260),- ("logicalnot", 584),- ("registered", 737),- ("copyright", 737),- ("trademark", 1000),- ("minus", 584),-];--static HELVETICA_BOLD: &[(&str, u16)] = &[- ("Euro", 556),- ("space", 278),- ("exclam", 333),- ("quotedbl", 474),- ("numbersign", 556),- ("dollar", 556),- ("percent", 889),- ("ampersand", 722),- ("quotesingle", 238),- ("quoteright", 278),- ("parenleft", 333),- ("parenright", 333),- ("asterisk", 389),- ("plus", 584),- ("comma", 278),- ("hyphen", 333),- ("period", 278),- ("slash", 278),- ("zero", 556),- ("one", 556),- ("two", 556),- ("three", 556),- ("four", 556),- ("five", 556),- ("six", 556),- ("seven", 556),- ("eight", 556),- ("nine", 556),- ("colon", 333),- ("semicolon", 333),- ("less", 584),- ("equal", 584),- ("greater", 584),- ("question", 611),- ("at", 975),- ("A", 722),- ("B", 722),- ("C", 722),- ("D", 722),- ("E", 667),- ("F", 611),- ("G", 778),- ("H", 722),- ("I", 278),- ("J", 556),- ("K", 722),- ("L", 611),- ("M", 833),- ("N", 722),- ("O", 778),- ("P", 667),- ("Q", 778),- ("R", 722),- ("S", 667),- ("T", 611),- ("U", 722),- ("V", 667),- ("W", 944),- ("X", 667),- ("Y", 667),- ("Z", 611),- ("bracketleft", 333),- ("backslash", 278),- ("bracketright", 333),- ("asciicircum", 584),- ("underscore", 556),- ("grave", 333),- ("quoteleft", 278),- ("a", 556),- ("b", 611),- ("c", 556),- ("d", 611),- ("e", 556),- ("f", 333),- ("g", 611),- ("h", 611),- ("i", 278),- ("j", 278),- ("k", 556),- ("l", 278),- ("m", 889),- ("n", 611),- ("o", 611),- ("p", 611),- ("q", 611),- ("r", 389),- ("s", 556),- ("t", 333),- ("u", 611),- ("v", 556),- ("w", 778),- ("x", 556),- ("y", 556),- ("z", 500),- ("braceleft", 389),- ("bar", 280),- ("braceright", 389),- ("asciitilde", 584),- ("exclamdown", 333),- ("cent", 556),- ("sterling", 556),- ("fraction", 167),- ("yen", 556),- ("florin", 556),- ("section", 556),- ("currency", 556),- ("quotedblleft", 500),- ("guillemotleft", 556),- ("guilsinglleft", 333),- ("guilsinglright", 333),- ("fi", 611),- ("fl", 611),- ("endash", 556),- ("dagger", 556),- ("daggerdbl", 556),- ("periodcentered", 278),- ("paragraph", 556),- ("bullet", 350),- ("quotesinglbase", 278),- ("quotedblbase", 500),- ("quotedblright", 500),- ("guillemotright", 556),- ("ellipsis", 1000),- ("perthousand", 1000),- ("questiondown", 611),- ("acute", 333),- ("circumflex", 333),- ("tilde", 333),- ("macron", 333),- ("breve", 333),- ("dotaccent", 333),- ("dieresis", 333),- ("ring", 333),- ("cedilla", 333),- ("hungarumlaut", 333),- ("ogonek", 333),- ("caron", 333),- ("emdash", 1000),- ("AE", 1000),- ("ordfeminine", 370),- ("Lslash", 611),- ("Oslash", 778),- ("OE", 1000),- ("ordmasculine", 365),- ("ae", 889),- ("dotlessi", 278),- ("lslash", 278),- ("oslash", 611),- ("oe", 944),- ("germandbls", 611),- ("Aacute", 722),- ("Acircumflex", 722),- ("Adieresis", 722),- ("Agrave", 722),- ("Aring", 722),- ("Atilde", 722),- ("Ccedilla", 722),- ("Eacute", 667),- ("Ecircumflex", 667),- ("Edieresis", 667),- ("Egrave", 667),- ("Iacute", 278),- ("Icircumflex", 278),- ("Idieresis", 278),- ("Igrave", 278),- ("Ntilde", 722),- ("Oacute", 778),- ("Ocircumflex", 778),- ("Odieresis", 778),- ("Ograve", 778),- ("Otilde", 778),- ("Scaron", 667),- ("Uacute", 722),- ("Ucircumflex", 722),- ("Udieresis", 722),- ("Ugrave", 722),- ("Yacute", 667),- ("Ydieresis", 667),- ("Zcaron", 611),- ("Thorn", 667),- ("Eth", 722),- ("aacute", 556),- ("acircumflex", 556),- ("adieresis", 556),- ("agrave", 556),- ("aring", 556),- ("atilde", 556),- ("ccedilla", 556),- ("eacute", 556),- ("ecircumflex", 556),- ("edieresis", 556),- ("egrave", 556),- ("iacute", 278),- ("icircumflex", 278),- ("idieresis", 278),- ("igrave", 278),- ("ntilde", 611),- ("oacute", 611),- ("ocircumflex", 611),- ("odieresis", 611),- ("ograve", 611),- ("otilde", 611),- ("scaron", 556),- ("uacute", 611),- ("ucircumflex", 611),- ("udieresis", 611),- ("ugrave", 611),- ("yacute", 556),- ("ydieresis", 556),- ("zcaron", 500),- ("thorn", 611),- ("eth", 611),- ("mu", 611),- ("degree", 400),- ("plusminus", 584),- ("twosuperior", 333),- ("threesuperior", 333),- ("onesuperior", 333),- ("onehalf", 834),- ("onequarter", 834),- ("threequarters", 834),- ("multiply", 584),- ("divide", 584),- ("brokenbar", 280),- ("logicalnot", 584),- ("registered", 737),- ("copyright", 737),- ("trademark", 1000),- ("minus", 584),-];--static TIMES_ROMAN: &[(&str, u16)] = &[- ("Euro", 500),- ("space", 250),- ("exclam", 333),- ("quotedbl", 408),- ("numbersign", 500),- ("dollar", 500),- ("percent", 833),- ("ampersand", 778),- ("quotesingle", 180),- ("quoteright", 333),- ("parenleft", 333),- ("parenright", 333),- ("asterisk", 500),- ("plus", 564),- ("comma", 250),- ("hyphen", 333),- ("period", 250),- ("slash", 278),- ("zero", 500),- ("one", 500),- ("two", 500),- ("three", 500),- ("four", 500),- ("five", 500),- ("six", 500),- ("seven", 500),- ("eight", 500),- ("nine", 500),- ("colon", 278),- ("semicolon", 278),- ("less", 564),- ("equal", 564),- ("greater", 564),- ("question", 444),- ("at", 921),- ("A", 722),- ("B", 667),- ("C", 667),- ("D", 722),- ("E", 611),- ("F", 556),- ("G", 722),- ("H", 722),- ("I", 333),- ("J", 389),- ("K", 722),- ("L", 611),- ("M", 889),- ("N", 722),- ("O", 722),- ("P", 556),- ("Q", 722),- ("R", 667),- ("S", 556),- ("T", 611),- ("U", 722),- ("V", 722),- ("W", 944),- ("X", 722),- ("Y", 722),- ("Z", 611),- ("bracketleft", 333),- ("backslash", 278),- ("bracketright", 333),- ("asciicircum", 469),- ("underscore", 500),- ("grave", 333),- ("quoteleft", 333),- ("a", 444),- ("b", 500),- ("c", 444),- ("d", 500),- ("e", 444),- ("f", 333),- ("g", 500),- ("h", 500),- ("i", 278),- ("j", 278),- ("k", 500),- ("l", 278),- ("m", 778),- ("n", 500),- ("o", 500),- ("p", 500),- ("q", 500),- ("r", 333),- ("s", 389),- ("t", 278),- ("u", 500),- ("v", 500),- ("w", 722),- ("x", 500),- ("y", 500),- ("z", 444),- ("braceleft", 480),- ("bar", 200),- ("braceright", 480),- ("asciitilde", 541),- ("exclamdown", 333),- ("cent", 500),- ("sterling", 500),- ("fraction", 167),- ("yen", 500),- ("florin", 500),- ("section", 500),- ("currency", 500),- ("quotedblleft", 444),- ("guillemotleft", 500),- ("guilsinglleft", 333),- ("guilsinglright", 333),- ("fi", 556),- ("fl", 556),- ("endash", 500),- ("dagger", 500),- ("daggerdbl", 500),- ("periodcentered", 250),- ("paragraph", 453),- ("bullet", 350),- ("quotesinglbase", 333),- ("quotedblbase", 444),- ("quotedblright", 444),- ("guillemotright", 500),- ("ellipsis", 1000),- ("perthousand", 1000),- ("questiondown", 444),- ("acute", 333),- ("circumflex", 333),- ("tilde", 333),- ("macron", 333),- ("breve", 333),- ("dotaccent", 333),- ("dieresis", 333),- ("ring", 333),- ("cedilla", 333),- ("hungarumlaut", 333),- ("ogonek", 333),- ("caron", 333),- ("emdash", 1000),- ("AE", 889),- ("ordfeminine", 276),- ("Lslash", 611),- ("Oslash", 722),- ("OE", 889),- ("ordmasculine", 310),- ("ae", 667),- ("dotlessi", 278),- ("lslash", 278),- ("oslash", 500),- ("oe", 722),- ("germandbls", 500),- ("Aacute", 722),- ("Acircumflex", 722),- ("Adieresis", 722),- ("Agrave", 722),- ("Aring", 722),- ("Atilde", 722),- ("Ccedilla", 667),- ("Eacute", 611),- ("Ecircumflex", 611),- ("Edieresis", 611),- ("Egrave", 611),- ("Iacute", 333),- ("Icircumflex", 333),- ("Idieresis", 333),- ("Igrave", 333),- ("Ntilde", 722),- ("Oacute", 722),- ("Ocircumflex", 722),- ("Odieresis", 722),- ("Ograve", 722),- ("Otilde", 722),- ("Scaron", 556),- ("Uacute", 722),- ("Ucircumflex", 722),- ("Udieresis", 722),- ("Ugrave", 722),- ("Yacute", 722),- ("Ydieresis", 722),- ("Zcaron", 611),- ("Thorn", 556),- ("Eth", 722),- ("aacute", 444),- ("acircumflex", 444),- ("adieresis", 444),- ("agrave", 444),- ("aring", 444),- ("atilde", 444),- ("ccedilla", 444),- ("eacute", 444),- ("ecircumflex", 444),- ("edieresis", 444),- ("egrave", 444),- ("iacute", 278),- ("icircumflex", 278),- ("idieresis", 278),- ("igrave", 278),- ("ntilde", 500),- ("oacute", 500),- ("ocircumflex", 500),- ("odieresis", 500),- ("ograve", 500),- ("otilde", 500),- ("scaron", 389),- ("uacute", 500),- ("ucircumflex", 500),- ("udieresis", 500),- ("ugrave", 500),- ("yacute", 500),- ("ydieresis", 500),- ("zcaron", 444),- ("thorn", 500),- ("eth", 500),- ("mu", 500),- ("degree", 400),- ("plusminus", 564),- ("twosuperior", 300),- ("threesuperior", 300),- ("onesuperior", 300),- ("onehalf", 750),- ("onequarter", 750),- ("threequarters", 750),- ("multiply", 564),- ("divide", 564),- ("brokenbar", 200),- ("logicalnot", 564),- ("registered", 760),- ("copyright", 760),- ("trademark", 980),- ("minus", 564),-];--static TIMES_BOLD: &[(&str, u16)] = &[- ("Euro", 500),- ("space", 250),- ("exclam", 333),- ("quotedbl", 555),- ("numbersign", 500),- ("dollar", 500),- ("percent", 1000),- ("ampersand", 833),- ("quotesingle", 278),- ("quoteright", 333),- ("parenleft", 333),- ("parenright", 333),- ("asterisk", 500),- ("plus", 570),- ("comma", 250),- ("hyphen", 333),- ("period", 250),- ("slash", 278),- ("zero", 500),- ("one", 500),- ("two", 500),- ("three", 500),- ("four", 500),- ("five", 500),- ("six", 500),- ("seven", 500),- ("eight", 500),- ("nine", 500),- ("colon", 333),- ("semicolon", 333),- ("less", 570),- ("equal", 570),- ("greater", 570),- ("question", 500),- ("at", 930),- ("A", 722),- ("B", 667),- ("C", 722),- ("D", 722),- ("E", 667),- ("F", 611),- ("G", 778),- ("H", 778),- ("I", 389),- ("J", 500),- ("K", 778),- ("L", 667),- ("M", 944),- ("N", 722),- ("O", 778),- ("P", 611),- ("Q", 778),- ("R", 722),- ("S", 556),- ("T", 667),- ("U", 722),- ("V", 722),- ("W", 1000),- ("X", 722),- ("Y", 722),- ("Z", 667),- ("bracketleft", 333),- ("backslash", 278),- ("bracketright", 333),- ("asciicircum", 581),- ("underscore", 500),- ("grave", 333),- ("quoteleft", 333),- ("a", 500),- ("b", 556),- ("c", 444),- ("d", 556),- ("e", 444),- ("f", 333),- ("g", 500),- ("h", 556),- ("i", 278),- ("j", 333),- ("k", 556),- ("l", 278),- ("m", 833),- ("n", 556),- ("o", 500),- ("p", 556),- ("q", 556),- ("r", 444),- ("s", 389),- ("t", 333),- ("u", 556),- ("v", 500),- ("w", 722),- ("x", 500),- ("y", 500),- ("z", 444),- ("braceleft", 394),- ("bar", 220),- ("braceright", 394),- ("asciitilde", 520),- ("exclamdown", 333),- ("cent", 500),- ("sterling", 500),- ("fraction", 167),- ("yen", 500),- ("florin", 500),- ("section", 500),- ("currency", 500),- ("quotedblleft", 500),- ("guillemotleft", 500),- ("guilsinglleft", 333),- ("guilsinglright", 333),- ("fi", 556),- ("fl", 556),- ("endash", 500),- ("dagger", 500),- ("daggerdbl", 500),- ("periodcentered", 250),- ("paragraph", 540),- ("bullet", 350),- ("quotesinglbase", 333),- ("quotedblbase", 500),- ("quotedblright", 500),- ("guillemotright", 500),- ("ellipsis", 1000),- ("perthousand", 1000),- ("questiondown", 500),- ("acute", 333),- ("circumflex", 333),- ("tilde", 333),- ("macron", 333),- ("breve", 333),- ("dotaccent", 333),- ("dieresis", 333),- ("ring", 333),- ("cedilla", 333),- ("hungarumlaut", 333),- ("ogonek", 333),- ("caron", 333),- ("emdash", 1000),- ("AE", 1000),- ("ordfeminine", 300),- ("Lslash", 667),- ("Oslash", 778),- ("OE", 1000),- ("ordmasculine", 330),- ("ae", 722),- ("dotlessi", 278),- ("lslash", 278),- ("oslash", 500),- ("oe", 722),- ("germandbls", 556),- ("Aacute", 722),- ("Acircumflex", 722),- ("Adieresis", 722),- ("Agrave", 722),- ("Aring", 722),- ("Atilde", 722),- ("Ccedilla", 722),- ("Eacute", 667),- ("Ecircumflex", 667),- ("Edieresis", 667),- ("Egrave", 667),- ("Iacute", 389),- ("Icircumflex", 389),- ("Idieresis", 389),- ("Igrave", 389),- ("Ntilde", 722),- ("Oacute", 778),- ("Ocircumflex", 778),- ("Odieresis", 778),- ("Ograve", 778),- ("Otilde", 778),- ("Scaron", 556),- ("Uacute", 722),- ("Ucircumflex", 722),- ("Udieresis", 722),- ("Ugrave", 722),- ("Yacute", 722),- ("Ydieresis", 722),- ("Zcaron", 667),- ("Thorn", 611),- ("Eth", 722),- ("aacute", 500),- ("acircumflex", 500),- ("adieresis", 500),- ("agrave", 500),- ("aring", 500),- ("atilde", 500),- ("ccedilla", 444),- ("eacute", 444),- ("ecircumflex", 444),- ("edieresis", 444),- ("egrave", 444),- ("iacute", 278),- ("icircumflex", 278),- ("idieresis", 278),- ("igrave", 278),- ("ntilde", 556),- ("oacute", 500),- ("ocircumflex", 500),- ("odieresis", 500),- ("ograve", 500),- ("otilde", 500),- ("scaron", 389),- ("uacute", 556),- ("ucircumflex", 556),- ("udieresis", 556),- ("ugrave", 556),- ("yacute", 500),- ("ydieresis", 500),- ("zcaron", 444),- ("thorn", 556),- ("eth", 500),- ("mu", 556),- ("degree", 400),- ("plusminus", 570),- ("twosuperior", 300),- ("threesuperior", 300),- ("onesuperior", 300),- ("onehalf", 750),- ("onequarter", 750),- ("threequarters", 750),- ("multiply", 570),- ("divide", 570),- ("brokenbar", 220),- ("logicalnot", 570),- ("registered", 747),- ("copyright", 747),- ("trademark", 1000),- ("minus", 570),-];--static TIMES_ITALIC: &[(&str, u16)] = &[- ("Euro", 500),- ("space", 250),- ("exclam", 333),- ("quotedbl", 420),- ("numbersign", 500),- ("dollar", 500),- ("percent", 833),- ("ampersand", 778),- ("quotesingle", 214),- ("quoteright", 333),- ("parenleft", 333),- ("parenright", 333),- ("asterisk", 500),- ("plus", 675),- ("comma", 250),- ("hyphen", 333),- ("period", 250),- ("slash", 278),- ("zero", 500),- ("one", 500),- ("two", 500),- ("three", 500),- ("four", 500),- ("five", 500),- ("six", 500),- ("seven", 500),- ("eight", 500),- ("nine", 500),- ("colon", 333),- ("semicolon", 333),- ("less", 675),- ("equal", 675),- ("greater", 675),- ("question", 500),- ("at", 920),- ("A", 611),- ("B", 611),- ("C", 667),- ("D", 722),- ("E", 611),- ("F", 611),- ("G", 722),- ("H", 722),- ("I", 333),- ("J", 444),- ("K", 667),- ("L", 556),- ("M", 833),- ("N", 667),- ("O", 722),- ("P", 611),- ("Q", 722),- ("R", 611),- ("S", 500),- ("T", 556),- ("U", 722),- ("V", 611),- ("W", 833),- ("X", 611),- ("Y", 556),- ("Z", 556),- ("bracketleft", 389),- ("backslash", 278),- ("bracketright", 389),- ("asciicircum", 422),- ("underscore", 500),- ("grave", 333),- ("quoteleft", 333),- ("a", 500),- ("b", 500),- ("c", 444),- ("d", 500),- ("e", 444),- ("f", 278),- ("g", 500),- ("h", 500),- ("i", 278),- ("j", 278),- ("k", 444),- ("l", 278),- ("m", 722),- ("n", 500),- ("o", 500),- ("p", 500),- ("q", 500),- ("r", 389),- ("s", 389),- ("t", 278),- ("u", 500),- ("v", 444),- ("w", 667),- ("x", 444),- ("y", 444),- ("z", 389),- ("braceleft", 400),- ("bar", 275),- ("braceright", 400),- ("asciitilde", 541),- ("exclamdown", 389),- ("cent", 500),- ("sterling", 500),- ("fraction", 167),- ("yen", 500),- ("florin", 500),- ("section", 500),- ("currency", 500),- ("quotedblleft", 556),- ("guillemotleft", 500),- ("guilsinglleft", 333),- ("guilsinglright", 333),- ("fi", 500),- ("fl", 500),- ("endash", 500),- ("dagger", 500),- ("daggerdbl", 500),- ("periodcentered", 250),- ("paragraph", 523),- ("bullet", 350),- ("quotesinglbase", 333),- ("quotedblbase", 556),- ("quotedblright", 556),- ("guillemotright", 500),- ("ellipsis", 889),- ("perthousand", 1000),- ("questiondown", 500),- ("acute", 333),- ("circumflex", 333),- ("tilde", 333),- ("macron", 333),- ("breve", 333),- ("dotaccent", 333),- ("dieresis", 333),- ("ring", 333),- ("cedilla", 333),- ("hungarumlaut", 333),- ("ogonek", 333),- ("caron", 333),- ("emdash", 889),- ("AE", 889),- ("ordfeminine", 276),- ("Lslash", 556),- ("Oslash", 722),- ("OE", 944),- ("ordmasculine", 310),- ("ae", 667),- ("dotlessi", 278),- ("lslash", 278),- ("oslash", 500),- ("oe", 667),- ("germandbls", 500),- ("Aacute", 611),- ("Acircumflex", 611),- ("Adieresis", 611),- ("Agrave", 611),- ("Aring", 611),- ("Atilde", 611),- ("Ccedilla", 667),- ("Eacute", 611),- ("Ecircumflex", 611),- ("Edieresis", 611),- ("Egrave", 611),- ("Iacute", 333),- ("Icircumflex", 333),- ("Idieresis", 333),- ("Igrave", 333),- ("Ntilde", 667),- ("Oacute", 722),- ("Ocircumflex", 722),- ("Odieresis", 722),- ("Ograve", 722),- ("Otilde", 722),- ("Scaron", 500),- ("Uacute", 722),- ("Ucircumflex", 722),- ("Udieresis", 722),- ("Ugrave", 722),- ("Yacute", 556),- ("Ydieresis", 556),- ("Zcaron", 556),- ("Thorn", 611),- ("Eth", 722),- ("aacute", 500),- ("acircumflex", 500),- ("adieresis", 500),- ("agrave", 500),- ("aring", 500),- ("atilde", 500),- ("ccedilla", 444),- ("eacute", 444),- ("ecircumflex", 444),- ("edieresis", 444),- ("egrave", 444),- ("iacute", 278),- ("icircumflex", 278),- ("idieresis", 278),- ("igrave", 278),- ("ntilde", 500),- ("oacute", 500),- ("ocircumflex", 500),- ("odieresis", 500),- ("ograve", 500),- ("otilde", 500),- ("scaron", 389),- ("uacute", 500),- ("ucircumflex", 500),- ("udieresis", 500),- ("ugrave", 500),- ("yacute", 444),- ("ydieresis", 444),- ("zcaron", 389),- ("thorn", 500),- ("eth", 500),- ("mu", 500),- ("degree", 400),- ("plusminus", 675),- ("twosuperior", 300),- ("threesuperior", 300),- ("onesuperior", 300),- ("onehalf", 750),- ("onequarter", 750),- ("threequarters", 750),- ("multiply", 675),- ("divide", 675),- ("brokenbar", 275),- ("logicalnot", 675),- ("registered", 760),- ("copyright", 760),- ("trademark", 980),- ("minus", 675),-];- include!("afm_part1.rs");+include!("afm_part2.rs");+include!("afm_part3.rs");+include!("afm_part4.rs");
pdf/src/main/rust/src/afm_part2.rs
diff --git a/pdf/src/main/rust/src/afm_part2.rs b/pdf/src/main/rust/src/afm_part2.rsnew file mode 100644index 0000000000..d933258dec--- /dev/null+++ b/pdf/src/main/rust/src/afm_part2.rs@@ -0,0 +1,465 @@+static HELVETICA: &[(&str, u16)] = &[+ ("Euro", 556),+ ("space", 278),+ ("exclam", 278),+ ("quotedbl", 355),+ ("numbersign", 556),+ ("dollar", 556),+ ("percent", 889),+ ("ampersand", 667),+ ("quotesingle", 191),+ ("quoteright", 222),+ ("parenleft", 333),+ ("parenright", 333),+ ("asterisk", 389),+ ("plus", 584),+ ("comma", 278),+ ("hyphen", 333),+ ("period", 278),+ ("slash", 278),+ ("zero", 556),+ ("one", 556),+ ("two", 556),+ ("three", 556),+ ("four", 556),+ ("five", 556),+ ("six", 556),+ ("seven", 556),+ ("eight", 556),+ ("nine", 556),+ ("colon", 278),+ ("semicolon", 278),+ ("less", 584),+ ("equal", 584),+ ("greater", 584),+ ("question", 556),+ ("at", 1015),+ ("A", 667),+ ("B", 667),+ ("C", 722),+ ("D", 722),+ ("E", 667),+ ("F", 611),+ ("G", 778),+ ("H", 722),+ ("I", 278),+ ("J", 500),+ ("K", 667),+ ("L", 556),+ ("M", 833),+ ("N", 722),+ ("O", 778),+ ("P", 667),+ ("Q", 778),+ ("R", 722),+ ("S", 667),+ ("T", 611),+ ("U", 722),+ ("V", 667),+ ("W", 944),+ ("X", 667),+ ("Y", 667),+ ("Z", 611),+ ("bracketleft", 278),+ ("backslash", 278),+ ("bracketright", 278),+ ("asciicircum", 469),+ ("underscore", 556),+ ("grave", 333),+ ("quoteleft", 222),+ ("a", 556),+ ("b", 556),+ ("c", 500),+ ("d", 556),+ ("e", 556),+ ("f", 278),+ ("g", 556),+ ("h", 556),+ ("i", 222),+ ("j", 222),+ ("k", 500),+ ("l", 222),+ ("m", 833),+ ("n", 556),+ ("o", 556),+ ("p", 556),+ ("q", 556),+ ("r", 333),+ ("s", 500),+ ("t", 278),+ ("u", 556),+ ("v", 500),+ ("w", 722),+ ("x", 500),+ ("y", 500),+ ("z", 500),+ ("braceleft", 334),+ ("bar", 260),+ ("braceright", 334),+ ("asciitilde", 584),+ // Latin-1 / punctuation extras.+ ("exclamdown", 333),+ ("cent", 556),+ ("sterling", 556),+ ("fraction", 167),+ ("yen", 556),+ ("florin", 556),+ ("section", 556),+ ("currency", 556),+ ("quotedblleft", 333),+ ("guillemotleft", 556),+ ("guilsinglleft", 333),+ ("guilsinglright", 333),+ ("fi", 500),+ ("fl", 500),+ ("endash", 556),+ ("dagger", 556),+ ("daggerdbl", 556),+ ("periodcentered", 278),+ ("paragraph", 537),+ ("bullet", 350),+ ("quotesinglbase", 222),+ ("quotedblbase", 333),+ ("quotedblright", 333),+ ("guillemotright", 556),+ ("ellipsis", 1000),+ ("perthousand", 1000),+ ("questiondown", 611),+ ("acute", 333),+ ("circumflex", 333),+ ("tilde", 333),+ ("macron", 333),+ ("breve", 333),+ ("dotaccent", 333),+ ("dieresis", 333),+ ("ring", 333),+ ("cedilla", 333),+ ("hungarumlaut", 333),+ ("ogonek", 333),+ ("caron", 333),+ ("emdash", 1000),+ ("AE", 1000),+ ("ordfeminine", 370),+ ("Lslash", 556),+ ("Oslash", 778),+ ("OE", 1000),+ ("ordmasculine", 365),+ ("ae", 889),+ ("dotlessi", 278),+ ("lslash", 222),+ ("oslash", 611),+ ("oe", 944),+ ("germandbls", 611),+ ("Aacute", 667),+ ("Acircumflex", 667),+ ("Adieresis", 667),+ ("Agrave", 667),+ ("Aring", 667),+ ("Atilde", 667),+ ("Ccedilla", 722),+ ("Eacute", 667),+ ("Ecircumflex", 667),+ ("Edieresis", 667),+ ("Egrave", 667),+ ("Iacute", 278),+ ("Icircumflex", 278),+ ("Idieresis", 278),+ ("Igrave", 278),+ ("Ntilde", 722),+ ("Oacute", 778),+ ("Ocircumflex", 778),+ ("Odieresis", 778),+ ("Ograve", 778),+ ("Otilde", 778),+ ("Scaron", 667),+ ("Uacute", 722),+ ("Ucircumflex", 722),+ ("Udieresis", 722),+ ("Ugrave", 722),+ ("Yacute", 667),+ ("Ydieresis", 667),+ ("Zcaron", 611),+ ("Thorn", 667),+ ("Eth", 722),+ ("aacute", 556),+ ("acircumflex", 556),+ ("adieresis", 556),+ ("agrave", 556),+ ("aring", 556),+ ("atilde", 556),+ ("ccedilla", 500),+ ("eacute", 556),+ ("ecircumflex", 556),+ ("edieresis", 556),+ ("egrave", 556),+ ("iacute", 278),+ ("icircumflex", 278),+ ("idieresis", 278),+ ("igrave", 278),+ ("ntilde", 556),+ ("oacute", 556),+ ("ocircumflex", 556),+ ("odieresis", 556),+ ("ograve", 556),+ ("otilde", 556),+ ("scaron", 500),+ ("uacute", 556),+ ("ucircumflex", 556),+ ("udieresis", 556),+ ("ugrave", 556),+ ("yacute", 500),+ ("ydieresis", 500),+ ("zcaron", 500),+ ("thorn", 556),+ ("eth", 556),+ ("mu", 556),+ ("degree", 400),+ ("plusminus", 584),+ ("twosuperior", 333),+ ("threesuperior", 333),+ ("onesuperior", 333),+ ("onehalf", 834),+ ("onequarter", 834),+ ("threequarters", 834),+ ("multiply", 584),+ ("divide", 584),+ ("brokenbar", 260),+ ("logicalnot", 584),+ ("registered", 737),+ ("copyright", 737),+ ("trademark", 1000),+ ("minus", 584),+];++static HELVETICA_BOLD: &[(&str, u16)] = &[+ ("Euro", 556),+ ("space", 278),+ ("exclam", 333),+ ("quotedbl", 474),+ ("numbersign", 556),+ ("dollar", 556),+ ("percent", 889),+ ("ampersand", 722),+ ("quotesingle", 238),+ ("quoteright", 278),+ ("parenleft", 333),+ ("parenright", 333),+ ("asterisk", 389),+ ("plus", 584),+ ("comma", 278),+ ("hyphen", 333),+ ("period", 278),+ ("slash", 278),+ ("zero", 556),+ ("one", 556),+ ("two", 556),+ ("three", 556),+ ("four", 556),+ ("five", 556),+ ("six", 556),+ ("seven", 556),+ ("eight", 556),+ ("nine", 556),+ ("colon", 333),+ ("semicolon", 333),+ ("less", 584),+ ("equal", 584),+ ("greater", 584),+ ("question", 611),+ ("at", 975),+ ("A", 722),+ ("B", 722),+ ("C", 722),+ ("D", 722),+ ("E", 667),+ ("F", 611),+ ("G", 778),+ ("H", 722),+ ("I", 278),+ ("J", 556),+ ("K", 722),+ ("L", 611),+ ("M", 833),+ ("N", 722),+ ("O", 778),+ ("P", 667),+ ("Q", 778),+ ("R", 722),+ ("S", 667),+ ("T", 611),+ ("U", 722),+ ("V", 667),+ ("W", 944),+ ("X", 667),+ ("Y", 667),+ ("Z", 611),+ ("bracketleft", 333),+ ("backslash", 278),+ ("bracketright", 333),+ ("asciicircum", 584),+ ("underscore", 556),+ ("grave", 333),+ ("quoteleft", 278),+ ("a", 556),+ ("b", 611),+ ("c", 556),+ ("d", 611),+ ("e", 556),+ ("f", 333),+ ("g", 611),+ ("h", 611),+ ("i", 278),+ ("j", 278),+ ("k", 556),+ ("l", 278),+ ("m", 889),+ ("n", 611),+ ("o", 611),+ ("p", 611),+ ("q", 611),+ ("r", 389),+ ("s", 556),+ ("t", 333),+ ("u", 611),+ ("v", 556),+ ("w", 778),+ ("x", 556),+ ("y", 556),+ ("z", 500),+ ("braceleft", 389),+ ("bar", 280),+ ("braceright", 389),+ ("asciitilde", 584),+ ("exclamdown", 333),+ ("cent", 556),+ ("sterling", 556),+ ("fraction", 167),+ ("yen", 556),+ ("florin", 556),+ ("section", 556),+ ("currency", 556),+ ("quotedblleft", 500),+ ("guillemotleft", 556),+ ("guilsinglleft", 333),+ ("guilsinglright", 333),+ ("fi", 611),+ ("fl", 611),+ ("endash", 556),+ ("dagger", 556),+ ("daggerdbl", 556),+ ("periodcentered", 278),+ ("paragraph", 556),+ ("bullet", 350),+ ("quotesinglbase", 278),+ ("quotedblbase", 500),+ ("quotedblright", 500),+ ("guillemotright", 556),+ ("ellipsis", 1000),+ ("perthousand", 1000),+ ("questiondown", 611),+ ("acute", 333),+ ("circumflex", 333),+ ("tilde", 333),+ ("macron", 333),+ ("breve", 333),+ ("dotaccent", 333),+ ("dieresis", 333),+ ("ring", 333),+ ("cedilla", 333),+ ("hungarumlaut", 333),+ ("ogonek", 333),+ ("caron", 333),+ ("emdash", 1000),+ ("AE", 1000),+ ("ordfeminine", 370),+ ("Lslash", 611),+ ("Oslash", 778),+ ("OE", 1000),+ ("ordmasculine", 365),+ ("ae", 889),+ ("dotlessi", 278),+ ("lslash", 278),+ ("oslash", 611),+ ("oe", 944),+ ("germandbls", 611),+ ("Aacute", 722),+ ("Acircumflex", 722),+ ("Adieresis", 722),+ ("Agrave", 722),+ ("Aring", 722),+ ("Atilde", 722),+ ("Ccedilla", 722),+ ("Eacute", 667),+ ("Ecircumflex", 667),+ ("Edieresis", 667),+ ("Egrave", 667),+ ("Iacute", 278),+ ("Icircumflex", 278),+ ("Idieresis", 278),+ ("Igrave", 278),+ ("Ntilde", 722),+ ("Oacute", 778),+ ("Ocircumflex", 778),+ ("Odieresis", 778),+ ("Ograve", 778),+ ("Otilde", 778),+ ("Scaron", 667),+ ("Uacute", 722),+ ("Ucircumflex", 722),+ ("Udieresis", 722),+ ("Ugrave", 722),+ ("Yacute", 667),+ ("Ydieresis", 667),+ ("Zcaron", 611),+ ("Thorn", 667),+ ("Eth", 722),+ ("aacute", 556),+ ("acircumflex", 556),+ ("adieresis", 556),+ ("agrave", 556),+ ("aring", 556),+ ("atilde", 556),+ ("ccedilla", 556),+ ("eacute", 556),+ ("ecircumflex", 556),+ ("edieresis", 556),+ ("egrave", 556),+ ("iacute", 278),+ ("icircumflex", 278),+ ("idieresis", 278),+ ("igrave", 278),+ ("ntilde", 611),+ ("oacute", 611),+ ("ocircumflex", 611),+ ("odieresis", 611),+ ("ograve", 611),+ ("otilde", 611),+ ("scaron", 556),+ ("uacute", 611),+ ("ucircumflex", 611),+ ("udieresis", 611),+ ("ugrave", 611),+ ("yacute", 556),+ ("ydieresis", 556),+ ("zcaron", 500),+ ("thorn", 611),+ ("eth", 611),+ ("mu", 611),+ ("degree", 400),+ ("plusminus", 584),+ ("twosuperior", 333),+ ("threesuperior", 333),+ ("onesuperior", 333),+ ("onehalf", 834),+ ("onequarter", 834),+ ("threequarters", 834),+ ("multiply", 584),+ ("divide", 584),+ ("brokenbar", 280),+ ("logicalnot", 584),+ ("registered", 737),+ ("copyright", 737),+ ("trademark", 1000),+ ("minus", 584),+];+
pdf/src/main/rust/src/afm_part3.rs
diff --git a/pdf/src/main/rust/src/afm_part3.rs b/pdf/src/main/rust/src/afm_part3.rsnew file mode 100644index 0000000000..8347f9b443--- /dev/null+++ b/pdf/src/main/rust/src/afm_part3.rs@@ -0,0 +1,464 @@+static TIMES_ROMAN: &[(&str, u16)] = &[+ ("Euro", 500),+ ("space", 250),+ ("exclam", 333),+ ("quotedbl", 408),+ ("numbersign", 500),+ ("dollar", 500),+ ("percent", 833),+ ("ampersand", 778),+ ("quotesingle", 180),+ ("quoteright", 333),+ ("parenleft", 333),+ ("parenright", 333),+ ("asterisk", 500),+ ("plus", 564),+ ("comma", 250),+ ("hyphen", 333),+ ("period", 250),+ ("slash", 278),+ ("zero", 500),+ ("one", 500),+ ("two", 500),+ ("three", 500),+ ("four", 500),+ ("five", 500),+ ("six", 500),+ ("seven", 500),+ ("eight", 500),+ ("nine", 500),+ ("colon", 278),+ ("semicolon", 278),+ ("less", 564),+ ("equal", 564),+ ("greater", 564),+ ("question", 444),+ ("at", 921),+ ("A", 722),+ ("B", 667),+ ("C", 667),+ ("D", 722),+ ("E", 611),+ ("F", 556),+ ("G", 722),+ ("H", 722),+ ("I", 333),+ ("J", 389),+ ("K", 722),+ ("L", 611),+ ("M", 889),+ ("N", 722),+ ("O", 722),+ ("P", 556),+ ("Q", 722),+ ("R", 667),+ ("S", 556),+ ("T", 611),+ ("U", 722),+ ("V", 722),+ ("W", 944),+ ("X", 722),+ ("Y", 722),+ ("Z", 611),+ ("bracketleft", 333),+ ("backslash", 278),+ ("bracketright", 333),+ ("asciicircum", 469),+ ("underscore", 500),+ ("grave", 333),+ ("quoteleft", 333),+ ("a", 444),+ ("b", 500),+ ("c", 444),+ ("d", 500),+ ("e", 444),+ ("f", 333),+ ("g", 500),+ ("h", 500),+ ("i", 278),+ ("j", 278),+ ("k", 500),+ ("l", 278),+ ("m", 778),+ ("n", 500),+ ("o", 500),+ ("p", 500),+ ("q", 500),+ ("r", 333),+ ("s", 389),+ ("t", 278),+ ("u", 500),+ ("v", 500),+ ("w", 722),+ ("x", 500),+ ("y", 500),+ ("z", 444),+ ("braceleft", 480),+ ("bar", 200),+ ("braceright", 480),+ ("asciitilde", 541),+ ("exclamdown", 333),+ ("cent", 500),+ ("sterling", 500),+ ("fraction", 167),+ ("yen", 500),+ ("florin", 500),+ ("section", 500),+ ("currency", 500),+ ("quotedblleft", 444),+ ("guillemotleft", 500),+ ("guilsinglleft", 333),+ ("guilsinglright", 333),+ ("fi", 556),+ ("fl", 556),+ ("endash", 500),+ ("dagger", 500),+ ("daggerdbl", 500),+ ("periodcentered", 250),+ ("paragraph", 453),+ ("bullet", 350),+ ("quotesinglbase", 333),+ ("quotedblbase", 444),+ ("quotedblright", 444),+ ("guillemotright", 500),+ ("ellipsis", 1000),+ ("perthousand", 1000),+ ("questiondown", 444),+ ("acute", 333),+ ("circumflex", 333),+ ("tilde", 333),+ ("macron", 333),+ ("breve", 333),+ ("dotaccent", 333),+ ("dieresis", 333),+ ("ring", 333),+ ("cedilla", 333),+ ("hungarumlaut", 333),+ ("ogonek", 333),+ ("caron", 333),+ ("emdash", 1000),+ ("AE", 889),+ ("ordfeminine", 276),+ ("Lslash", 611),+ ("Oslash", 722),+ ("OE", 889),+ ("ordmasculine", 310),+ ("ae", 667),+ ("dotlessi", 278),+ ("lslash", 278),+ ("oslash", 500),+ ("oe", 722),+ ("germandbls", 500),+ ("Aacute", 722),+ ("Acircumflex", 722),+ ("Adieresis", 722),+ ("Agrave", 722),+ ("Aring", 722),+ ("Atilde", 722),+ ("Ccedilla", 667),+ ("Eacute", 611),+ ("Ecircumflex", 611),+ ("Edieresis", 611),+ ("Egrave", 611),+ ("Iacute", 333),+ ("Icircumflex", 333),+ ("Idieresis", 333),+ ("Igrave", 333),+ ("Ntilde", 722),+ ("Oacute", 722),+ ("Ocircumflex", 722),+ ("Odieresis", 722),+ ("Ograve", 722),+ ("Otilde", 722),+ ("Scaron", 556),+ ("Uacute", 722),+ ("Ucircumflex", 722),+ ("Udieresis", 722),+ ("Ugrave", 722),+ ("Yacute", 722),+ ("Ydieresis", 722),+ ("Zcaron", 611),+ ("Thorn", 556),+ ("Eth", 722),+ ("aacute", 444),+ ("acircumflex", 444),+ ("adieresis", 444),+ ("agrave", 444),+ ("aring", 444),+ ("atilde", 444),+ ("ccedilla", 444),+ ("eacute", 444),+ ("ecircumflex", 444),+ ("edieresis", 444),+ ("egrave", 444),+ ("iacute", 278),+ ("icircumflex", 278),+ ("idieresis", 278),+ ("igrave", 278),+ ("ntilde", 500),+ ("oacute", 500),+ ("ocircumflex", 500),+ ("odieresis", 500),+ ("ograve", 500),+ ("otilde", 500),+ ("scaron", 389),+ ("uacute", 500),+ ("ucircumflex", 500),+ ("udieresis", 500),+ ("ugrave", 500),+ ("yacute", 500),+ ("ydieresis", 500),+ ("zcaron", 444),+ ("thorn", 500),+ ("eth", 500),+ ("mu", 500),+ ("degree", 400),+ ("plusminus", 564),+ ("twosuperior", 300),+ ("threesuperior", 300),+ ("onesuperior", 300),+ ("onehalf", 750),+ ("onequarter", 750),+ ("threequarters", 750),+ ("multiply", 564),+ ("divide", 564),+ ("brokenbar", 200),+ ("logicalnot", 564),+ ("registered", 760),+ ("copyright", 760),+ ("trademark", 980),+ ("minus", 564),+];++static TIMES_BOLD: &[(&str, u16)] = &[+ ("Euro", 500),+ ("space", 250),+ ("exclam", 333),+ ("quotedbl", 555),+ ("numbersign", 500),+ ("dollar", 500),+ ("percent", 1000),+ ("ampersand", 833),+ ("quotesingle", 278),+ ("quoteright", 333),+ ("parenleft", 333),+ ("parenright", 333),+ ("asterisk", 500),+ ("plus", 570),+ ("comma", 250),+ ("hyphen", 333),+ ("period", 250),+ ("slash", 278),+ ("zero", 500),+ ("one", 500),+ ("two", 500),+ ("three", 500),+ ("four", 500),+ ("five", 500),+ ("six", 500),+ ("seven", 500),+ ("eight", 500),+ ("nine", 500),+ ("colon", 333),+ ("semicolon", 333),+ ("less", 570),+ ("equal", 570),+ ("greater", 570),+ ("question", 500),+ ("at", 930),+ ("A", 722),+ ("B", 667),+ ("C", 722),+ ("D", 722),+ ("E", 667),+ ("F", 611),+ ("G", 778),+ ("H", 778),+ ("I", 389),+ ("J", 500),+ ("K", 778),+ ("L", 667),+ ("M", 944),+ ("N", 722),+ ("O", 778),+ ("P", 611),+ ("Q", 778),+ ("R", 722),+ ("S", 556),+ ("T", 667),+ ("U", 722),+ ("V", 722),+ ("W", 1000),+ ("X", 722),+ ("Y", 722),+ ("Z", 667),+ ("bracketleft", 333),+ ("backslash", 278),+ ("bracketright", 333),+ ("asciicircum", 581),+ ("underscore", 500),+ ("grave", 333),+ ("quoteleft", 333),+ ("a", 500),+ ("b", 556),+ ("c", 444),+ ("d", 556),+ ("e", 444),+ ("f", 333),+ ("g", 500),+ ("h", 556),+ ("i", 278),+ ("j", 333),+ ("k", 556),+ ("l", 278),+ ("m", 833),+ ("n", 556),+ ("o", 500),+ ("p", 556),+ ("q", 556),+ ("r", 444),+ ("s", 389),+ ("t", 333),+ ("u", 556),+ ("v", 500),+ ("w", 722),+ ("x", 500),+ ("y", 500),+ ("z", 444),+ ("braceleft", 394),+ ("bar", 220),+ ("braceright", 394),+ ("asciitilde", 520),+ ("exclamdown", 333),+ ("cent", 500),+ ("sterling", 500),+ ("fraction", 167),+ ("yen", 500),+ ("florin", 500),+ ("section", 500),+ ("currency", 500),+ ("quotedblleft", 500),+ ("guillemotleft", 500),+ ("guilsinglleft", 333),+ ("guilsinglright", 333),+ ("fi", 556),+ ("fl", 556),+ ("endash", 500),+ ("dagger", 500),+ ("daggerdbl", 500),+ ("periodcentered", 250),+ ("paragraph", 540),+ ("bullet", 350),+ ("quotesinglbase", 333),+ ("quotedblbase", 500),+ ("quotedblright", 500),+ ("guillemotright", 500),+ ("ellipsis", 1000),+ ("perthousand", 1000),+ ("questiondown", 500),+ ("acute", 333),+ ("circumflex", 333),+ ("tilde", 333),+ ("macron", 333),+ ("breve", 333),+ ("dotaccent", 333),+ ("dieresis", 333),+ ("ring", 333),+ ("cedilla", 333),+ ("hungarumlaut", 333),+ ("ogonek", 333),+ ("caron", 333),+ ("emdash", 1000),+ ("AE", 1000),+ ("ordfeminine", 300),+ ("Lslash", 667),+ ("Oslash", 778),+ ("OE", 1000),+ ("ordmasculine", 330),+ ("ae", 722),+ ("dotlessi", 278),+ ("lslash", 278),+ ("oslash", 500),+ ("oe", 722),+ ("germandbls", 556),+ ("Aacute", 722),+ ("Acircumflex", 722),+ ("Adieresis", 722),+ ("Agrave", 722),+ ("Aring", 722),+ ("Atilde", 722),+ ("Ccedilla", 722),+ ("Eacute", 667),+ ("Ecircumflex", 667),+ ("Edieresis", 667),+ ("Egrave", 667),+ ("Iacute", 389),+ ("Icircumflex", 389),+ ("Idieresis", 389),+ ("Igrave", 389),+ ("Ntilde", 722),+ ("Oacute", 778),+ ("Ocircumflex", 778),+ ("Odieresis", 778),+ ("Ograve", 778),+ ("Otilde", 778),+ ("Scaron", 556),+ ("Uacute", 722),+ ("Ucircumflex", 722),+ ("Udieresis", 722),+ ("Ugrave", 722),+ ("Yacute", 722),+ ("Ydieresis", 722),+ ("Zcaron", 667),+ ("Thorn", 611),+ ("Eth", 722),+ ("aacute", 500),+ ("acircumflex", 500),+ ("adieresis", 500),+ ("agrave", 500),+ ("aring", 500),+ ("atilde", 500),+ ("ccedilla", 444),+ ("eacute", 444),+ ("ecircumflex", 444),+ ("edieresis", 444),+ ("egrave", 444),+ ("iacute", 278),+ ("icircumflex", 278),+ ("idieresis", 278),+ ("igrave", 278),+ ("ntilde", 556),+ ("oacute", 500),+ ("ocircumflex", 500),+ ("odieresis", 500),+ ("ograve", 500),+ ("otilde", 500),+ ("scaron", 389),+ ("uacute", 556),+ ("ucircumflex", 556),+ ("udieresis", 556),+ ("ugrave", 556),+ ("yacute", 500),+ ("ydieresis", 500),+ ("zcaron", 444),+ ("thorn", 556),+ ("eth", 500),+ ("mu", 556),+ ("degree", 400),+ ("plusminus", 570),+ ("twosuperior", 300),+ ("threesuperior", 300),+ ("onesuperior", 300),+ ("onehalf", 750),+ ("onequarter", 750),+ ("threequarters", 750),+ ("multiply", 570),+ ("divide", 570),+ ("brokenbar", 220),+ ("logicalnot", 570),+ ("registered", 747),+ ("copyright", 747),+ ("trademark", 1000),+ ("minus", 570),+];+
pdf/src/main/rust/src/afm_part4.rs
diff --git a/pdf/src/main/rust/src/afm_part4.rs b/pdf/src/main/rust/src/afm_part4.rsnew file mode 100644index 0000000000..f7e50c45cc--- /dev/null+++ b/pdf/src/main/rust/src/afm_part4.rs@@ -0,0 +1,232 @@+static TIMES_ITALIC: &[(&str, u16)] = &[+ ("Euro", 500),+ ("space", 250),+ ("exclam", 333),+ ("quotedbl", 420),+ ("numbersign", 500),+ ("dollar", 500),+ ("percent", 833),+ ("ampersand", 778),+ ("quotesingle", 214),+ ("quoteright", 333),+ ("parenleft", 333),+ ("parenright", 333),+ ("asterisk", 500),+ ("plus", 675),+ ("comma", 250),+ ("hyphen", 333),+ ("period", 250),+ ("slash", 278),+ ("zero", 500),+ ("one", 500),+ ("two", 500),+ ("three", 500),+ ("four", 500),+ ("five", 500),+ ("six", 500),+ ("seven", 500),+ ("eight", 500),+ ("nine", 500),+ ("colon", 333),+ ("semicolon", 333),+ ("less", 675),+ ("equal", 675),+ ("greater", 675),+ ("question", 500),+ ("at", 920),+ ("A", 611),+ ("B", 611),+ ("C", 667),+ ("D", 722),+ ("E", 611),+ ("F", 611),+ ("G", 722),+ ("H", 722),+ ("I", 333),+ ("J", 444),+ ("K", 667),+ ("L", 556),+ ("M", 833),+ ("N", 667),+ ("O", 722),+ ("P", 611),+ ("Q", 722),+ ("R", 611),+ ("S", 500),+ ("T", 556),+ ("U", 722),+ ("V", 611),+ ("W", 833),+ ("X", 611),+ ("Y", 556),+ ("Z", 556),+ ("bracketleft", 389),+ ("backslash", 278),+ ("bracketright", 389),+ ("asciicircum", 422),+ ("underscore", 500),+ ("grave", 333),+ ("quoteleft", 333),+ ("a", 500),+ ("b", 500),+ ("c", 444),+ ("d", 500),+ ("e", 444),+ ("f", 278),+ ("g", 500),+ ("h", 500),+ ("i", 278),+ ("j", 278),+ ("k", 444),+ ("l", 278),+ ("m", 722),+ ("n", 500),+ ("o", 500),+ ("p", 500),+ ("q", 500),+ ("r", 389),+ ("s", 389),+ ("t", 278),+ ("u", 500),+ ("v", 444),+ ("w", 667),+ ("x", 444),+ ("y", 444),+ ("z", 389),+ ("braceleft", 400),+ ("bar", 275),+ ("braceright", 400),+ ("asciitilde", 541),+ ("exclamdown", 389),+ ("cent", 500),+ ("sterling", 500),+ ("fraction", 167),+ ("yen", 500),+ ("florin", 500),+ ("section", 500),+ ("currency", 500),+ ("quotedblleft", 556),+ ("guillemotleft", 500),+ ("guilsinglleft", 333),+ ("guilsinglright", 333),+ ("fi", 500),+ ("fl", 500),+ ("endash", 500),+ ("dagger", 500),+ ("daggerdbl", 500),+ ("periodcentered", 250),+ ("paragraph", 523),+ ("bullet", 350),+ ("quotesinglbase", 333),+ ("quotedblbase", 556),+ ("quotedblright", 556),+ ("guillemotright", 500),+ ("ellipsis", 889),+ ("perthousand", 1000),+ ("questiondown", 500),+ ("acute", 333),+ ("circumflex", 333),+ ("tilde", 333),+ ("macron", 333),+ ("breve", 333),+ ("dotaccent", 333),+ ("dieresis", 333),+ ("ring", 333),+ ("cedilla", 333),+ ("hungarumlaut", 333),+ ("ogonek", 333),+ ("caron", 333),+ ("emdash", 889),+ ("AE", 889),+ ("ordfeminine", 276),+ ("Lslash", 556),+ ("Oslash", 722),+ ("OE", 944),+ ("ordmasculine", 310),+ ("ae", 667),+ ("dotlessi", 278),+ ("lslash", 278),+ ("oslash", 500),+ ("oe", 667),+ ("germandbls", 500),+ ("Aacute", 611),+ ("Acircumflex", 611),+ ("Adieresis", 611),+ ("Agrave", 611),+ ("Aring", 611),+ ("Atilde", 611),+ ("Ccedilla", 667),+ ("Eacute", 611),+ ("Ecircumflex", 611),+ ("Edieresis", 611),+ ("Egrave", 611),+ ("Iacute", 333),+ ("Icircumflex", 333),+ ("Idieresis", 333),+ ("Igrave", 333),+ ("Ntilde", 667),+ ("Oacute", 722),+ ("Ocircumflex", 722),+ ("Odieresis", 722),+ ("Ograve", 722),+ ("Otilde", 722),+ ("Scaron", 500),+ ("Uacute", 722),+ ("Ucircumflex", 722),+ ("Udieresis", 722),+ ("Ugrave", 722),+ ("Yacute", 556),+ ("Ydieresis", 556),+ ("Zcaron", 556),+ ("Thorn", 611),+ ("Eth", 722),+ ("aacute", 500),+ ("acircumflex", 500),+ ("adieresis", 500),+ ("agrave", 500),+ ("aring", 500),+ ("atilde", 500),+ ("ccedilla", 444),+ ("eacute", 444),+ ("ecircumflex", 444),+ ("edieresis", 444),+ ("egrave", 444),+ ("iacute", 278),+ ("icircumflex", 278),+ ("idieresis", 278),+ ("igrave", 278),+ ("ntilde", 500),+ ("oacute", 500),+ ("ocircumflex", 500),+ ("odieresis", 500),+ ("ograve", 500),+ ("otilde", 500),+ ("scaron", 389),+ ("uacute", 500),+ ("ucircumflex", 500),+ ("udieresis", 500),+ ("ugrave", 500),+ ("yacute", 444),+ ("ydieresis", 444),+ ("zcaron", 389),+ ("thorn", 500),+ ("eth", 500),+ ("mu", 500),+ ("degree", 400),+ ("plusminus", 675),+ ("twosuperior", 300),+ ("threesuperior", 300),+ ("onesuperior", 300),+ ("onehalf", 750),+ ("onequarter", 750),+ ("threequarters", 750),+ ("multiply", 675),+ ("divide", 675),+ ("brokenbar", 275),+ ("logicalnot", 675),+ ("registered", 760),+ ("copyright", 760),+ ("trademark", 980),+ ("minus", 675),+];+
pdf/src/main/rust/src/cff.rs
diff --git a/pdf/src/main/rust/src/cff.rs b/pdf/src/main/rust/src/cff.rsindex f58694c61c..618203c0ce 100644--- a/pdf/src/main/rust/src/cff.rs+++ b/pdf/src/main/rust/src/cff.rs@@ -180,495 +180,6 @@ fn parse_dict(d: &[u8]) -> HashMap<u16, Vec<f64>> { out } -/// StandardEncoding names per PDF/PostScript spec (code -> glyph name)-const STANDARD_ENCODING_NAMES: [Option<&'static str>; 256] = [- None,- None,- None,- None,- None,- None,- None,- None, // 0-7- None,- None,- None,- None,- None,- None,- None,- None, // 8-15- None,- None,- None,- None,- None,- None,- None,- None, // 16-23- None,- None,- None,- None,- None,- None,- None,- None, // 24-31- Some("space"),- Some("exclam"),- Some("quotedbl"),- Some("numbersign"), // 32-35- Some("dollar"),- Some("percent"),- Some("ampersand"),- Some("quoteright"), // 36-39- Some("parenleft"),- Some("parenright"),- Some("asterisk"),- Some("plus"), // 40-43- Some("comma"),- Some("hyphen"),- Some("period"),- Some("slash"), //44-47- Some("zero"),- Some("one"),- Some("two"),- Some("three"), //48-51- Some("four"),- Some("five"),- Some("six"),- Some("seven"), //52-55- Some("eight"),- Some("nine"),- Some("colon"),- Some("semicolon"), //56-59- Some("less"),- Some("equal"),- Some("greater"),- Some("question"), //60-63- Some("at"),- Some("A"),- Some("B"),- Some("C"), //64-67- Some("D"),- Some("E"),- Some("F"),- Some("G"), //68-71- Some("H"),- Some("I"),- Some("J"),- Some("K"), //72-75- Some("L"),- Some("M"),- Some("N"),- Some("O"), //76-79- Some("P"),- Some("Q"),- Some("R"),- Some("S"), //80-83- Some("T"),- Some("U"),- Some("V"),- Some("W"), //84-87- Some("X"),- Some("Y"),- Some("Z"),- Some("bracketleft"), //88-91- Some("backslash"),- Some("bracketright"),- Some("asciicircum"),- Some("underscore"), //92-95- Some("quoteleft"),- Some("a"),- Some("b"),- Some("c"), //96-99- Some("d"),- Some("e"),- Some("f"),- Some("g"), //100-103- Some("h"),- Some("i"),- Some("j"),- Some("k"), //104-107- Some("l"),- Some("m"),- Some("n"),- Some("o"), //108-111- Some("p"),- Some("q"),- Some("r"),- Some("s"), //112-115- Some("t"),- Some("u"),- Some("v"),- Some("w"), //116-119- Some("x"),- Some("y"),- Some("z"),- Some("braceleft"), //120-123- Some("bar"),- Some("braceright"),- Some("asciitilde"),- None, //124-127- None,- None,- None,- None,- None,- None,- None,- None, //128-135- None,- None,- None,- None,- None,- None,- None,- None, //136-143- None,- None,- None,- None,- None,- None,- None,- None, //144-151- None,- None,- None,- None,- None,- None,- None,- None, //152-159- None, //160- Some("exclamdown"),- Some("cent"),- Some("sterling"),- Some("fraction"), //161-164- Some("yen"),- Some("florin"),- Some("section"),- Some("currency"), //165-168- Some("quotesingle"),- Some("quotedblleft"),- Some("guillemotleft"),- Some("guilsinglleft"), //169-172- Some("guilsinglright"),- Some("fi"),- Some("fl"),- None, //173-176- Some("endash"),- Some("dagger"),- Some("daggerdbl"),- Some("periodcentered"), //177-180- None,- Some("paragraph"),- Some("bullet"),- Some("quotesinglbase"), //181-184- Some("quotedblbase"),- Some("quotedblright"),- Some("guillemotright"),- Some("ellipsis"), //185-188- Some("perthousand"),- None,- Some("questiondown"), //189-191 (189 perthousand, 190 none, 191 questiondown)- Some("grave"),- Some("acute"),- Some("circumflex"),- Some("tilde"), //192-195- Some("macron"),- Some("breve"),- Some("dotaccent"),- Some("dieresis"), //196-199- None,- Some("ring"),- Some("cedilla"),- None, //200-203- Some("hungarumlaut"),- Some("ogonek"),- Some("caron"),- Some("emdash"), //204-207- None,- None,- None,- None,- None,- None,- None,- None, //208-215- None,- None,- None,- None,- None,- None,- None,- None, //216-223- Some("AE"),- Some("ordfeminine"),- None,- None,- None,- None,- Some("Lslash"),- Some("Oslash"), //224-231- Some("OE"),- Some("ordmasculine"),- Some("ae"),- None,- None,- None,- Some("lslash"),- Some("oslash"), //232-239- Some("oe"),- Some("germandbls"),- None,- None,- None,- None,- None,- None,- None,- None,- None,- None,- None,- None,- None,- None, //240-255 (remainder .notdef)-];--/// ExpertEncoding names (simplified but covering oldstyle and small caps per CFF spec)-const EXPERT_ENCODING_NAMES: [Option<&'static str>; 256] = {- let mut a: [Option<&'static str>; 256] = [None; 256];- // 32-127 populated below via const assignments in the original list- a[32] = Some("space");- a[33] = Some("exclamsmall");- a[34] = Some("Hungarumlautsmall");- a[36] = Some("dollaroldstyle");- a[37] = Some("dollarsuperior");- a[38] = Some("ampersandsmall");- a[39] = Some("Acutesmall");- a[40] = Some("parenleftsuperior");- a[41] = Some("parenrightsuperior");- a[42] = Some("twodotenleader");- a[43] = Some("onedotenleader");- a[44] = Some("comma");- a[45] = Some("hyphen");- a[46] = Some("period");- a[47] = Some("slash");- a[48] = Some("zerooldstyle");- a[49] = Some("oneoldstyle");- a[50] = Some("twooldstyle");- a[51] = Some("threeoldstyle");- a[52] = Some("fouroldstyle");- a[53] = Some("fiveoldstyle");- a[54] = Some("sixoldstyle");- a[55] = Some("sevenoldstyle");- a[56] = Some("eightoldstyle");- a[57] = Some("nineoldstyle");- a[58] = Some("commasuperior");- a[59] = Some("threequartersemdash");- a[60] = Some("periodsuperior");- a[62] = Some("asuperior");- a[63] = Some("bsuperior");- a[64] = Some("centsuperior");- a[65] = Some("dsuperior");- a[66] = Some("esuperior");- a[67] = Some("isuperior");- a[68] = Some("lsuperior");- a[69] = Some("msuperior");- a[70] = Some("nsuperior");- a[71] = Some("osuperior");- a[72] = Some("rsuperior");- a[73] = Some("ssuperior");- a[74] = Some("tsuperior");- a[75] = Some("ff");- a[76] = Some("fi");- a[77] = Some("fl");- a[78] = Some("ffi");- a[79] = Some("ffl");- a[80] = Some("parenleftinferior");- a[81] = Some("parenrightinferior");- a[82] = Some("Circumflexsmall");- a[83] = Some("hyphensuperior");- a[84] = Some("Gravesmall");- a[85] = Some("Asmall");- a[86] = Some("Bsmall");- a[87] = Some("Csmall");- a[88] = Some("Dsmall");- a[89] = Some("Esmall");- a[90] = Some("Fsmall");- a[91] = Some("Gsmall");- a[92] = Some("Hsmall");- a[93] = Some("Ismall");- a[94] = Some("Jsmall");- a[95] = Some("Ksmall");- a[96] = Some("Lsmall");- a[97] = Some("Msmall");- a[98] = Some("Nsmall");- a[99] = Some("Osmall");- a[100] = Some("Psmall");- a[101] = Some("Qsmall");- a[102] = Some("Rsmall");- a[103] = Some("Ssmall");- a[104] = Some("Tsmall");- a[105] = Some("Usmall");- a[106] = Some("Vsmall");- a[107] = Some("Wsmall");- a[108] = Some("Xsmall");- a[109] = Some("Ysmall");- a[110] = Some("Zsmall");- a[111] = Some("colonmonetary");- a[112] = Some("onefitted");- a[113] = Some("rupiah");- a[114] = Some("Tildesmall");- a[115] = Some("exclamdownsmall");- a[116] = Some("centoldstyle");- a[117] = Some("Lslashsmall");- a[118] = Some("Scaronsmall");- a[119] = Some("Zcaronsmall");- a[120] = Some("Dieresissmall");- a[121] = Some("Brevesmall");- a[122] = Some("Caronsmall");- a[123] = Some("Dotaccentsmall");- a[124] = Some("Macronsmall");- a[125] = Some("figuredash");- a[126] = Some("hypheninferior");- a[127] = Some("Ogoneksmall");- a[128] = Some("Ringsmall");- a[129] = Some("Cedillasmall");- a-};--fn sid_for_name(name: &str) -> Option<usize> {- STD_STRINGS.iter().position(|&n| n == name)-}--fn standard_encoding_map() -> HashMap<u8, usize> {- let mut m = HashMap::new();- for (code, opt_name) in STANDARD_ENCODING_NAMES.iter().enumerate() {- if let Some(name) = opt_name {- if let Some(sid) = sid_for_name(name) {- m.insert(code as u8, sid);- }- }- }- m-}--fn expert_encoding_map() -> HashMap<u8, usize> {- let mut m = HashMap::new();- for (code, opt_name) in EXPERT_ENCODING_NAMES.iter().enumerate() {- if let Some(name) = opt_name {- if let Some(sid) = sid_for_name(name) {- m.insert(code as u8, sid);- }- }- }- m-}--/// Custom encoding result: base code->GID and supplemental code->SID overrides-fn parse_custom_encoding(d: &[u8], off: usize) -> Option<(HashMap<u8, u16>, HashMap<u8, usize>)> {- let fmt = u8a(d, off)?;- let is_supplemental = (fmt & 0x80) != 0;- let base_fmt = fmt & 0x7F;- let mut base = HashMap::new();- let mut pos = off + 1;- if base_fmt == 0 {- let ncodes = u8a(d, pos)? as usize;- pos += 1;- if pos + ncodes > d.len() {- return None;- }- for i in 0..ncodes {- let code = u8a(d, pos + i)?;- base.insert(code, (i + 1) as u16);- }- pos += ncodes;- } else if base_fmt == 1 {- let nranges = u8a(d, pos)? as usize;- pos += 1;- let mut gid = 1u16;- for _ in 0..nranges {- if pos + 1 >= d.len() {- return None;- }- let first = u8a(d, pos)?;- let nleft = u8a(d, pos + 1)?;- pos += 2;- for k in 0..=nleft {- base.insert(first.wrapping_add(k), gid);- gid = gid.wrapping_add(1);- }- }- } else {- return None;- }- let mut supplements = HashMap::new();- if is_supplemental {- if pos >= d.len() {- return Some((base, supplements));- }- let nsups = u8a(d, pos)? as usize;- pos += 1;- for _ in 0..nsups {- if pos + 2 >= d.len() {- break;- }- let code = u8a(d, pos)?;- let sid = u16a(d, pos + 1)? as usize;- pos += 3;- supplements.insert(code, sid);- }- }- Some((base, supplements))-}--/// For a CID-keyed CFF (Top DICT has ROS, op 1230), parse the charset — which for-/// a CIDFont maps GID -> CID — and invert it to CID -> GID so a CID can select the-/// right glyph outline. Returns `None` for non-CID CFF or on parse failure.-pub fn cid_to_gid_map(d: &[u8]) -> Option<HashMap<u32, u16>> {- if u8a(d, 0)? != 1 {- return None;- }- let hdr_size = u8a(d, 2)? as usize;- if hdr_size < 4 || hdr_size > d.len() {- return None;- }- let name_idx = read_index(d, hdr_size)?;- let top_idx = read_index(d, name_idx.end)?;- let string_idx = read_index(d, top_idx.end)?;- let (ts, te) = *top_idx.entries.first()?;- let top = parse_dict(d.get(ts..te)?);- // Only CID-keyed fonts (ROS present) need CID->GID remapping.- if !top.contains_key(&1230) {- return None;- }- let cs_off = *top.get(&17)?.first()? as usize; // CharStrings INDEX offset (op 17)- let nglyphs = read_index(d, cs_off)?.entries.len();- if nglyphs == 0 || nglyphs > 65535 {- return None;- }- let charset_off = top.get(&15).and_then(|v| v.first()).copied().unwrap_or(0.0) as usize;- let mut map: HashMap<u32, u16> = HashMap::new();- map.insert(0, 0); // CID 0 (.notdef) -> GID 0- if charset_off > 2 {- // Custom charset: entries are CIDs for CID-keyed fonts.- let gid_to_cid = parse_charset(d, charset_off, nglyphs, string_idx.entries.len(), true)?;- for (gid, cid) in gid_to_cid {- map.insert(cid as u32, gid);- }- } else {- // Predefined charset offset (0/1/2): treat as identity (CID == GID).- for gid in 0..nglyphs as u16 {- map.insert(gid as u32, gid);- }- }- Some(map)-}- include!("cff_part1.rs");+include!("cff_part2.rs");+include!("cff_part3.rs");
pdf/src/main/rust/src/cff_part2.rs
diff --git a/pdf/src/main/rust/src/cff_part2.rs b/pdf/src/main/rust/src/cff_part2.rsnew file mode 100644index 0000000000..8c69972771--- /dev/null+++ b/pdf/src/main/rust/src/cff_part2.rs@@ -0,0 +1,259 @@+/// StandardEncoding names per PDF/PostScript spec (code -> glyph name)+const STANDARD_ENCODING_NAMES: [Option<&'static str>; 256] = [+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, // 0-7+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, // 8-15+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, // 16-23+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, // 24-31+ Some("space"),+ Some("exclam"),+ Some("quotedbl"),+ Some("numbersign"), // 32-35+ Some("dollar"),+ Some("percent"),+ Some("ampersand"),+ Some("quoteright"), // 36-39+ Some("parenleft"),+ Some("parenright"),+ Some("asterisk"),+ Some("plus"), // 40-43+ Some("comma"),+ Some("hyphen"),+ Some("period"),+ Some("slash"), //44-47+ Some("zero"),+ Some("one"),+ Some("two"),+ Some("three"), //48-51+ Some("four"),+ Some("five"),+ Some("six"),+ Some("seven"), //52-55+ Some("eight"),+ Some("nine"),+ Some("colon"),+ Some("semicolon"), //56-59+ Some("less"),+ Some("equal"),+ Some("greater"),+ Some("question"), //60-63+ Some("at"),+ Some("A"),+ Some("B"),+ Some("C"), //64-67+ Some("D"),+ Some("E"),+ Some("F"),+ Some("G"), //68-71+ Some("H"),+ Some("I"),+ Some("J"),+ Some("K"), //72-75+ Some("L"),+ Some("M"),+ Some("N"),+ Some("O"), //76-79+ Some("P"),+ Some("Q"),+ Some("R"),+ Some("S"), //80-83+ Some("T"),+ Some("U"),+ Some("V"),+ Some("W"), //84-87+ Some("X"),+ Some("Y"),+ Some("Z"),+ Some("bracketleft"), //88-91+ Some("backslash"),+ Some("bracketright"),+ Some("asciicircum"),+ Some("underscore"), //92-95+ Some("quoteleft"),+ Some("a"),+ Some("b"),+ Some("c"), //96-99+ Some("d"),+ Some("e"),+ Some("f"),+ Some("g"), //100-103+ Some("h"),+ Some("i"),+ Some("j"),+ Some("k"), //104-107+ Some("l"),+ Some("m"),+ Some("n"),+ Some("o"), //108-111+ Some("p"),+ Some("q"),+ Some("r"),+ Some("s"), //112-115+ Some("t"),+ Some("u"),+ Some("v"),+ Some("w"), //116-119+ Some("x"),+ Some("y"),+ Some("z"),+ Some("braceleft"), //120-123+ Some("bar"),+ Some("braceright"),+ Some("asciitilde"),+ None, //124-127+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //128-135+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //136-143+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //144-151+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //152-159+ None, //160+ Some("exclamdown"),+ Some("cent"),+ Some("sterling"),+ Some("fraction"), //161-164+ Some("yen"),+ Some("florin"),+ Some("section"),+ Some("currency"), //165-168+ Some("quotesingle"),+ Some("quotedblleft"),+ Some("guillemotleft"),+ Some("guilsinglleft"), //169-172+ Some("guilsinglright"),+ Some("fi"),+ Some("fl"),+ None, //173-176+ Some("endash"),+ Some("dagger"),+ Some("daggerdbl"),+ Some("periodcentered"), //177-180+ None,+ Some("paragraph"),+ Some("bullet"),+ Some("quotesinglbase"), //181-184+ Some("quotedblbase"),+ Some("quotedblright"),+ Some("guillemotright"),+ Some("ellipsis"), //185-188+ Some("perthousand"),+ None,+ Some("questiondown"), //189-191 (189 perthousand, 190 none, 191 questiondown)+ Some("grave"),+ Some("acute"),+ Some("circumflex"),+ Some("tilde"), //192-195+ Some("macron"),+ Some("breve"),+ Some("dotaccent"),+ Some("dieresis"), //196-199+ None,+ Some("ring"),+ Some("cedilla"),+ None, //200-203+ Some("hungarumlaut"),+ Some("ogonek"),+ Some("caron"),+ Some("emdash"), //204-207+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //208-215+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //216-223+ Some("AE"),+ Some("ordfeminine"),+ None,+ None,+ None,+ None,+ Some("Lslash"),+ Some("Oslash"), //224-231+ Some("OE"),+ Some("ordmasculine"),+ Some("ae"),+ None,+ None,+ None,+ Some("lslash"),+ Some("oslash"), //232-239+ Some("oe"),+ Some("germandbls"),+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None,+ None, //240-255 (remainder .notdef)+];
pdf/src/main/rust/src/cff_part3.rs
diff --git a/pdf/src/main/rust/src/cff_part3.rs b/pdf/src/main/rust/src/cff_part3.rsnew file mode 100644index 0000000000..1f5cd98ee0--- /dev/null+++ b/pdf/src/main/rust/src/cff_part3.rs@@ -0,0 +1,231 @@+/// ExpertEncoding names (simplified but covering oldstyle and small caps per CFF spec)+const EXPERT_ENCODING_NAMES: [Option<&'static str>; 256] = {+ let mut a: [Option<&'static str>; 256] = [None; 256];+ // 32-127 populated below via const assignments in the original list+ a[32] = Some("space");+ a[33] = Some("exclamsmall");+ a[34] = Some("Hungarumlautsmall");+ a[36] = Some("dollaroldstyle");+ a[37] = Some("dollarsuperior");+ a[38] = Some("ampersandsmall");+ a[39] = Some("Acutesmall");+ a[40] = Some("parenleftsuperior");+ a[41] = Some("parenrightsuperior");+ a[42] = Some("twodotenleader");+ a[43] = Some("onedotenleader");+ a[44] = Some("comma");+ a[45] = Some("hyphen");+ a[46] = Some("period");+ a[47] = Some("slash");+ a[48] = Some("zerooldstyle");+ a[49] = Some("oneoldstyle");+ a[50] = Some("twooldstyle");+ a[51] = Some("threeoldstyle");+ a[52] = Some("fouroldstyle");+ a[53] = Some("fiveoldstyle");+ a[54] = Some("sixoldstyle");+ a[55] = Some("sevenoldstyle");+ a[56] = Some("eightoldstyle");+ a[57] = Some("nineoldstyle");+ a[58] = Some("commasuperior");+ a[59] = Some("threequartersemdash");+ a[60] = Some("periodsuperior");+ a[62] = Some("asuperior");+ a[63] = Some("bsuperior");+ a[64] = Some("centsuperior");+ a[65] = Some("dsuperior");+ a[66] = Some("esuperior");+ a[67] = Some("isuperior");+ a[68] = Some("lsuperior");+ a[69] = Some("msuperior");+ a[70] = Some("nsuperior");+ a[71] = Some("osuperior");+ a[72] = Some("rsuperior");+ a[73] = Some("ssuperior");+ a[74] = Some("tsuperior");+ a[75] = Some("ff");+ a[76] = Some("fi");+ a[77] = Some("fl");+ a[78] = Some("ffi");+ a[79] = Some("ffl");+ a[80] = Some("parenleftinferior");+ a[81] = Some("parenrightinferior");+ a[82] = Some("Circumflexsmall");+ a[83] = Some("hyphensuperior");+ a[84] = Some("Gravesmall");+ a[85] = Some("Asmall");+ a[86] = Some("Bsmall");+ a[87] = Some("Csmall");+ a[88] = Some("Dsmall");+ a[89] = Some("Esmall");+ a[90] = Some("Fsmall");+ a[91] = Some("Gsmall");+ a[92] = Some("Hsmall");+ a[93] = Some("Ismall");+ a[94] = Some("Jsmall");+ a[95] = Some("Ksmall");+ a[96] = Some("Lsmall");+ a[97] = Some("Msmall");+ a[98] = Some("Nsmall");+ a[99] = Some("Osmall");+ a[100] = Some("Psmall");+ a[101] = Some("Qsmall");+ a[102] = Some("Rsmall");+ a[103] = Some("Ssmall");+ a[104] = Some("Tsmall");+ a[105] = Some("Usmall");+ a[106] = Some("Vsmall");+ a[107] = Some("Wsmall");+ a[108] = Some("Xsmall");+ a[109] = Some("Ysmall");+ a[110] = Some("Zsmall");+ a[111] = Some("colonmonetary");+ a[112] = Some("onefitted");+ a[113] = Some("rupiah");+ a[114] = Some("Tildesmall");+ a[115] = Some("exclamdownsmall");+ a[116] = Some("centoldstyle");+ a[117] = Some("Lslashsmall");+ a[118] = Some("Scaronsmall");+ a[119] = Some("Zcaronsmall");+ a[120] = Some("Dieresissmall");+ a[121] = Some("Brevesmall");+ a[122] = Some("Caronsmall");+ a[123] = Some("Dotaccentsmall");+ a[124] = Some("Macronsmall");+ a[125] = Some("figuredash");+ a[126] = Some("hypheninferior");+ a[127] = Some("Ogoneksmall");+ a[128] = Some("Ringsmall");+ a[129] = Some("Cedillasmall");+ a+};++fn sid_for_name(name: &str) -> Option<usize> {+ STD_STRINGS.iter().position(|&n| n == name)+}++fn standard_encoding_map() -> HashMap<u8, usize> {+ let mut m = HashMap::new();+ for (code, opt_name) in STANDARD_ENCODING_NAMES.iter().enumerate() {+ if let Some(name) = opt_name {+ if let Some(sid) = sid_for_name(name) {+ m.insert(code as u8, sid);+ }+ }+ }+ m+}++fn expert_encoding_map() -> HashMap<u8, usize> {+ let mut m = HashMap::new();+ for (code, opt_name) in EXPERT_ENCODING_NAMES.iter().enumerate() {+ if let Some(name) = opt_name {+ if let Some(sid) = sid_for_name(name) {+ m.insert(code as u8, sid);+ }+ }+ }+ m+}++/// Custom encoding result: base code->GID and supplemental code->SID overrides+fn parse_custom_encoding(d: &[u8], off: usize) -> Option<(HashMap<u8, u16>, HashMap<u8, usize>)> {+ let fmt = u8a(d, off)?;+ let is_supplemental = (fmt & 0x80) != 0;+ let base_fmt = fmt & 0x7F;+ let mut base = HashMap::new();+ let mut pos = off + 1;+ if base_fmt == 0 {+ let ncodes = u8a(d, pos)? as usize;+ pos += 1;+ if pos + ncodes > d.len() {+ return None;+ }+ for i in 0..ncodes {+ let code = u8a(d, pos + i)?;+ base.insert(code, (i + 1) as u16);+ }+ pos += ncodes;+ } else if base_fmt == 1 {+ let nranges = u8a(d, pos)? as usize;+ pos += 1;+ let mut gid = 1u16;+ for _ in 0..nranges {+ if pos + 1 >= d.len() {+ return None;+ }+ let first = u8a(d, pos)?;+ let nleft = u8a(d, pos + 1)?;+ pos += 2;+ for k in 0..=nleft {+ base.insert(first.wrapping_add(k), gid);+ gid = gid.wrapping_add(1);+ }+ }+ } else {+ return None;+ }+ let mut supplements = HashMap::new();+ if is_supplemental {+ if pos >= d.len() {+ return Some((base, supplements));+ }+ let nsups = u8a(d, pos)? as usize;+ pos += 1;+ for _ in 0..nsups {+ if pos + 2 >= d.len() {+ break;+ }+ let code = u8a(d, pos)?;+ let sid = u16a(d, pos + 1)? as usize;+ pos += 3;+ supplements.insert(code, sid);+ }+ }+ Some((base, supplements))+}++/// For a CID-keyed CFF (Top DICT has ROS, op 1230), parse the charset — which for+/// a CIDFont maps GID -> CID — and invert it to CID -> GID so a CID can select the+/// right glyph outline. Returns `None` for non-CID CFF or on parse failure.+pub fn cid_to_gid_map(d: &[u8]) -> Option<HashMap<u32, u16>> {+ if u8a(d, 0)? != 1 {+ return None;+ }+ let hdr_size = u8a(d, 2)? as usize;+ if hdr_size < 4 || hdr_size > d.len() {+ return None;+ }+ let name_idx = read_index(d, hdr_size)?;+ let top_idx = read_index(d, name_idx.end)?;+ let string_idx = read_index(d, top_idx.end)?;+ let (ts, te) = *top_idx.entries.first()?;+ let top = parse_dict(d.get(ts..te)?);+ // Only CID-keyed fonts (ROS present) need CID->GID remapping.+ if !top.contains_key(&1230) {+ return None;+ }+ let cs_off = *top.get(&17)?.first()? as usize; // CharStrings INDEX offset (op 17)+ let nglyphs = read_index(d, cs_off)?.entries.len();+ if nglyphs == 0 || nglyphs > 65535 {+ return None;+ }+ let charset_off = top.get(&15).and_then(|v| v.first()).copied().unwrap_or(0.0) as usize;+ let mut map: HashMap<u32, u16> = HashMap::new();+ map.insert(0, 0); // CID 0 (.notdef) -> GID 0+ if charset_off > 2 {+ // Custom charset: entries are CIDs for CID-keyed fonts.+ let gid_to_cid = parse_charset(d, charset_off, nglyphs, string_idx.entries.len(), true)?;+ for (gid, cid) in gid_to_cid {+ map.insert(cid as u32, gid);+ }+ } else {+ // Predefined charset offset (0/1/2): treat as identity (CID == GID).+ for gid in 0..nglyphs as u16 {+ map.insert(gid as u32, gid);+ }+ }+ Some(map)+}+
pdf/src/main/rust/src/color.rs
diff --git a/pdf/src/main/rust/src/color.rs b/pdf/src/main/rust/src/color.rsindex b31157cf70..155a62f7ac 100644--- a/pdf/src/main/rust/src/color.rs+++ b/pdf/src/main/rust/src/color.rs@@ -243,163 +243,6 @@ pub(crate) fn parse_named_cs( parse_cs_kind(doc, Some(cs_obj), cs_resources) } -fn parse_cs_array_at(- doc: &Document,- arr: &[Object],- cs_resources: &HashMap<Vec<u8>, ObjectId>,- depth: u32,-) -> Option<CsKind> {- if depth >= MAX_CS_DEPTH {- return None;- }- // Every nested colour space below goes through `parse_cs_kind_at` so the depth keeps- // accumulating across the array/kind boundary; a cycle alternates between the two.- let parse_cs_kind = |doc: &Document, o: Option<&Object>, r: &HashMap<Vec<u8>, ObjectId>| {- parse_cs_kind_at(doc, o, r, depth + 1)- };- // arr head is name- let head = arr.first().and_then(|o| o.as_name().ok()).unwrap_or(b"");- match head {- b"DeviceRGB" | b"RGB" => Some(CsKind::DeviceRGB),- b"DeviceCMYK" | b"CMYK" => Some(CsKind::DeviceCMYK),- b"DeviceGray" | b"G" | b"Gray" => Some(CsKind::DeviceGray),- b"Pattern" => Some(CsKind::Pattern {- // [ /Pattern baseColorSpace ] for uncolored (PaintType 2) patterns.- base: arr.get(1).and_then(|o| parse_cs_kind(doc, Some(o), cs_resources)).map(Box::new),- }),- b"CalRGB" => {- // [ /CalRGB dict ]- let dict = arr.get(1).and_then(|o| deref(doc, o)).and_then(|o| o.as_dict().ok());- if let Some(d) = dict {- let white = read_white_point(d).unwrap_or([0.9505, 1.0, 1.0890]);- let gamma = read_gamma_rgb(d).unwrap_or([1.0, 1.0, 1.0]);- let matrix = read_matrix_cal(d).unwrap_or([- [1.0, 0.0, 0.0],- [0.0, 1.0, 0.0],- [0.0, 0.0, 1.0],- ]);- Some(CsKind::CalRGB { white, gamma, matrix })- } else {- Some(CsKind::DeviceRGB)- }- }- b"CalGray" => {- let dict = arr.get(1).and_then(|o| deref(doc, o)).and_then(|o| o.as_dict().ok());- if let Some(d) = dict {- let white = read_white_point(d).unwrap_or([0.9505, 1.0, 1.0890]);- let gamma =- d.get(b"Gamma").ok().and_then(num).filter(|g| g.is_finite()).unwrap_or(1.0);- Some(CsKind::CalGray { white, gamma })- } else {- Some(CsKind::DeviceGray)- }- }- b"Lab" => {- // [ /Lab dict ]- let dict = arr.get(1).and_then(|o| deref(doc, o)).and_then(|o| o.as_dict().ok());- if let Some(d) = dict {- let white = read_white_point(d).unwrap_or([0.9505, 1.0, 1.0890]);- let range = read_lab_range(d).unwrap_or([[-100.0, 100.0], [-100.0, 100.0]]);- Some(CsKind::Lab { white, range })- } else {- Some(CsKind::Lab {- white: [0.9505, 1.0, 1.0890],- range: [[-100.0, 100.0], [-100.0, 100.0]],- })- }- }- b"ICCBased" => {- let dict_obj = arr.get(1).and_then(|o| deref(doc, o));- // alt colorspace in dict /Alternate- let alt = match dict_obj {- Some(Object::Stream(s)) => s- .dict- .get(b"Alternate")- .ok()- .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))- .map(Box::new),- Some(Object::Dictionary(d)) => d- .get(b"Alternate")- .ok()- .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))- .map(Box::new),- _ => None,- };- // /N is required (§8.6.5.5) and must be 1, 3 or 4. When it is missing or- // bogus, infer from /Alternate rather than defaulting to 1: a wrong- // component count shifts every sample in an image and yields the- // distinctive diagonal-rainbow garbage. Accept a bare dictionary too,- // which `colorspace_info` already tolerated.- let declared = match dict_obj {- Some(Object::Stream(s)) => s.dict.get(b"N").ok().and_then(num),- Some(Object::Dictionary(d)) => d.get(b"N").ok().and_then(num),- _ => None,- };- let n = match declared {- Some(v) if matches!(v as u8, 1 | 3 | 4) => v as u8,- _ => alt.as_ref().map(|a| cs_kind_ncomp(a)).unwrap_or(3),- };- Some(CsKind::ICCBased { n: n.max(1), alt })- }- b"Indexed" | b"I" => {- // [ /Indexed base hival lookup ]- let base = arr- .get(1)- .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))- .unwrap_or(CsKind::DeviceRGB);- let base_n = cs_kind_ncomp(&base);- let hival = arr- .get(2)- .and_then(|o| deref(doc, o))- .as_ref()- .and_then(|o| o.as_i64().ok())- .unwrap_or(255)- .clamp(0, 65535) as u16;- let lookup = match arr.get(3).and_then(|o| deref(doc, o)) {- Some(Object::String(s, _)) => s.clone(),- // NOT `decompressed_content()`. lopdf 0.36 implements only- // Flate/LZW/ASCII85, so RunLength or ASCIIHex hits the `Err` arm and the- // old fallback handed back the still-ENCODED bytes AS THE PALETTE. Worse,- // it reads /DecodeParms with `as_dict()`, so an INDIRECT or ARRAY- // /DecodeParms makes it return `Ok` with the PREDICTOR NEVER APPLIED —- // a success carrying garbage, which no `unwrap_or_else` can catch.- // Either way §8.6.6.3's palette is nonsense and every colour in the- // image is wrong. `stream_data_with_doc` runs our own chain.- Some(Object::Stream(s)) => stream_data_with_doc(doc, s),- _ => Vec::new(),- };- Some(CsKind::Indexed { base: Box::new(base), lookup, base_ncomp: base_n, hival })- }- b"Separation" => {- // [ /Separation name alt tintTransform ]- let name = arr.get(1).and_then(|o| o.as_name().ok()).unwrap_or(b"").to_vec();- let alt = arr- .get(2)- .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))- .unwrap_or(CsKind::DeviceGray);- let tint_fn = arr.get(3).and_then(|o| PdfFunction::parse(doc, o));- Some(CsKind::Separation { name, alt: Box::new(alt), tint_fn })- }- b"DeviceN" => {- let names = arr- .get(1)- .and_then(|o| deref(doc, o))- .and_then(|o| o.as_array().ok())- .map(|a| {- a.iter().filter_map(|obj| obj.as_name().ok().map(|n| n.to_vec())).collect()- })- .unwrap_or_default();- let alt = arr- .get(2)- .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))- .unwrap_or(CsKind::DeviceGray);- let tint_fn = arr.get(3).and_then(|o| PdfFunction::parse(doc, o));- Some(CsKind::DeviceN { names, alt: Box::new(alt), tint_fn })- }- _ => None,- }-}- pub(crate) fn cs_kind_ncomp(kind: &CsKind) -> u8 { match kind { CsKind::DeviceGray => 1,@@ -546,3 +389,4 @@ pub(crate) fn read_lab_range(dict: &lopdf::Dictionary) -> Option<[[f64; 2]; 2]> include!("color_part1.rs"); include!("color_part2.rs");+include!("color_part3.rs");
pdf/src/main/rust/src/color_part3.rs
diff --git a/pdf/src/main/rust/src/color_part3.rs b/pdf/src/main/rust/src/color_part3.rsnew file mode 100644index 0000000000..6e28680f8c--- /dev/null+++ b/pdf/src/main/rust/src/color_part3.rs@@ -0,0 +1,157 @@+fn parse_cs_array_at(+ doc: &Document,+ arr: &[Object],+ cs_resources: &HashMap<Vec<u8>, ObjectId>,+ depth: u32,+) -> Option<CsKind> {+ if depth >= MAX_CS_DEPTH {+ return None;+ }+ // Every nested colour space below goes through `parse_cs_kind_at` so the depth keeps+ // accumulating across the array/kind boundary; a cycle alternates between the two.+ let parse_cs_kind = |doc: &Document, o: Option<&Object>, r: &HashMap<Vec<u8>, ObjectId>| {+ parse_cs_kind_at(doc, o, r, depth + 1)+ };+ // arr head is name+ let head = arr.first().and_then(|o| o.as_name().ok()).unwrap_or(b"");+ match head {+ b"DeviceRGB" | b"RGB" => Some(CsKind::DeviceRGB),+ b"DeviceCMYK" | b"CMYK" => Some(CsKind::DeviceCMYK),+ b"DeviceGray" | b"G" | b"Gray" => Some(CsKind::DeviceGray),+ b"Pattern" => Some(CsKind::Pattern {+ // [ /Pattern baseColorSpace ] for uncolored (PaintType 2) patterns.+ base: arr.get(1).and_then(|o| parse_cs_kind(doc, Some(o), cs_resources)).map(Box::new),+ }),+ b"CalRGB" => {+ // [ /CalRGB dict ]+ let dict = arr.get(1).and_then(|o| deref(doc, o)).and_then(|o| o.as_dict().ok());+ if let Some(d) = dict {+ let white = read_white_point(d).unwrap_or([0.9505, 1.0, 1.0890]);+ let gamma = read_gamma_rgb(d).unwrap_or([1.0, 1.0, 1.0]);+ let matrix = read_matrix_cal(d).unwrap_or([+ [1.0, 0.0, 0.0],+ [0.0, 1.0, 0.0],+ [0.0, 0.0, 1.0],+ ]);+ Some(CsKind::CalRGB { white, gamma, matrix })+ } else {+ Some(CsKind::DeviceRGB)+ }+ }+ b"CalGray" => {+ let dict = arr.get(1).and_then(|o| deref(doc, o)).and_then(|o| o.as_dict().ok());+ if let Some(d) = dict {+ let white = read_white_point(d).unwrap_or([0.9505, 1.0, 1.0890]);+ let gamma =+ d.get(b"Gamma").ok().and_then(num).filter(|g| g.is_finite()).unwrap_or(1.0);+ Some(CsKind::CalGray { white, gamma })+ } else {+ Some(CsKind::DeviceGray)+ }+ }+ b"Lab" => {+ // [ /Lab dict ]+ let dict = arr.get(1).and_then(|o| deref(doc, o)).and_then(|o| o.as_dict().ok());+ if let Some(d) = dict {+ let white = read_white_point(d).unwrap_or([0.9505, 1.0, 1.0890]);+ let range = read_lab_range(d).unwrap_or([[-100.0, 100.0], [-100.0, 100.0]]);+ Some(CsKind::Lab { white, range })+ } else {+ Some(CsKind::Lab {+ white: [0.9505, 1.0, 1.0890],+ range: [[-100.0, 100.0], [-100.0, 100.0]],+ })+ }+ }+ b"ICCBased" => {+ let dict_obj = arr.get(1).and_then(|o| deref(doc, o));+ // alt colorspace in dict /Alternate+ let alt = match dict_obj {+ Some(Object::Stream(s)) => s+ .dict+ .get(b"Alternate")+ .ok()+ .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))+ .map(Box::new),+ Some(Object::Dictionary(d)) => d+ .get(b"Alternate")+ .ok()+ .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))+ .map(Box::new),+ _ => None,+ };+ // /N is required (§8.6.5.5) and must be 1, 3 or 4. When it is missing or+ // bogus, infer from /Alternate rather than defaulting to 1: a wrong+ // component count shifts every sample in an image and yields the+ // distinctive diagonal-rainbow garbage. Accept a bare dictionary too,+ // which `colorspace_info` already tolerated.+ let declared = match dict_obj {+ Some(Object::Stream(s)) => s.dict.get(b"N").ok().and_then(num),+ Some(Object::Dictionary(d)) => d.get(b"N").ok().and_then(num),+ _ => None,+ };+ let n = match declared {+ Some(v) if matches!(v as u8, 1 | 3 | 4) => v as u8,+ _ => alt.as_ref().map(|a| cs_kind_ncomp(a)).unwrap_or(3),+ };+ Some(CsKind::ICCBased { n: n.max(1), alt })+ }+ b"Indexed" | b"I" => {+ // [ /Indexed base hival lookup ]+ let base = arr+ .get(1)+ .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))+ .unwrap_or(CsKind::DeviceRGB);+ let base_n = cs_kind_ncomp(&base);+ let hival = arr+ .get(2)+ .and_then(|o| deref(doc, o))+ .as_ref()+ .and_then(|o| o.as_i64().ok())+ .unwrap_or(255)+ .clamp(0, 65535) as u16;+ let lookup = match arr.get(3).and_then(|o| deref(doc, o)) {+ Some(Object::String(s, _)) => s.clone(),+ // NOT `decompressed_content()`. lopdf 0.36 implements only+ // Flate/LZW/ASCII85, so RunLength or ASCIIHex hits the `Err` arm and the+ // old fallback handed back the still-ENCODED bytes AS THE PALETTE. Worse,+ // it reads /DecodeParms with `as_dict()`, so an INDIRECT or ARRAY+ // /DecodeParms makes it return `Ok` with the PREDICTOR NEVER APPLIED —+ // a success carrying garbage, which no `unwrap_or_else` can catch.+ // Either way §8.6.6.3's palette is nonsense and every colour in the+ // image is wrong. `stream_data_with_doc` runs our own chain.+ Some(Object::Stream(s)) => stream_data_with_doc(doc, s),+ _ => Vec::new(),+ };+ Some(CsKind::Indexed { base: Box::new(base), lookup, base_ncomp: base_n, hival })+ }+ b"Separation" => {+ // [ /Separation name alt tintTransform ]+ let name = arr.get(1).and_then(|o| o.as_name().ok()).unwrap_or(b"").to_vec();+ let alt = arr+ .get(2)+ .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))+ .unwrap_or(CsKind::DeviceGray);+ let tint_fn = arr.get(3).and_then(|o| PdfFunction::parse(doc, o));+ Some(CsKind::Separation { name, alt: Box::new(alt), tint_fn })+ }+ b"DeviceN" => {+ let names = arr+ .get(1)+ .and_then(|o| deref(doc, o))+ .and_then(|o| o.as_array().ok())+ .map(|a| {+ a.iter().filter_map(|obj| obj.as_name().ok().map(|n| n.to_vec())).collect()+ })+ .unwrap_or_default();+ let alt = arr+ .get(2)+ .and_then(|o| parse_cs_kind(doc, Some(o), cs_resources))+ .unwrap_or(CsKind::DeviceGray);+ let tint_fn = arr.get(3).and_then(|o| PdfFunction::parse(doc, o));+ Some(CsKind::DeviceN { names, alt: Box::new(alt), tint_fn })+ }+ _ => None,+ }+}+
pdf/src/main/rust/src/filters.rs
diff --git a/pdf/src/main/rust/src/filters.rs b/pdf/src/main/rust/src/filters.rsindex cbdba2cf4a..4ab584130a 100644--- a/pdf/src/main/rust/src/filters.rs+++ b/pdf/src/main/rust/src/filters.rs@@ -291,119 +291,6 @@ fn decode_runlength_limited(data: &[u8], limit: usize) -> Vec<u8> { out } -pub fn decode_lzw(data: &[u8], early_change: bool) -> Option<Vec<u8>> {- // weezl crate removed – pure std LZW decoder (single function we use, prefer stdlib)- lzw_decode_std(data, early_change, MAX_DECODED_BYTES as usize)-}--/// Minimal std-only LZW decoder for PDF's LZWDecode (MSB-first, 8-bit symbols).-/// Handles EarlyChange 1 (default, code size early bump) vs 0.-/// This is the `single function we use, we can just write it ourselves` rewrite path.-/// Returns None on malformed data.-fn lzw_decode_std(data: &[u8], early_change: bool, limit: usize) -> Option<Vec<u8>> {- // Simplified version: common case – try via quick dict of 258+ entries.- // If too complex, return None and let caller fail gracefully.- // Real PDF LZW switches code size at 2^k - early. Standard TIFF variant uses clear code 256, eod 257.- const CLEAR: u32 = 256;- const EOD: u32 = 257;- if data.is_empty() {- return Some(Vec::new());- }- let mut dict: Vec<Vec<u8>> = Vec::with_capacity(4096);- for i in 0..256 {- dict.push(vec![i as u8]);- }- dict.push(vec![]); // 256 clear- dict.push(vec![]); // 257 eod- // Reserve a guess, not a file-controlled amount: `data.len() * 2` is a 400 MB- // up-front allocation for a `MAX_PDF_BYTES`-sized stream, before a single code- // has been shown to decode.- let mut out = Vec::with_capacity(data.len().saturating_mul(2).min(1 << 20));- let mut code_bits = 9usize;- let mut bit_buf: u32 = 0;- let mut bits_in_buf = 0usize;- let mut data_pos = 0usize;- let mut prev: Option<Vec<u8>> = None;-- let read_code = |bit_buf: &mut u32,- bits_in_buf: &mut usize,- data: &[u8],- pos: &mut usize,- bits: usize|- -> Option<u32> {- while *bits_in_buf < bits {- if *pos >= data.len() {- return None;- }- *bit_buf = (*bit_buf << 8) | data[*pos] as u32;- *bits_in_buf += 8;- *pos += 1;- }- let shift = *bits_in_buf - bits;- let code = (*bit_buf >> shift) & ((1u32 << bits) - 1);- *bits_in_buf = shift;- *bit_buf &= (1u32 << shift).wrapping_sub(1);- Some(code)- };-- // Stream ended without an EOD (257) ends the loop: many producers omit- // it; returning None there discarded a fully-decoded stream and blanked- // the page.- while let Some(code) = read_code(&mut bit_buf, &mut bits_in_buf, data, &mut data_pos, code_bits)- {- if code == CLEAR {- dict.truncate(258);- code_bits = 9;- prev = None;- continue;- }- if code == EOD {- break;- }- let entry: Vec<u8> = if (code as usize) < dict.len() {- dict[code as usize].clone()- } else if code as usize == dict.len() {- // KwKwK case- match prev.as_ref() {- Some(p) if !p.is_empty() => {- let mut e = p.clone();- e.push(p[0]);- e- }- _ => break,- }- } else {- // Corrupt code: keep everything decoded so far rather than losing the stream.- break;- };- out.extend_from_slice(&entry);- // §7.4.3 places no bound on the expansion ratio: a dictionary entry grows to- // 4096 bytes, so a few-MB stream can decode to gigabytes. Flate is capped by- // `MAX_DECODED_BYTES`; this was not, and nothing downstream bounds it either.- // Everything decoded so far is kept, as for a truncated stream.- if out.len() >= limit {- break;- }- if let Some(p) = prev.take() {- if dict.len() < 4096 {- if let Some(&first) = entry.first() {- let mut new_entry = p;- new_entry.push(first);- dict.push(new_entry);- // EarlyChange bumps code size one entry early per PDF spec- let threshold =- if early_change { (1usize << code_bits) - 1 } else { 1usize << code_bits };- if dict.len() >= threshold && code_bits < 12 {- code_bits += 1;- }- }- }- }- prev = Some(entry);- }- Some(out)-}- /// Maximum bytes we will inflate from one stream. §7.4.4 places no limit on the /// expansion ratio, so a few-KB stream can inflate to gigabytes and OOM-kill the /// app; `MAX_PDF_BYTES` bounds only the compressed input.@@ -504,3 +391,4 @@ pub fn parse_ccitt_params(doc: &Document, dict_opt: Option<&Dictionary>) -> Ccit include!("filters_part1.rs"); include!("filters_part2.rs");+include!("filters_part3.rs");
pdf/src/main/rust/src/filters_part3.rs
diff --git a/pdf/src/main/rust/src/filters_part3.rs b/pdf/src/main/rust/src/filters_part3.rsnew file mode 100644index 0000000000..e755c85c10--- /dev/null+++ b/pdf/src/main/rust/src/filters_part3.rs@@ -0,0 +1,112 @@+pub fn decode_lzw(data: &[u8], early_change: bool) -> Option<Vec<u8>> {+ // weezl crate removed – pure std LZW decoder (single function we use, prefer stdlib)+ lzw_decode_std(data, early_change, MAX_DECODED_BYTES as usize)+}++/// Minimal std-only LZW decoder for PDF's LZWDecode (MSB-first, 8-bit symbols).+/// Handles EarlyChange 1 (default, code size early bump) vs 0.+/// This is the `single function we use, we can just write it ourselves` rewrite path.+/// Returns None on malformed data.+fn lzw_decode_std(data: &[u8], early_change: bool, limit: usize) -> Option<Vec<u8>> {+ // Simplified version: common case – try via quick dict of 258+ entries.+ // If too complex, return None and let caller fail gracefully.+ // Real PDF LZW switches code size at 2^k - early. Standard TIFF variant uses clear code 256, eod 257.+ const CLEAR: u32 = 256;+ const EOD: u32 = 257;+ if data.is_empty() {+ return Some(Vec::new());+ }+ let mut dict: Vec<Vec<u8>> = Vec::with_capacity(4096);+ for i in 0..256 {+ dict.push(vec![i as u8]);+ }+ dict.push(vec![]); // 256 clear+ dict.push(vec![]); // 257 eod+ // Reserve a guess, not a file-controlled amount: `data.len() * 2` is a 400 MB+ // up-front allocation for a `MAX_PDF_BYTES`-sized stream, before a single code+ // has been shown to decode.+ let mut out = Vec::with_capacity(data.len().saturating_mul(2).min(1 << 20));+ let mut code_bits = 9usize;+ let mut bit_buf: u32 = 0;+ let mut bits_in_buf = 0usize;+ let mut data_pos = 0usize;+ let mut prev: Option<Vec<u8>> = None;++ let read_code = |bit_buf: &mut u32,+ bits_in_buf: &mut usize,+ data: &[u8],+ pos: &mut usize,+ bits: usize|+ -> Option<u32> {+ while *bits_in_buf < bits {+ if *pos >= data.len() {+ return None;+ }+ *bit_buf = (*bit_buf << 8) | data[*pos] as u32;+ *bits_in_buf += 8;+ *pos += 1;+ }+ let shift = *bits_in_buf - bits;+ let code = (*bit_buf >> shift) & ((1u32 << bits) - 1);+ *bits_in_buf = shift;+ *bit_buf &= (1u32 << shift).wrapping_sub(1);+ Some(code)+ };++ // Stream ended without an EOD (257) ends the loop: many producers omit+ // it; returning None there discarded a fully-decoded stream and blanked+ // the page.+ while let Some(code) = read_code(&mut bit_buf, &mut bits_in_buf, data, &mut data_pos, code_bits)+ {+ if code == CLEAR {+ dict.truncate(258);+ code_bits = 9;+ prev = None;+ continue;+ }+ if code == EOD {+ break;+ }+ let entry: Vec<u8> = if (code as usize) < dict.len() {+ dict[code as usize].clone()+ } else if code as usize == dict.len() {+ // KwKwK case+ match prev.as_ref() {+ Some(p) if !p.is_empty() => {+ let mut e = p.clone();+ e.push(p[0]);+ e+ }+ _ => break,+ }+ } else {+ // Corrupt code: keep everything decoded so far rather than losing the stream.+ break;+ };+ out.extend_from_slice(&entry);+ // §7.4.3 places no bound on the expansion ratio: a dictionary entry grows to+ // 4096 bytes, so a few-MB stream can decode to gigabytes. Flate is capped by+ // `MAX_DECODED_BYTES`; this was not, and nothing downstream bounds it either.+ // Everything decoded so far is kept, as for a truncated stream.+ if out.len() >= limit {+ break;+ }+ if let Some(p) = prev.take() {+ if dict.len() < 4096 {+ if let Some(&first) = entry.first() {+ let mut new_entry = p;+ new_entry.push(first);+ dict.push(new_entry);+ // EarlyChange bumps code size one entry early per PDF spec+ let threshold =+ if early_change { (1usize << code_bits) - 1 } else { 1usize << code_bits };+ if dict.len() >= threshold && code_bits < 12 {+ code_bits += 1;+ }+ }+ }+ }+ prev = Some(entry);+ }+ Some(out)+}
pdf/src/main/rust/src/glyphlist.rs
diff --git a/pdf/src/main/rust/src/glyphlist.rs b/pdf/src/main/rust/src/glyphlist.rsindex 49af67718b..d7c34b0ad8 100644--- a/pdf/src/main/rust/src/glyphlist.rs+++ b/pdf/src/main/rust/src/glyphlist.rs@@ -70,1051 +70,9 @@ pub fn agl(name: &str) -> Option<char> { None } -/// MacRoman high range 0x80..=0xFF (low range is ASCII identity).-const MAC_ROMAN_HIGH: &[(u32, u32)] = &[- (0x80, 0x00C4),- (0x81, 0x00C5),- (0x82, 0x00C7),- (0x83, 0x00C9),- (0x84, 0x00D1),- (0x85, 0x00D6),- (0x86, 0x00DC),- (0x87, 0x00E1),- (0x88, 0x00E0),- (0x89, 0x00E2),- (0x8A, 0x00E4),- (0x8B, 0x00E3),- (0x8C, 0x00E5),- (0x8D, 0x00E7),- (0x8E, 0x00E9),- (0x8F, 0x00E8),- (0x90, 0x00EA),- (0x91, 0x00EB),- (0x92, 0x00ED),- (0x93, 0x00EC),- (0x94, 0x00EE),- (0x95, 0x00EF),- (0x96, 0x00F1),- (0x97, 0x00F3),- (0x98, 0x00F2),- (0x99, 0x00F4),- (0x9A, 0x00F6),- (0x9B, 0x00F5),- (0x9C, 0x00FA),- (0x9D, 0x00F9),- (0x9E, 0x00FB),- (0x9F, 0x00FC),- (0xA0, 0x2020),- (0xA1, 0x00B0),- (0xA2, 0x00A2),- (0xA3, 0x00A3),- (0xA4, 0x00A7),- (0xA5, 0x2022),- (0xA6, 0x00B6),- (0xA7, 0x00DF),- (0xA8, 0x00AE),- (0xA9, 0x00A9),- (0xAA, 0x2122),- (0xAB, 0x00B4),- (0xAC, 0x00A8),- (0xAD, 0x2260),- (0xAE, 0x00C6),- (0xAF, 0x00D8),- (0xB0, 0x221E),- (0xB1, 0x00B1),- (0xB2, 0x2264),- (0xB3, 0x2265),- (0xB4, 0x00A5),- (0xB5, 0x00B5),- (0xB6, 0x2202),- (0xB7, 0x2211),- (0xB8, 0x220F),- (0xB9, 0x03C0),- (0xBA, 0x222B),- (0xBB, 0x00AA),- (0xBC, 0x00BA),- (0xBD, 0x03A9),- (0xBE, 0x00E6),- (0xBF, 0x00F8),- (0xC0, 0x00BF),- (0xC1, 0x00A1),- (0xC2, 0x00AC),- (0xC3, 0x221A),- (0xC4, 0x0192),- (0xC5, 0x2248),- (0xC6, 0x2206),- (0xC7, 0x00AB),- (0xC8, 0x00BB),- (0xC9, 0x2026),- (0xCA, 0x00A0),- (0xCB, 0x00C0),- (0xCC, 0x00C3),- (0xCD, 0x00D5),- (0xCE, 0x0152),- (0xCF, 0x0153),- (0xD0, 0x2013),- (0xD1, 0x2014),- (0xD2, 0x201C),- (0xD3, 0x201D),- (0xD4, 0x2018),- (0xD5, 0x2019),- (0xD6, 0x00F7),- (0xD7, 0x25CA),- (0xD8, 0x00FF),- (0xD9, 0x0178),- // 0xDB is `currency` (U+00A4) in PDF 32000-1 Annex D.2 MacRomanEncoding, NOT- // the Euro that Mac OS Roman puts there from Mac OS 8.5 onward. This is the- // one code where the PDF table and the Apple charset disagree.- (0xDA, 0x2044),- (0xDB, 0x00A4),- (0xDC, 0x2039),- (0xDD, 0x203A),- (0xDE, 0xFB01),- (0xDF, 0xFB02),- (0xE0, 0x2021),- (0xE1, 0x00B7),- (0xE2, 0x201A),- (0xE3, 0x201E),- (0xE4, 0x2030),- (0xE5, 0x00C2),- (0xE6, 0x00CA),- (0xE7, 0x00C1),- (0xE8, 0x00CB),- (0xE9, 0x00C8),- (0xEA, 0x00CD),- (0xEB, 0x00CE),- (0xEC, 0x00CF),- (0xED, 0x00CC),- (0xEE, 0x00D3),- (0xEF, 0x00D4),- (0xF0, 0xF8FF),- (0xF1, 0x00D2),- (0xF2, 0x00DA),- (0xF3, 0x00DB),- (0xF4, 0x00D9),- (0xF5, 0x0131),- (0xF6, 0x02C6),- (0xF7, 0x02DC),- (0xF8, 0x00AF),- (0xF9, 0x02D8),- (0xFA, 0x02D9),- (0xFB, 0x02DA),- (0xFC, 0x00B8),- (0xFD, 0x02DD),- (0xFE, 0x02DB),- (0xFF, 0x02C7),-];--/// Adobe Symbol encoding full (code -> Unicode). 230+ entries covering Greek,-/// math operators, arrows, technical symbols, and extended Symbol.-const SYMBOL: &[(u32, u32)] = &[- // Low ASCII range- (0x20, 0x0020),- (0x21, 0x0021),- (0x22, 0x2200),- (0x23, 0x0023),- (0x24, 0x2203),- (0x25, 0x0025),- (0x26, 0x0026),- (0x27, 0x220B),- (0x28, 0x0028),- (0x29, 0x0029),- (0x2A, 0x2217),- (0x2B, 0x002B),- (0x2C, 0x002C),- (0x2D, 0x2212),- (0x2E, 0x002E),- (0x2F, 0x002F),- (0x30, 0x0030),- (0x31, 0x0031),- (0x32, 0x0032),- (0x33, 0x0033),- (0x34, 0x0034),- (0x35, 0x0035),- (0x36, 0x0036),- (0x37, 0x0037),- (0x38, 0x0038),- (0x39, 0x0039),- (0x3A, 0x003A),- (0x3B, 0x003B),- (0x3C, 0x003C),- (0x3D, 0x003D),- (0x3E, 0x003E),- (0x3F, 0x003F),- (0x40, 0x2245),- (0x41, 0x0391),- (0x42, 0x0392),- (0x43, 0x03A7),- (0x44, 0x0394),- (0x45, 0x0395),- (0x46, 0x03A6),- (0x47, 0x0393),- (0x48, 0x0397),- (0x49, 0x0399),- (0x4A, 0x03D1),- (0x4B, 0x039A),- (0x4C, 0x039B),- (0x4D, 0x039C),- (0x4E, 0x039D),- (0x4F, 0x039F),- (0x50, 0x03A0),- (0x51, 0x0398),- (0x52, 0x03A1),- (0x53, 0x03A3),- (0x54, 0x03A4),- (0x55, 0x03A5),- (0x56, 0x03C2),- (0x57, 0x03A9),- (0x58, 0x039E),- (0x59, 0x03A8),- (0x5A, 0x0396),- (0x5B, 0x005B),- (0x5C, 0x2234),- (0x5D, 0x005D),- (0x5E, 0x22A5),- (0x5F, 0x005F),- (0x60, 0xF8E5),- (0x61, 0x03B1),- (0x62, 0x03B2),- (0x63, 0x03C7),- (0x64, 0x03B4),- (0x65, 0x03B5),- (0x66, 0x03C6),- (0x67, 0x03B3),- (0x68, 0x03B7),- (0x69, 0x03B9),- (0x6A, 0x03D5),- (0x6B, 0x03BA),- (0x6C, 0x03BB),- (0x6D, 0x03BC),- (0x6E, 0x03BD),- (0x6F, 0x03BF),- (0x70, 0x03C0),- (0x71, 0x03B8),- (0x72, 0x03C1),- (0x73, 0x03C3),- (0x74, 0x03C4),- (0x75, 0x03C5),- (0x76, 0x03D6),- (0x77, 0x03C9),- (0x78, 0x03BE),- (0x79, 0x03C8),- (0x7A, 0x03B6),- (0x7B, 0x007B),- (0x7C, 0x007C),- (0x7D, 0x007D),- (0x7E, 0x223C),- // High range extended Symbol - includes Euro/various- (0x80, 0x20AC),- (0x81, 0x2205),- (0x82, 0x201A),- (0x83, 0x0192),- (0x84, 0x201E),- (0x85, 0x2026),- (0x86, 0x2020),- (0x87, 0x2021),- (0x88, 0x02C6),- (0x89, 0x2030),- (0x8A, 0x0160),- (0x8B, 0x2039),- (0x8C, 0x0152),- (0x8D, 0x2666),- (0x8E, 0x017D),- (0x8F, 0x2660),- (0x90, 0x2211),- (0x91, 0x2018),- (0x92, 0x2019),- (0x93, 0x201C),- (0x94, 0x201D),- (0x95, 0x2022),- (0x96, 0x2013),- (0x97, 0x2014),- (0x98, 0x02DC),- (0x99, 0x2122),- (0x9A, 0x0161),- (0x9B, 0x203A),- (0x9C, 0x0153),- (0x9D, 0x2665),- (0x9E, 0x017E),- (0x9F, 0x0178),- (0xA0, 0x20AC),- (0xA1, 0x03D2),- (0xA2, 0x2032),- (0xA3, 0x2264),- (0xA4, 0x2044),- (0xA5, 0x221E),- (0xA6, 0x0192),- (0xA7, 0x2663),- (0xA8, 0x2666),- (0xA9, 0x2665),- (0xAA, 0x2660),- (0xAB, 0x2194),- (0xAC, 0x2190),- (0xAD, 0x2191),- (0xAE, 0x2192),- (0xAF, 0x2193),- (0xB0, 0x00B0),- (0xB1, 0x00B1),- (0xB2, 0x2033),- (0xB3, 0x2265),- (0xB4, 0x00D7),- (0xB5, 0x221D),- (0xB6, 0x2202),- (0xB7, 0x2022),- (0xB8, 0x00F7),- (0xB9, 0x2260),- (0xBA, 0x2261),- (0xBB, 0x2248),- (0xBC, 0x2026),- (0xBD, 0x23D0),- (0xBE, 0x23AF),- (0xBF, 0x21B5),- (0xC0, 0x2135),- (0xC1, 0x2111),- (0xC2, 0x211C),- (0xC3, 0x2118),- (0xC4, 0x2297),- (0xC5, 0x2295),- (0xC6, 0x2205),- (0xC7, 0x2229),- (0xC8, 0x222A),- (0xC9, 0x2283),- (0xCA, 0x2287),- (0xCB, 0x2284),- (0xCC, 0x2282),- (0xCD, 0x2286),- (0xCE, 0x2208),- (0xCF, 0x2209),- (0xD0, 0x2220),- (0xD1, 0x2207),- (0xD2, 0x00AE),- (0xD3, 0x00A9),- (0xD4, 0x2122),- (0xD5, 0x220F),- (0xD6, 0x221A),- (0xD7, 0x22C5),- (0xD8, 0x00AC),- (0xD9, 0x2227),- (0xDA, 0x2228),- (0xDB, 0x21D4),- (0xDC, 0x21D0),- (0xDD, 0x21D1),- (0xDE, 0x21D2),- (0xDF, 0x21D3),- (0xE0, 0x25CA),- // 0xE1..0xFE are, in order: angleleft, the sans register/copyright/trademark,- // summation, then the paren / bracket / brace / integral EXTENDER pieces that- // a tall delimiter is built from, angleright and integral. They previously- // read as a run of geometric shapes (▪ ▫ ▬ ▲ ▼ …), which is neither the Adobe- // Symbol encoding nor anything on the page: an integral sign extracted as ▼.- // Each multi-piece delimiter maps to the base character it is a piece of, so- // a three-piece parenthesis extracts as "(((" — repetitive, but every- // character is one the page really shows, and it is searchable.- (0xE1, 0x2329),- (0xE2, 0x00AE),- (0xE3, 0x00A9),- (0xE4, 0x2122),- (0xE5, 0x2211),- (0xE6, 0x0028),- (0xE7, 0x0028),- (0xE8, 0x0028),- (0xE9, 0x005B),- (0xEA, 0x005B),- (0xEB, 0x005B),- (0xEC, 0x007B),- (0xED, 0x007B),- (0xEE, 0x007B),- (0xEF, 0x007C),- (0xF0, 0xF8FF),- (0xF1, 0x232A),- (0xF2, 0x222B),- (0xF3, 0x2320),- (0xF4, 0x23AE),- (0xF5, 0x2321),- (0xF6, 0x0029),- (0xF7, 0x0029),- (0xF8, 0x0029),- (0xF9, 0x005D),- (0xFA, 0x005D),- (0xFB, 0x005D),- (0xFC, 0x007D),- (0xFD, 0x007D),- (0xFE, 0x007D),-];--/// ZapfDingbats encoding full (code -> Unicode) - 220+ entries.-const ZAPF: &[(u32, u32)] = &[- (0x20, 0x0020),- (0x21, 0x2701),- (0x22, 0x2702),- (0x23, 0x2703),- (0x24, 0x2704),- (0x25, 0x260E),- (0x26, 0x2706),- (0x27, 0x2707),- (0x28, 0x2708),- (0x29, 0x2709),- (0x2A, 0x261B),- (0x2B, 0x261E),- (0x2C, 0x270C),- (0x2D, 0x270D),- (0x2E, 0x270E),- (0x2F, 0x270F),- (0x30, 0x2710),- (0x31, 0x2711),- (0x32, 0x2712),- (0x33, 0x2713),- (0x34, 0x2714),- (0x35, 0x2715),- (0x36, 0x2716),- (0x37, 0x2717),- (0x38, 0x2718),- (0x39, 0x2719),- (0x3A, 0x271A),- (0x3B, 0x271B),- (0x3C, 0x271C),- (0x3D, 0x271D),- (0x3E, 0x271E),- (0x3F, 0x271F),- (0x40, 0x2720),- (0x41, 0x2721),- (0x42, 0x2722),- (0x43, 0x2723),- (0x44, 0x2724),- (0x45, 0x2725),- (0x46, 0x2726),- (0x47, 0x2727),- (0x48, 0x2728),- (0x49, 0x2729),- (0x4A, 0x272A),- (0x4B, 0x272B),- (0x4C, 0x272C),- (0x4D, 0x272D),- (0x4E, 0x272E),- (0x4F, 0x272F),- (0x50, 0x2730),- (0x51, 0x2731),- (0x52, 0x2732),- (0x53, 0x2733),- (0x54, 0x2734),- (0x55, 0x2735),- (0x56, 0x2736),- (0x57, 0x2737),- (0x58, 0x2738),- (0x59, 0x2739),- (0x5A, 0x273A),- (0x5B, 0x273B),- (0x5C, 0x273C),- (0x5D, 0x273D),- (0x5E, 0x273E),- (0x5F, 0x273F),- (0x60, 0x2740),- (0x61, 0x2741),- (0x62, 0x2742),- (0x63, 0x2743),- (0x64, 0x2744),- (0x65, 0x2745),- (0x66, 0x2746),- (0x67, 0x2747),- (0x68, 0x2748),- (0x69, 0x2749),- (0x6A, 0x274A),- (0x6B, 0x274B),- (0x6C, 0x25CF),- (0x6D, 0x274D),- (0x6E, 0x25A0),- (0x6F, 0x25B2),- (0x70, 0x25BC),- (0x71, 0x25C6),- (0x72, 0x2756),- (0x73, 0x25D7),- (0x74, 0x2758),- (0x75, 0x2759),- (0x76, 0x275A),- (0x77, 0x276E),- (0x78, 0x276F),- (0x79, 0x2770),- (0x7A, 0x2771),- (0x7B, 0x2772),- (0x7C, 0x2773),- (0x7D, 0x2774),- (0x7E, 0x2775),- // High range 0x80-0x9F extra dingbats (common extensions)- (0x80, 0x2701),- (0x81, 0x2702),- (0x82, 0x201A),- (0x83, 0x0192),- (0x84, 0x201E),- (0x85, 0x2026),- (0x86, 0x2020),- (0x87, 0x2021),- (0x88, 0x02C6),- (0x89, 0x2030),- (0x8A, 0x0160),- (0x8B, 0x2039),- (0x8C, 0x0152),- (0x8D, 0x25CF),- (0x8E, 0x017D),- (0x8F, 0x25A0),- (0x90, 0x25B2),- (0x91, 0x2018),- (0x92, 0x2019),- (0x93, 0x201C),- (0x94, 0x201D),- (0x95, 0x2022),- (0x96, 0x2013),- (0x97, 0x2014),- (0x98, 0x02DC),- (0x99, 0x2122),- (0x9A, 0x0161),- (0x9B, 0x203A),- (0x9C, 0x0153),- (0x9D, 0x25BC),- (0x9E, 0x017E),- (0x9F, 0x0178),- // Extended high 0xA0-0xFF- (0xA0, 0x0020),- (0xA1, 0x2761),- (0xA2, 0x2762),- (0xA3, 0x2763),- (0xA4, 0x2764),- (0xA5, 0x2765),- (0xA6, 0x2766),- (0xA7, 0x2767),- (0xA8, 0x2663),- (0xA9, 0x2666),- (0xAA, 0x2665),- (0xAB, 0x2660),- (0xAC, 0x2460),- (0xAD, 0x2461),- (0xAE, 0x2462),- (0xAF, 0x2463),- (0xB0, 0x2464),- (0xB1, 0x2465),- (0xB2, 0x2466),- (0xB3, 0x2467),- (0xB4, 0x2468),- (0xB5, 0x2469),- (0xB6, 0x246A),- (0xB7, 0x246B),- (0xB8, 0x246C),- (0xB9, 0x246D),- (0xBA, 0x246E),- (0xBB, 0x246F),- (0xBC, 0x2470),- (0xBD, 0x2471),- (0xBE, 0x2472),- (0xBF, 0x2473),- (0xC0, 0x2474),- (0xC1, 0x2475),- (0xC2, 0x2476),- (0xC3, 0x2477),- (0xC4, 0x2478),- (0xC5, 0x2479),- (0xC6, 0x247A),- (0xC7, 0x247B),- (0xC8, 0x247C),- (0xC9, 0x247D),- (0xCA, 0x247E),- (0xCB, 0x247F),- (0xCC, 0x2480),- (0xCD, 0x2481),- (0xCE, 0x2482),- (0xCF, 0x2483),- (0xD0, 0x2484),- (0xD1, 0x2485),- (0xD2, 0x2486),- (0xD3, 0x2487),- (0xD4, 0x2488),- (0xD5, 0x2776),- (0xD6, 0x2777),- (0xD7, 0x2778),- (0xD8, 0x2192),- (0xD9, 0x2194),- (0xDA, 0x2195),- (0xDB, 0x2794),- (0xDC, 0x2798),- (0xDD, 0x279A),- (0xDE, 0x279C),- (0xDF, 0x279E),- (0xE0, 0x27A0),- (0xE1, 0x27A1),- (0xE2, 0x27A2),- (0xE3, 0x27A3),- (0xE4, 0x27A4),- (0xE5, 0x27A5),- (0xE6, 0x27A6),- (0xE7, 0x2799),- (0xE8, 0x279B),- (0xE9, 0x279C),- (0xEA, 0x279D),- (0xEB, 0x279E),- (0xEC, 0x279F),- (0xED, 0x27A0),- (0xEE, 0x27A1),- (0xEF, 0x27A2),- (0xF0, 0x27B2),- (0xF1, 0x2794),- (0xF2, 0x27B5),- (0xF3, 0x27B8),- (0xF4, 0x27BA),- (0xF5, 0x27BB),- (0xF6, 0x27BC),- (0xF7, 0x27BD),- (0xF8, 0x27BE),- (0xF9, 0x25CF),- (0xFA, 0x25A0),- (0xFB, 0x25B2),- (0xFC, 0x25BC),- (0xFD, 0x25C6),- (0xFE, 0x2716),- (0xFF, 0x271A),-];--/// Adobe Glyph List expanded: Latin/common subset + ligatures + extended Latin.-/// Includes ff, ffi, ffl and many extended Latin, Greek, symbols.-const AGL_LATIN: &[(&str, u32)] = &[- // Basic ASCII- ("space", 0x0020),- ("exclam", 0x0021),- ("quotedbl", 0x0022),- ("numbersign", 0x0023),- ("dollar", 0x0024),- ("percent", 0x0025),- ("ampersand", 0x0026),- ("quotesingle", 0x0027),- ("parenleft", 0x0028),- ("parenright", 0x0029),- ("asterisk", 0x002A),- ("plus", 0x002B),- ("comma", 0x002C),- ("hyphen", 0x002D),- ("period", 0x002E),- ("slash", 0x002F),- ("zero", 0x0030),- ("one", 0x0031),- ("two", 0x0032),- ("three", 0x0033),- ("four", 0x0034),- ("five", 0x0035),- ("six", 0x0036),- ("seven", 0x0037),- ("eight", 0x0038),- ("nine", 0x0039),- ("colon", 0x003A),- ("semicolon", 0x003B),- ("less", 0x003C),- ("equal", 0x003D),- ("greater", 0x003E),- ("question", 0x003F),- ("at", 0x0040),- ("A", 0x0041),- ("B", 0x0042),- ("C", 0x0043),- ("D", 0x0044),- ("E", 0x0045),- ("F", 0x0046),- ("G", 0x0047),- ("H", 0x0048),- ("I", 0x0049),- ("J", 0x004A),- ("K", 0x004B),- ("L", 0x004C),- ("M", 0x004D),- ("N", 0x004E),- ("O", 0x004F),- ("P", 0x0050),- ("Q", 0x0051),- ("R", 0x0052),- ("S", 0x0053),- ("T", 0x0054),- ("U", 0x0055),- ("V", 0x0056),- ("W", 0x0057),- ("X", 0x0058),- ("Y", 0x0059),- ("Z", 0x005A),- ("bracketleft", 0x005B),- ("backslash", 0x005C),- ("bracketright", 0x005D),- ("asciicircum", 0x005E),- ("underscore", 0x005F),- ("grave", 0x0060),- ("a", 0x0061),- ("b", 0x0062),- ("c", 0x0063),- ("d", 0x0064),- ("e", 0x0065),- ("f", 0x0066),- ("g", 0x0067),- ("h", 0x0068),- ("i", 0x0069),- ("j", 0x006A),- ("k", 0x006B),- ("l", 0x006C),- ("m", 0x006D),- ("n", 0x006E),- ("o", 0x006F),- ("p", 0x0070),- ("q", 0x0071),- ("r", 0x0072),- ("s", 0x0073),- ("t", 0x0074),- ("u", 0x0075),- ("v", 0x0076),- ("w", 0x0077),- ("x", 0x0078),- ("y", 0x0079),- ("z", 0x007A),- ("braceleft", 0x007B),- ("bar", 0x007C),- ("braceright", 0x007D),- ("asciitilde", 0x007E),- // Latin-1 Supplement- ("exclamdown", 0x00A1),- ("cent", 0x00A2),- ("sterling", 0x00A3),- ("currency", 0x00A4),- ("yen", 0x00A5),- ("brokenbar", 0x00A6),- ("section", 0x00A7),- ("dieresis", 0x00A8),- ("copyright", 0x00A9),- ("ordfeminine", 0x00AA),- ("guillemotleft", 0x00AB),- ("logicalnot", 0x00AC),- ("registered", 0x00AE),- ("macron", 0x00AF),- ("degree", 0x00B0),- ("plusminus", 0x00B1),- ("twosuperior", 0x00B2),- ("threesuperior", 0x00B3),- ("acute", 0x00B4),- ("mu", 0x00B5),- ("paragraph", 0x00B6),- ("periodcentered", 0x00B7),- ("cedilla", 0x00B8),- ("onesuperior", 0x00B9),- ("ordmasculine", 0x00BA),- ("guillemotright", 0x00BB),- ("onequarter", 0x00BC),- ("onehalf", 0x00BD),- ("threequarters", 0x00BE),- ("questiondown", 0x00BF),- ("Agrave", 0x00C0),- ("Aacute", 0x00C1),- ("Acircumflex", 0x00C2),- ("Atilde", 0x00C3),- ("Adieresis", 0x00C4),- ("Aring", 0x00C5),- ("AE", 0x00C6),- ("Ccedilla", 0x00C7),- ("Egrave", 0x00C8),- ("Eacute", 0x00C9),- ("Ecircumflex", 0x00CA),- ("Edieresis", 0x00CB),- ("Igrave", 0x00CC),- ("Iacute", 0x00CD),- ("Icircumflex", 0x00CE),- ("Idieresis", 0x00CF),- ("Eth", 0x00D0),- ("Ntilde", 0x00D1),- ("Ograve", 0x00D2),- ("Oacute", 0x00D3),- ("Ocircumflex", 0x00D4),- ("Otilde", 0x00D5),- ("Odieresis", 0x00D6),- ("multiply", 0x00D7),- ("Oslash", 0x00D8),- ("Ugrave", 0x00D9),- ("Uacute", 0x00DA),- ("Ucircumflex", 0x00DB),- ("Udieresis", 0x00DC),- ("Yacute", 0x00DD),- ("Thorn", 0x00DE),- ("germandbls", 0x00DF),- ("agrave", 0x00E0),- ("aacute", 0x00E1),- ("acircumflex", 0x00E2),- ("atilde", 0x00E3),- ("adieresis", 0x00E4),- ("aring", 0x00E5),- ("ae", 0x00E6),- ("ccedilla", 0x00E7),- ("egrave", 0x00E8),- ("eacute", 0x00E9),- ("ecircumflex", 0x00EA),- ("edieresis", 0x00EB),- ("igrave", 0x00EC),- ("iacute", 0x00ED),- ("icircumflex", 0x00EE),- ("idieresis", 0x00EF),- ("eth", 0x00F0),- ("ntilde", 0x00F1),- ("ograve", 0x00F2),- ("oacute", 0x00F3),- ("ocircumflex", 0x00F4),- ("otilde", 0x00F5),- ("odieresis", 0x00F6),- ("divide", 0x00F7),- ("oslash", 0x00F8),- ("ugrave", 0x00F9),- ("uacute", 0x00FA),- ("ucircumflex", 0x00FB),- ("udieresis", 0x00FC),- ("yacute", 0x00FD),- ("thorn", 0x00FE),- ("ydieresis", 0x00FF),- // Extended Latin- ("Amacron", 0x0100),- ("amacron", 0x0101),- ("Abreve", 0x0102),- ("abreve", 0x0103),- ("Aogonek", 0x0104),- ("aogonek", 0x0105),- ("Cacute", 0x0106),- ("cacute", 0x0107),- ("Ccircumflex", 0x0108),- ("ccircumflex", 0x0109),- ("Cdotaccent", 0x010A),- ("cdotaccent", 0x010B),- ("Ccaron", 0x010C),- ("ccaron", 0x010D),- ("Dcaron", 0x010E),- ("dcaron", 0x010F),- ("Dslash", 0x0110),- ("dslash", 0x0111),- ("Emacron", 0x0112),- ("emacron", 0x0113),- ("Ebreve", 0x0114),- ("ebreve", 0x0115),- ("Edotaccent", 0x0116),- ("edotaccent", 0x0117),- ("Eogonek", 0x0118),- ("eogonek", 0x0119),- ("Ecaron", 0x011A),- ("ecaron", 0x011B),- ("Gcircumflex", 0x011C),- ("gcircumflex", 0x011D),- ("Gbreve", 0x011E),- ("gbreve", 0x011F),- ("Gdotaccent", 0x0120),- ("gdotaccent", 0x0121),- ("Gcommaaccent", 0x0122),- ("gcommaaccent", 0x0123),- ("Hcircumflex", 0x0124),- ("hcircumflex", 0x0125),- ("Hbar", 0x0126),- ("hbar", 0x0127),- ("Itilde", 0x0128),- ("itilde", 0x0129),- ("Imacron", 0x012A),- ("imacron", 0x012B),- ("Iogonek", 0x012E),- ("iogonek", 0x012F),- ("Idotaccent", 0x0130),- ("dotlessi", 0x0131),- ("IJ", 0x0132),- ("ij", 0x0133),- ("Jcircumflex", 0x0134),- ("jcircumflex", 0x0135),- ("Kcommaaccent", 0x0136),- ("kcommaaccent", 0x0137),- ("Lacute", 0x0139),- ("lacute", 0x013A),- ("Lcommaaccent", 0x013B),- ("lcommaaccent", 0x013C),- ("Lcaron", 0x013D),- ("lcaron", 0x013E),- ("Ldot", 0x013F),- ("ldot", 0x0140),- ("Lslash", 0x0141),- ("lslash", 0x0142),- ("Nacute", 0x0143),- ("nacute", 0x0144),- ("Ncommaaccent", 0x0145),- ("ncommaaccent", 0x0146),- ("Ncaron", 0x0147),- ("ncaron", 0x0148),- ("Omacron", 0x014C),- ("omacron", 0x014D),- ("Obreve", 0x014E),- ("obreve", 0x014F),- ("Ohungarumlaut", 0x0150),- ("ohungarumlaut", 0x0151),- ("OE", 0x0152),- ("oe", 0x0153),- ("Racute", 0x0154),- ("racute", 0x0155),- ("Rcommaaccent", 0x0156),- ("rcommaaccent", 0x0157),- ("Rcaron", 0x0158),- ("rcaron", 0x0159),- ("Sacute", 0x015A),- ("sacute", 0x015B),- ("Scircumflex", 0x015C),- ("scircumflex", 0x015D),- ("Scedilla", 0x015E),- ("scedilla", 0x015F),- ("Scaron", 0x0160),- ("scaron", 0x0161),- ("Tcommaaccent", 0x0162),- ("tcommaaccent", 0x0163),- ("Tcaron", 0x0164),- ("tcaron", 0x0165),- ("Tbar", 0x0166),- ("tbar", 0x0167),- ("Utilde", 0x0168),- ("utilde", 0x0169),- ("Umacron", 0x016A),- ("umacron", 0x016B),- ("Ubreve", 0x016C),- ("ubreve", 0x016D),- ("Uring", 0x016E),- ("uring", 0x016F),- ("Uhungarumlaut", 0x0170),- ("uhungarumlaut", 0x0171),- ("Uogonek", 0x0172),- ("uogonek", 0x0173),- ("Wcircumflex", 0x0174),- ("wcircumflex", 0x0175),- ("Ycircumflex", 0x0176),- ("ycircumflex", 0x0177),- ("Ydieresis", 0x0178),- ("Zacute", 0x0179),- ("zacute", 0x017A),- ("Zdotaccent", 0x017B),- ("zdotaccent", 0x017C),- ("Zcaron", 0x017D),- ("zcaron", 0x017E),- ("longs", 0x017F),- ("bbar", 0x0180),- ("florin", 0x0192),- ("circumflex", 0x02C6),- ("caron", 0x02C7),- ("breve", 0x02D8),- ("dotaccent", 0x02D9),- ("ring", 0x02DA),- ("ogonek", 0x02DB),- ("tilde", 0x02DC),- ("hungarumlaut", 0x02DD),- ("gravecomb", 0x0300),- ("acutecomb", 0x0301),- ("tildecomb", 0x0303),- // Greek- ("Alpha", 0x0391),- ("Beta", 0x0392),- ("Gamma", 0x0393),- ("Delta", 0x0394),- ("Epsilon", 0x0395),- ("Zeta", 0x0396),- ("Eta", 0x0397),- ("Theta", 0x0398),- ("Iota", 0x0399),- ("Kappa", 0x039A),- ("Lambda", 0x039B),- ("Mu", 0x039C),- ("Nu", 0x039D),- ("Xi", 0x039E),- ("Omicron", 0x039F),- ("Pi", 0x03A0),- ("Rho", 0x03A1),- ("Sigma", 0x03A3),- ("Tau", 0x03A4),- ("Upsilon", 0x03A5),- ("Phi", 0x03A6),- ("Chi", 0x03A7),- ("Psi", 0x03A8),- ("Omega", 0x03A9),- ("alpha", 0x03B1),- ("beta", 0x03B2),- ("gamma", 0x03B3),- ("delta", 0x03B4),- ("epsilon", 0x03B5),- ("zeta", 0x03B6),- ("eta", 0x03B7),- ("theta", 0x03B8),- ("iota", 0x03B9),- // No ("mu", 0x03BC) here: the AGL name for U+03BC is `mugreek`, and `mu` is- // U+00B5 MICRO SIGN (listed above with the Latin-1 names). A duplicate key- // here silently won, because later inserts overwrite earlier ones.- ("kappa", 0x03BA),- ("lambda", 0x03BB),- ("mugreek", 0x03BC),- ("nu", 0x03BD),- ("xi", 0x03BE),- ("omicron", 0x03BF),- ("pi", 0x03C0),- ("rho", 0x03C1),- ("sigma", 0x03C3),- ("tau", 0x03C4),- ("upsilon", 0x03C5),- ("phi", 0x03C6),- ("chi", 0x03C7),- ("psi", 0x03C8),- ("omega", 0x03C9),- // Punctuation / symbols- ("endash", 0x2013),- ("emdash", 0x2014),- ("quoteleft", 0x2018),- ("quoteright", 0x2019),- ("quotesinglbase", 0x201A),- ("quotedblleft", 0x201C),- ("quotedblright", 0x201D),- ("quotedblbase", 0x201E),- ("dagger", 0x2020),- ("daggerdbl", 0x2021),- ("bullet", 0x2022),- ("ellipsis", 0x2026),- ("perthousand", 0x2030),- ("guilsinglleft", 0x2039),- ("guilsinglright", 0x203A),- ("fraction", 0x2044),- ("Euro", 0x20AC),- ("trademark", 0x2122),- ("partialdiff", 0x2202),- ("product", 0x220F),- ("summation", 0x2211),- ("minus", 0x2212),- ("radical", 0x221A),- ("infinity", 0x221E),- ("integral", 0x222B),- ("approxequal", 0x2248),- ("notequal", 0x2260),- ("lessequal", 0x2264),- ("greaterequal", 0x2265),- ("lozenge", 0x25CA),- // Critical ligatures- ("ff", 0xFB00),- ("fi", 0xFB01),- ("fl", 0xFB02),- ("ffi", 0xFB03),- ("ffl", 0xFB04),- ("f_f", 0xFB00),- ("f_i", 0xFB01),- ("f_l", 0xFB02),- ("f_f_i", 0xFB03),- ("f_f_l", 0xFB04),- // `st` is a real AGL-resolvable ligature (U+FB06). `fb`/`ft`/`ct` have no- // Unicode ligature, and mapping them to U+FB00 (ff) put a character in the- // extracted text that the page does not contain — it neither matches a- // search for "ft" nor renders as one. Omitted rather than approximated.- ("st", 0xFB06),- ("longs", 0x017F),- ("longs_s", 0xFB05),- ("nbspace", 0x00A0),- ("sfthyphen", 0x00AD),- ("hyphenminus", 0x002D),- ("apple", 0xF8FF),- ("afii10017", 0x0410),- ("afii10018", 0x0411),- ("afii10019", 0x0412),- ("Delta", 0x0394),- ("Omega", 0x03A9),- ("alpha", 0x03B1),- ("beta", 0x03B2),-];-+include!("glyphlist_part1.rs");+include!("glyphlist_part2.rs");+include!("glyphlist_part3.rs"); #[cfg(test)] mod tests { use super::*;
pdf/src/main/rust/src/glyphlist_part1.rs
diff --git a/pdf/src/main/rust/src/glyphlist_part1.rs b/pdf/src/main/rust/src/glyphlist_part1.rsnew file mode 100644index 0000000000..8ebb4039f1--- /dev/null+++ b/pdf/src/main/rust/src/glyphlist_part1.rs@@ -0,0 +1,371 @@+/// MacRoman high range 0x80..=0xFF (low range is ASCII identity).+const MAC_ROMAN_HIGH: &[(u32, u32)] = &[+ (0x80, 0x00C4),+ (0x81, 0x00C5),+ (0x82, 0x00C7),+ (0x83, 0x00C9),+ (0x84, 0x00D1),+ (0x85, 0x00D6),+ (0x86, 0x00DC),+ (0x87, 0x00E1),+ (0x88, 0x00E0),+ (0x89, 0x00E2),+ (0x8A, 0x00E4),+ (0x8B, 0x00E3),+ (0x8C, 0x00E5),+ (0x8D, 0x00E7),+ (0x8E, 0x00E9),+ (0x8F, 0x00E8),+ (0x90, 0x00EA),+ (0x91, 0x00EB),+ (0x92, 0x00ED),+ (0x93, 0x00EC),+ (0x94, 0x00EE),+ (0x95, 0x00EF),+ (0x96, 0x00F1),+ (0x97, 0x00F3),+ (0x98, 0x00F2),+ (0x99, 0x00F4),+ (0x9A, 0x00F6),+ (0x9B, 0x00F5),+ (0x9C, 0x00FA),+ (0x9D, 0x00F9),+ (0x9E, 0x00FB),+ (0x9F, 0x00FC),+ (0xA0, 0x2020),+ (0xA1, 0x00B0),+ (0xA2, 0x00A2),+ (0xA3, 0x00A3),+ (0xA4, 0x00A7),+ (0xA5, 0x2022),+ (0xA6, 0x00B6),+ (0xA7, 0x00DF),+ (0xA8, 0x00AE),+ (0xA9, 0x00A9),+ (0xAA, 0x2122),+ (0xAB, 0x00B4),+ (0xAC, 0x00A8),+ (0xAD, 0x2260),+ (0xAE, 0x00C6),+ (0xAF, 0x00D8),+ (0xB0, 0x221E),+ (0xB1, 0x00B1),+ (0xB2, 0x2264),+ (0xB3, 0x2265),+ (0xB4, 0x00A5),+ (0xB5, 0x00B5),+ (0xB6, 0x2202),+ (0xB7, 0x2211),+ (0xB8, 0x220F),+ (0xB9, 0x03C0),+ (0xBA, 0x222B),+ (0xBB, 0x00AA),+ (0xBC, 0x00BA),+ (0xBD, 0x03A9),+ (0xBE, 0x00E6),+ (0xBF, 0x00F8),+ (0xC0, 0x00BF),+ (0xC1, 0x00A1),+ (0xC2, 0x00AC),+ (0xC3, 0x221A),+ (0xC4, 0x0192),+ (0xC5, 0x2248),+ (0xC6, 0x2206),+
Diff truncated.