Chromium Code Reviews| 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 #ifndef CORE_INCLUDE_FXGE_FX_FONT_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_FONT_H_ |
| 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ | 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #define FXFONT_GREEK_CHARSET 161 | 42 #define FXFONT_GREEK_CHARSET 161 |
| 43 #define FXFONT_TURKISH_CHARSET 162 | 43 #define FXFONT_TURKISH_CHARSET 162 |
| 44 #define FXFONT_HEBREW_CHARSET 177 | 44 #define FXFONT_HEBREW_CHARSET 177 |
| 45 #define FXFONT_ARABIC_CHARSET 178 | 45 #define FXFONT_ARABIC_CHARSET 178 |
| 46 #define FXFONT_BALTIC_CHARSET 186 | 46 #define FXFONT_BALTIC_CHARSET 186 |
| 47 #define FXFONT_FF_FIXEDPITCH 1 | 47 #define FXFONT_FF_FIXEDPITCH 1 |
| 48 #define FXFONT_FF_ROMAN (1 << 4) | 48 #define FXFONT_FF_ROMAN (1 << 4) |
| 49 #define FXFONT_FF_SCRIPT (4 << 4) | 49 #define FXFONT_FF_SCRIPT (4 << 4) |
| 50 #define FXFONT_FW_NORMAL 400 | 50 #define FXFONT_FW_NORMAL 400 |
| 51 #define FXFONT_FW_BOLD 700 | 51 #define FXFONT_FW_BOLD 700 |
| 52 | |
| 52 class CFX_Font { | 53 class CFX_Font { |
| 53 public: | 54 public: |
| 54 CFX_Font(); | 55 CFX_Font(); |
| 55 ~CFX_Font(); | 56 ~CFX_Font(); |
| 56 | 57 |
| 57 FX_BOOL LoadSubst(const CFX_ByteString& face_name, | 58 FX_BOOL LoadSubst(const CFX_ByteString& face_name, |
| 58 FX_BOOL bTrueType, | 59 FX_BOOL bTrueType, |
| 59 FX_DWORD flags, | 60 FX_DWORD flags, |
| 60 int weight, | 61 int weight, |
| 61 int italic_angle, | 62 int italic_angle, |
| 62 int CharsetCP, | 63 int CharsetCP, |
| 63 FX_BOOL bVertical = FALSE); | 64 FX_BOOL bVertical = FALSE); |
| 64 | 65 |
| 65 FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); | 66 FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); |
| 66 | 67 |
|
Tom Sepez
2015/08/17 18:38:01
nit: maybe kill the doublespacing between decls in
Lei Zhang
2015/08/18 06:10:53
Done.
| |
| 67 FX_BOOL LoadFile(IFX_FileRead* pFile); | |
| 68 | |
| 69 FXFT_Face GetFace() const { return m_Face; } | 68 FXFT_Face GetFace() const { return m_Face; } |
| 70 | 69 |
| 71 const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } | 70 const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } |
| 72 | 71 |
| 73 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); | 72 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); |
|
Tom Sepez
2015/08/17 18:38:01
nit: maybe kill the default argument and be explic
Lei Zhang
2015/08/18 06:10:53
There's lots of default arguments all over the pla
| |
| 74 | 73 |
| 75 int GetGlyphWidth(FX_DWORD glyph_index); | 74 int GetGlyphWidth(FX_DWORD glyph_index); |
| 76 | 75 |
| 77 int GetAscent() const; | 76 int GetAscent() const; |
| 78 | 77 |
| 79 int GetDescent() const; | 78 int GetDescent() const; |
| 80 | 79 |
| 81 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox); | 80 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox); |
| 82 | 81 |
| 83 FX_BOOL IsItalic(); | 82 FX_BOOL IsItalic() const; |
| 84 | 83 |
| 85 FX_BOOL IsBold(); | 84 FX_BOOL IsBold() const; |
| 86 | 85 |
| 87 FX_BOOL IsFixedWidth(); | 86 FX_BOOL IsFixedWidth() const; |
| 88 | 87 |
| 89 FX_BOOL IsVertical() const { return m_bVertical; } | 88 FX_BOOL IsVertical() const { return m_bVertical; } |
| 90 | 89 |
| 91 CFX_WideString GetPsName() const; | 90 CFX_WideString GetPsName() const; |
| 92 | 91 |
| 93 CFX_ByteString GetFamilyName() const; | 92 CFX_ByteString GetFamilyName() const; |
| 94 | 93 |
| 95 CFX_ByteString GetFaceName() const; | 94 CFX_ByteString GetFaceName() const; |
| 96 | 95 |
| 97 FX_BOOL IsTTFont(); | 96 FX_BOOL IsTTFont() const; |
| 98 | 97 |
| 99 FX_BOOL GetBBox(FX_RECT& bbox); | 98 FX_BOOL GetBBox(FX_RECT& bbox); |
| 100 | 99 |
| 101 int GetHeight(); | 100 int GetHeight() const; |
| 102 | 101 |
| 103 int GetULPos(); | 102 int GetULPos() const; |
| 104 | 103 |
| 105 int GetULthickness(); | 104 int GetULthickness() const; |
| 106 | 105 |
| 107 int GetMaxAdvanceWidth(); | 106 int GetMaxAdvanceWidth() const; |
| 107 | |
| 108 FX_BOOL IsEmbedded() const { return m_bEmbedded; } | |
| 109 | |
| 110 uint8_t* GetSubData() const { return m_pGsubData; } | |
| 111 void SetSubData(uint8_t* data) { m_pGsubData = data; } | |
| 112 | |
| 113 void AdjustMMParams(int glyph_index, int width, int weight); | |
| 114 | |
| 115 private: | |
| 116 void ReleasePlatformResource(); | |
| 117 | |
| 118 void DeleteFace(); | |
| 108 | 119 |
| 109 FXFT_Face m_Face; | 120 FXFT_Face m_Face; |
| 110 | |
| 111 CFX_SubstFont* m_pSubstFont; | 121 CFX_SubstFont* m_pSubstFont; |
| 112 FX_BOOL IsEmbedded() { return m_bEmbedded; } | |
| 113 | |
| 114 void AdjustMMParams(int glyph_index, int width, int weight); | |
| 115 uint8_t* m_pFontDataAllocation; | 122 uint8_t* m_pFontDataAllocation; |
| 116 uint8_t* m_pFontData; | 123 uint8_t* m_pFontData; |
| 117 uint8_t* m_pGsubData; | 124 uint8_t* m_pGsubData; |
| 118 FX_DWORD m_dwSize; | 125 FX_DWORD m_dwSize; |
| 119 CFX_BinaryBuf m_OtfFontData; | 126 CFX_BinaryBuf m_OtfFontData; |
| 120 void* m_hHandle; | 127 void* m_hHandle; |
| 121 void* m_pPlatformFont; | 128 void* m_pPlatformFont; |
| 122 void* m_pPlatformFontCollection; | 129 void* m_pPlatformFontCollection; |
| 123 void* m_pDwFont; | 130 void* m_pDwFont; |
| 124 FX_BOOL m_bDwLoaded; | 131 FX_BOOL m_bDwLoaded; |
| 125 void ReleasePlatformResource(); | |
| 126 | |
| 127 void DeleteFace(); | |
| 128 | |
| 129 protected: | |
| 130 FX_BOOL m_bEmbedded; | 132 FX_BOOL m_bEmbedded; |
| 131 FX_BOOL m_bVertical; | 133 FX_BOOL m_bVertical; |
| 132 void* m_pOwnedStream; | |
| 133 }; | 134 }; |
| 135 | |
| 134 #define ENCODING_INTERNAL 0 | 136 #define ENCODING_INTERNAL 0 |
| 135 #define ENCODING_UNICODE 1 | 137 #define ENCODING_UNICODE 1 |
| 136 | 138 |
| 137 class IFX_FontEncoding { | 139 class IFX_FontEncoding { |
| 138 public: | 140 public: |
| 139 virtual ~IFX_FontEncoding() {} | 141 virtual ~IFX_FontEncoding() {} |
| 140 | 142 |
| 141 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; | 143 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; |
| 142 | 144 |
| 143 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; | 145 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 class IFX_GSUBTable { | 447 class IFX_GSUBTable { |
| 446 public: | 448 public: |
| 447 static IFX_GSUBTable* Create(CFX_Font* pFont); | 449 static IFX_GSUBTable* Create(CFX_Font* pFont); |
| 448 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 450 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
| 449 | 451 |
| 450 protected: | 452 protected: |
| 451 virtual ~IFX_GSUBTable() {} | 453 virtual ~IFX_GSUBTable() {} |
| 452 }; | 454 }; |
| 453 | 455 |
| 454 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 456 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |