[poppler] Branch 'poppler-0.20' - 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 02:01:24 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 9904b8f10abf068a7816bd90976ccbb320387645
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 2b01c29..24badd9 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1721,7 +1721,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
*/
@@ -1748,7 +1748,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 028f580056f99719cfb8af7bbe8184ceac02cb16
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 1916d000a86336213ffd6e9bd44ce873e8955895
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 64d6133..76394ca 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) {
@@ -1184,6 +1187,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
FcPattern *p=0;
GooString *path = NULL;
GooString *fontName = font->getName();
+ GooString substituteName;
if (!fontName) return NULL;
lockGlobalParams;
@@ -1191,6 +1195,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;
@@ -1235,28 +1240,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;
@@ -1281,7 +1284,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);
}
@@ -1306,7 +1309,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);
}
@@ -1329,6 +1332,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