Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: core/src/fxge/android/fpf_skiafontmgr.h

Issue 1296043002: Merge to XFA: Use override in more classes in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ 7 #ifndef CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
8 #define CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ 8 #define CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
9 9
10 #if _FX_OS_ == _FX_ANDROID_ 10 #if _FX_OS_ == _FX_ANDROID_
11
12 #include "../../../include/fxge/fpf.h"
13
11 #define FPF_SKIAFONTTYPE_Unknown 0 14 #define FPF_SKIAFONTTYPE_Unknown 0
12 #define FPF_SKIAFONTTYPE_Path 1 15 #define FPF_SKIAFONTTYPE_Path 1
13 #define FPF_SKIAFONTTYPE_File 2 16 #define FPF_SKIAFONTTYPE_File 2
14 #define FPF_SKIAFONTTYPE_Buffer 3 17 #define FPF_SKIAFONTTYPE_Buffer 3
18
15 class CFPF_SkiaFontDescriptor { 19 class CFPF_SkiaFontDescriptor {
16 public: 20 public:
17 CFPF_SkiaFontDescriptor() 21 CFPF_SkiaFontDescriptor()
18 : m_pFamily(NULL), 22 : m_pFamily(NULL),
19 m_dwStyle(0), 23 m_dwStyle(0),
20 m_iFaceIndex(0), 24 m_iFaceIndex(0),
21 m_dwCharsets(0), 25 m_dwCharsets(0),
22 m_iGlyphNum(0) {} 26 m_iGlyphNum(0) {}
23 virtual ~CFPF_SkiaFontDescriptor() { 27 virtual ~CFPF_SkiaFontDescriptor() {
24 if (m_pFamily) { 28 if (m_pFamily) {
25 FX_Free(m_pFamily); 29 FX_Free(m_pFamily);
26 } 30 }
27 } 31 }
32
28 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; } 33 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
34
29 void SetFamily(const FX_CHAR* pFamily) { 35 void SetFamily(const FX_CHAR* pFamily) {
30 if (m_pFamily) { 36 if (m_pFamily) {
31 FX_Free(m_pFamily); 37 FX_Free(m_pFamily);
32 } 38 }
33 int32_t iSize = FXSYS_strlen(pFamily); 39 int32_t iSize = FXSYS_strlen(pFamily);
34 m_pFamily = FX_Alloc(FX_CHAR, iSize + 1); 40 m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
35 FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); 41 FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
36 m_pFamily[iSize] = 0; 42 m_pFamily[iSize] = 0;
37 } 43 }
38 FX_CHAR* m_pFamily; 44 FX_CHAR* m_pFamily;
39 FX_DWORD m_dwStyle; 45 FX_DWORD m_dwStyle;
40 int32_t m_iFaceIndex; 46 int32_t m_iFaceIndex;
41 FX_DWORD m_dwCharsets; 47 FX_DWORD m_dwCharsets;
42 int32_t m_iGlyphNum; 48 int32_t m_iGlyphNum;
43 }; 49 };
50
44 class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { 51 class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
45 public: 52 public:
46 CFPF_SkiaPathFont() : m_pPath(NULL) {} 53 CFPF_SkiaPathFont() : m_pPath(NULL) {}
47 virtual ~CFPF_SkiaPathFont() { 54 ~CFPF_SkiaPathFont() override {
48 if (m_pPath) { 55 if (m_pPath) {
49 FX_Free(m_pPath); 56 FX_Free(m_pPath);
50 } 57 }
51 } 58 }
52 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Path; } 59
60 // CFPF_SkiaFontDescriptor
61 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
62
53 void SetPath(const FX_CHAR* pPath) { 63 void SetPath(const FX_CHAR* pPath) {
54 if (m_pPath) { 64 if (m_pPath) {
55 FX_Free(m_pPath); 65 FX_Free(m_pPath);
56 } 66 }
57 int32_t iSize = FXSYS_strlen(pPath); 67 int32_t iSize = FXSYS_strlen(pPath);
58 m_pPath = FX_Alloc(FX_CHAR, iSize + 1); 68 m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
59 FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR)); 69 FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
60 m_pPath[iSize] = 0; 70 m_pPath[iSize] = 0;
61 } 71 }
62 FX_CHAR* m_pPath; 72 FX_CHAR* m_pPath;
63 }; 73 };
74
64 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { 75 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
65 public: 76 public:
66 CFPF_SkiaFileFont() : m_pFile(NULL) {} 77 CFPF_SkiaFileFont() : m_pFile(NULL) {}
67 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_File; } 78
79 // CFPF_SkiaFontDescriptor
80 int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; }
68 IFX_FileRead* m_pFile; 81 IFX_FileRead* m_pFile;
69 }; 82 };
83
70 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { 84 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
71 public: 85 public:
72 CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {} 86 CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {}
73 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Buffer; } 87
88 // CFPF_SkiaFontDescriptor
89 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; }
90
74 void* m_pBuffer; 91 void* m_pBuffer;
75 size_t m_szBuffer; 92 size_t m_szBuffer;
76 }; 93 };
94
77 class CFPF_SkiaFontMgr : public IFPF_FontMgr { 95 class CFPF_SkiaFontMgr : public IFPF_FontMgr {
78 public: 96 public:
79 CFPF_SkiaFontMgr(); 97 CFPF_SkiaFontMgr();
80 virtual ~CFPF_SkiaFontMgr(); 98 ~CFPF_SkiaFontMgr() override;
99
100 // IFPF_FontMgr
101 void LoadSystemFonts() override;
102 void LoadPrivateFont(IFX_FileRead* pFontFile) override;
103 void LoadPrivateFont(const CFX_ByteStringC& bsFileName) override;
104 void LoadPrivateFont(void* pBuffer, size_t szBuffer) override;
105 IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname,
106 uint8_t uCharset,
107 FX_DWORD dwStyle,
108 FX_DWORD dwMatch = 0) override;
109
81 FX_BOOL InitFTLibrary(); 110 FX_BOOL InitFTLibrary();
82 virtual void LoadSystemFonts();
83 virtual void LoadPrivateFont(IFX_FileRead* pFontFile);
84 virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName);
85 virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer);
86
87 virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname,
88 uint8_t uCharset,
89 FX_DWORD dwStyle,
90 FX_DWORD dwMatch = 0);
91 FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0); 111 FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0);
92 FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); 112 FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0);
93 FXFT_Face GetFontFace(const uint8_t* pBuffer, 113 FXFT_Face GetFontFace(const uint8_t* pBuffer,
94 size_t szBuffer, 114 size_t szBuffer,
95 int32_t iFaceIndex = 0); 115 int32_t iFaceIndex = 0);
96 116
97 protected: 117 protected:
98 void ScanPath(const CFX_ByteStringC& path); 118 void ScanPath(const CFX_ByteStringC& path);
99 void ScanFile(const CFX_ByteStringC& file); 119 void ScanFile(const CFX_ByteStringC& file);
100 void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc); 120 void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
101 void OutputSystemFonts(); 121 void OutputSystemFonts();
102 FX_BOOL m_bLoaded; 122 FX_BOOL m_bLoaded;
103 CFX_PtrArray m_FontFaces; 123 CFX_PtrArray m_FontFaces;
104 FXFT_Library m_FTLibrary; 124 FXFT_Library m_FTLibrary;
105 CFX_MapPtrToPtr m_FamilyFonts; 125 CFX_MapPtrToPtr m_FamilyFonts;
106 }; 126 };
127
107 #endif 128 #endif
108 129
109 #endif // CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ 130 #endif // CORE_SRC_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698