forked from minhngoc25a/freetype2
s/FT_Palette/FT_Palette_Data/, s/palette/palette_data/.
* include/freetype/ftcolor.h, include/freetype/internal/tttypes.h, src/base/ftcolor.c, src/sfnt/sfobjs.c, src/sfnt/ttcolr.c: Updated.
This commit is contained in:
parent
bfbde7926f
commit
d8b8b6e34e
|
@ -1,3 +1,10 @@
|
|||
2018-06-10 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
s/FT_Palette/FT_Palette_Data/, s/palette/palette_data/.
|
||||
|
||||
* include/freetype/ftcolor.h, include/freetype/internal/tttypes.h,
|
||||
src/base/ftcolor.c, src/sfnt/sfobjs.c, src/sfnt/ttcolr.c: Updated.
|
||||
|
||||
2018-06-10 Nikolaus Waxweiler <madigens@gmail.com>
|
||||
|
||||
CMakeLists: also accept IOS_PLATFORM=SIMULATOR64
|
||||
|
|
|
@ -93,8 +93,8 @@ FT_BEGIN_HEADER
|
|||
*
|
||||
* @description:
|
||||
* A list of bit field constants used in the `palette_types' array of
|
||||
* the @FT_Palette structure to indicate for which background a palette
|
||||
* with a given index is usable.
|
||||
* the @FT_Palette_Data structure to indicate for which background a
|
||||
* palette with a given index is usable.
|
||||
*
|
||||
* @values:
|
||||
* FT_PALETTE_USABLE_WITH_LIGHT_BACKGROUND ::
|
||||
|
@ -115,7 +115,7 @@ FT_BEGIN_HEADER
|
|||
/**************************************************************************
|
||||
*
|
||||
* @struct:
|
||||
* FT_Palette
|
||||
* FT_Palette_Data
|
||||
*
|
||||
* @description:
|
||||
* This structure holds the data of the `CPAL' table.
|
||||
|
@ -167,7 +167,7 @@ FT_BEGIN_HEADER
|
|||
* @since:
|
||||
* 2.10
|
||||
*/
|
||||
typedef struct FT_Palette_ {
|
||||
typedef struct FT_Palette_Data_ {
|
||||
FT_UShort num_palettes;
|
||||
const FT_UShort* palette_name_ids;
|
||||
const FT_UShort* palette_types;
|
||||
|
@ -175,13 +175,13 @@ FT_BEGIN_HEADER
|
|||
FT_UShort num_palette_entries;
|
||||
const FT_UShort* palette_entry_name_ids;
|
||||
|
||||
} FT_Palette;
|
||||
} FT_Palette_Data;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @func:
|
||||
* FT_Palette_Get
|
||||
* FT_Palette_Data_Get
|
||||
*
|
||||
* @description:
|
||||
* Retrieve the face's color palette data.
|
||||
|
@ -192,13 +192,13 @@ FT_BEGIN_HEADER
|
|||
*
|
||||
* @output:
|
||||
* apalette ::
|
||||
* A pointer to an @FT_Palette structure.
|
||||
* A pointer to an @FT_Palette_Data structure.
|
||||
*
|
||||
* @return:
|
||||
* FreeType error code. 0~means success.
|
||||
*
|
||||
* @note:
|
||||
* All arrays in the returned @FT_Palette structure are read-only.
|
||||
* All arrays in the returned @FT_Palette_Data structure are read-only.
|
||||
*
|
||||
* This function always returns an error if the config macro
|
||||
* `TT_CONFIG_OPTION_COLOR_LAYERS' is not defined in `ftoption.h'.
|
||||
|
@ -207,8 +207,8 @@ FT_BEGIN_HEADER
|
|||
* 2.10
|
||||
*/
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_Palette_Get( FT_Face face,
|
||||
FT_Palette *apalette );
|
||||
FT_Palette_Data_Get( FT_Face face,
|
||||
FT_Palette_Data *apalette );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -243,12 +243,14 @@ FT_BEGIN_HEADER
|
|||
* If `apalette_entries' is set to NULL, no array gets returned (and
|
||||
* no color entries can be modified).
|
||||
*
|
||||
* In case the font doesn't support color palettes, NULL is returned.
|
||||
*
|
||||
* @return:
|
||||
* FreeType error code. 0~means success.
|
||||
*
|
||||
* @note:
|
||||
* The number of color entries is given by the `num_palette_entries'
|
||||
* field in the @FT_Palette structure.
|
||||
* field in the @FT_Palette_Data structure.
|
||||
*
|
||||
* The array pointed to by `apalette_entries' is owned and managed by
|
||||
* FreeType.
|
||||
|
|
|
@ -1659,7 +1659,7 @@ FT_BEGIN_HEADER
|
|||
TT_Post_NamesRec postscript_names;
|
||||
|
||||
/* glyph colors */
|
||||
FT_Palette palette; /* since 2.10 */
|
||||
FT_Palette_Data palette_data; /* since 2.10 */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
|
|
@ -25,24 +25,24 @@
|
|||
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
|
||||
|
||||
static
|
||||
const FT_Palette null_palette = { 0, NULL, NULL, 0, NULL };
|
||||
const FT_Palette_Data null_palette_data = { 0, NULL, NULL, 0, NULL };
|
||||
|
||||
|
||||
/* documentation is in ftcolor.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Get( FT_Face face,
|
||||
FT_Palette *apalette )
|
||||
FT_Palette_Data_Get( FT_Face face,
|
||||
FT_Palette_Data *apalette_data )
|
||||
{
|
||||
if ( !face )
|
||||
return FT_THROW( Invalid_Face_Handle );
|
||||
if ( !apalette)
|
||||
if ( !apalette_data)
|
||||
return FT_THROW( Invalid_Argument );
|
||||
|
||||
if ( FT_IS_SFNT( face ) )
|
||||
*apalette = ( (TT_Face)face )->palette;
|
||||
*apalette_data = ( (TT_Face)face )->palette_data;
|
||||
else
|
||||
*apalette = null_palette;
|
||||
*apalette_data = null_palette_data;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
@ -50,8 +50,8 @@
|
|||
#else /* !TT_CONFIG_OPTION_COLOR_LAYERS */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Palette_Get( FT_Face face,
|
||||
FT_Palette *apalette )
|
||||
FT_Palette_Data_Get( FT_Face face,
|
||||
FT_Palette_Data *apalette_data )
|
||||
{
|
||||
FT_UNUSED( face );
|
||||
FT_UNUSED( apalette );
|
||||
|
|
|
@ -1809,9 +1809,9 @@
|
|||
#endif
|
||||
|
||||
/* freeing glyph color palette data */
|
||||
FT_FREE( face->palette.palette_name_ids );
|
||||
FT_FREE( face->palette.palette_types );
|
||||
FT_FREE( face->palette.palette_entry_name_ids );
|
||||
FT_FREE( face->palette_data.palette_name_ids );
|
||||
FT_FREE( face->palette_data.palette_types );
|
||||
FT_FREE( face->palette_data.palette_entry_name_ids );
|
||||
|
||||
face->sfnt = NULL;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
} Colr;
|
||||
|
||||
|
||||
/* all data from `CPAL' not covered in FT_Palette */
|
||||
/* all data from `CPAL' not covered in FT_Palette_Data */
|
||||
typedef struct Cpal_
|
||||
{
|
||||
FT_UShort version; /* Table version number (0 or 1 supported). */
|
||||
|
@ -186,8 +186,8 @@
|
|||
if ( cpal.version > 1 )
|
||||
goto InvalidTable;
|
||||
|
||||
face->palette.num_palette_entries = FT_NEXT_USHORT( p );
|
||||
face->palette.num_palettes = FT_NEXT_USHORT( p );
|
||||
face->palette_data.num_palette_entries = FT_NEXT_USHORT( p );
|
||||
face->palette_data.num_palettes = FT_NEXT_USHORT( p );
|
||||
|
||||
cpal.num_colors = FT_NEXT_USHORT( p );
|
||||
colors_offset = FT_NEXT_ULONG( p );
|
||||
|
@ -208,7 +208,7 @@
|
|||
FT_UShort* q;
|
||||
|
||||
|
||||
p += face->palette.num_palettes * 2;
|
||||
p += face->palette_data.num_palettes * 2;
|
||||
|
||||
type_offset = FT_NEXT_ULONG( p );
|
||||
label_offset = FT_NEXT_ULONG( p );
|
||||
|
@ -218,61 +218,64 @@
|
|||
{
|
||||
if ( type_offset >= table_size )
|
||||
goto InvalidTable;
|
||||
if ( face->palette.num_palettes * 2 > table_size - type_offset )
|
||||
if ( face->palette_data.num_palettes * 2 >
|
||||
table_size - type_offset )
|
||||
goto InvalidTable;
|
||||
|
||||
if ( FT_QNEW_ARRAY( array, face->palette.num_palettes ) )
|
||||
if ( FT_QNEW_ARRAY( array, face->palette_data.num_palettes ) )
|
||||
goto NoColor;
|
||||
|
||||
p = cpal_table + type_offset;
|
||||
q = array;
|
||||
limit = q + face->palette.num_palettes * sizeof ( FT_UShort );
|
||||
limit = q + face->palette_data.num_palettes * sizeof ( FT_UShort );
|
||||
|
||||
while ( q < limit )
|
||||
*q++ = FT_NEXT_USHORT( p );
|
||||
|
||||
face->palette.palette_types = array;
|
||||
face->palette_data.palette_types = array;
|
||||
}
|
||||
|
||||
if ( label_offset )
|
||||
{
|
||||
if ( label_offset >= table_size )
|
||||
goto InvalidTable;
|
||||
if ( face->palette.num_palettes * 2 > table_size - label_offset )
|
||||
if ( face->palette_data.num_palettes * 2 >
|
||||
table_size - label_offset )
|
||||
goto InvalidTable;
|
||||
|
||||
if ( FT_QNEW_ARRAY( array, face->palette.num_palettes ) )
|
||||
if ( FT_QNEW_ARRAY( array, face->palette_data.num_palettes ) )
|
||||
goto NoColor;
|
||||
|
||||
p = cpal_table + label_offset;
|
||||
q = array;
|
||||
limit = q + face->palette.num_palettes * sizeof ( FT_UShort );
|
||||
limit = q + face->palette_data.num_palettes * sizeof ( FT_UShort );
|
||||
|
||||
while ( q < limit )
|
||||
*q++ = FT_NEXT_USHORT( p );
|
||||
|
||||
face->palette.palette_name_ids = array;
|
||||
face->palette_data.palette_name_ids = array;
|
||||
}
|
||||
|
||||
if ( entry_label_offset )
|
||||
{
|
||||
if ( entry_label_offset >= table_size )
|
||||
goto InvalidTable;
|
||||
if ( face->palette.num_palette_entries * 2 >
|
||||
if ( face->palette_data.num_palette_entries * 2 >
|
||||
table_size - entry_label_offset )
|
||||
goto InvalidTable;
|
||||
|
||||
if ( FT_QNEW_ARRAY( array, face->palette.num_palette_entries ) )
|
||||
if ( FT_QNEW_ARRAY( array, face->palette_data.num_palette_entries ) )
|
||||
goto NoColor;
|
||||
|
||||
p = cpal_table + entry_label_offset;
|
||||
q = array;
|
||||
limit = q + face->palette.num_palette_entries * sizeof ( FT_UShort );
|
||||
limit = q + face->palette_data.num_palette_entries *
|
||||
sizeof ( FT_UShort );
|
||||
|
||||
while ( q < limit )
|
||||
*q++ = FT_NEXT_USHORT( p );
|
||||
|
||||
face->palette.palette_entry_name_ids = array;
|
||||
face->palette_data.palette_entry_name_ids = array;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +298,7 @@
|
|||
FT_FRAME_RELEASE( colr_table );
|
||||
FT_FRAME_RELEASE( cpal_table );
|
||||
|
||||
/* arrays in `face->palette' are freed in `sfnt_face_done' */
|
||||
/* arrays in `face->palette_data' are freed in `sfnt_face_done' */
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -401,8 +404,8 @@
|
|||
FT_UShort palette_index = FT_NEXT_USHORT( layer_record_ptr );
|
||||
|
||||
|
||||
if ( palette_index != 0xFFFF &&
|
||||
palette_index >= face->palette.num_palette_entries )
|
||||
if ( palette_index != 0xFFFF &&
|
||||
palette_index >= face->palette_data.num_palette_entries )
|
||||
{
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
goto Error;
|
||||
|
@ -441,7 +444,7 @@
|
|||
FT_Int color_offset;
|
||||
|
||||
|
||||
if ( color_index >= face->palette.num_palette_entries )
|
||||
if ( color_index >= face->palette_data.num_palette_entries )
|
||||
return 0;
|
||||
|
||||
p = cpal->color_indices + palette_index * (int)sizeof ( FT_UShort );
|
||||
|
|
Loading…
Reference in New Issue