OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_resource.h" | 9 #include "../../../include/fpdfapi/fpdf_resource.h" |
9 #include "../../../include/fxge/fx_freetype.h" | 10 #include "../../../include/fxge/fx_freetype.h" |
10 | 11 |
11 // TODO(tsepez): These belong in headers, too. | |
12 extern const FX_WORD PDFDocEncoding[256]; | |
13 | |
14 static const struct _UnicodeAlt { | 12 static const struct _UnicodeAlt { |
15 FX_WORD m_Unicode; | 13 FX_WORD m_Unicode; |
16 const FX_CHAR* m_Alter; | 14 const FX_CHAR* m_Alter; |
17 } UnicodeAlts[] = { | 15 } UnicodeAlts[] = { |
18 {0x00a0, " "}, {0x00a1, "!"}, {0x00a2, "c"}, {0x00a3, "P"}, | 16 {0x00a0, " "}, {0x00a1, "!"}, {0x00a2, "c"}, {0x00a3, "P"}, |
19 {0x00a4, "o"}, {0x00a5, "Y"}, {0x00a6, "|"}, {0x00a7, "S"}, | 17 {0x00a4, "o"}, {0x00a5, "Y"}, {0x00a6, "|"}, {0x00a7, "S"}, |
20 {0x00a9, "(C)"}, {0x00aa, "a"}, {0x00ab, "<<"}, {0x00ac, "-|"}, | 18 {0x00a9, "(C)"}, {0x00aa, "a"}, {0x00ab, "<<"}, {0x00ac, "-|"}, |
21 {0x00ae, "(R)"}, {0x00af, "-"}, {0x00b0, "o"}, {0x00b1, "+/-"}, | 19 {0x00ae, "(R)"}, {0x00af, "-"}, {0x00b0, "o"}, {0x00b1, "+/-"}, |
22 {0x00b2, "^2"}, {0x00b3, "^3"}, {0x00b4, "'"}, {0x00b5, "u"}, | 20 {0x00b2, "^2"}, {0x00b3, "^3"}, {0x00b4, "'"}, {0x00b5, "u"}, |
23 {0x00b6, "P"}, {0x00b7, "."}, {0x00b9, "^1"}, {0x00ba, "o"}, | 21 {0x00b6, "P"}, {0x00b7, "."}, {0x00b9, "^1"}, {0x00ba, "o"}, |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 case PDFFONT_ENCODING_PDFDOC: | 1765 case PDFFONT_ENCODING_PDFDOC: |
1768 return PDFDocEncoding; | 1766 return PDFDocEncoding; |
1769 case PDFFONT_ENCODING_MS_SYMBOL: | 1767 case PDFFONT_ENCODING_MS_SYMBOL: |
1770 return MSSymbolEncoding; | 1768 return MSSymbolEncoding; |
1771 } | 1769 } |
1772 return NULL; | 1770 return NULL; |
1773 } | 1771 } |
1774 FX_DWORD PDF_PredefinedCharCodeFromUnicode(int encoding, FX_WCHAR unicode) { | 1772 FX_DWORD PDF_PredefinedCharCodeFromUnicode(int encoding, FX_WCHAR unicode) { |
1775 return PDF_FindCode(PDF_UnicodesForPredefinedCharSet(encoding), unicode); | 1773 return PDF_FindCode(PDF_UnicodesForPredefinedCharSet(encoding), unicode); |
1776 } | 1774 } |
1777 #ifdef __cplusplus | |
1778 extern "C" { | |
1779 #endif | |
1780 extern int FXFT_unicode_from_adobe_name(const char* name); | |
1781 extern void FXFT_adobe_name_from_unicode(char* glyph_name, FX_WCHAR unicode); | |
1782 #ifdef __cplusplus | |
1783 } | |
1784 #endif | |
1785 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) { | 1775 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) { |
1786 return (FX_WCHAR)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF); | 1776 return (FX_WCHAR)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF); |
1787 } | 1777 } |
1788 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) { | 1778 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) { |
1789 char glyph_name[64]; | 1779 char glyph_name[64]; |
1790 FXFT_adobe_name_from_unicode(glyph_name, unicode); | 1780 FXFT_adobe_name_from_unicode(glyph_name, unicode); |
1791 return CFX_ByteString(glyph_name, -1); | 1781 return CFX_ByteString(glyph_name, -1); |
1792 } | 1782 } |
OLD | NEW |