src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c
changeset 54876 da3834261f0c
parent 49234 3375a8039fde
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c	Wed May 08 22:59:20 2019 -0700
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c	Thu May 09 16:09:39 2019 -0700
@@ -1,20 +1,20 @@
-/***************************************************************************/
-/*                                                                         */
-/*  ttload.c                                                               */
-/*                                                                         */
-/*    Load the basic TrueType tables, i.e., tables that can be either in   */
-/*    TTF or OTF fonts (body).                                             */
-/*                                                                         */
-/*  Copyright 1996-2018 by                                                 */
-/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
-/*                                                                         */
-/*  This file is part of the FreeType project, and may only be used,       */
-/*  modified, and distributed under the terms of the FreeType project      */
-/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
-/*  this file you indicate that you have read the license and              */
-/*  understand and accept it fully.                                        */
-/*                                                                         */
-/***************************************************************************/
+/****************************************************************************
+ *
+ * ttload.c
+ *
+ *   Load the basic TrueType tables, i.e., tables that can be either in
+ *   TTF or OTF fonts (body).
+ *
+ * Copyright (C) 1996-2019 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
 
 
 #include <ft2build.h>
@@ -26,32 +26,34 @@
 #include "sferrors.h"
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * The macro FT_COMPONENT is used in trace mode.  It is an implicit
+   * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
+   * messages during execution.
+   */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_ttload
+#define FT_COMPONENT  ttload
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_lookup_table                                               */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Looks for a TrueType table by name.                                */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A face object handle.                                      */
-  /*                                                                       */
-  /*    tag  :: The searched tag.                                          */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    A pointer to the table directory entry.  0 if not found.           */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_lookup_table
+   *
+   * @Description:
+   *   Looks for a TrueType table by name.
+   *
+   * @Input:
+   *   face ::
+   *     A face object handle.
+   *
+   *   tag ::
+   *     The searched tag.
+   *
+   * @Return:
+   *   A pointer to the table directory entry.  0 if not found.
+   */
   FT_LOCAL_DEF( TT_Table  )
   tt_face_lookup_table( TT_Face   face,
                         FT_ULong  tag  )
