Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp

Issue 1411833003: XFA: Manually apply changes to fpdf_text.h and fx_font.h from master (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 AddIndirectObject(pFontDict); 971 AddIndirectObject(pFontDict);
972 pArray->AddReference(this, pFontDict); 972 pArray->AddReference(this, pFontDict);
973 } 973 }
974 AddIndirectObject(pBaseDict); 974 AddIndirectObject(pBaseDict);
975 CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; 975 CPDF_Dictionary* pFontDesc = new CPDF_Dictionary;
976 pFontDesc->SetAtName("Type", "FontDescriptor"); 976 pFontDesc->SetAtName("Type", "FontDescriptor");
977 pFontDesc->SetAtName("FontName", basefont); 977 pFontDesc->SetAtName("FontName", basefont);
978 pFontDesc->SetAtInteger("Flags", flags); 978 pFontDesc->SetAtInteger("Flags", flags);
979 pFontDesc->SetAtInteger( 979 pFontDesc->SetAtInteger(
980 "ItalicAngle", 980 "ItalicAngle",
981 pFont->m_pSubstFont ? pFont->m_pSubstFont->m_ItalicAngle : 0); 981 pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0);
982 pFontDesc->SetAtInteger("Ascent", pFont->GetAscent()); 982 pFontDesc->SetAtInteger("Ascent", pFont->GetAscent());
983 pFontDesc->SetAtInteger("Descent", pFont->GetDescent()); 983 pFontDesc->SetAtInteger("Descent", pFont->GetDescent());
984 FX_RECT bbox; 984 FX_RECT bbox;
985 pFont->GetBBox(bbox); 985 pFont->GetBBox(bbox);
986 CPDF_Array* pBBox = new CPDF_Array; 986 CPDF_Array* pBBox = new CPDF_Array;
987 pBBox->AddInteger(bbox.left); 987 pBBox->AddInteger(bbox.left);
988 pBBox->AddInteger(bbox.bottom); 988 pBBox->AddInteger(bbox.bottom);
989 pBBox->AddInteger(bbox.right); 989 pBBox->AddInteger(bbox.right);
990 pBBox->AddInteger(bbox.top); 990 pBBox->AddInteger(bbox.top);
991 pFontDesc->SetAt("FontBBox", pBBox); 991 pFontDesc->SetAt("FontBBox", pBBox);
992 int32_t nStemV = 0; 992 int32_t nStemV = 0;
993 if (pFont->m_pSubstFont) { 993 if (pFont->GetSubstFont()) {
994 nStemV = pFont->m_pSubstFont->m_Weight / 5; 994 nStemV = pFont->GetSubstFont()->m_Weight / 5;
995 } else { 995 } else {
996 static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'}; 996 static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'};
997 const size_t count = sizeof(stem_chars) / sizeof(stem_chars[0]); 997 const size_t count = sizeof(stem_chars) / sizeof(stem_chars[0]);
998 FX_DWORD glyph = pEncoding->GlyphFromCharCode(stem_chars[0]); 998 FX_DWORD glyph = pEncoding->GlyphFromCharCode(stem_chars[0]);
999 nStemV = pFont->GetGlyphWidth(glyph); 999 nStemV = pFont->GetGlyphWidth(glyph);
1000 for (size_t i = 1; i < count; i++) { 1000 for (size_t i = 1; i < count; i++) {
1001 glyph = pEncoding->GlyphFromCharCode(stem_chars[i]); 1001 glyph = pEncoding->GlyphFromCharCode(stem_chars[i]);
1002 int width = pFont->GetGlyphWidth(glyph); 1002 int width = pFont->GetGlyphWidth(glyph);
1003 if (width > 0 && width < nStemV) { 1003 if (width > 0 && width < nStemV) {
1004 nStemV = width; 1004 nStemV = width;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, 1140 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict,
1141 const CFX_ByteStringC& name) { 1141 const CFX_ByteStringC& name) {
1142 if (pPageDict->KeyExist(name)) { 1142 if (pPageDict->KeyExist(name)) {
1143 return; 1143 return;
1144 } 1144 }
1145 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); 1145 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name);
1146 if (pObj) { 1146 if (pObj) {
1147 pPageDict->SetAt(name, pObj->Clone()); 1147 pPageDict->SetAt(name, pObj->Clone());
1148 } 1148 }
1149 } 1149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698