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 <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 Loading... |
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 Loading... |
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 } |
OLD | NEW |