Commit 1a90b3aa authored by Albert Astals Cid's avatar Albert Astals Cid

* 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

May be interesting to have in the other frontends
parent 22b16181
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
......
......@@ -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;
}
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
};
}
......@@ -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 );
......@@ -108,6 +107,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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment