Better behaviour when font cant be loaded

This commit is contained in:
Jakub Melka
2019-04-06 17:32:36 +02:00
parent cd981183b0
commit 1694d310a8

View File

@ -1530,11 +1530,21 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
{ {
if (m_fontDictionary->hasKey(fontName.name)) if (m_fontDictionary->hasKey(fontName.name))
{ {
PDFFontPointer font = PDFFont::createFont(m_fontDictionary->get(fontName.name), m_document); try
{
PDFFontPointer font = PDFFont::createFont(m_fontDictionary->get(fontName.name), m_document);
m_graphicState.setTextFont(qMove(font)); m_graphicState.setTextFont(qMove(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
{ {