[poppler] 3 commits - glib/poppler-document.cc poppler/FontInfo.cc poppler/GlobalParams.cc poppler/GlobalParamsWin.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Thu May 24 01:56:51 PDT 2012


 glib/poppler-document.cc   |    4 +--
 poppler/FontInfo.cc        |    1 
 poppler/GlobalParams.cc    |   58 ++++++++++++++++++++++++---------------------
 poppler/GlobalParamsWin.cc |    5 +++
 4 files changed, 39 insertions(+), 29 deletions(-)

New commits:
commit b47d38e2ccd8563394df89765e277bde95730052
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu May 24 18:24:48 2012 +0930

    glib docs: fix typo

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index d404fcd..e626a2a 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1834,7 +1834,7 @@ poppler_fonts_iter_get_name (PopplerFontsIter *iter)
  * The name of the substitute font of the font associated with @iter or %NULL if
  * the font is embedded
  *
- * Returns: the name of the substitute font or %NULL y font is emebedded
+ * Returns: the name of the substitute font or %NULL if font is embedded
  *
  * Since: 0.20
  */
@@ -1861,7 +1861,7 @@ poppler_fonts_iter_get_substitute_name (PopplerFontsIter *iter)
  * The filename of the font associated with @iter or %NULL if
  * the font is embedded
  *
- * Returns: the filename of the font or %NULL y font is emebedded
+ * Returns: the filename of the font or %NULL if font is embedded
  */
 const char *
 poppler_fonts_iter_get_file_name (PopplerFontsIter *iter)
commit 14a29dbff585cbe55247431a346c2ac3e12473fe
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun May 13 21:36:36 2012 +0930

    add sustitute font name to GlobalParamsWin32 to fix compilation

diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index d8065e0..b8c3d0c 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -313,6 +313,7 @@ SysFontInfo *SysFontList::makeWindowsFont(char *name, int fontNum,
   char c;
   int i;
   SysFontType type;
+  GooString substituteName;
 
   n = strlen(name);
   bold = italic = oblique = fixedWidth = gFalse;
@@ -380,7 +381,7 @@ SysFontInfo *SysFontList::makeWindowsFont(char *name, int fontNum,
   }
 
   return new SysFontInfo(s, bold, italic, oblique, fixedWidth,
-                         new GooString(path), type, fontNum);
+                         new GooString(path), type, fontNum, substituteName.copy());
 }
 
 static GooString* replaceSuffix(GooString *path,
@@ -570,6 +571,8 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
     path = fi->path->copy();
     *type = fi->type;
     *fontNum = fi->fontNum;
+    if (substituteFontName)
+      substituteFontName.Set(fi->substituteName->getCString());
   } else {
     GooString *substFontName = new GooString(findSubstituteName(font, fontFiles,
                                                                 substFiles,
commit 7436b2c8a853f5121eb7dd13168ab997f1cf7d80
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat May 12 16:31:38 2012 +0930

    Include substitute font name in system font cache
    
    Bug 49826

diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 4f30f05..35d5f5f 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -224,6 +224,7 @@ FontInfo::FontInfo(FontInfo& f) {
   name = f.name ? f.name->copy() : NULL;
   file = f.file ? f.file->copy() : NULL;
   encoding = f.encoding ? f.encoding->copy() : NULL;
+  substituteName = f.substituteName ? f.substituteName->copy() : NULL;
   type = f.type;
   emb = f.emb;
   subset = f.subset;
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 13053ac..098e4a4 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -214,9 +214,10 @@ public:
   GooString *path;
   SysFontType type;
   int fontNum;			// for TrueType collections
+  GooString *substituteName;
 
   SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA,
-	      GooString *pathA, SysFontType typeA, int fontNumA);
+	      GooString *pathA, SysFontType typeA, int fontNumA, GooString *substituteNameA);
   ~SysFontInfo();
   GBool match(SysFontInfo *fi);
   GBool match(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA);
@@ -224,7 +225,7 @@ public:
 };
 
 SysFontInfo::SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA,
-			 GooString *pathA, SysFontType typeA, int fontNumA) {
+			 GooString *pathA, SysFontType typeA, int fontNumA, GooString *substituteNameA) {
   name = nameA;
   bold = boldA;
   italic = italicA;
@@ -233,11 +234,13 @@ SysFontInfo::SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obl
   path = pathA;
   type = typeA;
   fontNum = fontNumA;
+  substituteName = substituteNameA;
 }
 
 SysFontInfo::~SysFontInfo() {
   delete name;
   delete path;
+  delete substituteName;
 }
 
 GBool SysFontInfo::match(SysFontInfo *fi) {
@@ -1163,6 +1166,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
   FcPattern *p=0;
   GooString *path = NULL;
   GooString *fontName = font->getName();
+  GooString substituteName;
   if (!fontName) return NULL;
   lockGlobalParams;
 
@@ -1170,6 +1174,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
     path = fi->path->copy();
     *type = fi->type;
     *fontNum = fi->fontNum;
+    substituteName.Set(fi->substituteName->getCString());
   } else {
     FcChar8* s;
     char * ext;
@@ -1214,28 +1219,26 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
 	  }
 	}
 	FcChar8* s2;
