[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-poppler
Subject:    [poppler] poppler/Gfx.cc poppler/GfxFont.cc
From:       jrmuizel () kemper ! freedesktop ! org (Jeff Muizelaar)
Date:       2007-10-23 3:09:10
Message-ID: 20071023030910.7337810096 () kemper ! freedesktop ! org
[Download RAW message or body]

 poppler/Gfx.cc     |    4 ++++
 poppler/GfxFont.cc |    4 ++++
 2 files changed, 8 insertions(+)

New commits:
commit 25b273db677815c8df11e52fe9df29fe857a8a88
Author: Jeff Muizelaar <jeff@infidigm.net>
Date:   Mon Oct 22 23:01:37 2007 -0400

    Unset the font if it doesn't exist or we can not load it properly
    
    Previously, the previous font stayed current and glyphs would be drawn using
    it. This resulted in random glyphs being chosen unless the encodings happened
    to match. Now, instead, we draw nothing which matches the behaviour of
    acroread.

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index b86ab10..37c279e 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -2968,6 +2968,10 @@ void Gfx::opSetFont(Object args[], int numArgs) {
   GfxFont *font;
 
   if (!(font = res->lookupFont(args[0].getName()))) {
+    // unsetting the font (drawing no text) is better than using the
+    // previous one and drawing random glyphs from it
+    state->setFont(NULL, args[1].getNum());
+    fontChanged = gTrue;
     return;
   }
   if (printCommands) {
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 63ac1c0..cce097f 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -1861,6 +1861,10 @@ GfxFontDict::GfxFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict) {
       fonts[i] = GfxFont::makeFont(xref, fontDict->getKey(i),
 				   r, obj2.getDict());
       if (fonts[i] && !fonts[i]->isOk()) {
+	// XXX: it may be meaningful to distinguish between
+	// NULL and !isOk() so that when we do lookups
+	// we can tell the difference between a missing font
+	// and a font that is just !isOk()
 	delete fonts[i];
 	fonts[i] = NULL;
       }
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic