summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CHURLAUD <olivier@churlaud.com>2016-07-13 21:46:43 (GMT)
committerOlivier CHURLAUD <olivier@churlaud.com>2016-07-13 21:46:43 (GMT)
commitdd8fa351ce87be2b46243e5de641b9c104a024cc (patch)
treed3167bd6217ada92f937e87c08217f1845845a04
parentec0b68a75672ad2413fefbed81ebe08c46080bd7 (diff)
Fonts are scanned again by poppler5
Fonts are filtered as well to only appear once. REVIEW: 128441
-rw-r--r--core/document.cpp8
-rw-r--r--core/fontinfo.cpp3
-rw-r--r--generators/poppler/generator_pdf.cpp7
3 files changed, 11 insertions, 7 deletions
diff --git a/core/document.cpp b/core/document.cpp
index a59d2ea..2f99a8c 100644
--- a/core/document.cpp
+++ b/core/document.cpp
@@ -1521,10 +1521,12 @@ void DocumentPrivate::fontReadingProgress( int page )
void DocumentPrivate::fontReadingGotFont( const Okular::FontInfo& font )
{
- // TODO try to avoid duplicate fonts
- m_fontsCache.append( font );
+ // Try to avoid duplicate fonts
+ if (m_fontsCache.indexOf(font) == -1) {
+ m_fontsCache.append( font );
- emit m_parent->gotFont( font );
+ emit m_parent->gotFont( font );
+ }
}
void DocumentPrivate::slotGeneratorConfigChanged( const QString& )
diff --git a/core/fontinfo.cpp b/core/fontinfo.cpp
index 59ea79f..f7ca045 100644
--- a/core/fontinfo.cpp
+++ b/core/fontinfo.cpp
@@ -30,8 +30,7 @@ class Okular::FontInfoPrivate
type == rhs.type &&
embedType == rhs.embedType &&
file == rhs.file &&
- canBeExtracted == rhs.canBeExtracted &&
- nativeId == rhs.nativeId;
+ canBeExtracted == rhs.canBeExtracted;
}
QString name;
diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp
index 6ace716..8478a8c 100644
--- a/generators/poppler/generator_pdf.cpp
+++ b/generators/poppler/generator_pdf.cpp
@@ -800,8 +800,11 @@ Okular::FontInfo::List PDFGenerator::fontsForPage( int page )
QList<Poppler::FontInfo> fonts;
userMutex()->lock();
-#pragma message("scanForFonts doesn't exist in Poppler5. BahhhH!")
- //pdfdoc->scanForFonts( 1, &fonts );
+
+ Poppler::FontIterator* it = pdfdoc->newFontIterator(page);
+ if (it->hasNext()) {
+ fonts = it->next();
+ }
userMutex()->unlock();
foreach (const Poppler::FontInfo &font, fonts)