本文整理汇总了C++中CPDF_Document::LoadFont方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Document::LoadFont方法的具体用法?C++ CPDF_Document::LoadFont怎么用?C++ CPDF_Document::LoadFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Document
的用法示例。
在下文中一共展示了CPDF_Document::LoadFont方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindResFontSameCharset
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CFX_ByteString& sFontAlias,
int32_t nCharset) {
if (!pResDict)
return NULL;
CPDF_Document* pDocument = GetDocument();
ASSERT(pDocument != NULL);
CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
if (pFonts == NULL)
return NULL;
CPDF_Font* pFind = NULL;
FX_POSITION pos = pFonts->GetStartPos();
while (pos) {
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
if (pObj == NULL)
continue;
CPDF_Object* pDirect = pObj->GetDirect();
if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY)
continue;
CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect;
if (pElement->GetString("Type") != "Font")
continue;
CPDF_Font* pFont = pDocument->LoadFont(pElement);
if (pFont == NULL)
continue;
const CFX_SubstFont* pSubst = pFont->GetSubstFont();
if (pSubst == NULL)
continue;
if (pSubst->m_Charset == nCharset) {
sFontAlias = csKey;
pFind = pFont;
}
}
return pFind;
}
示例2: FindResFontSameCharset
CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CFX_ByteString& sFontAlias,
int32_t nCharset) {
if (!pResDict)
return nullptr;
CPDF_Dictionary* pFonts = pResDict->GetDictBy("Font");
if (!pFonts)
return nullptr;
CPDF_Document* pDocument = GetDocument();
CPDF_Font* pFind = nullptr;
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
if (!pObj)
continue;
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
if (pElement->GetStringBy("Type") != "Font")
continue;
CPDF_Font* pFont = pDocument->LoadFont(pElement);
if (!pFont)
continue;
const CFX_SubstFont* pSubst = pFont->GetSubstFont();
if (!pSubst)
continue;
if (pSubst->m_Charset == nCharset) {
sFontAlias = csKey;
pFind = pFont;
}
}
return pFind;
}