| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, | 741 CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, |
| 742 CPDF_Document* pDocument, | 742 CPDF_Document* pDocument, |
| 743 CFX_ByteString& csNameTag) { | 743 CFX_ByteString& csNameTag) { |
| 744 uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); | 744 uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); |
| 745 return AddNativeFont(pFormDict, pDocument, charSet, csNameTag); | 745 return AddNativeFont(pFormDict, pDocument, charSet, csNameTag); |
| 746 } | 746 } |
| 747 | 747 |
| 748 // static | 748 // static |
| 749 uint8_t CPDF_InterForm::GetNativeCharSet() { | 749 uint8_t CPDF_InterForm::GetNativeCharSet() { |
| 750 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 750 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 751 uint8_t charSet = ANSI_CHARSET; | 751 uint8_t charSet = FXFONT_ANSI_CHARSET; |
| 752 UINT iCodePage = ::GetACP(); | 752 UINT iCodePage = ::GetACP(); |
| 753 switch (iCodePage) { | 753 switch (iCodePage) { |
| 754 case 932: | 754 case 932: |
| 755 charSet = SHIFTJIS_CHARSET; | 755 charSet = FXFONT_SHIFTJIS_CHARSET; |
| 756 break; | 756 break; |
| 757 case 936: | 757 case 936: |
| 758 charSet = GB2312_CHARSET; | 758 charSet = FXFONT_GB2312_CHARSET; |
| 759 break; | 759 break; |
| 760 case 950: | 760 case 950: |
| 761 charSet = CHINESEBIG5_CHARSET; | 761 charSet = FXFONT_CHINESEBIG5_CHARSET; |
| 762 break; | 762 break; |
| 763 case 1252: | 763 case 1252: |
| 764 charSet = ANSI_CHARSET; | 764 charSet = FXFONT_ANSI_CHARSET; |
| 765 break; | 765 break; |
| 766 case 874: | 766 case 874: |
| 767 charSet = THAI_CHARSET; | 767 charSet = FXFONT_THAI_CHARSET; |
| 768 break; | 768 break; |
| 769 case 949: | 769 case 949: |
| 770 charSet = HANGUL_CHARSET; | 770 charSet = FXFONT_HANGUL_CHARSET; |
| 771 break; | 771 break; |
| 772 case 1200: | 772 case 1200: |
| 773 charSet = ANSI_CHARSET; | 773 charSet = FXFONT_ANSI_CHARSET; |
| 774 break; | 774 break; |
| 775 case 1250: | 775 case 1250: |
| 776 charSet = EASTEUROPE_CHARSET; | 776 charSet = FXFONT_EASTEUROPE_CHARSET; |
| 777 break; | 777 break; |
| 778 case 1251: | 778 case 1251: |
| 779 charSet = RUSSIAN_CHARSET; | 779 charSet = FXFONT_RUSSIAN_CHARSET; |
| 780 break; | 780 break; |
| 781 case 1253: | 781 case 1253: |
| 782 charSet = GREEK_CHARSET; | 782 charSet = FXFONT_GREEK_CHARSET; |
| 783 break; | 783 break; |
| 784 case 1254: | 784 case 1254: |
| 785 charSet = TURKISH_CHARSET; | 785 charSet = FXFONT_TURKISH_CHARSET; |
| 786 break; | 786 break; |
| 787 case 1255: | 787 case 1255: |
| 788 charSet = HEBREW_CHARSET; | 788 charSet = FXFONT_HEBREW_CHARSET; |
| 789 break; | 789 break; |
| 790 case 1256: | 790 case 1256: |
| 791 charSet = ARABIC_CHARSET; | 791 charSet = FXFONT_ARABIC_CHARSET; |
| 792 break; | 792 break; |
| 793 case 1257: | 793 case 1257: |
| 794 charSet = BALTIC_CHARSET; | 794 charSet = FXFONT_BALTIC_CHARSET; |
| 795 break; | 795 break; |
| 796 case 1258: | 796 case 1258: |
| 797 charSet = VIETNAMESE_CHARSET; | 797 charSet = FXFONT_VIETNAMESE_CHARSET; |
| 798 break; | 798 break; |
| 799 case 1361: | 799 case 1361: |
| 800 charSet = JOHAB_CHARSET; | 800 charSet = FXFONT_JOHAB_CHARSET; |
| 801 break; | 801 break; |
| 802 } | 802 } |
| 803 return charSet; | 803 return charSet; |
| 804 #else | 804 #else |
| 805 return 0; | 805 return 0; |
| 806 #endif | 806 #endif |
| 807 } | 807 } |
| 808 | 808 |
| 809 CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument) | 809 CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument) |
| 810 : m_pDocument(pDocument), | 810 : m_pDocument(pDocument), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 return pDocument->AddStandardFont(csFontName.c_str(), nullptr); | 909 return pDocument->AddStandardFont(csFontName.c_str(), nullptr); |
| 910 | 910 |
| 911 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI); | 911 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI); |
| 912 return pDocument->AddStandardFont(csFontName.c_str(), &encoding); | 912 return pDocument->AddStandardFont(csFontName.c_str(), &encoding); |
| 913 } | 913 } |
| 914 | 914 |
| 915 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { | 915 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { |
| 916 CFX_ByteString csFontName; | 916 CFX_ByteString csFontName; |
| 917 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 917 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 918 LOGFONTA lf = {}; | 918 LOGFONTA lf = {}; |
| 919 if (charSet == ANSI_CHARSET) { | 919 if (charSet == FXFONT_ANSI_CHARSET) { |
| 920 csFontName = "Helvetica"; | 920 csFontName = "Helvetica"; |
| 921 return csFontName; | 921 return csFontName; |
| 922 } | 922 } |
| 923 FX_BOOL bRet = FALSE; | 923 FX_BOOL bRet = FALSE; |
| 924 if (charSet == SHIFTJIS_CHARSET) { | 924 if (charSet == FXFONT_SHIFTJIS_CHARSET) { |
| 925 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, | 925 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, |
| 926 "MS Mincho", lf); | 926 "MS Mincho", lf); |
| 927 } else if (charSet == GB2312_CHARSET) { | 927 } else if (charSet == FXFONT_GB2312_CHARSET) { |
| 928 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "SimSun", | 928 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "SimSun", |
| 929 lf); | 929 lf); |
| 930 } else if (charSet == CHINESEBIG5_CHARSET) { | 930 } else if (charSet == FXFONT_CHINESEBIG5_CHARSET) { |
| 931 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MingLiU", | 931 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MingLiU", |
| 932 lf); | 932 lf); |
| 933 } | 933 } |
| 934 if (!bRet) { | 934 if (!bRet) { |
| 935 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, | 935 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, |
| 936 "Arial Unicode MS", lf); | 936 "Arial Unicode MS", lf); |
| 937 } | 937 } |
| 938 if (!bRet) { | 938 if (!bRet) { |
| 939 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, | 939 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, |
| 940 "Microsoft Sans Serif", lf); | 940 "Microsoft Sans Serif", lf); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 FDF_ImportField(pField, L"", bNotify); | 1624 FDF_ImportField(pField, L"", bNotify); |
| 1625 } | 1625 } |
| 1626 if (bNotify && m_pFormNotify) | 1626 if (bNotify && m_pFormNotify) |
| 1627 m_pFormNotify->AfterFormImportData(this); | 1627 m_pFormNotify->AfterFormImportData(this); |
| 1628 return TRUE; | 1628 return TRUE; |
| 1629 } | 1629 } |
| 1630 | 1630 |
| 1631 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { | 1631 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { |
| 1632 m_pFormNotify = pNotify; | 1632 m_pFormNotify = pNotify; |
| 1633 } | 1633 } |
| OLD | NEW |