diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | poppler/FontInfo.cc | 10 | ||||
-rw-r--r-- | poppler/FontInfo.h | 2 | ||||
-rw-r--r-- | qt4/src/poppler-document.cc | 14 | ||||
-rw-r--r-- | qt4/src/poppler-fontinfo.cc | 29 | ||||
-rw-r--r-- | qt4/src/poppler-private.h | 29 | ||||
-rw-r--r-- | qt4/src/poppler-qt4.h | 8 | ||||
-rw-r--r-- | qt4/tests/poppler-fonts.cpp | 5 |
8 files changed, 73 insertions, 37 deletions
@@ -1,3 +1,16 @@ +2006-03-11 Albert Astals Cid <aacid@kde.org> + + * poppler/FontInfo.cc: + * poppler/FontInfo.h: Add getFile() function that returns + the path of the font that is beign used in the system to + represent that font + * qt4/src/poppler-document.cc: + * qt4/src/poppler-fontinfo.cc: + * qt4/src/poppler-private.h: + * qt4/src/poppler-qt4.h: Add the file() function + * qt4/tests/poppler-fonts.cpp: Show the path of the font + used to represent each font + 2006-03-09 Albert Astals Cid <aacid@kde.org> * glib/Makefile.am: Build with cairo disabled, patch by Eduardo de diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc index 335ce5ca..d9defa39 100644 --- a/poppler/FontInfo.cc +++ b/poppler/FontInfo.cc @@ -152,6 +152,14 @@ FontInfo::FontInfo(GfxFont *font, PDFDoc *doc) { } else { name = NULL; } + + DisplayFontParam *dfp = globalParams->getDisplayFont(font); + if (dfp) + { + if (dfp->kind == displayFontT1) file = dfp->t1.fileName->copy(); + else file = dfp->tt.fileName->copy(); + } + else file = NULL; // font type type = (FontInfo::Type)font->getType(); @@ -186,6 +194,7 @@ FontInfo::FontInfo(GfxFont *font, PDFDoc *doc) { FontInfo::FontInfo(FontInfo& f) { name = f.name->copy(); + file = f.file->copy(); type = f.type; emb = f.emb; subset = f.subset; @@ -195,4 +204,5 @@ FontInfo::FontInfo(FontInfo& f) { FontInfo::~FontInfo() { delete name; + delete file; } diff --git a/poppler/FontInfo.h b/poppler/FontInfo.h index f2020e85..e58237bb 100644 --- a/poppler/FontInfo.h +++ b/poppler/FontInfo.h @@ -25,6 +25,7 @@ public: ~FontInfo(); GooString *getName() { return name; }; + GooString *getFile() { return file; }; Type getType() { return type; }; GBool getEmbedded() { return emb; }; GBool getSubset() { return subset; }; @@ -32,6 +33,7 @@ public: private: GooString *name; + GooString *file; Type type; GBool emb; GBool subset; diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc index 099ed2fe..6837cfcc 100644 --- a/qt4/src/poppler-document.cc +++ b/qt4/src/poppler-document.cc @@ -27,7 +27,6 @@ #include <Catalog.h> #include "UGooString.h" #include <ErrorCodes.h> -#include <SplashOutputDev.h> #include <splash/SplashBitmap.h> #include "poppler-private.h" #include <Stream.h> @@ -175,18 +174,7 @@ namespace Poppler { return false; for ( int i = 0; i < items->getLength(); ++i ) { - if (((::FontInfo*)items->get(i))->getName()) - fontList->append(FontInfo(((::FontInfo*)items->get(i))->getName()->getCString(), - ((::FontInfo*)items->get(i))->getEmbedded(), - ((::FontInfo*)items->get(i))->getSubset(), - (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType() - )); - else - fontList->append(FontInfo(QString::null, - ((::FontInfo*)items->get(i))->getEmbedded(), - ((::FontInfo*)items->get(i))->getSubset(), - (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType() - )); + fontList->append( FontInfo(FontInfoData((::FontInfo*)items->get(i))) ); } deleteGooList(items, ::FontInfo); return true; diff --git a/qt4/src/poppler-fontinfo.cc b/qt4/src/poppler-fontinfo.cc index bb7c281b..d757fe37 100644 --- a/qt4/src/poppler-fontinfo.cc +++ b/qt4/src/poppler-fontinfo.cc @@ -20,34 +20,18 @@ #define UNSTABLE_POPPLER_QT4 #include "poppler-qt4.h" +#include "poppler-private.h" namespace Poppler { -class FontInfoData +FontInfo::FontInfo( const FontInfoData &fid ) { - public: - QString fontName; - bool isEmbedded; - bool isSubset; - FontInfo::Type type; -}; - -FontInfo::FontInfo( const QString &fontName, const bool isEmbedded, const bool isSubset, Type type ) -{ - m_data = new FontInfoData(); - m_data->fontName = fontName; - m_data->isEmbedded = isEmbedded; - m_data->isSubset = isSubset; - m_data->type = type; + m_data = new FontInfoData(fid); } FontInfo::FontInfo( const FontInfo &fi ) { - m_data = new FontInfoData(); - m_data->fontName = fi.m_data->fontName; - m_data->isEmbedded = fi.m_data->isEmbedded; - m_data->isSubset = fi.m_data->isSubset; - m_data->type = fi.m_data->type; + m_data = new FontInfoData(*fi.m_data); } FontInfo::~FontInfo() @@ -60,6 +44,11 @@ const QString &FontInfo::name() const return m_data->fontName; } +const QString &FontInfo::file() const +{ + return m_data->fontFile; +} + bool FontInfo::isEmbedded() const { return m_data->isEmbedded; diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h index cedfeaa5..1ad496d3 100644 --- a/qt4/src/poppler-private.h +++ b/qt4/src/poppler-private.h @@ -19,6 +19,7 @@ #include <PDFDoc.h> #include <GfxState.h> #include <FontInfo.h> +#include <SplashOutputDev.h> namespace Poppler { @@ -60,6 +61,34 @@ namespace Poppler { QList<EmbeddedFile*> m_embeddedFiles; }; + class FontInfoData + { + public: + FontInfoData( const FontInfoData &fid ) + { + fontName = fid.fontName; + fontFile = fid.fontFile; + isEmbedded = fid.isEmbedded; + isSubset = fid.isSubset; + type = fid.type; + } + + FontInfoData( ::FontInfo* fi ) + { + if (fi->getName()) fontName = fi->getName()->getCString(); + if (fi->getFile()) fontFile = fi->getFile()->getCString(); + isEmbedded = fi->getEmbedded(); + isSubset = fi->getSubset(); + type = (Poppler::FontInfo::Type)fi->getType(); + } + + QString fontName; + QString fontFile; + bool isEmbedded; + bool isSubset; + FontInfo::Type type; + }; + } diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h index 03f0e34f..e0fa51d8 100644 --- a/qt4/src/poppler-qt4.h +++ b/qt4/src/poppler-qt4.h @@ -96,8 +96,7 @@ namespace Poppler { /** Create a new font information container */ - FontInfo( const QString &fontName, const bool isEmbedded, - const bool isSubset, Type type); + FontInfo( const FontInfoData &fid ); FontInfo( const FontInfo &fi ); @@ -109,6 +108,11 @@ namespace Poppler { const QString &name() const; /** + The path of the font file used to represent this font on this system. + */ + const QString &file() const; + + /** Whether the font is embedded in the file, or not \return true if the font is embedded diff --git a/qt4/tests/poppler-fonts.cpp b/qt4/tests/poppler-fonts.cpp index 1d7dc543..460987af 100644 --- a/qt4/tests/poppler-fonts.cpp +++ b/qt4/tests/poppler-fonts.cpp @@ -21,9 +21,9 @@ int main( int argc, char **argv ) exit(1); } - std::cout << "name type emb sub"; + std::cout << "name type emb sub font file"; std::cout << std::endl; - std::cout << "------------------------------------ ------------ --- ---"; + std::cout << "------------------------------------ ------------ --- --- ---------"; std::cout << std::endl; foreach( Poppler::FontInfo font, doc->fonts() ) { @@ -69,6 +69,7 @@ int main( int argc, char **argv ) } else { std::cout << "no "; } + std::cout << qPrintable( QString("%1").arg(font.file()) ); std::cout << std::endl; } delete doc; |