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

Side by Side Diff: core/fxge/win32/fx_win32_device.cpp

Issue 2395883002: Use another vector for installed fonts in CFX_FontMapper (Closed)
Patch Set: Nits Created 4 years, 2 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/fxge/ge/cfx_fontmapper.cpp ('k') | fpdfsdk/cfx_systemhandler.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 <crtdbg.h> 7 #include <crtdbg.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 0); 464 0);
465 return TRUE; 465 return TRUE;
466 } 466 }
467 467
468 CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { 468 CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) {
469 if (!m_pMapper) 469 if (!m_pMapper)
470 return name; 470 return name;
471 471
472 for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) { 472 for (size_t i = 0; i < m_pMapper->m_InstalledTTFonts.size(); ++i) {
473 CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; 473 CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i];
474 if (thisname[0] == ' ') { 474 if (thisname.Left(name.GetLength()) == name)
475 if (thisname.Mid(1, name.GetLength()) == name) {
476 return m_pMapper->m_InstalledTTFonts[i + 1];
477 }
478 } else if (thisname.Left(name.GetLength()) == name) {
479 return m_pMapper->m_InstalledTTFonts[i]; 475 return m_pMapper->m_InstalledTTFonts[i];
480 } 476 }
477 for (size_t i = 0; i < m_pMapper->m_LocalizedTTFonts.size(); ++i) {
478 CFX_ByteString thisname = m_pMapper->m_LocalizedTTFonts[i].first;
479 if (thisname.Left(name.GetLength()) == name)
480 return m_pMapper->m_LocalizedTTFonts[i].second;
481 } 481 }
482 return CFX_ByteString(); 482 return CFX_ByteString();
483 } 483 }
484 484
485 void* CFX_Win32FallbackFontInfo::MapFont(int weight, 485 void* CFX_Win32FallbackFontInfo::MapFont(int weight,
486 FX_BOOL bItalic, 486 FX_BOOL bItalic,
487 int charset, 487 int charset,
488 int pitch_family, 488 int pitch_family,
489 const FX_CHAR* cstr_face, 489 const FX_CHAR* cstr_face,
490 int& iExact) { 490 int& iExact) {
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 // static 1383 // static
1384 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) { 1384 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) {
1385 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); 1385 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY);
1386 int obj_type = ::GetObjectType(hDC); 1386 int obj_type = ::GetObjectType(hDC);
1387 bool use_printer = device_type == DT_RASPRINTER || 1387 bool use_printer = device_type == DT_RASPRINTER ||
1388 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; 1388 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC;
1389 if (use_printer) 1389 if (use_printer)
1390 return new CGdiPrinterDriver(hDC); 1390 return new CGdiPrinterDriver(hDC);
1391 return new CGdiDisplayDriver(hDC); 1391 return new CGdiDisplayDriver(hDC);
1392 } 1392 }
OLDNEW
« no previous file with comments | « core/fxge/ge/cfx_fontmapper.cpp ('k') | fpdfsdk/cfx_systemhandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698