| OLD | NEW |
| 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 "core/include/fxcrt/fx_ext.h" | 7 #include "core/include/fxcrt/fx_ext.h" |
| 8 #include "core/src/fxge/android/fx_fpf.h" | 8 #include "core/src/fxge/android/fx_fpf.h" |
| 9 | 9 |
| 10 #if _FX_OS_ == _FX_ANDROID_ | 10 #if _FX_OS_ == _FX_ANDROID_ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 count) { | 30 count) { |
| 31 return 0; | 31 return 0; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 return count; | 34 return count; |
| 35 } | 35 } |
| 36 static void FPF_SkiaStream_Close(FXFT_Stream stream) {} | 36 static void FPF_SkiaStream_Close(FXFT_Stream stream) {} |
| 37 #ifdef __cplusplus | 37 #ifdef __cplusplus |
| 38 }; | 38 }; |
| 39 #endif | 39 #endif |
| 40 typedef struct _FPF_SKIAFONTMAP { | 40 struct FPF_SKIAFONTMAP { |
| 41 FX_DWORD dwFamily; | 41 FX_DWORD dwFamily; |
| 42 FX_DWORD dwSubSt; | 42 FX_DWORD dwSubSt; |
| 43 } FPF_SKIAFONTMAP, *FPF_LPSKIAFONTMAP; | 43 }; |
| 44 typedef FPF_SKIAFONTMAP const* FPF_LPCSKIAFONTMAP; | |
| 45 static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { | 44 static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { |
| 46 {0x58c5083, 0xc8d2e345}, {0x5dfade2, 0xe1633081}, | 45 {0x58c5083, 0xc8d2e345}, {0x5dfade2, 0xe1633081}, |
| 47 {0x684317d, 0xe1633081}, {0x14ee2d13, 0xc8d2e345}, | 46 {0x684317d, 0xe1633081}, {0x14ee2d13, 0xc8d2e345}, |
| 48 {0x3918fe2d, 0xbbeeec72}, {0x3b98b31c, 0xe1633081}, | 47 {0x3918fe2d, 0xbbeeec72}, {0x3b98b31c, 0xe1633081}, |
| 49 {0x3d49f40e, 0xe1633081}, {0x432c41c5, 0xe1633081}, | 48 {0x3d49f40e, 0xe1633081}, {0x432c41c5, 0xe1633081}, |
| 50 {0x491b6ad0, 0xe1633081}, {0x5612cab1, 0x59b9f8f1}, | 49 {0x491b6ad0, 0xe1633081}, {0x5612cab1, 0x59b9f8f1}, |
| 51 {0x779ce19d, 0xc8d2e345}, {0x7cc9510b, 0x59b9f8f1}, | 50 {0x779ce19d, 0xc8d2e345}, {0x7cc9510b, 0x59b9f8f1}, |
| 52 {0x83746053, 0xbbeeec72}, {0xaaa60c03, 0xbbeeec72}, | 51 {0x83746053, 0xbbeeec72}, {0xaaa60c03, 0xbbeeec72}, |
| 53 {0xbf85ff26, 0xe1633081}, {0xc04fe601, 0xbbeeec72}, | 52 {0xbf85ff26, 0xe1633081}, {0xc04fe601, 0xbbeeec72}, |
| 54 {0xca3812d5, 0x59b9f8f1}, {0xca383e15, 0x59b9f8f1}, | 53 {0xca3812d5, 0x59b9f8f1}, {0xca383e15, 0x59b9f8f1}, |
| 55 {0xcad5eaf6, 0x59b9f8f1}, {0xcb7a04c8, 0xc8d2e345}, | 54 {0xcad5eaf6, 0x59b9f8f1}, {0xcb7a04c8, 0xc8d2e345}, |
| 56 {0xfb4ce0de, 0xe1633081}, | 55 {0xfb4ce0de, 0xe1633081}, |
| 57 }; | 56 }; |
| 58 FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) { | 57 FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) { |
| 59 int32_t iStart = 0; | 58 int32_t iStart = 0; |
| 60 int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); | 59 int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); |
| 61 while (iStart <= iEnd) { | 60 while (iStart <= iEnd) { |
| 62 int32_t iMid = (iStart + iEnd) / 2; | 61 int32_t iMid = (iStart + iEnd) / 2; |
| 63 FPF_LPCSKIAFONTMAP pItem = &g_SkiaFontmap[iMid]; | 62 const FPF_SKIAFONTMAP* pItem = &g_SkiaFontmap[iMid]; |
| 64 if (dwHash < pItem->dwFamily) { | 63 if (dwHash < pItem->dwFamily) { |
| 65 iEnd = iMid - 1; | 64 iEnd = iMid - 1; |
| 66 } else if (dwHash > pItem->dwFamily) { | 65 } else if (dwHash > pItem->dwFamily) { |
| 67 iStart = iMid + 1; | 66 iStart = iMid + 1; |
| 68 } else { | 67 } else { |
| 69 return pItem->dwSubSt; | 68 return pItem->dwSubSt; |
| 70 } | 69 } |
| 71 } | 70 } |
| 72 return 0; | 71 return 0; |
| 73 } | 72 } |
| 74 static const FPF_SKIAFONTMAP g_SkiaSansFontMap[] = { | 73 static const FPF_SKIAFONTMAP g_SkiaSansFontMap[] = { |
| 75 {0x58c5083, 0xd5b8d10f}, {0x14ee2d13, 0xd5b8d10f}, | 74 {0x58c5083, 0xd5b8d10f}, {0x14ee2d13, 0xd5b8d10f}, |
| 76 {0x779ce19d, 0xd5b8d10f}, {0xcb7a04c8, 0xd5b8d10f}, | 75 {0x779ce19d, 0xd5b8d10f}, {0xcb7a04c8, 0xd5b8d10f}, |
| 77 {0xfb4ce0de, 0xd5b8d10f}, | 76 {0xfb4ce0de, 0xd5b8d10f}, |
| 78 }; | 77 }; |
| 79 FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) { | 78 FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) { |
| 80 int32_t iStart = 0; | 79 int32_t iStart = 0; |
| 81 int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); | 80 int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); |
| 82 while (iStart <= iEnd) { | 81 while (iStart <= iEnd) { |
| 83 int32_t iMid = (iStart + iEnd) / 2; | 82 int32_t iMid = (iStart + iEnd) / 2; |
| 84 FPF_LPCSKIAFONTMAP pItem = &g_SkiaSansFontMap[iMid]; | 83 const FPF_SKIAFONTMAP* pItem = &g_SkiaSansFontMap[iMid]; |
| 85 if (dwHash < pItem->dwFamily) { | 84 if (dwHash < pItem->dwFamily) { |
| 86 iEnd = iMid - 1; | 85 iEnd = iMid - 1; |
| 87 } else if (dwHash > pItem->dwFamily) { | 86 } else if (dwHash > pItem->dwFamily) { |
| 88 iStart = iMid + 1; | 87 iStart = iMid + 1; |
| 89 } else { | 88 } else { |
| 90 return pItem->dwSubSt; | 89 return pItem->dwSubSt; |
| 91 } | 90 } |
| 92 } | 91 } |
| 93 return 0; | 92 return 0; |
| 94 } | 93 } |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 511 } |
| 513 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) { | 512 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) { |
| 514 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; | 513 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; |
| 515 } | 514 } |
| 516 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); | 515 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); |
| 517 pFontDesc->m_iFaceIndex = face->face_index; | 516 pFontDesc->m_iFaceIndex = face->face_index; |
| 518 pFontDesc->m_iGlyphNum = face->num_glyphs; | 517 pFontDesc->m_iGlyphNum = face->num_glyphs; |
| 519 } | 518 } |
| 520 void CFPF_SkiaFontMgr::OutputSystemFonts() {} | 519 void CFPF_SkiaFontMgr::OutputSystemFonts() {} |
| 521 #endif | 520 #endif |
| OLD | NEW |