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/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/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> |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 subst_pitch_family = FF_ROMAN; | 343 subst_pitch_family = FF_ROMAN; |
344 break; | 344 break; |
345 case CHINESEBIG5_CHARSET: | 345 case CHINESEBIG5_CHARSET: |
346 case HANGUL_CHARSET: | 346 case HANGUL_CHARSET: |
347 case GB2312_CHARSET: | 347 case GB2312_CHARSET: |
348 subst_pitch_family = 0; | 348 subst_pitch_family = 0; |
349 break; | 349 break; |
350 } | 350 } |
351 HFONT hFont = | 351 HFONT hFont = |
352 ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, | 352 ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, |
353 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face); | 353 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face.c_str()); |
354 char facebuf[100]; | 354 char facebuf[100]; |
355 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont); | 355 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont); |
356 ::GetTextFaceA(m_hDC, 100, facebuf); | 356 ::GetTextFaceA(m_hDC, 100, facebuf); |
357 ::SelectObject(m_hDC, hOldFont); | 357 ::SelectObject(m_hDC, hOldFont); |
358 if (face.EqualNoCase(facebuf)) { | 358 if (face.EqualNoCase(facebuf)) { |
359 return hFont; | 359 return hFont; |
360 } | 360 } |
361 int iCount = sizeof(VariantNames) / sizeof(VariantNames[0]); | 361 int iCount = sizeof(VariantNames) / sizeof(VariantNames[0]); |
362 for (int i = 0; i < iCount; ++i) { | 362 for (int i = 0; i < iCount; ++i) { |
363 if (face == VariantNames[i].m_pFaceName) { | 363 if (face == VariantNames[i].m_pFaceName) { |
(...skipping 22 matching lines...) Expand all Loading... |
386 face = "Gulim"; | 386 face = "Gulim"; |
387 break; | 387 break; |
388 case CHINESEBIG5_CHARSET: | 388 case CHINESEBIG5_CHARSET: |
389 if (face.Find("MSung") >= 0) { | 389 if (face.Find("MSung") >= 0) { |
390 face = "MingLiU"; | 390 face = "MingLiU"; |
391 } else { | 391 } else { |
392 face = "PMingLiU"; | 392 face = "PMingLiU"; |
393 } | 393 } |
394 break; | 394 break; |
395 } | 395 } |
396 hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, | 396 hFont = |
397 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face); | 397 ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, |
| 398 OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face.c_str()); |
398 return hFont; | 399 return hFont; |
399 } | 400 } |
400 void CFX_Win32FontInfo::DeleteFont(void* hFont) { | 401 void CFX_Win32FontInfo::DeleteFont(void* hFont) { |
401 ::DeleteObject(hFont); | 402 ::DeleteObject(hFont); |
402 } | 403 } |
403 uint32_t CFX_Win32FontInfo::GetFontData(void* hFont, | 404 uint32_t CFX_Win32FontInfo::GetFontData(void* hFont, |
404 uint32_t table, | 405 uint32_t table, |
405 uint8_t* buffer, | 406 uint8_t* buffer, |
406 uint32_t size) { | 407 uint32_t size) { |
407 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); | 408 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 SelectObject(m_hDC, m_hOldBitmap); | 1358 SelectObject(m_hDC, m_hOldBitmap); |
1358 DeleteDC(m_hDC); | 1359 DeleteDC(m_hDC); |
1359 } | 1360 } |
1360 if (m_hBitmap) { | 1361 if (m_hBitmap) { |
1361 DeleteObject(m_hBitmap); | 1362 DeleteObject(m_hBitmap); |
1362 } | 1363 } |
1363 delete GetBitmap(); | 1364 delete GetBitmap(); |
1364 } | 1365 } |
1365 | 1366 |
1366 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1367 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |