59bool CPDF_Type3Font::
Load() {
60 m_pFontResources = m_pFontDict->GetMutableDictFor(
"Resources");
61 RetainPtr<
const CPDF_Array> pMatrix = m_pFontDict->GetArrayFor(
"FontMatrix");
65 m_FontMatrix = pMatrix->GetMatrix();
66 xscale = m_FontMatrix
.a;
67 yscale = m_FontMatrix
.d;
70 RetainPtr<
const CPDF_Array> pBBox = m_pFontDict->GetArrayFor(
"FontBBox");
73 pBBox->GetFloatAt(0) * xscale, pBBox->GetFloatAt(1) * yscale,
74 pBBox->GetFloatAt(2) * xscale, pBBox->GetFloatAt(3) * yscale);
79 static constexpr size_t kCharLimit = std::extent<
decltype(m_CharWidthL)>();
80 int StartChar = m_pFontDict->GetIntegerFor(
"FirstChar");
81 if (StartChar >= 0 &&
static_cast<size_t>(StartChar) < kCharLimit) {
83 m_pFontDict->GetArrayFor(
"Widths");
85 size_t count = std::min(pWidthArray->size(), kCharLimit);
86 count =
std::min(count, kCharLimit - StartChar);
87 for (size_t i = 0; i < count; i++) {
88 m_CharWidthL[StartChar + i] =
90 pWidthArray->GetFloatAt(i) * xscale
));
94 m_pCharProcs = m_pFontDict->GetMutableDictFor(
"CharProcs");
95 if (m_pFontDict->GetDirectObjectFor(
"Encoding"))
107 if (m_CharLoadingDepth >= kMaxType3FormLevel)
110 auto it = m_CacheMap.find(charcode);
111 if (it != m_CacheMap.end())
112 return it->second.get();
114 const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
122 ToStream(m_pCharProcs->GetMutableDirectObjectFor(name));
126 std::unique_ptr<CPDF_Font::FormIface> pForm = m_pFormFactory->CreateForm(
127 m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources,
137 m_CharLoadingDepth++;
138 pForm->ParseContentForType3Char(pNewChar.get());
140 it = m_CacheMap.find(charcode);
141 if (it != m_CacheMap.end())
142 return it->second.get();
144 pNewChar->Transform(pForm.get(), m_FontMatrix);
145 if (pForm->HasPageObjects())
146 pNewChar->SetForm(
std::move(pForm));
149 m_CacheMap[charcode] = std::move(pNewChar);