[poppler] 2 commits - poppler/GfxFont.cc poppler/PSOutputDev.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Fri Dec 4 06:02:08 PST 2009
poppler/GfxFont.cc | 9 +++++++++
poppler/PSOutputDev.cc | 24 ++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
New commits:
commit ddf85d4a51f605eed998c633857b8bb5c74ab590
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Dec 4 14:59:41 2009 +0100
Make the code a bit more resilient
By checking the GooString we are going to use really exists
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 67b5412..f577425 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1663,14 +1663,16 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
// check for embedded Type 1 font
} else if (globalParams->getPSEmbedType1() &&
font->getType() == fontType1 &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getEmbeddedFontName()) {
psName = font->getEmbeddedFontName()->sanitizedName(gTrue /* ps mode */);
setupEmbeddedType1Font(&fontFileID, psName);
// check for embedded Type 1C font
} else if (globalParams->getPSEmbedType1() &&
font->getType() == fontType1C &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getOrigName()) {
// use the PDF font name because the embedded font name might
// not include the subset prefix
psName = font->getOrigName()->sanitizedName(gTrue /* ps mode */);
@@ -1679,7 +1681,8 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
// check for embedded OpenType - Type 1C font
} else if (globalParams->getPSEmbedType1() &&
font->getType() == fontType1COT &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getOrigName()) {
// use the PDF font name because the embedded font name might
// not include the subset prefix
psName = font->getOrigName()->sanitizedName(gTrue /* ps mode */);
@@ -1688,7 +1691,8 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
// check for external Type 1 font file
} else if (globalParams->getPSEmbedType1() &&
font->getType() == fontType1 &&
- font->getExtFontFile()) {
+ font->getExtFontFile() &&
+ font->getName()) {
// this assumes that the PS font name matches the PDF font name
psName = font->getName()->copy();
setupExternalType1Font(font->getExtFontFile(), psName);
@@ -1697,7 +1701,8 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
} else if (globalParams->getPSEmbedTrueType() &&
(font->getType() == fontTrueType ||
font->getType() == fontTrueTypeOT) &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getEmbeddedFontName()) {
psName = font->getEmbeddedFontName()->sanitizedName(gTrue /* ps mode */);
setupEmbeddedTrueTypeFont(font, &fontFileID, psName);
@@ -1710,7 +1715,8 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
// check for embedded CID PostScript font
} else if (globalParams->getPSEmbedCIDPostScript() &&
font->getType() == fontCIDType0C &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getEmbeddedFontName()) {
psName = font->getEmbeddedFontName()->sanitizedName(gTrue /* ps mode */);
setupEmbeddedCIDType0Font(font, &fontFileID, psName);
@@ -1718,14 +1724,16 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
} else if (globalParams->getPSEmbedCIDTrueType() &&
(font->getType() == fontCIDType2 ||
font->getType() == fontCIDType2OT) &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getEmbeddedFontName()) {
psName = font->getEmbeddedFontName()->sanitizedName(gTrue /* ps mode */);
setupEmbeddedCIDTrueTypeFont(font, &fontFileID, psName, gTrue);
// check for embedded OpenType - CID CFF font
} else if (globalParams->getPSEmbedCIDPostScript() &&
font->getType() == fontCIDType0COT &&
- font->getEmbeddedFontID(&fontFileID)) {
+ font->getEmbeddedFontID(&fontFileID) &&
+ font->getEmbeddedFontName()) {
psName = font->getEmbeddedFontName()->sanitizedName(gTrue /* ps mode */);
setupEmbeddedOpenTypeCFFFont(font, &fontFileID, psName);
commit 78b4afa0a44048b8d40438d400652dbae4cb99b1
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Dec 4 14:57:10 2009 +0100
Accept Fontname if FontName is not present
Fixes KDE bug 217013
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index f51c100..e7d564a 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -230,6 +230,15 @@ void GfxFont::readFontDescriptor(XRef *xref, Dict *fontDict) {
embFontName = new GooString(obj2.getName());
}
obj2.free();
+ if (embFontName == NULL) {
+ // get name with typo
+ obj1.dictLookup("Fontname", &obj2);
+ if (obj2.isName()) {
+ embFontName = new GooString(obj2.getName());
+ error(-1, "The file uses Fontname instead of FontName please notify the creator that the file is broken");
+ }
+ obj2.free();
+ }
// get family
obj1.dictLookup("FontFamily", &obj2);
More information about the poppler
mailing list