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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return pDocument->AddStandardFont(csFontName.c_str(), nullptr); | 409 return pDocument->AddStandardFont(csFontName.c_str(), nullptr); |
410 | 410 |
411 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI); | 411 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI); |
412 return pDocument->AddStandardFont(csFontName.c_str(), &encoding); | 412 return pDocument->AddStandardFont(csFontName.c_str(), &encoding); |
413 } | 413 } |
414 | 414 |
415 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { | 415 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { |
416 CFX_ByteString csFontName; | 416 CFX_ByteString csFontName; |
417 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 417 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
418 LOGFONTA lf = {}; | 418 LOGFONTA lf = {}; |
419 FX_BOOL bRet; | |
420 if (charSet == ANSI_CHARSET) { | 419 if (charSet == ANSI_CHARSET) { |
421 csFontName = "Helvetica"; | 420 csFontName = "Helvetica"; |
422 return csFontName; | 421 return csFontName; |
423 } | 422 } |
424 bRet = FALSE; | 423 FX_BOOL bRet = FALSE; |
425 if (charSet == SHIFTJIS_CHARSET) { | 424 if (charSet == SHIFTJIS_CHARSET) { |
426 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, | 425 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, |
427 "MS Mincho", lf); | 426 "MS Mincho", lf); |
428 } else if (charSet == GB2312_CHARSET) { | 427 } else if (charSet == GB2312_CHARSET) { |
429 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "SimSun", | 428 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "SimSun", |
430 lf); | 429 lf); |
431 } else if (charSet == CHINESEBIG5_CHARSET) { | 430 } else if (charSet == CHINESEBIG5_CHARSET) { |
432 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MingLiU", | 431 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MingLiU", |
433 lf); | 432 lf); |
434 } | 433 } |
(...skipping 12 matching lines...) Expand all Loading... |
447 if (bRet) { | 446 if (bRet) { |
448 if (pLogFont) { | 447 if (pLogFont) { |
449 memcpy(pLogFont, &lf, sizeof(LOGFONTA)); | 448 memcpy(pLogFont, &lf, sizeof(LOGFONTA)); |
450 } | 449 } |
451 csFontName = lf.lfFaceName; | 450 csFontName = lf.lfFaceName; |
452 return csFontName; | 451 return csFontName; |
453 } | 452 } |
454 #endif | 453 #endif |
455 return csFontName; | 454 return csFontName; |
456 } | 455 } |
| 456 |
457 CFX_ByteString CPDF_InterForm::GetNativeFont(void* pLogFont) { | 457 CFX_ByteString CPDF_InterForm::GetNativeFont(void* pLogFont) { |
458 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 458 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
459 uint8_t charSet = GetNativeCharSet(); | 459 return GetNativeFont(GetNativeCharSet(), pLogFont); |
460 return GetNativeFont(charSet, pLogFont); | |
461 #else | 460 #else |
462 return CFX_ByteString(); | 461 return CFX_ByteString(); |
463 #endif | 462 #endif |
464 } | 463 } |
| 464 |
| 465 // static |
465 uint8_t CPDF_InterForm::GetNativeCharSet() { | 466 uint8_t CPDF_InterForm::GetNativeCharSet() { |
466 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 467 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
467 uint8_t charSet = ANSI_CHARSET; | 468 uint8_t charSet = ANSI_CHARSET; |
468 UINT iCodePage = ::GetACP(); | 469 UINT iCodePage = ::GetACP(); |
469 switch (iCodePage) { | 470 switch (iCodePage) { |
470 case 932: | 471 case 932: |
471 charSet = SHIFTJIS_CHARSET; | 472 charSet = SHIFTJIS_CHARSET; |
472 break; | 473 break; |
473 case 936: | 474 case 936: |
474 charSet = GB2312_CHARSET; | 475 charSet = GB2312_CHARSET; |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 FDF_ImportField(pField, L"", bNotify); | 1189 FDF_ImportField(pField, L"", bNotify); |
1189 } | 1190 } |
1190 if (bNotify && m_pFormNotify) | 1191 if (bNotify && m_pFormNotify) |
1191 m_pFormNotify->AfterFormImportData(this); | 1192 m_pFormNotify->AfterFormImportData(this); |
1192 return TRUE; | 1193 return TRUE; |
1193 } | 1194 } |
1194 | 1195 |
1195 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { | 1196 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { |
1196 m_pFormNotify = pNotify; | 1197 m_pFormNotify = pNotify; |
1197 } | 1198 } |
OLD | NEW |