diff --git a/Makefile.am b/Makefile.am
index 2b949e4..2b4a5b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-SUBDIRS=fontconfig fc-case fc-lang fc-glyphname src \
+SUBDIRS=fontconfig fc-blanks fc-case fc-lang fc-glyphname src \
fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \
fc-validate conf.d test
if ENABLE_DOCS
diff --git a/configure.ac b/configure.ac
index 9141d3d..8f0150e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,7 @@ m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/
AM_MISSING_PROG([GIT], [git])
AM_MISSING_PROG([GPERF], [gperf])
+AM_PATH_PYTHON
AC_MSG_CHECKING([for RM macro])
_predefined_rm=`make -p -f /dev/null 2>/dev/null|grep '^RM ='|sed -e 's/^RM = //'`
@@ -697,6 +698,7 @@ Makefile
fontconfig/Makefile
fc-lang/Makefile
fc-glyphname/Makefile
+fc-blanks/Makefile
fc-case/Makefile
src/Makefile
conf.d/Makefile
diff --git a/fc-blanks/Makefile.am b/fc-blanks/Makefile.am
new file mode 100644
index 0000000..f9c2486
--- /dev/null
+++ b/fc-blanks/Makefile.am
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+#
+# Copyright © 2003 Keith Packard
+#
+# 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.
+
+NULL =
+BLANKSPY = fc-blanks.py
+BLANKS_H = fcblanks.h
+TMPL = fcblanks.tmpl.h
+noinst_SCRIPTS = $(BLANKSPY)
+noinst_HEADERS = $(BLANKS_H)
+
+$(BLANKS_H): $(BLANKSPY) $(TMPL)
+ $(AM_V_GEN) $(PYTHON) $(BLANKSPY) < $(TMPL) > $(BLANKS_H).tmp && \
+ mv $(BLANKS_H).tmp $(BLANKS_H) || ($(RM) $(BLANKS_H).tmp && false)
+
+EXTRA_DIST = \
+ $(BLANKS_H) \
+ $(TMPL) \
+ $(NULL)
+DISTCLEANFILES = $(BLANKS_H)
+
+-include $(top_srcdir)/git.mk
diff --git a/fc-blanks/fc-blanks.py b/fc-blanks/fc-blanks.py
new file mode 100755
index 0000000..fb01614
--- /dev/null
+++ b/fc-blanks/fc-blanks.py
@@ -0,0 +1,125 @@
+#! /usr/bin/python
+
+import urllib2
+import sys
+from lxml import html
+
+fp = urllib2.urlopen('http://unicode.org/cldr/utility/list-unicodeset.jsp?a=[%3AGC%3DZs%3A][%3ADI%3A]&abb=on&ucd=on&esc=on&g')
+data = fp.read()
+fp.close()
+
+dom = html.fromstring(data)
+x = dom.xpath('/html/body/form/p/text()')
+p = x[1]
+if p[0] == '[' and p[-1] == ']':
+ p = p.replace('[', '').replace(']', '')
+else:
+ sys.exit(1)
+fescape = False
+funicode = False
+frange = False
+fprocess = False
+v = 0
+vbegin = 0
+vend = 0
+n = 0
+l = []
+
+def insert(db, begin, end):
+ db.append([begin, end])
+
+for i in p:
+ if i == '\\':
+ if n > 0:
+ if frange == True and funicode == True:
+ vend = v
+ insert(l, vbegin, vend)
+ fprocess = True
+ elif funicode == True:
+ vbegin = v
+ vend = v
+ insert(l, vbegin, vend)
+ fprocess = True
+ funicode = False
+ fescape = True
+ elif i.lower() == 'u' and fescape == True:
+ funicode = True
+ elif i >= '0' and i <= '9' or i.lower() >= 'a' and i.lower() <= 'f':
+ if funicode == True:
+ v <<= 4
+ v += int(i, 16)
+ else:
+ raise RuntimeError, "Unable to parse Unicode"
+ elif i == ' ':
+ if frange == True and funicode == True:
+ vend = v
+ insert(l, vbegin, vend)
+ fprocess = True
+ elif funicode == True:
+ vbegin = v
+ vend = v
+ insert(l, vbegin, vend)
+ fprocess = True
+ fescape = False
+ funicode = False
+ frange = False
+ elif i == '-':
+ vbegin = v
+ v = 0
+ fescape = False
+ funicode = False
+ frange = True
+ else:
+ raise RuntimeError, "Unable to parse Unicode: %s" % i
+
+ if fprocess == True:
+ vbegin = 0
+ vend = 0
+ v = 0
+ fprocess = False
+ funicode = False
+ frange = False
+ n += 1
+
+if frange == True and funicode == True:
+ vend = v
+ insert(l, vbegin, vend)
+elif funicode == True:
+ vbegin = vend = v
+ insert(l, vbegin, vend)
+
+# somewhat missing 0x0020 in the list of code from Unicode Utilities
+insert(l, 0x0020, 0x0020)
+ncode = 0
+for i in l:
+ ncode += (i[1] - i[0] + 1)
+
+a = int(x[0].split(' ')[0].replace(',', ''))
+if a != ncode:
+ sys.stderr.write("Unexpected the amount of code points: %d (expected %d)\n" % (ncode, a))
+ sys.exit(1)
+insert(l, 0x2800, 0x2800)
+
+while True:
+ s = sys.stdin.readline().rstrip()
+ if s == "@@@":
+ break
+ print s
+
+print "static FcChar32 _fcBlanks[%s] = {" % (ncode + 1)
+k = 0
+for i in sorted(l, key=lambda(a): a[0]):
+ for j in range(i[0], i[1] + 1):
+ if k != 0:
+ print ","
+ print " 0x%04x" % j,
+ k += 1
+
+print "};"
+print '''
+static FcBlanks fcBlanks = {
+ %s,
+ -1,
+ _fcBlanks
+};
+''' % (ncode + 1)
diff --git a/fc-blanks/fcblanks.tmpl.h b/fc-blanks/fcblanks.tmpl.h
new file mode 100644
index 0000000..2bcaa21
--- /dev/null
+++ b/fc-blanks/fcblanks.tmpl.h
@@ -0,0 +1,25 @@
+/*
+ * fontconfig/fc-blanks/fcblanks.tmpl.h
+ *
+ * Copyright © 2003 Keith Packard
+ *
+ * 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.
+ */
+
+@@@
diff --git a/fonts.conf.in b/fonts.conf.in
index f63ada1..7c16a70 100644
--- a/fonts.conf.in
+++ b/fonts.conf.in
@@ -78,74 +78,6 @@
~/.fontconfig
-
-
- 0x0020
- 0x00A0
- 0x00AD
- 0x034F
- 0x061C
- 0x115F
- 0x1160
- 0x1680
- 0x17B4
- 0x17B5
- 0x180B
- 0x180C
- 0x180D
- 0x180E
- 0x2000
- 0x2001
- 0x2002
- 0x2003
- 0x2004
- 0x2005
- 0x2006
- 0x2007
- 0x2008
- 0x2009
- 0x200A
- 0x200B
- 0x200C
- 0x200D
- 0x200E
- 0x200F
- 0x202A
- 0x202B
- 0x202C
- 0x202D
- 0x202E
- 0x202F
- 0x205F
- 0x2060
- 0x2061
- 0x2062
- 0x2063
- 0x2064
- 0x2066
- 0x2067
- 0x2068
- 0x2069
- 0x206A
- 0x206B
- 0x206C
- 0x206D
- 0x206E
- 0x206F
- 0x2800
- 0x3000
- 0x3164
- 0xFEFF
- 0xFFA0
- 0x1BCA0
- 0x1BCA1
- 0x1BCA2
- 0x1BCA3
-
diff --git a/src/fcblanks.c b/src/fcblanks.c
index 46698bc..49f520b 100644
--- a/src/fcblanks.c
+++ b/src/fcblanks.c
@@ -41,6 +41,8 @@ FcBlanksCreate (void)
void
FcBlanksDestroy (FcBlanks *b)
{
+ if (b->sblank == -1)
+ return;
if (b->blanks)
free (b->blanks);
free (b);
@@ -56,6 +58,11 @@ FcBlanksAdd (FcBlanks *b, FcChar32 ucs4)
if (b->blanks[sblank] == ucs4)
return FcTrue;
+ if (b->sblank == -1)
+ {
+ fprintf (stderr, "Unable to update the static FcBlanks: 0x%04x\n", ucs4);
+ return FcTrue;
+ }
if (b->nblank == b->sblank)
{
sblank = b->sblank + 32;
diff --git a/src/fccfg.c b/src/fccfg.c
index b27ab0b..e2f7ea8 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -27,6 +27,7 @@
#include "fcint.h"
#include
#include
+#include "../fc-blanks/fcblanks.h"
#if defined (_WIN32) && !defined (R_OK)
#define R_OK 4
@@ -109,7 +110,7 @@ FcConfigCreate (void)
if (!config->cacheDirs)
goto bail8;
- config->blanks = 0;
+ config->blanks = &fcBlanks;
config->substPattern = 0;
config->substFont = 0;