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

Side by Side Diff: fpdfsdk/fpdf_sysfontinfo.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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
« no previous file with comments | « fpdfsdk/fpdf_progressive.cpp ('k') | fpdfsdk/fpdf_transformpage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "public/fpdf_sysfontinfo.h" 7 #include "public/fpdf_sysfontinfo.h"
8 8
9 #include "core/fxge/cfx_fontmapper.h" 9 #include "core/fxge/cfx_fontmapper.h"
10 #include "core/fxge/cfx_gemodule.h" 10 #include "core/fxge/cfx_gemodule.h"
11 #include "core/fxge/fx_font.h" 11 #include "core/fxge/fx_font.h"
12 #include "core/fxge/ifx_systemfontinfo.h" 12 #include "core/fxge/ifx_systemfontinfo.h"
13 #include "fpdfsdk/fsdk_define.h" 13 #include "fpdfsdk/fsdk_define.h"
14 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" 14 #include "fpdfsdk/pdfwindow/PWL_FontMap.h"
15 15
16 class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { 16 class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
17 public: 17 public:
18 explicit CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {} 18 explicit CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {}
19 ~CFX_ExternalFontInfo() override { 19 ~CFX_ExternalFontInfo() override {
20 if (m_pInfo->Release) 20 if (m_pInfo->Release)
21 m_pInfo->Release(m_pInfo); 21 m_pInfo->Release(m_pInfo);
22 } 22 }
23 23
24 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override { 24 bool EnumFontList(CFX_FontMapper* pMapper) override {
25 if (m_pInfo->EnumFonts) { 25 if (m_pInfo->EnumFonts) {
26 m_pInfo->EnumFonts(m_pInfo, pMapper); 26 m_pInfo->EnumFonts(m_pInfo, pMapper);
27 return TRUE; 27 return true;
28 } 28 }
29 return FALSE; 29 return false;
30 } 30 }
31 31
32 void* MapFont(int weight, 32 void* MapFont(int weight,
33 FX_BOOL bItalic, 33 bool bItalic,
34 int charset, 34 int charset,
35 int pitch_family, 35 int pitch_family,
36 const FX_CHAR* family, 36 const FX_CHAR* family,
37 int& iExact) override { 37 int& iExact) override {
38 if (!m_pInfo->MapFont) 38 if (!m_pInfo->MapFont)
39 return nullptr; 39 return nullptr;
40 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, 40 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family,
41 family, &iExact); 41 family, &iExact);
42 } 42 }
43 43
44 void* GetFont(const FX_CHAR* family) override { 44 void* GetFont(const FX_CHAR* family) override {
45 if (!m_pInfo->GetFont) 45 if (!m_pInfo->GetFont)
46 return nullptr; 46 return nullptr;
47 return m_pInfo->GetFont(m_pInfo, family); 47 return m_pInfo->GetFont(m_pInfo, family);
48 } 48 }
49 49
50 uint32_t GetFontData(void* hFont, 50 uint32_t GetFontData(void* hFont,
51 uint32_t table, 51 uint32_t table,
52 uint8_t* buffer, 52 uint8_t* buffer,
53 uint32_t size) override { 53 uint32_t size) override {
54 if (!m_pInfo->GetFontData) 54 if (!m_pInfo->GetFontData)
55 return 0; 55 return 0;
56 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); 56 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size);
57 } 57 }
58 58
59 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { 59 bool GetFaceName(void* hFont, CFX_ByteString& name) override {
60 if (!m_pInfo->GetFaceName) 60 if (!m_pInfo->GetFaceName)
61 return FALSE; 61 return false;
62 uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0); 62 uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0);
63 if (size == 0) 63 if (size == 0)
64 return FALSE; 64 return false;
65 char* buffer = FX_Alloc(char, size); 65 char* buffer = FX_Alloc(char, size);
66 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); 66 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size);
67 name = CFX_ByteString(buffer, size); 67 name = CFX_ByteString(buffer, size);
68 FX_Free(buffer); 68 FX_Free(buffer);
69 return TRUE; 69 return true;
70 } 70 }
71 71
72 FX_BOOL GetFontCharset(void* hFont, int& charset) override { 72 bool GetFontCharset(void* hFont, int& charset) override {
73 if (!m_pInfo->GetFontCharset) 73 if (!m_pInfo->GetFontCharset)
74 return FALSE; 74 return false;
75 75
76 charset = m_pInfo->GetFontCharset(m_pInfo, hFont); 76 charset = m_pInfo->GetFontCharset(m_pInfo, hFont);
77 return TRUE; 77 return true;
78 } 78 }
79 79
80 void DeleteFont(void* hFont) override { 80 void DeleteFont(void* hFont) override {
81 if (m_pInfo->DeleteFont) 81 if (m_pInfo->DeleteFont)
82 m_pInfo->DeleteFont(m_pInfo, hFont); 82 m_pInfo->DeleteFont(m_pInfo, hFont);
83 } 83 }
84 84
85 private: 85 private:
86 FPDF_SYSFONTINFO* const m_pInfo; 86 FPDF_SYSFONTINFO* const m_pInfo;
87 }; 87 };
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 pFontInfoExt->GetFaceName = DefaultGetFaceName; 187 pFontInfoExt->GetFaceName = DefaultGetFaceName;
188 pFontInfoExt->GetFont = DefaultGetFont; 188 pFontInfoExt->GetFont = DefaultGetFont;
189 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; 189 pFontInfoExt->GetFontCharset = DefaultGetFontCharset;
190 pFontInfoExt->GetFontData = DefaultGetFontData; 190 pFontInfoExt->GetFontData = DefaultGetFontData;
191 pFontInfoExt->MapFont = DefaultMapFont; 191 pFontInfoExt->MapFont = DefaultMapFont;
192 pFontInfoExt->Release = DefaultRelease; 192 pFontInfoExt->Release = DefaultRelease;
193 pFontInfoExt->version = 1; 193 pFontInfoExt->version = 1;
194 pFontInfoExt->m_pFontInfo = pFontInfo.release(); 194 pFontInfoExt->m_pFontInfo = pFontInfo.release();
195 return pFontInfoExt; 195 return pFontInfoExt;
196 } 196 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_progressive.cpp ('k') | fpdfsdk/fpdf_transformpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698