| OLD | NEW |
| 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 "xfa/fxfa/parser/cxfa_font.h" | 7 #include "xfa/fxfa/parser/cxfa_font.h" |
| 8 | 8 |
| 9 #include "core/fxge/fx_dib.h" | 9 #include "core/fxge/fx_dib.h" |
| 10 #include "xfa/fxfa/parser/cxfa_fill.h" | 10 #include "xfa/fxfa/parser/cxfa_fill.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 FX_FLOAT CXFA_Font::GetFontSize() { | 63 FX_FLOAT CXFA_Font::GetFontSize() { |
| 64 CXFA_Measurement ms; | 64 CXFA_Measurement ms; |
| 65 m_pNode->TryMeasure(XFA_ATTRIBUTE_Size, ms); | 65 m_pNode->TryMeasure(XFA_ATTRIBUTE_Size, ms); |
| 66 return ms.ToUnit(XFA_UNIT_Pt); | 66 return ms.ToUnit(XFA_UNIT_Pt); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void CXFA_Font::GetTypeface(CFX_WideStringC& wsTypeFace) { | 69 void CXFA_Font::GetTypeface(CFX_WideStringC& wsTypeFace) { |
| 70 m_pNode->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace); | 70 m_pNode->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace); |
| 71 } | 71 } |
| 72 | 72 |
| 73 FX_BOOL CXFA_Font::IsBold() { | 73 bool CXFA_Font::IsBold() { |
| 74 XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal; | 74 XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal; |
| 75 m_pNode->TryEnum(XFA_ATTRIBUTE_Weight, eAttr); | 75 m_pNode->TryEnum(XFA_ATTRIBUTE_Weight, eAttr); |
| 76 return eAttr == XFA_ATTRIBUTEENUM_Bold; | 76 return eAttr == XFA_ATTRIBUTEENUM_Bold; |
| 77 } | 77 } |
| 78 | 78 |
| 79 FX_BOOL CXFA_Font::IsItalic() { | 79 bool CXFA_Font::IsItalic() { |
| 80 XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal; | 80 XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_Normal; |
| 81 m_pNode->TryEnum(XFA_ATTRIBUTE_Posture, eAttr); | 81 m_pNode->TryEnum(XFA_ATTRIBUTE_Posture, eAttr); |
| 82 return eAttr == XFA_ATTRIBUTEENUM_Italic; | 82 return eAttr == XFA_ATTRIBUTEENUM_Italic; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void CXFA_Font::SetColor(FX_ARGB color) { | 85 void CXFA_Font::SetColor(FX_ARGB color) { |
| 86 CXFA_Fill fill(m_pNode->GetProperty(0, XFA_Element::Fill)); | 86 CXFA_Fill fill(m_pNode->GetProperty(0, XFA_Element::Fill)); |
| 87 fill.SetColor(color); | 87 fill.SetColor(color); |
| 88 } | 88 } |
| 89 | 89 |
| 90 FX_ARGB CXFA_Font::GetColor() { | 90 FX_ARGB CXFA_Font::GetColor() { |
| 91 CXFA_Fill fill(m_pNode->GetChild(0, XFA_Element::Fill)); | 91 CXFA_Fill fill(m_pNode->GetChild(0, XFA_Element::Fill)); |
| 92 return fill ? fill.GetColor(TRUE) : 0xFF000000; | 92 return fill ? fill.GetColor(true) : 0xFF000000; |
| 93 } | 93 } |
| OLD | NEW |