summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpvt_generateap.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-03-28 20:00:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-28 20:00:35 +0000
commit53a8093c6ef694ec520fe0b087fbac86af97f5e8 (patch)
tree519a805d66eed415e310eb67a05212c6d217025d /core/fpdfdoc/cpvt_generateap.cpp
parent971a674ef17526ad37ce55ba90110830b94889d0 (diff)
downloadpdfium-53a8093c6ef694ec520fe0b087fbac86af97f5e8.tar.xz
Use CPDF_DefaultAppearance instead of custom parsing
This CL moves code over to using CPDF_DefaultAppearance instead of calling the CPDF_SimpleParser directly. This means the code for finding a specific tag start can move into CPDF_DefaultAppearance directly. Change-Id: I1dc64e54aedd03d059b963121d466f3eb75c17db Reviewed-on: https://pdfium-review.googlesource.com/28410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 4138b21a6b..a6a64aaf8d 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -19,11 +19,11 @@
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
-#include "core/fpdfapi/parser/cpdf_simple_parser.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpdf_annot.h"
+#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fpdfdoc/cpdf_formfield.h"
#include "core/fpdfdoc/cpvt_fontmap.h"
#include "core/fpdfdoc/cpvt_word.h"
@@ -922,14 +922,17 @@ void CPVT_GenerateAP::GenerateFormAP(Type type,
if (DA.IsEmpty())
return;
- CPDF_SimpleParser syntax(DA.AsStringView());
- syntax.FindTagParamFromStart("Tf", 2);
- ByteString sFontName(syntax.GetWord());
- sFontName = PDF_NameDecode(sFontName.AsStringView());
+ CPDF_DefaultAppearance appearance(DA);
+ if (!appearance.HasFont())
+ return;
+
+ ASSERT(appearance.HasFont());
+ float fFontSize = 0;
+ ByteString sFontName =
+ PDF_NameDecode(appearance.GetFont(&fFontSize).AsStringView());
if (sFontName.IsEmpty())
return;
- float fFontSize = FX_atof(syntax.GetWord());
CFX_Color crText = CFX_Color::ParseColor(DA);
CPDF_Dictionary* pDRDict = pFormDict->GetDictFor("DR");
if (!pDRDict)