summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-27 15:34:54 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-27 19:51:15 +0000
commitdd17a14f060c39f50ca24522b202ffef5436dd43 (patch)
tree5c95bf7260bd16425d6d071782a891c8235e8c11 /core/fxge
parent290799f8a54e2b1531b6930ed988c5ddc6a2eb42 (diff)
downloadpdfium-dd17a14f060c39f50ca24522b202ffef5436dd43.tar.xz
Move CFX_Font definition to cfx_font.h
This CL moves the CFX_Font definition out of fx_font.h and into cfx_font.h to match the cfx_font.cpp implementation. Change-Id: Icc2fc7463fa4b9d0bec925e80b60a638136a83a1 Reviewed-on: https://pdfium-review.googlesource.com/14951 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp1
-rw-r--r--core/fxge/cfx_facecache.cpp1
-rw-r--r--core/fxge/cfx_facecache.h2
-rw-r--r--core/fxge/cfx_font.cpp2
-rw-r--r--core/fxge/cfx_font.h127
-rw-r--r--core/fxge/cfx_fontcache.h1
-rw-r--r--core/fxge/cfx_renderdevice.cpp1
-rw-r--r--core/fxge/cfx_unicodeencoding.cpp1
-rw-r--r--core/fxge/cfx_unicodeencoding.h2
-rw-r--r--core/fxge/fx_font.h98
-rw-r--r--core/fxge/skia/fx_skia_device.cpp1
-rw-r--r--core/fxge/skia/fx_skia_device_unittest.cpp1
-rw-r--r--core/fxge/win32/fx_win32_print.cpp1
13 files changed, 140 insertions, 99 deletions
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index b82e59cfd1..3c142c6984 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -16,6 +16,7 @@
#include "core/fxge/apple/apple_int.h"
#include "core/fxge/cfx_cliprgn.h"
#include "core/fxge/cfx_facecache.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/fx_freetype.h"
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp
index 782e5f9d07..07d7339c2d 100644
--- a/core/fxge/cfx_facecache.cpp
+++ b/core/fxge/cfx_facecache.cpp
@@ -12,6 +12,7 @@
#include <utility>
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_pathdata.h"
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h
index ef5652ed20..95f01d2f10 100644
--- a/core/fxge/cfx_facecache.h
+++ b/core/fxge/cfx_facecache.h
@@ -18,6 +18,8 @@
#include "third_party/skia/include/core/SkTypeface.h"
#endif
+class CFX_Font;
+
class CFX_FaceCache {
public:
explicit CFX_FaceCache(FXFT_Face face);
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 87ce9b53ec..e893c13357 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxge/fx_font.h"
+#include "core/fxge/cfx_font.h"
#include <algorithm>
#include <limits>
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
new file mode 100644
index 0000000000..d9f6debc5f
--- /dev/null
+++ b/core/fxge/cfx_font.h
@@ -0,0 +1,127 @@
+// Copyright 2017 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_FXGE_CFX_FONT_H_
+#define CORE_FXGE_CFX_FONT_H_
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "core/fxcrt/bytestring.h"
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxcrt/unowned_ptr.h"
+#include "core/fxge/fx_freetype.h"
+
+#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
+#include "core/fxge/fx_font.h"
+#endif
+
+class CFX_FaceCache;
+class CFX_GlyphBitmap;
+class CFX_PathData;
+class CFX_SubstFont;
+class IFX_SeekableReadStream;
+
+class CFX_Font {
+ public:
+ CFX_Font();
+ ~CFX_Font();
+
+ void LoadSubst(const ByteString& face_name,
+ bool bTrueType,
+ uint32_t flags,
+ int weight,
+ int italic_angle,
+ int CharsetCP,
+ bool bVertical);
+
+ bool LoadEmbedded(const uint8_t* data, uint32_t size);
+ FXFT_Face GetFace() const { return m_Face; }
+ CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); }
+
+#ifdef PDF_ENABLE_XFA
+ bool LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, int nFaceIndex);
+
+ bool LoadClone(const CFX_Font* pFont);
+ void SetFace(FXFT_Face face);
+ void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) {
+ m_pSubstFont = std::move(subst);
+ }
+#endif // PDF_ENABLE_XFA
+
+ const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index,
+ bool bFontStyle,
+ const CFX_Matrix* pMatrix,
+ int dest_width,
+ int anti_alias,
+ int& text_flags) const;
+ const CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width) const;
+
+#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
+ CFX_TypeFace* GetDeviceCache() const;
+#endif
+
+ int GetGlyphWidth(uint32_t glyph_index);
+ int GetAscent() const;
+ int GetDescent() const;
+ bool GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox);
+ bool IsItalic() const;
+ bool IsBold() const;
+ bool IsFixedWidth() const;
+ bool IsVertical() const { return m_bVertical; }
+ ByteString GetPsName() const;
+ ByteString GetFamilyName() const;
+ ByteString GetFaceName() const;
+ bool IsTTFont() const;
+ bool GetBBox(FX_RECT& bbox);
+ bool IsEmbedded() const { return m_bEmbedded; }
+ uint8_t* GetSubData() const { return m_pGsubData; }
+ void SetSubData(uint8_t* data) { m_pGsubData = data; }
+#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+ void* GetPlatformFont() const { return m_pPlatformFont; }
+ void SetPlatformFont(void* font) { m_pPlatformFont = font; }
+#endif
+ uint8_t* GetFontData() const { return m_pFontData; }
+ uint32_t GetSize() const { return m_dwSize; }
+ void AdjustMMParams(int glyph_index, int width, int weight) const;
+
+ static const size_t kAngleSkewArraySize = 30;
+ static const char s_AngleSkew[kAngleSkewArraySize];
+ static const size_t kWeightPowArraySize = 100;
+ static const uint8_t s_WeightPow[kWeightPowArraySize];
+ static const uint8_t s_WeightPow_11[kWeightPowArraySize];
+ static const uint8_t s_WeightPow_SHIFTJIS[kWeightPowArraySize];
+
+#ifdef PDF_ENABLE_XFA
+ protected:
+ bool m_bShallowCopy;
+ FXFT_StreamRec* m_pOwnedStream;
+#endif // PDF_ENABLE_XFA
+
+ private:
+ friend class CFX_FaceCache;
+ CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index, int dest_width) const;
+ CFX_FaceCache* GetFaceCache() const;
+ void ReleasePlatformResource();
+ void DeleteFace();
+ void ClearFaceCache();
+
+ FXFT_Face m_Face;
+ mutable UnownedPtr<CFX_FaceCache> m_FaceCache;
+ std::unique_ptr<CFX_SubstFont> m_pSubstFont;
+ std::vector<uint8_t> m_pFontDataAllocation;
+ uint8_t* m_pFontData;
+ uint8_t* m_pGsubData;
+ uint32_t m_dwSize;
+#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
+ void* m_pPlatformFont;
+#endif
+ bool m_bEmbedded;
+ bool m_bVertical;
+};
+
+#endif // CORE_FXGE_CFX_FONT_H_
diff --git a/core/fxge/cfx_fontcache.h b/core/fxge/cfx_fontcache.h
index 52ac3fa342..a14ed09a1e 100644
--- a/core/fxge/cfx_fontcache.h
+++ b/core/fxge/cfx_fontcache.h
@@ -11,6 +11,7 @@
#include <memory>
#include "core/fxcrt/fx_system.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 9c44fbc1ef..9ed77e8b7f 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -14,6 +14,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_facecache.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
diff --git a/core/fxge/cfx_unicodeencoding.cpp b/core/fxge/cfx_unicodeencoding.cpp
index 494ae33bb0..446b62c431 100644
--- a/core/fxge/cfx_unicodeencoding.cpp
+++ b/core/fxge/cfx_unicodeencoding.cpp
@@ -7,6 +7,7 @@
#include "core/fxge/cfx_unicodeencoding.h"
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
diff --git a/core/fxge/cfx_unicodeencoding.h b/core/fxge/cfx_unicodeencoding.h
index 7d020894c0..d64d8877d9 100644
--- a/core/fxge/cfx_unicodeencoding.h
+++ b/core/fxge/cfx_unicodeencoding.h
@@ -32,6 +32,8 @@
#define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n')
#endif // PDF_ENABLE_XFA
+class CFX_Font;
+
class CFX_UnicodeEncoding {
public:
explicit CFX_UnicodeEncoding(CFX_Font* pFont);
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index 598402a7f5..634429e2f6 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -78,104 +78,6 @@ class ScopedFontTransform {
FT_Face m_Face;
};
-class CFX_Font {
- public:
- CFX_Font();
- ~CFX_Font();
-
- void LoadSubst(const ByteString& face_name,
- bool bTrueType,
- uint32_t flags,
- int weight,
- int italic_angle,
- int CharsetCP,
- bool bVertical);
-
- bool LoadEmbedded(const uint8_t* data, uint32_t size);
- FXFT_Face GetFace() const { return m_Face; }
- CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); }
-
-#ifdef PDF_ENABLE_XFA
- bool LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, int nFaceIndex);
-
- bool LoadClone(const CFX_Font* pFont);
- void SetFace(FXFT_Face face);
- void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) {
- m_pSubstFont = std::move(subst);
- }
-#endif // PDF_ENABLE_XFA
-
- const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index,
- bool bFontStyle,
- const CFX_Matrix* pMatrix,
- int dest_width,
- int anti_alias,
- int& text_flags) const;
- const CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width) const;
-
-#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
- CFX_TypeFace* GetDeviceCache() const;
-#endif
-
- int GetGlyphWidth(uint32_t glyph_index);
- int GetAscent() const;
- int GetDescent() const;
- bool GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox);
- bool IsItalic() const;
- bool IsBold() const;
- bool IsFixedWidth() const;
- bool IsVertical() const { return m_bVertical; }
- ByteString GetPsName() const;
- ByteString GetFamilyName() const;
- ByteString GetFaceName() const;
- bool IsTTFont() const;
- bool GetBBox(FX_RECT& bbox);
- bool IsEmbedded() const { return m_bEmbedded; }
- uint8_t* GetSubData() const { return m_pGsubData; }
- void SetSubData(uint8_t* data) { m_pGsubData = data; }
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
- void* GetPlatformFont() const { return m_pPlatformFont; }
- void SetPlatformFont(void* font) { m_pPlatformFont = font; }
-#endif
- uint8_t* GetFontData() const { return m_pFontData; }
- uint32_t GetSize() const { return m_dwSize; }
- void AdjustMMParams(int glyph_index, int width, int weight) const;
-
- static const size_t kAngleSkewArraySize = 30;
- static const char s_AngleSkew[kAngleSkewArraySize];
- static const size_t kWeightPowArraySize = 100;
- static const uint8_t s_WeightPow[kWeightPowArraySize];
- static const uint8_t s_WeightPow_11[kWeightPowArraySize];
- static const uint8_t s_WeightPow_SHIFTJIS[kWeightPowArraySize];
-
-#ifdef PDF_ENABLE_XFA
- protected:
- bool m_bShallowCopy;
- FXFT_StreamRec* m_pOwnedStream;
-#endif // PDF_ENABLE_XFA
-
- private:
- friend class CFX_FaceCache;
- CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index, int dest_width) const;
- CFX_FaceCache* GetFaceCache() const;
- void ReleasePlatformResource();
- void DeleteFace();
- void ClearFaceCache();
-
- FXFT_Face m_Face;
- mutable UnownedPtr<CFX_FaceCache> m_FaceCache;
- std::unique_ptr<CFX_SubstFont> m_pSubstFont;
- std::vector<uint8_t> m_pFontDataAllocation;
- uint8_t* m_pFontData;
- uint8_t* m_pGsubData;
- uint32_t m_dwSize;
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
- void* m_pPlatformFont;
-#endif
- bool m_bEmbedded;
- bool m_bVertical;
-};
-
class CFX_FontFaceInfo {
public:
CFX_FontFaceInfo(ByteString filePath,
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index c8af215f26..8038ec5de1 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -18,6 +18,7 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp
index a959b6e2dc..7cb28cfb49 100644
--- a/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -4,6 +4,7 @@
#include "core/fxge/skia/fx_skia_device.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 2ff9fd07aa..df9e8387d5 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -11,6 +11,7 @@
#include <vector>
#include "core/fxcrt/fx_system.h"
+#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_windowsrenderdevice.h"
#include "core/fxge/dib/cfx_dibextractor.h"
#include "core/fxge/dib/cfx_imagerenderer.h"