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

Side by Side Diff: core/fxge/ge/cfx_font.cpp

Issue 2368693002: Remove FX_BOOL from cpdf_font (Closed)
Patch Set: And again Created 4 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 "core/fxge/include/fx_font.h" 7 #include "core/fxge/include/fx_font.h"
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fxge/ge/fx_text_int.h" 10 #include "core/fxge/ge/fx_text_int.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 m_pOwnedStream(nullptr), 226 m_pOwnedStream(nullptr),
227 #endif // PDF_ENABLE_XFA 227 #endif // PDF_ENABLE_XFA
228 m_Face(nullptr), 228 m_Face(nullptr),
229 m_FaceCache(nullptr), 229 m_FaceCache(nullptr),
230 m_pFontData(nullptr), 230 m_pFontData(nullptr),
231 m_pGsubData(nullptr), 231 m_pGsubData(nullptr),
232 m_dwSize(0), 232 m_dwSize(0),
233 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 233 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
234 m_pPlatformFont(nullptr), 234 m_pPlatformFont(nullptr),
235 #endif 235 #endif
236 m_bEmbedded(FALSE), 236 m_bEmbedded(false),
237 m_bVertical(FALSE) { 237 m_bVertical(false) {
238 } 238 }
239 239
240 #ifdef PDF_ENABLE_XFA 240 #ifdef PDF_ENABLE_XFA
241 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { 241 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
242 if (!pFont) 242 if (!pFont)
243 return FALSE; 243 return FALSE;
244 244
245 m_bShallowCopy = true; 245 m_bShallowCopy = true;
246 if (pFont->m_pSubstFont) { 246 if (pFont->m_pSubstFont) {
247 m_pSubstFont.reset(new CFX_SubstFont); 247 m_pSubstFont.reset(new CFX_SubstFont);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 m_Face = nullptr; 310 m_Face = nullptr;
311 } 311 }
312 312
313 void CFX_Font::LoadSubst(const CFX_ByteString& face_name, 313 void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
314 FX_BOOL bTrueType, 314 FX_BOOL bTrueType,
315 uint32_t flags, 315 uint32_t flags,
316 int weight, 316 int weight,
317 int italic_angle, 317 int italic_angle,
318 int CharsetCP, 318 int CharsetCP,
319 FX_BOOL bVertical) { 319 bool bVertical) {
320 m_bEmbedded = FALSE; 320 m_bEmbedded = false;
321 m_bVertical = bVertical; 321 m_bVertical = bVertical;
322 m_pSubstFont.reset(new CFX_SubstFont); 322 m_pSubstFont.reset(new CFX_SubstFont);
323 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( 323 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont(
324 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, 324 face_name, bTrueType, flags, weight, italic_angle, CharsetCP,
325 m_pSubstFont.get()); 325 m_pSubstFont.get());
326 if (m_Face) { 326 if (m_Face) {
327 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); 327 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face);
328 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); 328 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face);
329 } 329 }
330 } 330 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), 364 int width = EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
365 FXFT_Get_Glyph_HoriAdvance(m_Face)); 365 FXFT_Get_Glyph_HoriAdvance(m_Face));
366 return width; 366 return width;
367 } 367 }
368 368
369 FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) { 369 FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) {
370 std::vector<uint8_t> temp(data, data + size); 370 std::vector<uint8_t> temp(data, data + size);
371 m_pFontDataAllocation.swap(temp); 371 m_pFontDataAllocation.swap(temp);
372 m_Face = FT_LoadFont(m_pFontDataAllocation.data(), size); 372 m_Face = FT_LoadFont(m_pFontDataAllocation.data(), size);
373 m_pFontData = m_pFontDataAllocation.data(); 373 m_pFontData = m_pFontDataAllocation.data();
374 m_bEmbedded = TRUE; 374 m_bEmbedded = true;
375 m_dwSize = size; 375 m_dwSize = size;
376 return !!m_Face; 376 return !!m_Face;
377 } 377 }
378 378
379 FX_BOOL CFX_Font::IsTTFont() const { 379 bool CFX_Font::IsTTFont() const {
380 if (!m_Face) 380 if (!m_Face)
381 return FALSE; 381 return false;
382 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT; 382 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT;
383 } 383 }
384 384
385 int CFX_Font::GetAscent() const { 385 int CFX_Font::GetAscent() const {
386 if (!m_Face) 386 if (!m_Face)
387 return 0; 387 return 0;
388 return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), 388 return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
389 FXFT_Get_Face_Ascender(m_Face)); 389 FXFT_Get_Face_Ascender(m_Face));
390 } 390 }
391 391
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, 705 const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index,
706 int dest_width) const { 706 int dest_width) const {
707 return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width); 707 return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width);
708 } 708 }
709 709
710 #ifdef _SKIA_SUPPORT_ 710 #ifdef _SKIA_SUPPORT_
711 CFX_TypeFace* CFX_Font::GetDeviceCache() const { 711 CFX_TypeFace* CFX_Font::GetDeviceCache() const {
712 return GetFaceCache()->GetDeviceCache(this); 712 return GetFaceCache()->GetDeviceCache(this);
713 } 713 }
714 #endif 714 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698