Fix display of type 3 fonts

This commit is contained in:
Jakub Melka 2020-06-23 19:28:25 +02:00
parent 17d32fd0b8
commit aa36af6587
2 changed files with 5 additions and 4 deletions

View File

@ -2999,14 +2999,15 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
PDFPageContentProcessorStateGuard guard(this);
QMatrix invertedFontMatrix = fontMatrix.inverted();
PDFObject resources = parentFont->getResources();
if (!resources.isNull())
{
initDictionaries(resources);
}
QMatrix fontAdjustedMatrix = invertedFontMatrix * adjustMatrix;
QMatrix scaleMatrix(fontSize, 0.0, 0.0, fontSize, 0.0, 0.0);
adjustMatrix = scaleMatrix * adjustMatrix;
QMatrix fontAdjustedMatrix = fontMatrix * adjustMatrix;
for (const TextSequenceItem& item : textSequence.items)
{

View File

@ -468,7 +468,7 @@ PDFLexicalAnalyzer::Token PDFLexicalAnalyzer::fetch()
void PDFLexicalAnalyzer::seek(PDFInteger offset)
{
const PDFInteger limit = std::distance(m_begin, m_end);
if (offset >= 0 && offset < limit)
if (offset >= 0 && offset <= limit)
{
m_current = std::next(m_begin, offset);
}
@ -545,7 +545,7 @@ PDFInteger PDFLexicalAnalyzer::findSubstring(const char* str, PDFInteger positio
const PDFInteger substringLength = qstrlen(str);
const PDFInteger startPos = position;
const PDFInteger endPos = length - substringLength;
for (PDFInteger i = startPos; i < endPos; ++i)
for (PDFInteger i = startPos; i <= endPos; ++i)
{
Q_ASSERT(std::distance(m_begin + i + substringLength - 1, m_end) >= 0);
if (memcmp(m_begin + i, str, substringLength) == 0)