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

Side by Side Diff: core/fpdfapi/fpdf_font/cpdf_type3font.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « core/fpdfapi/fpdf_font/cpdf_type3font.h ('k') | core/fpdfapi/fpdf_font/font_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/fpdfapi/fpdf_font/cpdf_type3font.h" 7 #include "core/fpdfapi/fpdf_font/cpdf_type3font.h"
8 8
9 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" 9 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox"); 50 CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox");
51 if (pBBox) { 51 if (pBBox) {
52 m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000); 52 m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000);
53 m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000); 53 m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000);
54 m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000); 54 m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000);
55 m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000); 55 m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000);
56 } 56 }
57 int StartChar = m_pFontDict->GetIntegerBy("FirstChar"); 57 int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
58 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); 58 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
59 if (pWidthArray && (StartChar >= 0 && StartChar < 256)) { 59 if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
60 FX_DWORD count = pWidthArray->GetCount(); 60 uint32_t count = pWidthArray->GetCount();
61 if (count > 256) { 61 if (count > 256) {
62 count = 256; 62 count = 256;
63 } 63 }
64 if (StartChar + count > 256) { 64 if (StartChar + count > 256) {
65 count = 256 - StartChar; 65 count = 256 - StartChar;
66 } 66 }
67 for (FX_DWORD i = 0; i < count; i++) { 67 for (uint32_t i = 0; i < count; i++) {
68 m_CharWidthL[StartChar + i] = 68 m_CharWidthL[StartChar + i] =
69 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000); 69 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
70 } 70 }
71 } 71 }
72 m_pCharProcs = m_pFontDict->GetDictBy("CharProcs"); 72 m_pCharProcs = m_pFontDict->GetDictBy("CharProcs");
73 CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); 73 CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
74 if (pEncoding) { 74 if (pEncoding) {
75 LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE); 75 LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE);
76 if (m_pCharNames) { 76 if (m_pCharNames) {
77 for (int i = 0; i < 256; i++) { 77 for (int i = 0; i < 256; i++) {
78 m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]); 78 m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]);
79 if (m_Encoding.m_Unicodes[i] == 0) { 79 if (m_Encoding.m_Unicodes[i] == 0) {
80 m_Encoding.m_Unicodes[i] = i; 80 m_Encoding.m_Unicodes[i] = i;
81 } 81 }
82 } 82 }
83 } 83 }
84 } 84 }
85 return TRUE; 85 return TRUE;
86 } 86 }
87 87
88 void CPDF_Type3Font::CheckType3FontMetrics() { 88 void CPDF_Type3Font::CheckType3FontMetrics() {
89 CheckFontMetrics(); 89 CheckFontMetrics();
90 } 90 }
91 91
92 CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { 92 CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode, int level) {
93 if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_) 93 if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_)
94 return nullptr; 94 return nullptr;
95 95
96 auto it = m_CacheMap.find(charcode); 96 auto it = m_CacheMap.find(charcode);
97 if (it != m_CacheMap.end()) 97 if (it != m_CacheMap.end())
98 return it->second; 98 return it->second;
99 99
100 const FX_CHAR* name = 100 const FX_CHAR* name =
101 GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode); 101 GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
102 if (!name) 102 if (!name)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ASSERT(!pdfium::ContainsKey(m_CacheMap, charcode)); 138 ASSERT(!pdfium::ContainsKey(m_CacheMap, charcode));
139 CPDF_Type3Char* pCachedChar = pNewChar.release(); 139 CPDF_Type3Char* pCachedChar = pNewChar.release();
140 m_CacheMap[charcode] = pCachedChar; 140 m_CacheMap[charcode] = pCachedChar;
141 if (pCachedChar->m_pForm->GetPageObjectList()->empty()) { 141 if (pCachedChar->m_pForm->GetPageObjectList()->empty()) {
142 delete pCachedChar->m_pForm; 142 delete pCachedChar->m_pForm;
143 pCachedChar->m_pForm = nullptr; 143 pCachedChar->m_pForm = nullptr;
144 } 144 }
145 return pCachedChar; 145 return pCachedChar;
146 } 146 }
147 147
148 int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) { 148 int CPDF_Type3Font::GetCharWidthF(uint32_t charcode, int level) {
149 if (charcode >= FX_ArraySize(m_CharWidthL)) 149 if (charcode >= FX_ArraySize(m_CharWidthL))
150 charcode = 0; 150 charcode = 0;
151 151
152 if (m_CharWidthL[charcode]) 152 if (m_CharWidthL[charcode])
153 return m_CharWidthL[charcode]; 153 return m_CharWidthL[charcode];
154 154
155 const CPDF_Type3Char* pChar = LoadChar(charcode, level); 155 const CPDF_Type3Char* pChar = LoadChar(charcode, level);
156 return pChar ? pChar->m_Width : 0; 156 return pChar ? pChar->m_Width : 0;
157 } 157 }
158 158
159 FX_RECT CPDF_Type3Font::GetCharBBox(FX_DWORD charcode, int level) { 159 FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode, int level) {
160 const CPDF_Type3Char* pChar = LoadChar(charcode, level); 160 const CPDF_Type3Char* pChar = LoadChar(charcode, level);
161 return pChar ? pChar->m_BBox : FX_RECT(); 161 return pChar ? pChar->m_BBox : FX_RECT();
162 } 162 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_font/cpdf_type3font.h ('k') | core/fpdfapi/fpdf_font/font_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698