ae68a7
--- freetype-2.8/builds/unix/unix-cc.in.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/builds/unix/unix-cc.in	2018-06-07 19:16:35.881770695 +0200
ae68a7
@@ -109,6 +109,6 @@ CCexe        := $(CCraw_build)	# used to
ae68a7
 LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
ae68a7
                           -rpath $(libdir) -version-info $(version_info) \
ae68a7
                           $(LDFLAGS) -no-undefined \
ae68a7
-                          -export-symbols $(EXPORTS_LIST)
ae68a7
+                          # -export-symbols $(EXPORTS_LIST)
ae68a7
 
ae68a7
 # EOF
ae68a7
--- freetype-2.8/ft2demos-2.8/src/ftview.c.api	2017-05-11 18:31:16.000000000 +0200
ae68a7
+++ freetype-2.8/ft2demos-2.8/src/ftview.c	2018-06-04 16:53:29.960331386 +0200
ae68a7
@@ -1531,8 +1531,8 @@
ae68a7
       case FT_ENCODING_SJIS:
ae68a7
         encoding = "SJIS";
ae68a7
         break;
ae68a7
-      case FT_ENCODING_PRC:
ae68a7
-        encoding = "PRC";
ae68a7
+      case FT_ENCODING_GB2312:
ae68a7
+        encoding = "GB2312";
ae68a7
         break;
ae68a7
       case FT_ENCODING_BIG5:
ae68a7
         encoding = "Big5";
ae68a7
--- freetype-2.8/include/freetype/freetype.h.api	2017-05-13 06:28:40.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/freetype.h	2018-06-04 16:53:29.961331388 +0200
ae68a7
@@ -766,15 +766,14 @@ FT_BEGIN_HEADER
ae68a7
     FT_ENC_TAG( FT_ENCODING_UNICODE,   'u', 'n', 'i', 'c' ),
ae68a7
 
ae68a7
     FT_ENC_TAG( FT_ENCODING_SJIS,    's', 'j', 'i', 's' ),
ae68a7
-    FT_ENC_TAG( FT_ENCODING_PRC,     'g', 'b', ' ', ' ' ),
ae68a7
+    FT_ENC_TAG( FT_ENCODING_GB2312,  'g', 'b', ' ', ' ' ),
ae68a7
     FT_ENC_TAG( FT_ENCODING_BIG5,    'b', 'i', 'g', '5' ),
ae68a7
     FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
ae68a7
     FT_ENC_TAG( FT_ENCODING_JOHAB,   'j', 'o', 'h', 'a' ),
ae68a7
 
ae68a7
     /* for backward compatibility */
ae68a7
-    FT_ENCODING_GB2312     = FT_ENCODING_PRC,
ae68a7
     FT_ENCODING_MS_SJIS    = FT_ENCODING_SJIS,
ae68a7
-    FT_ENCODING_MS_GB2312  = FT_ENCODING_PRC,
ae68a7
+    FT_ENCODING_MS_GB2312  = FT_ENCODING_GB2312,
ae68a7
     FT_ENCODING_MS_BIG5    = FT_ENCODING_BIG5,
ae68a7
     FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
ae68a7
     FT_ENCODING_MS_JOHAB   = FT_ENCODING_JOHAB,
ae68a7
@@ -799,7 +798,7 @@ FT_BEGIN_HEADER
ae68a7
 #define ft_encoding_latin_1         FT_ENCODING_ADOBE_LATIN_1
ae68a7
 #define ft_encoding_latin_2         FT_ENCODING_OLD_LATIN_2
ae68a7
 #define ft_encoding_sjis            FT_ENCODING_SJIS
ae68a7
-#define ft_encoding_gb2312          FT_ENCODING_PRC
ae68a7
+#define ft_encoding_gb2312          FT_ENCODING_GB2312
ae68a7
 #define ft_encoding_big5            FT_ENCODING_BIG5
ae68a7
 #define ft_encoding_wansung         FT_ENCODING_WANSUNG
ae68a7
 #define ft_encoding_johab           FT_ENCODING_JOHAB
ae68a7
--- freetype-2.8/include/freetype/ftcache.h.api	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/ftcache.h	2018-06-04 16:53:29.961331388 +0200
ae68a7
@@ -667,8 +667,8 @@ FT_BEGIN_HEADER
ae68a7
   typedef struct  FTC_ImageTypeRec_
ae68a7
   {
ae68a7
     FTC_FaceID  face_id;
ae68a7
-    FT_UInt     width;
ae68a7
-    FT_UInt     height;
ae68a7
+    FT_Int      width;
ae68a7
+    FT_Int      height;
ae68a7
     FT_Int32    flags;
ae68a7
 
ae68a7
   } FTC_ImageTypeRec;
ae68a7
--- freetype-2.8/include/freetype/ftimage.h.api	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/ftimage.h	2018-06-04 16:53:29.962331389 +0200
ae68a7
@@ -260,13 +260,13 @@ FT_BEGIN_HEADER
ae68a7
   /*                                                                       */
