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

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

Issue 2643543002: Stop using Encoding array to get unicode from charcode in Type 3 fonts (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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/font/cpdf_type3font.h" 7 #include "core/fpdfapi/font/cpdf_type3font.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 count = 256; 65 count = 256;
66 if (StartChar + count > 256) 66 if (StartChar + count > 256)
67 count = 256 - StartChar; 67 count = 256 - StartChar;
68 for (size_t i = 0; i < count; i++) { 68 for (size_t i = 0; i < count; i++) {
69 m_CharWidthL[StartChar + i] = 69 m_CharWidthL[StartChar + i] =
70 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000); 70 FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
71 } 71 }
72 } 72 }
73 m_pCharProcs = m_pFontDict->GetDictFor("CharProcs"); 73 m_pCharProcs = m_pFontDict->GetDictFor("CharProcs");
74 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding"); 74 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
75 if (pEncoding) { 75 if (pEncoding)
76 LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, false, false); 76 LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, false, false);
77 if (!m_CharNames.empty()) {
78 for (int i = 0; i < 256; i++) {
79 m_Encoding.m_Unicodes[i] =
80 PDF_UnicodeFromAdobeName(m_CharNames[i].c_str());
81 if (m_Encoding.m_Unicodes[i] == 0) {
82 m_Encoding.m_Unicodes[i] = i;
83 }
84 }
85 }
86 }
87 return true; 77 return true;
88 } 78 }
89 79
90 void CPDF_Type3Font::CheckType3FontMetrics() { 80 void CPDF_Type3Font::CheckType3FontMetrics() {
91 CheckFontMetrics(); 81 CheckFontMetrics();
92 } 82 }
93 83
94 CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { 84 CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
95 if (m_CharLoadingDepth >= FPDF_MAX_TYPE3_FORM_LEVEL) 85 if (m_CharLoadingDepth >= FPDF_MAX_TYPE3_FORM_LEVEL)
96 return nullptr; 86 return nullptr;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return m_CharWidthL[charcode]; 143 return m_CharWidthL[charcode];
154 144
155 const CPDF_Type3Char* pChar = LoadChar(charcode); 145 const CPDF_Type3Char* pChar = LoadChar(charcode);
156 return pChar ? pChar->m_Width : 0; 146 return pChar ? pChar->m_Width : 0;
157 } 147 }
158 148
159 FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode) { 149 FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode) {
160 const CPDF_Type3Char* pChar = LoadChar(charcode); 150 const CPDF_Type3Char* pChar = LoadChar(charcode);
161 return pChar ? pChar->m_BBox : FX_RECT(); 151 return pChar ? pChar->m_BBox : FX_RECT();
162 } 152 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698