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 "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../fpdf_page/pageint.h" | 9 #include "../fpdf_page/pageint.h" |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 charSets.RemoveAll(); | 678 charSets.RemoveAll(); |
679 charSets.Add(FXFONT_SYMBOL_CHARSET); | 679 charSets.Add(FXFONT_SYMBOL_CHARSET); |
680 if (IsHasCharSet(languages, charSets)) { | 680 if (IsHasCharSet(languages, charSets)) { |
681 flags |= PDFFONT_SYMBOLIC; | 681 flags |= PDFFONT_SYMBOLIC; |
682 } else { | 682 } else { |
683 flags |= PDFFONT_NONSYMBOLIC; | 683 flags |= PDFFONT_NONSYMBOLIC; |
684 } | 684 } |
685 pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding"); | 685 pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding"); |
686 } else { | 686 } else { |
687 flags |= PDFFONT_NONSYMBOLIC; | 687 flags |= PDFFONT_NONSYMBOLIC; |
688 int i; | 688 size_t i; |
689 for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnico
des); i ++) { | 689 for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnico
des); i ++) { |
690 charSets.RemoveAll(); | 690 charSets.RemoveAll(); |
691 charSets.Add(g_FX_CharsetUnicodes[i].m_Charset); | 691 charSets.Add(g_FX_CharsetUnicodes[i].m_Charset); |
692 if (IsHasCharSet(languages, charSets)) { | 692 if (IsHasCharSet(languages, charSets)) { |
693 break; | 693 break; |
694 } | 694 } |
695 } | 695 } |
696 if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { | 696 if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { |
697 CPDF_Dictionary* pEncoding = FX_NEW CPDF_Dictionary; | 697 CPDF_Dictionary* pEncoding = FX_NEW CPDF_Dictionary; |
698 pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding"
); | 698 pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding"
); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 flags |= PDFFONT_NONSYMBOLIC; | 906 flags |= PDFFONT_NONSYMBOLIC; |
907 } | 907 } |
908 pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding"); | 908 pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding"); |
909 for (charcode = 128; charcode <= 255; charcode ++) { | 909 for (charcode = 128; charcode <= 255; charcode ++) { |
910 int glyph_index = pEncoding->GlyphFromCharCode(charcode); | 910 int glyph_index = pEncoding->GlyphFromCharCode(charcode); |
911 int char_width = pFont->GetGlyphWidth(glyph_index); | 911 int char_width = pFont->GetGlyphWidth(glyph_index); |
912 pWidths->AddInteger(char_width); | 912 pWidths->AddInteger(char_width); |
913 } | 913 } |
914 } else { | 914 } else { |
915 flags |= PDFFONT_NONSYMBOLIC; | 915 flags |= PDFFONT_NONSYMBOLIC; |
916 int i; | 916 size_t i; |
917 for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnico
des); i ++) | 917 for (i = 0; i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnico
des); i ++) |
918 if (g_FX_CharsetUnicodes[i].m_Charset == charset) { | 918 if (g_FX_CharsetUnicodes[i].m_Charset == charset) { |
919 break; | 919 break; |
920 } | 920 } |
921 if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { | 921 if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { |
922 CPDF_Dictionary* pEncodingDict = FX_NEW CPDF_Dictionary; | 922 CPDF_Dictionary* pEncodingDict = FX_NEW CPDF_Dictionary; |
923 pEncodingDict->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncod
ing"); | 923 pEncodingDict->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncod
ing"); |
924 CPDF_Array* pArray = FX_NEW CPDF_Array; | 924 CPDF_Array* pArray = FX_NEW CPDF_Array; |
925 pArray->AddInteger(128); | 925 pArray->AddInteger(128); |
926 const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; | 926 const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) | 1195 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) |
1196 { | 1196 { |
1197 if (pPageDict->KeyExist(name)) { | 1197 if (pPageDict->KeyExist(name)) { |
1198 return; | 1198 return; |
1199 } | 1199 } |
1200 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1200 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1201 if (pObj) { | 1201 if (pObj) { |
1202 pPageDict->SetAt(name, pObj->Clone()); | 1202 pPageDict->SetAt(name, pObj->Clone()); |
1203 } | 1203 } |
1204 } | 1204 } |
OLD | NEW |