From e83a915ebd3afaa897dbbf3e6cb3d2a2cb198595 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 16:53:33 -0500 Subject: Fold CXFA_FontData into CXFA_Font This CL removes the CXFA_FontData wrapper and puts the functionality into CXFA_Font. Change-Id: Id7e3a71106816a05843a62645f5955a70f7eaeaa Reviewed-on: https://pdfium-review.googlesource.com/22113 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_widgetacc.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'xfa/fxfa/cxfa_widgetacc.cpp') diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index b9d89cdfd5..a811d37fa4 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -23,6 +23,7 @@ #include "xfa/fxfa/cxfa_textprovider.h" #include "xfa/fxfa/parser/cxfa_calculate.h" #include "xfa/fxfa/parser/cxfa_caption.h" +#include "xfa/fxfa/parser/cxfa_font.h" #include "xfa/fxfa/parser/cxfa_image.h" #include "xfa/fxfa/parser/cxfa_items.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" @@ -709,13 +710,13 @@ void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) { bVert ? szCap.height = fCapReserve : szCap.width = fCapReserve; } else { float fFontSize = 10.0f; - CXFA_FontData fontData = caption->GetFontData(); - if (fontData.HasValidNode()) { - fFontSize = fontData.GetFontSize(); + CXFA_Font* font = caption->GetFont(); + if (font) { + fFontSize = font->GetFontSize(); } else { - CXFA_FontData widgetfontData = GetFontData(false); - if (widgetfontData.HasValidNode()) - fFontSize = widgetfontData.GetFontSize(); + CXFA_Font* widgetfont = GetFont(false); + if (widgetfont) + fFontSize = widgetfont->GetFontSize(); } if (bVert) { @@ -1483,14 +1484,14 @@ void CXFA_WidgetAcc::SetImageEditImage( RetainPtr CXFA_WidgetAcc::GetFDEFont() { WideString wsFontName = L"Courier"; uint32_t dwFontStyle = 0; - CXFA_FontData fontData = GetFontData(false); - if (fontData.HasValidNode()) { - if (fontData.IsBold()) + CXFA_Font* font = GetFont(false); + if (font) { + if (font->IsBold()) dwFontStyle |= FXFONT_BOLD; - if (fontData.IsItalic()) + if (font->IsItalic()) dwFontStyle |= FXFONT_ITALIC; - wsFontName = fontData.GetTypeface(); + wsFontName = font->GetTypeface(); } auto* pDoc = GetDoc(); @@ -1499,8 +1500,8 @@ RetainPtr CXFA_WidgetAcc::GetFDEFont() { } float CXFA_WidgetAcc::GetFontSize() { - CXFA_FontData fontData = GetFontData(false); - float fFontSize = fontData.HasValidNode() ? fontData.GetFontSize() : 10.0f; + CXFA_Font* font = GetFont(false); + float fFontSize = font ? font->GetFontSize() : 10.0f; return fFontSize < 0.1f ? 10.0f : fFontSize; } @@ -1515,6 +1516,6 @@ float CXFA_WidgetAcc::GetLineHeight() { } FX_ARGB CXFA_WidgetAcc::GetTextColor() { - CXFA_FontData fontData = GetFontData(false); - return fontData.HasValidNode() ? fontData.GetColor() : 0xFF000000; + CXFA_Font* font = GetFont(false); + return font ? font->GetColor() : 0xFF000000; } -- cgit v1.2.3