ae68a7
   typedef struct  FT_Bitmap_
ae68a7
   {
ae68a7
-    unsigned int    rows;
ae68a7
-    unsigned int    width;
ae68a7
+    int             rows;
ae68a7
+    int             width;
ae68a7
     int             pitch;
ae68a7
     unsigned char*  buffer;
ae68a7
-    unsigned short  num_grays;
ae68a7
-    unsigned char   pixel_mode;
ae68a7
-    unsigned char   palette_mode;
ae68a7
+    short           num_grays;
ae68a7
+    char            pixel_mode;
ae68a7
+    char            palette_mode;
ae68a7
     void*           palette;
ae68a7
 
ae68a7
   } FT_Bitmap;
ae68a7
--- freetype-2.8/include/freetype/ftmm.h.api	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/ftmm.h	2018-06-04 16:53:29.962331389 +0200
ae68a7
@@ -177,14 +177,10 @@ FT_BEGIN_HEADER
ae68a7
   /*                                                                       */
ae68a7
   /*    strid  :: The entry in `name' table identifying this instance.     */
ae68a7
   /*                                                                       */
ae68a7
-  /*    psid   :: The entry in `name' table identifying a PostScript name  */
ae68a7
-  /*              for this instance.                                       */
ae68a7
-  /*                                                                       */
ae68a7
   typedef struct  FT_Var_Named_Style_
ae68a7
   {
ae68a7
     FT_Fixed*  coords;
ae68a7
     FT_UInt    strid;
ae68a7
-    FT_UInt    psid;   /* since 2.7.1 */
ae68a7
 
ae68a7
   } FT_Var_Named_Style;
ae68a7
 
ae68a7
--- freetype-2.8/include/freetype/ttnameid.h.api	2017-05-03 23:26:45.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/ttnameid.h	2018-06-04 16:53:29.963331391 +0200
ae68a7
@@ -1217,9 +1217,9 @@ FT_BEGIN_HEADER
ae68a7
   /* */
ae68a7
 
ae68a7
   /* for backward compatibility with older FreeType versions */
ae68a7
-#define TT_UCR_ARABIC_PRESENTATION_A         \
ae68a7
+#define TT_UCR_ARABIC_PRESENTATIONS_A         \
ae68a7
           TT_UCR_ARABIC_PRESENTATION_FORMS_A
ae68a7
-#define TT_UCR_ARABIC_PRESENTATION_B         \
ae68a7
+#define TT_UCR_ARABIC_PRESENTATIONS_B         \
ae68a7
           TT_UCR_ARABIC_PRESENTATION_FORMS_B
ae68a7
 
ae68a7
 #define TT_UCR_COMBINING_DIACRITICS          \
ae68a7
--- freetype-2.8/include/freetype/tttables.h.api	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/tttables.h	2018-06-04 17:18:26.699449088 +0200
ae68a7
@@ -383,7 +383,7 @@ FT_BEGIN_HEADER
ae68a7
     FT_Short   xAvgCharWidth;
ae68a7
     FT_UShort  usWeightClass;
ae68a7
     FT_UShort  usWidthClass;
ae68a7
-    FT_UShort  fsType;
ae68a7
+    FT_Short   fsType;
ae68a7
     FT_Short   ySubscriptXSize;
ae68a7
     FT_Short   ySubscriptYSize;
ae68a7
     FT_Short   ySubscriptXOffset;
ae68a7
@@ -427,11 +427,6 @@ FT_BEGIN_HEADER
ae68a7
     FT_UShort  usBreakChar;
ae68a7
     FT_UShort  usMaxContext;
ae68a7
 
ae68a7
-    /* only version 5 and higher: */
ae68a7
-
ae68a7
-    FT_UShort  usLowerOpticalPointSize;       /* in twips (1/20th points) */
ae68a7
-    FT_UShort  usUpperOpticalPointSize;       /* in twips (1/20th points) */
ae68a7
-
ae68a7
   } TT_OS2;
ae68a7
 
ae68a7
 
ae68a7
@@ -596,43 +591,41 @@ FT_BEGIN_HEADER
ae68a7
   /*    @FT_Get_Sfnt_Table API function.                                   */
ae68a7
   /*                                                                       */
ae68a7
   /* <Values>                                                              */
ae68a7
-  /*    FT_SFNT_HEAD :: To access the font's @TT_Header structure.         */
ae68a7
+  /*    ft_sfnt_head :: To access the font's @TT_Header structure.         */
ae68a7
   /*                                                                       */
ae68a7
-  /*    FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure.     */
ae68a7
+  /*    ft_sfnt_maxp :: To access the font's @TT_MaxProfile structure.     */
ae68a7
   /*                                                                       */
ae68a7
-  /*    FT_SFNT_OS2  :: To access the font's @TT_OS2 structure.            */
ae68a7
+  /*    ft_sfnt_os2  :: To access the font's @TT_OS2 structure.            */
ae68a7
   /*                                                                       */