-	if (substituteFontName) {
-	  res = FcPatternGetString(set->fonts[i], FC_FULLNAME, 0, &s2);
-	  if (res == FcResultMatch && s2) {
-	    substituteFontName->Set((char*)s2);
-	  } else {
-	    // fontconfig does not extract fullname for some fonts
-	    // create the fullname from family and style
-	    res = FcPatternGetString(set->fonts[i], FC_FAMILY, 0, &s2);
-	    if (res == FcResultMatch && s2) {
-	      substituteFontName->Set((char*)s2);
-	      res = FcPatternGetString(set->fonts[i], FC_STYLE, 0, &s2);
-	      if (res == FcResultMatch && s2) {
-		GooString *style = new GooString((char*)s2);
-		if (style->cmp("Regular") != 0) {
-		  substituteFontName->append(" ");
-		  substituteFontName->append(style);
-		}
-		delete style;
-	      }
-	    }
-	  }
-	}
+        res = FcPatternGetString(set->fonts[i], FC_FULLNAME, 0, &s2);
+        if (res == FcResultMatch && s2) {
+          substituteName.Set((char*)s2);
+        } else {
+          // fontconfig does not extract fullname for some fonts
+          // create the fullname from family and style
+          res = FcPatternGetString(set->fonts[i], FC_FAMILY, 0, &s2);
+          if (res == FcResultMatch && s2) {
+            substituteName.Set((char*)s2);
+            res = FcPatternGetString(set->fonts[i], FC_STYLE, 0, &s2);
+            if (res == FcResultMatch && s2) {
+              GooString *style = new GooString((char*)s2);
+              if (style->cmp("Regular") != 0) {
+                substituteName.append(" ");
+                substituteName.append(style);
+              }
+              delete style;
+            }
+          }
+        }
 	ext = strrchr((char*)s,'.');
 	if (!ext)
 	  continue;
@@ -1260,7 +1263,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
 	  *type = (!strncasecmp(ext,".ttc",4)) ? sysFontTTC : sysFontTTF;
 	  FcPatternGetInteger(set->fonts[i], FC_INDEX, 0, fontNum);
 	  fi = new SysFontInfo(fontName->copy(), bold, italic, oblique, font->isFixedWidth(),
-			       new GooString((char*)s), *type, *fontNum);
+			       new GooString((char*)s), *type, *fontNum, substituteName.copy());
 	  sysFonts->addFcFont(fi);
 	  path = new GooString((char*)s);
 	}
@@ -1285,7 +1288,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
 	  *type = (!strncasecmp(ext,".pfa",4)) ? sysFontPFA : sysFontPFB;
 	  FcPatternGetInteger(set->fonts[i], FC_INDEX, 0, fontNum);
 	  fi = new SysFontInfo(fontName->copy(), bold, italic, oblique, font->isFixedWidth(),
-			       new GooString((char*)s), *type, *fontNum);
+			       new GooString((char*)s), *type, *fontNum, substituteName.copy());
 	  sysFonts->addFcFont(fi);
 	  path = new GooString((char*)s);
 	}
@@ -1308,6 +1311,9 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
     *type = fi->type;
     *fontNum = fi->fontNum;
   }
+  if (substituteFontName) {
+    substituteFontName->Set(substituteName.getCString());
+  }
 fin:
   if (p)
     FcPatternDestroy(p);


More information about the poppler mailing list