[poppler] Branch 'poppler-0.12' - 2 commits - poppler/GfxFont.cc poppler/PSOutputDev.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Fri Dec 4 06:01:14 PST 2009
poppler/GfxFont.cc | 9 +++++++++
poppler/PSOutputDev.cc | 24 ++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
New commits:
commit a6cdeb7be296b14d74cf1d2f22729dc7d0b9e31c
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 b784c00..1cf2eea 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1662,14 +1662,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 */);
@@ -1678,7 +1680,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 */);
@@ -1687,7 +1690,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);
@@ -1696,7 +1700,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);
@@ -1709,7 +1714,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);
@@ -1717,14 +1723,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 4eaf44cdf4e6006b70712c055a97ab152c41d26f
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