ae68a7
-  /*    FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure.     */
ae68a7
+  /*    ft_sfnt_hhea :: To access the font's @TT_HoriHeader structure.     */
ae68a7
   /*                                                                       */
ae68a7
-  /*    FT_SFNT_VHEA :: To access the font's @TT_VertHeader structure.     */
ae68a7
+  /*    ft_sfnt_vhea :: To access the font's @TT_VertHeader structure.     */
ae68a7
   /*                                                                       */
ae68a7
-  /*    FT_SFNT_POST :: To access the font's @TT_Postscript structure.     */
ae68a7
+  /*    ft_sfnt_post :: To access the font's @TT_Postscript structure.     */
ae68a7
   /*                                                                       */
ae68a7
-  /*    FT_SFNT_PCLT :: To access the font's @TT_PCLT structure.           */
ae68a7
+  /*    ft_sfnt_pclt :: To access the font's @TT_PCLT structure.           */
ae68a7
   /*                                                                       */
ae68a7
   typedef enum  FT_Sfnt_Tag_
ae68a7
   {
ae68a7
-    FT_SFNT_HEAD,
ae68a7
-    FT_SFNT_MAXP,
ae68a7
-    FT_SFNT_OS2,
ae68a7
-    FT_SFNT_HHEA,
ae68a7
-    FT_SFNT_VHEA,
ae68a7
-    FT_SFNT_POST,
ae68a7
-    FT_SFNT_PCLT,
ae68a7
+    ft_sfnt_head = 0,
ae68a7
+    ft_sfnt_maxp = 1,
ae68a7
+    ft_sfnt_os2  = 2,
ae68a7
+    ft_sfnt_hhea = 3,
ae68a7
+    ft_sfnt_vhea = 4,
ae68a7
+    ft_sfnt_post = 5,
ae68a7
+    ft_sfnt_pclt = 6,
ae68a7
 
ae68a7
-    FT_SFNT_MAX
ae68a7
+    sfnt_max
ae68a7
 
ae68a7
   } FT_Sfnt_Tag;
ae68a7
 
ae68a7
-  /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */
ae68a7
-  /* values instead                                                      */
ae68a7
-#define ft_sfnt_head  FT_SFNT_HEAD
ae68a7
-#define ft_sfnt_maxp  FT_SFNT_MAXP
ae68a7
-#define ft_sfnt_os2   FT_SFNT_OS2
ae68a7
-#define ft_sfnt_hhea  FT_SFNT_HHEA
ae68a7
-#define ft_sfnt_vhea  FT_SFNT_VHEA
ae68a7
-#define ft_sfnt_post  FT_SFNT_POST
ae68a7
-#define ft_sfnt_pclt  FT_SFNT_PCLT
ae68a7
+#define FT_SFNT_HEAD ft_sfnt_head
ae68a7
+#define FT_SFNT_MAXP ft_sfnt_maxp
ae68a7
+#define FT_SFNT_OS2  ft_sfnt_os2 
ae68a7
+#define FT_SFNT_HHEA ft_sfnt_hhea
ae68a7
+#define FT_SFNT_VHEA ft_sfnt_vhea
ae68a7
+#define FT_SFNT_POST ft_sfnt_post
ae68a7
+#define FT_SFNT_PCLT ft_sfnt_pclt
ae68a7
 
ae68a7
 
ae68a7
   /*************************************************************************/
ae68a7
--- freetype-2.8/src/sfnt/sfdriver.c.api	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/sfnt/sfdriver.c	2018-06-04 16:53:29.964331392 +0200
ae68a7
@@ -867,16 +867,9 @@
ae68a7
       SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
ae68a7
 
ae68a7
       FT_Long  instance = ( ( face->root.face_index & 0x7FFF0000L ) >> 16 ) - 1;
ae68a7
-      FT_UInt  psid     = mm_var->namedstyle[instance].psid;
ae68a7
 
ae68a7
       char*  ps_name = NULL;
ae68a7
 
ae68a7
-
ae68a7
-      /* try first to load the name string with index `postScriptNameID' */
ae68a7
-      if ( psid == 6                      ||
ae68a7
-           ( psid > 255 && psid < 32768 ) )
ae68a7
-        (void)sfnt->get_name( face, (FT_UShort)psid, &ps_name );
ae68a7
-
ae68a7
       if ( ps_name )
ae68a7
       {
ae68a7
         result = ps_name;
ae68a7
--- freetype-2.8/src/sfnt/sfobjs.c.api	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/sfnt/sfobjs.c	2018-06-04 16:53:29.964331392 +0200
ae68a7
@@ -311,7 +311,7 @@
ae68a7
       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_UCS_4,      FT_ENCODING_UNICODE },
ae68a7
       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_UNICODE_CS, FT_ENCODING_UNICODE },
ae68a7
       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_SJIS,       FT_ENCODING_SJIS },
