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/fxcrt/include/fx_system.h" | 7 #include "core/fxcrt/include/fx_system.h" |
8 | 8 |
9 #if _FX_OS_ == _FX_ANDROID_ | 9 #if _FX_OS_ == _FX_ANDROID_ |
10 | 10 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 if ((dwStyle & FXFONT_SCRIPT) == (pFontDes->m_dwStyle & FXFONT_SCRIPT)) { | 299 if ((dwStyle & FXFONT_SCRIPT) == (pFontDes->m_dwStyle & FXFONT_SCRIPT)) { |
300 nFind += FPF_SKIAMATCHWEIGHT_2; | 300 nFind += FPF_SKIAMATCHWEIGHT_2; |
301 } | 301 } |
302 if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) { | 302 if (dwSubst == dwSysFontName || dwSubstSans == dwSysFontName) { |
303 nFind += FPF_SKIAMATCHWEIGHT_NAME2; | 303 nFind += FPF_SKIAMATCHWEIGHT_NAME2; |
304 bMatchedName = true; | 304 bMatchedName = true; |
305 } | 305 } |
306 if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) { | 306 if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) { |
307 if (nFind > nMax && bMatchedName) { | 307 if (nFind > nMax && bMatchedName) { |
308 nMax = nFind; | 308 nMax = nFind; |
309 nItem = it - m_FontFaces.rbegin(); | 309 nItem = m_FontFaces.rend() - it - 1; |
olsen
2016/06/28 00:53:18
This will work, but it is prone to the same type o
Lei Zhang
2016/06/28 01:11:26
Done.
| |
310 } | 310 } |
311 } else if (FPF_SkiaIsCJK(uCharset)) { | 311 } else if (FPF_SkiaIsCJK(uCharset)) { |
312 if (bMatchedName || pFontDes->m_iGlyphNum > nGlyphNum) { | 312 if (bMatchedName || pFontDes->m_iGlyphNum > nGlyphNum) { |
313 nItem = it - m_FontFaces.rbegin(); | 313 nItem = m_FontFaces.rend() - it - 1; |
314 nGlyphNum = pFontDes->m_iGlyphNum; | 314 nGlyphNum = pFontDes->m_iGlyphNum; |
315 } | 315 } |
316 } else if (nFind > nMax) { | 316 } else if (nFind > nMax) { |
317 nMax = nFind; | 317 nMax = nFind; |
318 nItem = it - m_FontFaces.rbegin(); | 318 nItem = m_FontFaces.rend() - it - 1; |
319 } | 319 } |
320 if (nExpectVal <= nFind) { | 320 if (nExpectVal <= nFind) { |
321 nItem = it - m_FontFaces.rbegin(); | 321 nItem = m_FontFaces.rend() - it - 1; |
322 break; | 322 break; |
323 } | 323 } |
324 } | 324 } |
325 if (nItem > -1) { | 325 if (nItem > -1) { |
326 CFPF_SkiaFontDescriptor* pFontDes = m_FontFaces[nItem]; | 326 CFPF_SkiaFontDescriptor* pFontDes = m_FontFaces[nItem]; |
327 CFPF_SkiaFont* pFont = new CFPF_SkiaFont; | 327 CFPF_SkiaFont* pFont = new CFPF_SkiaFont; |
328 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { | 328 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { |
329 m_FamilyFonts[dwHash] = pFont; | 329 m_FamilyFonts[dwHash] = pFont; |
330 return pFont->Retain(); | 330 return pFont->Retain(); |
331 } | 331 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
513 } | 513 } |
514 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) { | 514 if (pOS2 && (pOS2->ulCodePageRange1 & (1 << 31))) { |
515 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; | 515 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; |
516 } | 516 } |
517 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); | 517 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); |
518 pFontDesc->m_iFaceIndex = face->face_index; | 518 pFontDesc->m_iFaceIndex = face->face_index; |
519 pFontDesc->m_iGlyphNum = face->num_glyphs; | 519 pFontDesc->m_iGlyphNum = face->num_glyphs; |
520 } | 520 } |
521 void CFPF_SkiaFontMgr::OutputSystemFonts() {} | 521 void CFPF_SkiaFontMgr::OutputSystemFonts() {} |
522 #endif | 522 #endif |
OLD | NEW |