aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/doc/fontconfig-user.sgml2
-rw-r--r--fontconfig/src/fccfg.c6
-rw-r--r--fontconfig/src/fcdir.c4
-rw-r--r--fontconfig/src/fcrange.c2
-rw-r--r--fontconfig/src/fcxml.c23
-rw-r--r--fontconfig/test/Makefile.am7
-rw-r--r--fontconfig/test/test-bz89617.c38
7 files changed, 75 insertions, 7 deletions
diff --git a/fontconfig/doc/fontconfig-user.sgml b/fontconfig/doc/fontconfig-user.sgml
index ac9d8079e..7b4ad7408 100644
--- a/fontconfig/doc/fontconfig-user.sgml
+++ b/fontconfig/doc/fontconfig-user.sgml
@@ -323,7 +323,7 @@ a directory in the users home directory. If 'prefix' is set to "xdg", the value
The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
named ``<literal>&lt;hash value&gt;</literal>-<literal>&lt;architecture&gt;</literal>.cache-<literal>&lt;version&gt;</literal>'',
where <literal>&lt;version&gt;</literal> is the font configureation file
-version number (currently 3).
+version number (currently 5).
</para></refsect2>
<refsect2><title><literal>&lt;include ignore_missing="no" prefix="default"&gt;</literal></title><para>
This element contains the name of an additional configuration file or
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index b92270b64..cc2d9ee63 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -1843,6 +1843,7 @@ FcConfigSubstitute (FcConfig *config,
#if defined (_WIN32)
static FcChar8 fontconfig_path[1000] = ""; /* MT-dontcare */
+FcChar8 fontconfig_instprefix[1000] = ""; /* MT-dontcare */
# if (defined (PIC) || defined (DLL_EXPORT))
@@ -1877,6 +1878,7 @@ DllMain (HINSTANCE hinstDLL,
if (p && (FcStrCmpIgnoreCase (p + 1, (const FcChar8 *) "bin") == 0 ||
FcStrCmpIgnoreCase (p + 1, (const FcChar8 *) "lib") == 0))
*p = '\0';
+ strcat ((char *) fontconfig_instprefix, (char *) fontconfig_path);
strcat ((char *) fontconfig_path, "\\etc\\fonts");
}
else
@@ -2227,7 +2229,9 @@ FcConfigAppFontAddFile (FcConfig *config,
FcStrSetDestroy (subdirs);
return FcFalse;
}
- if ((sublist = FcStrListCreate (subdirs)))
+ if (subdirs->num == 0)
+ ret = FcTrue;
+ else if ((sublist = FcStrListCreate (subdirs)))
{
while ((subdir = FcStrListNext (sublist)))
{
diff --git a/fontconfig/src/fcdir.c b/fontconfig/src/fcdir.c
index 593382f43..2e7f0dc7c 100644
--- a/fontconfig/src/fcdir.c
+++ b/fontconfig/src/fcdir.c
@@ -136,8 +136,8 @@ FcFileScanFontConfig (FcFontSet *set,
ret = FcFalse;
}
}
- else if (font)
- FcPatternDestroy (font);
+ else
+ ret = FcFalse;
id++;
} while (font && ret && id < count);
return ret;
diff --git a/fontconfig/src/fcrange.c b/fontconfig/src/fcrange.c
index 37cf06755..9b1b67b82 100644
--- a/fontconfig/src/fcrange.c
+++ b/fontconfig/src/fcrange.c
@@ -204,7 +204,7 @@ FcRangeHash (const FcRange *r)
{
FcRange c = FcRangeCanonicalize (r);
int b = (int) (c.u.d.begin * 100);
- int e = (int) (c.u.d.end * 100);
+ int e = FcDoubleCmpEQ (c.u.d.end, DBL_MAX) ? INT_MAX : (int) (c.u.d.end * 100);
return b ^ (b << 1) ^ (e << 9);
}
diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c
index cdb14b67c..9a6f08d27 100644
--- a/fontconfig/src/fcxml.c
+++ b/fontconfig/src/fcxml.c
@@ -54,6 +54,7 @@
#ifdef _WIN32
#include <mbstring.h>
+extern FcChar8 fontconfig_instprefix[];
#endif
static void
@@ -2187,7 +2188,25 @@ FcParseCacheDir (FcConfigParse *parse)
data = prefix;
}
#ifdef _WIN32
- if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0)
+ else if (data[0] == '/' && fontconfig_instprefix[0] != '\0')
+ {
+ size_t plen = strlen ((const char *)fontconfig_instprefix);
+ size_t dlen = strlen ((const char *)data);
+
+ prefix = malloc (plen + 1 + dlen + 1);
+ if (!prefix)
+ {
+ FcConfigMessage (parse, FcSevereError, "out of memory");
+ goto bail;
+ }
+ strcpy ((char *) prefix, (char *) fontconfig_instprefix);
+ prefix[plen] = FC_DIR_SEPARATOR;
+ memcpy (&prefix[plen + 1], data, dlen);
+ prefix[plen + 1 + dlen] = 0;
+ FcStrFree (data);
+ data = prefix;
+ }
+ else if (strcmp ((const char *) data, "WINDOWSTEMPDIR_FONTCONFIG_CACHE") == 0)
{
int rc;
FcStrFree (data);
@@ -2265,8 +2284,8 @@ FcParseInclude (FcConfigParse *parse)
attr = FcConfigGetAttribute (parse, "ignore_missing");
if (attr && FcConfigLexBool (parse, (FcChar8 *) attr) == FcTrue)
ignore_missing = FcTrue;
-#ifndef _WIN32
attr = FcConfigGetAttribute (parse, "deprecated");
+#ifndef _WIN32
if (attr && FcConfigLexBool (parse, (FcChar8 *) attr) == FcTrue)
deprecated = FcTrue;
#endif
diff --git a/fontconfig/test/Makefile.am b/fontconfig/test/Makefile.am
index f270b5071..bf1ec24a2 100644
--- a/fontconfig/test/Makefile.am
+++ b/fontconfig/test/Makefile.am
@@ -24,6 +24,13 @@ test_pthread_LDADD = $(top_builddir)/src/libfontconfig.la
# to meaningfully test anything, and we are not installed yet.
#TESTS += test-pthread
endif
+check_PROGRAMS += test-bz89617
+test_bz89617_CFLAGS = \
+ -DSRCDIR="\"$(abs_srcdir)\""
+
+test_bz89617_LDADD = $(top_builddir)/src/libfontconfig.la
+TESTS += test-bz89617
+
noinst_PROGRAMS = $(check_PROGRAMS)
if !OS_WIN32
diff --git a/fontconfig/test/test-bz89617.c b/fontconfig/test/test-bz89617.c
new file mode 100644
index 000000000..389f47094
--- /dev/null
+++ b/fontconfig/test/test-bz89617.c
@@ -0,0 +1,38 @@
+/*
+ * fontconfig/test/test-bz89617.c
+ *
+ * Copyright © 2000 Keith Packard
+ * Copyright © 2015 Akira TAGOH
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <stdio.h>
+#include <fontconfig/fontconfig.h>
+
+int
+main (void)
+{
+ FcConfig *config = FcConfigGetCurrent ();
+
+ if (!FcConfigAppFontAddFile (config, SRCDIR "/4x6.pcf") ||
+ FcConfigAppFontAddFile (config, "/dev/null"))
+ return 1;
+
+ return 0;
+}