diff --git a/core/fontinfo.h b/core/fontinfo.h --- a/core/fontinfo.h +++ b/core/fontinfo.h @@ -84,6 +84,16 @@ */ void setName( const QString& name ); + /** + * Returns the substitute name for the font. + */ + QString substituteName() const; + + /** + * Sets a new substitute name for the font. + */ + void setSubstituteName( const QString& substituteName ); + /** * Returns the type of the font. */ diff --git a/core/fontinfo.cpp b/core/fontinfo.cpp --- a/core/fontinfo.cpp +++ b/core/fontinfo.cpp @@ -27,13 +27,15 @@ bool operator==( const FontInfoPrivate &rhs ) const { return name == rhs.name && + substituteName == rhs.substituteName && type == rhs.type && embedType == rhs.embedType && file == rhs.file && canBeExtracted == rhs.canBeExtracted; } QString name; + QString substituteName; FontInfo::FontType type; FontInfo::EmbedType embedType; bool canBeExtracted; @@ -66,6 +68,16 @@ d->name = name; } +QString FontInfo::substituteName() const +{ + return d->substituteName; +} + +void FontInfo::setSubstituteName( const QString& substituteName ) +{ + d->substituteName = substituteName; +} + FontInfo::FontType FontInfo::type() const { return d->type; diff --git a/generators/poppler/CMakeLists.txt b/generators/poppler/CMakeLists.txt --- a/generators/poppler/CMakeLists.txt +++ b/generators/poppler/CMakeLists.txt @@ -156,6 +156,16 @@ } " HAVE_POPPLER_0_79) +check_cxx_source_compiles(" +#include +int main() +{ + Poppler::FontInfo info; + QString substituteName = info.substituteName(); + return 0; +} +" HAVE_POPPLER_0_80) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h diff --git a/generators/poppler/config-okular-poppler.h.cmake b/generators/poppler/config-okular-poppler.h.cmake --- a/generators/poppler/config-okular-poppler.h.cmake +++ b/generators/poppler/config-okular-poppler.h.cmake @@ -48,3 +48,6 @@ /* Defined if we have the 0.79 version of the Poppler library */ #cmakedefine HAVE_POPPLER_0_79 1 + +/* Defined if we have the 0.80 version of the Poppler library */ +#cmakedefine HAVE_POPPLER_0_80 1 diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -942,6 +942,9 @@ { Okular::FontInfo of; of.setName( font.name() ); +#ifdef HAVE_POPPLER_0_80 + of.setSubstituteName( font.substituteName() ); +#endif of.setType( convertPopplerFontInfoTypeToOkularFontInfoType( font.type() ) ); of.setEmbedType( embedTypeForPopplerFontInfo( font) ); of.setFile( font.file() ); diff --git a/ui/propertiesdialog.cpp b/ui/propertiesdialog.cpp --- a/ui/propertiesdialog.cpp +++ b/ui/propertiesdialog.cpp @@ -355,7 +355,12 @@ { case 0: { - QString fontname = m_fonts.at( index.row() ).name(); + const Okular::FontInfo &fi = m_fonts.at( index.row() ); + const QString fontname = fi.name(); + const QString substituteName = fi.substituteName(); + if ( fi.embedType() == Okular::FontInfo::NotEmbedded && !substituteName.isEmpty() && !fontname.isEmpty() && substituteName != fontname ) { + return i18nc("Replacing missing font with another one", "%1 (substituting with %2)", fontname, substituteName); + } return fontname.isEmpty() ? i18nc( "font name not available (empty)", "[n/a]" ) : fontname; break; }