| 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/fpdfapi/fpdf_parser/include/cpdf_document.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) { | 664 CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) { |
| 665 if (!pObj) | 665 if (!pObj) |
| 666 return nullptr; | 666 return nullptr; |
| 667 | 667 |
| 668 ASSERT(pObj->GetObjNum()); | 668 ASSERT(pObj->GetObjNum()); |
| 669 return m_pDocPage->GetImage(pObj); | 669 return m_pDocPage->GetImage(pObj); |
| 670 } | 670 } |
| 671 | 671 |
| 672 void CPDF_Document::CreateNewDoc() { | 672 void CPDF_Document::CreateNewDoc() { |
| 673 ASSERT(!m_pRootDict && !m_pInfoDict); | 673 ASSERT(!m_pRootDict && !m_pInfoDict); |
| 674 m_pRootDict = new CPDF_Dictionary; | 674 m_pRootDict = new CPDF_Dictionary(this); |
| 675 m_pRootDict->SetNameFor("Type", "Catalog"); | 675 m_pRootDict->SetNameFor("Type", "Catalog"); |
| 676 int objnum = AddIndirectObject(m_pRootDict); | 676 int objnum = AddIndirectObject(m_pRootDict); |
| 677 CPDF_Dictionary* pPages = new CPDF_Dictionary; | 677 CPDF_Dictionary* pPages = new CPDF_Dictionary(this); |
| 678 pPages->SetNameFor("Type", "Pages"); | 678 pPages->SetNameFor("Type", "Pages"); |
| 679 pPages->SetNumberFor("Count", 0); | 679 pPages->SetNumberFor("Count", 0); |
| 680 pPages->SetFor("Kids", new CPDF_Array); | 680 pPages->SetFor("Kids", new CPDF_Array); |
| 681 objnum = AddIndirectObject(pPages); | 681 objnum = AddIndirectObject(pPages); |
| 682 m_pRootDict->SetReferenceFor("Pages", this, objnum); | 682 m_pRootDict->SetReferenceFor("Pages", this, objnum); |
| 683 m_pInfoDict = new CPDF_Dictionary; | 683 m_pInfoDict = new CPDF_Dictionary(this); |
| 684 AddIndirectObject(m_pInfoDict); | 684 AddIndirectObject(m_pInfoDict); |
| 685 } | 685 } |
| 686 | 686 |
| 687 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { | 687 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
| 688 CPDF_Dictionary* pDict = new CPDF_Dictionary; | 688 CPDF_Dictionary* pDict = new CPDF_Dictionary(this); |
| 689 pDict->SetNameFor("Type", "Page"); | 689 pDict->SetNameFor("Type", "Page"); |
| 690 uint32_t dwObjNum = AddIndirectObject(pDict); | 690 uint32_t dwObjNum = AddIndirectObject(pDict); |
| 691 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { | 691 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { |
| 692 ReleaseIndirectObject(dwObjNum); | 692 ReleaseIndirectObject(dwObjNum); |
| 693 return nullptr; | 693 return nullptr; |
| 694 } | 694 } |
| 695 return pDict; | 695 return pDict; |
| 696 } | 696 } |
| 697 | 697 |
| 698 void CPDF_Document::DeletePage(int iPage) { | 698 void CPDF_Document::DeletePage(int iPage) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 721 | 721 |
| 722 size_t CPDF_Document::CalculateEncodingDict(int charset, | 722 size_t CPDF_Document::CalculateEncodingDict(int charset, |
| 723 CPDF_Dictionary* pBaseDict) { | 723 CPDF_Dictionary* pBaseDict) { |
| 724 size_t i; | 724 size_t i; |
| 725 for (i = 0; i < FX_ArraySize(g_FX_CharsetUnicodes); ++i) { | 725 for (i = 0; i < FX_ArraySize(g_FX_CharsetUnicodes); ++i) { |
| 726 if (g_FX_CharsetUnicodes[i].m_Charset == charset) | 726 if (g_FX_CharsetUnicodes[i].m_Charset == charset) |
| 727 break; | 727 break; |
| 728 } | 728 } |
| 729 if (i == FX_ArraySize(g_FX_CharsetUnicodes)) | 729 if (i == FX_ArraySize(g_FX_CharsetUnicodes)) |
| 730 return i; | 730 return i; |
| 731 CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary; | 731 CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary(this); |
| 732 pEncodingDict->SetNameFor("BaseEncoding", "WinAnsiEncoding"); | 732 pEncodingDict->SetNameFor("BaseEncoding", "WinAnsiEncoding"); |
| 733 CPDF_Array* pArray = new CPDF_Array; | 733 CPDF_Array* pArray = new CPDF_Array; |
| 734 pArray->AddInteger(128); | 734 pArray->AddInteger(128); |
| 735 const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; | 735 const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; |
| 736 for (int j = 0; j < 128; j++) { | 736 for (int j = 0; j < 128; j++) { |
| 737 CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]); | 737 CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]); |
| 738 pArray->AddName(name.IsEmpty() ? ".notdef" : name); | 738 pArray->AddName(name.IsEmpty() ? ".notdef" : name); |
| 739 } | 739 } |
| 740 pEncodingDict->SetFor("Differences", pArray); | 740 pEncodingDict->SetFor("Differences", pArray); |
| 741 AddIndirectObject(pEncodingDict); | 741 AddIndirectObject(pEncodingDict); |
| 742 pBaseDict->SetReferenceFor("Encoding", this, pEncodingDict); | 742 pBaseDict->SetReferenceFor("Encoding", this, pEncodingDict); |
| 743 return i; | 743 return i; |
| 744 } | 744 } |
| 745 | 745 |
| 746 CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { | 746 CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { |
| 747 if (!pFont) | 747 if (!pFont) |
| 748 return nullptr; | 748 return nullptr; |
| 749 | 749 |
| 750 bool bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || | 750 bool bCJK = charset == FXFONT_CHINESEBIG5_CHARSET || |
| 751 charset == FXFONT_GB2312_CHARSET || | 751 charset == FXFONT_GB2312_CHARSET || |
| 752 charset == FXFONT_HANGEUL_CHARSET || | 752 charset == FXFONT_HANGEUL_CHARSET || |
| 753 charset == FXFONT_SHIFTJIS_CHARSET; | 753 charset == FXFONT_SHIFTJIS_CHARSET; |
| 754 CFX_ByteString basefont = pFont->GetFamilyName(); | 754 CFX_ByteString basefont = pFont->GetFamilyName(); |
| 755 basefont.Replace(" ", ""); | 755 basefont.Replace(" ", ""); |
| 756 int flags = | 756 int flags = |
| 757 CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(), | 757 CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(), |
| 758 false, false, charset == FXFONT_SYMBOL_CHARSET); | 758 false, false, charset == FXFONT_SYMBOL_CHARSET); |
| 759 | 759 |
| 760 CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; | 760 CPDF_Dictionary* pBaseDict = new CPDF_Dictionary(this); |
| 761 pBaseDict->SetNameFor("Type", "Font"); | 761 pBaseDict->SetNameFor("Type", "Font"); |
| 762 std::unique_ptr<CFX_UnicodeEncoding> pEncoding( | 762 std::unique_ptr<CFX_UnicodeEncoding> pEncoding( |
| 763 new CFX_UnicodeEncoding(pFont)); | 763 new CFX_UnicodeEncoding(pFont)); |
| 764 CPDF_Dictionary* pFontDict = pBaseDict; | 764 CPDF_Dictionary* pFontDict = pBaseDict; |
| 765 if (!bCJK) { | 765 if (!bCJK) { |
| 766 CPDF_Array* pWidths = new CPDF_Array; | 766 CPDF_Array* pWidths = new CPDF_Array; |
| 767 for (int charcode = 32; charcode < 128; charcode++) { | 767 for (int charcode = 32; charcode < 128; charcode++) { |
| 768 int glyph_index = pEncoding->GlyphFromCharCode(charcode); | 768 int glyph_index = pEncoding->GlyphFromCharCode(charcode); |
| 769 int char_width = pFont->GetGlyphWidth(glyph_index); | 769 int char_width = pFont->GetGlyphWidth(glyph_index); |
| 770 pWidths->AddInteger(char_width); | 770 pWidths->AddInteger(char_width); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 785 int glyph_index = pEncoding->GlyphFromCharCode(pUnicodes[j]); | 785 int glyph_index = pEncoding->GlyphFromCharCode(pUnicodes[j]); |
| 786 int char_width = pFont->GetGlyphWidth(glyph_index); | 786 int char_width = pFont->GetGlyphWidth(glyph_index); |
| 787 pWidths->AddInteger(char_width); | 787 pWidths->AddInteger(char_width); |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 } | 790 } |
| 791 ProcessNonbCJK(pBaseDict, pFont->IsBold(), pFont->IsItalic(), basefont, | 791 ProcessNonbCJK(pBaseDict, pFont->IsBold(), pFont->IsItalic(), basefont, |
| 792 pWidths); | 792 pWidths); |
| 793 } else { | 793 } else { |
| 794 flags |= PDFFONT_NONSYMBOLIC; | 794 flags |= PDFFONT_NONSYMBOLIC; |
| 795 pFontDict = new CPDF_Dictionary; | 795 pFontDict = new CPDF_Dictionary(this); |
| 796 CFX_ByteString cmap; | 796 CFX_ByteString cmap; |
| 797 CFX_ByteString ordering; | 797 CFX_ByteString ordering; |
| 798 int supplement = 0; | 798 int supplement = 0; |
| 799 CPDF_Array* pWidthArray = new CPDF_Array; | 799 CPDF_Array* pWidthArray = new CPDF_Array; |
| 800 switch (charset) { | 800 switch (charset) { |
| 801 case FXFONT_CHINESEBIG5_CHARSET: | 801 case FXFONT_CHINESEBIG5_CHARSET: |
| 802 cmap = bVert ? "ETenms-B5-V" : "ETenms-B5-H"; | 802 cmap = bVert ? "ETenms-B5-V" : "ETenms-B5-H"; |
| 803 ordering = "CNS1"; | 803 ordering = "CNS1"; |
| 804 supplement = 4; | 804 supplement = 4; |
| 805 pWidthArray->AddInteger(1); | 805 pWidthArray->AddInteger(1); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 835 InsertWidthArray1(pFont, pEncoding.get(), 0x7e, 0x7e, pWidthArray); | 835 InsertWidthArray1(pFont, pEncoding.get(), 0x7e, 0x7e, pWidthArray); |
| 836 break; | 836 break; |
| 837 } | 837 } |
| 838 pBaseDict->SetNameFor("Subtype", "Type0"); | 838 pBaseDict->SetNameFor("Subtype", "Type0"); |
| 839 pBaseDict->SetNameFor("BaseFont", basefont); | 839 pBaseDict->SetNameFor("BaseFont", basefont); |
| 840 pBaseDict->SetNameFor("Encoding", cmap); | 840 pBaseDict->SetNameFor("Encoding", cmap); |
| 841 pFontDict->SetFor("W", pWidthArray); | 841 pFontDict->SetFor("W", pWidthArray); |
| 842 pFontDict->SetNameFor("Type", "Font"); | 842 pFontDict->SetNameFor("Type", "Font"); |
| 843 pFontDict->SetNameFor("Subtype", "CIDFontType2"); | 843 pFontDict->SetNameFor("Subtype", "CIDFontType2"); |
| 844 pFontDict->SetNameFor("BaseFont", basefont); | 844 pFontDict->SetNameFor("BaseFont", basefont); |
| 845 CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary; | 845 CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary(this); |
| 846 pCIDSysInfo->SetStringFor("Registry", "Adobe"); | 846 pCIDSysInfo->SetStringFor("Registry", "Adobe"); |
| 847 pCIDSysInfo->SetStringFor("Ordering", ordering); | 847 pCIDSysInfo->SetStringFor("Ordering", ordering); |
| 848 pCIDSysInfo->SetIntegerFor("Supplement", supplement); | 848 pCIDSysInfo->SetIntegerFor("Supplement", supplement); |
| 849 pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo); | 849 pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo); |
| 850 CPDF_Array* pArray = new CPDF_Array; | 850 CPDF_Array* pArray = new CPDF_Array; |
| 851 pBaseDict->SetFor("DescendantFonts", pArray); | 851 pBaseDict->SetFor("DescendantFonts", pArray); |
| 852 AddIndirectObject(pFontDict); | 852 AddIndirectObject(pFontDict); |
| 853 pArray->AddReference(this, pFontDict); | 853 pArray->AddReference(this, pFontDict); |
| 854 } | 854 } |
| 855 AddIndirectObject(pBaseDict); | 855 AddIndirectObject(pBaseDict); |
| 856 CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; | 856 CPDF_Dictionary* pFontDesc = new CPDF_Dictionary(this); |
| 857 pFontDesc->SetNameFor("Type", "FontDescriptor"); | 857 pFontDesc->SetNameFor("Type", "FontDescriptor"); |
| 858 pFontDesc->SetNameFor("FontName", basefont); | 858 pFontDesc->SetNameFor("FontName", basefont); |
| 859 pFontDesc->SetIntegerFor("Flags", flags); | 859 pFontDesc->SetIntegerFor("Flags", flags); |
| 860 pFontDesc->SetIntegerFor( | 860 pFontDesc->SetIntegerFor( |
| 861 "ItalicAngle", | 861 "ItalicAngle", |
| 862 pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0); | 862 pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0); |
| 863 pFontDesc->SetIntegerFor("Ascent", pFont->GetAscent()); | 863 pFontDesc->SetIntegerFor("Ascent", pFont->GetAscent()); |
| 864 pFontDesc->SetIntegerFor("Descent", pFont->GetDescent()); | 864 pFontDesc->SetIntegerFor("Descent", pFont->GetDescent()); |
| 865 FX_RECT bbox; | 865 FX_RECT bbox; |
| 866 pFont->GetBBox(bbox); | 866 pFont->GetBBox(bbox); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 basefont = pLogFont->lfFaceName; | 942 basefont = pLogFont->lfFaceName; |
| 943 | 943 |
| 944 int italicangle = ptm->otmItalicAngle / 10; | 944 int italicangle = ptm->otmItalicAngle / 10; |
| 945 int ascend = ptm->otmrcFontBox.top; | 945 int ascend = ptm->otmrcFontBox.top; |
| 946 int descend = ptm->otmrcFontBox.bottom; | 946 int descend = ptm->otmrcFontBox.bottom; |
| 947 int capheight = ptm->otmsCapEmHeight; | 947 int capheight = ptm->otmsCapEmHeight; |
| 948 int bbox[4] = {ptm->otmrcFontBox.left, ptm->otmrcFontBox.bottom, | 948 int bbox[4] = {ptm->otmrcFontBox.left, ptm->otmrcFontBox.bottom, |
| 949 ptm->otmrcFontBox.right, ptm->otmrcFontBox.top}; | 949 ptm->otmrcFontBox.right, ptm->otmrcFontBox.top}; |
| 950 FX_Free(tm_buf); | 950 FX_Free(tm_buf); |
| 951 basefont.Replace(" ", ""); | 951 basefont.Replace(" ", ""); |
| 952 CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; | 952 CPDF_Dictionary* pBaseDict = new CPDF_Dictionary(this); |
| 953 pBaseDict->SetNameFor("Type", "Font"); | 953 pBaseDict->SetNameFor("Type", "Font"); |
| 954 CPDF_Dictionary* pFontDict = pBaseDict; | 954 CPDF_Dictionary* pFontDict = pBaseDict; |
| 955 if (!bCJK) { | 955 if (!bCJK) { |
| 956 if (pLogFont->lfCharSet == ANSI_CHARSET || | 956 if (pLogFont->lfCharSet == ANSI_CHARSET || |
| 957 pLogFont->lfCharSet == DEFAULT_CHARSET || | 957 pLogFont->lfCharSet == DEFAULT_CHARSET || |
| 958 pLogFont->lfCharSet == SYMBOL_CHARSET) { | 958 pLogFont->lfCharSet == SYMBOL_CHARSET) { |
| 959 pBaseDict->SetNameFor("Encoding", "WinAnsiEncoding"); | 959 pBaseDict->SetNameFor("Encoding", "WinAnsiEncoding"); |
| 960 } else { | 960 } else { |
| 961 CalculateEncodingDict(pLogFont->lfCharSet, pBaseDict); | 961 CalculateEncodingDict(pLogFont->lfCharSet, pBaseDict); |
| 962 } | 962 } |
| 963 int char_widths[224]; | 963 int char_widths[224]; |
| 964 GetCharWidth(hDC, 32, 255, char_widths); | 964 GetCharWidth(hDC, 32, 255, char_widths); |
| 965 CPDF_Array* pWidths = new CPDF_Array; | 965 CPDF_Array* pWidths = new CPDF_Array; |
| 966 for (size_t i = 0; i < 224; i++) | 966 for (size_t i = 0; i < 224; i++) |
| 967 pWidths->AddInteger(char_widths[i]); | 967 pWidths->AddInteger(char_widths[i]); |
| 968 ProcessNonbCJK(pBaseDict, pLogFont->lfWeight > FW_MEDIUM, | 968 ProcessNonbCJK(pBaseDict, pLogFont->lfWeight > FW_MEDIUM, |
| 969 pLogFont->lfItalic != 0, basefont, pWidths); | 969 pLogFont->lfItalic != 0, basefont, pWidths); |
| 970 } else { | 970 } else { |
| 971 pFontDict = new CPDF_Dictionary; | 971 pFontDict = new CPDF_Dictionary(this); |
| 972 CFX_ByteString cmap; | 972 CFX_ByteString cmap; |
| 973 CFX_ByteString ordering; | 973 CFX_ByteString ordering; |
| 974 int supplement = 0; | 974 int supplement = 0; |
| 975 CPDF_Array* pWidthArray = new CPDF_Array; | 975 CPDF_Array* pWidthArray = new CPDF_Array; |
| 976 switch (pLogFont->lfCharSet) { | 976 switch (pLogFont->lfCharSet) { |
| 977 case CHINESEBIG5_CHARSET: | 977 case CHINESEBIG5_CHARSET: |
| 978 cmap = bVert ? "ETenms-B5-V" : "ETenms-B5-H"; | 978 cmap = bVert ? "ETenms-B5-V" : "ETenms-B5-H"; |
| 979 ordering = "CNS1"; | 979 ordering = "CNS1"; |
| 980 supplement = 4; | 980 supplement = 4; |
| 981 pWidthArray->AddInteger(1); | 981 pWidthArray->AddInteger(1); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1010 InsertWidthArray(hDC, 0x7e, 0x7e, pWidthArray); | 1010 InsertWidthArray(hDC, 0x7e, 0x7e, pWidthArray); |
| 1011 break; | 1011 break; |
| 1012 } | 1012 } |
| 1013 pBaseDict->SetNameFor("Subtype", "Type0"); | 1013 pBaseDict->SetNameFor("Subtype", "Type0"); |
| 1014 pBaseDict->SetNameFor("BaseFont", basefont); | 1014 pBaseDict->SetNameFor("BaseFont", basefont); |
| 1015 pBaseDict->SetNameFor("Encoding", cmap); | 1015 pBaseDict->SetNameFor("Encoding", cmap); |
| 1016 pFontDict->SetFor("W", pWidthArray); | 1016 pFontDict->SetFor("W", pWidthArray); |
| 1017 pFontDict->SetNameFor("Type", "Font"); | 1017 pFontDict->SetNameFor("Type", "Font"); |
| 1018 pFontDict->SetNameFor("Subtype", "CIDFontType2"); | 1018 pFontDict->SetNameFor("Subtype", "CIDFontType2"); |
| 1019 pFontDict->SetNameFor("BaseFont", basefont); | 1019 pFontDict->SetNameFor("BaseFont", basefont); |
| 1020 CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary; | 1020 CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary(this); |
| 1021 pCIDSysInfo->SetStringFor("Registry", "Adobe"); | 1021 pCIDSysInfo->SetStringFor("Registry", "Adobe"); |
| 1022 pCIDSysInfo->SetStringFor("Ordering", ordering); | 1022 pCIDSysInfo->SetStringFor("Ordering", ordering); |
| 1023 pCIDSysInfo->SetIntegerFor("Supplement", supplement); | 1023 pCIDSysInfo->SetIntegerFor("Supplement", supplement); |
| 1024 pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo); | 1024 pFontDict->SetFor("CIDSystemInfo", pCIDSysInfo); |
| 1025 CPDF_Array* pArray = new CPDF_Array; | 1025 CPDF_Array* pArray = new CPDF_Array; |
| 1026 pBaseDict->SetFor("DescendantFonts", pArray); | 1026 pBaseDict->SetFor("DescendantFonts", pArray); |
| 1027 AddIndirectObject(pFontDict); | 1027 AddIndirectObject(pFontDict); |
| 1028 pArray->AddReference(this, pFontDict); | 1028 pArray->AddReference(this, pFontDict); |
| 1029 } | 1029 } |
| 1030 AddIndirectObject(pBaseDict); | 1030 AddIndirectObject(pBaseDict); |
| 1031 CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; | 1031 CPDF_Dictionary* pFontDesc = new CPDF_Dictionary(this); |
| 1032 pFontDesc->SetNameFor("Type", "FontDescriptor"); | 1032 pFontDesc->SetNameFor("Type", "FontDescriptor"); |
| 1033 pFontDesc->SetNameFor("FontName", basefont); | 1033 pFontDesc->SetNameFor("FontName", basefont); |
| 1034 pFontDesc->SetIntegerFor("Flags", flags); | 1034 pFontDesc->SetIntegerFor("Flags", flags); |
| 1035 CPDF_Array* pBBox = new CPDF_Array; | 1035 CPDF_Array* pBBox = new CPDF_Array; |
| 1036 for (int i = 0; i < 4; i++) | 1036 for (int i = 0; i < 4; i++) |
| 1037 pBBox->AddInteger(bbox[i]); | 1037 pBBox->AddInteger(bbox[i]); |
| 1038 pFontDesc->SetFor("FontBBox", pBBox); | 1038 pFontDesc->SetFor("FontBBox", pBBox); |
| 1039 pFontDesc->SetIntegerFor("ItalicAngle", italicangle); | 1039 pFontDesc->SetIntegerFor("ItalicAngle", italicangle); |
| 1040 pFontDesc->SetIntegerFor("Ascent", ascend); | 1040 pFontDesc->SetIntegerFor("Ascent", ascend); |
| 1041 pFontDesc->SetIntegerFor("Descent", descend); | 1041 pFontDesc->SetIntegerFor("Descent", descend); |
| 1042 pFontDesc->SetIntegerFor("CapHeight", capheight); | 1042 pFontDesc->SetIntegerFor("CapHeight", capheight); |
| 1043 pFontDesc->SetIntegerFor("StemV", pLogFont->lfWeight / 5); | 1043 pFontDesc->SetIntegerFor("StemV", pLogFont->lfWeight / 5); |
| 1044 AddIndirectObject(pFontDesc); | 1044 AddIndirectObject(pFontDesc); |
| 1045 pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc); | 1045 pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc); |
| 1046 hFont = SelectObject(hDC, hFont); | 1046 hFont = SelectObject(hDC, hFont); |
| 1047 DeleteObject(hFont); | 1047 DeleteObject(hFont); |
| 1048 DeleteDC(hDC); | 1048 DeleteDC(hDC); |
| 1049 return LoadFont(pBaseDict); | 1049 return LoadFont(pBaseDict); |
| 1050 } | 1050 } |
| 1051 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1051 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| OLD | NEW |