OLD | NEW |
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 "xfa/fgas/font/fgas_gefont.h" | 7 #include "xfa/fgas/font/fgas_gefont.h" |
8 | 8 |
9 #include "xfa/fgas/crt/fgas_codepage.h" | 9 #include "xfa/fgas/crt/fgas_codepage.h" |
10 #include "xfa/fgas/font/fgas_fontutils.h" | 10 #include "xfa/fgas/font/fgas_fontutils.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if (bRet) { | 292 if (bRet) { |
293 m_bExtFont = !bTakeOver; | 293 m_bExtFont = !bTakeOver; |
294 bRet = InitFont(); | 294 bRet = InitFont(); |
295 } else { | 295 } else { |
296 m_bExtFont = TRUE; | 296 m_bExtFont = TRUE; |
297 } | 297 } |
298 m_wCharSet = 0xFFFF; | 298 m_wCharSet = 0xFFFF; |
299 return bRet; | 299 return bRet; |
300 } | 300 } |
301 FX_BOOL CFX_GEFont::InitFont() { | 301 FX_BOOL CFX_GEFont::InitFont() { |
302 if (!m_pFont) { | 302 if (!m_pFont) |
303 return FALSE; | 303 return FALSE; |
304 } | |
305 if (!m_pFontEncoding) { | 304 if (!m_pFontEncoding) { |
306 m_pFontEncoding = FX_CreateFontEncodingEx(m_pFont); | 305 m_pFontEncoding = FX_CreateFontEncodingEx(m_pFont); |
307 if (!m_pFontEncoding) { | 306 if (!m_pFontEncoding) |
308 return FALSE; | 307 return FALSE; |
309 } | |
310 } | 308 } |
311 if (!m_pCharWidthMap) { | 309 if (!m_pCharWidthMap) |
312 m_pCharWidthMap = new CFX_WordDiscreteArray(1024); | 310 m_pCharWidthMap = new CFX_WordDiscreteArray(1024); |
313 } | 311 if (!m_pRectArray) |
314 if (!m_pRectArray) { | 312 m_pRectArray = new CFX_MassArrayTemplate<CFX_Rect>(16); |
315 m_pRectArray = new CFX_RectMassArray(16); | 313 if (!m_pBBoxMap) |
316 } | |
317 if (!m_pBBoxMap) { | |
318 m_pBBoxMap = new CFX_MapPtrToPtr(16); | 314 m_pBBoxMap = new CFX_MapPtrToPtr(16); |
319 } | 315 |
320 return TRUE; | 316 return TRUE; |
321 } | 317 } |
322 IFX_Font* CFX_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { | 318 IFX_Font* CFX_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { |
323 if (GetFontStyles() == dwFontStyles) { | 319 if (GetFontStyles() == dwFontStyles) { |
324 return Retain(); | 320 return Retain(); |
325 } | 321 } |
326 return new CFX_GEFont(*this, dwFontStyles); | 322 return new CFX_GEFont(*this, dwFontStyles); |
327 } | 323 } |
328 uint8_t CFX_GEFont::GetCharSet() const { | 324 uint8_t CFX_GEFont::GetCharSet() const { |
329 if (m_wCharSet != 0xFFFF) { | 325 if (m_wCharSet != 0xFFFF) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 } | 550 } |
555 if (m_pRectArray != NULL) { | 551 if (m_pRectArray != NULL) { |
556 m_pRectArray->RemoveAll(); | 552 m_pRectArray->RemoveAll(); |
557 } | 553 } |
558 } | 554 } |
559 IFX_Font* CFX_GEFont::GetSubstFont(int32_t iGlyphIndex) const { | 555 IFX_Font* CFX_GEFont::GetSubstFont(int32_t iGlyphIndex) const { |
560 iGlyphIndex = ((uint32_t)iGlyphIndex) >> 24; | 556 iGlyphIndex = ((uint32_t)iGlyphIndex) >> 24; |
561 return iGlyphIndex == 0 ? const_cast<CFX_GEFont*>(this) | 557 return iGlyphIndex == 0 ? const_cast<CFX_GEFont*>(this) |
562 : m_SubstFonts[iGlyphIndex - 1]; | 558 : m_SubstFonts[iGlyphIndex - 1]; |
563 } | 559 } |
OLD | NEW |