OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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 "xfa/fgas/font/fgas_stdfontmgr.h" | 7 #include "xfa/fgas/font/fgas_stdfontmgr.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_stream.h" | 9 #include "core/fxcrt/include/fx_stream.h" |
10 #include "core/fxge/include/fx_ge.h" | 10 #include "core/fxge/include/fx_ge.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) | 21 CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) |
22 : m_pEnumerator(pEnumerator), | 22 : m_pEnumerator(pEnumerator), |
23 m_FontFaces(), | 23 m_FontFaces(), |
24 m_CPFonts(8), | 24 m_CPFonts(8), |
25 m_FamilyFonts(16), | 25 m_FamilyFonts(16), |
26 m_UnicodeFonts(16), | 26 m_UnicodeFonts(16), |
27 m_BufferFonts(4), | 27 m_BufferFonts(4), |
28 m_StreamFonts(4), | 28 m_StreamFonts(4), |
29 m_DeriveFonts(4) { | 29 m_DeriveFonts(4) { |
30 if (m_pEnumerator) { | 30 if (m_pEnumerator) { |
31 m_pEnumerator(m_FontFaces, NULL, 0xFEFF); | 31 m_pEnumerator(m_FontFaces, nullptr, 0xFEFF); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() { | 35 CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() { |
36 m_FontFaces.RemoveAll(); | 36 m_FontFaces.RemoveAll(); |
37 m_CPFonts.RemoveAll(); | 37 m_CPFonts.RemoveAll(); |
38 m_FamilyFonts.RemoveAll(); | 38 m_FamilyFonts.RemoveAll(); |
39 m_UnicodeFonts.RemoveAll(); | 39 m_UnicodeFonts.RemoveAll(); |
40 m_BufferFonts.RemoveAll(); | 40 m_BufferFonts.RemoveAll(); |
41 m_StreamFonts.RemoveAll(); | 41 m_StreamFonts.RemoveAll(); |
42 m_DeriveFonts.RemoveAll(); | 42 m_DeriveFonts.RemoveAll(); |
43 for (int32_t i = m_Fonts.GetUpperBound(); i >= 0; i--) | 43 for (int32_t i = m_Fonts.GetUpperBound(); i >= 0; i--) |
44 m_Fonts[i]->Release(); | 44 m_Fonts[i]->Release(); |
45 } | 45 } |
46 | 46 |
47 void CFGAS_StdFontMgrImp::Release() { | 47 void CFGAS_StdFontMgrImp::Release() { |
48 delete this; | 48 delete this; |
49 } | 49 } |
50 | 50 |
51 CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( | 51 CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( |
52 uint16_t wCodePage, | 52 uint16_t wCodePage, |
53 uint32_t dwFontStyles, | 53 uint32_t dwFontStyles, |
54 const FX_WCHAR* pszFontFamily) { | 54 const FX_WCHAR* pszFontFamily) { |
55 uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); | 55 uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); |
56 CFGAS_GEFont* pFont = NULL; | 56 CFGAS_GEFont* pFont = nullptr; |
57 if (m_CPFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { | 57 if (m_CPFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { |
58 return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL; | 58 return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; |
59 } | 59 } |
60 FX_FONTDESCRIPTOR const* pFD; | 60 FX_FONTDESCRIPTOR const* pFD = |
61 if ((pFD = FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage)) == NULL) { | 61 FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); |
62 if ((pFD = FindFont(NULL, dwFontStyles, TRUE, wCodePage)) == NULL) { | 62 if (!pFD) |
63 if ((pFD = FindFont(NULL, dwFontStyles, FALSE, wCodePage)) == NULL) | 63 pFD = FindFont(nullptr, dwFontStyles, TRUE, wCodePage); |
64 return NULL; | 64 if (!pFD) |
65 } | 65 pFD = FindFont(nullptr, dwFontStyles, FALSE, wCodePage); |
66 } | 66 if (!pFD) |
67 ASSERT(pFD); | 67 return nullptr; |
| 68 |
68 pFont = | 69 pFont = |
69 CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); | 70 CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); |
70 if (pFont) { | 71 if (pFont) { |
71 m_Fonts.Add(pFont); | 72 m_Fonts.Add(pFont); |
72 m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 73 m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
73 dwHash = FGAS_GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage); | 74 dwHash = FGAS_GetFontFamilyHash(pFD->wsFontFace, dwFontStyles, wCodePage); |
74 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 75 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
75 return LoadFont(pFont, dwFontStyles, wCodePage); | 76 return LoadFont(pFont, dwFontStyles, wCodePage); |
76 } | 77 } |
77 return NULL; | 78 return nullptr; |
78 } | 79 } |
79 | 80 |
80 CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCharset( | 81 CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCharset( |
81 uint8_t nCharset, | 82 uint8_t nCharset, |
82 uint32_t dwFontStyles, | 83 uint32_t dwFontStyles, |
83 const FX_WCHAR* pszFontFamily) { | 84 const FX_WCHAR* pszFontFamily) { |
84 return GetDefFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, | 85 return GetDefFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, |
85 pszFontFamily); | 86 pszFontFamily); |
86 } | 87 } |
87 | 88 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const FX_WCHAR* pszFontFamily) { | 131 const FX_WCHAR* pszFontFamily) { |
131 return GetDefFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), | 132 return GetDefFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), |
132 dwFontStyles, pszFontFamily); | 133 dwFontStyles, pszFontFamily); |
133 } | 134 } |
134 | 135 |
135 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, | 136 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, |
136 uint32_t dwFontStyles, | 137 uint32_t dwFontStyles, |
137 uint16_t wCodePage) { | 138 uint16_t wCodePage) { |
138 uint32_t dwHash = | 139 uint32_t dwHash = |
139 FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); | 140 FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); |
140 CFGAS_GEFont* pFont = NULL; | 141 CFGAS_GEFont* pFont = nullptr; |
141 if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { | 142 if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { |
142 return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL; | 143 return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; |
143 } | 144 } |
144 FX_FONTDESCRIPTOR const* pFD = NULL; | 145 FX_FONTDESCRIPTOR const* pFD = |
145 if ((pFD = FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage)) == NULL) { | 146 FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); |
146 if ((pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage)) == | 147 if (!pFD) |
147 NULL) { | 148 pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage); |
148 return NULL; | 149 if (!pFD) |
149 } | 150 return nullptr; |
150 } | 151 |
151 ASSERT(pFD); | |
152 if (wCodePage == 0xFFFF) { | 152 if (wCodePage == 0xFFFF) { |
153 wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); | 153 wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); |
154 } | 154 } |
155 pFont = | 155 pFont = |
156 CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); | 156 CFGAS_GEFont::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); |
157 if (pFont) { | 157 if (pFont) { |
158 m_Fonts.Add(pFont); | 158 m_Fonts.Add(pFont); |
159 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 159 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
160 dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); | 160 dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); |
161 m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 161 m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
162 return LoadFont(pFont, dwFontStyles, wCodePage); | 162 return LoadFont(pFont, dwFontStyles, wCodePage); |
163 } | 163 } |
164 return NULL; | 164 return nullptr; |
165 } | 165 } |
166 | 166 |
167 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, | 167 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, |
168 int32_t iLength) { | 168 int32_t iLength) { |
169 ASSERT(pBuffer && iLength > 0); | 169 ASSERT(pBuffer && iLength > 0); |
170 CFGAS_GEFont* pFont = NULL; | 170 CFGAS_GEFont* pFont = nullptr; |
171 if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) { | 171 if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) { |
172 if (pFont) { | 172 if (pFont) { |
173 return pFont->Retain(); | 173 return pFont->Retain(); |
174 } | 174 } |
175 } | 175 } |
176 pFont = CFGAS_GEFont::LoadFont(pBuffer, iLength, this); | 176 pFont = CFGAS_GEFont::LoadFont(pBuffer, iLength, this); |
177 if (pFont) { | 177 if (pFont) { |
178 m_Fonts.Add(pFont); | 178 m_Fonts.Add(pFont); |
179 m_BufferFonts.SetAt((void*)pBuffer, pFont); | 179 m_BufferFonts.SetAt((void*)pBuffer, pFont); |
180 return pFont->Retain(); | 180 return pFont->Retain(); |
181 } | 181 } |
182 return NULL; | 182 return nullptr; |
183 } | 183 } |
184 | 184 |
185 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, | 185 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, |
186 const FX_WCHAR* pszFontAlias, | 186 const FX_WCHAR* pszFontAlias, |
187 uint32_t dwFontStyles, | 187 uint32_t dwFontStyles, |
188 uint16_t wCodePage, | 188 uint16_t wCodePage, |
189 FX_BOOL bSaveStream) { | 189 FX_BOOL bSaveStream) { |
190 ASSERT(pFontStream && pFontStream->GetLength() > 0); | 190 ASSERT(pFontStream && pFontStream->GetLength() > 0); |
191 CFGAS_GEFont* pFont = NULL; | 191 CFGAS_GEFont* pFont = nullptr; |
192 if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { | 192 if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { |
193 if (pFont) { | 193 if (pFont) { |
194 if (pszFontAlias) { | 194 if (pszFontAlias) { |
195 uint32_t dwHash = | 195 uint32_t dwHash = |
196 FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage); | 196 FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage); |
197 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 197 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
198 } | 198 } |
199 return LoadFont(pFont, dwFontStyles, wCodePage); | 199 return LoadFont(pFont, dwFontStyles, wCodePage); |
200 } | 200 } |
201 } | 201 } |
202 pFont = CFGAS_GEFont::LoadFont(pFontStream, this, bSaveStream); | 202 pFont = CFGAS_GEFont::LoadFont(pFontStream, this, bSaveStream); |
203 if (pFont) { | 203 if (pFont) { |
204 m_Fonts.Add(pFont); | 204 m_Fonts.Add(pFont); |
205 m_StreamFonts.SetAt((void*)pFontStream, (void*)pFont); | 205 m_StreamFonts.SetAt((void*)pFontStream, (void*)pFont); |
206 if (pszFontAlias) { | 206 if (pszFontAlias) { |
207 uint32_t dwHash = | 207 uint32_t dwHash = |
208 FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage); | 208 FGAS_GetFontFamilyHash(pszFontAlias, dwFontStyles, wCodePage); |
209 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 209 m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
210 } | 210 } |
211 return LoadFont(pFont, dwFontStyles, wCodePage); | 211 return LoadFont(pFont, dwFontStyles, wCodePage); |
212 } | 212 } |
213 return NULL; | 213 return nullptr; |
214 } | 214 } |
215 | 215 |
216 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont, | 216 CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(CFGAS_GEFont* pSrcFont, |
217 uint32_t dwFontStyles, | 217 uint32_t dwFontStyles, |
218 uint16_t wCodePage) { | 218 uint16_t wCodePage) { |
219 ASSERT(pSrcFont); | 219 ASSERT(pSrcFont); |
220 if (pSrcFont->GetFontStyles() == dwFontStyles) { | 220 if (pSrcFont->GetFontStyles() == dwFontStyles) { |
221 return pSrcFont->Retain(); | 221 return pSrcFont->Retain(); |
222 } | 222 } |
223 void* buffer[3] = {pSrcFont, (void*)(uintptr_t)dwFontStyles, | 223 void* buffer[3] = {pSrcFont, (void*)(uintptr_t)dwFontStyles, |
224 (void*)(uintptr_t)wCodePage}; | 224 (void*)(uintptr_t)wCodePage}; |
225 uint32_t dwHash = FX_HashCode_GetA( | 225 uint32_t dwHash = FX_HashCode_GetA( |
226 CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false); | 226 CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false); |
227 CFGAS_GEFont* pFont = NULL; | 227 CFGAS_GEFont* pFont = nullptr; |
228 if (m_DeriveFonts.GetCount() > 0) { | 228 if (m_DeriveFonts.GetCount() > 0) { |
229 m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont); | 229 m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont); |
230 if (pFont) { | 230 if (pFont) { |
231 return pFont->Retain(); | 231 return pFont->Retain(); |
232 } | 232 } |
233 } | 233 } |
234 pFont = pSrcFont->Derive(dwFontStyles, wCodePage); | 234 pFont = pSrcFont->Derive(dwFontStyles, wCodePage); |
235 if (pFont) { | 235 if (pFont) { |
236 m_DeriveFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); | 236 m_DeriveFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); |
237 int32_t index = m_Fonts.Find(pFont); | 237 int32_t index = m_Fonts.Find(pFont); |
238 if (index < 0) { | 238 if (index < 0) { |
239 m_Fonts.Add(pFont); | 239 m_Fonts.Add(pFont); |
240 pFont->Retain(); | 240 pFont->Retain(); |
241 } | 241 } |
242 return pFont; | 242 return pFont; |
243 } | 243 } |
244 return NULL; | 244 return nullptr; |
245 } | 245 } |
246 | 246 |
247 void CFGAS_StdFontMgrImp::ClearFontCache() { | 247 void CFGAS_StdFontMgrImp::ClearFontCache() { |
248 for (int32_t i = 0; i < m_Fonts.GetSize(); i++) | 248 for (int32_t i = 0; i < m_Fonts.GetSize(); i++) |
249 m_Fonts[i]->Reset(); | 249 m_Fonts[i]->Reset(); |
250 } | 250 } |
251 | 251 |
252 void CFGAS_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, | 252 void CFGAS_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, |
253 CFGAS_GEFont* pFont) { | 253 CFGAS_GEFont* pFont) { |
254 FX_POSITION pos = fontMap.GetStartPosition(); | 254 FX_POSITION pos = fontMap.GetStartPosition(); |
255 void* pKey; | 255 void* pKey; |
256 void* pFind; | 256 void* pFind; |
257 while (pos) { | 257 while (pos) { |
258 pFind = NULL; | 258 pFind = nullptr; |
259 fontMap.GetNextAssoc(pos, pKey, pFind); | 259 fontMap.GetNextAssoc(pos, pKey, pFind); |
260 if (pFind != (void*)pFont) { | 260 if (pFind != (void*)pFont) { |
261 continue; | 261 continue; |
262 } | 262 } |
263 fontMap.RemoveKey(pKey); | 263 fontMap.RemoveKey(pKey); |
264 break; | 264 break; |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 void CFGAS_StdFontMgrImp::RemoveFont(CFGAS_GEFont* pFont) { | 268 void CFGAS_StdFontMgrImp::RemoveFont(CFGAS_GEFont* pFont) { |
(...skipping 24 matching lines...) Expand all Loading... |
293 params.pwsFamily = pszFontFamily; | 293 params.pwsFamily = pszFontFamily; |
294 params.dwFontStyles = dwFontStyles; | 294 params.dwFontStyles = dwFontStyles; |
295 params.dwMatchFlags = dwMatchFlags; | 295 params.dwMatchFlags = dwMatchFlags; |
296 FX_FONTDESCRIPTOR const* pDesc = FX_DefFontMatcher(¶ms, m_FontFaces); | 296 FX_FONTDESCRIPTOR const* pDesc = FX_DefFontMatcher(¶ms, m_FontFaces); |
297 if (pDesc) { | 297 if (pDesc) { |
298 return pDesc; | 298 return pDesc; |
299 } | 299 } |
300 if (pszFontFamily && m_pEnumerator) { | 300 if (pszFontFamily && m_pEnumerator) { |
301 CFX_FontDescriptors namedFonts; | 301 CFX_FontDescriptors namedFonts; |
302 m_pEnumerator(namedFonts, pszFontFamily, wUnicode); | 302 m_pEnumerator(namedFonts, pszFontFamily, wUnicode); |
303 params.pwsFamily = NULL; | 303 params.pwsFamily = nullptr; |
304 pDesc = FX_DefFontMatcher(¶ms, namedFonts); | 304 pDesc = FX_DefFontMatcher(¶ms, namedFonts); |
305 if (pDesc == NULL) { | 305 if (!pDesc) { |
306 return NULL; | 306 return nullptr; |
307 } | 307 } |
308 for (int32_t i = m_FontFaces.GetSize() - 1; i >= 0; i--) { | 308 for (int32_t i = m_FontFaces.GetSize() - 1; i >= 0; i--) { |
309 FX_FONTDESCRIPTOR const* pMatch = m_FontFaces.GetPtrAt(i); | 309 FX_FONTDESCRIPTOR const* pMatch = m_FontFaces.GetPtrAt(i); |
310 if (*pMatch == *pDesc) { | 310 if (*pMatch == *pDesc) { |
311 return pMatch; | 311 return pMatch; |
312 } | 312 } |
313 } | 313 } |
314 int index = m_FontFaces.Add(*pDesc); | 314 int index = m_FontFaces.Add(*pDesc); |
315 return m_FontFaces.GetPtrAt(index); | 315 return m_FontFaces.GetPtrAt(index); |
316 } | 316 } |
317 return NULL; | 317 return nullptr; |
318 } | 318 } |
319 | 319 |
320 FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, | 320 FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, |
321 const CFX_FontDescriptors& fonts) { | 321 const CFX_FontDescriptors& fonts) { |
322 FX_FONTDESCRIPTOR const* pBestFont = NULL; | 322 FX_FONTDESCRIPTOR const* pBestFont = nullptr; |
323 int32_t iBestSimilar = 0; | 323 int32_t iBestSimilar = 0; |
324 FX_BOOL bMatchStyle = | 324 FX_BOOL bMatchStyle = |
325 (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; | 325 (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; |
326 int32_t iCount = fonts.GetSize(); | 326 int32_t iCount = fonts.GetSize(); |
327 for (int32_t i = 0; i < iCount; ++i) { | 327 for (int32_t i = 0; i < iCount; ++i) { |
328 FX_FONTDESCRIPTOR const* pFont = fonts.GetPtrAt(i); | 328 FX_FONTDESCRIPTOR const* pFont = fonts.GetPtrAt(i); |
329 if ((pFont->dwFontStyles & FX_FONTSTYLE_BoldItalic) == | 329 if ((pFont->dwFontStyles & FX_FONTSTYLE_BoldItalic) == |
330 FX_FONTSTYLE_BoldItalic) { | 330 FX_FONTSTYLE_BoldItalic) { |
331 continue; | 331 continue; |
332 } | 332 } |
(...skipping 30 matching lines...) Expand all Loading... |
363 if (FXSYS_wcsicmp(pParams->pwsFamily, pFont->wsFontFace) == 0) { | 363 if (FXSYS_wcsicmp(pParams->pwsFamily, pFont->wsFontFace) == 0) { |
364 return pFont; | 364 return pFont; |
365 } | 365 } |
366 } | 366 } |
367 int32_t iSimilarValue = FX_GetSimilarValue(pFont, pParams->dwFontStyles); | 367 int32_t iSimilarValue = FX_GetSimilarValue(pFont, pParams->dwFontStyles); |
368 if (iBestSimilar < iSimilarValue) { | 368 if (iBestSimilar < iSimilarValue) { |
369 iBestSimilar = iSimilarValue; | 369 iBestSimilar = iSimilarValue; |
370 pBestFont = pFont; | 370 pBestFont = pFont; |
371 } | 371 } |
372 } | 372 } |
373 return iBestSimilar < 1 ? NULL : pBestFont; | 373 return iBestSimilar < 1 ? nullptr : pBestFont; |
374 } | 374 } |
375 | 375 |
376 int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont, | 376 int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont, |
377 uint32_t dwFontStyles) { | 377 uint32_t dwFontStyles) { |
378 int32_t iValue = 0; | 378 int32_t iValue = 0; |
379 if ((dwFontStyles & FX_FONTSTYLE_Symbolic) == | 379 if ((dwFontStyles & FX_FONTSTYLE_Symbolic) == |
380 (pFont->dwFontStyles & FX_FONTSTYLE_Symbolic)) { | 380 (pFont->dwFontStyles & FX_FONTSTYLE_Symbolic)) { |
381 iValue += 64; | 381 iValue += 64; |
382 } | 382 } |
383 if ((dwFontStyles & FX_FONTSTYLE_FixedPitch) == | 383 if ((dwFontStyles & FX_FONTSTYLE_FixedPitch) == |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 FXSYS_memcpy(&pFont->FontSignature, &lpntme->ntmFontSig, | 437 FXSYS_memcpy(&pFont->FontSignature, &lpntme->ntmFontSig, |
438 sizeof(lpntme->ntmFontSig)); | 438 sizeof(lpntme->ntmFontSig)); |
439 ((CFX_FontDescriptors*)lParam)->Add(*pFont); | 439 ((CFX_FontDescriptors*)lParam)->Add(*pFont); |
440 FX_Free(pFont); | 440 FX_Free(pFont); |
441 return 1; | 441 return 1; |
442 } | 442 } |
443 | 443 |
444 static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts, | 444 static void FX_EnumGdiFonts(CFX_FontDescriptors& fonts, |
445 const FX_WCHAR* pwsFaceName, | 445 const FX_WCHAR* pwsFaceName, |
446 FX_WCHAR wUnicode) { | 446 FX_WCHAR wUnicode) { |
447 HDC hDC = ::GetDC(NULL); | 447 HDC hDC = ::GetDC(nullptr); |
448 LOGFONTW lfFind; | 448 LOGFONTW lfFind; |
449 FXSYS_memset(&lfFind, 0, sizeof(lfFind)); | 449 FXSYS_memset(&lfFind, 0, sizeof(lfFind)); |
450 lfFind.lfCharSet = DEFAULT_CHARSET; | 450 lfFind.lfCharSet = DEFAULT_CHARSET; |
451 if (pwsFaceName) { | 451 if (pwsFaceName) { |
452 FXSYS_wcsncpy(lfFind.lfFaceName, pwsFaceName, 31); | 452 FXSYS_wcsncpy(lfFind.lfFaceName, pwsFaceName, 31); |
453 lfFind.lfFaceName[31] = 0; | 453 lfFind.lfFaceName[31] = 0; |
454 } | 454 } |
455 EnumFontFamiliesExW(hDC, (LPLOGFONTW)&lfFind, | 455 EnumFontFamiliesExW(hDC, (LPLOGFONTW)&lfFind, |
456 (FONTENUMPROCW)FX_GdiFontEnumProc, (LPARAM)&fonts, 0); | 456 (FONTENUMPROCW)FX_GdiFontEnumProc, (LPARAM)&fonts, 0); |
457 ::ReleaseDC(NULL, hDC); | 457 ::ReleaseDC(nullptr, hDC); |
458 } | 458 } |
459 | 459 |
460 FX_LPEnumAllFonts FX_GetDefFontEnumerator() { | 460 FX_LPEnumAllFonts FX_GetDefFontEnumerator() { |
461 return FX_EnumGdiFonts; | 461 return FX_EnumGdiFonts; |
462 } | 462 } |
463 | 463 |
464 #else | 464 #else |
465 const FX_CHAR* g_FontFolders[] = { | 465 const FX_CHAR* g_FontFolders[] = { |
466 #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ | 466 #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ |
467 "/usr/share/fonts", "/usr/share/X11/fonts/Type1", | 467 "/usr/share/fonts", "/usr/share/X11/fonts/Type1", |
(...skipping 13 matching lines...) Expand all Loading... |
481 CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { | 481 CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { |
482 for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i) | 482 for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i) |
483 m_FolderPaths.Add(g_FontFolders[i]); | 483 m_FolderPaths.Add(g_FontFolders[i]); |
484 } | 484 } |
485 | 485 |
486 CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} | 486 CFX_FontSourceEnum_File::~CFX_FontSourceEnum_File() {} |
487 | 487 |
488 CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { | 488 CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { |
489 Restart: | 489 Restart: |
490 void* pCurHandle = | 490 void* pCurHandle = |
491 m_FolderQueue.GetSize() == 0 | 491 m_FolderQueue.GetSize() != 0 |
492 ? NULL | 492 ? m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle |
493 : m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->pFileHandle; | 493 : nullptr; |
494 if (NULL == pCurHandle) { | 494 if (!pCurHandle) { |
495 if (m_FolderPaths.GetSize() < 1) { | 495 if (m_FolderPaths.GetSize() < 1) { |
496 return ""; | 496 return ""; |
497 } | 497 } |
498 pCurHandle = | 498 pCurHandle = |
499 FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str()); | 499 FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str()); |
500 FX_HandleParentPath hpp; | 500 FX_HandleParentPath hpp; |
501 hpp.pFileHandle = pCurHandle; | 501 hpp.pFileHandle = pCurHandle; |
502 hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1]; | 502 hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1]; |
503 m_FolderQueue.Add(hpp); | 503 m_FolderQueue.Add(hpp); |
504 } | 504 } |
(...skipping 19 matching lines...) Expand all Loading... |
524 } | 524 } |
525 if (bsName == "." || bsName == "..") { | 525 if (bsName == "." || bsName == "..") { |
526 continue; | 526 continue; |
527 } | 527 } |
528 if (bFolder) { | 528 if (bFolder) { |
529 FX_HandleParentPath hpp; | 529 FX_HandleParentPath hpp; |
530 hpp.bsParentPath = | 530 hpp.bsParentPath = |
531 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + | 531 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + |
532 bsFolderSpearator + bsName; | 532 bsFolderSpearator + bsName; |
533 hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str()); | 533 hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str()); |
534 if (hpp.pFileHandle == NULL) { | 534 if (!hpp.pFileHandle) { |
535 continue; | 535 continue; |
536 } | 536 } |
537 m_FolderQueue.Add(hpp); | 537 m_FolderQueue.Add(hpp); |
538 pCurHandle = hpp.pFileHandle; | 538 pCurHandle = hpp.pFileHandle; |
539 continue; | 539 continue; |
540 } | 540 } |
541 bsName = | 541 bsName = |
542 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + | 542 m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + |
543 bsFolderSpearator + bsName; | 543 bsFolderSpearator + bsName; |
544 break; | 544 break; |
545 } | 545 } |
546 return bsName; | 546 return bsName; |
547 } | 547 } |
548 | 548 |
549 FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() { | 549 FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() { |
550 m_wsNext = GetNextFile().UTF8Decode(); | 550 m_wsNext = GetNextFile().UTF8Decode(); |
551 if (0 == m_wsNext.GetLength()) { | 551 if (m_wsNext.GetLength() == 0) { |
552 return (FX_POSITION)0; | 552 return (FX_POSITION)0; |
553 } | 553 } |
554 return (FX_POSITION)-1; | 554 return (FX_POSITION)-1; |
555 } | 555 } |
556 | 556 |
557 IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) { | 557 IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) { |
558 IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext.AsStringC()); | 558 IFX_FileAccess* pAccess = FX_CreateDefaultFileAccess(m_wsNext.AsStringC()); |
559 m_wsNext = GetNextFile().UTF8Decode(); | 559 m_wsNext = GetNextFile().UTF8Decode(); |
560 pos = 0 != m_wsNext.GetLength() ? pAccess : NULL; | 560 pos = m_wsNext.GetLength() != 0 ? pAccess : nullptr; |
561 return pAccess; | 561 return pAccess; |
562 } | 562 } |
563 | 563 |
564 IFGAS_FontMgr* IFGAS_FontMgr::Create(CFX_FontSourceEnum_File* pFontEnum) { | 564 IFGAS_FontMgr* IFGAS_FontMgr::Create(CFX_FontSourceEnum_File* pFontEnum) { |
565 if (!pFontEnum) | 565 if (!pFontEnum) |
566 return nullptr; | 566 return nullptr; |
567 | 567 |
568 std::unique_ptr<CFGAS_FontMgrImp> pFontMgr(new CFGAS_FontMgrImp(pFontEnum)); | 568 std::unique_ptr<CFGAS_FontMgrImp> pFontMgr(new CFGAS_FontMgrImp(pFontEnum)); |
569 if (!pFontMgr->EnumFonts()) | 569 if (!pFontMgr->EnumFonts()) |
570 return nullptr; | 570 return nullptr; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 const FX_WCHAR* pszFontFamily) { | 735 const FX_WCHAR* pszFontFamily) { |
736 return GetFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, | 736 return GetFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, |
737 pszFontFamily); | 737 pszFontFamily); |
738 } | 738 } |
739 | 739 |
740 CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( | 740 CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( |
741 FX_WCHAR wUnicode, | 741 FX_WCHAR wUnicode, |
742 uint32_t dwFontStyles, | 742 uint32_t dwFontStyles, |
743 const FX_WCHAR* pszFontFamily) { | 743 const FX_WCHAR* pszFontFamily) { |
744 CFGAS_GEFont* pFont = nullptr; | 744 CFGAS_GEFont* pFont = nullptr; |
745 if (m_FailedUnicodes2NULL.Lookup(wUnicode, pFont)) | 745 if (m_FailedUnicodes2Nullptr.Lookup(wUnicode, pFont)) |
746 return nullptr; | 746 return nullptr; |
747 const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); | 747 const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); |
748 uint16_t wCodePage = x ? x->wCodePage : 0xFFFF; | 748 uint16_t wCodePage = x ? x->wCodePage : 0xFFFF; |
749 uint16_t wBitField = x ? x->wBitField : 0x03E7; | 749 uint16_t wBitField = x ? x->wBitField : 0x03E7; |
750 CFX_ByteString bsHash; | 750 CFX_ByteString bsHash; |
751 if (wCodePage == 0xFFFF) | 751 if (wCodePage == 0xFFFF) |
752 bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); | 752 bsHash.Format("%d, %d, %d", wCodePage, wBitField, dwFontStyles); |
753 else | 753 else |
754 bsHash.Format("%d, %d", wCodePage, dwFontStyles); | 754 bsHash.Format("%d, %d", wCodePage, dwFontStyles); |
755 bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); | 755 bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); |
(...skipping 22 matching lines...) Expand all Loading... |
778 if (!VerifyUnicode(pDesc, wUnicode)) | 778 if (!VerifyUnicode(pDesc, wUnicode)) |
779 continue; | 779 continue; |
780 pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); | 780 pFont = LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); |
781 if (!pFont) | 781 if (!pFont) |
782 continue; | 782 continue; |
783 pFont->SetLogicalFontStyle(dwFontStyles); | 783 pFont->SetLogicalFontStyle(dwFontStyles); |
784 pFonts->Add(pFont); | 784 pFonts->Add(pFont); |
785 return pFont; | 785 return pFont; |
786 } | 786 } |
787 if (!pszFontFamily) | 787 if (!pszFontFamily) |
788 m_FailedUnicodes2NULL.SetAt(wUnicode, nullptr); | 788 m_FailedUnicodes2Nullptr.SetAt(wUnicode, nullptr); |
789 return nullptr; | 789 return nullptr; |
790 } | 790 } |
791 | 791 |
792 FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, | 792 FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, |
793 FX_WCHAR wcUnicode) { | 793 FX_WCHAR wcUnicode) { |
794 IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); | 794 IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); |
795 if (!pFileRead) | 795 if (!pFileRead) |
796 return FALSE; | 796 return FALSE; |
797 FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex); | 797 FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex); |
798 FT_Error retCharmap = FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE); | 798 FT_Error retCharmap = FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 pos = m_IFXFont2FileRead.GetStartPosition(); | 1124 pos = m_IFXFont2FileRead.GetStartPosition(); |
1125 while (pos) { | 1125 while (pos) { |
1126 CFGAS_GEFont* pFont; | 1126 CFGAS_GEFont* pFont; |
1127 IFX_FileRead* pFileRead; | 1127 IFX_FileRead* pFileRead; |
1128 m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); | 1128 m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); |
1129 pFileRead->Release(); | 1129 pFileRead->Release(); |
1130 } | 1130 } |
1131 } | 1131 } |
1132 | 1132 |
1133 void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { | 1133 void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { |
1134 if (NULL == pEFont) { | 1134 if (!pEFont) { |
1135 return; | 1135 return; |
1136 } | 1136 } |
1137 IFX_FileRead* pFileRead; | 1137 IFX_FileRead* pFileRead; |
1138 if (m_IFXFont2FileRead.Lookup(pEFont, pFileRead)) { | 1138 if (m_IFXFont2FileRead.Lookup(pEFont, pFileRead)) { |
1139 pFileRead->Release(); | 1139 pFileRead->Release(); |
1140 m_IFXFont2FileRead.RemoveKey(pEFont); | 1140 m_IFXFont2FileRead.RemoveKey(pEFont); |
1141 } | 1141 } |
1142 FX_POSITION pos; | 1142 FX_POSITION pos; |
1143 pos = m_Hash2Fonts.GetStartPosition(); | 1143 pos = m_Hash2Fonts.GetStartPosition(); |
1144 while (pos) { | 1144 while (pos) { |
1145 uint32_t dwHash; | 1145 uint32_t dwHash; |
1146 CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts; | 1146 CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts; |
1147 m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); | 1147 m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); |
1148 if (NULL != pFonts) { | 1148 if (pFonts) { |
1149 for (int32_t i = 0; i < pFonts->GetSize(); i++) { | 1149 for (int32_t i = 0; i < pFonts->GetSize(); i++) { |
1150 if (pFonts->GetAt(i) == pEFont) { | 1150 if (pFonts->GetAt(i) == pEFont) { |
1151 pFonts->SetAt(i, NULL); | 1151 pFonts->SetAt(i, nullptr); |
1152 } | 1152 } |
1153 } | 1153 } |
1154 } else { | 1154 } else { |
1155 m_Hash2Fonts.RemoveKey(dwHash); | 1155 m_Hash2Fonts.RemoveKey(dwHash); |
1156 } | 1156 } |
1157 } | 1157 } |
1158 } | 1158 } |
1159 | 1159 |
1160 void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace, | 1160 void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace, |
1161 CFX_FontDescriptors& Fonts, | 1161 CFX_FontDescriptors& Fonts, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 return flag; | 1232 return flag; |
1233 } | 1233 } |
1234 | 1234 |
1235 #define GetUInt8(p) ((uint8_t)((p)[0])) | 1235 #define GetUInt8(p) ((uint8_t)((p)[0])) |
1236 #define GetUInt16(p) ((uint16_t)((p)[0] << 8 | (p)[1])) | 1236 #define GetUInt16(p) ((uint16_t)((p)[0] << 8 | (p)[1])) |
1237 #define GetUInt32(p) \ | 1237 #define GetUInt32(p) \ |
1238 ((uint32_t)((p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3])) | 1238 ((uint32_t)((p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3])) |
1239 | 1239 |
1240 void CFGAS_FontMgrImp::GetNames(const uint8_t* name_table, | 1240 void CFGAS_FontMgrImp::GetNames(const uint8_t* name_table, |
1241 CFX_WideStringArray& Names) { | 1241 CFX_WideStringArray& Names) { |
1242 if (NULL == name_table) { | 1242 if (!name_table) { |
1243 return; | 1243 return; |
1244 } | 1244 } |
1245 uint8_t* lpTable = (uint8_t*)name_table; | 1245 uint8_t* lpTable = (uint8_t*)name_table; |
1246 CFX_WideString wsFamily; | 1246 CFX_WideString wsFamily; |
1247 uint8_t* sp = lpTable + 2; | 1247 uint8_t* sp = lpTable + 2; |
1248 uint8_t* lpNameRecord = lpTable + 6; | 1248 uint8_t* lpNameRecord = lpTable + 6; |
1249 uint16_t nNameCount = GetUInt16(sp); | 1249 uint16_t nNameCount = GetUInt16(sp); |
1250 uint8_t* lpStr = lpTable + GetUInt16(sp + 2); | 1250 uint8_t* lpStr = lpTable + GetUInt16(sp + 2); |
1251 for (uint16_t j = 0; j < nNameCount; j++) { | 1251 for (uint16_t j = 0; j < nNameCount; j++) { |
1252 uint16_t nNameID = GetUInt16(lpNameRecord + j * 12 + 6); | 1252 uint16_t nNameID = GetUInt16(lpNameRecord + j * 12 + 6); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 charsets.push_back(FX_CHARSET_Default); | 1362 charsets.push_back(FX_CHARSET_Default); |
1363 } | 1363 } |
1364 return charsets; | 1364 return charsets; |
1365 } | 1365 } |
1366 | 1366 |
1367 #undef CODEPAGERANGE_IMPLEMENT | 1367 #undef CODEPAGERANGE_IMPLEMENT |
1368 void CFGAS_FontMgrImp::GetUSBCSB(FXFT_Face pFace, | 1368 void CFGAS_FontMgrImp::GetUSBCSB(FXFT_Face pFace, |
1369 uint32_t* USB, | 1369 uint32_t* USB, |
1370 uint32_t* CSB) { | 1370 uint32_t* CSB) { |
1371 TT_OS2* pOS2 = (TT_OS2*)FT_Get_Sfnt_Table(pFace, ft_sfnt_os2); | 1371 TT_OS2* pOS2 = (TT_OS2*)FT_Get_Sfnt_Table(pFace, ft_sfnt_os2); |
1372 if (NULL != pOS2) { | 1372 if (pOS2) { |
1373 USB[0] = pOS2->ulUnicodeRange1; | 1373 USB[0] = pOS2->ulUnicodeRange1; |
1374 USB[1] = pOS2->ulUnicodeRange2; | 1374 USB[1] = pOS2->ulUnicodeRange2; |
1375 USB[2] = pOS2->ulUnicodeRange3; | 1375 USB[2] = pOS2->ulUnicodeRange3; |
1376 USB[3] = pOS2->ulUnicodeRange4; | 1376 USB[3] = pOS2->ulUnicodeRange4; |
1377 CSB[0] = pOS2->ulCodePageRange1; | 1377 CSB[0] = pOS2->ulCodePageRange1; |
1378 CSB[1] = pOS2->ulCodePageRange2; | 1378 CSB[1] = pOS2->ulCodePageRange2; |
1379 } else { | 1379 } else { |
1380 USB[0] = 0; | 1380 USB[0] = 0; |
1381 USB[1] = 0; | 1381 USB[1] = 0; |
1382 USB[2] = 0; | 1382 USB[2] = 0; |
1383 USB[3] = 0; | 1383 USB[3] = 0; |
1384 CSB[0] = 0; | 1384 CSB[0] = 0; |
1385 CSB[1] = 0; | 1385 CSB[1] = 0; |
1386 } | 1386 } |
1387 } | 1387 } |
1388 | 1388 |
1389 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, | 1389 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, |
1390 const CFX_WideString& Name2) { | 1390 const CFX_WideString& Name2) { |
1391 if (Name1.Find(Name2.c_str()) != -1) { | 1391 if (Name1.Find(Name2.c_str()) != -1) { |
1392 return 1; | 1392 return 1; |
1393 } | 1393 } |
1394 return 0; | 1394 return 0; |
1395 } | 1395 } |
1396 | 1396 |
1397 #endif | 1397 #endif |
OLD | NEW |