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

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

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 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 _FPF_SKIA_FONTMGR_H_ 7 #ifndef _FPF_SKIA_FONTMGR_H_
8 #define _FPF_SKIA_FONTMGR_H_ 8 #define _FPF_SKIA_FONTMGR_H_
9 #if _FX_OS_ == _FX_ANDROID_ 9 #if _FX_OS_ == _FX_ANDROID_
10 #define FPF_SKIAFONTTYPE_Unknown» 0 10 #define FPF_SKIAFONTTYPE_Unknown 0
11 #define»FPF_SKIAFONTTYPE_Path» » 1 11 #define FPF_SKIAFONTTYPE_Path 1
12 #define FPF_SKIAFONTTYPE_File» » 2 12 #define FPF_SKIAFONTTYPE_File 2
13 #define FPF_SKIAFONTTYPE_Buffer»» 3 13 #define FPF_SKIAFONTTYPE_Buffer 3
14 class CFPF_SkiaFontDescriptor : public CFX_Object 14 class CFPF_SkiaFontDescriptor : public CFX_Object {
15 { 15 public:
16 public: 16 CFPF_SkiaFontDescriptor()
17 CFPF_SkiaFontDescriptor() : m_pFamily(NULL), m_dwStyle(0), m_iFaceIndex(0), m_dwCharsets(0), m_iGlyphNum(0) {} 17 : m_pFamily(NULL),
18 virtual ~CFPF_SkiaFontDescriptor() 18 m_dwStyle(0),
19 { 19 m_iFaceIndex(0),
20 if (m_pFamily) { 20 m_dwCharsets(0),
21 FX_Free(m_pFamily); 21 m_iGlyphNum(0) {}
22 } 22 virtual ~CFPF_SkiaFontDescriptor() {
23 if (m_pFamily) {
24 FX_Free(m_pFamily);
23 } 25 }
24 virtual» FX_INT32» GetType() const 26 }
25 { 27 virtual FX_INT32 GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
26 return FPF_SKIAFONTTYPE_Unknown; 28 void SetFamily(FX_LPCSTR pFamily) {
29 if (m_pFamily) {
30 FX_Free(m_pFamily);
27 } 31 }
28 void» » » » SetFamily(FX_LPCSTR pFamily) 32 FX_INT32 iSize = FXSYS_strlen(pFamily);
29 { 33 m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
30 if (m_pFamily) { 34 FXSYS_memcpy32(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
31 FX_Free(m_pFamily); 35 m_pFamily[iSize] = 0;
32 } 36 }
33 FX_INT32 iSize = FXSYS_strlen(pFamily); 37 FX_LPSTR m_pFamily;
34 m_pFamily = FX_Alloc(FX_CHAR, iSize + 1); 38 FX_DWORD m_dwStyle;
35 FXSYS_memcpy32(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); 39 FX_INT32 m_iFaceIndex;
36 m_pFamily[iSize] = 0; 40 FX_DWORD m_dwCharsets;
41 FX_INT32 m_iGlyphNum;
42 };
43 class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
44 public:
45 CFPF_SkiaPathFont() : m_pPath(NULL) {}
46 virtual ~CFPF_SkiaPathFont() {
47 if (m_pPath) {
48 FX_Free(m_pPath);
37 } 49 }
38 FX_LPSTR» » m_pFamily; 50 }
39 FX_DWORD» » m_dwStyle; 51 virtual FX_INT32 GetType() const { return FPF_SKIAFONTTYPE_Path; }
40 FX_INT32» » m_iFaceIndex; 52 void SetPath(FX_LPCSTR pPath) {
41 FX_DWORD» » m_dwCharsets; 53 if (m_pPath) {
42 FX_INT32» » m_iGlyphNum; 54 FX_Free(m_pPath);
55 }
56 FX_INT32 iSize = FXSYS_strlen(pPath);
57 m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
58 FXSYS_memcpy32(m_pPath, pPath, iSize * sizeof(FX_CHAR));
59 m_pPath[iSize] = 0;
60 }
61 FX_LPSTR m_pPath;
43 }; 62 };
44 class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor 63 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
45 { 64 public:
46 public: 65 CFPF_SkiaFileFont() : m_pFile(NULL) {}
47 CFPF_SkiaPathFont() : m_pPath(NULL) {} 66 virtual FX_INT32 GetType() const { return FPF_SKIAFONTTYPE_File; }
48 virtual ~CFPF_SkiaPathFont() 67 IFX_FileRead* m_pFile;
49 {
50 if (m_pPath) {
51 FX_Free(m_pPath);
52 }
53 }
54 virtual» FX_INT32» GetType() const
55 {
56 return FPF_SKIAFONTTYPE_Path;
57 }
58 void» » » » SetPath(FX_LPCSTR pPath)
59 {
60 if (m_pPath) {
61 FX_Free(m_pPath);
62 }
63 FX_INT32 iSize = FXSYS_strlen(pPath);
64 m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
65 FXSYS_memcpy32(m_pPath, pPath, iSize * sizeof(FX_CHAR));
66 m_pPath[iSize] = 0;
67 }
68 FX_LPSTR» » m_pPath;
69 }; 68 };
70 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor 69 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
71 { 70 public:
72 public: 71 CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {}
73 CFPF_SkiaFileFont() : m_pFile(NULL) {} 72 virtual FX_INT32 GetType() const { return FPF_SKIAFONTTYPE_Buffer; }
74 virtual FX_INT32» GetType() const 73 FX_LPVOID m_pBuffer;
75 { 74 size_t m_szBuffer;
76 return FPF_SKIAFONTTYPE_File;
77 }
78 IFX_FileRead» » *m_pFile;
79 }; 75 };
80 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor 76 class CFPF_SkiaFontMgr : public IFPF_FontMgr, public CFX_Object {
81 { 77 public:
82 public: 78 CFPF_SkiaFontMgr();
83 CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {} 79 virtual ~CFPF_SkiaFontMgr();
84 virtual FX_INT32» GetType() const 80 FX_BOOL InitFTLibrary();
85 { 81 virtual void LoadSystemFonts();
86 return FPF_SKIAFONTTYPE_Buffer; 82 virtual void LoadPrivateFont(IFX_FileRead* pFontFile);
87 } 83 virtual void LoadPrivateFont(FX_BSTR bsFileName);
88 FX_LPVOID» » » m_pBuffer; 84 virtual void LoadPrivateFont(FX_LPVOID pBuffer, size_t szBuffer);
89 size_t» » » » m_szBuffer;
90 };
91 class CFPF_SkiaFontMgr : public IFPF_FontMgr, public CFX_Object
92 {
93 public:
94 CFPF_SkiaFontMgr();
95 virtual ~CFPF_SkiaFontMgr();
96 FX_BOOL» » » » » InitFTLibrary();
97 virtual void» » » LoadSystemFonts();
98 virtual void» » » LoadPrivateFont(IFX_FileRead* pFontFile) ;
99 virtual void» » » LoadPrivateFont(FX_BSTR bsFileName);
100 virtual void» » » LoadPrivateFont(FX_LPVOID pBuffer, size_ t szBuffer);
101 85
102 virtual IFPF_Font*» » CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharse t, FX_DWORD dwStyle, FX_DWORD dwMatch = 0); 86 virtual IFPF_Font* CreateFont(FX_BSTR bsFamilyname,
103 FXFT_Face» » » » GetFontFace(IFX_FileRead *pFileRead, FX_ INT32 iFaceIndex = 0); 87 FX_BYTE uCharset,
104 FXFT_Face» » » » GetFontFace(FX_BSTR bsFile, FX_INT32 iFa ceIndex = 0); 88 FX_DWORD dwStyle,
105 FXFT_Face» » » » GetFontFace(FX_LPCBYTE pBuffer, size_t s zBuffer, FX_INT32 iFaceIndex = 0); 89 FX_DWORD dwMatch = 0);
106 protected: 90 FXFT_Face GetFontFace(IFX_FileRead* pFileRead, FX_INT32 iFaceIndex = 0);
107 void» » » » ScanPath(FX_BSTR path); 91 FXFT_Face GetFontFace(FX_BSTR bsFile, FX_INT32 iFaceIndex = 0);
108 void» » » » ScanFile(FX_BSTR file); 92 FXFT_Face GetFontFace(FX_LPCBYTE pBuffer,
109 void» » » » ReportFace(FXFT_Face face, CFPF_SkiaFont Descriptor *pFontDesc); 93 size_t szBuffer,
110 void» » » » OutputSystemFonts(); 94 FX_INT32 iFaceIndex = 0);
111 FX_BOOL» » » » m_bLoaded; 95
112 CFX_PtrArray» » m_FontFaces; 96 protected:
113 FXFT_Library» » m_FTLibrary; 97 void ScanPath(FX_BSTR path);
114 CFX_MapPtrToPtr» » m_FamilyFonts; 98 void ScanFile(FX_BSTR file);
99 void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
100 void OutputSystemFonts();
101 FX_BOOL m_bLoaded;
102 CFX_PtrArray m_FontFaces;
103 FXFT_Library m_FTLibrary;
104 CFX_MapPtrToPtr m_FamilyFonts;
115 }; 105 };
116 #endif 106 #endif
117 #endif 107 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698