aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcfreetype.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-03-25 10:20:34 +0100
committermarha <marha@users.sourceforge.net>2013-04-11 11:13:37 +0200
commitdde22e946ccfb0bd937224daf42403b80528c2a6 (patch)
treec4235cb922c8cd854bc3ef2e670bb6802dc743de /fontconfig/src/fcfreetype.c
parentaccd8a3364ffd1e91a4ab52b06b5e3b9d250ae92 (diff)
downloadvcxsrv-dde22e946ccfb0bd937224daf42403b80528c2a6.tar.gz
vcxsrv-dde22e946ccfb0bd937224daf42403b80528c2a6.tar.bz2
vcxsrv-dde22e946ccfb0bd937224daf42403b80528c2a6.zip
fontconfig mesa pixman xserver git update 25 Mar 2013
xserver commit 2967391c6d35f03121afa8003e0fb94b62495129 pixman commit d8ac35af1208a4fa4d67f03fee10b5449fb8495a fontconfig commit b561ff2016ce84eef3c81f16dfb0481be6a13f9b mesa commit 92b8a37fdfff9e83f39b8885f51ed2f60326ab6a
Diffstat (limited to 'fontconfig/src/fcfreetype.c')
-rw-r--r--fontconfig/src/fcfreetype.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c
index 9bd789ca3..8a037c059 100644
--- a/fontconfig/src/fcfreetype.c
+++ b/fontconfig/src/fcfreetype.c
@@ -1101,6 +1101,8 @@ FcFreeTypeQueryFace (const FT_Face face,
FcChar8 *style = 0;
int st;
+ char psname[256];
+ const char *tmp;
FcChar8 *hashstr;
@@ -1201,7 +1203,6 @@ FcFreeTypeQueryFace (const FT_Face face,
case TT_NAME_ID_PREFERRED_FAMILY:
case TT_NAME_ID_FONT_FAMILY:
#if 0
- case TT_NAME_ID_PS_NAME:
case TT_NAME_ID_UNIQUE_ID:
#endif
if (FcDebug () & FC_DBG_SCANV)
@@ -1347,6 +1348,52 @@ FcFreeTypeQueryFace (const FT_Face face,
++nfamily;
}
+ /* Add the PostScript name into the cache */
+ tmp = FT_Get_Postscript_Name (face);
+ if (!tmp)
+ {
+ FcChar8 *family, *familylang = NULL;
+ size_t len;
+ int n = 0;
+
+ /* Workaround when FT_Get_Postscript_Name didn't give any name.
+ * try to find out the English family name and convert.
+ */
+ while (FcPatternObjectGetString (pat, FC_FAMILYLANG_OBJECT, n, &familylang) == FcResultMatch)
+ {
+ if (FcStrCmp (familylang, (const FcChar8 *)"en") == 0)
+ break;
+ n++;
+ familylang = NULL;
+ }
+ if (!familylang)
+ n = 0;
+
+ if (FcPatternObjectGetString (pat, FC_FAMILY_OBJECT, n, &family) != FcResultMatch)
+ goto bail1;
+ len = strlen ((const char *)family);
+ /* the literal name in PostScript Language is limited to 127 characters though,
+ * It is the architectural limit. so assuming 255 characters may works enough.
+ */
+ for (i = 0; i < len && i < 255; i++)
+ {
+ /* those characters are not allowed to be the literal name in PostScript */
+ static const char exclusive_chars[] = "\x04()/<>[]{}\t\f\r\n ";
+
+ if (strchr(exclusive_chars, family[i]) != NULL)
+ psname[i] = '-';
+ else
+ psname[i] = family[i];
+ }
+ psname[i] = 0;
+ }
+ else
+ {
+ strcpy (psname, tmp);
+ }
+ if (!FcPatternAddString (pat, FC_POSTSCRIPT_NAME, (const FcChar8 *)psname))
+ goto bail1;
+
if (!FcPatternAddString (pat, FC_FILE, file))
goto bail1;