Extend the FontInfo class to distinguish the different types of font embedding.

svn path=/trunk/KDE/kdegraphics/okular/; revision=685317
remotes/origin/KDE/4.0
Pino Toscano 19 years ago
parent 1e13204e92
commit 3fd552ef21
  1. 14
      core/fontinfo.cpp
  2. 18
      core/fontinfo.h
  3. 2
      generators/poppler/generator_pdf.cpp
  4. 19
      ui/propertiesdialog.cpp

@ -17,7 +17,7 @@ class Okular::FontInfoPrivate
{
public:
FontInfoPrivate()
: name( 0 ), type( FontInfo::Unknown ), embedded( true )
: name( 0 ), type( FontInfo::Unknown ), embedType( FontInfo::NotEmbedded )
{
}
@ -25,13 +25,13 @@ class Okular::FontInfoPrivate
{
return name == rhs.name &&
type == rhs.type &&
embedded == rhs.embedded &&
embedType == rhs.embedType &&
file == rhs.file;
}
QString name;
FontInfo::FontType type;
bool embedded;
FontInfo::EmbedType embedType;
QString file;
};
@ -70,14 +70,14 @@ void FontInfo::setType( FontInfo::FontType type )
d->type = type;
}
bool FontInfo::isEmbedded() const
FontInfo::EmbedType FontInfo::embedType() const
{
return d->embedded;
return d->embedType;
}
void FontInfo::setEmbedded( bool embedded )
void FontInfo::setEmbedType( FontInfo::EmbedType type )
{
d->embedded = embedded;
d->embedType = type;
}
QString FontInfo::file() const

@ -48,6 +48,16 @@ class OKULAR_EXPORT FontInfo
CIDTrueTypeOT
};
/**
* The possible kinds of embed.
*/
enum EmbedType
{
NotEmbedded,
EmbeddedSubSet,
Embedded
};
/**
* Construct a new empty font info.
*/
@ -80,13 +90,13 @@ class OKULAR_EXPORT FontInfo
void setType( FontType type );
/**
* Returns whether the font is embedded into the document.
* Returns the type of font embedding.
*/
bool isEmbedded() const;
EmbedType embedType() const;
/**
* Sets whether the font is embedded into the document.
* Sets the type of font embedding.
*/
void setEmbedded( bool embedded );
void setEmbedType( EmbedType type );
/**
* In case of not embedded font, returns the path of the font that

@ -657,7 +657,7 @@ Okular::FontInfo::List PDFGenerator::fontsForPage( int /*page*/ )
Okular::FontInfo of;
of.setName( font.name() );
of.setType( convertPopplerFontInfoTypeToOkularFontInfoType( font.type() ) );
of.setEmbedded( font.isEmbedded() );
of.setEmbedType( font.isEmbedded() ? Okular::FontInfo::Embedded : Okular::FontInfo::NotEmbedded );
of.setFile( font.file() );
list.append( of );

@ -231,6 +231,23 @@ static QString descriptionForFontType( Okular::FontInfo::FontType type )
return QString();
}
static QString descriptionForEmbedType( Okular::FontInfo::EmbedType type )
{
switch ( type )
{
case Okular::FontInfo::NotEmbedded:
return i18n("No");
break;
case Okular::FontInfo::EmbeddedSubSet:
return i18n("Yes (subset)");
break;
case Okular::FontInfo::Embedded:
return i18n("Yes");
break;
}
return QString();
}
QVariant FontsListModel::data( const QModelIndex &index, int role ) const
{
if ( !index.isValid() )
@ -246,7 +263,7 @@ QVariant FontsListModel::data( const QModelIndex &index, int role ) const
{
case 0: return m_fonts.at( index.row() ).name(); break;
case 1: return descriptionForFontType( m_fonts.at( index.row() ).type() ); break;
case 2: return m_fonts.at( index.row() ).isEmbedded() ? i18n( "Yes" ) : i18n( "No" ); break;
case 2: return descriptionForEmbedType( m_fonts.at( index.row() ).embedType() ); break;
case 3: return m_fonts.at( index.row() ).file(); break;
default:
return QVariant();

Loading…
Cancel
Save