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 <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
10 #include "core/include/fpdfapi/fpdf_page.h" | 10 #include "core/include/fpdfapi/fpdf_page.h" |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 flags |= PDFFONT_FORCEBOLD; | 839 flags |= PDFFONT_FORCEBOLD; |
840 } | 840 } |
841 if (pFont->IsItalic()) { | 841 if (pFont->IsItalic()) { |
842 flags |= PDFFONT_ITALIC; | 842 flags |= PDFFONT_ITALIC; |
843 } | 843 } |
844 if (pFont->IsFixedWidth()) { | 844 if (pFont->IsFixedWidth()) { |
845 flags |= PDFFONT_FIXEDPITCH; | 845 flags |= PDFFONT_FIXEDPITCH; |
846 } | 846 } |
847 CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; | 847 CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; |
848 pBaseDict->SetAtName("Type", "Font"); | 848 pBaseDict->SetAtName("Type", "Font"); |
849 nonstd::unique_ptr<CFX_UnicodeEncoding> pEncoding( | 849 std::unique_ptr<CFX_UnicodeEncoding> pEncoding( |
850 new CFX_UnicodeEncoding(pFont)); | 850 new CFX_UnicodeEncoding(pFont)); |
851 CPDF_Dictionary* pFontDict = pBaseDict; | 851 CPDF_Dictionary* pFontDict = pBaseDict; |
852 if (!bCJK) { | 852 if (!bCJK) { |
853 CPDF_Array* pWidths = new CPDF_Array; | 853 CPDF_Array* pWidths = new CPDF_Array; |
854 int charcode; | 854 int charcode; |
855 for (charcode = 32; charcode < 128; charcode++) { | 855 for (charcode = 32; charcode < 128; charcode++) { |
856 int glyph_index = pEncoding->GlyphFromCharCode(charcode); | 856 int glyph_index = pEncoding->GlyphFromCharCode(charcode); |
857 int char_width = pFont->GetGlyphWidth(glyph_index); | 857 int char_width = pFont->GetGlyphWidth(glyph_index); |
858 pWidths->AddInteger(char_width); | 858 pWidths->AddInteger(char_width); |
859 } | 859 } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, | 1141 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, |
1142 const CFX_ByteStringC& name) { | 1142 const CFX_ByteStringC& name) { |
1143 if (pPageDict->KeyExist(name)) { | 1143 if (pPageDict->KeyExist(name)) { |
1144 return; | 1144 return; |
1145 } | 1145 } |
1146 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1146 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1147 if (pObj) { | 1147 if (pObj) { |
1148 pPageDict->SetAt(name, pObj->Clone()); | 1148 pPageDict->SetAt(name, pObj->Clone()); |
1149 } | 1149 } |
1150 } | 1150 } |
OLD | NEW |