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

Side by Side Diff: core/fxge/ge/fx_ge_fontmap.cpp

Issue 1982263004: Don't use LCD antialiasing if Fontconfig doesn't support hinting (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Initialize m_FTLibrarySupportsHinting Created 4 years, 7 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 | « no previous file | core/fxge/ge/fx_ge_text.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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 447 }
448 } 448 }
449 m_RefCount--; 449 m_RefCount--;
450 if (m_RefCount) { 450 if (m_RefCount) {
451 return m_RefCount; 451 return m_RefCount;
452 } 452 }
453 delete this; 453 delete this;
454 return 0; 454 return 0;
455 } 455 }
456 456
457 CFX_FontMgr::CFX_FontMgr() : m_FTLibrary(nullptr) { 457 CFX_FontMgr::CFX_FontMgr()
458 : m_FTLibrary(nullptr), m_FTLibrarySupportsHinting(false) {
458 m_pBuiltinMapper.reset(new CFX_FontMapper(this)); 459 m_pBuiltinMapper.reset(new CFX_FontMapper(this));
459 } 460 }
460 461
461 CFX_FontMgr::~CFX_FontMgr() { 462 CFX_FontMgr::~CFX_FontMgr() {
462 for (const auto& pair : m_FaceMap) 463 for (const auto& pair : m_FaceMap)
463 delete pair.second; 464 delete pair.second;
464 465
465 // |m_pBuiltinMapper| references |m_FTLibrary|, so it has to be destroyed 466 // |m_pBuiltinMapper| references |m_FTLibrary|, so it has to be destroyed
466 // first. 467 // first.
467 m_pBuiltinMapper.reset(); 468 m_pBuiltinMapper.reset();
468 FXFT_Done_FreeType(m_FTLibrary); 469 FXFT_Done_FreeType(m_FTLibrary);
469 } 470 }
470 471
471 void CFX_FontMgr::InitFTLibrary() { 472 void CFX_FontMgr::InitFTLibrary() {
472 if (m_FTLibrary) 473 if (m_FTLibrary)
473 return; 474 return;
474 FXFT_Init_FreeType(&m_FTLibrary); 475 FXFT_Init_FreeType(&m_FTLibrary);
476 m_FTLibrarySupportsHinting =
477 FXFT_Library_SetLcdFilter(m_FTLibrary, FT_LCD_FILTER_DEFAULT) !=
478 FT_Err_Unimplemented_Feature;
475 } 479 }
476 480
477 void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { 481 void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) {
478 m_pBuiltinMapper->SetSystemFontInfo(pFontInfo); 482 m_pBuiltinMapper->SetSystemFontInfo(pFontInfo);
479 } 483 }
480 484
481 FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, 485 FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
482 FX_BOOL bTrueType, 486 FX_BOOL bTrueType,
483 uint32_t flags, 487 uint32_t flags,
484 int weight, 488 int weight,
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 int PDF_GetStandardFontName(CFX_ByteString* name) { 1651 int PDF_GetStandardFontName(CFX_ByteString* name) {
1648 AltFontName* found = static_cast<AltFontName*>( 1652 AltFontName* found = static_cast<AltFontName*>(
1649 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), 1653 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
1650 sizeof(AltFontName), CompareString)); 1654 sizeof(AltFontName), CompareString));
1651 if (!found) 1655 if (!found)
1652 return -1; 1656 return -1;
1653 1657
1654 *name = g_Base14FontNames[found->m_Index]; 1658 *name = g_Base14FontNames[found->m_Index];
1655 return found->m_Index; 1659 return found->m_Index;
1656 } 1660 }
OLDNEW
« no previous file with comments | « no previous file | core/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698