From 35c1974ef6a86f3b30c265aeafe3dfc6e81a0d73 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 15 Feb 2018 21:40:23 +0000
Subject: freetype2: update to 2.9

---
 .../0001-Enable-table-validation-modules.patch     | 28 ++++++--
 ...saux-Correctly-handle-Flex-features-52846.patch | 38 ++++++++++
 .../0002-Enable-infinality-subpixel-hinting.patch  | 30 ++++++++
 .../freetype2/0002-Enable-subpixel-rendering.patch | 25 -------
 .../0003-Enable-infinality-subpixel-hinting.patch  | 27 --------
 .../0003-Enable-long-PCF-family-names.patch        | 28 ++++++++
 abs/core/freetype2/PKGBUILD                        | 81 ++++++++++++----------
 7 files changed, 164 insertions(+), 93 deletions(-)
 create mode 100644 abs/core/freetype2/0001-psaux-Correctly-handle-Flex-features-52846.patch
 create mode 100644 abs/core/freetype2/0002-Enable-infinality-subpixel-hinting.patch
 delete mode 100644 abs/core/freetype2/0002-Enable-subpixel-rendering.patch
 delete mode 100644 abs/core/freetype2/0003-Enable-infinality-subpixel-hinting.patch
 create mode 100644 abs/core/freetype2/0003-Enable-long-PCF-family-names.patch

diff --git a/abs/core/freetype2/0001-Enable-table-validation-modules.patch b/abs/core/freetype2/0001-Enable-table-validation-modules.patch
index 3e9451f..5fd339f 100644
--- a/abs/core/freetype2/0001-Enable-table-validation-modules.patch
+++ b/abs/core/freetype2/0001-Enable-table-validation-modules.patch
@@ -1,17 +1,18 @@
-From c3680bf8d38cf759c1e33dcc2d2d51e0a4fea2f9 Mon Sep 17 00:00:00 2001
+From c7a6a2312313a971089fb592deb8c476be4dca0f Mon Sep 17 00:00:00 2001
+Message-Id: <c7a6a2312313a971089fb592deb8c476be4dca0f.1513462508.git.jan.steffens@gmail.com>
 From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
 Date: Tue, 23 Jun 2015 08:40:29 +0200
-Subject: [PATCH 1/3] Enable table validation modules
+Subject: [PATCH 1/4] Enable table validation modules
 
 ---
  modules.cfg | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/modules.cfg b/modules.cfg
-index f30049c38cc45159..7b8e50fe1b34584a 100644
+index 56a2340e56d187aa..3a028329187275df 100644
 --- a/modules.cfg
 +++ b/modules.cfg
-@@ -120,7 +120,7 @@ AUX_MODULES += cache
+@@ -120,30 +120,30 @@ AUX_MODULES += cache
  # TrueType GX/AAT table validation.  Needs ftgxval.c below.
  #
  # No FT_CONFIG_OPTION_PIC support.
@@ -20,7 +21,22 @@ index f30049c38cc45159..7b8e50fe1b34584a 100644
  
  # Support for streams compressed with gzip (files with suffix .gz).
  #
-@@ -143,7 +143,7 @@ AUX_MODULES += bzip2
+ # See include/freetype/ftgzip.h for the API.
+ # No FT_CONFIG_OPTION_PIC support.
+ AUX_MODULES += gzip
+ 
+ # Support for streams compressed with LZW (files with suffix .Z).
+ #
+ # See include/freetype/ftlzw.h for the API.
+ # No FT_CONFIG_OPTION_PIC support.
+ AUX_MODULES += lzw
+ 
+ # Support for streams compressed with bzip2 (files with suffix .bz2).
+ #
+ # See include/freetype/ftbzip2.h for the API.
+ # No FT_CONFIG_OPTION_PIC support.
+ AUX_MODULES += bzip2
+ 
  # OpenType table validation.  Needs ftotval.c below.
  #
  # No FT_CONFIG_OPTION_PIC support.
@@ -30,5 +46,5 @@ index f30049c38cc45159..7b8e50fe1b34584a 100644
  # Auxiliary PostScript driver component to share common code.
  #
 -- 
-2.9.3
+2.15.1
 
