[poppler] Re: [Patch] Silly infinite cycle

Marco Pesenti Gritti mpgritti at gmail.com
Sat Jun 18 07:26:11 PDT 2005


Haha, gmail UI is pretty cool actually, just my fault :)

Marco

On 6/18/05, Martin Kretzschmar <m_kretzschmar at gmx.net> wrote:
> Marco Pesenti Gritti schrieb:
> > Patch attached also fix the problem with fonts with NULL origName.
> > I choosed to just pass back a NULL instead of something like "No name"
> > because I think applications may need control on how to show this in
> > the UI (at very least that string should be translated).
> 
> I haven't seen GMail myself, but it must have a really horrible UI for
> attaching patches...
> 
> SCNR,
> 
> Martin
>
-------------- next part --------------
Index: poppler/FontInfo.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/FontInfo.cc,v
retrieving revision 1.1
diff -u -r1.1 FontInfo.cc
--- poppler/FontInfo.cc	13 Jun 2005 17:18:32 -0000	1.1
+++ poppler/FontInfo.cc	18 Jun 2005 13:15:05 -0000
@@ -101,13 +101,14 @@
   }
   if (gfxFontDict) {
     for (i = 0; i < gfxFontDict->getNumFonts(); ++i) {
+      int k;
       if ((font = gfxFontDict->getFont(i))) {
         Ref fontRef = *font->getID();
 	GBool alreadySeen = gFalse;
 
         // check for an already-seen font
-        for (i = 0; i < fontsLen; ++i) {
-          if (fontRef.num == fonts[i].num && fontRef.gen == fonts[i].gen) {
+        for (k = 0; k < fontsLen; ++k) {
+          if (fontRef.num == fonts[k].num && fontRef.gen == fonts[k].gen) {
             alreadySeen = gTrue;
           }
         }
@@ -147,6 +148,7 @@
 }
 
 FontInfo::FontInfo(GfxFont *font, PDFDoc *doc) {
+  GooString *origName;
   Ref embRef;
   Object fontObj, toUnicodeObj;
   int i;
@@ -154,7 +156,12 @@
   fontRef = *font->getID();
 
   // font name
-  name = font->getOrigName()->copy();
+  origName = font->getOrigName();
+  if (origName != NULL) {
+    name = font->getOrigName()->copy();
+  } else {
+    name = NULL;
+  }
 
   // check for an embedded font
   if (font->getType() == fontType3) {
Index: glib/poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.19
diff -u -r1.19 poppler-document.cc
--- glib/poppler-document.cc	15 Jun 2005 15:02:46 -0000	1.19
+++ glib/poppler-document.cc	18 Jun 2005 13:15:49 -0000
@@ -777,11 +777,17 @@
 const char *
 poppler_fonts_iter_get_name (PopplerFontsIter *iter)
 {
+	GooString *name;
 	FontInfo *info;
 
 	info = (FontInfo *)iter->items->get (iter->index);
 
-	return info->getName()->getCString();
+	name = info->getName();
+	if (name != NULL) {
+		return info->getName()->getCString();
+	} else {
+		return NULL;
+	}
 }
 
 gboolean


More information about the poppler mailing list