11#include "core/fpdfapi/font/cpdf_cidfont.h"
12#include "core/fpdfapi/font/cpdf_font.h"
13#include "core/fpdfapi/page/cpdf_docpagedata.h"
14#include "core/fpdfapi/page/cpdf_textobject.h"
15#include "core/fpdfapi/page/cpdf_textstate.h"
16#include "core/fpdfapi/parser/cpdf_array.h"
17#include "core/fpdfapi/parser/cpdf_dictionary.h"
18#include "core/fpdfapi/parser/cpdf_document.h"
19#include "core/fpdfapi/parser/cpdf_name.h"
20#include "core/fpdfapi/parser/cpdf_number.h"
21#include "core/fpdfapi/parser/cpdf_reference.h"
22#include "core/fpdfapi/parser/cpdf_stream.h"
23#include "core/fpdfapi/parser/cpdf_string.h"
24#include "core/fpdfapi/render/charposlist.h"
25#include "core/fpdfapi/render/cpdf_pagerendercontext.h"
26#include "core/fpdfapi/render/cpdf_rendercontext.h"
27#include "core/fpdfapi/render/cpdf_renderstatus.h"
28#include "core/fpdfapi/render/cpdf_textrenderer.h"
29#include "core/fpdftext/cpdf_textpage.h"
30#include "core/fxcrt/check.h"
31#include "core/fxcrt/check_op.h"
32#include "core/fxcrt/compiler_specific.h"
33#include "core/fxcrt/containers/contains.h"
34#include "core/fxcrt/fx_extension.h"
35#include "core/fxcrt/fx_memcpy_wrappers.h"
36#include "core/fxcrt/fx_string_wrappers.h"
37#include "core/fxcrt/numerics/safe_conversions.h"
38#include "core/fxcrt/span_util.h"
39#include "core/fxcrt/stl_util.h"
40#include "core/fxcrt/utf16.h"
41#include "core/fxge/cfx_defaultrenderdevice.h"
42#include "core/fxge/cfx_fontmgr.h"
43#include "core/fxge/dib/cfx_dibitmap.h"
44#include "core/fxge/fx_font.h"
45#include "core/fxge/text_char_pos.h"
46#include "fpdfsdk/cpdfsdk_helpers.h"
47#include "public/fpdf_edit.h"
51 FPDF_TEXTRENDERMODE_UNKNOWN,
52 "TextRenderingMode::MODE_UNKNOWN value mismatch");
54 FPDF_TEXTRENDERMODE_FILL,
55 "TextRenderingMode::MODE_FILL value mismatch");
57 FPDF_TEXTRENDERMODE_STROKE,
58 "TextRenderingMode::MODE_STROKE value mismatch");
60 FPDF_TEXTRENDERMODE_FILL_STROKE,
61 "TextRenderingMode::MODE_FILL_STROKE value mismatch");
63 FPDF_TEXTRENDERMODE_INVISIBLE,
64 "TextRenderingMode::MODE_INVISIBLE value mismatch");
66 FPDF_TEXTRENDERMODE_FILL_CLIP,
67 "TextRenderingMode::MODE_FILL_CLIP value mismatch");
69 FPDF_TEXTRENDERMODE_STROKE_CLIP,
70 "TextRenderingMode::MODE_STROKE_CLIP value mismatch");
72 FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP,
73 "TextRenderingMode::MODE_FILL_STROKE_CLIP value mismatch");
75 FPDF_TEXTRENDERMODE_CLIP,
76 "TextRenderingMode::MODE_CLIP value mismatch");
78 FPDF_TEXTRENDERMODE_LAST,
79 "TextRenderingMode::MODE_LAST value mismatch");
94 font_dict->SetNewFor<CPDF_Name>(
"Type",
"Font");
95 font_dict->SetNewFor<CPDF_Name>(
"Subtype",
"Type0");
98 font_dict->SetNewFor<CPDF_Name>(
"Encoding", encoding);
99 font_dict->SetNewFor<CPDF_Name>(
108 cid_font_dict->SetNewFor<CPDF_Name>(
"Type",
"Font");
109 cid_font_dict->SetNewFor<CPDF_Name>(
"Subtype", font_type ==
FPDF_FONT_TYPE1
112 cid_font_dict->SetNewFor<CPDF_Name>(
"BaseFont", name);
117 cid_system_info_dict->SetNewFor<CPDF_String>(
"Registry",
"Adobe");
118 cid_system_info_dict->SetNewFor<CPDF_String>(
"Ordering",
"Identity");
119 cid_system_info_dict->SetNewFor<CPDF_Number>(
"Supplement", 0);
120 cid_font_dict->SetNewFor<CPDF_Reference>(
"CIDSystemInfo", doc,
121 cid_system_info_dict->GetObjNum());
122 return cid_font_dict;
128 pdfium::span<
const uint8_t> font_data,
131 font_descriptor_dict->SetNewFor<CPDF_Name>(
"Type",
"FontDescriptor");
132 font_descriptor_dict->SetNewFor<CPDF_Name>(
"FontName", font_name);
134 if (font->GetFace()->IsFixedWidth()) {
137 if (font_name.Contains(
"Serif"))
139 if (font->GetFace()->IsItalic()) {
142 if (font->GetFace()->IsBold()) {
149 font_descriptor_dict->SetNewFor<CPDF_Number>(
"Flags", flags);
154 font_descriptor_dict->SetNewFor<CPDF_Number>(
"ItalicAngle",
157 font_descriptor_dict->SetNewFor<CPDF_Number>(
"Ascent", font
->GetAscent());
158 font_descriptor_dict->SetNewFor<CPDF_Number>(
"Descent", font
->GetDescent());
161 font_descriptor_dict->SetNewFor<CPDF_Number>(
"CapHeight", font
->GetAscent());
162 font_descriptor_dict->SetNewFor<CPDF_Number>(
"StemV",
165 auto stream = doc->NewIndirect<CPDF_Stream>(font_data);
168 stream->GetMutableDict()->SetNewFor<CPDF_Number>(
169 "Length1",
pdfium::checked_cast<
int>(font_data.size()));
173 font_descriptor_dict->SetNewFor<CPDF_Reference>(font_file_key, doc,
174 stream->GetObjNum());
175 return font_descriptor_dict;
180 const std::map<uint32_t, uint32_t>& widths) {
181 auto widths_array = doc->NewIndirect<
CPDF_Array>();
182 for (
auto it = widths.begin(); it != widths.end(); ++it) {
185 if (
std::next(it) == widths.end()) {
188 single_w_array->AppendNew<CPDF_Number>(w);
189 widths_array->AppendNew<CPDF_Number>(ch);
190 widths_array->Append(
std::move(single_w_array));
194 int next_ch = it->first;
195 int next_w = it->second;
196 if (next_ch == ch + 1 && next_w == w) {
199 widths_array->AppendNew<CPDF_Number>(ch);
202 auto next_it =
std::next(it);
203 if (next_it == widths.end() || next_it->first != it->first + 1 ||
204 next_it->second != it->second) {
210 widths_array->AppendNew<CPDF_Number>(ch);
211 widths_array->AppendNew<CPDF_Number>(w);
216 widths_array->AppendNew<CPDF_Number>(ch);
218 current_width_array->AppendNew<CPDF_Number>(w);
219 current_width_array->AppendNew<CPDF_Number>(next_w);
221 auto next_it =
std::next(it);
222 if (next_it == widths.end() || next_it->first != it->first + 1) {
226 current_width_array->AppendNew<CPDF_Number>(
static_cast<
int>(it->second));
228 widths_array->Append(
std::move(current_width_array));
233const char kToUnicodeStart[] =
234 "/CIDInit /ProcSet findresource begin\n"
238 "<</Registry (Adobe)\n"
239 "/Ordering (Identity)\n"
242 "/CMapName /Adobe-Identity-H def\n"
244 "1 begincodespacerange\n"
246 "endcodespacerange\n";
248const char kToUnicodeEnd[] =
250 "CMapName currentdict /CMap defineresource pop\n"
254void AddCharcode(fxcrt::ostringstream& buffer, uint32_t number) {
267void AddUnicode(fxcrt::ostringstream& buffer, uint32_t unicode) {
273 size_t char_count = FXSYS_ToUTF16BE(unicode, ans);
276 auto ans_span =
pdfium::make_span(ans).first(char_count);
277 for (
char c : ans_span) {
286 const std::multimap<uint32_t, uint32_t>& to_unicode) {
288 std::map<uint32_t, uint32_t> char_to_uni;
292 std::map<std::pair<uint32_t, uint32_t>, std::vector<uint32_t>>
298 std::map<std::pair<uint32_t, uint32_t>, uint32_t> map_range;
301 for (
auto it = to_unicode.begin(); it != to_unicode.end(); ++it) {
302 uint32_t first_charcode = it->first;
303 uint32_t first_unicode = it->second;
305 auto next_it =
std::next(it);
306 if (next_it == to_unicode.end() || first_charcode + 1 != next_it->first) {
307 char_to_uni[first_charcode] = first_unicode;
312 uint32_t current_charcode = it->first;
313 uint32_t current_unicode = it->second;
314 if (current_charcode % 256 == 0) {
315 char_to_uni[first_charcode] = first_unicode;
316 char_to_uni[current_charcode] = current_unicode;
319 const size_t max_extra = 255 - (current_charcode % 256);
320 auto next_it =
std::next(it);
321 if (first_unicode + 1 != current_unicode) {
323 std::vector<uint32_t> unicodes = {first_unicode, current_unicode};
324 for (size_t i = 0; i < max_extra; ++i) {
325 if (next_it == to_unicode.end() ||
326 current_charcode + 1 != next_it->first) {
331 unicodes.push_back(it->second);
332 next_it =
std::next(it);
334 CHECK_EQ(it->first - first_charcode + 1, unicodes.size());
335 map_range_vector[
std::make_pair(first_charcode, it->first)] = unicodes;
339 for (size_t i = 0; i < max_extra; ++i) {
340 if (next_it == to_unicode.end() ||
341 current_charcode + 1 != next_it->first ||
342 current_unicode + 1 != next_it->second) {
348 next_it =
std::next(it);
350 map_range[
std::make_pair(first_charcode, current_charcode)] = first_unicode;
353 fxcrt::ostringstream buffer;
354 buffer << kToUnicodeStart;
356 buffer <<
static_cast<uint32_t>(char_to_uni.size()) <<
" beginbfchar\n";
357 for (
const auto& it : char_to_uni) {
358 AddCharcode(buffer, it.first);
360 AddUnicode(buffer, it.second);
363 buffer <<
"endbfchar\n"
364 <<
static_cast<uint32_t>(map_range_vector.size() + map_range.size())
365 <<
" beginbfrange\n";
366 for (
const auto& it : map_range_vector) {
367 const std::pair<uint32_t, uint32_t>& charcode_range = it.first;
368 AddCharcode(buffer, charcode_range.first);
370 AddCharcode(buffer, charcode_range.second);
372 const std::vector<uint32_t>& unicodes = it.second;
373 for (size_t i = 0; i < unicodes.size(); ++i) {
374 AddUnicode(buffer, unicodes[i]);
375 if (i != unicodes.size() - 1)
380 for (
const auto& it : map_range) {
381 const std::pair<uint32_t, uint32_t>& charcode_range = it.first;
382 AddCharcode(buffer, charcode_range.first);
384 AddCharcode(buffer, charcode_range.second);
386 AddUnicode(buffer, it.second);
389 buffer <<
"endbfrange\n";
390 buffer << kToUnicodeEnd;
391 auto stream = doc->NewIndirect<CPDF_Stream>(&buffer);
397 uint32_t cid_font_dict_obj_num) {
398 auto descendant_fonts_dict =
399 font_dict->SetNewFor<
CPDF_Array>(
"DescendantFonts");
400 descendant_fonts_dict->AppendNew<CPDF_Reference>(doc, cid_font_dict_obj_num);
404 std::unique_ptr<CFX_Font> font,
405 pdfium::span<
const uint8_t> font_data,
408 RetainPtr<CFX_Face> face = font->GetFace();
409 if (face->GetGlyphCount() <= 0) {
414 static constexpr uint32_t kMaxSimpleFontChar = 0xFF;
415 auto char_codes_and_indices =
416 face->GetCharCodesAndIndices(kMaxSimpleFontChar);
417 if (char_codes_and_indices.empty()) {
422 font_dict->SetNewFor<CPDF_Name>(
"Type",
"Font");
423 font_dict->SetNewFor<CPDF_Name>(
425 const ByteString name = BaseFontNameForType(font.get(), font_type);
426 font_dict->SetNewFor<CPDF_Name>(
"BaseFont", name);
428 font_dict->SetNewFor<CPDF_Number>(
429 "FirstChar",
static_cast<
int>(char_codes_and_indices[0].char_code));
430 auto widths_array = doc->NewIndirect<
CPDF_Array>();
431 for (size_t i = 0; i < char_codes_and_indices.size(); ++i) {
432 widths_array->AppendNew<CPDF_Number>(
433 font->GetGlyphWidth(char_codes_and_indices[i].glyph_index));
434 if (i > 0 && i < char_codes_and_indices.size() - 1) {
435 for (uint32_t j = char_codes_and_indices[i - 1].char_code + 1;
436 j < char_codes_and_indices[i].char_code; ++j) {
437 widths_array->AppendNew<CPDF_Number>(0);
441 font_dict->SetNewFor<CPDF_Number>(
442 "LastChar",
static_cast<
int>(char_codes_and_indices.back().char_code));
443 font_dict->SetNewFor<CPDF_Reference>(
"Widths", doc,
444 widths_array->GetObjNum());
446 LoadFontDesc(doc, name, font.get(), font_data, font_type);
448 font_dict->SetNewFor<CPDF_Reference>(
"FontDescriptor", doc,
449 font_descriptor_dict->GetObjNum());
454 std::unique_ptr<CFX_Font> font,
455 pdfium::span<
const uint8_t> font_data,
458 RetainPtr<CFX_Face> face = font->GetFace();
459 if (face->GetGlyphCount() <= 0) {
463 auto char_codes_and_indices =
465 if (char_codes_and_indices.empty()) {
469 const ByteString name = BaseFontNameForType(font.get(), font_type);
471 CreateCompositeFontDict(doc, font.get(), font_type, name);
474 CreateCidFontDict(doc, font_type, name);
477 LoadFontDesc(doc, name, font.get(), font_data, font_type);
478 cid_font_dict->SetNewFor<CPDF_Reference>(
"FontDescriptor", doc,
479 font_descriptor_dict->GetObjNum());
481 std::multimap<uint32_t, uint32_t> to_unicode;
482 std::map<uint32_t, uint32_t> widths;
483 for (
const auto& item : char_codes_and_indices) {
484 if (!pdfium::Contains(widths, item.glyph_index)) {
485 widths[item.glyph_index] = font->GetGlyphWidth(item.glyph_index);
487 to_unicode.emplace(item.glyph_index, item.char_code);
490 cid_font_dict->SetNewFor<CPDF_Reference>(
"W", doc, widths_array->GetObjNum());
494 CreateDescendantFontsArray(doc, font_dict.Get(), cid_font_dict->GetObjNum());
496 RetainPtr<CPDF_Stream> to_unicode_stream = LoadUnicode(doc, to_unicode);
497 font_dict->SetNewFor<CPDF_Reference>(
"ToUnicode", doc,
498 to_unicode_stream->GetObjNum());
504 std::unique_ptr<CFX_Font> font,
505 pdfium::span<
const uint8_t> font_span,
506 const char* to_unicode_cmap,
507 pdfium::span<
const uint8_t> cid_to_gid_map_span) {
509 RetainPtr<CFX_Face> face = font->GetFace();
510 if (face->GetGlyphCount() <= 0) {
514 auto char_codes_and_indices =
516 if (char_codes_and_indices.empty()) {
529 cid_font_dict->SetNewFor<CPDF_Reference>(
"FontDescriptor", doc,
530 font_descriptor->GetObjNum());
532 std::map<uint32_t, uint32_t> widths;
533 for (
const auto& item : char_codes_and_indices) {
534 if (!pdfium::Contains(widths, item.glyph_index)) {
535 widths[item.glyph_index] = font->GetGlyphWidth(item.glyph_index);
539 cid_font_dict->SetNewFor<CPDF_Reference>(
"W", doc, widths_array->GetObjNum());
541 auto cid_to_gid_map = doc->NewIndirect<CPDF_Stream>(cid_to_gid_map_span);
542 cid_font_dict->SetNewFor<CPDF_Reference>(
"CIDToGIDMap", doc,
543 cid_to_gid_map->GetObjNum());
545 CreateDescendantFontsArray(doc, font_dict, cid_font_dict->GetObjNum());
547 auto to_unicode_stream = doc->NewIndirect<CPDF_Stream>(
548 ByteStringView(to_unicode_cmap).unsigned_span());
549 font_dict->SetNewFor<CPDF_Reference>(
"ToUnicode", doc,
550 to_unicode_stream->GetObjNum());
554CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
559FPDF_GLYPHPATH FPDFGlyphPathFromCFXPath(
const CFX_Path* path) {
560 return reinterpret_cast<FPDF_GLYPHPATH>(path);
562const CFX_Path* CFXPathFromFPDFGlyphPath(FPDF_GLYPHPATH path) {
563 return reinterpret_cast<
const CFX_Path*>(path);
570 FPDF_BYTESTRING font,
577 CPDF_Font::GetStockFont(pDoc, ByteStringView(font));
581 auto pTextObj =
std::make_unique<CPDF_TextObject>();
582 pTextObj->mutable_text_state().SetFont(
std::move(pFont));
583 pTextObj->mutable_text_state().SetFontSize(font_size);
584 pTextObj->SetDefaultStates();
587 return FPDFPageObjectFromCPDFPageObject(pTextObj.release());
592 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text_object);
599 for (
wchar_t wc : encodedText) {
600 pTextObj->GetFont()->AppendChar(
601 &byteText, pTextObj->GetFont()->CharCodeFromUnicode(wc));
609 const uint32_t* charcodes,
611 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text_object);
615 if (!charcodes && count)
620 for (size_t i = 0; i < count; ++i) {
621 pTextObj->GetFont()->AppendChar(&byte_text,
UNSAFE_TODO(charcodes[i]));
634 if (!pDoc || !data || size == 0 ||
645 if (!pFont->LoadEmbedded(span,
false, 0))
649 return FPDFFontFromCPDFFont(
650 cid ? LoadCompositeFont(pDoc, std::move(pFont), span, font_type).Leak()
651 : LoadSimpleFont(pDoc, std::move(pFont), span, font_type).Leak());
661 return FPDFFontFromCPDFFont(
667 const uint8_t* font_data,
668 uint32_t font_data_size,
669 FPDF_BYTESTRING to_unicode_cmap,
670 const uint8_t* cid_to_gid_map_data,
671 uint32_t cid_to_gid_map_data_size) {
673 if (!doc || !font_data || font_data_size == 0 || !to_unicode_cmap ||
674 strlen(to_unicode_cmap) == 0 || !cid_to_gid_map_data ||
675 cid_to_gid_map_data_size == 0) {
684 if (!font->LoadEmbedded(font_span,
false,
692 return FPDFFontFromCPDFFont(
693 LoadCustomCompositeFont(
694 doc, std::move(font), font_span, to_unicode_cmap,
696 pdfium::make_span(cid_to_gid_map_data, cid_to_gid_map_data_size)))
705 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
715 FPDF_TEXTPAGE text_page,
717 unsigned long length) {
718 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text_object);
727 return Utf16EncodeMaybeCopyAndReturnLength(
728 pTextPage->GetTextByObject(pTextObj),
735 FPDF_PAGEOBJECT text_object,
745 CPDF_TextObject* text = CPDFTextObjectFromFPDFPageObject(text_object);
763 auto result_bitmap =
pdfium::MakeRetain<CFX_DIBitmap>();
769 auto render_context =
std::make_unique<CPDF_PageRenderContext>();
770 CPDF_PageRenderContext* render_context_ptr = render_context.get();
773 optional_page->SetRenderContext(
std::move(render_context));
776 optional_page ? optional_page->GetMutablePageResources() :
nullptr;
778 auto device =
std::make_unique<CFX_DefaultRenderDevice>();
779 CFX_DefaultRenderDevice* device_ptr = device.get();
780 render_context_ptr->m_pDevice =
std::move(device);
782 doc,
std::move(page_resources),
nullptr);
793 render_matrix
*= scale_matrix;
796 CHECK(!result_bitmap->IsPremultiplied());
799 return FPDFBitmapFromCFXDIBitmap(result_bitmap.Leak());
816 auto pTextObj =
std::make_unique<CPDF_TextObject>();
817 pTextObj->mutable_text_state().SetFont(
819 pFont->GetMutableFontDict()
));
820 pTextObj->mutable_text_state().SetFontSize(font_size);
821 pTextObj->SetDefaultStates();
822 return FPDFPageObjectFromCPDFPageObject(pTextObj.release());
827 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
829 return FPDF_TEXTRENDERMODE_UNKNOWN;
835 FPDF_TEXT_RENDERMODE render_mode) {
836 if (render_mode <= FPDF_TEXTRENDERMODE_UNKNOWN ||
837 render_mode > FPDF_TEXTRENDERMODE_LAST) {
841 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
850 CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
855 return FPDFFontFromCPDFFont(pTextObj
->GetFont());
867 auto result_span =
UNSAFE_BUFFERS(SpanFromFPDFApiArgs(buffer, length));
869 pdfium::span<
const char> name_span = name.span_with_terminator();
870 fxcrt::try_spancpy(result_span, name_span);
871 return name_span.size();
883 auto result_span =
UNSAFE_BUFFERS(SpanFromFPDFApiArgs(buffer, length));
885 pdfium::span<
const char> name_span = name.span_with_terminator();
886 fxcrt::try_spancpy(result_span, name_span);
887 return name_span.size();
893 size_t* out_buflen) {
895 if (!cfont || !out_buflen)
899 auto result_span =
UNSAFE_BUFFERS(SpanFromFPDFApiArgs(buffer, buflen));
900 pdfium::span<
const uint8_t> data = cfont
->GetFont()->GetFontSpan();
901 fxcrt::try_spancpy(result_span, data);
902 *out_buflen = data.size();
930 if (!pFont || !angle)
941 if (!pFont || !ascent)
952 if (!pFont || !descent)
964 if (!pFont || !width)
986 if (!
pdfium::IsValueInRangeForNumericType<
wchar_t>(glyph)) {
991 std::vector<TextCharPos> pos =
992 GetCharPosList(pdfium::span_from_ref(charcode),
993 pdfium::span<
const float>(), pFont, font_size);
998 if (pos[0].m_FallbackFontPosition == -1) {
1010 return FPDFGlyphPathFromCFXPath(pPath);
1015 auto* pPath = CFXPathFromFPDFGlyphPath(glyphpath);
1019 return fxcrt::CollectionSize<
int>(pPath->GetPoints());
1024 auto* pPath = CFXPathFromFPDFGlyphPath(glyphpath);
1028 pdfium::span<
const CFX_Path::Point> points = pPath->GetPoints();
1029 if (!
fxcrt::IndexInBounds(points, index))
1032 return FPDFPathSegmentFromFXPathPoint(&points[index]);
fxcrt::ByteString ByteString
bool Attach(RetainPtr< CFX_DIBitmap > pBitmap)
CFX_FloatRect(const FX_RECT &rect)
FX_RECT GetOuterRect() const
const CFX_Path * LoadGlyphPath(uint32_t glyph_index, int dest_width) const
std::optional< FX_RECT > GetBBox() const
ByteString GetPsName() const
ByteString GetBaseFontName() const
static const char kUntitledFontName[]
ByteString GetFamilyName() const
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
CFX_Matrix & operator*=(const CFX_Matrix &other)
constexpr CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
uint16_t CIDFromCharCode(uint32_t charcode) const
int16_t GetVertWidth(uint16_t cid) const
bool IsVertWriting() const override
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
RetainPtr< CPDF_Font > GetFont(RetainPtr< CPDF_Dictionary > pFontDict)
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)
int GetItalicAngle() const
virtual int GetCharWidthF(uint32_t charcode)=0
int GetTypeDescent() const
virtual CPDF_CIDFont * AsCIDFont()
virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const
static RetainPtr< CPDF_Font > GetStockFont(CPDF_Document *pDoc, ByteStringView fontname)
ByteString GetBaseFontName() const
int GetFontWeight() const
int GetTypeAscent() const
CFX_Font * GetFontFallback(int position)
const CFX_FloatRect & GetRect() const
virtual CPDF_TextObject * AsText()
RenderContextClearer(CPDF_Page *pPage)
CPDF_Document * GetDocument() const override
void SetDeviceMatrix(const CFX_Matrix &matrix)
void RenderSingleObject(CPDF_PageObject *pObj, const CFX_Matrix &mtObj2Device)
void Initialize(const CPDF_RenderStatus *pParentStatus, const CPDF_GraphicStates *pInitialStates)
RetainPtr< CPDF_Font > GetFont() const
void SetText(const ByteString &str)
void SetTextRenderMode(TextRenderingMode mode)
float GetFontSize() const
TextRenderingMode GetTextRenderMode() const
#define UNSAFE_BUFFERS(...)
UNSAFE_BUFFER_USAGE WideString WideStringFromFPDFWideString(FPDF_WIDESTRING wide_string)
CPDF_TextPage * CPDFTextPageFromFPDFTextPage(FPDF_TEXTPAGE page)
CPDF_Font * CPDFFontFromFPDFFont(FPDF_FONT font)
CPDF_Page * CPDFPageFromFPDFPage(FPDF_PAGE page)
CPDF_Document * CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc)
CPDF_PageObject * CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object)
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object, FPDF_TEXTPAGE text_page, FPDF_WCHAR *buffer, unsigned long length)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetGlyphWidth(FPDF_FONT font, uint32_t glyph, float font_size, float *width)
FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetWeight(FPDF_FONT font)
FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetIsEmbedded(FPDF_FONT font)
#define FPDF_FONT_TRUETYPE
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetDescent(FPDF_FONT font, float font_size, float *descent)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFTextObj_SetTextRenderMode(FPDF_PAGEOBJECT text, FPDF_TEXT_RENDERMODE render_mode)
FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadFont(FPDF_DOCUMENT document, const uint8_t *data, uint32_t size, int font_type, FPDF_BOOL cid)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetItalicAngle(FPDF_FONT font, int *angle)
FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetFlags(FPDF_FONT font)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_NewTextObj(FPDF_DOCUMENT document, FPDF_BYTESTRING font, float font_size)
FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadStandardFont(FPDF_DOCUMENT document, FPDF_BYTESTRING font)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document, FPDF_FONT font, float font_size)
FPDF_EXPORT FPDF_TEXT_RENDERMODE FPDF_CALLCONV FPDFTextObj_GetTextRenderMode(FPDF_PAGEOBJECT text)
FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFTextObj_GetFont(FPDF_PAGEOBJECT text)
FPDF_EXPORT FPDF_GLYPHPATH FPDF_CALLCONV FPDFFont_GetGlyphPath(FPDF_FONT font, uint32_t glyph, float font_size)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text)
FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text, float *size)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetAscent(FPDF_FONT font, float font_size, float *ascent)
FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadCidType2Font(FPDF_DOCUMENT document, const uint8_t *font_data, uint32_t font_data_size, FPDF_BYTESTRING to_unicode_cmap, const uint8_t *cid_to_gid_map_data, uint32_t cid_to_gid_map_data_size)
FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV FPDFGlyphPath_GetGlyphPathSegment(FPDF_GLYPHPATH glyphpath, int index)
FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFTextObj_GetRenderedBitmap(FPDF_DOCUMENT document, FPDF_PAGE page, FPDF_PAGEOBJECT text_object, float scale)
FPDF_EXPORT int FPDF_CALLCONV FPDFGlyphPath_CountGlyphSegments(FPDF_GLYPHPATH glyphpath)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetFontData(FPDF_FONT font, uint8_t *buffer, size_t buflen, size_t *out_buflen)
FPDF_EXPORT size_t FPDF_CALLCONV FPDFFont_GetBaseFontName(FPDF_FONT font, char *buffer, size_t length)
FPDF_EXPORT size_t FPDF_CALLCONV FPDFFont_GetFamilyName(FPDF_FONT font, char *buffer, size_t length)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_SetCharcodes(FPDF_PAGEOBJECT text_object, const uint32_t *charcodes, size_t count)
void FXSYS_IntToFourHexChars(uint16_t n, char *buf)
#define FXFONT_NONSYMBOLIC
#define FXFONT_FORCE_BOLD
#define FXFONT_FIXED_PITCH
ByteString operator+(const ByteString &str1, const ByteString &str2)
ByteString operator+(const ByteString &str1, const char *str2)
constexpr char32_t kMaximumSupplementaryCodePoint
constexpr bool IsHighSurrogate(char32_t code_point)
constexpr bool IsLowSurrogate(char32_t code_point)
constexpr FX_RECT()=default
fxcrt::WideString WideString