1 // Copyright 2016 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FXGE_CFX_UNICODEENCODING_H_ 8 #define CORE_FXGE_CFX_UNICODEENCODING_H_ 9 10 #include "core/fxge/fx_font.h" 11 12 #define ENCODING_INTERNAL 0 13 #define ENCODING_UNICODE 1 14 15 #ifdef PDF_ENABLE_XFA 16 #define FXFM_ENC_TAG(a, b, c, d) \ 17 (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | \ 18 (uint32_t)(d)) 19 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) 20 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') 21 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') 22 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') 23 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') 24 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') 25 #define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's') 26 #define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a') 27 #define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B') 28 #define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E') 29 #define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C') 30 #define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1') 31 #define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2') 32 #define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n') 33 #endif // PDF_ENABLE_XFA 34 35 class CFX_UnicodeEncoding { 36 public: 37 explicit CFX_UnicodeEncoding(CFX_Font* pFont); 38 virtual ~CFX_UnicodeEncoding(); 39 40 virtual uint32_t GlyphFromCharCode(uint32_t charcode); 41 42 protected: 43 CFX_Font* m_pFont; // Unowned, not nullptr. 44 }; 45 46 #endif // CORE_FXGE_CFX_UNICODEENCODING_H_ 47