@@ -101,27 +103,31 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_goto_table                                                 */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Looks for a TrueType table by name, then seek a stream to it.      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A face object handle.                                    */
-  /*                                                                       */
-  /*    tag    :: The searched tag.                                        */
-  /*                                                                       */
-  /*    stream :: The stream to seek when the table is found.              */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    length :: The length of the table if found, undefined otherwise.   */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_goto_table
+   *
+   * @Description:
+   *   Looks for a TrueType table by name, then seek a stream to it.
+   *
+   * @Input:
+   *   face ::
+   *     A face object handle.
+   *
+   *   tag ::
+   *     The searched tag.
+   *
+   *   stream ::
+   *     The stream to seek when the table is found.
+   *
+   * @Output:
+   *   length ::
+   *     The length of the table if found, undefined otherwise.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_goto_table( TT_Face    face,
                       FT_ULong   tag,
@@ -309,28 +315,31 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_font_dir                                              */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the header of a SFNT font file.                              */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face       :: A handle to the target face object.                  */
-  /*                                                                       */
-  /*    stream     :: The input stream.                                    */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    sfnt       :: The SFNT header.                                     */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The stream cursor must be at the beginning of the font directory.  */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_font_dir
+   *
+   * @Description:
+   *   Loads the header of a SFNT font file.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     The input stream.
+   *
+   * @Output:
+   *   sfnt ::
+   *     The SFNT header.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   *
+   * @Note:
+   *   The stream cursor must be at the beginning of the font directory.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_font_dir( TT_Face    face,
                          FT_Stream  stream )
@@ -496,46 +505,51 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_any                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads any font table into client memory.                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: The face object to look for.                             */
-  /*                                                                       */
-  /*    tag    :: The tag of table to load.  Use the value 0 if you want   */
-  /*              to access the whole font file, else set this parameter   */
-  /*              to a valid TrueType table tag that you can forge with    */
-  /*              the MAKE_TT_TAG macro.                                   */
-  /*                                                                       */
-  /*    offset :: The starting offset in the table (or the file if         */
-  /*              tag == 0).                                               */
-  /*                                                                       */
-  /*    length :: The address of the decision variable:                    */
-  /*                                                                       */
-  /*                If length == NULL:                                     */
-  /*                  Loads the whole table.  Returns an error if          */
-  /*                  `offset' == 0!                                       */
-  /*                                                                       */
-  /*                If *length == 0:                                       */
-  /*                  Exits immediately; returning the length of the given */
-  /*                  table or of the font file, depending on the value of */
-  /*                  `tag'.                                               */
-  /*                                                                       */
-  /*                If *length != 0:                                       */
-  /*                  Loads the next `length' bytes of table or font,      */
-  /*                  starting at offset `offset' (in table or font too).  */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    buffer :: The address of target buffer.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_any
+   *
+   * @Description:
+   *   Loads any font table into client memory.
+   *
+   * @Input:
+   *   face ::
+   *     The face object to look for.
+   *
+   *   tag ::
+   *     The tag of table to load.  Use the value 0 if you want
+   *     to access the whole font file, else set this parameter
+   *     to a valid TrueType table tag that you can forge with
+   *     the MAKE_TT_TAG macro.
+   *
+   *   offset ::
+   *     The starting offset in the table (or the file if
+   *     tag == 0).
+   *
+   *   length ::
+   *     The address of the decision variable:
+   *
+   *     If length == NULL:
+   *       Loads the whole table.  Returns an error if
+   *       `offset' == 0!
+   *
+   *     If *length == 0:
+   *       Exits immediately; returning the length of the given
+   *       table or of the font file, depending on the value of
+   *       `tag'.
+   *
+   *     If *length != 0:
+   *       Loads the next `length' bytes of table or font,
+   *       starting at offset `offset' (in table or font too).
+   *
+   * @Output:
+   *   buffer ::
+   *     The address of target buffer.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_any( TT_Face    face,
                     FT_ULong   tag,
@@ -586,22 +600,24 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_generic_header                                        */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the TrueType table `head' or `bhed'.                         */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_generic_header
+   *
+   * @Description:
+   *   Loads the TrueType table `head' or `bhed'.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     The input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   static FT_Error
   tt_face_load_generic_header( TT_Face    face,
                                FT_Stream  stream,
@@ -622,10 +638,10 @@
         FT_FRAME_LONG  ( Magic_Number ),
         FT_FRAME_USHORT( Flags ),
         FT_FRAME_USHORT( Units_Per_EM ),
-        FT_FRAME_LONG  ( Created[0] ),
-        FT_FRAME_LONG  ( Created[1] ),
-        FT_FRAME_LONG  ( Modified[0] ),
-        FT_FRAME_LONG  ( Modified[1] ),
+        FT_FRAME_ULONG ( Created[0] ),
+        FT_FRAME_ULONG ( Created[1] ),
+        FT_FRAME_ULONG ( Modified[0] ),
+        FT_FRAME_ULONG ( Modified[1] ),
         FT_FRAME_SHORT ( xMin ),
         FT_FRAME_SHORT ( yMin ),
         FT_FRAME_SHORT ( xMax ),
@@ -676,22 +692,24 @@
 #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_maxp                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the maximum profile into a face object.                      */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_maxp
+   *
+   * @Description:
+   *   Loads the maximum profile into a face object.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     The input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_maxp( TT_Face    face,
                      FT_Stream  stream )
@@ -784,22 +802,24 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_name                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the name records.                                            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_name
+   *
+   * @Description:
+   *   Loads the name records.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     The input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_name( TT_Face    face,
                      FT_Stream  stream )
@@ -981,17 +1001,18 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_free_name                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Frees the name records.                                            */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A handle to the target face object.                        */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_free_name
+   *
+   * @Description:
+   *   Frees the name records.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   */
   FT_LOCAL_DEF( void )
   tt_face_free_name( TT_Face  face )
   {
@@ -1030,23 +1051,25 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_cmap                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the cmap directory in a face object.  The cmaps themselves   */
-  /*    are loaded on demand in the `ttcmap.c' module.                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the input stream.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_cmap
+   *
+   * @Description:
+   *   Loads the cmap directory in a face object.  The cmaps themselves
+   *   are loaded on demand in the `ttcmap.c' module.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     A handle to the input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
 
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_cmap( TT_Face    face,
@@ -1068,22 +1091,24 @@
 
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_os2                                                   */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the OS2 table.                                               */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the input stream.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_os2
+   *
+   * @Description:
+   *   Loads the OS2 table.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     A handle to the input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_os2( TT_Face    face,
                     FT_Stream  stream )
@@ -1228,22 +1253,24 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_postscript                                            */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the Postscript table.                                        */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the input stream.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_postscript
+   *
+   * @Description:
+   *   Loads the Postscript table.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     A handle to the input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_post( TT_Face    face,
                      FT_Stream  stream )
@@ -1288,22 +1315,24 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_pclt                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the PCL 5 Table.                                             */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: A handle to the input stream.                            */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_pclt
+   *
+   * @Description:
+   *   Loads the PCL 5 Table.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     A handle to the input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_pclt( TT_Face    face,
                      FT_Stream  stream )
@@ -1349,22 +1378,24 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    tt_face_load_gasp                                                  */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Loads the `gasp' table into a face object.                         */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face   :: A handle to the target face object.                      */
-  /*                                                                       */
-  /*    stream :: The input stream.                                        */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
+  /**************************************************************************
+   *
+   * @Function:
+   *   tt_face_load_gasp
+   *
+   * @Description:
+   *   Loads the `gasp' table into a face object.
+   *
+   * @Input:
+   *   face ::
+   *     A handle to the target face object.
+   *
+   *   stream ::
+   *     The input stream.
+   *
+   * @Return:
+   *   FreeType error code.  0 means success.
+   */
   FT_LOCAL_DEF( FT_Error )
   tt_face_load_gasp( TT_Face    face,
                      FT_Stream  stream )