src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c
changeset 54876 da3834261f0c
parent 50479 70e706c85f1d
equal deleted inserted replaced
54875:bcfedddcf4ce 54876:da3834261f0c
     1 /***************************************************************************/
     1 /****************************************************************************
     2 /*                                                                         */
     2  *
     3 /*  ttsbit.c                                                               */
     3  * ttsbit.c
     4 /*                                                                         */
     4  *
     5 /*    TrueType and OpenType embedded bitmap support (body).                */
     5  *   TrueType and OpenType embedded bitmap support (body).
     6 /*                                                                         */
     6  *
     7 /*  Copyright 2005-2018 by                                                 */
     7  * Copyright (C) 2005-2019 by
     8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
     8  * David Turner, Robert Wilhelm, and Werner Lemberg.
     9 /*                                                                         */
     9  *
    10 /*  Copyright 2013 by Google, Inc.                                         */
    10  * Copyright 2013 by Google, Inc.
    11 /*  Google Author(s): Behdad Esfahbod.                                     */
    11  * Google Author(s): Behdad Esfahbod.
    12 /*                                                                         */
    12  *
    13 /*  This file is part of the FreeType project, and may only be used,       */
    13  * This file is part of the FreeType project, and may only be used,
    14 /*  modified, and distributed under the terms of the FreeType project      */
    14  * modified, and distributed under the terms of the FreeType project
    15 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    15  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
    16 /*  this file you indicate that you have read the license and              */
    16  * this file you indicate that you have read the license and
    17 /*  understand and accept it fully.                                        */
    17  * understand and accept it fully.
    18 /*                                                                         */
    18  *
    19 /***************************************************************************/
    19  */
    20 
    20 
    21 
    21 
    22 #include <ft2build.h>
    22 #include <ft2build.h>
    23 #include FT_INTERNAL_DEBUG_H
    23 #include FT_INTERNAL_DEBUG_H
    24 #include FT_INTERNAL_STREAM_H
    24 #include FT_INTERNAL_STREAM_H
    34 
    34 
    35 #include "ttmtx.h"
    35 #include "ttmtx.h"
    36 #include "pngshim.h"
    36 #include "pngshim.h"
    37 
    37 
    38 
    38 
    39   /*************************************************************************/
    39   /**************************************************************************
    40   /*                                                                       */
    40    *
    41   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
    41    * The macro FT_COMPONENT is used in trace mode.  It is an implicit
    42   /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
    42    * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
    43   /* messages during execution.                                            */
    43    * messages during execution.
    44   /*                                                                       */
    44    */
    45 #undef  FT_COMPONENT
    45 #undef  FT_COMPONENT
    46 #define FT_COMPONENT  trace_ttsbit
    46 #define FT_COMPONENT  ttsbit
    47 
    47 
    48 
    48 
    49   FT_LOCAL_DEF( FT_Error )
    49   FT_LOCAL_DEF( FT_Error )
    50   tt_face_load_sbit( TT_Face    face,
    50   tt_face_load_sbit( TT_Face    face,
    51                      FT_Stream  stream )
    51                      FT_Stream  stream )
   127           error = FT_THROW( Invalid_File_Format );
   127           error = FT_THROW( Invalid_File_Format );
   128           goto Exit;
   128           goto Exit;
   129         }
   129         }
   130 
   130 
   131         /*
   131         /*
   132          *  Count the number of strikes available in the table.  We are a bit
   132          * Count the number of strikes available in the table.  We are a bit
   133          *  paranoid there and don't trust the data.
   133          * paranoid there and don't trust the data.
   134          */
   134          */
   135         count = (FT_UInt)num_strikes;
   135         count = (FT_UInt)num_strikes;
   136         if ( 8 + 48UL * count > table_size )
   136         if ( 8 + 48UL * count > table_size )
   137           count = (FT_UInt)( ( table_size - 8 ) / 48 );
   137           count = (FT_UInt)( ( table_size - 8 ) / 48 );
   138 
   138 
   180                       " sbix overlay not supported yet\n"
   180                       " sbix overlay not supported yet\n"
   181                       "                          "
   181                       "                          "
   182                       " expect bad rendering results\n" ));
   182                       " expect bad rendering results\n" ));
   183 
   183 
   184         /*
   184         /*
   185          *  Count the number of strikes available in the table.  We are a bit
   185          * Count the number of strikes available in the table.  We are a bit
   186          *  paranoid there and don't trust the data.
   186          * paranoid there and don't trust the data.
   187          */
   187          */
   188         count = (FT_UInt)num_strikes;
   188         count = (FT_UInt)num_strikes;
   189         if ( 8 + 4UL * count > table_size )
   189         if ( 8 + 4UL * count > table_size )
   190           count = (FT_UInt)( ( table_size - 8 ) / 4 );
   190           count = (FT_UInt)( ( table_size - 8 ) / 4 );
   191 
   191 
  1012                 num_components == 1 ? "" : "s" ));
  1012                 num_components == 1 ? "" : "s" ));
  1013 
  1013 
  1014     for ( nn = 0; nn < num_components; nn++ )
  1014     for ( nn = 0; nn < num_components; nn++ )
  1015     {
  1015     {
  1016       FT_UInt  gindex = FT_NEXT_USHORT( p );
  1016       FT_UInt  gindex = FT_NEXT_USHORT( p );
  1017       FT_Byte  dx     = FT_NEXT_BYTE( p );
  1017       FT_Char  dx     = FT_NEXT_CHAR( p );
  1018       FT_Byte  dy     = FT_NEXT_BYTE( p );
  1018       FT_Char  dy     = FT_NEXT_CHAR( p );
  1019 
  1019 
  1020 
  1020 
  1021       /* NB: a recursive call */
  1021       /* NB: a recursive call */
  1022       error = tt_sbit_decoder_load_image( decoder,
  1022       error = tt_sbit_decoder_load_image( decoder,
  1023                                           gindex,
  1023                                           gindex,