mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-03-01 01:47:46 +01:00
Better behaviour when font cant be loaded
This commit is contained in:
parent
cd981183b0
commit
1694d310a8
@ -1529,6 +1529,8 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
|
|||||||
if (m_fontDictionary)
|
if (m_fontDictionary)
|
||||||
{
|
{
|
||||||
if (m_fontDictionary->hasKey(fontName.name))
|
if (m_fontDictionary->hasKey(fontName.name))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
PDFFontPointer font = PDFFont::createFont(m_fontDictionary->get(fontName.name), m_document);
|
PDFFontPointer font = PDFFont::createFont(m_fontDictionary->get(fontName.name), m_document);
|
||||||
|
|
||||||
@ -1536,6 +1538,14 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
|
|||||||
m_graphicState.setTextFontSize(fontSize);
|
m_graphicState.setTextFontSize(fontSize);
|
||||||
updateGraphicState();
|
updateGraphicState();
|
||||||
}
|
}
|
||||||
|
catch (PDFParserException)
|
||||||
|
{
|
||||||
|
m_graphicState.setTextFont(nullptr);
|
||||||
|
m_graphicState.setTextFontSize(fontSize);
|
||||||
|
updateGraphicState();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Font '%1' not found in font dictionary.").arg(QString::fromLatin1(fontName.name)));
|
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Font '%1' not found in font dictionary.").arg(QString::fromLatin1(fontName.name)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user