[poppler] 2 commits - poppler/FontInfo.cc poppler/FontInfo.h qt4/src
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue Jun 10 15:53:38 PDT 2008
poppler/FontInfo.cc | 2 +-
poppler/FontInfo.h | 3 +++
qt4/src/poppler-document.cc | 23 +++++++++++++++++++++++
qt4/src/poppler-private.h | 3 +++
qt4/src/poppler-qt4.h | 5 +++++
5 files changed, 35 insertions(+), 1 deletion(-)
New commits:
commit e368838d7f9691c7b1adf7d7f62f65abed91eea7
Author: Albert Astals Cid <aacid at kde.org>
Date: Wed Jun 11 00:48:53 2008 +0200
[Qt4] Add the possibility of getting a QByteArray with the data of an embedded font
diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index ceffeca..a6f6af8 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -201,6 +201,29 @@ namespace Poppler {
return true;
}
+ QByteArray Document::fontData(const FontInfo &fi) const
+ {
+ QByteArray result;
+ if (fi.isEmbedded())
+ {
+ Object refObj, strObj;
+ refObj.initRef(fi.m_data->embRef.num, fi.m_data->embRef.gen);
+ refObj.fetch(m_doc->doc->getXRef(), &strObj);
+ refObj.free();
+ if (strObj.isStream())
+ {
+ int c;
+ strObj.streamReset();
+ while ((c = strObj.streamGetChar()) != EOF)
+ {
+ result.append((char)c);
+ }
+ strObj.streamClose();
+ }
+ strObj.free();
+ }
+ return result;
+ }
/* borrowed from kpdf */
QString Document::info( const QString & type ) const
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 6f55f18..b412435 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -273,6 +273,7 @@ namespace Poppler {
isEmbedded = fid.isEmbedded;
isSubset = fid.isSubset;
type = fid.type;
+ embRef = fid.embRef;
}
FontInfoData( ::FontInfo* fi )
@@ -282,6 +283,7 @@ namespace Poppler {
isEmbedded = fi->getEmbedded();
isSubset = fi->getSubset();
type = (Poppler::FontInfo::Type)fi->getType();
+ embRef = fi->getEmbRef();
}
QString fontName;
@@ -289,6 +291,7 @@ namespace Poppler {
bool isEmbedded : 1;
bool isSubset : 1;
FontInfo::Type type;
+ Ref embRef;
};
class TextBoxData
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index ac106ae..0a278bc 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -115,6 +115,7 @@ namespace Poppler {
document
*/
class POPPLER_QT4_EXPORT FontInfo {
+ friend class Document;
public:
/**
The type of font.
@@ -788,6 +789,10 @@ QString subject = m_doc->info("Subject");
*/
bool scanForFonts( int numPages, QList<FontInfo> *fontList ) const;
+ /**
+ The font data if the font is an embedded one.
+ */
+ QByteArray fontData(const FontInfo &font) const;
/**
The documents embedded within the PDF document.
commit 184292ffb8fef5aa5a72bdbfcc0c95b663f452bd
Author: Albert Astals Cid <aacid at kde.org>
Date: Tue Jun 10 23:00:11 2008 +0200
Make the fontRef and the embRef accessible to FontInfo users
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 555b3aa..d98f1c6 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -138,7 +138,6 @@ void FontInfoScanner::scanFonts(Dict *resDict, GooList *fontsList) {
FontInfo::FontInfo(GfxFont *font, PDFDoc *doc) {
GooString *origName;
- Ref embRef;
Object fontObj, toUnicodeObj;
int i;
@@ -203,6 +202,7 @@ FontInfo::FontInfo(FontInfo& f) {
subset = f.subset;
hasToUnicode = f.hasToUnicode;
fontRef = f.fontRef;
+ embRef = f.embRef;
}
FontInfo::~FontInfo() {
diff --git a/poppler/FontInfo.h b/poppler/FontInfo.h
index 81bf4b9..1862845 100644
--- a/poppler/FontInfo.h
+++ b/poppler/FontInfo.h
@@ -34,6 +34,8 @@ public:
GBool getEmbedded() { return emb; };
GBool getSubset() { return subset; };
GBool getToUnicode() { return hasToUnicode; };
+ Ref getRef() { return fontRef; };
+ Ref getEmbRef() { return embRef; };
private:
GooString *name;
@@ -43,6 +45,7 @@ private:
GBool subset;
GBool hasToUnicode;
Ref fontRef;
+ Ref embRef;
};
class FontInfoScanner {
More information about the poppler
mailing list