diff --git a/abs/core/freetype2/0001-psaux-Correctly-handle-Flex-features-52846.patch b/abs/core/freetype2/0001-psaux-Correctly-handle-Flex-features-52846.patch
new file mode 100644
index 0000000..44630fb
--- /dev/null
+++ b/abs/core/freetype2/0001-psaux-Correctly-handle-Flex-features-52846.patch
@@ -0,0 +1,38 @@
+From cc2f3cdecff5a351e7e8961b9f2e389ab740231a Mon Sep 17 00:00:00 2001
+From: Ewald Hew <ewaldhew@gmail.com>
+Date: Wed, 10 Jan 2018 13:24:56 +0800
+Subject: [PATCH] [psaux] Correctly handle Flex features (#52846).
+
+* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO,
+cf2_cmdHMOVETO>: Do not move if doing Flex.
+---
+ src/psaux/psintrp.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
+index 5c0ee78..da5a8da 100644
+--- a/src/psaux/psintrp.c
++++ b/src/psaux/psintrp.c
+@@ -852,7 +852,8 @@
+ 
+         curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
+ 
+-        cf2_glyphpath_moveTo( &glyphPath, curX, curY );
++        if ( !decoder->flex_state )
++          cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+ 
+         break;
+ 
+@@ -2674,7 +2675,8 @@
+ 
+         curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
+ 
+-        cf2_glyphpath_moveTo( &glyphPath, curX, curY );
++        if ( !decoder->flex_state )
++          cf2_glyphpath_moveTo( &glyphPath, curX, curY );
+ 
+         break;
+ 
+-- 
+2.16.1
+
diff --git a/abs/core/freetype2/0002-Enable-infinality-subpixel-hinting.patch b/abs/core/freetype2/0002-Enable-infinality-subpixel-hinting.patch
new file mode 100644
index 0000000..5f43915
--- /dev/null
+++ b/abs/core/freetype2/0002-Enable-infinality-subpixel-hinting.patch
@@ -0,0 +1,30 @@
+From 438b8c65e900d4c28db9eeb2a45e5998048eb471 Mon Sep 17 00:00:00 2001
+Message-Id: <438b8c65e900d4c28db9eeb2a45e5998048eb471.1513462508.git.jan.steffens@gmail.com>
+In-Reply-To: <c7a6a2312313a971089fb592deb8c476be4dca0f.1513462508.git.jan.steffens@gmail.com>
+References: <c7a6a2312313a971089fb592deb8c476be4dca0f.1513462508.git.jan.steffens@gmail.com>
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Mon, 29 Aug 2016 08:43:10 +0200
+Subject: [PATCH 2/4] Enable infinality subpixel hinting
+
+---
+ include/freetype/config/ftoption.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
+index 06f3d50bb02fb5ac..e6f9720df9b5d004 100644
+--- a/include/freetype/config/ftoption.h
++++ b/include/freetype/config/ftoption.h
+@@ -654,8 +654,8 @@ FT_BEGIN_HEADER
+   /* [1] https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
+   /*                                                                       */
+ /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING  1         */
+-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING  2
+-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING  ( 1 | 2 ) */
++/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING  2         */
++#define TT_CONFIG_OPTION_SUBPIXEL_HINTING     ( 1 | 2 )
+ 
+ 
+   /*************************************************************************/
+-- 
+2.15.1
+
diff --git a/abs/core/freetype2/0002-Enable-subpixel-rendering.patch b/abs/core/freetype2/0002-Enable-subpixel-rendering.patch
deleted file mode 100644
index dfb5796..0000000
--- a/abs/core/freetype2/0002-Enable-subpixel-rendering.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 96f09f08417887b2618c177bccfb6da2906568d9 Mon Sep 17 00:00:00 2001
-From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
-Date: Tue, 23 Jun 2015 08:43:07 +0200
-Subject: [PATCH 2/3] Enable subpixel rendering
-
----
- include/freetype/config/ftoption.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
-index 90c123ef93e9ea04..67a361dd41e0b026 100644
---- a/include/freetype/config/ftoption.h
-+++ b/include/freetype/config/ftoption.h
-@@ -122,7 +122,7 @@ FT_BEGIN_HEADER
-   /* This is done to allow FreeType clients to run unmodified, forcing     */
-   /* them to display normal gray-level anti-aliased glyphs.                */
-   /*                                                                       */
--/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- 
- 
-   /*************************************************************************/
--- 
-2.9.3
-
diff --git a/abs/core/freetype2/0003-Enable-infinality-subpixel-hinting.patch b/abs/core/freetype2/0003-Enable-infinality-subpixel-hinting.patch
deleted file mode 100644
index bbfa2a2..0000000
--- a/abs/core/freetype2/0003-Enable-infinality-subpixel-hinting.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 220e96a9a8d7aff6ad0f0f1aa12c79cdb563331c Mon Sep 17 00:00:00 2001
-From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
-Date: Mon, 29 Aug 2016 08:43:10 +0200
-Subject: [PATCH 3/3] Enable infinality subpixel hinting
-
----
- include/freetype/config/ftoption.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
-index 67a361dd41e0b026..c4812862518b66a6 100644
---- a/include/freetype/config/ftoption.h
-+++ b/include/freetype/config/ftoption.h
-@@ -675,8 +675,8 @@ FT_BEGIN_HEADER
-   /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */
-   /*                                                                       */
- /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING  1         */
--#define TT_CONFIG_OPTION_SUBPIXEL_HINTING  2
--/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING  ( 1 | 2 ) */
-+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING  2         */
-+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING     ( 1 | 2 )
- 
- 
-   /*************************************************************************/
--- 
-2.9.3
-
diff --git a/abs/core/freetype2/0003-Enable-long-PCF-family-names.patch b/abs/core/freetype2/0003-Enable-long-PCF-family-names.patch
new file mode 100644
index 0000000..be202c1
--- /dev/null
+++ b/abs/core/freetype2/0003-Enable-long-PCF-family-names.patch
@@ -0,0 +1,28 @@
+From 7e262bff01573c67432f8b8fd879bf858e1611b3 Mon Sep 17 00:00:00 2001
+Message-Id: <7e262bff01573c67432f8b8fd879bf858e1611b3.1513462508.git.jan.steffens@gmail.com>
+In-Reply-To: <c7a6a2312313a971089fb592deb8c476be4dca0f.1513462508.git.jan.steffens@gmail.com>
+References: <c7a6a2312313a971089fb592deb8c476be4dca0f.1513462508.git.jan.steffens@gmail.com>
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Sun, 14 May 2017 18:09:31 +0200
+Subject: [PATCH 3/4] Enable long PCF family names
+
+---
+ include/freetype/config/ftoption.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
+index e6f9720df9b5d004..832c9c3cd200f91a 100644
+--- a/include/freetype/config/ftoption.h
++++ b/include/freetype/config/ftoption.h
+@@ -845,7 +845,7 @@ FT_BEGIN_HEADER
+   /* If this option is activated, it can be controlled with the            */
+   /* `no-long-family-names' property of the pcf driver module.             */
+   /*                                                                       */
+-/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
++#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
+ 
+ 
+   /*************************************************************************/
+-- 
+2.15.1
+
diff --git a/abs/core/freetype2/PKGBUILD b/abs/core/freetype2/PKGBUILD
index 80f5160..251ac74 100644
--- a/abs/core/freetype2/PKGBUILD
+++ b/abs/core/freetype2/PKGBUILD
@@ -2,32 +2,36 @@
 # Maintainer: Jan de Groot <jgc@archlinux.org>
 
 pkgbase=freetype2
-pkgname=('freetype2' 'freetype2-demos')
-pkgver=2.7.1
-pkgrel=1
-arch=(i686 x86_64)
+pkgname=('freetype2' 'freetype2-demos' 'freetype2-docs')
+pkgver=2.9
+pkgrel=2
+pkgdesc="Font rasterization library"
+arch=(x86_64)
 license=('GPL')
-url="http://www.freetype.org/"
+url="https://www.freetype.org/"
 # adding harfbuzz for improved OpenType features auto-hinting
 # introduces a cycle dep to harfbuzz depending on freetype wanted by upstream
-makedepends=('libx11' 'zlib' 'bzip2' 'sh' 'libpng' 'harfbuzz')
-source=(https://download.savannah.gnu.org/releases/freetype/freetype-${pkgver}.tar.bz2{,.sig}
-        https://download.savannah.gnu.org/releases/freetype/freetype-doc-${pkgver}.tar.bz2{,.sig}
-        https://download.savannah.gnu.org/releases/freetype/ft2demos-${pkgver}.tar.bz2{,.sig}
+depends=('zlib' 'bzip2' 'sh' 'libpng' 'harfbuzz')
+makedepends=('libx11')
+source=(https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${pkgver}.tar.bz2{,.sig}
+        https://download-mirror.savannah.gnu.org/releases/freetype/freetype-doc-${pkgver}.tar.bz2{,.sig}
+        https://download-mirror.savannah.gnu.org/releases/freetype/ft2demos-${pkgver}.tar.bz2{,.sig}
         0001-Enable-table-validation-modules.patch
-        0002-Enable-subpixel-rendering.patch
-        0003-Enable-infinality-subpixel-hinting.patch
+        0002-Enable-infinality-subpixel-hinting.patch
+        0003-Enable-long-PCF-family-names.patch
+        0001-psaux-Correctly-handle-Flex-features-52846.patch
         0005-freetype-2.5.2-more-demos.patch
         freetype2.sh)
-sha1sums=('4d08a9a6567c6332d58e9a5f9a7e9e3fbce66789'
+sha1sums=('94c4399b1a55c5892812e732843fcb4a7c2fe657'
           'SKIP'
-          'd8ce472cd775b8ce50d127689acab59181e72ecf'
+          '63e171aa5b2c46e7bece3ae7781015380d012e1f'
           'SKIP'
-          '2ebe93df13eb45dac8515c5ed0216ef694c33f18'
+          'bd8a5d17274f987284e6f934722fb7715d00892e'
           'SKIP'
-          'b31882ef5e8447e761acee1c4a44c0630cd4d465'
-          'b1494810ed3aca25cdd8e8cedf634e5adfe6c09e'
-          '41d27140fd590945e22e012c9dce62de3d6f11e6'
+          'b69531770c343d403be294b7e4d25ac45738c833'
+          '3d26a569f0cb94c28a550577f5dcaadb4e193d91'
+          '770f1981734a837bcf065564c91644b4cc5e256a'
+          '21ad7dd31e16adb5b39adfa5671018a736626562'
           '72cfecbe738085eec475e012617661ad0cc9b76f'
           'bc6df1661c4c33e20f5ce30c2da8ad3c2083665f')
 validpgpkeys=('58E0C111E39F5408C5D3EC76C1A60EACE707FDA5')
@@ -35,13 +39,18 @@ validpgpkeys=('58E0C111E39F5408C5D3EC76C1A60EACE707FDA5')
 prepare() {
   # Rename source dir to allow building the demos
   mv freetype-${pkgver} freetype2
+  mv ft2demos-${pkgver} freetype2-demos
 
   cd freetype2
   patch -Np1 -i ../0001-Enable-table-validation-modules.patch
-  patch -Np1 -i ../0002-Enable-subpixel-rendering.patch
-  patch -Np1 -i ../0003-Enable-infinality-subpixel-hinting.patch
+  patch -Np1 -i ../0002-Enable-infinality-subpixel-hinting.patch
+  patch -Np1 -i ../0003-Enable-long-PCF-family-names.patch
 
-  cd ../ft2demos-${pkgver}
+  # Freetype 2.9 regression: bad rendering for some Type 1 fonts
+  # https://savannah.nongnu.org/bugs/?52846
+  patch -Np1 -i ../0001-psaux-Correctly-handle-Flex-features-52846.patch
+
+  cd ../freetype2-demos
   # enable more demos
   patch -Np1 -i ../0005-freetype-2.5.2-more-demos.patch
 
@@ -55,7 +64,7 @@ build() {
   make
 
   # Build demos
-  cd ../ft2demos-${pkgver}
+  cd ../freetype2-demos
   make
 }
 
@@ -65,31 +74,33 @@ check() {
 }
 
 package_freetype2() {
-  pkgdesc="TrueType font rendering library"
-  depends=('zlib' 'bzip2' 'sh' 'libpng' 'harfbuzz')
   provides=('libfreetype.so')
   install=freetype2.install
   backup=('etc/profile.d/freetype2.sh')
 
   cd freetype2
   make DESTDIR="${pkgdir}" install
-  install -Dm644 ../freetype2.sh "${pkgdir}/etc/profile.d/freetype2.sh"
+  install -Dt "${pkgdir}/etc/profile.d" -m644 ../freetype2.sh
+}
 
-  # Package docs
-  install -dm755 "${pkgdir}/usr/share/doc"
-  cp -a docs "${pkgdir}/usr/share/doc/${pkgname}"
+package_freetype2-demos() {
+  pkgdesc="Freetype tools and demos"
+  depends=('freetype2' 'libx11')
 
-  cd ../ft2demos-${pkgver}
-  mkdir -p $srcdir/ft-demos
+  cd freetype2-demos
+  install -d "${pkgdir}/usr/bin"
   for _i in bin/{f,t}t*; do
-    libtool --mode=install install $_i "$srcdir/ft-demos"
+    libtool --mode=install install $_i "${pkgdir}/usr/bin"
   done
 }
 
-package_freetype2-demos() {
-  pkgdesc="Freetype tools and demos"
-  depends=('freetype2' 'libx11')
+package_freetype2-docs() {
+  pkgdesc="Freetype documentation"
+  depends=('freetype2')
 
-  install -dm755 "${pkgdir}/usr/bin"
-  cp -a $srcdir/ft-demos/* "${pkgdir}/usr/bin"
+  cd freetype2
+  install -d "${pkgdir}/usr/share/doc"
+  cp -a docs "${pkgdir}/usr/share/doc/freetype2"
 }
+
+# vim:set ts=2 sw=2 et:
-- 
cgit v0.12

