7#include "core/fpdfapi/page/cpdf_docpagedata.h"
15#include "build/build_config.h"
16#include "constants/font_encodings.h"
17#include "core/fpdfapi/font/cpdf_fontglobals.h"
18#include "core/fpdfapi/font/cpdf_type1font.h"
19#include "core/fpdfapi/page/cpdf_form.h"
20#include "core/fpdfapi/page/cpdf_iccprofile.h"
21#include "core/fpdfapi/page/cpdf_image.h"
22#include "core/fpdfapi/page/cpdf_pattern.h"
23#include "core/fpdfapi/page/cpdf_shadingpattern.h"
24#include "core/fpdfapi/page/cpdf_tilingpattern.h"
25#include "core/fpdfapi/parser/cpdf_array.h"
26#include "core/fpdfapi/parser/cpdf_dictionary.h"
27#include "core/fpdfapi/parser/cpdf_name.h"
28#include "core/fpdfapi/parser/cpdf_number.h"
29#include "core/fpdfapi/parser/cpdf_reference.h"
30#include "core/fpdfapi/parser/cpdf_stream.h"
31#include "core/fpdfapi/parser/cpdf_stream_acc.h"
32#include "core/fpdfapi/parser/cpdf_string.h"
33#include "core/fxcodec/icc/icc_transform.h"
34#include "core/fxcrt/fx_codepage.h"
35#include "core/fxcrt/fx_memory.h"
36#include "core/fxcrt/fx_safe_types.h"
37#include "core/fxcrt/scoped_set_insertion.h"
38#include "core/fxge/cfx_font.h"
39#include "core/fxge/cfx_fontmapper.h"
40#include "core/fxge/cfx_substfont.h"
41#include "core/fxge/cfx_unicodeencoding.h"
42#include "core/fxge/fx_font.h"
43#include "third_party/base/check.h"
44#include "third_party/base/containers/contains.h"
48void InsertWidthArrayImpl(std::vector<
int> widths, CPDF_Array* pWidthArray) {
50 for (i = 1; i < widths.size(); i++) {
51 if (widths[i] != widths[0])
54 if (i == widths.size()) {
55 int first = pWidthArray->GetIntegerAt(pWidthArray->size() - 1);
56 pWidthArray->AppendNew<CPDF_Number>(first +
57 static_cast<
int>(widths.size()) - 1);
58 pWidthArray->AppendNew<CPDF_Number>(widths[0]);
61 auto pWidthArray1 = pWidthArray->AppendNew<CPDF_Array>();
63 pWidthArray1->AppendNew<CPDF_Number>(w);
67void InsertWidthArray(HDC hDC,
int start,
int end, CPDF_Array* pWidthArray) {
68 std::vector<
int> widths(end - start + 1);
69 GetCharWidth(hDC, start, end, widths.data());
70 InsertWidthArrayImpl(std::move(widths), pWidthArray);
73ByteString GetPSNameFromTT(HDC hDC) {
75 DWORD size = ::GetFontData(hDC,
'eman', 0,
nullptr, 0);
76 if (size != GDI_ERROR) {
77 LPBYTE buffer = FX_Alloc(BYTE, size);
78 ::GetFontData(hDC,
'eman', 0, buffer, size);
79 result = GetNameFromTT({buffer, size}, 6);
86void InsertWidthArray1(
CFX_Font* pFont,
90 CPDF_Array* pWidthArray) {
91 std::vector<
int> widths(end - start + 1);
92 for (size_t i = 0; i < widths.size(); ++i) {
96 InsertWidthArrayImpl(
std::move(widths), pWidthArray);
99int CalculateFlags(
bool bold,
123void ProcessNonbCJK(
RetainPtr<CPDF_Dictionary> pBaseDict,
129 basefont
+= ",BoldItalic";
133 basefont
+= ",Italic";
134 pBaseDict->SetNewFor<CPDF_Name>(
"Subtype",
"TrueType");
135 pBaseDict->SetNewFor<CPDF_Name>(
"BaseFont", basefont);
136 pBaseDict->SetNewFor<CPDF_Number>(
"FirstChar", 32);
137 pBaseDict->SetNewFor<CPDF_Number>(
"LastChar", 255);
138 pBaseDict->SetFor(
"Widths", pWidths);
149 auto pFontDesc = pDoc->New<CPDF_Dictionary>();
150 pFontDesc->SetNewFor<CPDF_Name>(
"Type",
"FontDescriptor");
151 pFontDesc->SetNewFor<CPDF_Name>(
"FontName", basefont);
152 pFontDesc->SetNewFor<CPDF_Number>(
"Flags", flags);
153 pFontDesc->SetFor(
"FontBBox", bbox);
154 pFontDesc->SetNewFor<CPDF_Number>(
"ItalicAngle", italicangle);
155 pFontDesc->SetNewFor<CPDF_Number>(
"Ascent", ascend);
156 pFontDesc->SetNewFor<CPDF_Number>(
"Descent", descend);
157 pFontDesc->SetNewFor<CPDF_Number>(
"StemV", stemV);
171 for (
auto& it : m_FontMap) {
173 it.second->WillBeDestroyed();
177CPDF_DocPageData::HashIccProfileKey::HashIccProfileKey(ByteString digest,
179 : digest(std::move(digest)), components(components) {}
181CPDF_DocPageData::HashIccProfileKey::~HashIccProfileKey() =
default;
183bool CPDF_DocPageData::HashIccProfileKey::operator<(
184 const HashIccProfileKey& other)
const {
185 if (components == other.components) {
186 return digest < other.digest;
188 return components < other.components;
200 auto it = m_FontMap.find(pFontDict);
201 if (it != m_FontMap.end() && it->second)
202 return pdfium::WrapRetain(it->second.Get());
205 CPDF_Font::Create(GetDocument(), pFontDict,
this);
209 m_FontMap[std::move(pFontDict)].Reset(pFont.Get());
214 const ByteString& fontName,
219 for (
auto& it : m_FontMap) {
220 CPDF_Font* pFont = it.second.Get();
223 if (pFont->GetBaseFontName() != fontName)
225 if (pFont->IsEmbedded())
227 if (!pFont->IsType1Font())
229 if (pFont->GetFontDict()->KeyExist(
"Widths"))
232 CPDF_Type1Font* pT1Font = pFont->AsType1Font();
233 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding))
236 return pdfium::WrapRetain(pFont);
239 auto pDict =
GetDocument()->NewIndirect<CPDF_Dictionary>();
240 pDict->SetNewFor<CPDF_Name>(
"Type",
"Font");
241 pDict->SetNewFor<CPDF_Name>(
"Subtype",
"Type1");
242 pDict->SetNewFor<CPDF_Name>(
"BaseFont", fontName);
244 pDict->SetFor(
"Encoding",
245 pEncoding->Realize(
GetDocument()->GetByteStringPool()));
253 m_FontMap[std::move(pDict)].Reset(pFont.Get());
259 const CPDF_Dictionary* pResources) {
260 std::set<
const CPDF_Object*> visited;
261 return GetColorSpaceGuarded(pCSObj, pResources, &visited);
266 const CPDF_Dictionary* pResources,
267 std::set<
const CPDF_Object*>* pVisited) {
268 std::set<
const CPDF_Object*> visitedLocal;
269 return GetColorSpaceInternal(pCSObj, pResources, pVisited, &visitedLocal);
274 const CPDF_Dictionary* pResources,
275 std::set<
const CPDF_Object*>* pVisited,
276 std::set<
const CPDF_Object*>* pVisitedInternal) {
280 if (pdfium::Contains(*pVisitedInternal, pCSObj))
288 if (!pCS && pResources) {
290 pResources->GetDictFor(
"ColorSpace");
292 return GetColorSpaceInternal(pList->GetDirectObjectFor(name).Get(),
293 nullptr, pVisited, pVisitedInternal);
296 if (!pCS || !pResources)
299 RetainPtr<
const CPDF_Dictionary> pColorSpaces =
300 pResources->GetDictFor(
"ColorSpace");
305 switch (pCS->GetFamily()) {
307 pDefaultCS = pColorSpaces->GetDirectObjectFor(
"DefaultRGB");
310 pDefaultCS = pColorSpaces->GetDirectObjectFor(
"DefaultGray");
313 pDefaultCS = pColorSpaces->GetDirectObjectFor(
"DefaultCMYK");
321 return GetColorSpaceInternal(pDefaultCS.Get(),
nullptr, pVisited,
325 RetainPtr<
const CPDF_Array> pArray(pCSObj->AsArray());
326 if (!pArray || pArray->IsEmpty())
329 if (pArray->size() == 1) {
330 return GetColorSpaceInternal(pArray->GetDirectObjectAt(0).Get(), pResources,
331 pVisited, pVisitedInternal);
334 auto it = m_ColorSpaceMap.find(pArray);
335 if (it != m_ColorSpaceMap.end() && it->second)
336 return pdfium::WrapRetain(it->second.Get());
339 CPDF_ColorSpace::Load(GetDocument(), pArray.Get(), pVisited);
343 m_ColorSpaceMap[std::move(pArray)].Reset(pCS.Get());
353 auto it = m_PatternMap.find(pPatternObj);
354 if (it != m_PatternMap.end() && it->second)
355 return pdfium::WrapRetain(it->second.Get());
357 RetainPtr<
const CPDF_Dictionary> pDict = pPatternObj->GetDict();
362 int type = pDict->GetIntegerFor(
"PatternType");
364 pPattern = pdfium::MakeRetain<CPDF_TilingPattern>(
GetDocument(),
365 pPatternObj, matrix);
367 pPattern = pdfium::MakeRetain<CPDF_ShadingPattern>(
372 m_PatternMap[pPatternObj].Reset(pPattern.Get());
382 auto it = m_PatternMap.find(pPatternObj);
383 if (it != m_PatternMap.end() && it->second)
384 return pdfium::WrapRetain(it->second->AsShadingPattern());
386 auto pPattern = pdfium::MakeRetain<CPDF_ShadingPattern>(
388 m_PatternMap[pPatternObj].Reset(pPattern.Get());
393 DCHECK(dwStreamObjNum);
394 auto it = m_ImageMap.find(dwStreamObjNum);
395 if (it != m_ImageMap.end())
398 auto pImage = pdfium::MakeRetain<CPDF_Image>(
GetDocument(), dwStreamObjNum);
399 m_ImageMap[dwStreamObjNum] = pImage;
404 DCHECK(dwStreamObjNum);
405 auto it = m_ImageMap.find(dwStreamObjNum);
406 if (it != m_ImageMap.end() && it->second->HasOneRef())
407 m_ImageMap.erase(it);
411 RetainPtr<
const CPDF_Stream> pProfileStream) {
412 CHECK(pProfileStream);
414 auto it = m_IccProfileMap.find(pProfileStream);
415 if (it != m_IccProfileMap.end() && it->second)
416 return pdfium::WrapRetain(it->second.Get());
418 auto pAccessor = pdfium::MakeRetain<CPDF_StreamAcc>(pProfileStream);
419 pAccessor->LoadAllDataFiltered();
422 const int expected_components = pProfileStream->GetDict()->GetIntegerFor(
"N");
428 const HashIccProfileKey hash_profile_key(pAccessor->ComputeDigest(),
429 expected_components);
430 auto hash_it = m_HashIccProfileMap.find(hash_profile_key);
431 if (hash_it != m_HashIccProfileMap.end()) {
432 auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
433 if (it_copied_stream != m_IccProfileMap.end() && it_copied_stream->second)
434 return pdfium::WrapRetain(it_copied_stream->second.Get());
436 auto pProfile = pdfium::MakeRetain<CPDF_IccProfile>(
437 pProfileStream, pAccessor->GetSpan(), expected_components);
438 m_IccProfileMap[pProfileStream].Reset(pProfile.Get());
439 m_HashIccProfileMap[hash_profile_key] = std::move(pProfileStream);
444 RetainPtr<
const CPDF_Stream> pFontStream) {
446 auto it = m_FontFileMap.find(pFontStream);
447 if (it != m_FontFileMap.end())
450 RetainPtr<
const CPDF_Dictionary> pFontDict = pFontStream->GetDict();
451 int32_t len1 = pFontDict->GetIntegerFor(
"Length1");
452 int32_t len2 = pFontDict->GetIntegerFor(
"Length2");
453 int32_t len3 = pFontDict->GetIntegerFor(
"Length3");
454 uint32_t org_size = 0;
455 if (len1 >= 0 && len2 >= 0 && len3 >= 0) {
456 FX_SAFE_UINT32 safe_org_size = len1;
457 safe_org_size += len2;
458 safe_org_size += len3;
459 org_size = safe_org_size.ValueOrDefault(0);
462 auto pFontAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pFontStream);
463 pFontAcc->LoadAllDataFilteredWithEstimatedSize(org_size);
464 m_FontFileMap[std::move(pFontStream)] = pFontAcc;
469 RetainPtr<CPDF_StreamAcc>&& pStreamAcc) {
473 RetainPtr<
const CPDF_Stream> pFontStream = pStreamAcc->GetStream();
478 auto it = m_FontFileMap.find(std::move(pFontStream));
479 if (it != m_FontFileMap.end() && it->second->HasOneRef())
480 m_FontFileMap.erase(it);
485 RetainPtr<CPDF_Dictionary> pPageResources,
487 return std::make_unique<CPDF_Form>(pDocument,
std::move(pPageResources),
488 std::move(pFormStream));
492 const ByteString& fontName,
494 ByteString mutable_name
(fontName
);
495 absl::optional<CFX_FontMapper::StandardFont> font_id =
496 CFX_FontMapper::GetStandardFontName(&mutable_name);
497 if (!font_id.has_value())
499 return GetStandardFont(mutable_name, pEncoding);
508 ByteString basefont = pFont->GetFamilyName();
509 basefont.Replace(
" ",
"");
511 CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(),
514 auto pBaseDict =
GetDocument()->NewIndirect<CPDF_Dictionary>();
515 pBaseDict->SetNewFor<CPDF_Name>(
"Type",
"Font");
518 RetainPtr<CPDF_Dictionary> pFontDict = pBaseDict;
520 auto pWidths = pdfium::MakeRetain<CPDF_Array>();
521 for (
int charcode = 32; charcode < 128; charcode++) {
522 int glyph_index = pEncoding->GlyphFromCharCode(charcode);
523 int char_width = pFont->GetGlyphWidth(glyph_index);
524 pWidths->AppendNew<CPDF_Number>(char_width);
528 pBaseDict->SetNewFor<CPDF_Name>(
"Encoding",
530 for (
int charcode = 128; charcode <= 255; charcode++) {
531 int glyph_index = pEncoding->GlyphFromCharCode(charcode);
532 int char_width = pFont->GetGlyphWidth(glyph_index);
533 pWidths->AppendNew<CPDF_Number>(char_width);
536 size_t i = CalculateEncodingDict(charset, pBaseDict.Get());
539 for (
int j = 0; j < 128; j++) {
540 int glyph_index = pEncoding->GlyphFromCharCode(pUnicodes[j]);
541 int char_width = pFont->GetGlyphWidth(glyph_index);
542 pWidths->AppendNew<CPDF_Number>(char_width);
546 ProcessNonbCJK(pBaseDict, pFont->IsBold(), pFont->IsItalic(), basefont,
549 pFontDict = ProcessbCJK(
550 pBaseDict, charset, basefont,
551 [&pFont, &pEncoding](
wchar_t start,
wchar_t end, CPDF_Array* widthArr) {
552 InsertWidthArray1(pFont.get(), pEncoding.get(), start, end, widthArr);
555 int italicangle = pFont->GetSubstFontItalicAngle();
557 auto pBBox = pdfium::MakeRetain<CPDF_Array>();
558 pBBox->AppendNew<CPDF_Number>(bbox
.left);
559 pBBox->AppendNew<CPDF_Number>(bbox
.bottom);
560 pBBox->AppendNew<CPDF_Number>(bbox
.right);
561 pBBox->AppendNew<CPDF_Number>(bbox
.top);
563 if (pFont->GetSubstFont()) {
564 nStemV = pFont->GetSubstFont()->m_Weight / 5;
566 static const char stem_chars[] = {
'i',
'I',
'!',
'1'};
567 const size_t count = std::size(stem_chars);
568 uint32_t glyph = pEncoding->GlyphFromCharCode(stem_chars[0]);
569 nStemV = pFont->GetGlyphWidth(glyph);
570 for (size_t i = 1; i < count; i++) {
571 glyph = pEncoding->GlyphFromCharCode(stem_chars[i]);
572 int width = pFont->GetGlyphWidth(glyph);
573 if (width > 0 && width < nStemV)
577 RetainPtr<CPDF_Dictionary> pFontDesc = CalculateFontDesc(
578 GetDocument(), basefont, flags, italicangle, pFont->GetAscent(),
579 pFont->GetDescent(), std::move(pBBox), nStemV);
580 uint32_t new_objnum =
GetDocument()->AddIndirectObject(
std::move(pFontDesc));
581 pFontDict->SetNewFor<CPDF_Reference>(
"FontDescriptor",
GetDocument(),
583 return GetFont(pBaseDict);
587RetainPtr<CPDF_Font> CPDF_DocPageData::AddWindowsFont(LOGFONTA* pLogFont) {
588 pLogFont->lfHeight = -1000;
589 pLogFont->lfWidth = 0;
590 HGDIOBJ hFont = CreateFontIndirectA(pLogFont);
591 HDC hDC = CreateCompatibleDC(
nullptr);
592 hFont = SelectObject(hDC, hFont);
593 int tm_size = GetOutlineTextMetrics(hDC, 0,
nullptr);
595 hFont = SelectObject(hDC, hFont);
601 LPBYTE tm_buf = FX_Alloc(BYTE, tm_size);
602 OUTLINETEXTMETRIC* ptm =
reinterpret_cast<OUTLINETEXTMETRIC*>(tm_buf);
603 GetOutlineTextMetrics(hDC, tm_size, ptm);
604 int flags = CalculateFlags(
605 false, pLogFont->lfItalic != 0,
606 (pLogFont->lfPitchAndFamily & 3) == FIXED_PITCH,
607 (pLogFont->lfPitchAndFamily & 0xf8) == FF_ROMAN,
608 (pLogFont->lfPitchAndFamily & 0xf8) == FF_SCRIPT,
609 pLogFont->lfCharSet ==
static_cast<
int>(FX_Charset::kSymbol));
611 const FX_Charset eCharset = FX_GetCharsetFromInt(pLogFont->lfCharSet);
612 const bool bCJK = FX_CharSetIsCJK(eCharset);
615 basefont = GetPSNameFromTT(hDC);
617 if (basefont.IsEmpty())
618 basefont = pLogFont->lfFaceName;
620 int italicangle = ptm->otmItalicAngle / 10;
621 int ascend = ptm->otmrcFontBox.top;
622 int descend = ptm->otmrcFontBox.bottom;
623 int capheight = ptm->otmsCapEmHeight;
624 int bbox[4] = {ptm->otmrcFontBox.left, ptm->otmrcFontBox.bottom,
625 ptm->otmrcFontBox.right, ptm->otmrcFontBox.top};
627 basefont.Replace(
" ",
"");
628 auto pBaseDict = GetDocument()->NewIndirect<CPDF_Dictionary>();
629 pBaseDict->SetNewFor<CPDF_Name>(
"Type",
"Font");
630 RetainPtr<CPDF_Dictionary> pFontDict = pBaseDict;
632 if (eCharset == FX_Charset::kANSI || eCharset == FX_Charset::kDefault ||
633 eCharset == FX_Charset::kSymbol) {
634 pBaseDict->SetNewFor<CPDF_Name>(
"Encoding",
635 pdfium::font_encodings::kWinAnsiEncoding);
637 CalculateEncodingDict(eCharset, pBaseDict.Get());
639 int char_widths[224];
640 GetCharWidth(hDC, 32, 255, char_widths);
641 auto pWidths = pdfium::MakeRetain<CPDF_Array>();
642 for (size_t i = 0; i < 224; i++)
643 pWidths->AppendNew<CPDF_Number>(char_widths[i]);
644 ProcessNonbCJK(pBaseDict, pLogFont->lfWeight > FW_MEDIUM,
645 pLogFont->lfItalic != 0, basefont, std::move(pWidths));
648 ProcessbCJK(pBaseDict, eCharset, basefont,
649 [&hDC](
wchar_t start,
wchar_t end, CPDF_Array* widthArr) {
650 InsertWidthArray(hDC, start, end, widthArr);
653 auto pBBox = pdfium::MakeRetain<CPDF_Array>();
654 for (
int i = 0; i < 4; i++)
655 pBBox->AppendNew<CPDF_Number>(bbox[i]);
656 RetainPtr<CPDF_Dictionary> pFontDesc =
657 CalculateFontDesc(GetDocument(), basefont, flags, italicangle, ascend,
658 descend, std::move(pBBox), pLogFont->lfWeight / 5);
659 pFontDesc->SetNewFor<CPDF_Number>(
"CapHeight", capheight);
660 GetDocument()->AddIndirectObject(pFontDesc);
661 pFontDict->SetFor(
"FontDescriptor", pFontDesc->MakeReference(GetDocument()));
662 hFont = SelectObject(hDC, hFont);
665 return GetFont(std::move(pBaseDict));
669size_t CPDF_DocPageData::CalculateEncodingDict(
FX_Charset charset,
670 CPDF_Dictionary* pBaseDict) {
679 auto pEncodingDict =
GetDocument()->NewIndirect<CPDF_Dictionary>();
680 pEncodingDict->SetNewFor<CPDF_Name>(
"BaseEncoding",
683 auto pArray = pEncodingDict->SetNewFor<CPDF_Array>(
"Differences");
684 pArray->AppendNew<CPDF_Number>(128);
687 for (
int j = 0; j < 128; j++) {
689 pArray->AppendNew<CPDF_Name>(name
.IsEmpty() ?
".notdef" : name);
691 pBaseDict->SetNewFor<CPDF_Reference>(
"Encoding",
GetDocument(),
692 pEncodingDict->GetObjNum());
696RetainPtr<CPDF_Dictionary> CPDF_DocPageData::ProcessbCJK(
700 std::function<
void(
wchar_t,
wchar_t, CPDF_Array*)> Insert) {
701 auto pFontDict =
GetDocument()->NewIndirect<CPDF_Dictionary>();
705 auto pWidthArray = pFontDict->SetNewFor<CPDF_Array>(
"W");
708 cmap
= "ETenms-B5-H";
711 pWidthArray->AppendNew<CPDF_Number>(1);
712 Insert(0x20, 0x7e, pWidthArray.Get());
718 pWidthArray->AppendNew<CPDF_Number>(7716);
719 Insert(0x20, 0x20, pWidthArray.Get());
720 pWidthArray->AppendNew<CPDF_Number>(814);
721 Insert(0x21, 0x7e, pWidthArray.Get());
724 cmap
= "KSCms-UHC-H";
727 pWidthArray->AppendNew<CPDF_Number>(1);
728 Insert(0x20, 0x7e, pWidthArray.Get());
731 cmap
= "90ms-RKSJ-H";
734 pWidthArray->AppendNew<CPDF_Number>(231);
735 Insert(0x20, 0x7d, pWidthArray.Get());
736 pWidthArray->AppendNew<CPDF_Number>(326);
737 Insert(0xa0, 0xa0, pWidthArray.Get());
738 pWidthArray->AppendNew<CPDF_Number>(327);
739 Insert(0xa1, 0xdf, pWidthArray.Get());
740 pWidthArray->AppendNew<CPDF_Number>(631);
741 Insert(0x7e, 0x7e, pWidthArray.Get());
746 pBaseDict->SetNewFor<CPDF_Name>(
"Subtype",
"Type0");
747 pBaseDict->SetNewFor<CPDF_Name>(
"BaseFont", basefont);
748 pBaseDict->SetNewFor<CPDF_Name>(
"Encoding", cmap);
749 pFontDict->SetNewFor<CPDF_Name>(
"Type",
"Font");
750 pFontDict->SetNewFor<CPDF_Name>(
"Subtype",
"CIDFontType2");
751 pFontDict->SetNewFor<CPDF_Name>(
"BaseFont", basefont);
753 auto pCIDSysInfo = pFontDict->SetNewFor<CPDF_Dictionary>(
"CIDSystemInfo");
754 pCIDSysInfo->SetNewFor<CPDF_String>(
"Registry",
"Adobe",
false);
755 pCIDSysInfo->SetNewFor<CPDF_String>(
"Ordering", ordering,
false);
756 pCIDSysInfo->SetNewFor<CPDF_Number>(
"Supplement", supplement);
758 auto pArray = pBaseDict->SetNewFor<CPDF_Array>(
"DescendantFonts");
759 pArray->AppendNew<CPDF_Reference>(
GetDocument(), pFontDict->GetObjNum());
int GetGlyphWidth(uint32_t glyph_index) const
virtual uint32_t GlyphFromCharCode(uint32_t charcode)
void MaybePurgeFontFileStreamAcc(RetainPtr< CPDF_StreamAcc > &&pStreamAcc) override
RetainPtr< CPDF_ColorSpace > GetColorSpace(const CPDF_Object *pCSObj, const CPDF_Dictionary *pResources)
void ClearStockFont() override
RetainPtr< CPDF_IccProfile > GetIccProfile(RetainPtr< const CPDF_Stream > pProfileStream)
RetainPtr< CPDF_Pattern > GetPattern(RetainPtr< CPDF_Object > pPatternObj, const CFX_Matrix &matrix)
std::unique_ptr< CPDF_Font::FormIface > CreateForm(CPDF_Document *pDocument, RetainPtr< CPDF_Dictionary > pPageResources, RetainPtr< CPDF_Stream > pFormStream) override
RetainPtr< CPDF_Font > AddFont(std::unique_ptr< CFX_Font > pFont, FX_Charset charset)
RetainPtr< CPDF_Font > GetStandardFont(const ByteString &fontName, const CPDF_FontEncoding *pEncoding)
RetainPtr< CPDF_Font > GetFont(RetainPtr< CPDF_Dictionary > pFontDict)
RetainPtr< CPDF_ShadingPattern > GetShading(RetainPtr< CPDF_Object > pPatternObj, const CFX_Matrix &matrix)
void MaybePurgeImage(uint32_t dwStreamObjNum) override
RetainPtr< CPDF_Image > GetImage(uint32_t dwStreamObjNum)
~CPDF_DocPageData() override
RetainPtr< CPDF_ColorSpace > GetColorSpaceGuarded(const CPDF_Object *pCSObj, const CPDF_Dictionary *pResources, std::set< const CPDF_Object * > *pVisited)
RetainPtr< CPDF_StreamAcc > GetFontFileStreamAcc(RetainPtr< const CPDF_Stream > pFontStream) override
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)
RetainPtr< CPDF_Font > AddStandardFont(const ByteString &fontName, const CPDF_FontEncoding *pEncoding)
CPDF_Document * GetDocument() const
PageDataIface * GetPageData() const
static CPDF_FontGlobals * GetInstance()
void Clear(CPDF_Document *pDoc)
virtual ByteString GetString() const
ByteString(const ByteString &other)
ByteString & operator+=(const char *str)
ByteString & operator=(const char *str)
const FX_CharsetUnicodes kFX_CharsetUnicodes[8]
bool FX_CharSetIsCJK(FX_Charset uCharset)
#define FXFONT_NONSYMBOLIC
#define FXFONT_FORCE_BOLD
ByteString AdobeNameFromUnicode(wchar_t unicode)
#define FXFONT_FIXED_PITCH
const char kWinAnsiEncoding[]
constexpr FX_RECT()=default