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

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

Issue 1800523005: Move core/src/ up to core/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « core/src/fxge/android/fpf_skiafontmgr.h ('k') | core/src/fxge/android/fpf_skiamodule.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "core/include/fxcrt/fx_system.h"
8
9 #if _FX_OS_ == _FX_ANDROID_
10
11 #define FPF_SKIAMATCHWEIGHT_NAME1 62
12 #define FPF_SKIAMATCHWEIGHT_NAME2 60
13 #define FPF_SKIAMATCHWEIGHT_1 16
14 #define FPF_SKIAMATCHWEIGHT_2 8
15
16 #include "core/include/fxcrt/fx_ext.h"
17 #include "core/include/fxge/fx_freetype.h"
18 #include "core/src/fxge/android/fpf_skiafont.h"
19 #include "core/src/fxge/android/fpf_skiafontmgr.h"
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 static unsigned long FPF_SkiaStream_Read(FXFT_Stream stream,
25 unsigned long offset,
26 unsigned char* buffer,
27 unsigned long count) {
28 IFX_FileRead* pFileRead = (IFX_FileRead*)stream->descriptor.pointer;
29 if (!pFileRead) {
30 return 0;
31 }
32 if (count > 0) {
33 if (pFileRead->ReadBlock(buffer, (FX_FILESIZE)offset, (size_t)count) !=
34 count) {
35 return 0;
36 }
37 }
38 return count;
39 }
40 static void FPF_SkiaStream_Close(FXFT_Stream stream) {}
41 #ifdef __cplusplus
42 };
43 #endif
44 struct FPF_SKIAFONTMAP {
45 FX_DWORD dwFamily;
46 FX_DWORD dwSubSt;
47 };
48 static const FPF_SKIAFONTMAP g_SkiaFontmap[] = {
49 {0x58c5083, 0xc8d2e345}, {0x5dfade2, 0xe1633081},
50 {0x684317d, 0xe1633081}, {0x14ee2d13, 0xc8d2e345},
51 {0x3918fe2d, 0xbbeeec72}, {0x3b98b31c, 0xe1633081},
52 {0x3d49f40e, 0xe1633081}, {0x432c41c5, 0xe1633081},
53 {0x491b6ad0, 0xe1633081}, {0x5612cab1, 0x59b9f8f1},
54 {0x779ce19d, 0xc8d2e345}, {0x7cc9510b, 0x59b9f8f1},
55 {0x83746053, 0xbbeeec72}, {0xaaa60c03, 0xbbeeec72},
56 {0xbf85ff26, 0xe1633081}, {0xc04fe601, 0xbbeeec72},
57 {0xca3812d5, 0x59b9f8f1}, {0xca383e15, 0x59b9f8f1},
58 {0xcad5eaf6, 0x59b9f8f1}, {0xcb7a04c8, 0xc8d2e345},
59 {0xfb4ce0de, 0xe1633081},
60 };
61 FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) {
62 int32_t iStart = 0;
63 int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP);
64 while (iStart <= iEnd) {
65 int32_t iMid = (iStart + iEnd) / 2;
66 const FPF_SKIAFONTMAP* pItem = &g_SkiaFontmap[iMid];
67 if (dwHash < pItem->dwFamily) {
68 iEnd = iMid - 1;
69 } else if (dwHash > pItem->dwFamily) {
70 iStart = iMid + 1;
71 } else {
72 return pItem->dwSubSt;
73 }
74 }
75 return 0;
76 }
77 static const FPF_SKIAFONTMAP g_SkiaSansFontMap[] = {
78 {0x58c5083, 0xd5b8d10f}, {0x14ee2d13, 0xd5b8d10f},
79 {0x779ce19d, 0xd5b8d10f}, {0xcb7a04c8, 0xd5b8d10f},
80 {0xfb4ce0de, 0xd5b8d10f},
81 };
82 FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) {
83 int32_t iStart = 0;
84 int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP);
85 while (iStart <= iEnd) {
86 int32_t iMid = (iStart + iEnd) / 2;
87 const FPF_SKIAFONTMAP* pItem = &g_SkiaSansFontMap[iMid];
88 if (dwHash < pItem->dwFamily) {
89 iEnd = iMid - 1;
90 } else if (dwHash > pItem->dwFamily) {
91 iStart = iMid + 1;
92 } else {
93 return pItem->dwSubSt;
94 }
95 }
96 return 0;
97 }
98 static uint32_t FPF_GetHashCode_StringA(const FX_CHAR* pStr,
99 int32_t iLength,
100 FX_BOOL bIgnoreCase = FALSE) {
101 if (!pStr) {
102 return 0;
103 }
104 if (iLength < 0) {
105 iLength = FXSYS_strlen(pStr);
106 }
107 const FX_CHAR* pStrEnd = pStr + iLength;
108 uint32_t uHashCode = 0;
109 if (bIgnoreCase) {
110 while (pStr < pStrEnd) {
111 uHashCode = 31 * uHashCode + FXSYS_tolower(*pStr++);
112 }
113 } else {
114 while (pStr < pStrEnd) {
115 uHashCode = 31 * uHashCode + *pStr++;
116 }
117 }
118 return uHashCode;
119 }
120 enum FPF_SKIACHARSET {
121 FPF_SKIACHARSET_Ansi = 1 << 0,
122 FPF_SKIACHARSET_Default = 1 << 1,
123 FPF_SKIACHARSET_Symbol = 1 << 2,
124 FPF_SKIACHARSET_ShiftJIS = 1 << 3,
125 FPF_SKIACHARSET_Korean = 1 << 4,
126 FPF_SKIACHARSET_Johab = 1 << 5,
127 FPF_SKIACHARSET_GB2312 = 1 << 6,
128 FPF_SKIACHARSET_BIG5 = 1 << 7,
129 FPF_SKIACHARSET_Greek = 1 << 8,
130 FPF_SKIACHARSET_Turkish = 1 << 9,
131 FPF_SKIACHARSET_Vietnamese = 1 << 10,
132 FPF_SKIACHARSET_Hebrew = 1 << 11,
133 FPF_SKIACHARSET_Arabic = 1 << 12,
134 FPF_SKIACHARSET_Baltic = 1 << 13,
135 FPF_SKIACHARSET_Cyrillic = 1 << 14,
136 FPF_SKIACHARSET_Thai = 1 << 15,
137 FPF_SKIACHARSET_EeasternEuropean = 1 << 16,
138 FPF_SKIACHARSET_PC = 1 << 17,
139 FPF_SKIACHARSET_OEM = 1 << 18,
140 };
141 static FX_DWORD FPF_SkiaGetCharset(uint8_t uCharset) {
142 switch (uCharset) {
143 case FXFONT_ANSI_CHARSET:
144 return FPF_SKIACHARSET_Ansi;
145 case FXFONT_DEFAULT_CHARSET:
146 return FPF_SKIACHARSET_Default;
147 case FXFONT_SYMBOL_CHARSET:
148 return FPF_SKIACHARSET_Symbol;
149 case FXFONT_SHIFTJIS_CHARSET:
150 return FPF_SKIACHARSET_ShiftJIS;
151 case FXFONT_HANGEUL_CHARSET:
152 return FPF_SKIACHARSET_Korean;
153 case FXFONT_GB2312_CHARSET:
154 return FPF_SKIACHARSET_GB2312;
155 case FXFONT_CHINESEBIG5_CHARSET:
156 return FPF_SKIACHARSET_BIG5;
157 case FXFONT_GREEK_CHARSET:
158 return FPF_SKIACHARSET_Greek;
159 case FXFONT_TURKISH_CHARSET:
160 return FPF_SKIACHARSET_Turkish;
161 case FXFONT_HEBREW_CHARSET:
162 return FPF_SKIACHARSET_Hebrew;
163 case FXFONT_ARABIC_CHARSET:
164 return FPF_SKIACHARSET_Arabic;
165 case FXFONT_BALTIC_CHARSET:
166 return FPF_SKIACHARSET_Baltic;
167 case FXFONT_RUSSIAN_CHARSET:
168 return FPF_SKIACHARSET_Cyrillic;
169 case FXFONT_THAI_CHARSET:
170 return FPF_SKIACHARSET_Thai;
171 case FXFONT_EASTEUROPE_CHARSET:
172 return FPF_SKIACHARSET_EeasternEuropean;
173 }
174 return FPF_SKIACHARSET_Default;
175 }
176 static FX_DWORD FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) {
177 FX_DWORD dwHash = 0;
178 int32_t iLength = bsfamily.GetLength();
179 const FX_CHAR* pBuffer = bsfamily.GetCStr();
180 for (int32_t i = 0; i < iLength; i++) {
181 FX_CHAR ch = pBuffer[i];
182 if (ch == ' ' || ch == '-' || ch == ',') {
183 continue;
184 }
185 dwHash = 31 * dwHash + FXSYS_tolower(ch);
186 }
187 return dwHash;
188 }
189 static FX_DWORD FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily,
190 FX_DWORD dwStyle,
191 uint8_t uCharset) {
192 CFX_ByteString bsFont(bsFamily);
193 if (dwStyle & FXFONT_BOLD) {
194 bsFont += "Bold";
195 }
196 if (dwStyle & FXFONT_ITALIC) {
197 bsFont += "Italic";
198 }
199 if (dwStyle & FXFONT_SERIF) {
200 bsFont += "Serif";
201 }
202 bsFont += uCharset;
203 return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE);
204 }
205 static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset) {
206 return (uCharset == FXFONT_GB2312_CHARSET) ||
207 (uCharset == FXFONT_CHINESEBIG5_CHARSET) ||
208 (uCharset == FXFONT_HANGEUL_CHARSET) ||
209 (uCharset == FXFONT_SHIFTJIS_CHARSET);
210 }
211 static FX_BOOL FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) {
212 CFX_ByteString bsName = bsFacename;
213 bsName.MakeLower();
214 return bsName.Find("symbol") > -1;
215 }
216 static FX_BOOL FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) {
217 CFX_ByteString bsName = bsFacename;
218 bsName.MakeLower();
219 return bsName.Find("arabic") > -1;
220 }
221 CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() : m_bLoaded(FALSE), m_FTLibrary(NULL) {}
222 CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() {
223 for (const auto& pair : m_FamilyFonts) {
224 if (pair.second)
225 pair.second->Release();
226 }
227 m_FamilyFonts.clear();
228 for (auto it = m_FontFaces.rbegin(); it != m_FontFaces.rend(); ++it) {
229 delete *it;
230 }
231 m_FontFaces.clear();
232 if (m_FTLibrary) {
233 FXFT_Done_FreeType(m_FTLibrary);
234 }
235 }
236 FX_BOOL CFPF_SkiaFontMgr::InitFTLibrary() {
237 if (!m_FTLibrary) {
238 FXFT_Init_FreeType(&m_FTLibrary);
239 }
240 return m_FTLibrary != NULL;
241 }
242 void CFPF_SkiaFontMgr::LoadSystemFonts() {
243 if (m_bLoaded) {
244 return;
245 }
246 ScanPath("/system/fonts");
247 OutputSystemFonts();
248 m_bLoaded = TRUE;
249 }
250 void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile) {}
251 void CFPF_SkiaFontMgr::LoadPrivateFont(const CFX_ByteStringC& bsFileName) {}
252 void CFPF_SkiaFontMgr::LoadPrivateFont(void* pBuffer, size_t szBuffer) {}
253 IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
254 uint8_t uCharset,
255 FX_DWORD dwStyle,
256 FX_DWORD dwMatch) {
257 FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset);
258 auto it = m_FamilyFonts.find(dwHash);
259 if (it != m_FamilyFonts.end() && it->second)
260 return it->second->Retain();
261
262 FX_DWORD dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname);
263 FX_DWORD dwSubst = FPF_SkiaGetSubstFont(dwFaceName);
264 FX_DWORD dwSubstSans = FPF_SkiaGetSansFont(dwFaceName);
265 FX_BOOL bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname);
266 if (uCharset != FXFONT_ARABIC_CHARSET && FPF_SkiaMaybeArabic(bsFamilyname)) {
267 uCharset = FXFONT_ARABIC_CHARSET;
268 } else if (uCharset == FXFONT_ANSI_CHARSET &&
269 (dwMatch & FPF_MATCHFONT_REPLACEANSI)) {
270 uCharset = FXFONT_DEFAULT_CHARSET;
271 }
272 int32_t nExpectVal = FPF_SKIAMATCHWEIGHT_NAME1 + FPF_SKIAMATCHWEIGHT_1 * 3 +
273 FPF_SKIAMATCHWEIGHT_2 * 2;
274 int32_t nItem = -1;
275 int32_t nMax = -1;
276 int32_t nGlyphNum = 0;
277 for (auto it = m_FontFaces.rbegin(); it != m_FontFaces.rend(); ++it) {
278 CFPF_SkiaPathFont* pFontDes = static_cast<CFPF_SkiaPathFont*>(*it);
279 if (!(pFontDes->m_dwCharsets & FPF_SkiaGetCharset(uCharset))) {
280 continue;
281 }
282 int32_t nFind = 0;
283 FX_DWORD dwSysFontName = FPF_SKIANormalizeFontName(pFontDes->m_pFamily);
284 if (dwFaceName == dwSysFontName) {
285 nFind += FPF_SKIAMATCHWEIGHT_NAME1;
286 }
287 bool bMatchedName = (nFind == FPF_SKIAMATCHWEIGHT_NAME1);
288 if ((dwStyle & FXFONT_BOLD) == (pFontDes->m_dwStyle & FXFONT_BOLD)) {
289 nFind += FPF_SKIAMATCHWEIGHT_1;
290 }
291 if ((dwStyle & FXFONT_ITALIC) == (pFontDes->m_dwStyle & FXFONT_ITALIC)) {
292 nFind += FPF_SKIAMATCHWEIGHT_1;
293 }
294 if ((dwStyle & FXFONT_FIXED_PITCH) ==
295 (pFontDes->m_dwStyle & FXFONT_FIXED_PITCH)) {
296 nFind += FPF_SKIAMATCHWEIGHT_2;
297 }
298 if ((dwStyle & FXFONT_SERIF) == (pFontDes->m_dwStyle & FXFONT_SERIF)) {
299 nFind += FPF_SKIAMATCHWEIGHT_1;
300 }
301 if ((dwStyle & FXFONT_SCRIPT) == (pFontDes->m_dwStyle & FXFONT_SCRIPT)) {
302 nFind += FPF_SKIAMATCHWEIGHT_2;
303 }
304 if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) {
305 nFind += FPF_SKIAMATCHWEIGHT_NAME2;
306 bMatchedName = true;
307 }
308 if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) {
309 if (nFind > nMax && bMatchedName) {
310 nMax = nFind;
311 nItem = it - m_FontFaces.rbegin();
312 }
313 } else if (FPF_SkiaIsCJK(uCharset)) {
314 if (bMatchedName || pFontDes->m_iGlyphNum > nGlyphNum) {
315 nItem = it - m_FontFaces.rbegin();
316 nGlyphNum = pFontDes->m_iGlyphNum;
317 }
318 } else if (nFind > nMax) {
319 nMax = nFind;
320 nItem = it - m_FontFaces.rbegin();
321 }
322 if (nExpectVal <= nFind) {
323 nItem = it - m_FontFaces.rbegin();
324 break;
325 }
326 }
327 if (nItem > -1) {
328 CFPF_SkiaFontDescriptor* pFontDes = m_FontFaces[nItem];
329 CFPF_SkiaFont* pFont = new CFPF_SkiaFont;
330 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) {
331 m_FamilyFonts[dwHash] = pFont;
332 return pFont->Retain();
333 }
334 pFont->Release();
335 }
336 return NULL;
337 }
338 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead* pFileRead,
339 int32_t iFaceIndex) {
340 if (!pFileRead) {
341 return NULL;
342 }
343 if (pFileRead->GetSize() == 0) {
344 return NULL;
345 }
346 if (iFaceIndex < 0) {
347 return NULL;
348 }
349 FXFT_StreamRec streamRec;
350 FXSYS_memset(&streamRec, 0, sizeof(FXFT_StreamRec));
351 streamRec.size = pFileRead->GetSize();
352 streamRec.descriptor.pointer = pFileRead;
353 streamRec.read = FPF_SkiaStream_Read;
354 streamRec.close = FPF_SkiaStream_Close;
355 FXFT_Open_Args args;
356 args.flags = FT_OPEN_STREAM;
357 args.stream = &streamRec;
358 FXFT_Face face;
359 if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
360 return NULL;
361 }
362 FXFT_Set_Pixel_Sizes(face, 0, 64);
363 return face;
364 }
365 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const CFX_ByteStringC& bsFile,
366 int32_t iFaceIndex) {
367 if (bsFile.IsEmpty()) {
368 return NULL;
369 }
370 if (iFaceIndex < 0) {
371 return NULL;
372 }
373 FXFT_Open_Args args;
374 args.flags = FT_OPEN_PATHNAME;
375 args.pathname = (FT_String*)bsFile.GetCStr();
376 FXFT_Face face;
377 if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
378 return FALSE;
379 }
380 FXFT_Set_Pixel_Sizes(face, 0, 64);
381 return face;
382 }
383 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(const uint8_t* pBuffer,
384 size_t szBuffer,
385 int32_t iFaceIndex) {
386 if (!pBuffer || szBuffer < 1) {
387 return NULL;
388 }
389 if (iFaceIndex < 0) {
390 return NULL;
391 }
392 FXFT_Open_Args args;
393 args.flags = FT_OPEN_MEMORY;
394 args.memory_base = pBuffer;
395 args.memory_size = szBuffer;
396 FXFT_Face face;
397 if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face)) {
398 return FALSE;
399 }
400 FXFT_Set_Pixel_Sizes(face, 0, 64);
401 return face;
402 }
403 void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path) {
404 void* handle = FX_OpenFolder(path.GetCStr());
405 if (!handle) {
406 return;
407 }
408 CFX_ByteString filename;
409 FX_BOOL bFolder = FALSE;
410 while (FX_GetNextFile(handle, filename, bFolder)) {
411 if (bFolder) {
412 if (filename == "." || filename == "..") {
413 continue;
414 }
415 } else {
416 CFX_ByteString ext = filename.Right(4);
417 ext.MakeLower();
418 if (ext != ".ttf" && ext != ".ttc" && ext != ".otf") {
419 continue;
420 }
421 }
422 CFX_ByteString fullpath = path;
423 fullpath += "/";
424 fullpath += filename;
425 if (bFolder) {
426 ScanPath(fullpath);
427 } else {
428 ScanFile(fullpath);
429 }
430 }
431 FX_CloseFolder(handle);
432 }
433 void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteStringC& file) {
434 FXFT_Face face = GetFontFace(file);
435 if (face) {
436 CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont;
437 pFontDesc->SetPath(file.GetCStr());
438 ReportFace(face, pFontDesc);
439 m_FontFaces.push_back(pFontDesc);
440 FXFT_Done_Face(face);
441 }
442 }
443 static const FX_DWORD g_FPFSkiaFontCharsets[] = {
444 FPF_SKIACHARSET_Ansi,
445 FPF_SKIACHARSET_EeasternEuropean,
446 FPF_SKIACHARSET_Cyrillic,
447 FPF_SKIACHARSET_Greek,
448 FPF_SKIACHARSET_Turkish,
449 FPF_SKIACHARSET_Hebrew,
450 FPF_SKIACHARSET_Arabic,
451 FPF_SKIACHARSET_Baltic,
452 0,
453 0,
454 0,
455 0,
456 0,
457 0,
458 0,
459 0,
460 FPF_SKIACHARSET_Thai,
461 FPF_SKIACHARSET_ShiftJIS,
462 FPF_SKIACHARSET_GB2312,
463 FPF_SKIACHARSET_Korean,
464 FPF_SKIACHARSET_BIG5,
465 FPF_SKIACHARSET_Johab,
466 0,
467 0,
468 0,
469 0,
470 0,
471 0,
472 0,
473 0,
474 FPF_SKIACHARSET_OEM,
475 FPF_SKIACHARSET_Symbol,
476 };
477 static FX_DWORD FPF_SkiaGetFaceCharset(TT_OS2* pOS2) {
478 FX_DWORD dwCharset = 0;
479 if (pOS2) {
480 for (int32_t i = 0; i < 32; i++) {
481 if (pOS2->ulCodePageRange1 & (1 << i)) {
482 dwCharset |= g_FPFSkiaFontCharsets[i];
483 }
484 }
485 }
486 dwCharset |= FPF_SKIACHARSET_Default;
487 return dwCharset;
488 }
489 void CFPF_SkiaFontMgr::ReportFace(FXFT_Face face,
490 CFPF_SkiaFontDescriptor* pFontDesc) {
491 if (!face || !pFontDesc) {
492 return;
493 }
494 pFontDesc->SetFamily(FXFT_Get_Face_Family_Name(face));
495 if (FXFT_Is_Face_Bold(face)) {
496 pFontDesc->m_dwStyle |= FXFONT_BOLD;
497 }
498 if (FXFT_Is_Face_Italic(face)) {
499 pFontDesc->m_dwStyle |= FXFONT_ITALIC;
500 }
501 if (FT_IS_FIXED_WIDTH(face)) {
502 pFontDesc->m_dwStyle |= FXFONT_FIXED_PITCH;
503 }
504 TT_OS2* pOS2 = (TT_OS2*)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
505 if (pOS2) {
506 if (pOS2->ulCodePageRange1 & (1 << 31)) {
507 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC;
508 }
509 if (pOS2->panose[0] == 2) {
510 uint8_t uSerif = pOS2->panose[1];
511 if ((uSerif > 1 && uSerif < 10) || uSerif > 13) {
512 pFontDesc->m_dwStyle |= FXFONT_SERIF;
513 }
514 }
515 }
516 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) {
517 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC;
518 }
519 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2);
520 pFontDesc->m_iFaceIndex = face->face_index;
521 pFontDesc->m_iGlyphNum = face->num_glyphs;
522 }
523 void CFPF_SkiaFontMgr::OutputSystemFonts() {}
524 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/android/fpf_skiafontmgr.h ('k') | core/src/fxge/android/fpf_skiamodule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698