diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-03-28 20:00:35 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-28 20:00:35 +0000 |
commit | 53a8093c6ef694ec520fe0b087fbac86af97f5e8 (patch) | |
tree | 519a805d66eed415e310eb67a05212c6d217025d /fpdfsdk/formfiller/cba_fontmap.cpp | |
parent | 971a674ef17526ad37ce55ba90110830b94889d0 (diff) | |
download | pdfium-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 'fpdfsdk/formfiller/cba_fontmap.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cba_fontmap.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 8e4ac469a5..b7e14b4636 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -12,9 +12,9 @@ #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/parser/cpdf_document.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/fpdf_parser_decode.h" +#include "core/fpdfdoc/cpdf_defaultappearance.h" #include "core/fpdfdoc/cpdf_formfield.h" #include "core/fxge/cfx_substfont.h" #include "fpdfsdk/cpdfsdk_annot.h" @@ -216,10 +216,12 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(ByteString* sAlias) { if (sDA.IsEmpty()) return nullptr; - CPDF_SimpleParser syntax(sDA.AsStringView()); - syntax.FindTagParamFromStart("Tf", 2); + CPDF_DefaultAppearance appearance(sDA); + ASSERT(appearance.HasFont()); - ByteString sDecodedFontName = PDF_NameDecode(syntax.GetWord()); + float font_size; + ByteString sDecodedFontName = + PDF_NameDecode(appearance.GetFont(&font_size).AsStringView()); *sAlias = sDecodedFontName.Right(sDecodedFontName.GetLength() - 1); CPDF_Dictionary* pFontDict = nullptr; |