diff --git a/.freetype.metadata b/.freetype.metadata
index 561c0ef..a138cce 100644
--- a/.freetype.metadata
+++ b/.freetype.metadata
@@ -1,3 +1,3 @@
-b15e5a0b30c1e854484b410340f6429ad1253c74 SOURCES/freetype-2.4.11.tar.bz2
-8cca4f5c23046c14348103759c5130bc838cbb76 SOURCES/freetype-doc-2.4.11.tar.bz2
-52b68556544a470ff8fc98467e170d4174c1a74f SOURCES/ft2demos-2.4.11.tar.bz2
+42c6b1f733fe13a3eba135f5025b22cb68450f91 SOURCES/freetype-2.8.tar.bz2
+5b221ee14fe674cd5f6db0193d55360bc0bd3655 SOURCES/freetype-doc-2.8.tar.bz2
+7849f1ac4a352971fab61a5fc2e5c6a597201201 SOURCES/ft2demos-2.8.tar.bz2
diff --git a/.gitignore b/.gitignore
index babf1e2..3718073 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-SOURCES/freetype-2.4.11.tar.bz2
-SOURCES/freetype-doc-2.4.11.tar.bz2
-SOURCES/ft2demos-2.4.11.tar.bz2
+SOURCES/freetype-2.8.tar.bz2
+SOURCES/freetype-doc-2.8.tar.bz2
+SOURCES/ft2demos-2.8.tar.bz2
diff --git a/SOURCES/0001-Fix-vertical-size-of-emboldened-glyphs.patch b/SOURCES/0001-Fix-vertical-size-of-emboldened-glyphs.patch
deleted file mode 100644
index 330d1ce..0000000
--- a/SOURCES/0001-Fix-vertical-size-of-emboldened-glyphs.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 31e726d939e7b79506d11164d259c9789e429761 Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Fri, 20 Sep 2013 07:20:53 +0200
-Subject: [PATCH] Fix vertical size of emboldened glyphs.
-
-Cf. https://bugzilla.gnome.org/show_bug.cgi?id=686709
-
-* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Adjust `horiBearingY'
-also.
----
- src/base/ftsynth.c | 11 ++++++-----
- 1 files changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
-index 241d37f..3098a60 100644
---- a/src/base/ftsynth.c
-+++ b/src/base/ftsynth.c
-@@ -4,7 +4,7 @@
- /*                                                                         */
- /*    FreeType synthesizing code for emboldening and slanting (body).      */
- /*                                                                         */
--/*  Copyright 2000-2006, 2010, 2012 by                                     */
-+/*  Copyright 2000-2006, 2010, 2012, 2013 by                               */
- /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
- /*                                                                         */
- /*  This file is part of the FreeType project, and may only be used,       */
-@@ -139,10 +139,11 @@
-     if ( slot->advance.y )
-       slot->advance.y += ystr;
- 
--    slot->metrics.width       += xstr;
--    slot->metrics.height      += ystr;
--    slot->metrics.horiAdvance += xstr;
--    slot->metrics.vertAdvance += ystr;
-+    slot->metrics.width        += xstr;
-+    slot->metrics.height       += ystr;
-+    slot->metrics.horiAdvance  += xstr;
-+    slot->metrics.vertAdvance  += ystr;
-+    slot->metrics.horiBearingY += ystr;
- 
-     /* XXX: 16-bit overflow case must be excluded before here */
-     if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
--- 
-1.8.3.1
-
diff --git a/SOURCES/freetype-2.2.1-enable-valid.patch b/SOURCES/freetype-2.2.1-enable-valid.patch
index c78b6b7..21d80da 100644
--- a/SOURCES/freetype-2.2.1-enable-valid.patch
+++ b/SOURCES/freetype-2.2.1-enable-valid.patch
@@ -1,18 +1,18 @@
 --- freetype-2.2.1/modules.cfg.orig	2006-07-07 21:01:09.000000000 -0400
 +++ freetype-2.2.1/modules.cfg	2006-07-07 21:01:54.000000000 -0400
 @@ -110,7 +110,7 @@
- AUX_MODULES += cache
- 
  # TrueType GX/AAT table validation.  Needs ftgxval.c below.
+ #
+ # No FT_CONFIG_OPTION_PIC support.
 -# AUX_MODULES += gxvalid
 +AUX_MODULES += gxvalid
  
  # Support for streams compressed with gzip (files with suffix .gz).
  #
 @@ -124,7 +124,7 @@
- 
  # OpenType table validation.  Needs ftotval.c below.
  #
+ # No FT_CONFIG_OPTION_PIC support.
 -# AUX_MODULES += otvalid
 +AUX_MODULES += otvalid
  
diff --git a/SOURCES/freetype-2.3.11-more-demos.patch b/SOURCES/freetype-2.3.11-more-demos.patch
index 181eafe..7d43b58 100644
--- a/SOURCES/freetype-2.3.11-more-demos.patch
+++ b/SOURCES/freetype-2.3.11-more-demos.patch
@@ -1,9 +1,9 @@
 diff -up ft2demos-2.3.11/Makefile.more-demos freetype-2.3.11/ft2demos-2.3.11/Makefile
 --- ft2demos-2.3.11/Makefile.more-demos	2009-10-22 16:02:26.000000000 -0400
 +++ ft2demos-2.3.11/Makefile	2009-10-22 16:02:32.000000000 -0400
-@@ -288,10 +288,10 @@ else
-   # Note that ttdebug only works if the FreeType's `truetype' driver has
-   # been compiled with TT_CONFIG_OPTION_BYTECODE_INTERPRETER defined.
+@@ -296,10 +296,10 @@ else
+   # The following programs are not compiled automatically; either comment
+   # out the affected line or use the program name as a Makefile target.
    #
 -  # EXES += ftchkwd
 -  # EXES += ftmemchk
@@ -14,5 +14,5 @@ diff -up ft2demos-2.3.11/Makefile.more-demos freetype-2.3.11/ft2demos-2.3.11/Mak
 +  EXES += ftpatchk
 +  EXES += fttimer
    # EXES += testname
-   # EXES += ttdebug
  
