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

Side by Side Diff: core/fpdfapi/page/cpdf_textobject.cpp

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month 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/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/page/cpdf_tilingpattern.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/page/cpdf_textobject.h" 7 #include "core/fpdfapi/page/cpdf_textobject.h"
8 8
9 #include "core/fpdfapi/font/cpdf_cidfont.h" 9 #include "core/fpdfapi/font/cpdf_cidfont.h"
10 #include "core/fpdfapi/font/cpdf_font.h" 10 #include "core/fpdfapi/font/cpdf_font.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 void CPDF_TextObject::SetText(const CFX_ByteString& str) { 206 void CPDF_TextObject::SetText(const CFX_ByteString& str) {
207 SetSegments(&str, nullptr, 1); 207 SetSegments(&str, nullptr, 1);
208 RecalcPositionData(); 208 RecalcPositionData();
209 } 209 }
210 210
211 FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const { 211 FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const {
212 FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; 212 FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
213 CPDF_Font* pFont = m_TextState.GetFont(); 213 CPDF_Font* pFont = m_TextState.GetFont();
214 FX_BOOL bVertWriting = FALSE; 214 bool bVertWriting = false;
215 CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); 215 CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
216 if (pCIDFont) { 216 if (pCIDFont) {
217 bVertWriting = pCIDFont->IsVertWriting(); 217 bVertWriting = pCIDFont->IsVertWriting();
218 } 218 }
219 if (!bVertWriting) 219 if (!bVertWriting)
220 return pFont->GetCharWidthF(charcode) * fontsize; 220 return pFont->GetCharWidthF(charcode) * fontsize;
221 221
222 uint16_t CID = pCIDFont->CIDFromCharCode(charcode); 222 uint16_t CID = pCIDFont->CIDFromCharCode(charcode);
223 return pCIDFont->GetVertWidth(CID) * fontsize; 223 return pCIDFont->GetVertWidth(CID) * fontsize;
224 } 224 }
(...skipping 16 matching lines...) Expand all
241 241
242 void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, 242 void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
243 FX_FLOAT* pTextAdvanceY, 243 FX_FLOAT* pTextAdvanceY,
244 FX_FLOAT horz_scale) { 244 FX_FLOAT horz_scale) {
245 FX_FLOAT curpos = 0; 245 FX_FLOAT curpos = 0;
246 FX_FLOAT min_x = 10000 * 1.0f; 246 FX_FLOAT min_x = 10000 * 1.0f;
247 FX_FLOAT max_x = -10000 * 1.0f; 247 FX_FLOAT max_x = -10000 * 1.0f;
248 FX_FLOAT min_y = 10000 * 1.0f; 248 FX_FLOAT min_y = 10000 * 1.0f;
249 FX_FLOAT max_y = -10000 * 1.0f; 249 FX_FLOAT max_y = -10000 * 1.0f;
250 CPDF_Font* pFont = m_TextState.GetFont(); 250 CPDF_Font* pFont = m_TextState.GetFont();
251 FX_BOOL bVertWriting = FALSE; 251 bool bVertWriting = false;
252 CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); 252 CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
253 if (pCIDFont) { 253 if (pCIDFont) {
254 bVertWriting = pCIDFont->IsVertWriting(); 254 bVertWriting = pCIDFont->IsVertWriting();
255 } 255 }
256 FX_FLOAT fontsize = m_TextState.GetFontSize(); 256 FX_FLOAT fontsize = m_TextState.GetFontSize();
257 for (int i = 0; i < m_nChars; ++i) { 257 for (int i = 0; i < m_nChars; ++i) {
258 uint32_t charcode = 258 uint32_t charcode =
259 m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; 259 m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
260 if (i > 0) { 260 if (i > 0) {
261 if (charcode == CPDF_Font::kInvalidCharCode) { 261 if (charcode == CPDF_Font::kInvalidCharCode) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 m_PosY = y; 379 m_PosY = y;
380 m_Left += dx; 380 m_Left += dx;
381 m_Right += dx; 381 m_Right += dx;
382 m_Top += dy; 382 m_Top += dy;
383 m_Bottom += dy; 383 m_Bottom += dy;
384 } 384 }
385 385
386 void CPDF_TextObject::RecalcPositionData() { 386 void CPDF_TextObject::RecalcPositionData() {
387 CalcPositionData(nullptr, nullptr, 1); 387 CalcPositionData(nullptr, nullptr, 1);
388 } 388 }
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/page/cpdf_tilingpattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698