ae68a7
-      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_PRC,        FT_ENCODING_PRC },
ae68a7
+      { TT_PLATFORM_MICROSOFT,     TT_MS_ID_GB2312,     FT_ENCODING_GB2312 },
ae68a7
       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_BIG_5,      FT_ENCODING_BIG5 },
ae68a7
       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_WANSUNG,    FT_ENCODING_WANSUNG },
ae68a7
       { TT_PLATFORM_MICROSOFT,     TT_MS_ID_JOHAB,      FT_ENCODING_JOHAB }
ae68a7
--- freetype-2.8/src/sfnt/ttload.c.api	2017-04-22 07:39:36.000000000 +0200
ae68a7
+++ freetype-2.8/src/sfnt/ttload.c	2018-06-04 16:53:29.965331393 +0200
ae68a7
@@ -1164,15 +1164,6 @@
ae68a7
       FT_FRAME_END
ae68a7
     };
ae68a7
 
ae68a7
-    /* `OS/2' version 5 and newer */
ae68a7
-    static const FT_Frame_Field  os2_fields_extra5[] =
ae68a7
-    {
ae68a7
-      FT_FRAME_START( 4 ),
ae68a7
-        FT_FRAME_USHORT( usLowerOpticalPointSize ),
ae68a7
-        FT_FRAME_USHORT( usUpperOpticalPointSize ),
ae68a7
-      FT_FRAME_END
ae68a7
-    };
ae68a7
-
ae68a7
 
ae68a7
     /* We now support old Mac fonts where the OS/2 table doesn't  */
ae68a7
     /* exist.  Simply put, we set the `version' field to 0xFFFF   */
ae68a7
@@ -1193,8 +1184,6 @@
ae68a7
     os2->usDefaultChar           = 0;
ae68a7
     os2->usBreakChar             = 0;
ae68a7
     os2->usMaxContext            = 0;
ae68a7
-    os2->usLowerOpticalPointSize = 0;
ae68a7
-    os2->usUpperOpticalPointSize = 0xFFFF;
ae68a7
 
ae68a7
     if ( os2->version >= 0x0001 )
ae68a7
     {
ae68a7
@@ -1207,13 +1196,6 @@
ae68a7
         /* only version 2 tables */
ae68a7
         if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )
ae68a7
           goto Exit;
ae68a7
-
ae68a7
-        if ( os2->version >= 0x0005 )
ae68a7
-        {
ae68a7
-          /* only version 5 tables */
ae68a7
-          if ( FT_STREAM_READ_FIELDS( os2_fields_extra5, os2 ) )
ae68a7
-            goto Exit;
ae68a7
-        }
ae68a7
       }
ae68a7
     }
ae68a7
 
ae68a7
--- freetype-2.8/src/truetype/ttgxvar.c.api	2017-05-02 14:37:55.000000000 +0200
ae68a7
+++ freetype-2.8/src/truetype/ttgxvar.c	2018-06-04 16:53:29.966331395 +0200
ae68a7
@@ -2155,7 +2155,7 @@
ae68a7
           *c = FT_GET_LONG();
ae68a7
 
ae68a7
         if ( usePsName )
ae68a7
-          ns->psid = FT_GET_USHORT();
ae68a7
+          (void) FT_GET_USHORT();
ae68a7
 
