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

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

Issue 2032613003: Get rid of NULLs in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Git rid of comparisons against NULL Created 4 years, 6 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/fpdfapi/fpdf_font/include/cpdf_font.h" 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
8 #include "core/fxge/ge/fx_text_int.h" 8 #include "core/fxge/ge/fx_text_int.h"
9 #include "core/fxge/include/fx_freetype.h" 9 #include "core/fxge/include/fx_freetype.h"
10 #include "core/fxge/include/fx_ge.h" 10 #include "core/fxge/include/fx_ge.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 m_hHandle = NULL; 53 m_hHandle = NULL;
54 m_bDwLoaded = FALSE; 54 m_bDwLoaded = FALSE;
55 #ifdef PDF_ENABLE_XFA 55 #ifdef PDF_ENABLE_XFA
56 m_bLogic = FALSE; 56 m_bLogic = FALSE;
57 m_pOwnedStream = NULL; 57 m_pOwnedStream = NULL;
58 #endif // PDF_ENABLE_XFA 58 #endif // PDF_ENABLE_XFA
59 } 59 }
60 60
61 #ifdef PDF_ENABLE_XFA 61 #ifdef PDF_ENABLE_XFA
62 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { 62 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
63 if (pFont == NULL) { 63 if (!pFont)
64 return FALSE; 64 return FALSE;
65 } 65
66 m_bLogic = TRUE; 66 m_bLogic = TRUE;
67 if (pFont->m_pSubstFont) { 67 if (pFont->m_pSubstFont) {
68 m_pSubstFont = new CFX_SubstFont; 68 m_pSubstFont = new CFX_SubstFont;
69 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; 69 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset;
70 m_pSubstFont->m_ExtHandle = pFont->m_pSubstFont->m_ExtHandle; 70 m_pSubstFont->m_ExtHandle = pFont->m_pSubstFont->m_ExtHandle;
71 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; 71 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags;
72 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; 72 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight;
73 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; 73 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family;
74 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; 74 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle;
75 } 75 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return width; 232 return width;
233 } 233 }
234 234
235 FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) { 235 FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) {
236 m_pFontDataAllocation = FX_Alloc(uint8_t, size); 236 m_pFontDataAllocation = FX_Alloc(uint8_t, size);
237 FXSYS_memcpy(m_pFontDataAllocation, data, size); 237 FXSYS_memcpy(m_pFontDataAllocation, data, size);
238 m_Face = FT_LoadFont(m_pFontDataAllocation, size); 238 m_Face = FT_LoadFont(m_pFontDataAllocation, size);
239 m_pFontData = m_pFontDataAllocation; 239 m_pFontData = m_pFontDataAllocation;
240 m_bEmbedded = TRUE; 240 m_bEmbedded = TRUE;
241 m_dwSize = size; 241 m_dwSize = size;
242 return m_Face != NULL; 242 return !!m_Face;
243 } 243 }
244 244
245 FX_BOOL CFX_Font::IsTTFont() const { 245 FX_BOOL CFX_Font::IsTTFont() const {
246 if (!m_Face) 246 if (!m_Face)
247 return FALSE; 247 return FALSE;
248 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT; 248 return FXFT_Is_Face_TT_OT(m_Face) == FXFT_FACE_FLAG_SFNT;
249 } 249 }
250 250
251 int CFX_Font::GetAscent() const { 251 int CFX_Font::GetAscent() const {
252 if (!m_Face) 252 if (!m_Face)
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { 531 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) {
532 CFX_UnicodeEncodingEx* pFontEncoding = 532 CFX_UnicodeEncodingEx* pFontEncoding =
533 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); 533 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]);
534 if (pFontEncoding) { 534 if (pFontEncoding) {
535 return pFontEncoding; 535 return pFontEncoding;
536 } 536 }
537 } 537 }
538 return NULL; 538 return NULL;
539 } 539 }
540 #endif // PDF_ENABLE_XFA 540 #endif // PDF_ENABLE_XFA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698