diff options
author | dsinclair <dsinclair@chromium.org> | 2016-10-04 11:08:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-04 11:08:49 -0700 |
commit | bc5e6d289ed40efec2b0e03427e8fc2947bf53e3 (patch) | |
tree | fa1509c1fe1a46a6ebe8861768804883041973be /core/fpdfapi/font/cpdf_fontencoding.h | |
parent | 241543581696e996093bf0c2ae09ece6afe13ba2 (diff) | |
download | pdfium-bc5e6d289ed40efec2b0e03427e8fc2947bf53e3.tar.xz |
Move core/fpdfapi/fpdf_font to core/fpdfapi/font
BUG=pdfium:603
Review-Url: https://codereview.chromium.org/2392773003
Diffstat (limited to 'core/fpdfapi/font/cpdf_fontencoding.h')
-rw-r--r-- | core/fpdfapi/font/cpdf_fontencoding.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h new file mode 100644 index 0000000000..a81035c825 --- /dev/null +++ b/core/fpdfapi/font/cpdf_fontencoding.h @@ -0,0 +1,61 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FONT_CPDF_FONTENCODING_H_ +#define CORE_FPDFAPI_FONT_CPDF_FONTENCODING_H_ + +#include "core/fxcrt/cfx_string_pool_template.h" +#include "core/fxcrt/cfx_weak_ptr.h" +#include "core/fxcrt/fx_string.h" + +#define PDFFONT_ENCODING_BUILTIN 0 +#define PDFFONT_ENCODING_WINANSI 1 +#define PDFFONT_ENCODING_MACROMAN 2 +#define PDFFONT_ENCODING_MACEXPERT 3 +#define PDFFONT_ENCODING_STANDARD 4 +#define PDFFONT_ENCODING_ADOBE_SYMBOL 5 +#define PDFFONT_ENCODING_ZAPFDINGBATS 6 +#define PDFFONT_ENCODING_PDFDOC 7 +#define PDFFONT_ENCODING_MS_SYMBOL 8 +#define PDFFONT_ENCODING_UNICODE 9 + +uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); +FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode); + +FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); +CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); + +const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding); +const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, + uint8_t charcode); + +class CPDF_Object; + +class CPDF_FontEncoding { + public: + CPDF_FontEncoding(); + explicit CPDF_FontEncoding(int PredefinedEncoding); + + void LoadEncoding(CPDF_Object* pEncoding); + + FX_BOOL IsIdentical(CPDF_FontEncoding* pAnother) const; + + FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { + return m_Unicodes[charcode]; + } + int CharCodeFromUnicode(FX_WCHAR unicode) const; + + void SetUnicode(uint8_t charcode, FX_WCHAR unicode) { + m_Unicodes[charcode] = unicode; + } + + CPDF_Object* Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool); + + public: + FX_WCHAR m_Unicodes[256]; +}; + +#endif // CORE_FPDFAPI_FONT_CPDF_FONTENCODING_H_ |