本文整理汇总了C++中CPDF_Font::GetFontDict方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Font::GetFontDict方法的具体用法?C++ CPDF_Font::GetFontDict怎么用?C++ CPDF_Font::GetFontDict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Font
的用法示例。
在下文中一共展示了CPDF_Font::GetFontDict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStandardFont
CPDF_Font* CPDF_DocPageData::GetStandardFont(FX_BSTR fontName, CPDF_FontEncoding* pEncoding)
{
if (fontName.IsEmpty()) {
return NULL;
}
FX_POSITION pos = m_FontMap.GetStartPosition();
while (pos) {
CPDF_Dictionary* fontDict;
CPDF_CountedObject<CPDF_Font*>* fontData;
m_FontMap.GetNextAssoc(pos, fontDict, fontData);
CPDF_Font* pFont = fontData->m_Obj;
if (!pFont) {
continue;
}
if (pFont->GetBaseFont() != fontName) {
continue;
}
if (pFont->IsEmbedded()) {
continue;
}
if (pFont->GetFontType() != PDFFONT_TYPE1) {
continue;
}
if (pFont->GetFontDict()->KeyExist(FX_BSTRC("Widths"))) {
continue;
}
CPDF_Type1Font* pT1Font = pFont->GetType1Font();
if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding)) {
continue;
}
fontData->m_nCount ++;
return pFont;
}
CPDF_Dictionary* pDict = FX_NEW CPDF_Dictionary;
pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Font"));
pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Type1"));
pDict->SetAtName(FX_BSTRC("BaseFont"), fontName);
if (pEncoding) {
pDict->SetAt(FX_BSTRC("Encoding"), pEncoding->Realize());
}
m_pPDFDoc->AddIndirectObject(pDict);
CPDF_CountedObject<CPDF_Font*>* fontData = FX_NEW CPDF_CountedObject<CPDF_Font*>;
if (!fontData) {
return NULL;
}
CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict);
if (!pFont) {
delete fontData;
return NULL;
}
fontData->m_nCount = 2;
fontData->m_Obj = pFont;
m_FontMap.SetAt(pDict, fontData);
return pFont;
}
示例2: GetAnnotSysPDFFont
void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
const CPDF_Dictionary* pResDict,
CPDF_Font*& pSysFont,
CFX_ByteString& sSysFontAlias) {
if (!pDoc || !pResDict)
return;
CFX_ByteString sFontAlias;
CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictBy("AcroForm");
CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias);
if (!pPDFFont)
return;
if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) {
if (!pFontList->KeyExist(sSysFontAlias))
pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict());
}
pSysFont = pPDFFont;
}
示例3: GetStandardFont
CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteStringC& fontName,
CPDF_FontEncoding* pEncoding) {
if (fontName.IsEmpty())
return nullptr;
for (auto& it : m_FontMap) {
CPDF_CountedFont* fontData = it.second;
CPDF_Font* pFont = fontData->get();
if (!pFont)
continue;
if (pFont->GetBaseFont() != fontName)
continue;
if (pFont->IsEmbedded())
continue;
if (!pFont->IsType1Font())
continue;
if (pFont->GetFontDict()->KeyExist("Widths"))
continue;
CPDF_Type1Font* pT1Font = pFont->AsType1Font();
if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding))
continue;
return fontData->AddRef();
}
CPDF_Dictionary* pDict = new CPDF_Dictionary;
pDict->SetAtName("Type", "Font");
pDict->SetAtName("Subtype", "Type1");
pDict->SetAtName("BaseFont", fontName);
if (pEncoding) {
pDict->SetAt("Encoding", pEncoding->Realize());
}
m_pPDFDoc->AddIndirectObject(pDict);
CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict);
if (!pFont) {
return nullptr;
}
CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont);
m_FontMap[pDict] = fontData;
return fontData->AddRef();
}