diff --git a/.fontconfig.metadata b/.fontconfig.metadata
index 65e0d65..cf56cad 100644
--- a/.fontconfig.metadata
+++ b/.fontconfig.metadata
@@ -1 +1 @@
-f9f4a25b730a9c56f951db6fec639ddeeb92a9d4 SOURCES/fontconfig-2.10.95.tar.bz2
+b7bcc5d47211b7bbac35bb221860407db3601f5b SOURCES/fontconfig-2.13.0.tar.bz2
diff --git a/.gitignore b/.gitignore
index d9863e9..52cbde1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/fontconfig-2.10.95.tar.bz2
+SOURCES/fontconfig-2.13.0.tar.bz2
diff --git a/SOURCES/FcStrListFirst.3 b/SOURCES/FcStrListFirst.3
deleted file mode 100644
index f8a46e8..0000000
--- a/SOURCES/FcStrListFirst.3
+++ /dev/null
@@ -1,16 +0,0 @@
-.\" auto-generated by docbook2man-spec from docbook-utils package
-.TH "FcStrListFirst" "3" "09 10月 2013" "" ""
-.SH NAME
-FcStrListFirst \- get first string in iteration
-.SH SYNOPSIS
-.nf
-\fB#include <fontconfig/fontconfig.h>
-.sp
-void FcStrListFirst (FcStrList *\fIlist\fB);
-.fi\fR
-.SH "DESCRIPTION"
-.PP
-Returns the first string in \fIlist\fR\&.
-.SH "VERSION"
-.PP
-Fontconfig version 2.10.95
diff --git a/SOURCES/fc-cache b/SOURCES/fc-cache
new file mode 100755
index 0000000..6a12446
--- /dev/null
+++ b/SOURCES/fc-cache
@@ -0,0 +1,4 @@
+#! /bin/sh
+
+[ -x /usr/bin/fc-cache-32 ] && /usr/bin/fc-cache-32 $@ || :
+[ -x /usr/bin/fc-cache-64 ] && /usr/bin/fc-cache-64 $@ || :
diff --git a/SOURCES/fontconfig-2.8.0-sleep-less.patch b/SOURCES/fontconfig-2.8.0-sleep-less.patch
deleted file mode 100644
index 5b14431..0000000
--- a/SOURCES/fontconfig-2.8.0-sleep-less.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -pruN fontconfig-2.8.90.orig/fc-cache/fc-cache.c fontconfig-2.8.90/fc-cache/fc-cache.c
---- fontconfig-2.8.90.orig/fc-cache/fc-cache.c	2012-02-20 12:49:18.000000000 +0900
-+++ fontconfig-2.8.90/fc-cache/fc-cache.c	2012-03-06 12:28:26.000000000 +0900
-@@ -465,7 +465,7 @@ main (int argc, char **argv)
-     FcConfigDestroy (config);
-     FcFini ();
-     if (changed)
--	sleep (2);
-+	sleep (1);
-     if (verbose)
- 	printf ("%s: %s\n", argv[0], ret ? "failed" : "succeeded");
-     return ret;
diff --git a/SOURCES/fontconfig-const-name-in-range.patch b/SOURCES/fontconfig-const-name-in-range.patch
new file mode 100644
index 0000000..728c2c3
--- /dev/null
+++ b/SOURCES/fontconfig-const-name-in-range.patch
@@ -0,0 +1,60 @@
+From 198358dd8ff858c9e36531a7406ccb2246ae77b7 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Mon, 12 Mar 2018 11:49:58 +0900
+Subject: [PATCH] Allow the constant names in the range
+
+https://bugs.freedesktop.org/show_bug.cgi?id=105415
+---
+ src/fcname.c | 34 +++++++++++++++++++++++++++++-----
+ 1 file changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/src/fcname.c b/src/fcname.c
+index 79e413e..15fb659 100644
+--- a/src/fcname.c
++++ b/src/fcname.c
+@@ -330,13 +330,37 @@ FcNameConvert (FcType type, FcChar8 *string)
+     case FcTypeRange:
+ 	if (sscanf ((char *) string, "[%lg %lg]", &b, &e) != 2)
+ 	{
+-	    v.u.d = strtod ((char *) string, &p);
+-	    if (p != NULL && p[0] != 0)
++	    char *sc, *ec;
++	    size_t len = strlen ((const char *) string);
++	    int si, ei;
++
++	    sc = malloc (len);
++	    ec = malloc (len);
++	    if (sc && ec && sscanf ((char *) string, "[%s %[^]]]", sc, ec) == 2)
+ 	    {
+-		v.type = FcTypeVoid;
+-		break;
++		if (FcNameConstant ((const FcChar8 *) sc, &si) &&
++		    FcNameConstant ((const FcChar8 *) ec, &ei))
++		    v.u.r =  FcRangeCreateDouble (si, ei);
++		else
++		    goto bail1;
++	    }
++	    else
++	    {
++	    bail1:
++		v.type = FcTypeDouble;
++		if (FcNameConstant (string, &si))
++		{
++		    v.u.d = (double) si;
++		} else {
++		    v.u.d = strtod ((char *) string, &p);
++		    if (p != NULL && p[0] != 0)
++			v.type = FcTypeVoid;
++		}
+ 	    }
+-	    v.type = FcTypeDouble;
++	    if (sc)
++		free (sc);
++	    if (ec)
++		free (ec);
+ 	}
+ 	else
+ 	    v.u.r = FcRangeCreateDouble (b, e);
+-- 
+2.14.3
+
diff --git a/SOURCES/fontconfig-copy-all-value.patch b/SOURCES/fontconfig-copy-all-value.patch
deleted file mode 100644
index 92634aa..0000000
--- a/SOURCES/fontconfig-copy-all-value.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 5e6b8894ea9d03caabdfc3a6bcd0c402edf840a8 Mon Sep 17 00:00:00 2001
-From: Akira TAGOH <akira@tagoh.org>
-Date: Wed, 18 Sep 2013 17:31:10 +0900
-Subject: [PATCH] Copy all values from the font to the pattern if the pattern
- doesn't have the element
-
----
- src/fcmatch.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/src/fcmatch.c b/src/fcmatch.c
-index dec92b9..627aa1a 100644
---- a/src/fcmatch.c
-+++ b/src/fcmatch.c
-@@ -552,14 +552,16 @@ FcFontRenderPrepare (FcConfig	    *config,
- 
- 		continue;
- 	    }
-+	    FcPatternObjectAdd (new, fe->object, v, FcFalse);
- 	}
- 	else
- 	{
- 	    if (fel)
- 		goto copy_lang;
--	    v = FcValueCanonicalize(&FcPatternEltValues (fe)->value);
-+	    FcPatternObjectListAdd (new, fe->object,
-+				    FcValueListDuplicate (FcPatternEltValues (fe)),
-+				    FcTrue);
- 	}
--	FcPatternObjectAdd (new, fe->object, v, FcFalse);
-     }
-     for (i = 0; i < pat->num; i++)
-     {
--- 
-1.8.3.1
-
diff --git a/SOURCES/fontconfig-drop-incompatible-conf.patch b/SOURCES/fontconfig-drop-incompatible-conf.patch
new file mode 100644
index 0000000..ae79a23
--- /dev/null
+++ b/SOURCES/fontconfig-drop-incompatible-conf.patch
@@ -0,0 +1,525 @@
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-autohint.conf fontconfig-2.13.0/conf.d/10-autohint.conf
+--- fontconfig-2.13.0.orig/conf.d/10-autohint.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-autohint.conf	2018-06-08 17:56:13.942291063 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Enable autohinter</description>
+ <!--  Use the Autohinter --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-hinting-full.conf fontconfig-2.13.0/conf.d/10-hinting-full.conf
+--- fontconfig-2.13.0.orig/conf.d/10-hinting-full.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-hinting-full.conf	2018-06-08 17:56:19.729380613 +0900
+@@ -1,12 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set hintfull to hintstyle</description>
+-
+   <match target="pattern">
+     <!--
+       This configuration is available on the major desktop environments.
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-hinting-medium.conf fontconfig-2.13.0/conf.d/10-hinting-medium.conf
+--- fontconfig-2.13.0.orig/conf.d/10-hinting-medium.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-hinting-medium.conf	2018-06-08 17:56:24.966461652 +0900
+@@ -1,12 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set hintmedium to hintstyle</description>
+-
+   <match target="pattern">
+     <!--
+       This configuration is available on the major desktop environments.
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-hinting-none.conf fontconfig-2.13.0/conf.d/10-hinting-none.conf
+--- fontconfig-2.13.0.orig/conf.d/10-hinting-none.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-hinting-none.conf	2018-06-08 17:56:29.968539055 +0900
+@@ -1,12 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set hintnone to hintstyle</description>
+-
+   <match target="pattern">
+     <!--
+       This configuration is available on the major desktop environments.
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-hinting-slight.conf fontconfig-2.13.0/conf.d/10-hinting-slight.conf
+--- fontconfig-2.13.0.orig/conf.d/10-hinting-slight.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-hinting-slight.conf	2018-06-08 17:56:34.839614432 +0900
+@@ -1,12 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set hintslight to hintstyle</description>
+-
+   <match target="pattern">
+     <!--
+       This configuration is available on the major desktop environments.
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-no-sub-pixel.conf fontconfig-2.13.0/conf.d/10-no-sub-pixel.conf
+--- fontconfig-2.13.0.orig/conf.d/10-no-sub-pixel.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-no-sub-pixel.conf	2018-06-08 17:56:40.138696429 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Disable sub-pixel rendering</description>
+ <!--  Disable sub-pixel rendering --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-scale-bitmap-fonts.conf fontconfig-2.13.0/conf.d/10-scale-bitmap-fonts.conf
+--- fontconfig-2.13.0.orig/conf.d/10-scale-bitmap-fonts.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-scale-bitmap-fonts.conf	2018-06-08 17:56:44.835769114 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Bitmap scaling</description>
+ <!--
+   If font is bitmap, calculate scale factor.
+   Note that color bitmap fonts have scalable=true, while
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-sub-pixel-bgr.conf fontconfig-2.13.0/conf.d/10-sub-pixel-bgr.conf
+--- fontconfig-2.13.0.orig/conf.d/10-sub-pixel-bgr.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-sub-pixel-bgr.conf	2018-06-08 17:56:49.304838268 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Enable sub-pixel rendering with the BGR stripes layout</description>
+ <!--  Enable sub-pixel rendering --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-sub-pixel-rgb.conf fontconfig-2.13.0/conf.d/10-sub-pixel-rgb.conf
+--- fontconfig-2.13.0.orig/conf.d/10-sub-pixel-rgb.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-sub-pixel-rgb.conf	2018-06-08 17:56:53.746907005 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Enable sub-pixel rendering with the RGB stripes layout</description>
+ <!--  Enable sub-pixel rendering --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-sub-pixel-vbgr.conf fontconfig-2.13.0/conf.d/10-sub-pixel-vbgr.conf
+--- fontconfig-2.13.0.orig/conf.d/10-sub-pixel-vbgr.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-sub-pixel-vbgr.conf	2018-06-08 17:56:58.421979349 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Enable sub-pixel rendering with the vertical BGR stripes layout</description>
+ <!--  Enable sub-pixel rendering --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-sub-pixel-vrgb.conf fontconfig-2.13.0/conf.d/10-sub-pixel-vrgb.conf
+--- fontconfig-2.13.0.orig/conf.d/10-sub-pixel-vrgb.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-sub-pixel-vrgb.conf	2018-06-08 17:57:02.654044835 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Enable sub-pixel rendering with the vertical RGB stripes layout</description>
+ <!--  Enable sub-pixel rendering --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/10-unhinted.conf fontconfig-2.13.0/conf.d/10-unhinted.conf
+--- fontconfig-2.13.0.orig/conf.d/10-unhinted.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/10-unhinted.conf	2018-06-08 17:57:06.878110200 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Disable hinting</description>
+ <!--  Disable hinting --> 
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/11-lcdfilter-default.conf fontconfig-2.13.0/conf.d/11-lcdfilter-default.conf
+--- fontconfig-2.13.0.orig/conf.d/11-lcdfilter-default.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/11-lcdfilter-default.conf	2018-06-08 17:57:11.396180113 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Use lcddefault as default for LCD filter</description>
+ <!--  Use lcddefault as default for LCD filter -->
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/11-lcdfilter-legacy.conf fontconfig-2.13.0/conf.d/11-lcdfilter-legacy.conf
+--- fontconfig-2.13.0.orig/conf.d/11-lcdfilter-legacy.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/11-lcdfilter-legacy.conf	2018-06-08 17:57:15.798248231 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Use lcdlegacy as default for LCD filter</description>
+ <!--  Use lcdlegacy as default for LCD filter -->
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/11-lcdfilter-light.conf fontconfig-2.13.0/conf.d/11-lcdfilter-light.conf
+--- fontconfig-2.13.0.orig/conf.d/11-lcdfilter-light.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/11-lcdfilter-light.conf	2018-06-08 17:57:20.037313826 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Use lcdlight as default for LCD filter</description>
+ <!--  Use lcdlight as default for LCD filter -->
+   <match target="pattern">
+     <!--
+diff -pruN fontconfig-2.13.0.orig/conf.d/20-unhint-small-vera.conf fontconfig-2.13.0/conf.d/20-unhint-small-vera.conf
+--- fontconfig-2.13.0.orig/conf.d/20-unhint-small-vera.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/20-unhint-small-vera.conf	2018-06-08 17:57:24.272379360 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Disable hinting for Bitstream Vera fonts when the size is less than 8ppem</description>
+ <!-- 
+ 	The Bitstream Vera fonts have GASP entries suggesting that hinting be
+ 	disabled below 8 ppem, but FreeType ignores those, preferring to use
+diff -pruN fontconfig-2.13.0.orig/conf.d/25-unhint-nonlatin.conf fontconfig-2.13.0/conf.d/25-unhint-nonlatin.conf
+--- fontconfig-2.13.0.orig/conf.d/25-unhint-nonlatin.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/25-unhint-nonlatin.conf	2018-06-08 17:57:28.646447045 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Disable hinting for CJK fonts</description>
+ <!-- We can't hint CJK fonts well, so turn off hinting for CJK fonts. -->
+ 
+ 	<match target="font">
+diff -pruN fontconfig-2.13.0.orig/conf.d/30-metric-aliases.conf fontconfig-2.13.0/conf.d/30-metric-aliases.conf
+--- fontconfig-2.13.0.orig/conf.d/30-metric-aliases.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/30-metric-aliases.conf	2018-06-08 17:57:33.560523086 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set substitutions for similar/metric-compatible families</description>
+ 
+ <!--
+ 
+diff -pruN fontconfig-2.13.0.orig/conf.d/40-nonlatin.conf fontconfig-2.13.0/conf.d/40-nonlatin.conf
+--- fontconfig-2.13.0.orig/conf.d/40-nonlatin.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/40-nonlatin.conf	2018-06-08 17:57:37.707587259 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set substitutions for non-Latin fonts</description>
+ <!--
+   Mark common families with their generics so we'll get
+   something reasonable
+diff -pruN fontconfig-2.13.0.orig/conf.d/45-generic.conf fontconfig-2.13.0/conf.d/45-generic.conf
+--- fontconfig-2.13.0.orig/conf.d/45-generic.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/45-generic.conf	2018-06-08 17:57:41.897652096 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set substitutions for emoji/math fonts</description>
+ 
+ <!-- Keep in sync with 60-generic.conf -->
+ 
+diff -pruN fontconfig-2.13.0.orig/conf.d/45-latin.conf fontconfig-2.13.0/conf.d/45-latin.conf
+--- fontconfig-2.13.0.orig/conf.d/45-latin.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/45-latin.conf	2018-06-08 17:57:46.222719023 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set substitutions for Latin fonts</description>
+ <!--
+   Mark common families with their generics so we'll get
+   something reasonable
+diff -pruN fontconfig-2.13.0.orig/conf.d/49-sansserif.conf fontconfig-2.13.0/conf.d/49-sansserif.conf
+--- fontconfig-2.13.0.orig/conf.d/49-sansserif.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/49-sansserif.conf	2018-06-08 17:57:50.494785131 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Add sans-serif to the family when no generic name</description>
+ <!--
+   If the font still has no generic name, add sans-serif
+  -->
+diff -pruN fontconfig-2.13.0.orig/conf.d/50-user.conf fontconfig-2.13.0/conf.d/50-user.conf
+--- fontconfig-2.13.0.orig/conf.d/50-user.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/50-user.conf	2018-06-08 17:57:54.872852876 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Load per-user customization files</description>
+ 	<!--
+ 	    Load per-user customization files where stored on XDG Base Directory
+ 	    specification compliant places. it should be usually:
+diff -pruN fontconfig-2.13.0.orig/conf.d/51-local.conf fontconfig-2.13.0/conf.d/51-local.conf
+--- fontconfig-2.13.0.orig/conf.d/51-local.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/51-local.conf	2018-06-08 17:57:59.237920422 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Load local customization file</description>
+ 	<!-- Load local system customization file -->
+ 	<include ignore_missing="yes">local.conf</include>
+ </fontconfig>
+diff -pruN fontconfig-2.13.0.orig/conf.d/60-generic.conf fontconfig-2.13.0/conf.d/60-generic.conf
+--- fontconfig-2.13.0.orig/conf.d/60-generic.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/60-generic.conf	2018-06-08 17:58:03.405984919 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set preferable fonts for emoji/math fonts</description>
+ <!-- Keep in sync with 45-generic.conf -->
+ 
+ <!-- Emoji -->
+diff -pruN fontconfig-2.13.0.orig/conf.d/60-latin.conf fontconfig-2.13.0/conf.d/60-latin.conf
+--- fontconfig-2.13.0.orig/conf.d/60-latin.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/60-latin.conf	2018-06-08 17:58:07.630050283 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set preferable fonts for Latin</description>
+ 	<alias>
+ 		<family>serif</family>
+ 		<prefer>
+diff -pruN fontconfig-2.13.0.orig/conf.d/65-fonts-persian.conf fontconfig-2.13.0/conf.d/65-fonts-persian.conf
+--- fontconfig-2.13.0.orig/conf.d/65-fonts-persian.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/65-fonts-persian.conf	2018-06-08 17:58:22.987287923 +0900
+@@ -31,10 +31,6 @@
+     2008	Behdad Esfahbod:  Cleanup.  Add fantasy and cursive.
+   -->
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+ 
+ 
+ <!-- Deprecated fonts are discouraged -->
+diff -pruN fontconfig-2.13.0.orig/conf.d/65-khmer.conf fontconfig-2.13.0/conf.d/65-khmer.conf
+--- fontconfig-2.13.0.orig/conf.d/65-khmer.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/65-khmer.conf	2018-06-08 17:58:28.539373837 +0900
+@@ -1,10 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+ 	<alias>
+ 		<family>serif</family>
+ 		<prefer>
+diff -pruN fontconfig-2.13.0.orig/conf.d/65-nonlatin.conf fontconfig-2.13.0/conf.d/65-nonlatin.conf
+--- fontconfig-2.13.0.orig/conf.d/65-nonlatin.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/65-nonlatin.conf	2018-06-08 17:58:32.936441877 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Set preferable fonts for non-Latin</description>
+ 	<alias>
+ 		<family>serif</family>
+ 		<prefer>
+diff -pruN fontconfig-2.13.0.orig/conf.d/69-unifont.conf fontconfig-2.13.0/conf.d/69-unifont.conf
+--- fontconfig-2.13.0.orig/conf.d/69-unifont.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/69-unifont.conf	2018-06-08 17:58:37.092506189 +0900
+@@ -1,10 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+ 	<alias>
+ 		<family>serif</family>
+ 		<prefer>
+diff -pruN fontconfig-2.13.0.orig/conf.d/70-no-bitmaps.conf fontconfig-2.13.0/conf.d/70-no-bitmaps.conf
+--- fontconfig-2.13.0.orig/conf.d/70-no-bitmaps.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/70-no-bitmaps.conf	2018-06-08 17:58:41.897580544 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Reject bitmap fonts</description>
+ <!-- Reject bitmap fonts -->
+  <selectfont>
+   <rejectfont>
+diff -pruN fontconfig-2.13.0.orig/conf.d/70-yes-bitmaps.conf fontconfig-2.13.0/conf.d/70-yes-bitmaps.conf
+--- fontconfig-2.13.0.orig/conf.d/70-yes-bitmaps.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/70-yes-bitmaps.conf	2018-06-08 17:58:46.206647223 +0900
+@@ -1,11 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+-  <description>Accept bitmap fonts</description>
+ <!-- Accept bitmap fonts -->
+  <selectfont>
+   <acceptfont>
+diff -pruN fontconfig-2.13.0.orig/conf.d/80-delicious.conf fontconfig-2.13.0/conf.d/80-delicious.conf
+--- fontconfig-2.13.0.orig/conf.d/80-delicious.conf	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/conf.d/80-delicious.conf	2018-06-08 17:58:50.251709817 +0900
+@@ -1,10 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+ <!-- Fix-ups for Delicious family -->
+ 
+ <!-- Delicious 'heavy' variant says its Medium weight -->
+diff -pruN fontconfig-2.13.0.orig/conf.d/90-synthetic.conf fontconfig-2.13.0/conf.d/90-synthetic.conf
+--- fontconfig-2.13.0.orig/conf.d/90-synthetic.conf	2018-06-08 17:55:25.274537971 +0900
++++ fontconfig-2.13.0/conf.d/90-synthetic.conf	2018-06-08 17:58:54.259771838 +0900
+@@ -1,10 +1,6 @@
+ <?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+-  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-  </its:rules>
+-
+ <!-- 
+  Artificial oblique for fonts without an italic or oblique version
+  -->
+diff -pruN fontconfig-2.13.0.orig/fonts.conf.in fontconfig-2.13.0/fonts.conf.in
+--- fontconfig-2.13.0.orig/fonts.conf.in	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.13.0/fonts.conf.in	2018-06-08 19:55:53.912390551 +0900
+@@ -2,12 +2,6 @@
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <!-- /etc/fonts/fonts.conf file to configure system font access -->
+ <fontconfig>
+-	<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+-		<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
+-	</its:rules>
+-
+-	<description>Default configuration file</description>
+-
+ <!--
+ 	DO NOT EDIT THIS FILE.
+ 	IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
diff --git a/SOURCES/fontconfig-fix-crash-on-fcfontsort.patch b/SOURCES/fontconfig-fix-crash-on-fcfontsort.patch
deleted file mode 100644
index 819548b..0000000
--- a/SOURCES/fontconfig-fix-crash-on-fcfontsort.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 8a174b6c51581df6ffd6a5da056949c6c79337cf Mon Sep 17 00:00:00 2001
-From: Akira TAGOH <akira@tagoh.org>
-Date: Tue, 24 Sep 2013 11:14:57 +0900
-Subject: [PATCH] Fix a crash when FcPattern is set to null on FcFontSetList()
- and FcFontList()
-
----
- src/fclist.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/fclist.c b/src/fclist.c
-index c56e24c..a365098 100644
---- a/src/fclist.c
-+++ b/src/fclist.c
-@@ -212,6 +212,8 @@ FcListPatternMatchAny (const FcPattern *p,
- {
-     int		    i;
- 
-+    if (!p)
-+	return FcFalse;
-     for (i = 0; i < p->num; i++)
-     {
- 	FcPatternElt	*pe = &FcPatternElts(p)[i];
--- 
-1.8.3.1
-
diff --git a/SOURCES/fontconfig-fix-doublefree.patch b/SOURCES/fontconfig-fix-doublefree.patch
new file mode 100644
index 0000000..1dc97ab
--- /dev/null
+++ b/SOURCES/fontconfig-fix-doublefree.patch
@@ -0,0 +1,27 @@
+From 14c23a5715c529be175d8d6152cabd4ddad4e981 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Fri, 25 May 2018 15:20:10 +0900
+Subject: [PATCH 6/7] Fix double-free
+
+---
+ src/fcxml.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/fcxml.c b/src/fcxml.c
+index c69ee50..4f984a7 100644
+--- a/src/fcxml.c
++++ b/src/fcxml.c
+@@ -2780,7 +2780,10 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
+ 	    else
+ 	    {
+ 		if (parse->scanOnly && vstack->u.string)
++		{
+ 		    FcStrFree (vstack->u.string);
++		    vstack->tag = FcVStackNone;
++		}
+ 	    }
+ 	    break;
+ 	case FcVStackPattern:
+-- 
+2.17.1
+
diff --git a/SOURCES/fontconfig-fix-embolden-logic.patch b/SOURCES/fontconfig-fix-embolden-logic.patch
new file mode 100644
index 0000000..766b7be
--- /dev/null
+++ b/SOURCES/fontconfig-fix-embolden-logic.patch
@@ -0,0 +1,31 @@
+From 454923709a1a1e480554c400e053aea9a1ba951a Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Thu, 10 May 2018 22:01:29 +0900
+Subject: [PATCH] Change the emboldening logic again
+
+enable emboldening when request was >= bold and font was <= medium
+
+https://bugs.freedesktop.org/show_bug.cgi?id=106460
+---
+ conf.d/90-synthetic.conf | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/conf.d/90-synthetic.conf b/conf.d/90-synthetic.conf
+index e344e4a..6b929dd 100644
+--- a/conf.d/90-synthetic.conf
++++ b/conf.d/90-synthetic.conf
+@@ -42,9 +42,9 @@
+  -->
+ 
+ 	<match target="font">
+-		<!-- check to see if the font is just regular -->
++		<!-- check to see if the weight in the font is less than medium which possibly need emboldening -->
+ 		<test name="weight" compare="less_eq">
+-			<const>regular</const>
++			<const>medium</const>
+ 		</test>
+ 		<!-- check to see if the pattern requests bold -->
+ 		<test target="pattern" name="weight" compare="more_eq">
+-- 
+2.17.0
+
diff --git a/SOURCES/fontconfig-fix-flatpak.patch b/SOURCES/fontconfig-fix-flatpak.patch
new file mode 100644
index 0000000..467e09d
--- /dev/null
+++ b/SOURCES/fontconfig-fix-flatpak.patch
@@ -0,0 +1,618 @@
+diff -pruN fontconfig-2.13.0.orig/src/fccache.c fontconfig-2.13.0/src/fccache.c
+--- fontconfig-2.13.0.orig/src/fccache.c	2017-12-18 21:45:13.000000000 +0900
++++ fontconfig-2.13.0/src/fccache.c	2018-06-08 18:39:33.079539192 +0900
+@@ -51,13 +51,23 @@ FcDirCacheCreateUUID (FcChar8  *dir,
+ 		      FcBool    force,
+ 		      FcConfig *config)
+ {
++    const FcChar8 *sysroot = FcConfigGetSysRoot (config);
++    FcChar8 *target;
+     FcBool ret = FcTrue;
+ #ifndef _WIN32
+     FcChar8 *uuidname;
+ 
+-    uuidname = FcStrBuildFilename (dir, ".uuid", NULL);
++    if (sysroot)
++	target = FcStrBuildFilename (sysroot, dir, NULL);
++    else
++	target = FcStrdup (dir);
++    uuidname = FcStrBuildFilename (target, ".uuid", NULL);
++
+     if (!uuidname)
++    {
++	FcStrFree (target);
+ 	return FcFalse;
++    }
+ 
+     if (force || access ((const char *) uuidname, F_OK) < 0)
+     {
+@@ -69,7 +79,7 @@ FcDirCacheCreateUUID (FcChar8  *dir,
+ 	struct stat statb;
+ 	struct timeval times[2];
+ 
+-	if (FcStat (dir, &statb) != 0)
++	if (FcStat (target, &statb) != 0)
+ 	{
+ 	    ret = FcFalse;
+ 	    goto bail1;
+@@ -96,7 +106,7 @@ FcDirCacheCreateUUID (FcChar8  *dir,
+ 	    hash_add = FcHashTableReplace;
+ 	else
+ 	    hash_add = FcHashTableAdd;
+-	if (!hash_add (config->uuid_table, dir, uuid))
++	if (!hash_add (config->uuid_table, target, uuid))
+ 	{
+ 	    ret = FcFalse;
+ 	    goto bail3;
+@@ -124,14 +134,15 @@ FcDirCacheCreateUUID (FcChar8  *dir,
+ 	    times[0].tv_usec = 0;
+ 	    times[1].tv_usec = 0;
+ #endif
+-	    if (utimes ((const  char *) dir, times) != 0)
++	    if (utimes ((const  char *) target, times) != 0)
+ 	    {
+-		fprintf (stderr, "Unable to revert mtime: %s\n", dir);
++		fprintf (stderr, "Unable to revert mtime: %s\n", target);
+ 	    }
+ 	}
+     }
+-    bail1:
++bail1:
+     FcStrFree (uuidname);
++    FcStrFree (target);
+ #endif
+ 
+     return ret;
+@@ -144,10 +155,17 @@ FcDirCacheReadUUID (FcChar8  *dir,
+ {
+     void *u;
+     uuid_t uuid;
++    const FcChar8 *sysroot = FcConfigGetSysRoot (config);
++    FcChar8 *target;
+ 
+-    if (!FcHashTableFind (config->uuid_table, dir, &u))
++    if (sysroot)
++	target = FcStrBuildFilename (sysroot, dir, NULL);
++    else
++	target = FcStrdup (dir);
++
++    if (!FcHashTableFind (config->uuid_table, target, &u))
+     {
+-	FcChar8 *uuidname = FcStrBuildFilename (dir, ".uuid", NULL);
++	FcChar8 *uuidname = FcStrBuildFilename (target, ".uuid", NULL);
+ 	int fd;
+ 
+ 	if ((fd = FcOpen ((char *) uuidname, O_RDONLY)) >= 0)
+@@ -162,7 +180,7 @@ FcDirCacheReadUUID (FcChar8  *dir,
+ 		{
+ 		    if (FcDebug () & FC_DBG_CACHE)
+ 			printf ("FcDirCacheReadUUID %s -> %s\n", uuidname, suuid);
+-		    FcHashTableAdd (config->uuid_table, dir, uuid);
++		    FcHashTableAdd (config->uuid_table, target, uuid);
+ 		}
+ 	    }
+ 	    close (fd);
+@@ -176,6 +194,7 @@ FcDirCacheReadUUID (FcChar8  *dir,
+     }
+     else
+ 	FcHashUuidFree (u);
++    FcStrFree (target);
+ }
+ #endif
+ 
+@@ -259,19 +278,22 @@ static FcChar8 *
+ FcDirCacheBasenameUUID (const FcChar8 *dir, FcChar8 cache_base[CACHEBASE_LEN], FcConfig *config)
+ {
+     void *u;
+-    FcChar8 *alias;
++    FcChar8 *target;
++    const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ 
+-    if (!FcHashTableFind (config->alias_table, dir, (void **)&alias))
+-	alias = FcStrdup (dir);
+-    if (FcHashTableFind (config->uuid_table, alias, &u))
++    if (sysroot)
++	target = FcStrBuildFilename (sysroot, dir, NULL);
++    else
++	target = FcStrdup (dir);
++    if (FcHashTableFind (config->uuid_table, target, &u))
+     {
+ 	uuid_unparse (u, (char *) cache_base);
+ 	strcat ((char *) cache_base, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX);
+ 	FcHashUuidFree (u);
+-	FcStrFree (alias);
++	FcStrFree (target);
+ 	return cache_base;
+     }
+-    FcStrFree (alias);
++    FcStrFree (target);
+     return NULL;
+ }
+ #endif
+@@ -417,6 +439,7 @@ struct _FcCacheSkip {
+     FcCache	    *cache;
+     FcRef	    ref;
+     intptr_t	    size;
++    void	   *allocated;
+     dev_t	    cache_dev;
+     ino_t	    cache_ino;
+     time_t	    cache_mtime;
+@@ -542,6 +565,7 @@ FcCacheInsert (FcCache *cache, struct st
+ 
+     s->cache = cache;
+     s->size = cache->size;
++    s->allocated = NULL;
+     FcRefInit (&s->ref, 1);
+     if (cache_stat)
+     {
+@@ -616,6 +640,7 @@ FcCacheRemoveUnlocked (FcCache *cache)
+     FcCacheSkip	    **update[FC_CACHE_MAX_LEVEL];
+     FcCacheSkip	    *s, **next;
+     int		    i;
++    void            *allocated;
+ 
+     /*
+      * Find links along each chain
+@@ -633,6 +658,15 @@ FcCacheRemoveUnlocked (FcCache *cache)
+ 	*update[i] = s->next[i];
+     while (fcCacheMaxLevel > 0 && fcCacheChains[fcCacheMaxLevel - 1] == NULL)
+ 	fcCacheMaxLevel--;
++
++    allocated = s->allocated;
++    while (allocated)
++    {
++	/* First element in allocated chunk is the free list */
++	next = *(void **)allocated;
++	free (allocated);
++	allocated = next;
++    }
+     free (s);
+ }
+ 
+@@ -702,6 +736,30 @@ FcCacheObjectDereference (void *object)
+     unlock_cache ();
+ }
+ 
++void *
++FcCacheAllocate (FcCache *cache, size_t len)
++{
++    FcCacheSkip	*skip;
++    void *allocated = NULL;
++
++    lock_cache ();
++    skip = FcCacheFindByAddrUnlocked (cache);
++    if (skip)
++    {
++      void *chunk = malloc (sizeof (void *) + len);
++      if (chunk)
++      {
++	  /* First element in allocated chunk is the free list */
++	  *(void **)chunk = skip->allocated;
++	  skip->allocated = chunk;
++	  /* Return the rest */
++	  allocated = ((FcChar8 *)chunk) + sizeof (void *);
++      }
++    }
++    unlock_cache ();
++    return allocated;
++}
++
+ void
+ FcCacheFini (void)
+ {
+@@ -955,7 +1013,6 @@ FcCache *
+ FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file)
+ {
+     FcCache *cache = NULL;
+-    const FcChar8 *d;
+ 
+ #ifndef _WIN32
+     FcDirCacheReadUUID ((FcChar8 *) dir, config);
+@@ -965,10 +1022,6 @@ FcDirCacheLoad (const FcChar8 *dir, FcCo
+ 			    &cache, cache_file))
+ 	return NULL;
+ 
+-    d = FcCacheDir (cache);
+-    if (FcStrCmp (dir, d))
+-	FcHashTableAdd (config->alias_table, (FcChar8 *) d, (FcChar8 *) dir);
+-
+     return cache;
+ }
+ 
+diff -pruN fontconfig-2.13.0.orig/src/fccfg.c fontconfig-2.13.0/src/fccfg.c
+--- fontconfig-2.13.0.orig/src/fccfg.c	2018-06-08 18:34:36.546946321 +0900
++++ fontconfig-2.13.0/src/fccfg.c	2018-06-08 18:39:33.079539192 +0900
+@@ -144,12 +144,6 @@ FcConfigCreate (void)
+ 					    FcHashUuidCopy,
+ 					    (FcDestroyFunc) FcStrFree,
+ 					    FcHashUuidFree);
+-    config->alias_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
+-					     (FcCompareFunc) FcStrCmp,
+-					     FcHashStrCopy,
+-					     FcHashStrCopy,
+-					     (FcDestroyFunc) FcStrFree,
+-					     (FcDestroyFunc) FcStrFree);
+ 
+     FcRefInit (&config->ref, 1);
+ 
+@@ -313,7 +307,6 @@ FcConfigDestroy (FcConfig *config)
+ 	FcStrFree (config->sysRoot);
+ 
+     FcHashTableDestroy (config->uuid_table);
+-    FcHashTableDestroy (config->alias_table);
+ 
+     free (config);
+ }
+@@ -324,11 +317,15 @@ FcConfigDestroy (FcConfig *config)
+ 
+ FcBool
+ FcConfigAddCache (FcConfig *config, FcCache *cache,
+-		  FcSetName set, FcStrSet *dirSet)
++		  FcSetName set, FcStrSet *dirSet, FcChar8 *forDir)
+ {
+     FcFontSet	*fs;
+     intptr_t	*dirs;
+     int		i;
++    FcBool      relocated = FcFalse;
++
++    if (strcmp ((char *)FcCacheDir(cache), (char *)forDir) != 0)
++      relocated = FcTrue;
+ 
+     /*
+      * Add fonts
+@@ -342,23 +339,43 @@ FcConfigAddCache (FcConfig *config, FcCa
+ 	{
+ 	    FcPattern	*font = FcFontSetFont (fs, i);
+ 	    FcChar8	*font_file;
++	    FcChar8	*relocated_font_file = NULL;
+ 
+-	    /*
+-	     * Check to see if font is banned by filename
+-	     */
+ 	    if (FcPatternObjectGetString (font, FC_FILE_OBJECT,
+-					  0, &font_file) == FcResultMatch &&
+-		!FcConfigAcceptFilename (config, font_file))
++					  0, &font_file) == FcResultMatch)
+ 	    {
+-		continue;
++		if (relocated)
++		  {
++		    FcChar8 *slash = FcStrLastSlash (font_file);
++		    relocated_font_file = FcStrBuildFilename (forDir, slash + 1, NULL);
++		    font_file = relocated_font_file;
++		  }
++
++		/*
++		 * Check to see if font is banned by filename
++		 */
++		if (!FcConfigAcceptFilename (config, font_file))
++		{
++		    free (relocated_font_file);
++		    continue;
++		}
+ 	    }
+-		
++
+ 	    /*
+ 	     * Check to see if font is banned by pattern
+ 	     */
+ 	    if (!FcConfigAcceptFont (config, font))
++	    {
++		free (relocated_font_file);
+ 		continue;
+-		
++	    }
++
++	    if (relocated_font_file)
++	    {
++	      font = FcPatternCacheRewriteFile (font, cache, relocated_font_file);
++	      free (relocated_font_file);
++	    }
++
+ 	    if (FcFontSetAdd (config->fonts[set], font))
+ 		nref++;
+ 	}
+@@ -374,18 +391,14 @@ FcConfigAddCache (FcConfig *config, FcCa
+ 	for (i = 0; i < cache->dirs_count; i++)
+ 	{
+ 	    const FcChar8 *dir = FcCacheSubdir (cache, i);
+-	    FcChar8 *alias;
+-	    FcChar8 *d = FcStrDirname (dir);
+ 	    FcChar8 *s = NULL;
+ 
+-	    if (FcHashTableFind (config->alias_table, d, (void **)&alias))
++	    if (relocated)
+ 	    {
+ 		FcChar8 *base = FcStrBasename (dir);
+-		dir = s = FcStrBuildFilename (alias, base, NULL);
+-		FcStrFree (alias);
++		dir = s = FcStrBuildFilename (forDir, base, NULL);
+ 		FcStrFree (base);
+ 	    }
+-	    FcStrFree (d);
+ 	    if (FcConfigAcceptFilename (config, dir))
+ 		FcStrSetAddFilename (dirSet, dir);
+ 	    if (s)
+@@ -413,7 +426,7 @@ FcConfigAddDirList (FcConfig *config, Fc
+ 	cache = FcDirCacheRead (dir, FcFalse, config);
+ 	if (!cache)
+ 	    continue;
+-	FcConfigAddCache (config, cache, set, dirSet);
++	FcConfigAddCache (config, cache, set, dirSet, dir);
+ 	FcDirCacheUnload (cache);
+     }
+     FcStrListDone (dirlist);
+diff -pruN fontconfig-2.13.0.orig/src/fcint.h fontconfig-2.13.0/src/fcint.h
+--- fontconfig-2.13.0.orig/src/fcint.h	2018-02-04 19:20:56.000000000 +0900
++++ fontconfig-2.13.0/src/fcint.h	2018-06-08 18:39:33.080539208 +0900
+@@ -566,7 +566,6 @@ struct _FcConfig {
+     FcStrSet	*availConfigFiles;  /* config files available */
+     FcPtrList	*rulesetList;	    /* List of rulesets being installed */
+     FcHashTable *uuid_table;	    /* UUID table for cachedirs */
+-    FcHashTable *alias_table;	    /* alias table for cachedirs */
+ };
+ 
+ typedef struct _FcFileTime {
+@@ -617,9 +616,13 @@ FcCacheObjectReference (void *object);
+ FcPrivate void
+ FcCacheObjectDereference (void *object);
+ 
++FcPrivate void *
++FcCacheAllocate (FcCache *cache, size_t len);
++
+ FcPrivate void
+ FcCacheFini (void);
+ 
++
+ FcPrivate void
+ FcDirCacheReference (FcCache *cache, int nref);
+ 
+@@ -708,7 +711,7 @@ FcConfigModifiedTime (FcConfig *config);
+ 
+ FcPrivate FcBool
+ FcConfigAddCache (FcConfig *config, FcCache *cache,
+-		  FcSetName set, FcStrSet *dirSet);
++		  FcSetName set, FcStrSet *dirSet, FcChar8 *forDir);
+ 
+ FcPrivate FcRuleSet *
+ FcRuleSetCreate (const FcChar8 *name);
+@@ -1150,6 +1153,9 @@ FcPatternAppend (FcPattern *p, FcPattern
+ FcPrivate int
+ FcPatternPosition (const FcPattern *p, const char *object);
+ 
++FcPrivate FcPattern *
++FcPatternCacheRewriteFile (const FcPattern *pat, FcCache *cache, const FcChar8 *relocated_font_file);
++
+ FcPrivate FcChar32
+ FcStringHash (const FcChar8 *s);
+ 
+diff -pruN fontconfig-2.13.0.orig/src/fclist.c fontconfig-2.13.0/src/fclist.c
+--- fontconfig-2.13.0.orig/src/fclist.c	2017-12-05 21:44:22.000000000 +0900
++++ fontconfig-2.13.0/src/fclist.c	2018-06-08 18:39:33.049538728 +0900
+@@ -448,41 +448,6 @@ FcListAppend (FcListHashTable	*table,
+ 	e = FcPatternObjectFindElt (font, FcObjectFromName (os->objects[o]));
+ 	if (e)
+ 	{
+-	    if (FcRefIsConst (&font->ref) && !strcmp (os->objects[o], FC_FILE))
+-	    {
+-		FcChar8 *dir, *alias;
+-		FcConfig *config = FcConfigGetCurrent (); /* FIXME: this may need to be exported as API? */
+-
+-		for (v = FcPatternEltValues (e); v->value.type != FcTypeString; v = FcValueListNext (v));
+-		if (!v)
+-		    goto bail2;
+-		dir = FcStrDirname (FcValueString (&v->value));
+-		if (FcHashTableFind (config->alias_table, dir, (void **) &alias))
+-		{
+-		    FcChar8 *base = FcStrBasename (FcValueString (&v->value));
+-		    FcChar8 *s = FcStrBuildFilename (alias, base, NULL);
+-		    FcValue vv;
+-
+-		    FcStrFree (alias);
+-		    FcStrFree (base);
+-		    vv.type = FcTypeString;
+-		    vv.u.s = s;
+-		    if (!FcPatternAdd (bucket->pattern,
+-				       os->objects[o],
+-				       FcValueCanonicalize (&vv),
+-				       FcTrue))
+-		    {
+-			FcStrFree (s);
+-			FcStrFree (dir);
+-			goto bail2;
+-		    }
+-		    FcStrFree (s);
+-		    FcStrFree (dir);
+-		    goto bail3;
+-		}
+-		else
+-		    FcStrFree (dir);
+-	    }
+ 	    for (v = FcPatternEltValues(e), idx = 0; v;
+ 		 v = FcValueListNext(v), ++idx)
+ 	    {
+@@ -491,7 +456,6 @@ FcListAppend (FcListHashTable	*table,
+ 				   FcValueCanonicalize(&v->value), defidx != idx))
+ 		    goto bail2;
+ 	    }
+-	  bail3:;
+ 	}
+     }
+     *prev = bucket;
+diff -pruN fontconfig-2.13.0.orig/src/fcmatch.c fontconfig-2.13.0/src/fcmatch.c
+--- fontconfig-2.13.0.orig/src/fcmatch.c	2017-12-23 14:06:22.000000000 +0900
++++ fontconfig-2.13.0/src/fcmatch.c	2018-06-08 18:39:33.050538743 +0900
+@@ -682,43 +682,9 @@ FcFontRenderPrepare (FcConfig	    *confi
+ 	}
+ 	else
+ 	{
+-	    if (FcRefIsConst (&font->ref) && fe->object == FC_FILE_OBJECT)
+-	    {
+-		FcValueListPtr l = FcPatternEltValues (fe);
+-		FcChar8 *dir, *alias;
+-
+-		while (l->value.type != FcTypeString)
+-		    l = FcValueListNext (l);
+-		if (!l)
+-		    goto bail0;
+-		dir = FcStrDirname (FcValueString (&l->value));
+-		if (!config)
+-		    config = FcConfigGetCurrent ();
+-		if (config && FcHashTableFind (config->alias_table, dir, (void **) &alias))
+-		{
+-		    FcChar8 *base = FcStrBasename (FcValueString (&l->value));
+-		    FcChar8 *s = FcStrBuildFilename (alias, base, NULL);
+-		    FcValue v;
+-
+-		    FcStrFree (alias);
+-		    FcStrFree (base);
+-		    v.type = FcTypeString;
+-		    v.u.s = s;
+-		    FcPatternObjectAddWithBinding (new, fe->object,
+-						   FcValueCanonicalize (&v),
+-						   l->binding,
+-						   FcTrue);
+-		    FcStrFree (s);
+-		    FcStrFree (dir);
+-		    goto bail0;
+-		}
+-		else
+-		    FcStrFree (dir);
+-	    }
+ 	    FcPatternObjectListAdd (new, fe->object,
+ 				    FcValueListDuplicate (FcPatternEltValues (fe)),
+ 				    FcTrue);
+-	  bail0:;
+ 	}
+     }
+     for (i = 0; i < pat->num; i++)
+diff -pruN fontconfig-2.13.0.orig/src/fcpat.c fontconfig-2.13.0/src/fcpat.c
+--- fontconfig-2.13.0.orig/src/fcpat.c	2017-12-20 19:20:15.000000000 +0900
++++ fontconfig-2.13.0/src/fcpat.c	2018-06-08 18:39:33.050538743 +0900
+@@ -373,6 +373,71 @@ FcValueListHash (FcValueListPtr l)
+     return hash;
+ }
+ 
++static void *
++FcPatternGetCacheObject (FcPattern *p)
++{
++  /* We use a value to find the cache, instead of the FcPattern object
++   * because the pattern itself may be a cache allocation if we rewrote the path,
++   * so the p may not be in the cached region. */
++  return FcPatternEltValues(&FcPatternElts (p)[0]);
++}
++
++FcPattern *
++FcPatternCacheRewriteFile (const FcPattern *p,
++                           FcCache *cache,
++                           const FcChar8 *relocated_font_file)
++{
++    FcPatternElt *elts = FcPatternElts (p);
++    size_t i,j;
++    FcChar8 *data;
++    FcPattern *new_p;
++    FcPatternElt *new_elts;
++    FcValueList *new_value_list;
++    size_t new_path_len = strlen ((char *)relocated_font_file);
++    FcChar8 *new_path;
++
++    /* Allocate space for the patter, the PatternElt headers and
++     * the FC_FILE FcValueList and path that will be freed with the
++     * cache */
++    data = FcCacheAllocate (cache,
++			    sizeof (FcPattern) +
++			    p->num * sizeof (FcPatternElt) +
++			    sizeof (FcValueList) +
++			    new_path_len + 1);
++
++    new_p = (FcPattern *)data;
++    data += sizeof (FcPattern);
++    new_elts = (FcPatternElt *)(data);
++    data += p->num * sizeof (FcPatternElt);
++    new_value_list = (FcValueList *)data;
++    data += sizeof (FcValueList);
++    new_path = data;
++
++    *new_p = *p;
++    new_p->elts_offset = FcPtrToOffset (new_p, new_elts);
++
++    /* Copy all but the FILE values from the cache */
++    for (i = 0, j = 0; i < p->num; i++)
++    {
++	FcPatternElt *elt = &elts[i];
++	new_elts[j].object = elt->object;
++	if (elt->object != FC_FILE_OBJECT)
++	    new_elts[j++].values = FcPatternEltValues(elt);
++	else
++	    new_elts[j++].values = new_value_list;
++    }
++
++    new_value_list->next = NULL;
++    new_value_list->value.type = FcTypeString;
++    new_value_list->value.u.s = new_path;
++    new_value_list->binding = FcValueBindingWeak;
++
++    /* Add rewritten path at the end */
++    strcpy ((char *)new_path, (char *)relocated_font_file);
++
++    return new_p;
++}
++
+ void
+ FcPatternDestroy (FcPattern *p)
+ {
+@@ -384,10 +449,10 @@ FcPatternDestroy (FcPattern *p)
+ 
+     if (FcRefIsConst (&p->ref))
+     {
+-	FcCacheObjectDereference (p);
++	FcCacheObjectDereference (FcPatternGetCacheObject(p));
+ 	return;
+     }
+-	
++
+     if (FcRefDec (&p->ref) != 1)
+ 	return;
+ 
+@@ -1155,7 +1220,7 @@ FcPatternReference (FcPattern *p)
+     if (!FcRefIsConst (&p->ref))
+ 	FcRefInc (&p->ref);
+     else
+-	FcCacheObjectReference (p);
++	FcCacheObjectReference (FcPatternGetCacheObject(p));
+ }
+ 
+ FcPattern *
+diff -pruN fontconfig-2.13.0.orig/test/run-test.sh fontconfig-2.13.0/test/run-test.sh
+--- fontconfig-2.13.0.orig/test/run-test.sh	2017-12-18 21:25:18.000000000 +0900
++++ fontconfig-2.13.0/test/run-test.sh	2018-06-08 18:39:33.031538449 +0900
+@@ -202,4 +202,29 @@ fi
+ rm -rf $TESTTMPDIR out1 out2 xxx bind-fonts.conf
+ fi
+ 
++dotest "sysroot option"
++prep
++mkdir -p $MyPWD/sysroot/$FONTDIR
++mkdir -p $MyPWD/sysroot/$CACHEDIR
++cp $FONT1 $MyPWD/sysroot/$FONTDIR
++cp $MyPWD/fonts.conf $MyPWD/sysroot/$MyPWD/fonts.conf
++$FCCACHE -y $MyPWD/sysroot
++stat $MyPWD/sysroot/$FONTDIR/.uuid
++if test $? != 0; then
++  echo "*** Test failed: $TEST"
++  exit 1
++fi
++
++dotest "creating uuid-based cache file on sysroot"
++uuid=`cat $MyPWD/sysroot/$FONTDIR/.uuid`
++ls $MyPWD/sysroot/$CACHEDIR/$uuid*
++if [ $? != 0 ]; then
++  echo "*** Test failed: $TEST"
++  echo "No cache for $uuid"
++  ls $MyPWD/sysroot/$CACHEDIR
++  exit 1
++fi
++
++rm -rf $MyPWD/sysroot
++
+ rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out
diff --git a/SOURCES/fontconfig-fix-memleak.patch b/SOURCES/fontconfig-fix-memleak.patch
deleted file mode 100644
index f7753ea..0000000
--- a/SOURCES/fontconfig-fix-memleak.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From a61e145304da86c8c35b137493bbd8fd5dd1e7f5 Mon Sep 17 00:00:00 2001
-From: Akira TAGOH <akira@tagoh.org>
-Date: Mon, 9 Sep 2013 19:59:31 +0900
-Subject: [PATCH] Fix memory leaks in FcFreeTypeQueryFace
-
----
- src/fcfreetype.c | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/src/fcfreetype.c b/src/fcfreetype.c
-index 02e85cb..e394307 100644
---- a/src/fcfreetype.c
-+++ b/src/fcfreetype.c
-@@ -1105,7 +1105,6 @@ FcFreeTypeQueryFace (const FT_Face  face,
-     const char	    *tmp;
- 
-     FcChar8	    *hashstr = NULL;
--    char	    *fontdata = NULL;
-     FT_Error	    err;
-     FT_ULong	    len = 0, alen;
- 
-@@ -1668,15 +1667,21 @@ FcFreeTypeQueryFace (const FT_Face  face,
-     err = FT_Load_Sfnt_Table (face, 0, 0, NULL, &len);
-     if (err == FT_Err_Ok)
-     {
-+	char *fontdata;
-+
- 	alen = (len + 63) & ~63;
- 	fontdata = malloc (alen);
- 	if (!fontdata)
- 	    goto bail3;
- 	err = FT_Load_Sfnt_Table (face, 0, 0, (FT_Byte *)fontdata, &len);
- 	if (err != FT_Err_Ok)
-+	{
-+	    free (fontdata);
- 	    goto bail3;
-+	}
- 	memset (&fontdata[len], 0, alen - len);
- 	hashstr = FcHashGetSHA256DigestFromMemory (fontdata, len);
-+	free (fontdata);
-     }
-     else if (err == FT_Err_Invalid_Face_Handle)
-     {
-@@ -1692,7 +1697,11 @@ FcFreeTypeQueryFace (const FT_Face  face,
-     if (hashstr)
-     {
- 	if (!FcPatternAddString (pat, FC_HASH, hashstr))
-+	{
-+	    free (hashstr);
- 	    goto bail1;
-+	}
-+	free (hashstr);
-     }
- bail3:
- 
-@@ -1783,10 +1792,6 @@ bail3:
- bail2:
-     FcCharSetDestroy (cs);
- bail1:
--    if (hashstr)
--	free (hashstr);
--    if (fontdata)
--	free (fontdata);
-     FcPatternDestroy (pat);
- bail0:
-     return NULL;
--- 
-1.8.3.1
-
diff --git a/SOURCES/fontconfig-fix-memleaks.patch b/SOURCES/fontconfig-fix-memleaks.patch
new file mode 100644
index 0000000..9a70e6b
--- /dev/null
+++ b/SOURCES/fontconfig-fix-memleaks.patch
@@ -0,0 +1,40 @@
+From 684c3ce6850c4168e127ea84432e7a9006296ff4 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Fri, 25 May 2018 13:51:10 +0900
+Subject: [PATCH 1/7] Fix leaks
+
+---
+ src/fcxml.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/fcxml.c b/src/fcxml.c
+index 1ee1ba1..c69ee50 100644
+--- a/src/fcxml.c
++++ b/src/fcxml.c
+@@ -2777,6 +2777,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
+ 	    {
+ 		FcConfigMessage (parse, FcSevereError, "out of memory");
+ 	    }
++	    else
++	    {
++		if (parse->scanOnly && vstack->u.string)
++		    FcStrFree (vstack->u.string);
++	    }
+ 	    break;
+ 	case FcVStackPattern:
+ 	    if (!parse->scanOnly && !FcConfigPatternsAdd (parse->config,
+@@ -2786,7 +2791,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
+ 		FcConfigMessage (parse, FcSevereError, "out of memory");
+ 	    }
+ 	    else
++	    {
++		if (parse->scanOnly && vstack->u.pattern)
++		    FcPatternDestroy (vstack->u.pattern);
+ 		vstack->tag = FcVStackNone;
++	    }
+ 	    break;
+ 	default:
+ 	    FcConfigMessage (parse, FcSevereWarning, "bad font selector");
+-- 
+2.17.1
+
diff --git a/SOURCES/fontconfig-fix-race-condition.patch b/SOURCES/fontconfig-fix-race-condition.patch
deleted file mode 100644
index 503f7eb..0000000
--- a/SOURCES/fontconfig-fix-race-condition.patch
+++ /dev/null
@@ -1,196 +0,0 @@
-From 0203055520206028eecee5d261887cdc91500e15 Mon Sep 17 00:00:00 2001
-From: Akira TAGOH <akira@tagoh.org>
-Date: Wed, 2 Oct 2013 16:34:34 +0900
-Subject: [PATCH] Workaround the race condition issue on updating cache
-
----
- fc-cache/fc-cache.c     | 62 ++++++++++++++++++++++++++++---------------------
- fontconfig/fontconfig.h |  3 +++
- src/fcstr.c             |  6 +++++
- 3 files changed, 45 insertions(+), 26 deletions(-)
-
-diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
-index aeb0af2..af7ba6d 100644
---- a/fc-cache/fc-cache.c
-+++ b/fc-cache/fc-cache.c
-@@ -118,7 +118,7 @@ usage (char *program, int error)
- static FcStrSet *processed_dirs;
- 
- static int
--scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcBool verbose, int *changed)
-+scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force, FcBool verbose, FcBool recursive, int *changed)
- {
-     int		    ret = 0;
-     const FcChar8   *dir;
-@@ -141,7 +141,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
- 	    fflush (stdout);
- 	}
- 	
--	if (FcStrSetMember (processed_dirs, dir))
-+	if (recursive && FcStrSetMember (processed_dirs, dir))
- 	{
- 	    if (verbose)
- 		printf ("skipping, looped directory detected\n");
-@@ -213,32 +213,37 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
- 		ret++;
- 	    }
- 	}
--	
--	subdirs = FcStrSetCreate ();
--	if (!subdirs)
-+
-+	if (recursive)
- 	{
--	    fprintf (stderr, "%s: Can't create subdir set\n", dir);
--	    ret++;
--	    FcDirCacheUnload (cache);
--	    continue;
--	}
--	for (i = 0; i < FcCacheNumSubdir (cache); i++)
--	    FcStrSetAdd (subdirs, FcCacheSubdir (cache, i));
-+	    subdirs = FcStrSetCreate ();
-+	    if (!subdirs)
-+	    {
-+		fprintf (stderr, "%s: Can't create subdir set\n", dir);
-+		ret++;
-+		FcDirCacheUnload (cache);
-+		continue;
-+	    }
-+	    for (i = 0; i < FcCacheNumSubdir (cache); i++)
-+		FcStrSetAdd (subdirs, FcCacheSubdir (cache, i));
- 	
--	FcDirCacheUnload (cache);
-+	    FcDirCacheUnload (cache);
- 	
--	sublist = FcStrListCreate (subdirs);
--	FcStrSetDestroy (subdirs);
--	if (!sublist)
--	{
--	    fprintf (stderr, "%s: Can't create subdir list\n", dir);
--	    ret++;
--	    continue;
-+	    sublist = FcStrListCreate (subdirs);
-+	    FcStrSetDestroy (subdirs);
-+	    if (!sublist)
-+	    {
-+		fprintf (stderr, "%s: Can't create subdir list\n", dir);
-+		ret++;
-+		continue;
-+	    }
-+	    FcStrSetAdd (processed_dirs, dir);
-+	    ret += scanDirs (sublist, config, force, really_force, verbose, recursive, changed);
-+	    FcStrListDone (sublist);
- 	}
--	FcStrSetAdd (processed_dirs, dir);
--	ret += scanDirs (sublist, config, force, really_force, verbose, changed);
-+	else
-+	    FcDirCacheUnload (cache);
-     }
--    FcStrListDone (list);
-     return ret;
- }
- 
-@@ -366,7 +371,11 @@ main (int argc, char **argv)
-     }
- 	
-     changed = 0;
--    ret = scanDirs (list, config, force, really_force, verbose, &changed);
-+    ret = scanDirs (list, config, force, really_force, verbose, FcTrue, &changed);
-+    /* Update the directory cache again to avoid the race condition as much as possible */
-+    FcStrListFirst (list);
-+    ret += scanDirs (list, config, FcTrue, really_force, verbose, FcFalse, &changed);
-+    FcStrListDone (list);
- 
-     /*
-      * Try to create CACHEDIR.TAG anyway.
-@@ -379,6 +388,8 @@ main (int argc, char **argv)
- 
-     cleanCacheDirectories (config, verbose);
- 
-+    FcConfigDestroy (config);
-+    FcFini ();
-     /* 
-      * Now we need to sleep a second  (or two, to be extra sure), to make
-      * sure that timestamps for changes after this run of fc-cache are later
-@@ -386,8 +397,7 @@ main (int argc, char **argv)
-      * sleep(3) can't be interrupted by a signal here -- this isn't in the
-      * library, and there aren't any signals flying around here.
-      */
--    FcConfigDestroy (config);
--    FcFini ();
-+    /* the resolution of mtime on FAT is 2 seconds */
-     if (changed)
- 	sleep (1);
-     if (verbose)
-diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
-index 58912f5..e588579 100644
---- a/fontconfig/fontconfig.h
-+++ b/fontconfig/fontconfig.h
-@@ -974,6 +974,9 @@ FcStrSetDestroy (FcStrSet *set);
- FcPublic FcStrList *
- FcStrListCreate (FcStrSet *set);
- 
-+FcPublic void
-+FcStrListFirst (FcStrList *list);
-+
- FcPublic FcChar8 *
- FcStrListNext (FcStrList *list);
- 
-diff --git a/src/fcstr.c b/src/fcstr.c
-index 3a32031..5707172 100644
---- a/src/fcstr.c
-+++ b/src/fcstr.c
-@@ -1374,6 +1374,12 @@ FcStrListCreate (FcStrSet *set)
-     return list;
- }
- 
-+void
-+FcStrListFirst (FcStrList *list)
-+{
-+    list->n = 0;
-+}
-+
- FcChar8 *
- FcStrListNext (FcStrList *list)
- {
--- 
-1.8.3.1
-
-From 9a4310176bb11e1e826d238eb0761b7895b48883 Mon Sep 17 00:00:00 2001
-From: Akira TAGOH <akira@tagoh.org>
-Date: Wed, 9 Oct 2013 12:19:35 +0900
-Subject: [PATCH] Add missing doc for FcStrListFirst and fix a typo
-
----
- doc/fcstrset.fncs | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/doc/fcstrset.fncs b/doc/fcstrset.fncs
-index 737347b..b96489a 100644
---- a/doc/fcstrset.fncs
-+++ b/doc/fcstrset.fncs
-@@ -98,12 +98,20 @@ Destroys <parameter>set</parameter>.
- Creates an iterator to list the strings in <parameter>set</parameter>.
- @@
- 
-+@RET@		void
-+@FUNC@		FcStrListFirst
-+@TYPE1@		FcStrList *			@ARG1@		list
-+@PURPOSE@	get first string in iteration
-+@DESC@
-+Returns the first string in <parameter>list</parameter>.
-+@@
-+
- @RET@		FcChar8 *
- @FUNC@		FcStrListNext
- @TYPE1@		FcStrList *			@ARG1@		list	
- @PURPOSE@	get next string in iteration
- @DESC@
--Returns the next string in <parameter>set</parameter>.
-+Returns the next string in <parameter>list</parameter>.
- @@
- 
- @RET@		void
--- 
-1.8.3.1
-
diff --git a/SOURCES/fontconfig-freetype-compat.patch b/SOURCES/fontconfig-freetype-compat.patch
new file mode 100644
index 0000000..c5b7d45
--- /dev/null
+++ b/SOURCES/fontconfig-freetype-compat.patch
@@ -0,0 +1,33 @@
+diff -pruN fontconfig-2.13.0.orig/configure.ac fontconfig-2.13.0/configure.ac
+--- fontconfig-2.13.0.orig/configure.ac	2018-06-08 18:56:53.882676862 +0900
++++ fontconfig-2.13.0/configure.ac	2018-06-08 19:01:14.514726892 +0900
+@@ -319,6 +319,10 @@ fontconfig_save_cflags="$CFLAGS"
+ LIBS="$LIBS $FREETYPE_LIBS"
+ CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
+ AC_CHECK_FUNCS(FT_Get_BDF_Property FT_Get_PS_Font_Info FT_Has_PS_Glyph_Names FT_Get_X11_Font_Format FT_Done_MM_Var)
++AC_CHECK_MEMBERS([TT_OS2.usLowerOpticalPointSize, TT_OS2.usUpperOpticalPointSize], [], [], [[
++#include <ft2build.h>
++#include FT_FREETYPE_H
++#include FT_TRUETYPE_TABLES_H]])
+ 
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ 	#include <ft2build.h>
+diff -pruN fontconfig-2.13.0.orig/src/fcfreetype.c fontconfig-2.13.0/src/fcfreetype.c
+--- fontconfig-2.13.0.orig/src/fcfreetype.c	2018-03-02 13:27:09.000000000 +0900
++++ fontconfig-2.13.0/src/fcfreetype.c	2018-06-08 19:02:17.328703890 +0900
+@@ -1721,6 +1721,7 @@ FcFreeTypeQueryFaceInternal (const FT_Fa
+ 	free (complex_);
+     }
+ 
++#if defined (HAVE_TT_OS2_USUPPEROPTICALPOINTSIZE) && defined (HAVE_TT_OS2_USLOWEROPTICALPOINTSIZE)
+     if (!variable_size && os2 && os2->version >= 0x0005 && os2->version != 0xffff)
+     {
+ 	double lower_size, upper_size;
+@@ -1746,6 +1747,7 @@ FcFreeTypeQueryFaceInternal (const FT_Fa
+ 	    FcRangeDestroy (r);
+ 	}
+     }
++#endif
+ 
+     /*
+      * Type 1: Check for FontInfo dictionary information
diff --git a/SOURCES/fontconfig-implicit-object-for-const-name.patch b/SOURCES/fontconfig-implicit-object-for-const-name.patch
new file mode 100644
index 0000000..8dbde51
--- /dev/null
+++ b/SOURCES/fontconfig-implicit-object-for-const-name.patch
@@ -0,0 +1,31 @@
+From 4699406a68321179b14fae7412f828e2f37a7033 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Wed, 14 Mar 2018 18:31:30 +0900
+Subject: [PATCH 2/5] Add the value of the constant name to the implicit object
+ in the pattern
+
+For objects which has been changed the object type to FcTypeRange.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=105415
+---
+ src/fcname.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/fcname.c b/src/fcname.c
+index 15fb659..c9320ae 100644
+--- a/src/fcname.c
++++ b/src/fcname.c
+@@ -490,6 +490,10 @@ FcNameParse (const FcChar8 *name)
+ 			if (!FcPatternAddBool (pat, c->object, c->value))
+ 			    goto bail2;
+ 			break;
++		    case FcTypeRange:
++			if (!FcPatternAddInteger (pat, c->object, c->value))
++			    goto bail2;
++			break;
+ 		    default:
+ 			break;
+ 		    }
+-- 
+2.14.3
+
diff --git a/SOURCES/fontconfig-locale.patch b/SOURCES/fontconfig-locale.patch
new file mode 100644
index 0000000..c63a717
--- /dev/null
+++ b/SOURCES/fontconfig-locale.patch
@@ -0,0 +1,274 @@
+From 923b5be626a6e03fbaeee0b5cd6d0246c2f8f36f Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Wed, 14 Mar 2018 12:35:05 +0900
+Subject: [PATCH 1/5] Do not override locale if already set by app
+
+https://bugs.freedesktop.org/show_bug.cgi?id=105492
+---
+ src/fccfg.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/fccfg.c b/src/fccfg.c
+index eb0b76d..e311f17 100644
+--- a/src/fccfg.c
++++ b/src/fccfg.c
+@@ -45,11 +45,16 @@ retry_locale:
+     is_locale_initialized = (intptr_t) fc_atomic_ptr_get (&static_is_locale_initialized);
+     if (!is_locale_initialized)
+     {
++	char *loc;
++
+ 	is_locale_initialized = FcTrue;
+ 	if (!fc_atomic_ptr_cmpexch (&static_is_locale_initialized, NULL,
+ 				    (void *)(intptr_t) is_locale_initialized))
+ 	    goto retry_locale;
+-	setlocale (LC_ALL, "");
++
++	loc = setlocale (LC_ALL, NULL);
++	if (!loc || strcmp (loc, "C") == 0)
++	    setlocale (LC_ALL, "");
+     }
+ retry_config:
+     config = fc_atomic_ptr_get (&_fcConfig);
+-- 
+2.14.3
+
+From 98eaef69af1350e459bf9c175476d3b772968874 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Thu, 15 Mar 2018 12:17:52 +0900
+Subject: [PATCH 4/5] Leave the locale setting to applications
+
+https://bugs.freedesktop.org/show_bug.cgi?id=105492
+---
+ fc-conflist/fc-conflist.c |  2 ++
+ src/fccfg.c               | 22 ++--------------------
+ 2 files changed, 4 insertions(+), 20 deletions(-)
+
+diff --git a/fc-conflist/fc-conflist.c b/fc-conflist/fc-conflist.c
+index d02273b..5c40a0f 100644
+--- a/fc-conflist/fc-conflist.c
++++ b/fc-conflist/fc-conflist.c
+@@ -38,6 +38,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <locale.h>
+ 
+ #ifdef ENABLE_NLS
+ #include <libintl.h>
+@@ -102,6 +103,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int		c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "Vh", longopts, NULL)) != -1)
+ #else
+diff --git a/src/fccfg.c b/src/fccfg.c
+index e311f17..e35c451 100644
+--- a/src/fccfg.c
++++ b/src/fccfg.c
+@@ -26,7 +26,6 @@
+ 
+ #include "fcint.h"
+ #include <dirent.h>
+-#include <locale.h>
+ #include <sys/types.h>
+ 
+ #if defined (_WIN32) && !defined (R_OK)
+@@ -39,24 +38,7 @@ static FcConfig *
+ FcConfigEnsure (void)
+ {
+     FcConfig	*config;
+-    FcBool	is_locale_initialized;
+-    static void *static_is_locale_initialized;
+-retry_locale:
+-    is_locale_initialized = (intptr_t) fc_atomic_ptr_get (&static_is_locale_initialized);
+-    if (!is_locale_initialized)
+-    {
+-	char *loc;
+-
+-	is_locale_initialized = FcTrue;
+-	if (!fc_atomic_ptr_cmpexch (&static_is_locale_initialized, NULL,
+-				    (void *)(intptr_t) is_locale_initialized))
+-	    goto retry_locale;
+-
+-	loc = setlocale (LC_ALL, NULL);
+-	if (!loc || strcmp (loc, "C") == 0)
+-	    setlocale (LC_ALL, "");
+-    }
+-retry_config:
++retry:
+     config = fc_atomic_ptr_get (&_fcConfig);
+     if (!config)
+     {
+@@ -64,7 +46,7 @@ retry_config:
+ 
+ 	if (!fc_atomic_ptr_cmpexch (&_fcConfig, NULL, config)) {
+ 	    FcConfigDestroy (config);
+-	    goto retry_config;
++	    goto retry;
+ 	}
+     }
+     return config;
+-- 
+2.14.3
+
+From 2938e4d72da40f6bb0d22086c519a9852a820f40 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH <akira@tagoh.org>
+Date: Thu, 15 Mar 2018 12:54:02 +0900
+Subject: [PATCH 5/5] call setlocale
+
+---
+ fc-cache/fc-cache.c     | 2 ++
+ fc-cat/fc-cat.c         | 2 ++
+ fc-list/fc-list.c       | 2 ++
+ fc-match/fc-match.c     | 2 ++
+ fc-pattern/fc-pattern.c | 2 ++
+ fc-query/fc-query.c     | 2 ++
+ fc-scan/fc-scan.c       | 2 ++
+ 7 files changed, 14 insertions(+)
+
+diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
+index dc93c19..87e3020 100644
+--- a/fc-cache/fc-cache.c
++++ b/fc-cache/fc-cache.c
+@@ -41,6 +41,7 @@
+ #include <fcntl.h>
+ #include <dirent.h>
+ #include <string.h>
++#include <locale.h>
+ 
+ #if defined (_WIN32)
+ #define STRICT
+@@ -302,6 +303,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int		c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "Efrsy:Vvh", longopts, NULL)) != -1)
+ #else
+diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c
+index dfe30d7..69611bc 100644
+--- a/fc-cat/fc-cat.c
++++ b/fc-cat/fc-cat.c
+@@ -40,6 +40,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <errno.h>
++#include <locale.h>
+ 
+ #ifdef ENABLE_NLS
+ #include <libintl.h>
+@@ -271,6 +272,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int		c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "Vvrh", longopts, NULL)) != -1)
+ #else
+diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
+index 5cded50..2039acd 100644
+--- a/fc-list/fc-list.c
++++ b/fc-list/fc-list.c
+@@ -27,6 +27,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <locale.h>
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #else
+@@ -117,6 +118,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int			c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "vbf:qVh", longopts, NULL)) != -1)
+ #else
+diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
+index 7902707..dee6147 100644
+--- a/fc-match/fc-match.c
++++ b/fc-match/fc-match.c
+@@ -36,6 +36,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <locale.h>
+ 
+ #ifdef ENABLE_NLS
+ #include <libintl.h>
+@@ -121,6 +122,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int			c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "asvbf:Vh", longopts, NULL)) != -1)
+ #else
+diff --git a/fc-pattern/fc-pattern.c b/fc-pattern/fc-pattern.c
+index f63761c..7989b81 100644
+--- a/fc-pattern/fc-pattern.c
++++ b/fc-pattern/fc-pattern.c
+@@ -36,6 +36,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <locale.h>
+ 
+ #ifdef ENABLE_NLS
+ #include <libintl.h>
+@@ -111,6 +112,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int		c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "cdf:Vh", longopts, NULL)) != -1)
+ #else
+diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c
+index 9da090d..fbffb84 100644
+--- a/fc-query/fc-query.c
++++ b/fc-query/fc-query.c
+@@ -39,6 +39,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <locale.h>
+ 
+ #ifdef ENABLE_NLS
+ #include <libintl.h>
+@@ -115,6 +116,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int		c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "i:bf:Vh", longopts, NULL)) != -1)
+ #else
+diff --git a/fc-scan/fc-scan.c b/fc-scan/fc-scan.c
+index edb967c..9302ac5 100644
+--- a/fc-scan/fc-scan.c
++++ b/fc-scan/fc-scan.c
+@@ -39,6 +39,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <locale.h>
+ 
+ #ifdef ENABLE_NLS
+ #include <libintl.h>
+@@ -110,6 +111,7 @@ main (int argc, char **argv)
+ #if HAVE_GETOPT_LONG || HAVE_GETOPT
+     int		c;
+ 
++    setlocale (LC_ALL, "");
+ #if HAVE_GETOPT_LONG
+     while ((c = getopt_long (argc, argv, "bf:Vh", longopts, NULL)) != -1)
+ #else
+-- 
+2.14.3
+
diff --git a/SOURCES/fontconfig-no-dir-when-no-conf.patch b/SOURCES/fontconfig-no-dir-when-no-conf.patch
deleted file mode 100644
index 53eb6d1..0000000
--- a/SOURCES/fontconfig-no-dir-when-no-conf.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 3e5f70a16ac6d54f1e01c92ddaa5985deec1b7f9 Mon Sep 17 00:00:00 2001
-From: Akira TAGOH <akira@tagoh.org>
-Date: Mon, 2 Sep 2013 20:51:46 +0900
-Subject: [PATCH] Do not create a config dir for migration when no config files
- nor dirs
-
----
- src/fcxml.c | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/src/fcxml.c b/src/fcxml.c
-index b464b4e..8ff10b6 100644
---- a/src/fcxml.c
-+++ b/src/fcxml.c
-@@ -2233,11 +2233,6 @@ FcParseInclude (FcConfigParse *parse)
- 	    /* No config dir nor file on the XDG directory spec compliant place
- 	     * so need to guess what it is supposed to be.
- 	     */
--	    FcChar8 *parent = FcStrDirname (s);
--
--	    if (!FcFileIsDir (parent))
--		FcMakeDirectory (parent);
--	    FcStrFree (parent);
- 	    if (FcStrStr (s, (const FcChar8 *)"conf.d") != NULL)
- 		goto userdir;
- 	    else
-@@ -2259,6 +2254,11 @@ FcParseInclude (FcConfigParse *parse)
- 	{
- 	    if (FcFileIsDir (filename))
- 	    {
-+		FcChar8 *parent = FcStrDirname (userdir);
-+
-+		if (!FcFileIsDir (parent))
-+		    FcMakeDirectory (parent);
-+		FcStrFree (parent);
- 		if (FcFileIsDir (userdir) ||
- 		    rename ((const char *)filename, (const char *)userdir) != 0 ||
- 		    symlink ((const char *)userdir, (const char *)filename) != 0)
-@@ -2272,6 +2272,11 @@ FcParseInclude (FcConfigParse *parse)
- 	    }
- 	    else
- 	    {
-+		FcChar8 *parent = FcStrDirname (userconf);
-+
-+		if (!FcFileIsDir (parent))
-+		    FcMakeDirectory (parent);
-+		FcStrFree (parent);
- 		if (FcFileIsFile (userconf) ||
- 		    rename ((const char *)filename, (const char *)userconf) != 0 ||
- 		    symlink ((const char *)userconf, (const char *)filename) != 0)
--- 
-1.8.3.1
-
diff --git a/SOURCES/fontconfig-offset-in-elts.patch b/SOURCES/fontconfig-offset-in-elts.patch
deleted file mode 100644
index 48f7c27..0000000
--- a/SOURCES/fontconfig-offset-in-elts.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git a/src/fccache.c b/src/fccache.c
-index 02ec301..6f3c68a 100644
---- a/src/fccache.c
-+++ b/src/fccache.c
-@@ -640,6 +640,7 @@ FcCacheOffsetsValid (FcCache *cache)
-             FcPattern		*font = FcFontSetFont (fs, i);
-             FcPatternElt	*e;
-             FcValueListPtr	 l;
-+	    char                *last_offset;
- 
-             if ((char *) font < base ||
-                 (char *) font > end - sizeof (FcFontSet) ||
-@@ -653,11 +654,17 @@ FcCacheOffsetsValid (FcCache *cache)
-             if (e->values != 0 && !FcIsEncodedOffset(e->values))
-                 return FcFalse;
- 
--            for (j = font->num, l = FcPatternEltValues(e); j >= 0 && l; j--, l = FcValueListNext(l))
--                if (l->next != NULL && !FcIsEncodedOffset(l->next))
--                    break;
--            if (j < 0)
--                return FcFalse;
-+	    for (j = 0; j < font->num; j++)
-+	    {
-+		last_offset = (char *) font + font->elts_offset;
-+		for (l = FcPatternEltValues(&e[j]); l; l = FcValueListNext(l))
-+		{
-+		    if ((char *) l < last_offset || (char *) l > end - sizeof (*l) ||
-+			(l->next != NULL && !FcIsEncodedOffset(l->next)))
-+			return FcFalse;
-+		    last_offset = (char *) l + 1;
-+		}
-+	    }
-         }
-     }
- 
diff --git a/SOURCES/fontconfig-required-freetype-version.patch b/SOURCES/fontconfig-required-freetype-version.patch
new file mode 100644
index 0000000..6f7aae3
--- /dev/null
+++ b/SOURCES/fontconfig-required-freetype-version.patch
@@ -0,0 +1,14 @@
+diff -pruN fontconfig-2.12.93.orig/configure.ac fontconfig-2.12.93/configure.ac
+--- fontconfig-2.12.93.orig/configure.ac	2018-02-15 22:01:54.000000000 +0900
++++ fontconfig-2.12.93/configure.ac	2018-02-15 22:33:42.353941393 +0900
+@@ -308,8 +308,8 @@ AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,
+ # Checks for FreeType
+ #
+ dnl See http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/VERSIONS.TXT for versioning in freetype
+-PKG_CHECK_MODULES(FREETYPE, freetype2 >= 21.0.15)
+-PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES freetype2 >= 21.0.15"
++PKG_CHECK_MODULES(FREETYPE, freetype2 >= 20.0.14)
++PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES freetype2 >= 20.0.14"
+ 
+ AC_SUBST(FREETYPE_LIBS)
+ AC_SUBST(FREETYPE_CFLAGS)
diff --git a/SOURCES/fontconfig-revert-urw-alias.patch b/SOURCES/fontconfig-revert-urw-alias.patch
new file mode 100644
index 0000000..8d34d31
--- /dev/null
+++ b/SOURCES/fontconfig-revert-urw-alias.patch
@@ -0,0 +1,213 @@
+From 2084b76bea78f9a41349de57d76134efd5174d96 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
+Date: Fri, 15 Sep 2017 22:52:52 +0200
+Subject: [PATCH 324/491] build: Remove references to deleted file
+
+Commit cc67d7df17 removed 30-urw-aliases.conf, so don't try to
+install it.
+---
+ conf.d/Makefile.am | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am
+index fd50a5d..ff03fb2 100644
+--- a/conf.d/Makefile.am
++++ b/conf.d/Makefile.am
+@@ -29,7 +29,6 @@ CONF_LINKS = \
+ 	10-hinting-$(PREFERRED_HINTING).conf	\
+ 	10-scale-bitmap-fonts.conf \
+ 	20-unhint-small-vera.conf \
+-	30-urw-aliases.conf \
+ 	30-metric-aliases.conf \
+ 	40-nonlatin.conf \
+ 	45-generic.conf \
+@@ -70,7 +69,6 @@ template_DATA =				\
+ 	11-lcdfilter-light.conf		\
+ 	20-unhint-small-vera.conf	\
+ 	25-unhint-nonlatin.conf		\
+-	30-urw-aliases.conf		\
+ 	30-metric-aliases.conf		\
+ 	40-nonlatin.conf		\
+ 	45-generic.conf			\
+-- 
+2.17.1
+
+From cc67d7df172431cb345ed42c27eb852e2ee65ae2 Mon Sep 17 00:00:00 2001
+From: "David Kaspar [Dee'Kej]" <dkaspar@redhat.com>
+Date: Fri, 1 Sep 2017 11:05:16 +0200
+Subject: [PATCH 323/491] conf.d: Drop aliases for (URW)++ fonts
+
+  They have become a part of (URW)++ upstream release now:
+  https://github.com/ArtifexSoftware/urw-base35-fonts/tree/master/fontconfig
+---
+ conf.d/30-metric-aliases.conf | 29 +++--------------------------
+ conf.d/30-urw-aliases.conf    | 33 ---------------------------------
+ 2 files changed, 3 insertions(+), 59 deletions(-)
+ delete mode 100644 conf.d/30-urw-aliases.conf
+
+diff --git a/conf.d/30-metric-aliases.conf b/conf.d/30-metric-aliases.conf
+index 1f0778d..c755c5e 100644
+--- a/conf.d/30-metric-aliases.conf
++++ b/conf.d/30-metric-aliases.conf
+@@ -44,6 +44,9 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 3) Alias each generic to its specifics.
+    e.g. Arial to Liberation Sans, Arimo, Albany, and Albany AMT
+ 
++NOTE: The (URW)++ fonts mappings of generics to specifics were removed, because
++      upstream now includes them in their release of (URW)++ Core Font Set here:
++      https://github.com/ArtifexSoftware/urw-base35-fonts/tree/master/fontconfig
+ -->
+ 
+ <!-- Map specifics to generics -->
+@@ -308,7 +311,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  </default>
+ 	</alias>
+ 
+-
+ 	<!-- Microsoft -->
+ 	<alias binding="same">
+ 	  <family>Arimo</family>
+@@ -460,7 +462,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  </default>
+ 	</alias>
+ 
+-
+ 	<!-- Microsoft -->
+ 	<alias>
+ 	  <family>Arial</family>
+@@ -490,8 +491,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  </default>
+ 	</alias>
+ 
+-
+-
+ <!-- Map generics to specifics -->
+ 
+ 	<!-- PostScript -->
+@@ -499,8 +498,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <family>Helvetica</family>
+ 	  <accept>
+ 	  <family>TeX Gyre Heros</family>
+-	  <family>Nimbus Sans</family>
+-	  <family>Nimbus Sans L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -508,7 +505,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <family>Helvetica Narrow</family>
+ 	  <accept>
+ 	  <family>TeX Gyre Heros Cn</family>
+-	  <family>Nimbus Sans Narrow</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -516,8 +512,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <family>Times</family>
+ 	  <accept>
+ 	  <family>TeX Gyre Termes</family>
+-	  <family>Nimbus Roman</family>
+-	  <family>Nimbus Roman No9 L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -525,9 +519,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <family>Courier</family>
+ 	  <accept>
+ 	  <family>TeX Gyre Cursor</family>
+-	  <family>Nimbus Mono PS</family>
+-	  <family>Nimbus Mono</family>
+-	  <family>Nimbus Mono L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -535,8 +526,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <family>ITC Avant Garde Gothic</family>
+ 	  <accept>
+ 	  <family>TeX Gyre Adventor</family>
+-	  <family>URW Gothic</family>
+-	  <family>URW Gothic L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -545,9 +534,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <accept>
+ 	  <family>Bookman Old Style</family>
+ 	  <family>TeX Gyre Bonum</family>
+-	  <family>URW Bookman</family>
+-	  <family>Bookman URW</family>
+-	  <family>URW Bookman L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -555,9 +541,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <family>ITC Zapf Chancery</family>
+ 	  <accept>
+ 	  <family>TeX Gyre Chorus</family>
+-	  <family>Z003</family>
+-	  <family>Chancery URW</family>
+-	  <family>URW Chancery L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -566,9 +549,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <accept>
+ 	  <family>Palatino Linotype</family>
+ 	  <family>TeX Gyre Pagella</family>
+-	  <family>P052</family>
+-	  <family>Palladio URW</family>
+-	  <family>URW Palladio L</family>
+ 	  </accept>
+ 	</alias>
+ 
+@@ -577,9 +557,6 @@ but in an order preferring similar designs first.  We do this in three steps:
+ 	  <accept>
+ 	  <family>Century Schoolbook</family>
+ 	  <family>TeX Gyre Schola</family>
+-	  <family>C059</family>
+-	  <family>Century SchoolBook URW</family>
+-	  <family>Century Schoolbook L</family>
+ 	  </accept>
+ 	</alias>
+ 
+diff --git a/conf.d/30-urw-aliases.conf b/conf.d/30-urw-aliases.conf
+deleted file mode 100644
+index cfde071..0000000
+--- a/conf.d/30-urw-aliases.conf
++++ /dev/null
+@@ -1,33 +0,0 @@
+-<?xml version="1.0"?>
+-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+-<fontconfig>
+-<!--
+-  URW provides metric and shape compatible fonts for some Adobe families.
+-  Most of these are handled in 30-metric-aliases.conf.
+-  -->
+-	<alias binding="same">
+-	  <family>Zapf Dingbats</family>
+-	  <accept>
+-	    <family>D050000L</family>
+-	    <family>Dingbats</family>
+-	  </accept>
+-	</alias>
+-	<alias binding="same">
+-	  <family>ITC Zapf Dingbats</family>
+-	  <accept>
+-	    <family>D050000L</family>
+-	    <family>Dingbats</family>
+-	  </accept>
+-	</alias>
+-	<match target="pattern">
+-	  <test name="family" compare="eq" ignore-blanks="true">
+-	    <string>Symbol</string>
+-	  </test>
+-	  <edit name="family" mode="append" binding="same">
+-	    <string>Standard Symbols PS</string>
+-	  </edit>
+-	  <edit name="family" mode="append" binding="same">
+-	    <string>Standard Symbols L</string>
+-	  </edit>
+-	</match>
+-</fontconfig>
+-- 
+2.17.1
+
diff --git a/SOURCES/fontconfig-sleep-less.patch b/SOURCES/fontconfig-sleep-less.patch
new file mode 100644
index 0000000..bd9c58c
--- /dev/null
+++ b/SOURCES/fontconfig-sleep-less.patch
@@ -0,0 +1,12 @@
+diff -pruN fontconfig-2.12.91.orig/fc-cache/fc-cache.c fontconfig-2.12.91/fc-cache/fc-cache.c
+--- fontconfig-2.12.91.orig/fc-cache/fc-cache.c	2017-11-20 21:02:20.000000000 +0900
++++ fontconfig-2.12.91/fc-cache/fc-cache.c	2017-12-14 16:59:19.002003145 +0900
+@@ -413,7 +413,7 @@ main (int argc, char **argv)
+      */
+     /* the resolution of mtime on FAT is 2 seconds */
+     if (changed)
+-	sleep (2);
++	sleep (1);
+     if (verbose)
+ 	printf ("%s: %s\n", argv[0], ret ? _("failed") : _("succeeded"));
+     return ret;
diff --git a/SOURCES/fontconfig-update-45-latin.patch b/SOURCES/fontconfig-update-45-latin.patch
deleted file mode 100644
index 53b6613..0000000
--- a/SOURCES/fontconfig-update-45-latin.patch
+++ /dev/null
@@ -1,293 +0,0 @@
-diff --git a/conf.d/45-latin.conf b/conf.d/45-latin.conf
-index aa62ed4..5228945 100644
---- a/conf.d/45-latin.conf
-+++ b/conf.d/45-latin.conf
-@@ -14,23 +14,31 @@
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
-+		<family>Cambria</family>
-+		<default><family>serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Constantia</family>
-+		<default><family>serif</family></default>
-+	</alias>
-+	<alias>
- 		<family>DejaVu Serif</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Liberation Serif</family>
-+		<family>Elephant</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Times New Roman</family>
-+		<family>Garamond</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Times</family>
-+		<family>Georgia</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Nimbus Roman No9 L</family>
-+		<family>Liberation Serif</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
-@@ -38,42 +46,50 @@
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Thorndale AMT</family>
-+		<family>MS Serif</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Thorndale</family>
-+		<family>Nimbus Roman No9 L</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Georgia</family>
-+		<family>Nimbus Roman</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Garamond</family>
-+		<family>Palatino Linotype</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Palatino Linotype</family>
-+		<family>Thorndale AMT</family>
- 		<default><family>serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Trebuchet MS</family>
-+		<family>Thorndale</family>
-+		<default><family>serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Times New Roman</family>
-+		<default><family>serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Times</family>
- 		<default><family>serif</family></default>
- 	</alias>
- <!--
-   Sans-serif faces
-  -->
- 	<alias>
--		<family>Bitstream Vera Sans</family>
-+		<family>Albany AMT</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
--		<family>DejaVu Sans</family>
-+		<family>Albany</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Liberation Sans</family>
-+		<family>Arial Unicode MS</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
-@@ -81,19 +97,47 @@
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
-+		<family>Bitstream Vera Sans</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Britannic</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Calibri</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Candara</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Century Gothic</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Corbel</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>DejaVu Sans</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
- 		<family>Helvetica</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Verdana</family>
-+		<family>Haettenschweiler</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Albany AMT</family>
-+		<family>Liberation Sans</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
--		<family>Albany</family>
-+		<family>MS Sans Serif</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
-@@ -101,88 +145,124 @@
- 		<default><family>sans-serif</family></default>
- 	</alias>
- 	<alias>
-+		<family>Nimbus Sans</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
- 		<family>Luxi Sans</family>
- 		<default><family>sans-serif</family></default>
- 	</alias>
-+	<alias>
-+		<family>Tahoma</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Trebuchet MS</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Twentieth Century</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
-+	<alias>
-+		<family>Verdana</family>
-+		<default><family>sans-serif</family></default>
-+	</alias>
- <!--
-   Monospace faces
-  -->
-+	<alias>
-+		<family>Andale Mono</family>
-+		<default><family>monospace</family></default>
-+	</alias>
-  	<alias>
- 		<family>Bitstream Vera Sans Mono</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>DejaVu Sans Mono</family>
-+		<family>Consolas</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Liberation Mono</family>
-+		<family>Courier New</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Inconsolata</family>
-+		<family>Courier</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Courier New</family>
-+		<family>Cumberland AMT</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Courier</family>
-+		<family>Cumberland</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Andale Mono</family>
-+		<family>DejaVu Sans Mono</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Luxi Mono</family>
-+		<family>Fixedsys</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Cumberland AMT</family>
-+		<family>Inconsolata</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
--		<family>Cumberland</family>
-+		<family>Liberation Mono</family>
-+		<default><family>monospace</family></default>
-+	</alias>
-+	<alias>
-+		<family>Luxi Mono</family>
- 		<default><family>monospace</family></default>
- 	</alias>
- 	<alias>
- 		<family>Nimbus Mono L</family>
- 		<default><family>monospace</family></default>
- 	</alias>
-+	<alias>
-+		<family>Nimbus Mono</family>
-+		<default><family>monospace</family></default>
-+	</alias>
-+	<alias>
-+		<family>Terminal</family>
-+		<default><family>monospace</family></default>
-+	</alias>
- <!--
-   Fantasy faces
-  -->
-- 	<alias>
--		<family>Impact</family>
-+	<alias>
-+		<family>Bauhaus Std</family>
- 		<default><family>fantasy</family></default>
- 	</alias>
- 	<alias>
--		<family>Copperplate Gothic Std</family>
-+		<family>Cooper Std</family>
- 		<default><family>fantasy</family></default>
- 	</alias>
- 	<alias>
--		<family>Cooper Std</family>
-+		<family>Copperplate Gothic Std</family>
- 		<default><family>fantasy</family></default>
- 	</alias>
- 	<alias>
--		<family>Bauhaus Std</family>
-+		<family>Impact</family>
- 		<default><family>fantasy</family></default>
- 	</alias>
- <!--
-   Cursive faces
-   -->
- 	<alias>
--		<family>ITC Zapf Chancery Std</family>
-+		<family>Comic Sans MS</family>
- 		<default><family>cursive</family></default>
- 	</alias>
- 	<alias>
--		<family>Zapfino</family>
-+		<family>ITC Zapf Chancery Std</family>
- 		<default><family>cursive</family></default>
- 	</alias>
- 	<alias>
--		<family>Comic Sans MS</family>
-+		<family>Zapfino</family>
- 		<default><family>cursive</family></default>
- 	</alias>
- 
diff --git a/SOURCES/fontconfig-validate-offset-in-cache.patch b/SOURCES/fontconfig-validate-offset-in-cache.patch
deleted file mode 100644
index 9009ffd..0000000
--- a/SOURCES/fontconfig-validate-offset-in-cache.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-diff -pruN fontconfig-2.10.95.orig/src/fccache.c fontconfig-2.10.95/src/fccache.c
---- fontconfig-2.10.95.orig/src/fccache.c	2013-08-26 11:49:32.000000000 +0900
-+++ fontconfig-2.10.95/src/fccache.c	2016-08-05 18:01:48.040872110 +0900
-@@ -30,6 +30,7 @@
- #include <fcntl.h>
- #include <dirent.h>
- #include <string.h>
-+#include <limits.h>
- #include <sys/types.h>
- #include <assert.h>
- #if defined(HAVE_MMAP) || defined(__CYGWIN__)
-@@ -547,6 +548,82 @@ FcCacheTimeValid (FcCache *cache, struct
-     return cache->checksum == (int) dir_stat->st_mtime;
- }
- 
-+static FcBool
-+FcCacheOffsetsValid (FcCache *cache)
-+{
-+    char		*base = (char *)cache;
-+    char		*end = base + cache->size;
-+    intptr_t		*dirs;
-+    FcFontSet		*fs;
-+    int			 i, j;
-+
-+    if (cache->dir < 0 || cache->dir > cache->size - sizeof (intptr_t) ||
-+        memchr (base + cache->dir, '\0', cache->size - cache->dir) == NULL)
-+        return FcFalse;
-+
-+    if (cache->dirs < 0 || cache->dirs >= cache->size ||
-+        cache->dirs_count < 0 ||
-+        cache->dirs_count > (cache->size - cache->dirs) / sizeof (intptr_t))
-+        return FcFalse;
-+
-+    dirs = FcCacheDirs (cache);
-+    if (dirs)
-+    {
-+        for (i = 0; i < cache->dirs_count; i++)
-+        {
-+            FcChar8	*dir;
-+
-+            if (dirs[i] < 0 ||
-+                dirs[i] > end - (char *) dirs - sizeof (intptr_t))
-+                return FcFalse;
-+
-+            dir = FcOffsetToPtr (dirs, dirs[i], FcChar8);
-+            if (memchr (dir, '\0', end - (char *) dir) == NULL)
-+                return FcFalse;
-+         }
-+    }
-+
-+    if (cache->set < 0 || cache->set > cache->size - sizeof (FcFontSet))
-+        return FcFalse;
-+
-+    fs = FcCacheSet (cache);
-+    if (fs)
-+    {
-+        if (fs->nfont > (end - (char *) fs) / sizeof (FcPattern))
-+            return FcFalse;
-+
-+        if (fs->fonts != 0 && !FcIsEncodedOffset(fs->fonts))
-+            return FcFalse;
-+
-+        for (i = 0; i < fs->nfont; i++)
-+        {
-+            FcPattern		*font = FcFontSetFont (fs, i);
-+            FcPatternElt	*e;
-+            FcValueListPtr	 l;
-+
-+            if ((char *) font < base ||
-+                (char *) font > end - sizeof (FcFontSet) ||
-+                font->elts_offset < 0 ||
-+                font->elts_offset > end - (char *) font ||
-+                font->num > (end - (char *) font - font->elts_offset) / sizeof (FcPatternElt))
-+                return FcFalse;
-+
-+
-+            e = FcPatternElts(font);
-+            if (e->values != 0 && !FcIsEncodedOffset(e->values))
-+                return FcFalse;
-+
-+            for (j = font->num, l = FcPatternEltValues(e); j >= 0 && l; j--, l = FcValueListNext(l))
-+                if (l->next != NULL && !FcIsEncodedOffset(l->next))
-+                    break;
-+            if (j < 0)
-+                return FcFalse;
-+        }
-+    }
-+
-+    return FcTrue;
-+}
-+
- /*
-  * Map a cache file into memory
-  */
-@@ -556,7 +633,8 @@ FcDirCacheMapFd (int fd, struct stat *fd
-     FcCache	*cache;
-     FcBool	allocated = FcFalse;
- 
--    if (fd_stat->st_size < (int) sizeof (FcCache))
-+    if (fd_stat->st_size > INTPTR_MAX ||
-+        fd_stat->st_size < (int) sizeof (FcCache))
- 	return NULL;
-     cache = FcCacheFindByStat (fd_stat);
-     if (cache)
-@@ -612,6 +690,7 @@ FcDirCacheMapFd (int fd, struct stat *fd
-     if (cache->magic != FC_CACHE_MAGIC_MMAP ||
- 	cache->version < FC_CACHE_CONTENT_VERSION ||
- 	cache->size != (intptr_t) fd_stat->st_size ||
-+	!FcCacheOffsetsValid (cache) ||
- 	!FcCacheTimeValid (cache, dir_stat) ||
- 	!FcCacheInsert (cache, fd_stat))
-     {
diff --git a/SPECS/fontconfig.spec b/SPECS/fontconfig.spec
index 15bf7ab..ffcb02d 100644
--- a/SPECS/fontconfig.spec
+++ b/SPECS/fontconfig.spec
@@ -1,9 +1,9 @@
-%global freetype_version 2.1.4
+%global freetype_version 2.8-7
 
 Summary:	Font configuration and customization library
 Name:		fontconfig
-Version:	2.10.95
-Release:	11%{?dist}
+Version:	2.13.0
+Release:	4.3%{?dist}
 # src/ftglue.[ch] is in Public Domain
 # src/fccache.c contains Public Domain code
 # fc-case/CaseFolding.txt is in the UCD
@@ -13,27 +13,33 @@ Group:		System Environment/Libraries
 Source:		http://fontconfig.org/release/%{name}-%{version}.tar.bz2
 URL:		http://fontconfig.org
 Source1:	25-no-bitmap-fedora.conf
-Source2:	FcStrListFirst.3
+Source2:	fc-cache
 
 # https://bugzilla.redhat.com/show_bug.cgi?id=140335
-Patch0:		fontconfig-2.8.0-sleep-less.patch
-Patch1:		fontconfig-no-dir-when-no-conf.patch
-Patch2:		fontconfig-fix-memleak.patch
-Patch3:		fontconfig-copy-all-value.patch
-Patch4:		fontconfig-fix-crash-on-fcfontsort.patch
-Patch5:		fontconfig-fix-race-condition.patch
-Patch6:		fontconfig-update-45-latin.patch
-Patch7:		fontconfig-validate-offset-in-cache.patch
-Patch8:		fontconfig-offset-in-elts.patch
+Patch0:		%{name}-sleep-less.patch
+Patch1:		%{name}-required-freetype-version.patch
+Patch2:		%{name}-const-name-in-range.patch
+Patch3:		%{name}-implicit-object-for-const-name.patch
+Patch4:		%{name}-locale.patch
+Patch5:		%{name}-fix-embolden-logic.patch
+Patch6:		%{name}-fix-memleaks.patch
+Patch7:		%{name}-fix-flatpak.patch
+Patch8:		%{name}-fix-doublefree.patch
+Patch9:		%{name}-revert-urw-alias.patch
+Patch10:	%{name}-drop-incompatible-conf.patch
+Patch11:	%{name}-freetype-compat.patch
 
 BuildRequires:	expat-devel
 BuildRequires:	freetype-devel >= %{freetype_version}
 BuildRequires:	fontpackages-devel
+BuildRequires:	libuuid-devel
+BuildRequires:	autoconf automake libtool gettext itstool
+BuildRequires:	gperf
 
-Requires:	fontpackages-filesystem
-Requires(pre):	freetype
+Requires:	fontpackages-filesystem freetype
+Requires(pre):	freetype >= 2.8-7
 Requires(post):	grep coreutils
-Requires:	font(:lang=en)
+Requires:	dejavu-sans-fonts
 
 %description
 Fontconfig is designed to locate fonts within the
@@ -46,6 +52,7 @@ Group:		Development/Libraries
 Requires:	%{name}%{?_isa} = %{version}-%{release}
 Requires:	freetype-devel >= %{freetype_version}
 Requires:	pkgconfig
+Requires:	gettext
 
 %description	devel
 The fontconfig-devel package includes the header files,
@@ -67,22 +74,25 @@ which is useful for developing applications that uses fontconfig.
 %prep
 %setup -q
 %patch0 -p1 -b .sleep-less
-%patch1 -p1 -b .nodir
-%patch2 -p1 -b .memleak
-%patch3 -p1 -b .copy-all
-%patch4 -p1 -b .fix-crash
-%patch5 -p1 -b .fix-race
-%patch6 -p1 -b .update-45-latin
-%patch7 -p1 -b .validate-offset
-%patch8 -p1 -b .offset-elts
-cp %{SOURCE2} doc/
+%patch1 -p1 -b .freetype
+%patch2 -p1 -b .const-range
+%patch3 -p1 -b .const
+%patch4 -p1 -b .locale
+%patch5 -p1 -b .embolden
+%patch6 -p1 -b .memleaks
+%patch7 -p1 -b .flatpak
+%patch8 -p1 -b .doublefree
+%patch9 -p1 -b .urw -R
+%patch10 -p1 -b .incompat
+%patch11 -p1 -b .freetype-compat
 
 %build
 # We don't want to rebuild the docs, but we want to install the included ones.
 export HASDOCBOOK=no
 
+autoreconf
 %configure	--with-add-fonts=/usr/share/X11/fonts/Type1,/usr/share/X11/fonts/TTF,/usr/local/share/fonts \
-		--disable-static
+		--disable-static --with-cache-dir=/usr/lib/fontconfig/cache
 
 make %{?_smp_mflags} V=1
 
@@ -94,11 +104,20 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
 install -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/fonts/conf.d
 ln -s %{_fontconfig_templatedir}/25-unhint-nonlatin.conf $RPM_BUILD_ROOT%{_fontconfig_confdir}/
 
-# move installed doc files back to build directory to package themm
+# move installed doc files back to build directory to package them
 # in the right place
 mv $RPM_BUILD_ROOT%{_docdir}/fontconfig/* .
 rmdir $RPM_BUILD_ROOT%{_docdir}/fontconfig/
 
+# rename fc-cache binary
+mv $RPM_BUILD_ROOT%{_bindir}/fc-cache $RPM_BUILD_ROOT%{_bindir}/fc-cache-%{__isa_bits}
+
+install -p -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/fc-cache
+
+%find_lang %{name}
+%find_lang %{name}-conf
+cat %{name}-conf.lang >> %{name}.lang
+
 %check
 make check V=1
 
@@ -107,7 +126,9 @@ make check V=1
 
 umask 0022
 
-mkdir -p %{_localstatedir}/cache/fontconfig
+mkdir -p /usr/lib/fontconfig/cache
+
+[[ -d %{_localstatedir}/cache/fontconfig ]] && rm -rf %{_localstatedir}/cache/fontconfig/* 2> /dev/null || :
 
 # Force regeneration of all fontconfig cache files
 # The check for existance is needed on dual-arch installs (the second
@@ -119,13 +140,14 @@ fi
 
 %postun -p /sbin/ldconfig
 
-%files
+%files -f %{name}.lang
 %doc README AUTHORS COPYING
 %doc fontconfig-user.txt fontconfig-user.html
 %doc %{_fontconfig_confdir}/README
 %{_libdir}/libfontconfig.so.*
-%{_bindir}/fc-cache
+%{_bindir}/fc-cache*
 %{_bindir}/fc-cat
+%{_bindir}/fc-conflist
 %{_bindir}/fc-list
 %{_bindir}/fc-match
 %{_bindir}/fc-pattern
@@ -138,7 +160,7 @@ fi
 # If you want to do so, you should use local.conf instead.
 %config %{_fontconfig_masterdir}/fonts.conf
 %config(noreplace) %{_fontconfig_confdir}/*.conf
-%dir %{_localstatedir}/cache/fontconfig
+%dir /usr/lib/fontconfig/cache
 %{_mandir}/man1/*
 %{_mandir}/man5/*
 
@@ -147,11 +169,26 @@ fi
 %{_libdir}/pkgconfig/*
 %{_includedir}/fontconfig
 %{_mandir}/man3/*
+%{_datadir}/gettext/its/fontconfig.its
+%{_datadir}/gettext/its/fontconfig.loc
 
 %files devel-doc
 %doc fontconfig-devel.txt fontconfig-devel
 
 %changelog
+* Fri Jun 08 2018 Akira TAGOH <tagoh@redhat.com> - 2.13.0-4.3
+- Add 30-urw-aliases.conf back.
+
+* Fri Jun 08 2018 Akira TAGOH <tagoh@redhat.com> - 2.13.0-4.2
+- Drop more new syntax in config.
+
+* Fri Jun 08 2018 Akira TAGOH <tagoh@redhat.com> - 2.13.0-4.1
+- Rebase to 2.13.0 (#1576501)
+- Rename fc-cache binary to fc-cache-{32,64} for multilib. (#1568968)
+- backport some fixes related to Flatpak.
+- Drop new syntax in config for compatibility.
+- Requires dejavu-sans-fonts instead of font(:lang=en) (#1484094)
+
 * Fri Feb 24 2017 Akira TAGOH <tagoh@redhat.com> - 2.10.95-11
 - Add Requires: font(:lang=en) (#1403957)