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/fxge/fx_ge.h" | 7 #include "core/include/fxge/fx_ge.h" |
8 | 8 |
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
11 | 11 |
12 #include "core/include/fxcodec/fx_codec.h" | 12 #include "core/include/fxcodec/fx_codec.h" |
13 #include "core/include/fxge/fx_freetype.h" | 13 #include "core/include/fxge/fx_freetype.h" |
14 #include "core/include/fxge/fx_ge_win32.h" | 14 #include "core/include/fxge/fx_ge_win32.h" |
15 #include "core/src/fxge/agg/include/fx_agg_driver.h" | 15 #include "core/src/fxge/agg/include/fx_agg_driver.h" |
16 #include "core/src/fxge/dib/dib_int.h" | 16 #include "core/src/fxge/dib/dib_int.h" |
17 #include "core/src/fxge/ge/fx_text_int.h" | 17 #include "core/src/fxge/ge/fx_text_int.h" |
18 #include "dwrite_int.h" | 18 #include "core/src/fxge/win32/dwrite_int.h" |
19 #include "win32_int.h" | 19 #include "core/src/fxge/win32/win32_int.h" |
| 20 #include "third_party/base/stl_util.h" |
20 | 21 |
21 class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo { | 22 class CFX_Win32FallbackFontInfo final : public CFX_FolderFontInfo { |
22 public: | 23 public: |
23 void* MapFont(int weight, | 24 void* MapFont(int weight, |
24 FX_BOOL bItalic, | 25 FX_BOOL bItalic, |
25 int charset, | 26 int charset, |
26 int pitch_family, | 27 int pitch_family, |
27 const FX_CHAR* family, | 28 const FX_CHAR* family, |
28 int& iExact) override; | 29 int& iExact) override; |
29 }; | 30 }; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 {"Helvetica-Oblique", "Arial", FALSE, TRUE}, | 189 {"Helvetica-Oblique", "Arial", FALSE, TRUE}, |
189 {"Times-Roman", "Times New Roman", FALSE, FALSE}, | 190 {"Times-Roman", "Times New Roman", FALSE, FALSE}, |
190 {"Times-Bold", "Times New Roman", TRUE, FALSE}, | 191 {"Times-Bold", "Times New Roman", TRUE, FALSE}, |
191 {"Times-BoldItalic", "Times New Roman", TRUE, TRUE}, | 192 {"Times-BoldItalic", "Times New Roman", TRUE, TRUE}, |
192 {"Times-Italic", "Times New Roman", FALSE, TRUE}, | 193 {"Times-Italic", "Times New Roman", FALSE, TRUE}, |
193 }; | 194 }; |
194 CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { | 195 CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { |
195 if (!m_pMapper) { | 196 if (!m_pMapper) { |
196 return name; | 197 return name; |
197 } | 198 } |
198 int nFonts = m_pMapper->m_InstalledTTFonts.GetSize(); | 199 int nFonts = pdfium::CollectionSize<int>(m_pMapper->m_InstalledTTFonts); |
199 for (int i = 0; i < nFonts; i++) { | 200 for (int i = 0; i < nFonts; i++) { |
200 CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; | 201 CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; |
201 if (thisname[0] == ' ') { | 202 if (thisname[0] == ' ') { |
202 if (thisname.Mid(1, name.GetLength()) == name) { | 203 if (thisname.Mid(1, name.GetLength()) == name) { |
203 return m_pMapper->m_InstalledTTFonts[i + 1]; | 204 return m_pMapper->m_InstalledTTFonts[i + 1]; |
204 } | 205 } |
205 } else if (thisname.Left(name.GetLength()) == name) { | 206 } else if (thisname.Left(name.GetLength()) == name) { |
206 return m_pMapper->m_InstalledTTFonts[i]; | 207 return m_pMapper->m_InstalledTTFonts[i]; |
207 } | 208 } |
208 } | 209 } |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 SelectObject(m_hDC, m_hOldBitmap); | 1356 SelectObject(m_hDC, m_hOldBitmap); |
1356 DeleteDC(m_hDC); | 1357 DeleteDC(m_hDC); |
1357 } | 1358 } |
1358 if (m_hBitmap) { | 1359 if (m_hBitmap) { |
1359 DeleteObject(m_hBitmap); | 1360 DeleteObject(m_hBitmap); |
1360 } | 1361 } |
1361 delete GetBitmap(); | 1362 delete GetBitmap(); |
1362 } | 1363 } |
1363 | 1364 |
1364 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1365 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |