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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 m_pCharWidthMap(nullptr), | 102 m_pCharWidthMap(nullptr), |
103 m_pRectArray(nullptr), | 103 m_pRectArray(nullptr), |
104 m_pBBoxMap(nullptr), | 104 m_pBBoxMap(nullptr), |
105 m_pProvider(nullptr) { | 105 m_pProvider(nullptr) { |
106 ASSERT(src.m_pFont); | 106 ASSERT(src.m_pFont); |
107 m_pFont = new CFX_Font; | 107 m_pFont = new CFX_Font; |
108 m_pFont->LoadClone(src.m_pFont); | 108 m_pFont->LoadClone(src.m_pFont); |
109 CFX_SubstFont* pSubst = m_pFont->GetSubstFont(); | 109 CFX_SubstFont* pSubst = m_pFont->GetSubstFont(); |
110 if (!pSubst) { | 110 if (!pSubst) { |
111 pSubst = new CFX_SubstFont; | 111 pSubst = new CFX_SubstFont; |
112 m_pFont->SetSubstFont(pSubst); | 112 m_pFont->SetSubstFont(std::unique_ptr<CFX_SubstFont>(pSubst)); |
113 } | 113 } |
114 pSubst->m_Weight = | 114 pSubst->m_Weight = |
115 (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL; | 115 (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL; |
116 if (dwFontStyles & FX_FONTSTYLE_Italic) { | 116 if (dwFontStyles & FX_FONTSTYLE_Italic) { |
117 pSubst->m_SubstFlags |= FXFONT_SUBST_ITALIC; | 117 pSubst->m_SubstFlags |= FXFONT_SUBST_ITALIC; |
118 } | 118 } |
119 InitFont(); | 119 InitFont(); |
120 } | 120 } |
121 | 121 |
122 CFGAS_GEFont::~CFGAS_GEFont() { | 122 CFGAS_GEFont::~CFGAS_GEFont() { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 474 } |
475 if (m_pRectArray) { | 475 if (m_pRectArray) { |
476 m_pRectArray->RemoveAll(FALSE); | 476 m_pRectArray->RemoveAll(FALSE); |
477 } | 477 } |
478 } | 478 } |
479 CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const { | 479 CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const { |
480 iGlyphIndex = ((uint32_t)iGlyphIndex) >> 24; | 480 iGlyphIndex = ((uint32_t)iGlyphIndex) >> 24; |
481 return iGlyphIndex == 0 ? const_cast<CFGAS_GEFont*>(this) | 481 return iGlyphIndex == 0 ? const_cast<CFGAS_GEFont*>(this) |
482 : m_SubstFonts[iGlyphIndex - 1]; | 482 : m_SubstFonts[iGlyphIndex - 1]; |
483 } | 483 } |
OLD | NEW |