mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-02-28 17:37: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->hasKey(fontName.name))
|
||||
{
|
||||
try
|
||||
{
|
||||
PDFFontPointer font = PDFFont::createFont(m_fontDictionary->get(fontName.name), m_document);
|
||||
|
||||
@ -1536,6 +1538,14 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
|
||||
m_graphicState.setTextFontSize(fontSize);
|
||||
updateGraphicState();
|
||||
}
|
||||
catch (PDFParserException)
|
||||
{
|
||||
m_graphicState.setTextFont(nullptr);
|
||||
m_graphicState.setTextFontSize(fontSize);
|
||||
updateGraphicState();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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