aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-16 08:45:43 +0100
committermarha <marha@users.sourceforge.net>2013-01-16 08:45:43 +0100
commitb8219a4680768e14b7fe4930adf86e9be261b31f (patch)
tree193855ef8d48765d67cc11153a15e3c1e2568e50 /fontconfig
parent15cdb95b194cb051a5d469cc9eb73eb0eed4db41 (diff)
parent811d1bcf6d61ea49551abdd7f2294c5af2776913 (diff)
downloadvcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.tar.gz
vcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.tar.bz2
vcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.zip
Merge remote-tracking branch 'origin/released'
* origin/released: Switched to xcalc-1.0.5 Switched to bdftopcf-1.0.4 libxtrans fontconfig glproto libX11 libXau libXext libXft libXinerama libXmu libfontenc mesa xkeyboard-config
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/configure.ac2
-rw-r--r--fontconfig/doc/fontconfig-devel.sgml3
-rw-r--r--fontconfig/doc/fontconfig-user.sgml2
-rw-r--r--fontconfig/fontconfig/fontconfig.h2
-rw-r--r--fontconfig/src/fccfg.c7
-rw-r--r--fontconfig/src/fccompat.c6
-rw-r--r--fontconfig/src/fcdefault.c85
-rw-r--r--fontconfig/src/fcint.h3
-rw-r--r--fontconfig/src/fcobjs.h2
9 files changed, 108 insertions, 4 deletions
diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac
index 06ac8a2e7..a520ae70d 100644
--- a/fontconfig/configure.ac
+++ b/fontconfig/configure.ac
@@ -141,7 +141,7 @@ AC_TYPE_PID_T
# Checks for library functions.
AC_FUNC_VPRINTF
AC_FUNC_MMAP
-AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp mkostemp _mktemp_s strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree fstatvfs fstatfs lstat])
+AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp mkostemp _mktemp_s strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror readlink regexec regfree fstatvfs fstatfs lstat])
dnl AC_CHECK_FUNCS doesn't check for header files.
dnl posix_fadvise() may be not available in older libc.
diff --git a/fontconfig/doc/fontconfig-devel.sgml b/fontconfig/doc/fontconfig-devel.sgml
index 79cceb1ec..05c5c0928 100644
--- a/fontconfig/doc/fontconfig-devel.sgml
+++ b/fontconfig/doc/fontconfig-devel.sgml
@@ -190,9 +190,12 @@ convenience for the application's rendering mechanism.
the font
embolden FC_EMBOLDEN Bool Rasterizer should
synthetically embolden the font
+ fontfeatures FC_FONT_FEATURES String List of extra feature tags in
+ OpenType to be enabled
namelang FC_NAMELANG String Language name to be used for the
default value of familylang,
stylelang and fullnamelang
+ prgname FC_PRGNAME String Name of the running program
</programlisting>
</sect2>
</sect1>
diff --git a/fontconfig/doc/fontconfig-user.sgml b/fontconfig/doc/fontconfig-user.sgml
index c842371ec..90e246b69 100644
--- a/fontconfig/doc/fontconfig-user.sgml
+++ b/fontconfig/doc/fontconfig-user.sgml
@@ -131,6 +131,8 @@ convenience for the applications' rendering mechanism.
fontversion Int Version number of the font
capability String List of layout capabilities in the font
embolden Bool Rasterizer should synthetically embolden the font
+ fontfeatures String List of the feature tags in OpenType to be enabled
+ prgname String String Name of the running program
</programlisting>
</refsect2>
<refsect2>
diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h
index 52e9438fe..dc2532ff4 100644
--- a/fontconfig/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig/fontconfig.h
@@ -112,7 +112,9 @@ typedef int FcBool;
#define FC_EMBEDDED_BITMAP "embeddedbitmap" /* Bool - true to enable embedded bitmaps */
#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */
#define FC_LCD_FILTER "lcdfilter" /* Int */
+#define FC_FONT_FEATURES "fontfeatures" /* String */
#define FC_NAMELANG "namelang" /* String RFC 3866 langs */
+#define FC_PRGNAME "prgname" /* String */
#define FC_CACHE_SUFFIX ".cache-" FC_CACHE_VERSION
#define FC_DIR_CACHE_FILE "fonts.cache-" FC_CACHE_VERSION
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index 877a4f57e..3e9fdaba4 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -1478,6 +1478,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
FcPattern *p_pat,
FcMatchKind kind)
{
+ FcValue v;
FcSubst *s;
FcSubState *st;
int i;
@@ -1513,6 +1514,12 @@ FcConfigSubstituteWithPat (FcConfig *config,
}
FcStrListDone (l);
}
+ if (FcPatternObjectGet (p, FC_PRGNAME_OBJECT, 0, &v) == FcResultNoMatch)
+ {
+ FcChar8 *prgname = FcGetPrgname ();
+ if (prgname)
+ FcPatternObjectAddString (p, FC_PRGNAME_OBJECT, prgname);
+ }
break;
case FcMatchFont:
s = config->substFont;
diff --git a/fontconfig/src/fccompat.c b/fontconfig/src/fccompat.c
index 169cab9ed..2aa29ddcc 100644
--- a/fontconfig/src/fccompat.c
+++ b/fontconfig/src/fccompat.c
@@ -100,7 +100,11 @@ FcMakeTempfile (char *template)
return -1;
fd = FcOpen(template, O_RDWR | O_EXCL | O_CREAT, 0600);
#else
-#error no secure functions to create a temporary file
+ /* warn at the runtime for just debugging purpose why something may
+ * goes wrong. mingw may not have one, but it shouldn't be reached since
+ * this function isn't used so far.
+ */
+ fprintf(stderr, "Fontconfig warning: No secure functions to create a temporary file\n");
#endif
return fd;
diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c
index 6937994b7..aa47840d1 100644
--- a/fontconfig/src/fcdefault.c
+++ b/fontconfig/src/fcdefault.c
@@ -104,11 +104,81 @@ retry:
return lang;
}
+static FcChar8 *default_prgname;
+
+FcChar8 *
+FcGetPrgname (void)
+{
+ FcChar8 *prgname;
+retry:
+ prgname = fc_atomic_ptr_get (&default_prgname);
+ if (!prgname)
+ {
+#ifdef _WIN32
+ char buf[MAX_PATH+1];
+
+ /* TODO This is ASCII-only; fix it. */
+ if (GetModuleFileNameA (GetModuleHandle (NULL), buf, sizeof (buf) / sizeof (buf[0])) > 0)
+ {
+ char *p;
+ unsigned int len;
+
+ p = strrchr (buf, '\\');
+ if (p)
+ p++;
+ else
+ p = buf;
+
+ len = strlen (p);
+
+ if (len > 4 && 0 == strcmp (p + len - 4, ".exe"))
+ {
+ len -= 4;
+ buf[len] = '\0';
+ }
+
+ prgname = FcStrdup (p);
+ }
+#else
+ char buf[8192];
+ unsigned int len;
+
+ len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
+ if (len > 0)
+ {
+ char *p;
+
+ p = strrchr (buf, '/');
+ if (p)
+ p++;
+ else
+ p = buf;
+
+ prgname = FcStrdup (p);
+ }
+#endif
+
+ if (!prgname)
+ prgname = FcStrdup ("");
+
+ if (!fc_atomic_ptr_cmpexch (&default_prgname, NULL, prgname)) {
+ free (prgname);
+ goto retry;
+ }
+ }
+
+ if (prgname && !prgname[0])
+ return NULL;
+
+ return prgname;
+}
+
void
FcDefaultFini (void)
{
FcChar8 *lang;
FcStrSet *langs;
+ FcChar8 *prgname;
lang = fc_atomic_ptr_get (&default_lang);
if (lang && fc_atomic_ptr_cmpexch (&default_lang, lang, NULL)) {
@@ -120,6 +190,11 @@ FcDefaultFini (void)
FcRefInit (&langs->ref, 1);
FcStrSetDestroy (langs);
}
+
+ prgname = fc_atomic_ptr_get (&default_prgname);
+ if (prgname && fc_atomic_ptr_cmpexch (&default_prgname, prgname, NULL)) {
+ free (prgname);
+ }
}
void
@@ -195,7 +270,7 @@ FcDefaultSubstitute (FcPattern *pattern)
* exact matched "en" has higher score than ll-cc.
*/
v2.type = FcTypeString;
- v2.u.s = FcStrdup ("en-us");
+ v2.u.s = (FcChar8 *) "en-us";
if (FcPatternObjectGet (pattern, FC_FAMILYLANG_OBJECT, 0, &v) == FcResultNoMatch)
{
FcPatternObjectAdd (pattern, FC_FAMILYLANG_OBJECT, namelang, FcTrue);
@@ -211,7 +286,13 @@ FcDefaultSubstitute (FcPattern *pattern)
FcPatternObjectAdd (pattern, FC_FULLNAMELANG_OBJECT, namelang, FcTrue);
FcPatternObjectAddWithBinding (pattern, FC_FULLNAMELANG_OBJECT, v2, FcValueBindingWeak, FcTrue);
}
- FcFree (v2.u.s);
+
+ if (FcPatternObjectGet (pattern, FC_PRGNAME_OBJECT, 0, &v) == FcResultNoMatch)
+ {
+ FcChar8 *prgname = FcGetPrgname ();
+ if (prgname)
+ FcPatternObjectAddString (pattern, FC_PRGNAME_OBJECT, prgname);
+ }
}
#define __fcdefault__
#include "fcaliastail.h"
diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h
index 512926797..3cf526f3d 100644
--- a/fontconfig/src/fcint.h
+++ b/fontconfig/src/fcint.h
@@ -770,6 +770,9 @@ FcInitDebug (void);
FcPrivate FcChar8 *
FcGetDefaultLang (void);
+FcPrivate FcChar8 *
+FcGetPrgname (void);
+
FcPrivate void
FcDefaultFini (void);
diff --git a/fontconfig/src/fcobjs.h b/fontconfig/src/fcobjs.h
index 1e9067e21..ad803eb13 100644
--- a/fontconfig/src/fcobjs.h
+++ b/fontconfig/src/fcobjs.h
@@ -41,4 +41,6 @@ FC_OBJECT (EMBEDDED_BITMAP, FcTypeBool)
FC_OBJECT (DECORATIVE, FcTypeBool)
FC_OBJECT (LCD_FILTER, FcTypeInteger)
FC_OBJECT (NAMELANG, FcTypeString)
+FC_OBJECT (FONT_FEATURES, FcTypeString)
+FC_OBJECT (PRGNAME, FcTypeString)
/* ^-------------- Add new objects here. */