+   exes: $(EXES:%=$(BIN_DIR_2)/%$E)
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9657.patch b/SOURCES/freetype-2.4.11-CVE-2014-9657.patch
deleted file mode 100644
index 8954406..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9657.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From eca0f067068020870a429fe91f6329e499390d55 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Mon, 24 Nov 2014 09:22:08 +0000
-Subject: [truetype] Fix Savannah bug #43679.
-
-* src/truetype/ttpload.c (tt_face_load_hdmx): Check minimum size of
-`record_size'.
----
-diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
-index 9723a51..9991925 100644
---- a/src/truetype/ttpload.c
-+++ b/src/truetype/ttpload.c
-@@ -508,9 +508,9 @@
-     record_size = FT_NEXT_ULONG( p );
- 
-     /* The maximum number of bytes in an hdmx device record is the */
--    /* maximum number of glyphs + 2; this is 0xFFFF + 2; this is   */
--    /* the reason why `record_size' is a long (which we read as    */
--    /* unsigned long for convenience).  In practice, two bytes     */
-+    /* maximum number of glyphs + 2; this is 0xFFFF + 2, thus      */
-+    /* explaining why `record_size' is a long (which we read as    */
-+    /* unsigned long for convenience).  In practice, two bytes are */
-     /* sufficient to hold the size value.                          */
-     /*                                                             */
-     /* There are at least two fonts, HANNOM-A and HANNOM-B version */
-@@ -522,8 +522,10 @@
-       record_size &= 0xFFFFU;
- 
-     /* The limit for `num_records' is a heuristic value. */
--
--    if ( version != 0 || num_records > 255 || record_size > 0x10001L )
-+    if ( version != 0           ||
-+         num_records > 255      ||
-+         record_size > 0x10001L ||
-+         record_size < 4        )
-     {
-       error = TT_Err_Invalid_File_Format;
-       goto Fail;
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9658.patch b/SOURCES/freetype-2.4.11-CVE-2014-9658.patch
deleted file mode 100644
index 7aec5c8..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9658.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From f70d9342e65cd2cb44e9f26b6d7edeedf191fc6c Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Mon, 24 Nov 2014 08:31:32 +0000
-Subject: [sfnt] Fix Savannah bug #43672.
-
-* src/sfnt/ttkern.c (tt_face_load_kern): Use correct value for
-minimum table length test.
----
-diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c
-index 32c4008..455e7b5 100644
---- a/src/sfnt/ttkern.c
-+++ b/src/sfnt/ttkern.c
-@@ -99,7 +99,7 @@
-       length   = FT_NEXT_USHORT( p );
-       coverage = FT_NEXT_USHORT( p );
- 
--      if ( length <= 6 )
-+      if ( length <= 6 + 8 )
-         break;
- 
-       p_next += length;
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9660.patch b/SOURCES/freetype-2.4.11-CVE-2014-9660.patch
deleted file mode 100644
index fc310f7..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9660.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From af8346172a7b573715134f7a51e6c5c60fa7f2ab Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Sat, 22 Nov 2014 12:29:10 +0000
-Subject: [bdf] Fix Savannah bug #43660.
-
-* src/bdf/bdflib.c (_bdf_parse_glyphs) <"ENDFONT">: Check
-`_BDF_GLYPH_BITS'.
----
-diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
-index c128526..369c111 100644
---- a/src/bdf/bdflib.c
-+++ b/src/bdf/bdflib.c
-@@ -1549,6 +1549,14 @@
-     /* Check for the ENDFONT field. */
-     if ( _bdf_strncmp( line, "ENDFONT", 7 ) == 0 )
-     {
-+      if ( p->flags & _BDF_GLYPH_BITS )
-+      {
-+        /* Missing ENDCHAR field. */
-+        FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
-+        error = BDF_Err_Corrupted_Font_Glyphs;
-+        goto Exit;
-+      }
-+
-       /* Sort the glyphs by encoding. */
-       ft_qsort( (char *)font->glyphs,
-                 font->glyphs_used,
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9661a.patch b/SOURCES/freetype-2.4.11-CVE-2014-9661a.patch
deleted file mode 100644
index e6cbe78..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9661a.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 3788187e0c396952cd7d905c6c61f3ff8e84b2b4 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Sat, 22 Nov 2014 09:46:47 +0000
-Subject: [type42] Fix Savannah bug #43659.
-
-* src/type42/t42objs.c (T42_Open_Face): Initialize `face->ttf_size'.
-
-* src/type42/t42parse.c (t42_parse_sfnts): Always set
-`face->ttf_size' directly.  This ensures a correct stream size in
-the call to `FT_Open_Face', which follows after parsing, even for
-buggy input data.
-Fix error messages.
----
-diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
-index 798ebdb..7a9cb57 100644
---- a/src/type42/t42objs.c
-+++ b/src/type42/t42objs.c
-@@ -47,6 +47,12 @@
-     if ( FT_ALLOC( face->ttf_data, 12 ) )
-       goto Exit;
- 
-+    /* while parsing the font we always update `face->ttf_size' so that */
-+    /* even in case of buggy data (which might lead to premature end of */
-+    /* scanning without causing an error) the call to `FT_Open_Face' in */
-+    /* `T42_Face_Init' passes the correct size                          */
-+    face->ttf_size = 12;
-+
-     error = t42_parser_init( parser,
-                              face->root.stream,
-                              memory,
-diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
-index a60e216..daf304d 100644
---- a/src/type42/t42parse.c
-+++ b/src/type42/t42parse.c
-@@ -498,7 +498,7 @@
-     FT_Byte*    limit  = parser->root.limit;
-     FT_Error    error;
-     FT_Int      num_tables = 0;
--    FT_ULong    count, ttf_size = 0;
-+    FT_ULong    count;
- 
-     FT_Long     n, string_size, old_string_size, real_size;
-     FT_Byte*    string_buf = NULL;
-@@ -591,7 +591,7 @@
- 
-         if ( limit - parser->root.cursor < string_size )
-         {
--          FT_ERROR(( "t42_parse_sfnts: too many binary data\n" ));
-+          FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
-           error = T42_Err_Invalid_File_Format;
-           goto Fail;
-         }
-@@ -631,18 +631,18 @@
-           }
-           else
-           {
--            num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];
--            status     = BEFORE_TABLE_DIR;
--            ttf_size   = 12 + 16 * num_tables;
-+            num_tables     = 16 * face->ttf_data[4] + face->ttf_data[5];
-+            status         = BEFORE_TABLE_DIR;
-+            face->ttf_size = 12 + 16 * num_tables;
- 
--            if ( FT_REALLOC( face->ttf_data, 12, ttf_size ) )
-+            if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) )
-               goto Fail;
-           }
-           /* fall through */
- 
-         case BEFORE_TABLE_DIR:
-           /* the offset table is read; read the table directory */
--          if ( count < ttf_size )
-+          if ( count < face->ttf_size )
-           {
-             face->ttf_data[count++] = string_buf[n];
-             continue;
-@@ -661,24 +661,23 @@
-               len = FT_PEEK_ULONG( p );
- 
-               /* Pad to a 4-byte boundary length */
--              ttf_size += ( len + 3 ) & ~3;
-+              face->ttf_size += ( len + 3 ) & ~3;
-             }
- 
--            status         = OTHER_TABLES;
--            face->ttf_size = ttf_size;
-+            status = OTHER_TABLES;
- 
-             /* there are no more than 256 tables, so no size check here */
-             if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
--                             ttf_size + 1 ) )
-+                             face->ttf_size + 1 ) )
-               goto Fail;
-           }
-           /* fall through */
- 
-         case OTHER_TABLES:
-           /* all other tables are just copied */
--          if ( count >= ttf_size )
-+          if ( count >= face->ttf_size )
-           {
--            FT_ERROR(( "t42_parse_sfnts: too many binary data\n" ));
-+            FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
-             error = T42_Err_Invalid_File_Format;
-             goto Fail;
-           }
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9661b.patch b/SOURCES/freetype-2.4.11-CVE-2014-9661b.patch
deleted file mode 100644
index 0f62d7f..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9661b.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 42fcd6693ec7bd6ffc65ddc63e74287a65dda669 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Sat, 22 Nov 2014 11:44:33 +0000
-Subject: [type42] Allow only embedded TrueType fonts.
-
-This is a follow-up to Savannah bug #43659.
-
-* src/type42/t42objs.c (T42_Face_Init): Exclusively use the
-`truetype' font driver for loading the font contained in the `sfnts'
-array.
----
-diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
-index 7a9cb57..915e81f 100644
---- a/src/type42/t42objs.c
-+++ b/src/type42/t42objs.c
-@@ -291,7 +291,9 @@
-       FT_Open_Args  args;
- 
- 
--      args.flags       = FT_OPEN_MEMORY;
-+      args.flags       = FT_OPEN_MEMORY | FT_OPEN_DRIVER;
-+      args.driver      = FT_Get_Module( FT_FACE_LIBRARY( face ),
-+                                        "truetype" );
-       args.memory_base = face->ttf_data;
-       args.memory_size = face->ttf_size;
- 
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9663.patch b/SOURCES/freetype-2.4.11-CVE-2014-9663.patch
deleted file mode 100644
index 9e2496a..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9663.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 9bd20b7304aae61de5d50ac359cf27132bafd4c1 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Sat, 22 Nov 2014 05:24:45 +0000
-Subject: [sfnt] Fix Savannah bug #43656.
-
-* src/sfnt/ttcmap.c (tt_cmap4_validate): Fix order of validity
-tests.
----
-diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
-index 712bd4f..fb863c3 100644
---- a/src/sfnt/ttcmap.c
-+++ b/src/sfnt/ttcmap.c
-@@ -823,9 +823,6 @@
-     FT_Error  error = SFNT_Err_Ok;
- 
- 
--    if ( length < 16 )
--      FT_INVALID_TOO_SHORT;
--
-     /* in certain fonts, the `length' field is invalid and goes */
-     /* out of bound.  We try to correct this here...            */
-     if ( table + length > valid->limit )
-@@ -836,6 +833,9 @@
-       length = (FT_UInt)( valid->limit - table );
-     }
- 
-+    if ( length < 16 )
-+      FT_INVALID_TOO_SHORT;
-+
-     p        = table + 6;
-     num_segs = TT_NEXT_USHORT( p );   /* read segCountX2 */
- 
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9664a.patch b/SOURCES/freetype-2.4.11-CVE-2014-9664a.patch
deleted file mode 100644
index 7753f3f..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9664a.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 73be9f9ab67842cfbec36ee99e8d2301434c84ca Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Mon, 24 Nov 2014 06:30:05 +0000
-Subject: [type1, type42] Another fix for Savannah bug #43655.
-
-* src/type1/t1load.c (parse_charstrings), src/type42/t42parse.c
-(t42_parse_charstrings): Add another boundary testing.
----
-diff --git a/src/type1/t1load.c b/src/type1/t1load.c
-index caa75bd..24b14a8 100644
---- a/src/type1/t1load.c
-+++ b/src/type1/t1load.c
-@@ -1589,6 +1589,11 @@
-       }
- 
-       T1_Skip_PS_Token( parser );
-+      if ( parser->root.cursor >= limit )
-+      {
-+        error = T1_Err_Invalid_File_Format;
-+        goto Fail;
-+      }
-       if ( parser->root.error )
-         return;
- 
-diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
-index daf304d..d45c069 100644
---- a/src/type42/t42parse.c
-+++ b/src/type42/t42parse.c
-@@ -823,6 +823,12 @@
-         break;
- 
-       T1_Skip_PS_Token( parser );
-+      if ( parser->root.cursor >= limit )
-+      {
-+        FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
-+        error = T42_Err_Invalid_File_Format;
-+        goto Fail;
-+      }
-       if ( parser->root.error )
-         return;
- 
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9664b.patch b/SOURCES/freetype-2.4.11-CVE-2014-9664b.patch
deleted file mode 100644
index f594fe7..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9664b.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From dd89710f0f643eb0f99a3830e0712d26c7642acd Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Fri, 21 Nov 2014 21:19:28 +0000
-Subject: [type1, type42] Fix Savannah bug #43655.
-
-* src/type1/t1load.c (parse_charstrings), src/type42/t42parse.c
-(t42_parse_charstrings): Fix boundary testing.
----
-diff --git a/src/type1/t1load.c b/src/type1/t1load.c
-index fd06432..caa75bd 100644
---- a/src/type1/t1load.c
-+++ b/src/type1/t1load.c
-@@ -1602,7 +1602,7 @@
-         FT_PtrDist  len;
- 
- 
--        if ( cur + 1 >= limit )
-+        if ( cur + 2 >= limit )
-         {
-           error = T1_Err_Invalid_File_Format;
-           goto Fail;
-diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
-index 9b66888..a60e216 100644
---- a/src/type42/t42parse.c
-+++ b/src/type42/t42parse.c
-@@ -837,7 +837,7 @@
-         FT_PtrDist  len;
- 
- 
--        if ( cur + 1 >= limit )
-+        if ( cur + 2 >= limit )
-         {
-           FT_ERROR(( "t42_parse_charstrings: out of bounds\n" ));
-           error = T42_Err_Invalid_File_Format;
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9667.patch b/SOURCES/freetype-2.4.11-CVE-2014-9667.patch
deleted file mode 100644
index 1e34940..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9667.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 677ddf4f1dc1b36cef7c7ddd59a14c508f4b1891 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Wed, 12 Nov 2014 20:26:44 +0000
-Subject: [sfnt] Fix Savannah bug #43590.
-
-* src/sfnt/ttload.c (check_table_dir, tt_face_load_font_dir):
-Protect against addition overflow.
----
-diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
-index 0a3cd29..8338150 100644
---- a/src/sfnt/ttload.c
-+++ b/src/sfnt/ttload.c
-@@ -5,7 +5,7 @@
- /*    Load the basic TrueType tables, i.e., tables that can be either in   */
- /*    TTF or OTF fonts (body).                                             */
- /*                                                                         */
--/*  Copyright 1996-2010, 2012 by                                           */
-+/*  Copyright 1996-2010, 2012-2014 by                                      */
- /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
- /*                                                                         */
- /*  This file is part of the FreeType project, and may only be used,       */
-@@ -207,7 +207,10 @@
-       }
- 
-       /* we ignore invalid tables */
--      if ( table.Offset + table.Length > stream->size )
-+
-+      /* table.Offset + table.Length > stream->size ? */
-+      if ( table.Length > stream->size                ||
-+           table.Offset > stream->size - table.Length )
-       {
-         FT_TRACE2(( "check_table_dir: table entry %d invalid\n", nn ));
-         continue;
-@@ -398,7 +398,10 @@
-       entry->Length   = FT_GET_LONG();
- 
-       /* ignore invalid tables */
--      if ( entry->Offset + entry->Length > stream->size )
-+
-+      /* entry->Offset + entry->Length > stream->size ? */
-+      if ( entry->Length > stream->size                 ||
-+           entry->Offset > stream->size - entry->Length )
-         continue;
-       else
-       {
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9669.patch b/SOURCES/freetype-2.4.11-CVE-2014-9669.patch
deleted file mode 100644
index 59fe8c3..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9669.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-From 602040b1112c9f94d68e200be59ea7ac3d104565 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Wed, 12 Nov 2014 19:51:20 +0000
-Subject: [sfnt] Fix Savannah bug #43588.
-
-* src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate,
-tt_cmap12_validate, tt_cmap13_validate, tt_cmap14_validate): Protect
-against overflow in additions and multiplications.
----
-diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
-index f9acf5d..712bd4f 100644
---- a/src/sfnt/ttcmap.c
-+++ b/src/sfnt/ttcmap.c
-@@ -1647,7 +1647,8 @@
-     p          = is32  + 8192;          /* skip `is32' array */
-     num_groups = TT_NEXT_ULONG( p );
- 
--    if ( p + num_groups * 12 > valid->limit )
-+    /* p + num_groups * 12 > valid->limit ? */
-+    if ( num_groups > (FT_UInt32)( valid->limit - p ) / 12 )
-       FT_INVALID_TOO_SHORT;
- 
-     /* check groups, they must be in increasing order */
-@@ -1672,7 +1673,12 @@
- 
-         if ( valid->level >= FT_VALIDATE_TIGHT )
-         {
--          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )
-+          FT_UInt32  d = end - start;
-+
-+
-+          /* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
-+          if ( d > TT_VALID_GLYPH_COUNT( valid )             ||
-+               start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
-             FT_INVALID_GLYPH_ID;
- 
-           count = (FT_UInt32)( end - start + 1 );
-@@ -1870,7 +1876,9 @@
-     count  = TT_NEXT_ULONG( p );
- 
-     if ( length > (FT_ULong)( valid->limit - table ) ||
--         length < 20 + count * 2                     )
-+         /* length < 20 + count * 2 ? */
-+         length < 20                                 ||
-+         ( length - 20 ) / 2 < count                 )
-       FT_INVALID_TOO_SHORT;
- 
-     /* check glyph indices */
-@@ -2057,7 +2065,9 @@
-     num_groups = TT_NEXT_ULONG( p );
- 
-     if ( length > (FT_ULong)( valid->limit - table ) ||
--         length < 16 + 12 * num_groups               )
-+         /* length < 16 + 12 * num_groups ? */
-+         length < 16                                 ||
-+         ( length - 16 ) / 12 < num_groups           )
-       FT_INVALID_TOO_SHORT;
- 
-     /* check groups, they must be in increasing order */
-@@ -2079,7 +2089,12 @@
- 
-         if ( valid->level >= FT_VALIDATE_TIGHT )
-         {
--          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )
-+          FT_UInt32  d = end - start;
-+
-+
-+          /* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
-+          if ( d > TT_VALID_GLYPH_COUNT( valid )             ||
-+               start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
-             FT_INVALID_GLYPH_ID;
-         }
- 
-@@ -2381,7 +2396,9 @@
-     num_groups = TT_NEXT_ULONG( p );
- 
-     if ( length > (FT_ULong)( valid->limit - table ) ||
--         length < 16 + 12 * num_groups               )
-+         /* length < 16 + 12 * num_groups ? */
-+         length < 16                                 ||
-+         ( length - 16 ) / 12 < num_groups           )
-       FT_INVALID_TOO_SHORT;
- 
-     /* check groups, they must be in increasing order */
-@@ -2762,7 +2779,9 @@
- 
- 
-     if ( length > (FT_ULong)( valid->limit - table ) ||
--         length < 10 + 11 * num_selectors            )
-+         /* length < 10 + 11 * num_selectors ? */
-+         length < 10                                 ||
-+         ( length - 10 ) / 11 < num_selectors        )
-       FT_INVALID_TOO_SHORT;
- 
-     /* check selectors, they must be in increasing order */
-@@ -2798,7 +2817,8 @@
-           FT_ULong  lastBase  = 0;
- 
- 
--          if ( defp + numRanges * 4 > valid->limit )
-+          /* defp + numRanges * 4 > valid->limit ? */
-+          if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 )
-             FT_INVALID_TOO_SHORT;
- 
-           for ( i = 0; i < numRanges; ++i )
-@@ -2825,7 +2845,8 @@
-           FT_ULong  i, lastUni  = 0;
- 
- 
--          if ( numMappings * 4 > (FT_ULong)( valid->limit - ndp ) )
-+          /* numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ? */
-+          if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 4 )
-             FT_INVALID_TOO_SHORT;
- 
-           for ( i = 0; i < numMappings; ++i )
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9670.patch b/SOURCES/freetype-2.4.11-CVE-2014-9670.patch
deleted file mode 100644
index 0a9b70a..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9670.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From ef1eba75187adfac750f326b563fe543dd5ff4e6 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Thu, 06 Nov 2014 22:25:05 +0000
-Subject: Fix Savannah bug #43548.
-
-* src/pcf/pcfread (pcf_get_encodings): Add sanity checks for row and
-column values.
----
-diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
-index 8db31bd..668c962 100644
---- a/src/pcf/pcfread.c
-+++ b/src/pcf/pcfread.c
-@@ -812,6 +812,15 @@ THE SOFTWARE.
-     if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
-       return PCF_Err_Invalid_File_Format;
- 
-+    /* sanity checks */
-+    if ( firstCol < 0       ||
-+         firstCol > lastCol ||
-+         lastCol  > 0xFF    ||
-+         firstRow < 0       ||
-+         firstRow > lastRow ||
-+         lastRow  > 0xFF    )
-+      return PCF_Err_Invalid_Table;
-+
-     FT_TRACE4(( "pdf_get_encodings:\n" ));
- 
-     FT_TRACE4(( "  firstCol %d, lastCol %d, firstRow %d, lastRow %d\n",
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9671.patch b/SOURCES/freetype-2.4.11-CVE-2014-9671.patch
deleted file mode 100644
index a291150..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9671.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 0e2f5d518c60e2978f26400d110eff178fa7e3c3 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Thu, 06 Nov 2014 21:32:46 +0000
-Subject: Fix Savannah bug #43547.
-
-* src/pcf/pcfread.c (pcf_read_TOC): Check `size' and `offset'
-values.
----
-diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
-index f63377b..8db31bd 100644
---- a/src/pcf/pcfread.c
-+++ b/src/pcf/pcfread.c
-@@ -151,6 +151,21 @@ THE SOFTWARE.
-         break;
-     }
- 
-+    /* we now check whether the `size' and `offset' values are reasonable: */
-+    /* `offset' + `size' must not exceed the stream size                   */
-+    tables = face->toc.tables;
-+    for ( n = 0; n < toc->count; n++ )
-+    {
-+      /* we need two checks to avoid overflow */
-+      if ( ( tables->size   > stream->size                ) ||
-+           ( tables->offset > stream->size - tables->size ) )
-+      {
-+        error = PCF_Err_Invalid_Table;
-+        goto Exit;
-+      }
-+      tables++;
-+    }
-+
- #ifdef FT_DEBUG_LEVEL_TRACE
- 
-     {
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9673.patch b/SOURCES/freetype-2.4.11-CVE-2014-9673.patch
deleted file mode 100644
index 957ebe3..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9673.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 35252ae9aa1dd9343e9f4884e9ddb1fee10ef415 Mon Sep 17 00:00:00 2001
-From: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
-Date: Wed, 26 Nov 2014 06:52:23 +0000
-Subject: Fix Savannah bug #43539.
-
-* src/base/ftobjs.c (Mac_Read_POST_Resource): Fix integer overflow
-by a broken POST table in resource-fork.
----
-diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
-index ffbbc32..922216e 100644
---- a/src/base/ftobjs.c
-+++ b/src/base/ftobjs.c
-@@ -1589,6 +1589,11 @@
-         goto Exit2;
-       if ( FT_READ_LONG( rlen ) )
-         goto Exit;
-+      if ( rlen < 0 )
-+      {
-+        error = FT_Err_Invalid_Offset;
-+        goto Exit2;
-+      }
-       if ( FT_READ_USHORT( flags ) )
-         goto Exit;
-       FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
-@@ -1606,7 +1611,14 @@
-         rlen = 0;
- 
-       if ( ( flags >> 8 ) == type )
-+      {
-+        if ( 0x7FFFFFFFL - rlen < len )
-+        {
-+          error = FT_Err_Array_Too_Large;
-+          goto Exit2;
-+        }
-         len += rlen;
-+      }
-       else
-       {
-         if ( pfb_lenpos + 3 > pfb_len + 2 )
-@@ -1635,6 +1647,11 @@
-       }
- 
-       error = FT_Err_Cannot_Open_Resource;
-+      if ( rlen > 0x7FFFFFFFL - pfb_pos )
-+      {
-+        error = FT_Err_Array_Too_Large;
-+        goto Exit2;
-+      }
-       if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
-         goto Exit2;
- 
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9674a.patch b/SOURCES/freetype-2.4.11-CVE-2014-9674a.patch
deleted file mode 100644
index 631a5bf..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9674a.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 240c94a185cd8dae7d03059abec8a5662c35ecd3 Mon Sep 17 00:00:00 2001
-From: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
-Date: Wed, 26 Nov 2014 06:43:29 +0000
-Subject: Fix Savannah bug #43538.
-
-* src/base/ftobjs.c (Mac_Read_POST_Resource): Fix integer overflow
-by a broken POST table in resource-fork.
----
-diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
-index 4d60e88..ffbbc32 100644
---- a/src/base/ftobjs.c
-+++ b/src/base/ftobjs.c
-@@ -1565,10 +1565,23 @@
-         goto Exit;
-       if ( FT_READ_LONG( temp ) )
-         goto Exit;
-+      if ( 0 > temp )
-+        error = FT_Err_Invalid_Offset;
-+      else if ( 0x7FFFFFFFL - 6 - pfb_len < temp )
-+        error = FT_Err_Array_Too_Large;
-+
-+      if ( error )
-+        goto Exit;
-+
-       pfb_len += temp + 6;
-     }
- 
--    if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
-+    if ( 0x7FFFFFFFL - 2 < pfb_len )
-+      error = FT_Err_Array_Too_Large;
-+    else
-+      error = FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 );
-+
-+    if ( error )
-       goto Exit;
- 
-     pfb_data[0] = 0x80;
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9674b.patch b/SOURCES/freetype-2.4.11-CVE-2014-9674b.patch
deleted file mode 100644
index 288953a..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9674b.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From cd4a5a26e591d01494567df9dec7f72d59551f6e Mon Sep 17 00:00:00 2001
-From: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
-Date: Wed, 26 Nov 2014 15:20:48 +0000
-Subject: * src/base/ftobj.c (Mac_Read_POST_Resource): Additional
-
-overflow check in the summation of POST fragment lengths,
-suggested by Mateusz Jurczyk <mjurczyk@google.com>.
----
-diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
-index 4321126..b28216a 100644
---- a/src/base/ftobjs.c
-+++ b/src/base/ftobjs.c
-@@ -1566,8 +1566,10 @@
-       if ( FT_READ_ULONG( temp ) )
-         goto Exit;
-       FT_TRACE4(( "                 POST fragment #%d: length=0x%08x\n", i, temp));
--      if ( 0x7FFFFFFFUL < temp )
-+      if ( 0x7FFFFFFFUL < temp || pfb_len + temp + 6 < pfb_len )
-       {
-+        FT_TRACE2(( "             too long fragment length makes"
-+                    " pfb_len confused: temp=0x%08x\n", temp ));
-         error = FT_Err_Invalid_Offset;
-         goto Exit;
-       }
---
-cgit v0.9.0.2
diff --git a/SOURCES/freetype-2.4.11-CVE-2014-9675.patch b/SOURCES/freetype-2.4.11-CVE-2014-9675.patch
deleted file mode 100644
index 3c3ea40..0000000
--- a/SOURCES/freetype-2.4.11-CVE-2014-9675.patch
+++ /dev/null
@@ -1,237 +0,0 @@
-commit 2c4832d30939b45c05757f0a05128ce64c4cacc7
-Author: Werner Lemberg <wl@gnu.org>
-Date:   Fri Nov 7 07:42:33 2014 +0100
-
-    Fix Savannah bug #43535.
-    
-    * src/bdf/bdflib.c (_bdf_strncmp): New macro that checks one
-    character more than `strncmp'.
-    s/ft_strncmp/_bdf_strncmp/ everywhere.
-
-diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
-index 2eda11c..c128526 100644
---- a/src/bdf/bdflib.c
-+++ b/src/bdf/bdflib.c
-@@ -169,6 +169,18 @@
-                         sizeof ( _bdf_properties[0] );
- 
- 
-+  /* An auxiliary macro to parse properties, to be used in conditionals. */
-+  /* It behaves like `strncmp' but also tests the following character    */
-+  /* whether it is a whitespace or NULL.                                 */
-+  /* `property' is a constant string of length `n' to compare with.      */
-+#define _bdf_strncmp( name, property, n )      \
-+          ( ft_strncmp( name, property, n ) || \
-+            !( name[n] == ' '  ||              \
-+               name[n] == '\0' ||              \
-+               name[n] == '\n' ||              \
-+               name[n] == '\r' ||              \
-+               name[n] == '\t' )            )
-+
-   /* Auto correction messages. */
- #define ACMSG1   "FONT_ASCENT property missing.  " \
-                  "Added `FONT_ASCENT %hd'.\n"
-@@ -1402,7 +1414,7 @@
- 
-     /* If the property happens to be a comment, then it doesn't need */
-     /* to be added to the internal hash table.                       */
--    if ( ft_strncmp( name, "COMMENT", 7 ) != 0 )
-+    if ( _bdf_strncmp( name, "COMMENT", 7 ) != 0 )
-     {
-       /* Add the property to the font property table. */
-       error = hash_insert( fp->name,
-@@ -1420,13 +1432,13 @@
-     /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are        */
-     /* present, and the SPACING property should override the default       */
-     /* spacing.                                                            */
--    if ( ft_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 )
-+    if ( _bdf_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 )
-       font->default_char = fp->value.l;
--    else if ( ft_strncmp( name, "FONT_ASCENT", 11 ) == 0 )
-+    else if ( _bdf_strncmp( name, "FONT_ASCENT", 11 ) == 0 )
-       font->font_ascent = fp->value.l;
--    else if ( ft_strncmp( name, "FONT_DESCENT", 12 ) == 0 )
-+    else if ( _bdf_strncmp( name, "FONT_DESCENT", 12 ) == 0 )
-       font->font_descent = fp->value.l;
--    else if ( ft_strncmp( name, "SPACING", 7 ) == 0 )
-+    else if ( _bdf_strncmp( name, "SPACING", 7 ) == 0 )
-     {
-       if ( !fp->value.atom )
-       {
-@@ -1484,7 +1496,7 @@
-     memory = font->memory;
- 
-     /* Check for a comment. */
--    if ( ft_strncmp( line, "COMMENT", 7 ) == 0 )
-+    if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
-     {
-       linelen -= 7;
- 
-@@ -1501,7 +1513,7 @@
-     /* The very first thing expected is the number of glyphs. */
-     if ( !( p->flags & _BDF_GLYPHS ) )
-     {
--      if ( ft_strncmp( line, "CHARS", 5 ) != 0 )
-+      if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 )
-       {
-         FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" ));
-         error = BDF_Err_Missing_Chars_Field;
-@@ -1535,7 +1547,7 @@
-     }
- 
-     /* Check for the ENDFONT field. */
--    if ( ft_strncmp( line, "ENDFONT", 7 ) == 0 )
-+    if ( _bdf_strncmp( line, "ENDFONT", 7 ) == 0 )
-     {
-       /* Sort the glyphs by encoding. */
-       ft_qsort( (char *)font->glyphs,
-@@ -1549,7 +1561,7 @@
-     }
- 
-     /* Check for the ENDCHAR field. */
--    if ( ft_strncmp( line, "ENDCHAR", 7 ) == 0 )
-+    if ( _bdf_strncmp( line, "ENDCHAR", 7 ) == 0 )
-     {
-       p->glyph_enc = 0;
-       p->flags    &= ~_BDF_GLYPH_BITS;
-@@ -1565,7 +1577,7 @@
-       goto Exit;
- 
-     /* Check for the STARTCHAR field. */
--    if ( ft_strncmp( line, "STARTCHAR", 9 ) == 0 )
-+    if ( _bdf_strncmp( line, "STARTCHAR", 9 ) == 0 )
-     {
-       /* Set the character name in the parse info first until the */
-       /* encoding can be checked for an unencoded character.      */
-@@ -1599,7 +1611,7 @@
-     }
- 
-     /* Check for the ENCODING field. */
--    if ( ft_strncmp( line, "ENCODING", 8 ) == 0 )
-+    if ( _bdf_strncmp( line, "ENCODING", 8 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_GLYPH ) )
-       {
-@@ -1785,7 +1797,7 @@
-     }
- 
-     /* Expect the SWIDTH (scalable width) field next. */
--    if ( ft_strncmp( line, "SWIDTH", 6 ) == 0 )
-+    if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_ENCODING ) )
-         goto Missing_Encoding;
-@@ -1801,7 +1813,7 @@
-     }
- 
-     /* Expect the DWIDTH (scalable width) field next. */
--    if ( ft_strncmp( line, "DWIDTH", 6 ) == 0 )
-+    if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_ENCODING ) )
-         goto Missing_Encoding;
-@@ -1829,7 +1841,7 @@
-     }
- 
-     /* Expect the BBX field next. */
--    if ( ft_strncmp( line, "BBX", 3 ) == 0 )
-+    if ( _bdf_strncmp( line, "BBX", 3 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_ENCODING ) )
-         goto Missing_Encoding;
-@@ -1897,7 +1909,7 @@
-     }
- 
-     /* And finally, gather up the bitmap. */
--    if ( ft_strncmp( line, "BITMAP", 6 ) == 0 )
-+    if ( _bdf_strncmp( line, "BITMAP", 6 ) == 0 )
-     {
-       unsigned long  bitmap_size;
- 
-@@ -1972,7 +1984,7 @@
-     p    = (_bdf_parse_t *)    client_data;
- 
-     /* Check for the end of the properties. */
--    if ( ft_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
-+    if ( _bdf_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
-     {
-       /* If the FONT_ASCENT or FONT_DESCENT properties have not been      */
-       /* encountered yet, then make sure they are added as properties and */
-@@ -2013,12 +2025,12 @@
-     }
- 
-     /* Ignore the _XFREE86_GLYPH_RANGES properties. */
--    if ( ft_strncmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 )
-+    if ( _bdf_strncmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 )
-       goto Exit;
- 
-     /* Handle COMMENT fields and properties in a special way to preserve */
-     /* the spacing.                                                      */
--    if ( ft_strncmp( line, "COMMENT", 7 ) == 0 )
-+    if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
-     {
-       name = value = line;
-       value += 7;
-@@ -2082,7 +2094,7 @@
- 
-     /* Check for a comment.  This is done to handle those fonts that have */
-     /* comments before the STARTFONT line for some reason.                */
--    if ( ft_strncmp( line, "COMMENT", 7 ) == 0 )
-+    if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
-     {
-       if ( p->opts->keep_comments != 0 && p->font != 0 )
-       {
-@@ -2108,7 +2120,7 @@
-     {
-       memory = p->memory;
- 
--      if ( ft_strncmp( line, "STARTFONT", 9 ) != 0 )
-+      if ( _bdf_strncmp( line, "STARTFONT", 9 ) != 0 )
-       {
-         /* we don't emit an error message since this code gets */
-         /* explicitly caught one level higher                  */
-@@ -2156,7 +2168,7 @@
-     }
- 
-     /* Check for the start of the properties. */
--    if ( ft_strncmp( line, "STARTPROPERTIES", 15 ) == 0 )
-+    if ( _bdf_strncmp( line, "STARTPROPERTIES", 15 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_FONT_BBX ) )
-       {
-@@ -2185,7 +2197,7 @@
-     }
- 
-     /* Check for the FONTBOUNDINGBOX field. */
--    if ( ft_strncmp( line, "FONTBOUNDINGBOX", 15 ) == 0 )
-+    if ( _bdf_strncmp( line, "FONTBOUNDINGBOX", 15 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_SIZE ) )
-       {
-@@ -2216,7 +2228,7 @@
-     }
- 
-     /* The next thing to check for is the FONT field. */
--    if ( ft_strncmp( line, "FONT", 4 ) == 0 )
-+    if ( _bdf_strncmp( line, "FONT", 4 ) == 0 )
-     {
-       error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
-       if ( error )
-@@ -2251,7 +2263,7 @@
-     }
- 
-     /* Check for the SIZE field. */
--    if ( ft_strncmp( line, "SIZE", 4 ) == 0 )
-+    if ( _bdf_strncmp( line, "SIZE", 4 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_FONT_NAME ) )
-       {
-@@ -2305,7 +2317,7 @@
-     }
- 
-     /* Check for the CHARS field -- font properties are optional */
--    if ( ft_strncmp( line, "CHARS", 5 ) == 0 )
-+    if ( _bdf_strncmp( line, "CHARS", 5 ) == 0 )
-     {
-       char  nbuf[128];
- 
diff --git a/SOURCES/freetype-2.4.11-fix-emboldening.patch b/SOURCES/freetype-2.4.11-fix-emboldening.patch
deleted file mode 100644
index 5e8a0c5..0000000
--- a/SOURCES/freetype-2.4.11-fix-emboldening.patch
+++ /dev/null
@@ -1,253 +0,0 @@
---- freetype-2.4.11/include/freetype/internal/ftcalc.h
-+++ freetype-2.4.11/include/freetype/internal/ftcalc.h
-@@ -156,6 +156,13 @@ FT_BEGIN_HEADER
-                      FT_Pos  out_y );
- 
- 
-+  /*
-+   *  Return the most significant bit index.
-+   */
-+  FT_BASE( FT_Int )
-+  FT_MSB( FT_UInt32 z );
-+
-+
- #define INT_TO_F26DOT6( x )    ( (FT_Long)(x) << 6  )
- #define INT_TO_F2DOT14( x )    ( (FT_Long)(x) << 14 )
- #define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )
---- freetype-2.4.11/src/base/ftcalc.c
-+++ freetype-2.4.11/src/base/ftcalc.c
-@@ -103,6 +103,42 @@
-   }
- 
- 
-+  FT_BASE_DEF ( FT_Int )
-+  FT_MSB( FT_UInt32 z )
-+  {
-+    FT_Int shift = 0;
-+
-+    /* determine msb bit index in `shift' */
-+    if ( z >= ( 1L << 16 ) )
-+    {
-+      z     >>= 16;
-+      shift  += 16;
-+    }
-+    if ( z >= ( 1L << 8 ) )
-+    {
-+      z     >>= 8;
-+      shift  += 8;
-+    }
-+    if ( z >= ( 1L << 4 ) )
-+    {
-+      z     >>= 4;
-+      shift  += 4;
-+    }
-+    if ( z >= ( 1L << 2 ) )
-+    {
-+      z     >>= 2;
-+      shift  += 2;
-+    }
-+    if ( z >= ( 1L << 1 ) )
-+    {
-+      z     >>= 1;
-+      shift  += 1;
-+    }
-+
-+    return shift;
-+  }
-+
-+
- #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
- 
-   /* documentation is in ftcalc.h */
---- freetype-2.4.11/src/base/ftoutln.c
-+++ freetype-2.4.11/src/base/ftoutln.c
-@@ -930,10 +930,15 @@
-       v_prev  = points[last];
-       v_cur   = v_first;
- 
--      /* compute the incoming vector and its length */
-+      /* compute the incoming normalized vector */
-       in.x = v_cur.x - v_prev.x;
-       in.y = v_cur.y - v_prev.y;
-       l_in = FT_Vector_Length( &in );
-+      if ( l_in )
-+      {
-+        in.x = FT_DivFix( in.x, l_in );
-+        in.y = FT_DivFix( in.y, l_in );
-+      }
- 
-       for ( n = first; n <= last; n++ )
-       {
-@@ -942,20 +947,27 @@
-         else
-           v_next = v_first;
- 
--        /* compute the outgoing vector and its length */
-+        /* compute the outgoing normalized vector */
-         out.x = v_next.x - v_cur.x;
-         out.y = v_next.y - v_cur.y;
-         l_out = FT_Vector_Length( &out );
-+        if ( l_out )
-+        {
-+          out.x = FT_DivFix( out.x, l_out );
-+          out.y = FT_DivFix( out.y, l_out );
-+        }
- 
--        d = l_in * l_out + in.x * out.x + in.y * out.y;
-+        d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );
- 
-         /* shift only if turn is less then ~160 degrees */
--        if ( 16 * d > l_in * l_out )
-+        if ( d > -0xF000L )
-         {
-+          d = d + 0x10000L;
-+
-           /* shift components are aligned along bisector        */
-           /* and directed according to the outline orientation. */
--          shift.x = l_out * in.y + l_in * out.y;
--          shift.y = l_out * in.x + l_in * out.x;
-+          shift.x = in.y + out.y;
-+          shift.y = in.x + out.x;
- 
-           if ( orientation == FT_ORIENTATION_TRUETYPE )
-             shift.x = -shift.x;
-@@ -963,18 +975,19 @@
-             shift.y = -shift.y;
- 
-           /* threshold strength to better handle collapsing segments */
--          l = FT_MIN( l_in, l_out );
--          q = out.x * in.y - out.y * in.x;
-+          q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x );
-           if ( orientation == FT_ORIENTATION_TRUETYPE )
-             q = -q;
- 
--          if ( FT_MulDiv( xstrength, q, l ) < d )
-+          l = FT_MIN( l_in, l_out );
-+
-+          if ( FT_MulFix( xstrength, q ) <= FT_MulFix( d, l ) )
-             shift.x = FT_MulDiv( shift.x, xstrength, d );
-           else
-             shift.x = FT_MulDiv( shift.x, l, q );
- 
-           
--          if ( FT_MulDiv( ystrength, q, l ) < d )
-+          if ( FT_MulFix( ystrength, q ) <= FT_MulFix( d, l ) )
-             shift.y = FT_MulDiv( shift.y, ystrength, d );
-           else
-             shift.y = FT_MulDiv( shift.y, l, q );
-@@ -1002,6 +1015,8 @@
-   FT_EXPORT_DEF( FT_Orientation )
-   FT_Outline_Get_Orientation( FT_Outline*  outline )
-   {
-+    FT_BBox     cbox;
-+    FT_Int      xshift, yshift;
-     FT_Vector*  points;
-     FT_Vector   v_prev, v_cur;
-     FT_Int      c, n, first;
-@@ -1016,6 +1031,14 @@
-     /* cubic or quadratic curves, this test deals with the polygon    */
-     /* only which is spanned up by the control points.                */
- 
-+    FT_Outline_Get_CBox( outline, &cbox );
-+
-+    xshift = FT_MSB( FT_ABS( cbox.xMax ) | FT_ABS( cbox.xMin ) ) - 14;
-+    xshift = FT_MAX( xshift, 0 );
-+
-+    yshift = FT_MSB( cbox.yMax - cbox.yMin ) - 14;
-+    yshift = FT_MAX( yshift, 0 );
-+
-     points = outline->points;
- 
-     first = 0;
-@@ -1029,7 +1052,8 @@
-       for ( n = first; n <= last; n++ )
-       {
-         v_cur = points[n];
--        area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x );
-+        area += ( ( v_cur.y - v_prev.y ) >> yshift ) *
-+                ( ( v_cur.x + v_prev.x ) >> xshift );
-         v_prev = v_cur;
-       }
- 
---- freetype-2.4.11/src/base/fttrigon.c
-+++ freetype-2.4.11/src/base/fttrigon.c
-@@ -104,43 +104,14 @@
-   static FT_Int
-   ft_trig_prenorm( FT_Vector*  vec )
-   {
--    FT_Fixed  x, y, z;
-+    FT_Fixed  x, y;
-     FT_Int    shift;
- 
- 
-     x = vec->x;
-     y = vec->y;
- 
--    z     = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y );
--    shift = 0;
--
--#if 1
--    /* determine msb bit index in `shift' */
--    if ( z >= ( 1L << 16 ) )
--    {
--      z     >>= 16;
--      shift  += 16;
--    }
--    if ( z >= ( 1L << 8 ) )
--    {
--      z     >>= 8;
--      shift  += 8;
--    }
--    if ( z >= ( 1L << 4 ) )
--    {
--      z     >>= 4;
--      shift  += 4;
--    }
--    if ( z >= ( 1L << 2 ) )
--    {
--      z     >>= 2;
--      shift  += 2;
--    }
--    if ( z >= ( 1L << 1 ) )
--    {
--      z    >>= 1;
--      shift += 1;
--    }
-+    shift = FT_MSB( FT_ABS( x ) | FT_ABS( y ) );
- 
-     if ( shift <= 27 )
-     {
-@@ -156,33 +127,6 @@
-       shift  = -shift;
-     }
- 
--#else /* 0 */
--
--    if ( z < ( 1L << 27 ) )
--    {
--      do
--      {
--        shift++;
--        z <<= 1;
--      } while ( z < ( 1L << 27 ) );
--      vec->x = x << shift;
--      vec->y = y << shift;
--    }
--    else if ( z > ( 1L << 28 ) )
--    {
--      do
--      {
--        shift++;
--        z >>= 1;
--      } while ( z > ( 1L << 28 ) );
--
--      vec->x = x >> shift;
--      vec->y = y >> shift;
--      shift  = -shift;
--    }
--
--#endif /* 0 */
--
-     return shift;
-   }
- 
diff --git a/SOURCES/freetype-2.4.11-ft-strncmp.patch b/SOURCES/freetype-2.4.11-ft-strncmp.patch
deleted file mode 100644
index 6de33c5..0000000
--- a/SOURCES/freetype-2.4.11-ft-strncmp.patch
+++ /dev/null
@@ -1,228 +0,0 @@
-commit 9a56764037dfc01a89fe61f5c67971bf50343d00
-Author: Werner Lemberg <wl@gnu.org>
-Date:   Wed Feb 26 13:08:07 2014 +0100
-
-    [bdf] Fix Savannah bug #41692.
-    
-    bdflib puts data from the input stream into a buffer in chunks of
-    1024 bytes.  The data itself gets then parsed line by line, simply
-    increasing the current pointer into the buffer; if the search for
-    the final newline character exceeds the buffer size, more data gets
-    read.
-    
-    However, in case the current line's end is very near to the buffer
-    end, and the keyword to compare with is longer than the current
-    line's length, an out-of-bounds read might happen since `memcmp'
-    doesn't stop properly at the string end.
-    
-    * src/bdf/bdflib.c: s/ft_memcmp/ft_strncmp/ to make comparisons
-    stop at string ends.
-
-diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
-index c9e231e..b0ec292 100644
---- a/src/bdf/bdflib.c
-+++ b/src/bdf/bdflib.c
-@@ -1402,7 +1402,7 @@
- 
-     /* If the property happens to be a comment, then it doesn't need */
-     /* to be added to the internal hash table.                       */
--    if ( ft_memcmp( name, "COMMENT", 7 ) != 0 )
-+    if ( ft_strncmp( name, "COMMENT", 7 ) != 0 )
-     {
-       /* Add the property to the font property table. */
-       error = hash_insert( fp->name,
-@@ -1420,13 +1420,13 @@
-     /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are        */
-     /* present, and the SPACING property should override the default       */
-     /* spacing.                                                            */
--    if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 )
-+    if ( ft_strncmp( name, "DEFAULT_CHAR", 12 ) == 0 )
-       font->default_char = fp->value.l;
--    else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 )
-+    else if ( ft_strncmp( name, "FONT_ASCENT", 11 ) == 0 )
-       font->font_ascent = fp->value.l;
--    else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 )
-+    else if ( ft_strncmp( name, "FONT_DESCENT", 12 ) == 0 )
-       font->font_descent = fp->value.l;
--    else if ( ft_memcmp( name, "SPACING", 7 ) == 0 )
-+    else if ( ft_strncmp( name, "SPACING", 7 ) == 0 )
-     {
-       if ( !fp->value.atom )
-       {
-@@ -1484,7 +1484,7 @@
-     memory = font->memory;
- 
-     /* Check for a comment. */
--    if ( ft_memcmp( line, "COMMENT", 7 ) == 0 )
-+    if ( ft_strncmp( line, "COMMENT", 7 ) == 0 )
-     {
-       linelen -= 7;
- 
-@@ -1501,7 +1501,7 @@
-     /* The very first thing expected is the number of glyphs. */
-     if ( !( p->flags & _BDF_GLYPHS ) )
-     {
--      if ( ft_memcmp( line, "CHARS", 5 ) != 0 )
-+      if ( ft_strncmp( line, "CHARS", 5 ) != 0 )
-       {
-         FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" ));
-         error = BDF_Err_Missing_Chars_Field;
-@@ -1535,7 +1535,7 @@
-     }
- 
-     /* Check for the ENDFONT field. */
--    if ( ft_memcmp( line, "ENDFONT", 7 ) == 0 )
-+    if ( ft_strncmp( line, "ENDFONT", 7 ) == 0 )
-     {
-       /* Sort the glyphs by encoding. */
-       ft_qsort( (char *)font->glyphs,
-@@ -1549,7 +1549,7 @@
-     }
- 
-     /* Check for the ENDCHAR field. */
--    if ( ft_memcmp( line, "ENDCHAR", 7 ) == 0 )
-+    if ( ft_strncmp( line, "ENDCHAR", 7 ) == 0 )
-     {
-       p->glyph_enc = 0;
-       p->flags    &= ~_BDF_GLYPH_BITS;
-@@ -1565,7 +1565,7 @@
-       goto Exit;
- 
-     /* Check for the STARTCHAR field. */
--    if ( ft_memcmp( line, "STARTCHAR", 9 ) == 0 )
-+    if ( ft_strncmp( line, "STARTCHAR", 9 ) == 0 )
-     {
-       /* Set the character name in the parse info first until the */
-       /* encoding can be checked for an unencoded character.      */
-@@ -1599,7 +1599,7 @@
-     }
- 
-     /* Check for the ENCODING field. */
--    if ( ft_memcmp( line, "ENCODING", 8 ) == 0 )
-+    if ( ft_strncmp( line, "ENCODING", 8 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_GLYPH ) )
-       {
-@@ -1785,7 +1785,7 @@
-     }
- 
-     /* Expect the SWIDTH (scalable width) field next. */
--    if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 )
-+    if ( ft_strncmp( line, "SWIDTH", 6 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_ENCODING ) )
-         goto Missing_Encoding;
-@@ -1801,7 +1801,7 @@
-     }
- 
-     /* Expect the DWIDTH (scalable width) field next. */
--    if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 )
-+    if ( ft_strncmp( line, "DWIDTH", 6 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_ENCODING ) )
-         goto Missing_Encoding;
-@@ -1829,7 +1829,7 @@
-     }
- 
-     /* Expect the BBX field next. */
--    if ( ft_memcmp( line, "BBX", 3 ) == 0 )
-+    if ( ft_strncmp( line, "BBX", 3 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_ENCODING ) )
-         goto Missing_Encoding;
-@@ -1897,7 +1897,7 @@
-     }
- 
-     /* And finally, gather up the bitmap. */
--    if ( ft_memcmp( line, "BITMAP", 6 ) == 0 )
-+    if ( ft_strncmp( line, "BITMAP", 6 ) == 0 )
-     {
-       unsigned long  bitmap_size;
- 
-@@ -1972,7 +1972,7 @@
-     p    = (_bdf_parse_t *)    client_data;
- 
-     /* Check for the end of the properties. */
--    if ( ft_memcmp( line, "ENDPROPERTIES", 13 ) == 0 )
-+    if ( ft_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
-     {
-       /* If the FONT_ASCENT or FONT_DESCENT properties have not been      */
-       /* encountered yet, then make sure they are added as properties and */
-@@ -2013,12 +2013,12 @@
-     }
- 
-     /* Ignore the _XFREE86_GLYPH_RANGES properties. */
--    if ( ft_memcmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 )
-+    if ( ft_strncmp( line, "_XFREE86_GLYPH_RANGES", 21 ) == 0 )
-       goto Exit;
- 
-     /* Handle COMMENT fields and properties in a special way to preserve */
-     /* the spacing.                                                      */
--    if ( ft_memcmp( line, "COMMENT", 7 ) == 0 )
-+    if ( ft_strncmp( line, "COMMENT", 7 ) == 0 )
-     {
-       name = value = line;
-       value += 7;
-@@ -2082,7 +2082,7 @@
- 
-     /* Check for a comment.  This is done to handle those fonts that have */
-     /* comments before the STARTFONT line for some reason.                */
--    if ( ft_memcmp( line, "COMMENT", 7 ) == 0 )
-+    if ( ft_strncmp( line, "COMMENT", 7 ) == 0 )
-     {
-       if ( p->opts->keep_comments != 0 && p->font != 0 )
-       {
-@@ -2108,7 +2108,7 @@
-     {
-       memory = p->memory;
- 
--      if ( ft_memcmp( line, "STARTFONT", 9 ) != 0 )
-+      if ( ft_strncmp( line, "STARTFONT", 9 ) != 0 )
-       {
-         /* we don't emit an error message since this code gets */
-         /* explicitly caught one level higher                  */
-@@ -2156,7 +2156,7 @@
-     }
- 
-     /* Check for the start of the properties. */
--    if ( ft_memcmp( line, "STARTPROPERTIES", 15 ) == 0 )
-+    if ( ft_strncmp( line, "STARTPROPERTIES", 15 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_FONT_BBX ) )
-       {
-@@ -2185,7 +2185,7 @@
-     }
- 
-     /* Check for the FONTBOUNDINGBOX field. */
--    if ( ft_memcmp( line, "FONTBOUNDINGBOX", 15 ) == 0 )
-+    if ( ft_strncmp( line, "FONTBOUNDINGBOX", 15 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_SIZE ) )
-       {
-@@ -2216,7 +2216,7 @@
-     }
- 
-     /* The next thing to check for is the FONT field. */
--    if ( ft_memcmp( line, "FONT", 4 ) == 0 )
-+    if ( ft_strncmp( line, "FONT", 4 ) == 0 )
-     {
-       error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
-       if ( error )
-@@ -2251,7 +2251,7 @@
-     }
- 
-     /* Check for the SIZE field. */
--    if ( ft_memcmp( line, "SIZE", 4 ) == 0 )
-+    if ( ft_strncmp( line, "SIZE", 4 ) == 0 )
-     {
-       if ( !( p->flags & _BDF_FONT_NAME ) )
-       {
-@@ -2305,7 +2305,7 @@
-     }
- 
-     /* Check for the CHARS field -- font properties are optional */
--    if ( ft_memcmp( line, "CHARS", 5 ) == 0 )
-+    if ( ft_strncmp( line, "CHARS", 5 ) == 0 )
-     {
-       char  nbuf[128];
- 
diff --git a/SOURCES/freetype-2.4.11-libtool.patch b/SOURCES/freetype-2.4.11-libtool.patch
index 203913e..6cabf2a 100644
--- a/SOURCES/freetype-2.4.11-libtool.patch
+++ b/SOURCES/freetype-2.4.11-libtool.patch
@@ -1,11 +1,10 @@
 --- freetype-2.4.11/builds/unix/freetype-config.in
 +++ freetype-2.4.11/builds/unix/freetype-config.in
-@@ -153,8 +153,7 @@ if test "$echo_libs" = "yes" ; then
+@@ -205,7 +205,7 @@ if test "$echo_libs" = "yes" ; then
  fi
  
  if test "$echo_libtool" = "yes" ; then
--  convlib="libfreetype.la"
--  echo ${SYSROOT}$libdir/$convlib
+-  echo ${SYSROOT}$libdir/libfreetype.la
 +  echo ""
  fi
  
diff --git a/SOURCES/freetype-2.4.11-pcf-read-a.patch b/SOURCES/freetype-2.4.11-pcf-read-a.patch
deleted file mode 100644
index 34ab2e0..0000000
--- a/SOURCES/freetype-2.4.11-pcf-read-a.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-From 74af85c4b62b35e55b0ce9dec55ee10cbc4962a2 Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Mon, 8 Dec 2014 16:01:50 +0100
-Subject: [PATCH] [pcf] Fix Savannah bug #43774.
-
-Work around `features' of X11's `pcfWriteFont' and `pcfReadFont'
-functions.  Since the PCF format doesn't have an official
-specification, we have to exactly follow these functions' behaviour.
-
-The problem was unveiled with a patch from 2014-11-06, fixing issue #43547.
-
-* src/pcf/pcfread.c (pcf_read_TOC): Don't check table size for last
-element.  Instead, assign real size.
----
- ChangeLog         | 14 ++++++++++++++
- src/pcf/pcfread.c | 54 +++++++++++++++++++++++++++++++++++++++++++-----------
- 2 files changed, 57 insertions(+), 11 deletions(-)
-
-diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
-index 998cbed..e3caf82 100644
---- a/src/pcf/pcfread.c
-+++ b/src/pcf/pcfread.c
-@@ -95,9 +95,11 @@ THE SOFTWARE.
-     FT_Memory  memory = FT_FACE(face)->memory;
-     FT_UInt    n;
- 
-+    FT_ULong   size;
- 
--    if ( FT_STREAM_SEEK ( 0 )                          ||
--         FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )
-+
-+    if ( FT_STREAM_SEEK( 0 )                          ||
-+         FT_STREAM_READ_FIELDS( pcf_toc_header, toc ) )
-       return PCF_Err_Cannot_Open_Resource;
- 
-     if ( toc->version != PCF_FILE_VERSION                 ||
-@@ -151,14 +153,35 @@ THE SOFTWARE.
-         break;
-     }
- 
--    /* we now check whether the `size' and `offset' values are reasonable: */
--    /* `offset' + `size' must not exceed the stream size                   */
-+    /*
-+     *  We now check whether the `size' and `offset' values are reasonable:
-+     *  `offset' + `size' must not exceed the stream size.
-+     *
-+     *  Note, however, that X11's `pcfWriteFont' routine (used by the
-+     *  `bdftopcf' program to create PDF font files) has two special
-+     *  features.
-+     *
-+     *  - It always assigns the accelerator table a size of 100 bytes in the
-+     *    TOC, regardless of its real size, which can vary between 34 and 72
-+     *    bytes.
-+     *
-+     *  - Due to the way the routine is designed, it ships out the last font
-+     *    table with its real size, ignoring the TOC's size value.  Since
-+     *    the TOC size values are always rounded up to a multiple of 4, the
-+     *    difference can be up to three bytes for all tables except the
-+     *    accelerator table, for which the difference can be as large as 66
-+     *    bytes.
-+     *
-+     */
-+
-     tables = face->toc.tables;
--    for ( n = 0; n < toc->count; n++ )
-+    size   = stream->size;
-+
-+    for ( n = 0; n < toc->count - 1; n++ )
-     {
-       /* we need two checks to avoid overflow */
--      if ( ( tables->size   > stream->size                ) ||
--           ( tables->offset > stream->size - tables->size ) )
-+      if ( ( tables->size   > size                ) ||
-+           ( tables->offset > size - tables->size ) )
-       {
-         error = PCF_Err_Invalid_Table;
-         goto Exit;
-@@ -166,6 +189,15 @@ THE SOFTWARE.
-       tables++;
-     }
- 
-+    /* no check of `tables->size' for last table element ... */
-+    if ( ( tables->offset > size ) )
-+    {
-+      error = PCF_Err_Invalid_Table;
-+      goto Exit;
-+    }
-+    /* ... instead, we adjust `tables->size' to the real value */
-+    tables->size = size - tables->offset;
-+
- #ifdef FT_DEBUG_LEVEL_TRACE
- 
-     {
-@@ -714,8 +746,8 @@ THE SOFTWARE.
- 
-     FT_TRACE4(( "  number of bitmaps: %d\n", nbitmaps ));
- 
--    /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */
--    if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics )
-+    /* XXX: PCF_Face->nmetrics is signed FT_Long, see pcf.h */
-+    if ( face->nmetrics < 0 || nbitmaps != (FT_ULong)face->nmetrics )
-       return PCF_Err_Invalid_File_Format;
- 
-     if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
--- 
-2.1.0
-
diff --git a/SOURCES/freetype-2.4.11-pcf-read-b.patch b/SOURCES/freetype-2.4.11-pcf-read-b.patch
deleted file mode 100644
index 16c68cc..0000000
--- a/SOURCES/freetype-2.4.11-pcf-read-b.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 06842c7b49c21f13c0ab61201daab6ff5a358fcc Mon Sep 17 00:00:00 2001
-From: Werner Lemberg <wl@gnu.org>
-Date: Sat, 13 Dec 2014 07:42:51 +0100
-Subject: [PATCH] * src/pcf/pcfread.c (pcf_read_TOC): Improve fix from
- 2014-12-08.
-
----
- ChangeLog         | 4 ++++
- src/pcf/pcfread.c | 7 ++++---
- 2 files changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
-index e3caf82..a29a9e3 100644
---- a/src/pcf/pcfread.c
-+++ b/src/pcf/pcfread.c
-@@ -189,14 +189,15 @@ THE SOFTWARE.
-       tables++;
-     }
- 
--    /* no check of `tables->size' for last table element ... */
-+    /* only check `tables->offset' for last table element ... */
-     if ( ( tables->offset > size ) )
-     {
-       error = PCF_Err_Invalid_Table;
-       goto Exit;
-     }
--    /* ... instead, we adjust `tables->size' to the real value */
--    tables->size = size - tables->offset;
-+    /* ... and adjust `tables->size' to the real value if necessary */
-+    if ( tables->size > size - tables->offset )
-+      tables->size = size - tables->offset;
- 
- #ifdef FT_DEBUG_LEVEL_TRACE
- 
--- 
-2.1.0
-
diff --git a/SOURCES/freetype-2.4.11-signed.patch b/SOURCES/freetype-2.4.11-signed.patch
index 6069928..88d717b 100644
--- a/SOURCES/freetype-2.4.11-signed.patch
+++ b/SOURCES/freetype-2.4.11-signed.patch
@@ -180,7 +180,7 @@
 +
    FT_BASE_DEF( FT_UShort )
    FT_Stream_ReadUShortLE( FT_Stream  stream,
-                          FT_Error*  error )
+                           FT_Error*  error )
 @@ -577,6 +716,53 @@
    }
  
@@ -234,7 +234,7 @@
 +
    FT_BASE_DEF( FT_ULong )
    FT_Stream_ReadUOffset( FT_Stream  stream,
-                         FT_Error*  error )
+                          FT_Error*  error )
 @@ -624,6 +810,53 @@
    }
  
@@ -288,7 +288,7 @@
 +
    FT_BASE_DEF( FT_ULong )
    FT_Stream_ReadULong( FT_Stream  stream,
-                       FT_Error*  error )
+                        FT_Error*  error )
 @@ -671,6 +904,53 @@
    }
  
@@ -342,7 +342,7 @@
 +
    FT_BASE_DEF( FT_ULong )
    FT_Stream_ReadULongLE( FT_Stream  stream,
-                         FT_Error*  error )
+                          FT_Error*  error )
 @@ -714,6 +994,53 @@
                 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                 stream->pos, stream->size ));
diff --git a/SOURCES/freetype-2.4.11-unsigned-long.patch b/SOURCES/freetype-2.4.11-unsigned-long.patch
deleted file mode 100644
index 04db8c1..0000000
--- a/SOURCES/freetype-2.4.11-unsigned-long.patch
+++ /dev/null
@@ -1,153 +0,0 @@
-commit 453316792fee912cfced48e9e270e9eb19892e64
-Author: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
-Date:   Wed Nov 26 16:02:17 2014 +0900
-
-    * src/base/ftobjs.c (Mac_Read_POST_Resource): Use unsigned long
-    variables to read the lengths in POST fragments.  Suggested by
-    Mateusz Jurczyk <mjurczyk@google.com>.
-
-diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
-index 922216e..dfad24a 100644
---- a/src/base/ftobjs.c
-+++ b/src/base/ftobjs.c
-@@ -1545,9 +1545,9 @@
-     FT_Memory  memory = library->memory;
-     FT_Byte*   pfb_data = NULL;
-     int        i, type, flags;
--    FT_Long    len;
--    FT_Long    pfb_len, pfb_pos, pfb_lenpos;
--    FT_Long    rlen, temp;
-+    FT_ULong   len;
-+    FT_ULong   pfb_len, pfb_pos, pfb_lenpos;
-+    FT_ULong   rlen, temp;
- 
- 
-     if ( face_index == -1 )
-@@ -1563,25 +1563,25 @@
-       error = FT_Stream_Seek( stream, offsets[i] );
-       if ( error )
-         goto Exit;
--      if ( FT_READ_LONG( temp ) )
-+      if ( FT_READ_ULONG( temp ) )
-         goto Exit;
--      if ( 0 > temp )
-+      FT_TRACE4(( "                 POST fragment #%d: length=0x%08x\n", i, temp));
-+      if ( 0x7FFFFFFFUL < temp )
-+      {
-         error = FT_Err_Invalid_Offset;
--      else if ( 0x7FFFFFFFL - 6 - pfb_len < temp )
--        error = FT_Err_Array_Too_Large;
--
--      if ( error )
-         goto Exit;
-+      }
- 
-       pfb_len += temp + 6;
-     }
- 
--    if ( 0x7FFFFFFFL - 2 < pfb_len )
-+    FT_TRACE2(( "             total buffer size to concatenate %d POST fragments: 0x%08x\n",
-+                 resource_cnt, pfb_len + 2));
-+    if ( pfb_len + 2 < 6 ) {
-       error = FT_Err_Array_Too_Large;
--    else
--      error = FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 );
--
--    if ( error )
-+      goto Exit;
-+    }
-+    if ( FT_ALLOC( pfb_data, (FT_Long)pfb_len + 2 ) )
-       goto Exit;
- 
-     pfb_data[0] = 0x80;
-@@ -1600,21 +1602,25 @@
-       error = FT_Stream_Seek( stream, offsets[i] );
-       if ( error )
-         goto Exit2;
--      if ( FT_READ_LONG( rlen ) )
-+      if ( FT_READ_ULONG( rlen ) )
-         goto Exit;
--      if ( rlen < 0 )
-+      if ( 0x7FFFFFFFUL < rlen )
-       {
-         error = FT_Err_Invalid_Offset;
-         goto Exit2;
-       }
-       if ( FT_READ_USHORT( flags ) )
-         goto Exit;
-       FT_TRACE3(( "POST fragment[%d]: offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
-                    i, offsets[i], rlen, flags ));
- 
-+      error = FT_Err_Array_Too_Large;
-       /* postpone the check of rlen longer than buffer until FT_Stream_Read() */
-       if ( ( flags >> 8 ) == 0 )        /* Comment, should not be loaded */
-+      {
-+        FT_TRACE3(( "    Skip POST fragment #%d because it is a comment\n", i ));
-         continue;
-+      }
- 
-       /* the flags are part of the resource, so rlen >= 2.  */
-       /* but some fonts declare rlen = 0 for empty fragment */
-@@ -1624,16 +1632,10 @@
-         rlen = 0;
- 
-       if ( ( flags >> 8 ) == type )
--      {
--        if ( 0x7FFFFFFFL - rlen < len )
--        {
--          error = FT_Err_Array_Too_Large;
--          goto Exit2;
--        }
-         len += rlen;
--      }
-       else
-       {
-+        FT_TRACE3(( "    Write POST fragment #%d header (4-byte) to buffer 0x%p + 0x%08x\n", i, pfb_data, pfb_lenpos ));
-         if ( pfb_lenpos + 3 > pfb_len + 2 )
-           goto Exit2;
-         pfb_data[pfb_lenpos    ] = (FT_Byte)( len );
-@@ -1644,6 +1646,7 @@
-         if ( ( flags >> 8 ) == 5 )      /* End of font mark */
-           break;
- 
-+        FT_TRACE3(( "    Write POST fragment #%d header (6-byte) to buffer 0x%p + 0x%08x\n", i, pfb_data, pfb_pos ));
-         if ( pfb_pos + 6 > pfb_len + 2 )
-           goto Exit2;
-         pfb_data[pfb_pos++] = 0x80;
-@@ -1659,21 +1662,17 @@
-         pfb_data[pfb_pos++] = 0;
-       }
- 
--      error = FT_Err_Cannot_Open_Resource;
--      if ( rlen > 0x7FFFFFFFL - pfb_pos )
--      {
--        error = FT_Err_Array_Too_Large;
--        goto Exit2;
--      }
-       if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
-         goto Exit2;
- 
-+      FT_TRACE3(( "    Load POST fragment #%d (%d byte) to buffer 0x%p + 0x%08x\n", i, rlen, pfb_data, pfb_pos ));
-       error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
-       if ( error )
-         goto Exit2;
-       pfb_pos += rlen;
-     }
- 
-+    error = FT_Err_Array_Too_Large;
-     if ( pfb_pos + 2 > pfb_len + 2 )
-       goto Exit2;
-     pfb_data[pfb_pos++] = 0x80;
-@@ -1694,6 +1693,12 @@
-                                   aface );
- 
-   Exit2:
-+    if ( error == FT_Err_Array_Too_Large )
-+      FT_TRACE2(( "  Abort due to too-short buffer to store all POST fragments\n" ));
-+    else if ( error == FT_Err_Invalid_Offset )
-+      FT_TRACE2(( "  Abort due to invalid offset in a POST fragment\n" ));
-+    if ( error )
-+      error = FT_Err_Cannot_Open_Resource;
-     FT_FREE( pfb_data );
- 
-   Exit:
diff --git a/SOURCES/freetype-2.8-2.4.11-API.patch b/SOURCES/freetype-2.8-2.4.11-API.patch
new file mode 100644
index 0000000..203e9e4
--- /dev/null
+++ b/SOURCES/freetype-2.8-2.4.11-API.patch
@@ -0,0 +1,696 @@
+--- freetype-2.8/builds/unix/unix-cc.in.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/builds/unix/unix-cc.in	2018-06-07 19:16:35.881770695 +0200
+@@ -109,6 +109,6 @@ CCexe        := $(CCraw_build)	# used to
+ LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
+                           -rpath $(libdir) -version-info $(version_info) \
+                           $(LDFLAGS) -no-undefined \
+-                          -export-symbols $(EXPORTS_LIST)
++                          # -export-symbols $(EXPORTS_LIST)
+ 
+ # EOF
+--- freetype-2.8/ft2demos-2.8/src/ftview.c.api	2017-05-11 18:31:16.000000000 +0200
++++ freetype-2.8/ft2demos-2.8/src/ftview.c	2018-06-04 16:53:29.960331386 +0200
+@@ -1531,8 +1531,8 @@
+       case FT_ENCODING_SJIS:
+         encoding = "SJIS";
+         break;
+-      case FT_ENCODING_PRC:
+-        encoding = "PRC";
++      case FT_ENCODING_GB2312:
++        encoding = "GB2312";
+         break;
+       case FT_ENCODING_BIG5:
+         encoding = "Big5";
+--- freetype-2.8/include/freetype/freetype.h.api	2017-05-13 06:28:40.000000000 +0200
++++ freetype-2.8/include/freetype/freetype.h	2018-06-04 16:53:29.961331388 +0200
+@@ -766,15 +766,14 @@ FT_BEGIN_HEADER
+     FT_ENC_TAG( FT_ENCODING_UNICODE,   'u', 'n', 'i', 'c' ),
+ 
+     FT_ENC_TAG( FT_ENCODING_SJIS,    's', 'j', 'i', 's' ),
+-    FT_ENC_TAG( FT_ENCODING_PRC,     'g', 'b', ' ', ' ' ),
++    FT_ENC_TAG( FT_ENCODING_GB2312,  'g', 'b', ' ', ' ' ),
+     FT_ENC_TAG( FT_ENCODING_BIG5,    'b', 'i', 'g', '5' ),
+     FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
+     FT_ENC_TAG( FT_ENCODING_JOHAB,   'j', 'o', 'h', 'a' ),
+ 
+     /* for backward compatibility */
+-    FT_ENCODING_GB2312     = FT_ENCODING_PRC,
+     FT_ENCODING_MS_SJIS    = FT_ENCODING_SJIS,
+-    FT_ENCODING_MS_GB2312  = FT_ENCODING_PRC,
++    FT_ENCODING_MS_GB2312  = FT_ENCODING_GB2312,
+     FT_ENCODING_MS_BIG5    = FT_ENCODING_BIG5,
+     FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
+     FT_ENCODING_MS_JOHAB   = FT_ENCODING_JOHAB,
+--- freetype-2.8/include/freetype/ftcache.h.api	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/include/freetype/ftcache.h	2018-06-04 16:53:29.961331388 +0200
+@@ -667,8 +667,8 @@ FT_BEGIN_HEADER
+   typedef struct  FTC_ImageTypeRec_
+   {
+     FTC_FaceID  face_id;
+-    FT_UInt     width;
+-    FT_UInt     height;
++    FT_Int      width;
++    FT_Int      height;
+     FT_Int32    flags;
+ 
+   } FTC_ImageTypeRec;
+--- freetype-2.8/include/freetype/ftimage.h.api	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/include/freetype/ftimage.h	2018-06-04 16:53:29.962331389 +0200
+@@ -260,13 +260,13 @@ FT_BEGIN_HEADER
+   /*                                                                       */
+   typedef struct  FT_Bitmap_
+   {
+-    unsigned int    rows;
+-    unsigned int    width;
++    int             rows;
++    int             width;
+     int             pitch;
+     unsigned char*  buffer;
+-    unsigned short  num_grays;
+-    unsigned char   pixel_mode;
+-    unsigned char   palette_mode;
++    short           num_grays;
++    char            pixel_mode;
++    char            palette_mode;
+     void*           palette;
+ 
+   } FT_Bitmap;
+--- freetype-2.8/include/freetype/ftmm.h.api	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/include/freetype/ftmm.h	2018-06-04 16:53:29.962331389 +0200
+@@ -177,14 +177,10 @@ FT_BEGIN_HEADER
+   /*                                                                       */
+   /*    strid  :: The entry in `name' table identifying this instance.     */
+   /*                                                                       */
+-  /*    psid   :: The entry in `name' table identifying a PostScript name  */
+-  /*              for this instance.                                       */
+-  /*                                                                       */
+   typedef struct  FT_Var_Named_Style_
+   {
+     FT_Fixed*  coords;
+     FT_UInt    strid;
+-    FT_UInt    psid;   /* since 2.7.1 */
+ 
+   } FT_Var_Named_Style;
+ 
+--- freetype-2.8/include/freetype/ttnameid.h.api	2017-05-03 23:26:45.000000000 +0200
++++ freetype-2.8/include/freetype/ttnameid.h	2018-06-04 16:53:29.963331391 +0200
+@@ -1217,9 +1217,9 @@ FT_BEGIN_HEADER
+   /* */
+ 
+   /* for backward compatibility with older FreeType versions */
+-#define TT_UCR_ARABIC_PRESENTATION_A         \
++#define TT_UCR_ARABIC_PRESENTATIONS_A         \
+           TT_UCR_ARABIC_PRESENTATION_FORMS_A
+-#define TT_UCR_ARABIC_PRESENTATION_B         \
++#define TT_UCR_ARABIC_PRESENTATIONS_B         \
+           TT_UCR_ARABIC_PRESENTATION_FORMS_B
+ 
+ #define TT_UCR_COMBINING_DIACRITICS          \
+--- freetype-2.8/include/freetype/tttables.h.api	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/include/freetype/tttables.h	2018-06-04 17:18:26.699449088 +0200
+@@ -383,7 +383,7 @@ FT_BEGIN_HEADER
+     FT_Short   xAvgCharWidth;
+     FT_UShort  usWeightClass;
+     FT_UShort  usWidthClass;
+-    FT_UShort  fsType;
++    FT_Short   fsType;
+     FT_Short   ySubscriptXSize;
+     FT_Short   ySubscriptYSize;
+     FT_Short   ySubscriptXOffset;
+@@ -427,11 +427,6 @@ FT_BEGIN_HEADER
+     FT_UShort  usBreakChar;
+     FT_UShort  usMaxContext;
+ 
+-    /* only version 5 and higher: */
+-
+-    FT_UShort  usLowerOpticalPointSize;       /* in twips (1/20th points) */
+-    FT_UShort  usUpperOpticalPointSize;       /* in twips (1/20th points) */
+-
+   } TT_OS2;
+ 
+ 
+@@ -596,43 +591,41 @@ FT_BEGIN_HEADER
+   /*    @FT_Get_Sfnt_Table API function.                                   */
+   /*                                                                       */
+   /* <Values>                                                              */
+-  /*    FT_SFNT_HEAD :: To access the font's @TT_Header structure.         */
++  /*    ft_sfnt_head :: To access the font's @TT_Header structure.         */
+   /*                                                                       */
+-  /*    FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure.     */
++  /*    ft_sfnt_maxp :: To access the font's @TT_MaxProfile structure.     */
+   /*                                                                       */
+-  /*    FT_SFNT_OS2  :: To access the font's @TT_OS2 structure.            */
++  /*    ft_sfnt_os2  :: To access the font's @TT_OS2 structure.            */
+   /*                                                                       */
+-  /*    FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure.     */
++  /*    ft_sfnt_hhea :: To access the font's @TT_HoriHeader structure.     */
+   /*                                                                       */
+-  /*    FT_SFNT_VHEA :: To access the font's @TT_VertHeader structure.     */
++  /*    ft_sfnt_vhea :: To access the font's @TT_VertHeader structure.     */
+   /*                                                                       */
+-  /*    FT_SFNT_POST :: To access the font's @TT_Postscript structure.     */
++  /*    ft_sfnt_post :: To access the font's @TT_Postscript structure.     */
+   /*                                                                       */
+-  /*    FT_SFNT_PCLT :: To access the font's @TT_PCLT structure.           */
++  /*    ft_sfnt_pclt :: To access the font's @TT_PCLT structure.           */
+   /*                                                                       */
+   typedef enum  FT_Sfnt_Tag_
+   {
+-    FT_SFNT_HEAD,
+-    FT_SFNT_MAXP,
+-    FT_SFNT_OS2,
+-    FT_SFNT_HHEA,
+-    FT_SFNT_VHEA,
+-    FT_SFNT_POST,
+-    FT_SFNT_PCLT,
++    ft_sfnt_head = 0,
++    ft_sfnt_maxp = 1,
++    ft_sfnt_os2  = 2,
++    ft_sfnt_hhea = 3,
++    ft_sfnt_vhea = 4,
++    ft_sfnt_post = 5,
++    ft_sfnt_pclt = 6,
+ 
+-    FT_SFNT_MAX
++    sfnt_max
+ 
+   } FT_Sfnt_Tag;
+ 
+-  /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */
+-  /* values instead                                                      */
+-#define ft_sfnt_head  FT_SFNT_HEAD
+-#define ft_sfnt_maxp  FT_SFNT_MAXP
+-#define ft_sfnt_os2   FT_SFNT_OS2
+-#define ft_sfnt_hhea  FT_SFNT_HHEA
+-#define ft_sfnt_vhea  FT_SFNT_VHEA
+-#define ft_sfnt_post  FT_SFNT_POST
+-#define ft_sfnt_pclt  FT_SFNT_PCLT
++#define FT_SFNT_HEAD ft_sfnt_head
++#define FT_SFNT_MAXP ft_sfnt_maxp
++#define FT_SFNT_OS2  ft_sfnt_os2 
++#define FT_SFNT_HHEA ft_sfnt_hhea
++#define FT_SFNT_VHEA ft_sfnt_vhea
++#define FT_SFNT_POST ft_sfnt_post
++#define FT_SFNT_PCLT ft_sfnt_pclt
+ 
+ 
+   /*************************************************************************/
+--- freetype-2.8/src/sfnt/sfdriver.c.api	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/sfnt/sfdriver.c	2018-06-04 16:53:29.964331392 +0200
+@@ -867,16 +867,9 @@
+       SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
+ 
+       FT_Long  instance = ( ( face->root.face_index & 0x7FFF0000L ) >> 16 ) - 1;
+-      FT_UInt  psid     = mm_var->namedstyle[instance].psid;
+ 
+       char*  ps_name = NULL;
+ 
+-
+-      /* try first to load the name string with index `postScriptNameID' */
+-      if ( psid == 6                      ||
+-           ( psid > 255 && psid < 32768 ) )
+-        (void)sfnt->get_name( face, (FT_UShort)psid, &ps_name );
+-
+       if ( ps_name )
+       {
+         result = ps_name;
+--- freetype-2.8/src/sfnt/sfobjs.c.api	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/sfnt/sfobjs.c	2018-06-04 16:53:29.964331392 +0200
+@@ -311,7 +311,7 @@
+       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_UCS_4,      FT_ENCODING_UNICODE },
+       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_UNICODE_CS, FT_ENCODING_UNICODE },
+       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_SJIS,       FT_ENCODING_SJIS },
+-      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_PRC,        FT_ENCODING_PRC },
++      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_GB2312,     FT_ENCODING_GB2312 },
+       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_BIG_5,      FT_ENCODING_BIG5 },
+       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_WANSUNG,    FT_ENCODING_WANSUNG },
+       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_JOHAB,      FT_ENCODING_JOHAB }
+--- freetype-2.8/src/sfnt/ttload.c.api	2017-04-22 07:39:36.000000000 +0200
++++ freetype-2.8/src/sfnt/ttload.c	2018-06-04 16:53:29.965331393 +0200
+@@ -1164,15 +1164,6 @@
+       FT_FRAME_END
+     };
+ 
+-    /* `OS/2' version 5 and newer */
+-    static const FT_Frame_Field  os2_fields_extra5[] =
+-    {
+-      FT_FRAME_START( 4 ),
+-        FT_FRAME_USHORT( usLowerOpticalPointSize ),
+-        FT_FRAME_USHORT( usUpperOpticalPointSize ),
+-      FT_FRAME_END
+-    };
+-
+ 
+     /* We now support old Mac fonts where the OS/2 table doesn't  */
+     /* exist.  Simply put, we set the `version' field to 0xFFFF   */
+@@ -1193,8 +1184,6 @@
+     os2->usDefaultChar           = 0;
+     os2->usBreakChar             = 0;
+     os2->usMaxContext            = 0;
+-    os2->usLowerOpticalPointSize = 0;
+-    os2->usUpperOpticalPointSize = 0xFFFF;
+ 
+     if ( os2->version >= 0x0001 )
+     {
+@@ -1207,13 +1196,6 @@
+         /* only version 2 tables */
+         if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )
+           goto Exit;
+-
+-        if ( os2->version >= 0x0005 )
+-        {
+-          /* only version 5 tables */
+-          if ( FT_STREAM_READ_FIELDS( os2_fields_extra5, os2 ) )
+-            goto Exit;
+-        }
+       }
+     }
+ 
+--- freetype-2.8/src/truetype/ttgxvar.c.api	2017-05-02 14:37:55.000000000 +0200
++++ freetype-2.8/src/truetype/ttgxvar.c	2018-06-04 16:53:29.966331395 +0200
+@@ -2155,7 +2155,7 @@
+           *c = FT_GET_LONG();
+ 
+         if ( usePsName )
+-          ns->psid = FT_GET_USHORT();
++          (void) FT_GET_USHORT();
+ 
+         ft_var_to_normalized( face,
+                               fvar_head.axisCount,
+@@ -2206,7 +2206,6 @@
+             ns = &mmvar->namedstyle[fvar_head.instanceCount];
+ 
+             ns->strid = strid;
+-            ns->psid  = TT_NAME_ID_PS_NAME;
+ 
+             a = mmvar->axis;
+             c = ns->coords;
+--- freetype-2.8/devel/ftoption.h.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/devel/ftoption.h	2018-06-07 11:30:34.431455285 +0200
+@@ -903,7 +903,7 @@ FT_BEGIN_HEADER
+    * This macro is obsolete.  Support has been removed in FreeType
+    * version 2.5.
+    */
+-/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
++#define FT_CONFIG_OPTION_OLD_INTERNALS
+ 
+ 
+   /*
+--- freetype-2.8/include/freetype/config/ftoption.h.orig	2017-05-01 09:39:06.000000000 +0200
++++ freetype-2.8/include/freetype/config/ftoption.h	2018-06-07 11:30:53.662506048 +0200
+@@ -934,7 +934,7 @@ FT_BEGIN_HEADER
+    * This macro is obsolete.  Support has been removed in FreeType
+    * version 2.5.
+    */
+-/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
++#define FT_CONFIG_OPTION_OLD_INTERNALS
+ 
+ 
+   /*
+--- freetype-2.8/include/freetype/ftcache.h.orig	2018-06-07 11:33:07.663882169 +0200
++++ freetype-2.8/include/freetype/ftcache.h	2018-06-07 11:33:23.127947502 +0200
+@@ -1049,6 +1049,54 @@ FT_BEGIN_HEADER
+   /* */
+ 
+ 
++#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
++
++  /*@***********************************************************************/
++  /*                                                                       */
++  /* <Struct>                                                              */
++  /*    FTC_FontRec                                                        */
++  /*                                                                       */
++  /* <Description>                                                         */
++  /*    A simple structure used to describe a given `font' to the cache    */
++  /*    manager.  Note that a `font' is the combination of a given face    */
++  /*    with a given character size.                                       */
++  /*                                                                       */
++  /* <Fields>                                                              */
++  /*    face_id    :: The ID of the face to use.                           */
++  /*                                                                       */
++  /*    pix_width  :: The character width in integer pixels.               */
++  /*                                                                       */
++  /*    pix_height :: The character height in integer pixels.              */
++  /*                                                                       */
++  typedef struct  FTC_FontRec_
++  {
++    FTC_FaceID  face_id;
++    FT_UShort   pix_width;
++    FT_UShort   pix_height;
++
++  } FTC_FontRec;
++
++
++  /* */
++
++
++  typedef FTC_FontRec*  FTC_Font;
++
++
++  FT_EXPORT( FT_Error )
++  FTC_Manager_Lookup_Face( FTC_Manager  manager,
++                           FTC_FaceID   face_id,
++                           FT_Face     *aface );
++
++  FT_EXPORT( FT_Error )
++  FTC_Manager_Lookup_Size( FTC_Manager  manager,
++                           FTC_Font     font,
++                           FT_Face     *aface,
++                           FT_Size     *asize );
++
++#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
++
++
+ FT_END_HEADER
+ 
+ #endif /* FTCACHE_H_ */
+--- freetype-2.8/src/cache/ftcmanag.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/cache/ftcmanag.c	2018-06-07 11:28:18.663096906 +0200
+@@ -701,4 +701,55 @@
+   }
+ 
+ 
++#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
++
++  FT_EXPORT_DEF( FT_Error )
++  FTC_Manager_Lookup_Face( FTC_Manager  manager,
++                           FTC_FaceID   face_id,
++                           FT_Face     *aface )
++  {
++    return FTC_Manager_LookupFace( manager, face_id, aface );
++  }
++
++
++  FT_EXPORT( FT_Error )
++  FTC_Manager_Lookup_Size( FTC_Manager  manager,
++                           FTC_Font     font,
++                           FT_Face     *aface,
++                           FT_Size     *asize )
++  {
++    FTC_ScalerRec  scaler;
++    FT_Error       error;
++    FT_Size        size;
++    FT_Face        face;
++
++
++    scaler.face_id = font->face_id;
++    scaler.width   = font->pix_width;
++    scaler.height  = font->pix_height;
++    scaler.pixel   = TRUE;
++    scaler.x_res   = 0;
++    scaler.y_res   = 0;
++
++    error = FTC_Manager_LookupSize( manager, &scaler, &size );
++    if ( error )
++    {
++      face = NULL;
++      size = NULL;
++    }
++    else
++      face = size->face;
++
++    if ( aface )
++      *aface = face;
++
++    if ( asize )
++      *asize = size;
++
++    return error;
++  }
++
++#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
++
++
+ /* END */
+--- freetype-2.8/ft2demos-2.8/graph/x11/grx11.c.orig	2016-10-19 06:55:23.000000000 +0200
++++ freetype-2.8/ft2demos-2.8/graph/x11/grx11.c	2018-06-07 16:41:52.626432650 +0200
+@@ -1404,8 +1404,8 @@ typedef  unsigned long   uint32;
+                                     RootWindow( display, screen ),
+                                     0,
+                                     0,
+-                                    (unsigned int)bitmap->width,
+-                                    (unsigned int)bitmap->rows,
++                                    bitmap->width,
++                                    bitmap->rows,
+                                     10,
+                                     format->x_depth,
+                                     InputOutput,
+--- freetype-2.8/src/base/ftbitmap.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/base/ftbitmap.c	2018-06-07 18:26:08.488060315 +0200
+@@ -90,7 +90,7 @@
+ 
+     if ( pitch < 0 )
+       pitch = -pitch;
+-    size = (FT_ULong)pitch * source->rows;
++    size = (FT_ULong)( pitch * source->rows );
+ 
+     if ( target->buffer )
+     {
+@@ -100,7 +100,7 @@
+ 
+       if ( target_pitch < 0 )
+         target_pitch = -target_pitch;
+-      target_size = (FT_ULong)target_pitch * target->rows;
++      target_size = (FT_ULong)( target_pitch * target->rows );
+ 
+       if ( target_size != size )
+         (void)FT_QREALLOC( target->buffer, target_size, size );
+@@ -156,7 +156,7 @@
+     int             pitch;
+     int             new_pitch;
+     FT_UInt         bpp;
+-    FT_UInt         i, width, height;
++    FT_Int          i, width, height;
+     unsigned char*  buffer = NULL;
+ 
+ 
+@@ -194,17 +194,17 @@
+     if ( ypixels == 0 && new_pitch <= pitch )
+     {
+       /* zero the padding */
+-      FT_UInt  bit_width = (FT_UInt)pitch * 8;
+-      FT_UInt  bit_last  = ( width + xpixels ) * bpp;
++      FT_Int  bit_width = pitch * 8;
++      FT_Int  bit_last  = ( width + xpixels ) * bpp;
+ 
+ 
+       if ( bit_last < bit_width )
+       {
+         FT_Byte*  line  = bitmap->buffer + ( bit_last >> 3 );
+         FT_Byte*  end   = bitmap->buffer + pitch;
+-        FT_UInt   shift = bit_last & 7;
++        FT_Int    shift = bit_last & 7;
+         FT_UInt   mask  = 0xFF00U >> shift;
+-        FT_UInt   count = height;
++        FT_Int    count = height;
+ 
+ 
+         for ( ; count > 0; count--, line += pitch, end += pitch )
+@@ -233,7 +233,7 @@
+     /* thus take care of the flow direction         */
+     if ( bitmap->pitch > 0 )
+     {
+-      FT_UInt  len = ( width * bpp + 7 ) >> 3;
++      FT_Int  len = ( width * bpp + 7 ) >> 3;
+ 
+ 
+       for ( i = 0; i < bitmap->rows; i++ )
+@@ -243,7 +243,7 @@
+     }
+     else
+     {
+-      FT_UInt  len = ( width * bpp + 7 ) >> 3;
++      FT_Int  len = ( width * bpp + 7 ) >> 3;
+ 
+ 
+       for ( i = 0; i < bitmap->rows; i++ )
+@@ -275,8 +275,7 @@
+   {
+     FT_Error        error;
+     unsigned char*  p;
+-    FT_Int          i, x, pitch;
+-    FT_UInt         y;
++    FT_Int          i, x, y, pitch;
+     FT_Int          xstr, ystr;
+ 
+ 
+@@ -420,8 +419,8 @@
+       p += bitmap->pitch;
+     }
+ 
+-    bitmap->width += (FT_UInt)xstr;
+-    bitmap->rows += (FT_UInt)ystr;
++    bitmap->width += xstr;
++    bitmap->rows += ystr;
+ 
+     return FT_Err_Ok;
+   }
+@@ -506,8 +505,8 @@
+     case FT_PIXEL_MODE_LCD_V:
+     case FT_PIXEL_MODE_BGRA:
+       {
+-        FT_Int    pad, old_target_pitch, target_pitch;
+-        FT_ULong  old_size;
++        FT_Int   pad, old_target_pitch, target_pitch;
++        FT_Long  old_size;
+ 
+ 
+         old_target_pitch = target->pitch;
+@@ -617,7 +616,7 @@
+     case FT_PIXEL_MODE_LCD:
+     case FT_PIXEL_MODE_LCD_V:
+       {
+-        FT_UInt  width = source->width;
++        FT_Int   width = source->width;
+         FT_UInt  i;
+ 
+ 
+--- freetype-2.8/src/pcf/pcfdrivr.c.orig	2018-06-07 11:42:57.757375204 +0200
++++ freetype-2.8/src/pcf/pcfdrivr.c	2018-06-07 16:59:25.832896549 +0200
+@@ -523,10 +523,10 @@ THE SOFTWARE.
+ 
+     metric = face->metrics + glyph_index;
+ 
+-    bitmap->rows       = (unsigned int)( metric->ascent +
+-                                         metric->descent );
+-    bitmap->width      = (unsigned int)( metric->rightSideBearing -
+-                                         metric->leftSideBearing );
++    bitmap->rows       = ( metric->ascent +
++                           metric->descent );
++    bitmap->width      = ( metric->rightSideBearing -
++                           metric->leftSideBearing );
+     bitmap->num_grays  = 1;
+     bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
+ 
+--- freetype-2.8/src/raster/ftraster.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/raster/ftraster.c	2018-06-07 18:07:14.977278387 +0200
+@@ -2479,7 +2479,7 @@
+       {
+         e1 = TRUNC( e1 );
+ 
+-        if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
++        if ( e1 >= 0 && e1 < ras.target.rows )
+         {
+           Byte   f1;
+           PByte  bits;
+@@ -2589,7 +2589,7 @@
+         /* bounding box instead                                           */
+         if ( pxl < 0 )
+           pxl = e1;
+-        else if ( (ULong)( TRUNC( pxl ) ) >= ras.target.rows )
++        else if ( ( TRUNC( pxl ) ) >= ras.target.rows )
+           pxl = e2;
+ 
+         /* check that the other pixel isn't set */
+@@ -2604,9 +2604,9 @@
+         if ( ras.target.pitch > 0 )
+           bits += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
+ 
+-        if ( e1 >= 0                     &&
+-             (ULong)e1 < ras.target.rows &&
+-             *bits & f1                  )
++        if ( e1 >= 0              &&
++             e1 < ras.target.rows &&
++             *bits & f1           )
+           goto Exit;
+       }
+       else
+@@ -2615,7 +2615,7 @@
+ 
+     e1 = TRUNC( pxl );
+ 
+-    if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
++    if ( e1 >= 0 && e1 < ras.target.rows )
+     {
+       FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+ 
+--- freetype-2.8/src/sfnt/pngshim.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/sfnt/pngshim.c	2018-06-07 18:08:07.825359421 +0200
+@@ -209,10 +209,10 @@
+     }
+ 
+     if ( !populate_map_and_metrics                            &&
+-         ( (FT_UInt)x_offset + metrics->width  > map->width ||
+-           (FT_UInt)y_offset + metrics->height > map->rows  ||
+-           pix_bits != 32                                   ||
+-           map->pixel_mode != FT_PIXEL_MODE_BGRA            ) )
++         ( x_offset + metrics->width  > map->width ||
++           y_offset + metrics->height > map->rows  ||
++           pix_bits != 32                          ||
++           map->pixel_mode != FT_PIXEL_MODE_BGRA   ) )
+     {
+       error = FT_THROW( Invalid_Argument );
+       goto Exit;
+@@ -270,7 +270,7 @@
+       map->num_grays  = 256;
+ 
+       /* reject too large bitmaps similarly to the rasterizer */
+-      if ( map->rows > 0x7FFF || map->width > 0x7FFF )
++      if ( map->rows > 0x4FFF || map->width > 0x4FFF )
+       {
+         error = FT_THROW( Array_Too_Large );
+         goto DestroyExit;
+@@ -346,7 +346,7 @@
+ 
+     if ( populate_map_and_metrics )
+     {
+-      /* this doesn't overflow: 0x7FFF * 0x7FFF * 4 < 2^32 */
++      /* this doesn't overflow: 0x4FFF * 0x4FFF * 4 < 2^31 */
+       FT_ULong  size = map->rows * (FT_ULong)map->pitch;
+ 
+ 
+--- freetype-2.8/src/sfnt/ttsbit.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/sfnt/ttsbit.c	2018-06-07 18:31:57.610612501 +0200
+@@ -705,7 +705,7 @@
+     FT_Error    error = FT_Err_Ok;
+     FT_Byte*    line;
+     FT_Int      pitch, width, height, line_bits, h;
+-    FT_UInt     bit_height, bit_width;
++    FT_Int      bit_height, bit_width;
+     FT_Bitmap*  bitmap;
+ 
+     FT_UNUSED( recurse_count );
+--- freetype-2.8/src/smooth/ftgrays.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/smooth/ftgrays.c	2018-06-07 17:01:09.008070697 +0200
+@@ -1880,7 +1880,7 @@ typedef ptrdiff_t  FT_PtrDist;
+         ras.target.origin = target_map->buffer;
+       else
+         ras.target.origin = target_map->buffer
+-              + ( target_map->rows - 1 ) * (unsigned int)target_map->pitch;
++              + (unsigned int) (( target_map->rows - 1 ) * target_map->pitch);
+ 
+       ras.target.pitch = target_map->pitch;
+ 
+--- freetype-2.8/src/smooth/ftsmooth.c.orig	2017-05-01 09:35:12.000000000 +0200
++++ freetype-2.8/src/smooth/ftsmooth.c	2018-06-07 17:01:51.040141641 +0200
+@@ -292,8 +292,8 @@
+ 
+     bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
+     bitmap->num_grays  = 256;
+-    bitmap->width      = (unsigned int)width;
+-    bitmap->rows       = (unsigned int)height;
++    bitmap->width      = width;
++    bitmap->rows       = height;
+     bitmap->pitch      = pitch;
+ 
+     /* translate outline to render it into the bitmap */
+--- freetype-2.8/src/winfonts/winfnt.c.orig	2017-03-30 12:20:23.000000000 +0200
++++ freetype-2.8/src/winfonts/winfnt.c	2018-06-07 18:21:47.809648016 +0200
+@@ -1038,7 +1038,7 @@
+ 
+     p = font->fnt_frame + offset;
+ 
+-    bitmap->width = FT_NEXT_USHORT_LE( p );
++    bitmap->width = FT_NEXT_SHORT_LE( p );
+ 
+     /* jump to glyph entry */
+     if ( new_format )
+@@ -1079,7 +1079,7 @@
+     /* allocate and build bitmap */
+     {
+       FT_Memory  memory = FT_FACE_MEMORY( slot->face );
+-      FT_UInt    pitch  = ( bitmap->width + 7 ) >> 3;
++      FT_Int     pitch  = ( bitmap->width + 7 ) >> 3;
+       FT_Byte*   column;
+       FT_Byte*   write;
+ 
diff --git a/SOURCES/freetype-2.8-avar-table-load.patch b/SOURCES/freetype-2.8-avar-table-load.patch
new file mode 100644
index 0000000..bd6416c
--- /dev/null
+++ b/SOURCES/freetype-2.8-avar-table-load.patch
@@ -0,0 +1,46 @@
+From 55bbb98f5c5a89230127d6b998a6e23e634b5d0e Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <behdad@behdad.org>
+Date: Tue, 1 Aug 2017 09:17:02 +0200
+Subject: [PATCH 077/132] [truetype] Fix loading of named instances.
+
+* src/truetype/ttgxvar.c (TT_Get_MM_Var): Preserve file position
+while loading the `avar' table.
+---
+ ChangeLog               |  7 +++++++
+ include/freetype/ftmm.h |  2 +-
+ src/truetype/ttgxvar.c  | 11 ++++++++++-
+ 3 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
+index 68458362e..df42b3bfd 100644
+--- a/src/truetype/ttgxvar.c
++++ b/src/truetype/ttgxvar.c
+@@ -2136,8 +2136,16 @@
+         goto Exit;
+ 
+       if ( fvar_head.instanceCount && !face->blend->avar_loaded )
++      {
++        FT_ULong  offset = FT_STREAM_POS();
++
++
+         ft_var_load_avar( face );
+ 
++        if ( FT_STREAM_SEEK( offset ) )
++          goto Exit;
++      }
++
+       ns  = mmvar->namedstyle;
+       nsc = face->blend->normalized_stylecoords;
+       for ( i = 0; i < fvar_head.instanceCount; i++, ns++ )
+@@ -2171,7 +2179,7 @@
+         SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
+ 
+         FT_Int   found, dummy1, dummy2;
+-        FT_UInt  strid = 0xFFFFFFFFUL;
++        FT_UInt  strid = ~0U;
+ 
+ 
+         /* the default instance is missing in array the   */
+-- 
+2.13.5
+
diff --git a/SOURCES/freetype-2.8-getvariation.patch b/SOURCES/freetype-2.8-getvariation.patch
new file mode 100644
index 0000000..7e0ecf9
--- /dev/null
+++ b/SOURCES/freetype-2.8-getvariation.patch
@@ -0,0 +1,39 @@
+From 29c759284e305ec428703c9a5831d0b1fc3497ef Mon Sep 17 00:00:00 2001
+From: Werner Lemberg <wl@gnu.org>
+Date: Sat, 27 Jan 2018 14:43:43 +0100
+Subject: [PATCH] * src/truetype/ttinterp.c (Ins_GETVARIATION): Avoid NULL
+ reference.
+
+Reported as
+
+  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5736
+---
+ src/truetype/ttinterp.c | 12 ++++++++++--
+ 1 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
+index d855aaaa9..551f14a2e 100644
+--- a/src/truetype/ttinterp.c
++++ b/src/truetype/ttinterp.c
+@@ -7470,8 +7470,16 @@
+       return;
+     }
+ 
+-    for ( i = 0; i < num_axes; i++ )
+-      args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */
++    if ( coords )
++    {
++      for ( i = 0; i < num_axes; i++ )
++        args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */
++    }
++    else
++    {
++      for ( i = 0; i < num_axes; i++ )
++        args[i] = 0;
++    }
+   }
+ 
+ 
+-- 
+2.14.3
+
diff --git a/SOURCES/freetype-2.8-loop-counter.patch b/SOURCES/freetype-2.8-loop-counter.patch
new file mode 100644
index 0000000..61e9052
--- /dev/null
+++ b/SOURCES/freetype-2.8-loop-counter.patch
@@ -0,0 +1,36 @@
+From 8d435c463d22f6de35015b244d6f9bb433beb7e6 Mon Sep 17 00:00:00 2001
+From: Werner Lemberg <wl@gnu.org>
+Date: Thu, 1 Jun 2017 07:09:44 +0200
+Subject: [PATCH] * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter
+ again.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Problem reported by Marek Kašík <mkasik@redhat.com>.
+
+The problematic font that exceeds the old limit is Padauk-Bold,
+version 3.002, containing bytecode generated by a buggy version of
+ttfautohint.
+---
+ ChangeLog               | 10 ++++++++++
+ src/truetype/ttinterp.c |  3 +--
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
+index 0c48c256..775d1104 100644
+--- a/src/truetype/ttinterp.c
++++ b/src/truetype/ttinterp.c
+@@ -7649,8 +7649,7 @@
+                                   FT_MAX( 50,
+                                           exc->cvtSize / 10 );
+     else
+-      exc->loopcall_counter_max = FT_MAX( 100,
+-                                          10 * exc->cvtSize );
++      exc->loopcall_counter_max = 300 + 8 * exc->cvtSize;
+ 
+     /* as a protection against an unreasonable number of CVT entries  */
+     /* we assume at most 100 control values per glyph for the counter */
+-- 
+2.13.0
+
diff --git a/SOURCES/freetype-2.8-pcf-encoding.patch b/SOURCES/freetype-2.8-pcf-encoding.patch
new file mode 100644
index 0000000..fd1c706
--- /dev/null
+++ b/SOURCES/freetype-2.8-pcf-encoding.patch
@@ -0,0 +1,58 @@
+From 082f2faf5007812bac6a1f783c7dcc6f49d761fe Mon Sep 17 00:00:00 2001
+From: Werner Lemberg <wl@gnu.org>
+Date: Wed, 24 May 2017 07:40:46 +0200
+Subject: [PATCH] [bdf, pcf] Support ISO646.1991-IRV character encoding (aka
+ ASCII).
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Problem reported by Marek Kašík <mkasik@redhat.com>, cf.
+
+  https://bugzilla.redhat.com/show_bug.cgi?id=1451795
+
+* src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdrivr.c
+(PCF_Face_Init): Implement it.
+---
+ ChangeLog          | 11 +++++++++++
+ src/bdf/bdfdrivr.c |  6 +++++-
+ src/pcf/pcfdrivr.c |  6 +++++-
+ 3 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
+index a2242be0..c0a5a5c5 100644
+--- a/src/bdf/bdfdrivr.c
++++ b/src/bdf/bdfdrivr.c
+@@ -545,7 +545,11 @@ THE SOFTWARE.
+               if ( !ft_strcmp( s, "10646" )                      ||
+                    ( !ft_strcmp( s, "8859" ) &&
+                      !ft_strcmp( face->charset_encoding, "1" ) ) )
+-              unicode_charmap = 1;
++                unicode_charmap = 1;
++              /* another name for ASCII */
++              else if ( !ft_strcmp( s, "646.1991" )                 &&
++                        !ft_strcmp( face->charset_encoding, "IRV" ) )
++                unicode_charmap = 1;
+             }
+ 
+             {
+diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
+index 9f4d36d1..50530941 100644
+--- a/src/pcf/pcfdrivr.c
++++ b/src/pcf/pcfdrivr.c
+@@ -387,7 +387,11 @@ THE SOFTWARE.
+           if ( !ft_strcmp( s, "10646" )                      ||
+                ( !ft_strcmp( s, "8859" ) &&
+                  !ft_strcmp( face->charset_encoding, "1" ) ) )
+-          unicode_charmap = 1;
++            unicode_charmap = 1;
++          /* another name for ASCII */
++          else if ( !ft_strcmp( s, "646.1991" )                 &&
++                    !ft_strcmp( face->charset_encoding, "IRV" ) )
++            unicode_charmap = 1;
+         }
+       }
+ 
+-- 
+2.13.0
+
diff --git a/SOURCES/freetype-multilib.patch b/SOURCES/freetype-multilib.patch
index f369adb..4f40a80 100644
--- a/SOURCES/freetype-multilib.patch
+++ b/SOURCES/freetype-multilib.patch
@@ -1,18 +1,65 @@
---- freetype-2.2.1/builds/unix/freetype-config.in.multilib	2006-07-27 18:50:40.000000000 -0400
-+++ freetype-2.2.1/builds/unix/freetype-config.in	2006-07-27 18:58:13.000000000 -0400
-@@ -9,11 +9,11 @@
- # indicate that you have read the license and understand and accept it
- # fully.
+--- freetype-2.8/builds/unix/freetype-config.in
++++ freetype-2.8/builds/unix/freetype-config.in
+@@ -13,45 +13,25 @@ LC_ALL=C
+ export LC_ALL
+ 
+ 
+-# if `pkg-config' is available, use values from `freetype2.pc'
+-pkg-config --version >/dev/null 2>&1
+-if test $? -eq 0 ; then
+-  # note that option `--variable' is not affected by the
+-  # PKG_CONFIG_SYSROOT_DIR environment variable
+-  if test "x$SYSROOT" != "x" ; then
+-    PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
+-    export PKG_CONFIG_SYSROOT_DIR
+-  fi
+-
+-  prefix=`pkg-config --variable prefix freetype2`
+-  exec_prefix=`pkg-config --variable exec_prefix freetype2`
+-
+-  includedir=`pkg-config --variable includedir freetype2`
+-  libdir=`pkg-config --variable libdir freetype2`
+-
+-  version=`pkg-config --modversion freetype2`
+-
+-  cflags=`pkg-config --cflags freetype2`
+-  dynamic_libs=`pkg-config --libs freetype2`
+-  static_libs=`pkg-config --static --libs freetype2`
+-else
+-  prefix="%prefix%"
+-  exec_prefix="%exec_prefix%"
+-
+-  includedir="%includedir%"
+-  libdir="%libdir%"
+-
+-  version=%ft_version%
+-
+-  cflags="-I${SYSROOT}$includedir/freetype2"
+-  dynamic_libs="-lfreetype"
+-  static_libs="%LIBSSTATIC_CONFIG%"
+-  if test "${SYSROOT}$libdir" != "/usr/lib"   &&
+-     test "${SYSROOT}$libdir" != "/usr/lib64" ; then
+-    libs_L="-L${SYSROOT}$libdir"
+-  fi
++# note that option `--variable' is not affected by the
++# PKG_CONFIG_SYSROOT_DIR environment variable
++if test "x$SYSROOT" != "x" ; then
++  PKG_CONFIG_SYSROOT_DIR="$SYSROOT"
++  export PKG_CONFIG_SYSROOT_DIR
+ fi
  
--prefix=@prefix@
--exec_prefix=@exec_prefix@
 +prefix=`pkg-config --variable prefix freetype2`
 +exec_prefix=`pkg-config --variable exec_prefix freetype2`
- exec_prefix_set=no
--includedir=@includedir@
--libdir=@libdir@
++
 +includedir=`pkg-config --variable includedir freetype2`
 +libdir=`pkg-config --variable libdir freetype2`
- enable_shared=@build_libtool_libs@
- wl=@wl@
- hardcode_libdir_flag_spec='@hardcode_libdir_flag_spec@'
++
++version=`pkg-config --modversion freetype2`
++
++cflags=`pkg-config --cflags freetype2`
++dynamic_libs=`pkg-config --libs freetype2`
++static_libs=`pkg-config --static --libs freetype2`
++
+ orig_prefix=$prefix
+ orig_exec_prefix=$exec_prefix
+ 
diff --git a/SPECS/freetype.spec b/SPECS/freetype.spec
index c98aa1b..c7e62a0 100644
--- a/SPECS/freetype.spec
+++ b/SPECS/freetype.spec
@@ -6,8 +6,8 @@
 
 Summary: A free and portable font rendering engine
 Name: freetype
-Version: 2.4.11
-Release: 15%{?dist}
+Version: 2.8
+Release: 12%{?dist}
 License: (FTL or GPLv2+) and BSD and MIT and Public Domain and zlib with acknowledgement
 Group: System Environment/Libraries
 URL: http://www.freetype.org
@@ -16,54 +16,40 @@ Source1: http://download.savannah.gnu.org/releases/freetype/freetype-doc-%{versi
 Source2: http://download.savannah.gnu.org/releases/freetype/ft2demos-%{version}.tar.bz2
 Source3: ftconfig.h
 
-Patch21:  freetype-2.3.0-enable-spr.patch
+Patch0:  freetype-2.3.0-enable-spr.patch
 
 # Enable otvalid and gxvalid modules
-Patch46:  freetype-2.2.1-enable-valid.patch
+Patch1:  freetype-2.2.1-enable-valid.patch
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=1197740
+Patch2:  freetype-2.4.11-inode-overflow.patch
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=1381678
+Patch3:  freetype-2.4.11-signed.patch
+
 # Enable additional demos
-Patch47:  freetype-2.3.11-more-demos.patch
+Patch4:  freetype-2.3.11-more-demos.patch
 
-# Fix multilib conflicts
-Patch88:  freetype-multilib.patch
+Patch5:  freetype-2.4.11-libtool.patch
 
-# https://bugzilla.redhat.com/show_bug.cgi?id=891457
-Patch89:  freetype-2.4.11-fix-emboldening.patch
+Patch6:  freetype-2.8-pcf-encoding.patch
 
-# https://bugzilla.redhat.com/show_bug.cgi?id=1010341
-Patch90:  0001-Fix-vertical-size-of-emboldened-glyphs.patch
+Patch7:  freetype-2.8-loop-counter.patch
 
-# https://bugzilla.redhat.com/show_bug.cgi?id=1197740
-Patch91:  freetype-2.4.11-CVE-2014-9657.patch
-Patch92:  freetype-2.4.11-CVE-2014-9658.patch
-Patch93:  freetype-2.4.11-ft-strncmp.patch
-Patch94:  freetype-2.4.11-CVE-2014-9675.patch
-Patch95:  freetype-2.4.11-CVE-2014-9660.patch
-Patch96:  freetype-2.4.11-CVE-2014-9661a.patch
-Patch97:  freetype-2.4.11-CVE-2014-9661b.patch
-Patch98:  freetype-2.4.11-CVE-2014-9663.patch
-Patch99:  freetype-2.4.11-CVE-2014-9664a.patch
-Patch100:  freetype-2.4.11-CVE-2014-9664b.patch
-Patch101:  freetype-2.4.11-CVE-2014-9667.patch
-Patch102:  freetype-2.4.11-CVE-2014-9669.patch
-Patch103:  freetype-2.4.11-CVE-2014-9670.patch
-Patch104:  freetype-2.4.11-CVE-2014-9671.patch
-Patch105:  freetype-2.4.11-CVE-2014-9673.patch
-Patch106:  freetype-2.4.11-CVE-2014-9674a.patch
-Patch107:  freetype-2.4.11-unsigned-long.patch
-Patch108:  freetype-2.4.11-CVE-2014-9674b.patch
-Patch109:  freetype-2.4.11-pcf-read-a.patch
-Patch110:  freetype-2.4.11-pcf-read-b.patch
-Patch111:  freetype-2.4.11-inode-overflow.patch
-
-# https://bugzilla.redhat.com/show_bug.cgi?id=1368141
-Patch112:  freetype-2.4.11-libtool.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=1497443
+Patch8:  freetype-multilib.patch
 
-# https://bugzilla.redhat.com/show_bug.cgi?id=1381678
-Patch113:  freetype-2.4.11-signed.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=1544775
+Patch9:  freetype-2.8-getvariation.patch
 
-Buildroot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
+# https://bugzilla.redhat.com/show_bug.cgi?id=1576504
+Patch10:  freetype-2.8-2.4.11-API.patch
+Patch11:  freetype-2.8-avar-table-load.patch
 
 BuildRequires: libX11-devel
+BuildRequires: libpng-devel
+BuildRequires: zlib-devel
+BuildRequires: bzip2-devel
 
 Provides: %{name}-bytecode
 %if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
@@ -95,8 +81,7 @@ small utilities showing various capabilities of the FreeType library.
 Summary: FreeType development libraries and header files
 Group: Development/Libraries
 Requires: %{name} = %{version}-%{release}
-Requires: zlib-devel
-Requires: pkgconfig
+Requires: pkgconfig%{?_isa}
 
 %description devel
 The freetype-devel package includes the static libraries and header files
@@ -110,46 +95,34 @@ FreeType.
 %setup -q -b 1 -a 2
 
 %if %{?_with_subpixel_rendering:1}%{!?_with_subpixel_rendering:0}
-%patch21  -p1 -b .enable-spr
+%patch0  -p1 -b .enable-spr
 %endif
 
-%patch46  -p1 -b .enable-valid
+%patch1  -p1 -b .enable-valid
+%patch2  -p1 -b .inode-overflow
+%patch3  -p1 -b .signed
 
 pushd ft2demos-%{version}
-%patch47  -p1 -b .more-demos
+%patch4  -p1 -b .more-demos
 popd
 
-%patch88 -p1 -b .multilib
-%patch89 -p1 -b .emboldening
-%patch90 -p1 -b .emboldened-glyphs
-
-%patch91 -p1 -b .CVE-2014-9657
-%patch92 -p1 -b .CVE-2014-9658
-%patch93 -p1 -b .ft-strncmp
-%patch94 -p1 -b .CVE-2014-9675
-%patch95 -p1 -b .CVE-2014-9660
-%patch96 -p1 -b .CVE-2014-9661a
-%patch97 -p1 -b .CVE-2014-9661b
-%patch98 -p1 -b .CVE-2014-9663
-%patch99 -p1 -b .CVE-2014-9664a
-%patch100 -p1 -b .CVE-2014-9664b
-%patch101 -p1 -b .CVE-2014-9667
-%patch102 -p1 -b .CVE-2014-9669
-%patch103 -p1 -b .CVE-2014-9670
-%patch104 -p1 -b .CVE-2014-9671
-%patch105 -p1 -b .CVE-2014-9673
-%patch106 -p1 -b .CVE-2014-9674a
-%patch107 -p1 -b .unsigned-long
-%patch108 -p1 -b .CVE-2014-9674b
-%patch109 -p1 -b .pcf-read-a
-%patch110 -p1 -b .pcf-read-b
-%patch111 -p1 -b .inode-overflow
-%patch112 -p1 -b .libtool
-%patch113 -p1 -b .signed
+%patch5 -p1 -b .libtool
+%patch6 -p1 -b .pcf-encoding
+%patch7 -p1 -b .loop-counter
+%patch8 -p1 -b .multilib
+%patch9 -p1 -b .getvariation
+%patch10 -p1 -b .2.4.11-api
+%patch11 -p1 -b .avar-table-load
 
 %build
 
-%configure --disable-static CFLAGS="%optflags -D_FILE_OFFSET_BITS=64"
+%configure --disable-static \
+           --with-zlib=yes \
+           --with-bzip2=yes \
+           --with-png=yes \
+           --with-harfbuzz=no \
+           CFLAGS="%optflags -D_FILE_OFFSET_BITS=64"
+
 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' builds/unix/libtool
 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' builds/unix/libtool
 make %{?_smp_mflags}
@@ -174,10 +147,8 @@ popd
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
-
 
-%makeinstall gnulocaledir=$RPM_BUILD_ROOT%{_datadir}/locale
+%make_install gnulocaledir=$RPM_BUILD_ROOT%{_datadir}/locale
 
 {
   for ftdemo in ftbench ftchkwd ftmemchk ftpatchk fttimer ftdump ftlint ftmemchk ftvalid ; do
@@ -202,8 +173,6 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_includedir}/freetype2/freetype/co
 # Don't package static a or .la files
 rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
 
-%clean
-rm -rf $RPM_BUILD_ROOT
 
 %triggerpostun -- freetype < 2.0.5-3
 {
@@ -220,14 +189,12 @@ rm -rf $RPM_BUILD_ROOT
 %postun -p /sbin/ldconfig
 
 %files
-%defattr(-,root,root)
+%{!?_licensedir:%global license %%doc}
+%license docs/LICENSE.TXT docs/FTL.TXT docs/GPLv2.TXT
 %{_libdir}/libfreetype.so.*
 %doc README
-%doc docs/LICENSE.TXT docs/FTL.TXT docs/GPLv2.TXT
-%doc docs/CHANGES docs/VERSION.DLL docs/formats.txt docs/ft2faq.html
 
 %files demos
-%defattr(-,root,root)
 %{_bindir}/ftbench
 %{_bindir}/ftchkwd
 %{_bindir}/ftmemchk
@@ -235,7 +202,6 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/fttimer
 %{_bindir}/ftdump
 %{_bindir}/ftlint
-%{_bindir}/ftmemchk
 %{_bindir}/ftvalid
 %if %{with_xfree86}
 %{_bindir}/ftdiff
@@ -243,17 +209,15 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/ftgrid
 %{_bindir}/ftmulti
 %{_bindir}/ftstring
-%{_bindir}/fttimer
 %{_bindir}/ftview
 %endif
 %doc ChangeLog README
 
 %files devel
-%defattr(-,root,root)
+%doc docs/CHANGES docs/formats.txt docs/ft2faq.html
 %dir %{_includedir}/freetype2
 %{_datadir}/aclocal/freetype2.m4
 %{_includedir}/freetype2/*
-%{_includedir}/*.h
 %{_libdir}/libfreetype.so
 %{_bindir}/freetype-config
 %{_libdir}/pkgconfig/freetype2.pc
@@ -261,8 +225,21 @@ rm -rf $RPM_BUILD_ROOT
 %doc docs/glyphs
 %doc docs/reference
 %doc docs/tutorial
+%{_mandir}/man1/*
 
 %changelog
+* Fri Jun 08 2018 Marek Kasik <mkasik@redhat.com> - 2.8-12
+- Fix loading of avar tables
+- Resolves: #1576504
+
+* Thu Jun 07 2018 Marek Kasik <mkasik@redhat.com> - 2.8-11
+- Preserve API/ABI compatibility for public symbols
+- Resolves: #1576504
+
+* Wed Jun 06 2018 Richard Hughes <rhughes@redhat.com> - 2.8-10
+- Update to 2.8
+- Resolves: #1576504
+
 * Mon Feb 20 2017 Marek Kasik <mkasik@redhat.com> - 2.4.11-15
 - Fix shellcheck warning (coverity)
 - Related: #1368141