Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.40 KB | None | 0 0
  1. diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
  2. index 41b8bb9..99fb36d 100644
  3. --- a/poppler/GfxFont.cc
  4. +++ b/poppler/GfxFont.cc
  5. @@ -1242,11 +1242,15 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA
  6. // pass 1: use the name-to-Unicode mapping table
  7. missing = hex = false;
  8. bool isZapfDingbats = name && name->endsWith("ZapfDingbats");
  9. + bool isWPTypographicSymbols = name && name->endsWith("WPTypographicSymbols");
  10. for (int code = 0; code < 256; ++code) {
  11. if ((charName = enc[code])) {
  12. if (isZapfDingbats) {
  13. // include ZapfDingbats names
  14. toUnicode[code] = globalParams->mapNameToUnicodeAll(charName);
  15. + } else if (isWPTypographicSymbols) {
  16. + // include WPTypographicSymbols names
  17. + toUnicode[code] = globalParams->mapNameToUnicodeWPTypographicSymbols(charName);
  18. } else {
  19. toUnicode[code] = globalParams->mapNameToUnicodeText(charName);
  20. }
  21. diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
  22. index 60d3ca9..b7fcf30 100644
  23. --- a/poppler/GlobalParams.cc
  24. +++ b/poppler/GlobalParams.cc
  25. @@ -393,6 +393,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
  26. }
  27.  
  28. nameToUnicodeZapfDingbats = new NameToCharCode();
  29. + nameToUnicodeWPTypographicSymbols = new NameToCharCode();
  30. nameToUnicodeText = new NameToCharCode();
  31. toUnicodeDirs = new GooList();
  32. sysFonts = new SysFontList();
  33. @@ -424,7 +425,11 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
  34. for (int i = 0; nameToUnicodeZapfDingbatsTab[i].name; ++i) {
  35. nameToUnicodeZapfDingbats->add(nameToUnicodeZapfDingbatsTab[i].name, nameToUnicodeZapfDingbatsTab[i].u);
  36. }
  37. -
  38. +
  39. + for (int i = 0; nameToUnicodeWPTypographicSymbolsTab[i].name; ++i) {
  40. + nameToUnicodeWPTypographicSymbols->add(nameToUnicodeWPTypographicSymbolsTab[i].name, nameToUnicodeWPTypographicSymbolsTab[i].u);
  41. + }
  42. +
  43. for (int i = 0; nameToUnicodeTextTab[i].name; ++i) {
  44. nameToUnicodeText->add(nameToUnicodeTextTab[i].name, nameToUnicodeTextTab[i].u);
  45. }
  46. @@ -552,6 +557,7 @@ GlobalParams::~GlobalParams() {
  47. delete macRomanReverseMap;
  48.  
  49. delete nameToUnicodeZapfDingbats;
  50. + delete nameToUnicodeWPTypographicSymbols;
  51. delete nameToUnicodeText;
  52. deleteGooList<GooString>(toUnicodeDirs);
  53. delete sysFonts;
  54. @@ -580,6 +586,14 @@ Unicode GlobalParams::mapNameToUnicodeAll(const char *charName) {
  55. return u;
  56. }
  57.  
  58. +Unicode GlobalParams::mapNameToUnicodeWPTypographicSymbols(const char *charName) {
  59. + Unicode u = nameToUnicodeWPTypographicSymbols->lookup(charName);
  60. + if (!u)
  61. + u = nameToUnicodeText->lookup(charName);
  62. + return u;
  63. +}
  64. +
  65. +
  66. Unicode GlobalParams::mapNameToUnicodeText(const char *charName) {
  67. // no need to lock - nameToUnicodeText is constant
  68. return nameToUnicodeText->lookup(charName);
  69. diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
  70. index 365c489..cf81cb5 100644
  71. --- a/poppler/GlobalParams.h
  72. +++ b/poppler/GlobalParams.h
  73. @@ -118,6 +118,10 @@ public:
  74. // Return Unicode values for character names. Used for glyph
  75. // lookups or text extraction with ZapfDingbats fonts.
  76. Unicode mapNameToUnicodeAll(const char *charName);
  77. +
  78. + // Return Unicode values for character names. Used for glyph
  79. + // lookups or text extraction with WPTypographicSymbols fonts.
  80. + Unicode mapNameToUnicodeWPTypographicSymbols(const char *charName);
  81.  
  82. UnicodeMap *getResidentUnicodeMap(const GooString *encodingName);
  83. FILE *getUnicodeMapFile(const GooString *encodingName);
  84. @@ -182,6 +186,8 @@ private:
  85.  
  86. NameToCharCode * // mapping from char name to Unicode for ZapfDingbats
  87. nameToUnicodeZapfDingbats;
  88. + NameToCharCode * // mapping from char name to Unicode for WPTypographicSymbols
  89. + nameToUnicodeWPTypographicSymbols;
  90. NameToCharCode * // mapping from char name to Unicode for text
  91. nameToUnicodeText; // extraction
  92. // files for mappings from char collections
  93. diff --git a/poppler/NameToUnicodeTable.h b/poppler/NameToUnicodeTable.h
  94. index 7345eab..d758510 100644
  95. --- a/poppler/NameToUnicodeTable.h
  96. +++ b/poppler/NameToUnicodeTable.h
  97. @@ -4482,3 +4482,110 @@ static struct NameToUnicodeTab nameToUnicodeZapfDingbatsTab[] = {
  98. {0x2720, "a9"},
  99. { 0, nullptr }
  100. };
  101. +
  102. +// map WPTypographicSymbols names to Unicode
  103. +static struct NameToUnicodeTab nameToUnicodeWPTypographicSymbolsTab[] = {
  104. + {0x2022, "exclamleft"},
  105. + {0x25e6, "quotedbl"},
  106. + {0x25fc, "numbersign"},
  107. + {0x30fb, "dollar"},
  108. + {0x204e, "percent"},
  109. + {0xb6, "ampersand"},
  110. + {0xa7, "quotesingle"},
  111. + {0xa1, "parenleft"},
  112. + {0xbf, "parenright"},
  113. + {0xab, "asterisk"},
  114. + {0xbb, "plus"},
  115. + {0xa3, "comma"},
  116. + {0xa5, "hyphen"},
  117. + {0x20a7, "period"},
  118. + {0x192, "slash"},
  119. + {0xaa, "zero"},
  120. + {0xba, "one"},
  121. + {0xbd, "two"},
  122. + {0xbc, "three"},
  123. + {0xa2, "four"},
  124. + {0xb2, "five"},
  125. + {0x207f, "six"},
  126. + {0xae, "seven"},
  127. + {0xa9, "eight"},
  128. + {0xa4, "nine"},
  129. + {0xbe, "colon"},
  130. + {0xb3, "semicolon"},
  131. + {0x201b, "less"},
  132. + {0x2019, "equal"},
  133. + {0x2018, "greater"},
  134. + {0x201f, "question"},
  135. + {0x201d, "at"},
  136. + {0x201c, "A"},
  137. + {0x2013, "B"},
  138. + {0x2014, "C"},
  139. + {0x2039, "D"},
  140. + {0x203a, "E"},
  141. + {0x25cb, "F"},
  142. + {0x25a1, "G"},
  143. + {0x2020, "H"},
  144. + {0x2021, "I"},
  145. + {0x2122, "J"},
  146. + {0x2120, "K"},
  147. + {0x211e, "L"},
  148. + {0x25cf, "M"},
  149. + {0x25e6, "N"},
  150. + {0x25a0, "O"},
  151. + {0x25fc, "P"},
  152. + {0x2610, "Q"},
  153. + {0x25fb, "R"},
  154. + {0x2012, "S"},
  155. + {0xfb00, "T"},
  156. + {0xfb03, "U"},
  157. + {0xfb04, "V"},
  158. + {0xfb01, "W"},
  159. + {0xfb02, "X"},
  160. + {0x2026, "Y"},
  161. + {0x24, "Z"},
  162. + {0x20a3, "bracketleft"},
  163. + {0x20a2, "backslash"},
  164. + {0x20a0, "bracketright"},
  165. + {0x20a4, "asciicircum"},
  166. + {0x201a, "underscore"},
  167. + {0x201e, "grave"},
  168. + {0x2153, "a"},
  169. + {0x2154, "b"},
  170. + {0x215b, "c"},
  171. + {0x215c, "d"},
  172. + {0x215d, "e"},
  173. + {0x215e, "f"},
  174. + {0x24c2, "g"},
  175. + {0x2117, "h"},
  176. + {0x20ac, "i"},
  177. + {0x2105, "j"},
  178. + {0x2106, "k"},
  179. + {0x2030, "l"},
  180. + {0x2116, "m"},
  181. + {0x2010, "n"},
  182. + {0xb9, "o"},
  183. + {0x1f137, "p"},
  184. + {0x1f135, "q"},
  185. + {0x1f132, "r"},
  186. + {0x1f13b, "s"},
  187. + {0x1f13d, "t"},
  188. + {0x1f145, "u"},
  189. + {0x267c, "v"},
  190. + {0x20a9, "w"},
  191. + {0x20a6, "x"},
  192. + {0x20a8, "y"},
  193. + {0x1f16b, "z"},
  194. + {0x1f16a, "{"},
  195. + {0x25b6, "|"},
  196. + {0x23f9, "}"},
  197. + {0x23f8, "~"},
  198. + {0x23ee, "florin"},
  199. + {0x1ca, "circumflex"},
  200. + {0xa5, "hyphentwo"},
  201. + {0x23fa, "quotesinglbase"},
  202. + {0x23ed, "quotedblbase"},
  203. + {0x1d11e, "dagger"},
  204. + {0x1d122, "daggerdbl"},
  205. + {0x23cf, "ellipsis"},
  206. + { 0, nullptr }
  207. +};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement