summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/cpdf_simplefont.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-10-04 11:08:49 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-04 11:08:49 -0700
commitbc5e6d289ed40efec2b0e03427e8fc2947bf53e3 (patch)
treefa1509c1fe1a46a6ebe8861768804883041973be /core/fpdfapi/font/cpdf_simplefont.h
parent241543581696e996093bf0c2ae09ece6afe13ba2 (diff)
downloadpdfium-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_simplefont.h')
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h
new file mode 100644
index 0000000000..592290b99b
--- /dev/null
+++ b/core/fpdfapi/font/cpdf_simplefont.h
@@ -0,0 +1,49 @@
+// 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_SIMPLEFONT_H_
+#define CORE_FPDFAPI_FONT_CPDF_SIMPLEFONT_H_
+
+#include <vector>
+
+#include "core/fpdfapi/font/cpdf_font.h"
+#include "core/fpdfapi/font/cpdf_fontencoding.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/fx_system.h"
+
+class CPDF_SimpleFont : public CPDF_Font {
+ public:
+ CPDF_SimpleFont();
+ ~CPDF_SimpleFont() override;
+
+ // CPDF_Font
+ int GetCharWidthF(uint32_t charcode) override;
+ FX_RECT GetCharBBox(uint32_t charcode) override;
+ int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
+ bool IsUnicodeCompatible() const override;
+ CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+
+ CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
+
+ protected:
+ virtual void LoadGlyphMap() = 0;
+
+ bool LoadCommon();
+ void LoadSubstFont();
+ void LoadCharMetrics(int charcode);
+
+ CPDF_FontEncoding m_Encoding;
+ uint16_t m_GlyphIndex[256];
+ uint16_t m_ExtGID[256];
+ std::vector<CFX_ByteString> m_CharNames;
+ int m_BaseEncoding;
+ uint16_t m_CharWidth[256];
+ FX_RECT m_CharBBox[256];
+ bool m_bUseFontWidth;
+};
+
+#endif // CORE_FPDFAPI_FONT_CPDF_SIMPLEFONT_H_