ae68a7
         ft_var_to_normalized( face,
ae68a7
                               fvar_head.axisCount,
ae68a7
@@ -2206,7 +2206,6 @@
ae68a7
             ns = &mmvar->namedstyle[fvar_head.instanceCount];
ae68a7
 
ae68a7
             ns->strid = strid;
ae68a7
-            ns->psid  = TT_NAME_ID_PS_NAME;
ae68a7
 
ae68a7
             a = mmvar->axis;
ae68a7
             c = ns->coords;
ae68a7
--- freetype-2.8/devel/ftoption.h.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/devel/ftoption.h	2018-06-07 11:30:34.431455285 +0200
ae68a7
@@ -903,7 +903,7 @@ FT_BEGIN_HEADER
ae68a7
    * This macro is obsolete.  Support has been removed in FreeType
ae68a7
    * version 2.5.
ae68a7
    */
ae68a7
-/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
ae68a7
+#define FT_CONFIG_OPTION_OLD_INTERNALS
ae68a7
 
ae68a7
 
ae68a7
   /*
ae68a7
--- freetype-2.8/include/freetype/config/ftoption.h.orig	2017-05-01 09:39:06.000000000 +0200
ae68a7
+++ freetype-2.8/include/freetype/config/ftoption.h	2018-06-07 11:30:53.662506048 +0200
ae68a7
@@ -934,7 +934,7 @@ FT_BEGIN_HEADER
ae68a7
    * This macro is obsolete.  Support has been removed in FreeType
ae68a7
    * version 2.5.
ae68a7
    */
ae68a7
-/* #define FT_CONFIG_OPTION_OLD_INTERNALS */
ae68a7
+#define FT_CONFIG_OPTION_OLD_INTERNALS
ae68a7
 
ae68a7
 
ae68a7
   /*
ae68a7
--- freetype-2.8/include/freetype/ftcache.h.orig	2018-06-07 11:33:07.663882169 +0200
ae68a7
+++ freetype-2.8/include/freetype/ftcache.h	2018-06-07 11:33:23.127947502 +0200
ae68a7
@@ -1049,6 +1049,54 @@ FT_BEGIN_HEADER
ae68a7
   /* */
ae68a7
 
ae68a7
 
ae68a7
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
ae68a7
+
ae68a7
+  /*@***********************************************************************/
ae68a7
+  /*                                                                       */
ae68a7
+  /* <Struct>                                                              */
ae68a7
+  /*    FTC_FontRec                                                        */
ae68a7
+  /*                                                                       */
ae68a7
+  /* <Description>                                                         */
ae68a7
+  /*    A simple structure used to describe a given `font' to the cache    */
ae68a7
+  /*    manager.  Note that a `font' is the combination of a given face    */
ae68a7
+  /*    with a given character size.                                       */
ae68a7
+  /*                                                                       */
ae68a7
+  /* <Fields>                                                              */
ae68a7
+  /*    face_id    :: The ID of the face to use.                           */
ae68a7
+  /*                                                                       */
ae68a7
+  /*    pix_width  :: The character width in integer pixels.               */
ae68a7
+  /*                                                                       */
ae68a7
+  /*    pix_height :: The character height in integer pixels.              */
ae68a7
+  /*                                                                       */
ae68a7
+  typedef struct  FTC_FontRec_
ae68a7
+  {
ae68a7
+    FTC_FaceID  face_id;
ae68a7
+    FT_UShort   pix_width;
ae68a7
+    FT_UShort   pix_height;
ae68a7
+
ae68a7
+  } FTC_FontRec;
ae68a7
+
ae68a7
+
ae68a7
+  /* */
ae68a7
+
ae68a7
+
ae68a7
+  typedef FTC_FontRec*  FTC_Font;
ae68a7
+
ae68a7
+
ae68a7
+  FT_EXPORT( FT_Error )
ae68a7
+  FTC_Manager_Lookup_Face( FTC_Manager  manager,
ae68a7
+                           FTC_FaceID   face_id,
ae68a7
+                           FT_Face     *aface );
ae68a7
+
ae68a7
+  FT_EXPORT( FT_Error )
ae68a7
+  FTC_Manager_Lookup_Size( FTC_Manager  manager,
ae68a7
+                           FTC_Font     font,
ae68a7
+                           FT_Face     *aface,
ae68a7
+                           FT_Size     *asize );
ae68a7
+
ae68a7
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
ae68a7
+
ae68a7
+
ae68a7
 FT_END_HEADER
ae68a7
 
ae68a7
 #endif /* FTCACHE_H_ */
ae68a7
--- freetype-2.8/src/cache/ftcmanag.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/cache/ftcmanag.c	2018-06-07 11:28:18.663096906 +0200
ae68a7
@@ -701,4 +701,55 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
ae68a7
+
ae68a7
+  FT_EXPORT_DEF( FT_Error )
ae68a7
+  FTC_Manager_Lookup_Face( FTC_Manager  manager,
ae68a7
+                           FTC_FaceID   face_id,
ae68a7
+                           FT_Face     *aface )
ae68a7
+  {
ae68a7
+    return FTC_Manager_LookupFace( manager, face_id, aface );
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
+  FT_EXPORT( FT_Error )
ae68a7
+  FTC_Manager_Lookup_Size( FTC_Manager  manager,
ae68a7
+                           FTC_Font     font,
ae68a7
+                           FT_Face     *aface,
ae68a7
+                           FT_Size     *asize )
ae68a7
+  {
ae68a7
+    FTC_ScalerRec  scaler;
ae68a7
+    FT_Error       error;
ae68a7
+    FT_Size        size;
ae68a7
+    FT_Face        face;
ae68a7
+
ae68a7
+
ae68a7
+    scaler.face_id = font->face_id;
ae68a7
+    scaler.width   = font->pix_width;
ae68a7
+    scaler.height  = font->pix_height;
ae68a7
+    scaler.pixel   = TRUE;
ae68a7
+    scaler.x_res   = 0;
ae68a7
+    scaler.y_res   = 0;
ae68a7
+
ae68a7
+    error = FTC_Manager_LookupSize( manager, &scaler, &size );
ae68a7
+    if ( error )
ae68a7
+    {
ae68a7
+      face = NULL;
ae68a7
+      size = NULL;
ae68a7
+    }
ae68a7
+    else
ae68a7
+      face = size->face;
ae68a7
+
ae68a7
+    if ( aface )
ae68a7
+      *aface = face;
ae68a7
+
ae68a7
+    if ( asize )
ae68a7
+      *asize = size;
ae68a7
+
ae68a7
+    return error;
ae68a7
+  }
ae68a7
+
ae68a7
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
ae68a7
+
ae68a7
+
ae68a7
 /* END */
ae68a7
--- freetype-2.8/ft2demos-2.8/graph/x11/grx11.c.orig	2016-10-19 06:55:23.000000000 +0200
ae68a7
+++ freetype-2.8/ft2demos-2.8/graph/x11/grx11.c	2018-06-07 16:41:52.626432650 +0200
ae68a7
@@ -1404,8 +1404,8 @@ typedef  unsigned long   uint32;
ae68a7
                                     RootWindow( display, screen ),
ae68a7
                                     0,
ae68a7
                                     0,
ae68a7
-                                    (unsigned int)bitmap->width,
ae68a7
-                                    (unsigned int)bitmap->rows,
ae68a7
+                                    bitmap->width,
ae68a7
+                                    bitmap->rows,
ae68a7
                                     10,
ae68a7
                                     format->x_depth,
ae68a7
                                     InputOutput,
ae68a7
--- freetype-2.8/src/base/ftbitmap.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/base/ftbitmap.c	2018-06-07 18:26:08.488060315 +0200
ae68a7
@@ -90,7 +90,7 @@
ae68a7
 
ae68a7
     if ( pitch < 0 )
ae68a7
       pitch = -pitch;
ae68a7
-    size = (FT_ULong)pitch * source->rows;
ae68a7
+    size = (FT_ULong)( pitch * source->rows );
ae68a7
 
ae68a7
     if ( target->buffer )
ae68a7
     {
ae68a7
@@ -100,7 +100,7 @@
ae68a7
 
ae68a7
       if ( target_pitch < 0 )
ae68a7
         target_pitch = -target_pitch;
ae68a7
-      target_size = (FT_ULong)target_pitch * target->rows;
ae68a7
+      target_size = (FT_ULong)( target_pitch * target->rows );
ae68a7
 
ae68a7
       if ( target_size != size )
ae68a7
         (void)FT_QREALLOC( target->buffer, target_size, size );
ae68a7
@@ -156,7 +156,7 @@
ae68a7
     int             pitch;
ae68a7
     int             new_pitch;
ae68a7
     FT_UInt         bpp;
ae68a7
-    FT_UInt         i, width, height;
ae68a7
+    FT_Int          i, width, height;
ae68a7
     unsigned char*  buffer = NULL;
ae68a7
 
ae68a7
 
ae68a7
@@ -194,17 +194,17 @@
ae68a7
     if ( ypixels == 0 && new_pitch <= pitch )
ae68a7
     {
ae68a7
       /* zero the padding */
ae68a7
-      FT_UInt  bit_width = (FT_UInt)pitch * 8;
ae68a7
-      FT_UInt  bit_last  = ( width + xpixels ) * bpp;
ae68a7
+      FT_Int  bit_width = pitch * 8;
ae68a7
+      FT_Int  bit_last  = ( width + xpixels ) * bpp;
ae68a7
 
ae68a7
 
ae68a7
       if ( bit_last < bit_width )
ae68a7
       {
ae68a7
         FT_Byte*  line  = bitmap->buffer + ( bit_last >> 3 );
ae68a7
         FT_Byte*  end   = bitmap->buffer + pitch;
ae68a7
-        FT_UInt   shift = bit_last & 7;
ae68a7
+        FT_Int    shift = bit_last & 7;
ae68a7
         FT_UInt   mask  = 0xFF00U >> shift;
ae68a7
-        FT_UInt   count = height;
ae68a7
+        FT_Int    count = height;
ae68a7
 
ae68a7
 
ae68a7
         for ( ; count > 0; count--, line += pitch, end += pitch )
ae68a7
@@ -233,7 +233,7 @@
ae68a7
     /* thus take care of the flow direction         */
ae68a7
     if ( bitmap->pitch > 0 )
ae68a7
     {
ae68a7
-      FT_UInt  len = ( width * bpp + 7 ) >> 3;
ae68a7
+      FT_Int  len = ( width * bpp + 7 ) >> 3;
ae68a7
 
ae68a7
 
ae68a7
       for ( i = 0; i < bitmap->rows; i++ )
ae68a7
@@ -243,7 +243,7 @@
ae68a7
     }
ae68a7
     else
ae68a7
     {
ae68a7
-      FT_UInt  len = ( width * bpp + 7 ) >> 3;
ae68a7
+      FT_Int  len = ( width * bpp + 7 ) >> 3;
ae68a7
 
ae68a7
 
ae68a7
       for ( i = 0; i < bitmap->rows; i++ )
ae68a7
@@ -275,8 +275,7 @@
ae68a7
   {
ae68a7
     FT_Error        error;
ae68a7
     unsigned char*  p;
ae68a7
-    FT_Int          i, x, pitch;
ae68a7
-    FT_UInt         y;
ae68a7
+    FT_Int          i, x, y, pitch;
ae68a7
     FT_Int          xstr, ystr;
ae68a7
 
ae68a7
 
ae68a7
@@ -420,8 +419,8 @@
ae68a7
       p += bitmap->pitch;
ae68a7
     }
ae68a7
 
ae68a7
-    bitmap->width += (FT_UInt)xstr;
ae68a7
-    bitmap->rows += (FT_UInt)ystr;
ae68a7
+    bitmap->width += xstr;
ae68a7
+    bitmap->rows += ystr;
ae68a7
 
ae68a7
     return FT_Err_Ok;
ae68a7
   }
ae68a7
@@ -506,8 +505,8 @@
ae68a7
     case FT_PIXEL_MODE_LCD_V:
ae68a7
     case FT_PIXEL_MODE_BGRA:
ae68a7
       {
ae68a7
-        FT_Int    pad, old_target_pitch, target_pitch;
ae68a7
-        FT_ULong  old_size;
ae68a7
+        FT_Int   pad, old_target_pitch, target_pitch;
ae68a7
+        FT_Long  old_size;
ae68a7
 
ae68a7
 
ae68a7
         old_target_pitch = target->pitch;
ae68a7
@@ -617,7 +616,7 @@
ae68a7
     case FT_PIXEL_MODE_LCD:
ae68a7
     case FT_PIXEL_MODE_LCD_V:
ae68a7
       {
ae68a7
-        FT_UInt  width = source->width;
ae68a7
+        FT_Int   width = source->width;
ae68a7
         FT_UInt  i;
ae68a7
 
ae68a7
 
ae68a7
--- freetype-2.8/src/pcf/pcfdrivr.c.orig	2018-06-07 11:42:57.757375204 +0200
ae68a7
+++ freetype-2.8/src/pcf/pcfdrivr.c	2018-06-07 16:59:25.832896549 +0200
ae68a7
@@ -523,10 +523,10 @@ THE SOFTWARE.
ae68a7
 
ae68a7
     metric = face->metrics + glyph_index;
ae68a7
 
ae68a7
-    bitmap->rows       = (unsigned int)( metric->ascent +
ae68a7
-                                         metric->descent );
ae68a7
-    bitmap->width      = (unsigned int)( metric->rightSideBearing -
ae68a7
-                                         metric->leftSideBearing );
ae68a7
+    bitmap->rows       = ( metric->ascent +
ae68a7
+                           metric->descent );
ae68a7
+    bitmap->width      = ( metric->rightSideBearing -
ae68a7
+                           metric->leftSideBearing );
ae68a7
     bitmap->num_grays  = 1;
ae68a7
     bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
ae68a7
 
ae68a7
--- freetype-2.8/src/raster/ftraster.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/raster/ftraster.c	2018-06-07 18:07:14.977278387 +0200
ae68a7
@@ -2479,7 +2479,7 @@
ae68a7
       {
ae68a7
         e1 = TRUNC( e1 );
ae68a7
 
ae68a7
-        if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
ae68a7
+        if ( e1 >= 0 && e1 < ras.target.rows )
ae68a7
         {
ae68a7
           Byte   f1;
ae68a7
           PByte  bits;
ae68a7
@@ -2589,7 +2589,7 @@
ae68a7
         /* bounding box instead                                           */
ae68a7
         if ( pxl < 0 )
ae68a7
           pxl = e1;
ae68a7
-        else if ( (ULong)( TRUNC( pxl ) ) >= ras.target.rows )
ae68a7
+        else if ( ( TRUNC( pxl ) ) >= ras.target.rows )
ae68a7
           pxl = e2;
ae68a7
 
ae68a7
         /* check that the other pixel isn't set */
ae68a7
@@ -2604,9 +2604,9 @@
ae68a7
         if ( ras.target.pitch > 0 )
ae68a7
           bits += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
ae68a7
 
ae68a7
-        if ( e1 >= 0                     &&
ae68a7
-             (ULong)e1 < ras.target.rows &&
ae68a7
-             *bits & f1                  )
ae68a7
+        if ( e1 >= 0              &&
ae68a7
+             e1 < ras.target.rows &&
ae68a7
+             *bits & f1           )
ae68a7
           goto Exit;
ae68a7
       }
ae68a7
       else
ae68a7
@@ -2615,7 +2615,7 @@
ae68a7
 
ae68a7
     e1 = TRUNC( pxl );
ae68a7
 
ae68a7
-    if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
ae68a7
+    if ( e1 >= 0 && e1 < ras.target.rows )
ae68a7
     {
ae68a7
       FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
ae68a7
 
ae68a7
--- freetype-2.8/src/sfnt/pngshim.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/sfnt/pngshim.c	2018-06-07 18:08:07.825359421 +0200
ae68a7
@@ -209,10 +209,10 @@
ae68a7
     }
ae68a7
 
ae68a7
     if ( !populate_map_and_metrics                            &&
ae68a7
-         ( (FT_UInt)x_offset + metrics->width  > map->width ||
ae68a7
-           (FT_UInt)y_offset + metrics->height > map->rows  ||
ae68a7
-           pix_bits != 32                                   ||
ae68a7
-           map->pixel_mode != FT_PIXEL_MODE_BGRA            ) )
ae68a7
+         ( x_offset + metrics->width  > map->width ||
ae68a7
+           y_offset + metrics->height > map->rows  ||
ae68a7
+           pix_bits != 32                          ||
ae68a7
+           map->pixel_mode != FT_PIXEL_MODE_BGRA   ) )
ae68a7
     {
ae68a7
       error = FT_THROW( Invalid_Argument );
ae68a7
       goto Exit;
ae68a7
@@ -270,7 +270,7 @@
ae68a7
       map->num_grays  = 256;
ae68a7
 
ae68a7
       /* reject too large bitmaps similarly to the rasterizer */
ae68a7
-      if ( map->rows > 0x7FFF || map->width > 0x7FFF )
ae68a7
+      if ( map->rows > 0x4FFF || map->width > 0x4FFF )
ae68a7
       {
ae68a7
         error = FT_THROW( Array_Too_Large );
ae68a7
         goto DestroyExit;
ae68a7
@@ -346,7 +346,7 @@
ae68a7
 
ae68a7
     if ( populate_map_and_metrics )
ae68a7
     {
ae68a7
-      /* this doesn't overflow: 0x7FFF * 0x7FFF * 4 < 2^32 */
ae68a7
+      /* this doesn't overflow: 0x4FFF * 0x4FFF * 4 < 2^31 */
ae68a7
       FT_ULong  size = map->rows * (FT_ULong)map->pitch;
ae68a7
 
ae68a7
 
ae68a7
--- freetype-2.8/src/sfnt/ttsbit.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/sfnt/ttsbit.c	2018-06-07 18:31:57.610612501 +0200
ae68a7
@@ -705,7 +705,7 @@
ae68a7
     FT_Error    error = FT_Err_Ok;
ae68a7
     FT_Byte*    line;
ae68a7
     FT_Int      pitch, width, height, line_bits, h;
ae68a7
-    FT_UInt     bit_height, bit_width;
ae68a7
+    FT_Int      bit_height, bit_width;
ae68a7
     FT_Bitmap*  bitmap;
ae68a7
 
ae68a7
     FT_UNUSED( recurse_count );
ae68a7
--- freetype-2.8/src/smooth/ftgrays.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/smooth/ftgrays.c	2018-06-07 17:01:09.008070697 +0200
ae68a7
@@ -1880,7 +1880,7 @@ typedef ptrdiff_t  FT_PtrDist;
ae68a7
         ras.target.origin = target_map->buffer;
ae68a7
       else
ae68a7
         ras.target.origin = target_map->buffer
ae68a7
-              + ( target_map->rows - 1 ) * (unsigned int)target_map->pitch;
ae68a7
+              + (unsigned int) (( target_map->rows - 1 ) * target_map->pitch);
ae68a7
 
ae68a7
       ras.target.pitch = target_map->pitch;
ae68a7
 
ae68a7
--- freetype-2.8/src/smooth/ftsmooth.c.orig	2017-05-01 09:35:12.000000000 +0200
ae68a7
+++ freetype-2.8/src/smooth/ftsmooth.c	2018-06-07 17:01:51.040141641 +0200
ae68a7
@@ -292,8 +292,8 @@
ae68a7
 
ae68a7
     bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
ae68a7
     bitmap->num_grays  = 256;
ae68a7
-    bitmap->width      = (unsigned int)width;
ae68a7
-    bitmap->rows       = (unsigned int)height;
ae68a7
+    bitmap->width      = width;
ae68a7
+    bitmap->rows       = height;
ae68a7
     bitmap->pitch      = pitch;
ae68a7
 
ae68a7
     /* translate outline to render it into the bitmap */
ae68a7
--- freetype-2.8/src/winfonts/winfnt.c.orig	2017-03-30 12:20:23.000000000 +0200
ae68a7
+++ freetype-2.8/src/winfonts/winfnt.c	2018-06-07 18:21:47.809648016 +0200
ae68a7
@@ -1038,7 +1038,7 @@
ae68a7
 
ae68a7
     p = font->fnt_frame + offset;
ae68a7
 
ae68a7
-    bitmap->width = FT_NEXT_USHORT_LE( p );
ae68a7
+    bitmap->width = FT_NEXT_SHORT_LE( p );
ae68a7
 
ae68a7
     /* jump to glyph entry */
ae68a7
     if ( new_format )
ae68a7
@@ -1079,7 +1079,7 @@
ae68a7
     /* allocate and build bitmap */
ae68a7
     {
ae68a7
       FT_Memory  memory = FT_FACE_MEMORY( slot->face );
ae68a7
-      FT_UInt    pitch  = ( bitmap->width + 7 ) >> 3;
ae68a7
+      FT_Int     pitch  = ( bitmap->width + 7 ) >> 3;
ae68a7
       FT_Byte*   column;
ae68a7
       FT_Byte*   write;
ae68a7