From 5ac5b79aa7f3d5c739e089aaed24069ff3f2e84b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 9 May 2020 16:50:31 +1000 Subject: [PATCH] Day 481 of removing unused freetype code Remove the unused Sfnt table stuff --- src/freetype/freetype.h | 1 - src/freetype/ftobjs.c | 70 -------------- src/freetype/sfdriver.c | 89 +---------------- src/freetype/svsfnt.h | 88 ----------------- src/freetype/tttables.h | 207 ---------------------------------------- 5 files changed, 1 insertion(+), 454 deletions(-) delete mode 100644 src/freetype/svsfnt.h diff --git a/src/freetype/freetype.h b/src/freetype/freetype.h index b1c97b067..46b05d62b 100644 --- a/src/freetype/freetype.h +++ b/src/freetype/freetype.h @@ -1049,7 +1049,6 @@ FT_BEGIN_HEADER FT_ListRec sizes_list; FT_Generic autohint; /* face-specific auto-hinter data */ - void* extensions; /* unused */ FT_Face_Internal internal; diff --git a/src/freetype/ftobjs.c b/src/freetype/ftobjs.c index 8ca4f0f64..7b5275f3f 100644 --- a/src/freetype/ftobjs.c +++ b/src/freetype/ftobjs.c @@ -33,7 +33,6 @@ #include FT_TRUETYPE_IDS_H #include FT_SERVICE_PROPERTIES_H -#include FT_SERVICE_SFNT_H #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_TT_CMAP_H @@ -2792,75 +2791,6 @@ } - /* documentation is in tttables.h */ - - FT_EXPORT_DEF( void* ) - FT_Get_Sfnt_Table( FT_Face face, - FT_Sfnt_Tag tag ) - { - void* table = NULL; - FT_Service_SFNT_Table service; - - - if ( face && FT_IS_SFNT( face ) ) - { - FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); - if ( service ) - table = service->get_table( face, tag ); - } - - return table; - } - - - /* documentation is in tttables.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Load_Sfnt_Table( FT_Face face, - FT_ULong tag, - FT_Long offset, - FT_Byte* buffer, - FT_ULong* length ) - { - FT_Service_SFNT_Table service; - - - if ( !face || !FT_IS_SFNT( face ) ) - return FT_THROW( Invalid_Face_Handle ); - - FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); - if ( !service ) - return FT_THROW( Unimplemented_Feature ); - - return service->load_table( face, tag, offset, buffer, length ); - } - - - /* documentation is in tttables.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Sfnt_Table_Info( FT_Face face, - FT_UInt table_index, - FT_ULong *tag, - FT_ULong *length ) - { - FT_Service_SFNT_Table service; - FT_ULong offset; - - - /* test for valid `length' delayed to `service->table_info' */ - - if ( !face || !FT_IS_SFNT( face ) ) - return FT_THROW( Invalid_Face_Handle ); - - FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); - if ( !service ) - return FT_THROW( Unimplemented_Feature ); - - return service->table_info( face, table_index, tag, &offset, length ); - } - - /* documentation is in tttables.h */ FT_EXPORT_DEF( FT_Long ) diff --git a/src/freetype/sfdriver.c b/src/freetype/sfdriver.c index 119c822b9..c4dcf6d75 100644 --- a/src/freetype/sfdriver.c +++ b/src/freetype/sfdriver.c @@ -40,7 +40,6 @@ #include "ttmtx.h" #include FT_SERVICE_GLYPH_DICT_H -#include FT_SERVICE_SFNT_H #include FT_SERVICE_TT_CMAP_H #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -59,91 +58,6 @@ #define FT_COMPONENT trace_sfdriver - /* - * SFNT TABLE SERVICE - * - */ - - static void* - get_sfnt_table( TT_Face face, - FT_Sfnt_Tag tag ) - { - void* table; - - - switch ( tag ) - { - case FT_SFNT_HEAD: - table = &face->header; - break; - - case FT_SFNT_HHEA: - table = &face->horizontal; - break; - - case FT_SFNT_VHEA: - table = face->vertical_info ? &face->vertical : NULL; - break; - - case FT_SFNT_OS2: - table = ( face->os2.version == 0xFFFFU ) ? NULL : &face->os2; - break; - - case FT_SFNT_POST: - table = &face->postscript; - break; - - case FT_SFNT_MAXP: - table = &face->max_profile; - break; - - case FT_SFNT_PCLT: - table = face->pclt.Version ? &face->pclt : NULL; - break; - - default: - table = NULL; - } - - return table; - } - - - static FT_Error - sfnt_table_info( TT_Face face, - FT_UInt idx, - FT_ULong *tag, - FT_ULong *offset, - FT_ULong *length ) - { - if ( !offset || !length ) - return FT_THROW( Invalid_Argument ); - - if ( !tag ) - *length = face->num_tables; - else - { - if ( idx >= face->num_tables ) - return FT_THROW( Table_Missing ); - - *tag = face->dir_tables[idx].Tag; - *offset = face->dir_tables[idx].Offset; - *length = face->dir_tables[idx].Length; - } - - return FT_Err_Ok; - } - - - FT_DEFINE_SERVICE_SFNT_TABLEREC( - sfnt_service_sfnt_table, - - (FT_SFNT_TableLoadFunc)tt_face_load_any, /* load_table */ - (FT_SFNT_TableGetFunc) get_sfnt_table, /* get_table */ - (FT_SFNT_TableInfoFunc)sfnt_table_info /* table_info */ - ) - - #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES /* @@ -193,10 +107,9 @@ */ #if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES - FT_DEFINE_SERVICEDESCREC3( + FT_DEFINE_SERVICEDESCREC2( sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table, FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict, FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info ) #else diff --git a/src/freetype/svsfnt.h b/src/freetype/svsfnt.h deleted file mode 100644 index 670f5e607..000000000 --- a/src/freetype/svsfnt.h +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************/ -/* */ -/* svsfnt.h */ -/* */ -/* The FreeType SFNT table loading service (specification). */ -/* */ -/* Copyright 2003-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. */ -/* */ -/***************************************************************************/ - - -#ifndef SVSFNT_H_ -#define SVSFNT_H_ - -#include FT_INTERNAL_SERVICE_H -#include FT_TRUETYPE_TABLES_H - - -FT_BEGIN_HEADER - - - /* - * SFNT table loading service. - */ - -#define FT_SERVICE_ID_SFNT_TABLE "sfnt-table" - - - /* - * Used to implement FT_Load_Sfnt_Table(). - */ - typedef FT_Error - (*FT_SFNT_TableLoadFunc)( FT_Face face, - FT_ULong tag, - FT_Long offset, - FT_Byte* buffer, - FT_ULong* length ); - - /* - * Used to implement FT_Get_Sfnt_Table(). - */ - typedef void* - (*FT_SFNT_TableGetFunc)( FT_Face face, - FT_Sfnt_Tag tag ); - - - /* - * Used to implement FT_Sfnt_Table_Info(). - */ - typedef FT_Error - (*FT_SFNT_TableInfoFunc)( FT_Face face, - FT_UInt idx, - FT_ULong *tag, - FT_ULong *offset, - FT_ULong *length ); - - - FT_DEFINE_SERVICE( SFNT_Table ) - { - FT_SFNT_TableLoadFunc load_table; - FT_SFNT_TableGetFunc get_table; - FT_SFNT_TableInfoFunc table_info; - }; - - -#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \ - static const FT_Service_SFNT_TableRec class_ = \ - { \ - load_, get_, info_ \ - }; - - /* */ - - -FT_END_HEADER - - -#endif /* SVSFNT_H_ */ - - -/* END */ diff --git a/src/freetype/tttables.h b/src/freetype/tttables.h index 17c178024..495b74863 100644 --- a/src/freetype/tttables.h +++ b/src/freetype/tttables.h @@ -578,213 +578,6 @@ FT_BEGIN_HEADER } TT_MaxProfile; - /*************************************************************************/ - /* */ - /* */ - /* FT_Sfnt_Tag */ - /* */ - /* */ - /* An enumeration to specify indices of SFNT tables loaded and parsed */ - /* by FreeType during initialization of an SFNT font. Used in the */ - /* @FT_Get_Sfnt_Table API function. */ - /* */ - /* */ - /* FT_SFNT_HEAD :: To access the font's @TT_Header structure. */ - /* */ - /* FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure. */ - /* */ - /* FT_SFNT_OS2 :: To access the font's @TT_OS2 structure. */ - /* */ - /* FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure. */ - /* */ - /* FT_SFNT_VHEA :: To access the font's @TT_VertHeader structure. */ - /* */ - /* FT_SFNT_POST :: To access the font's @TT_Postscript structure. */ - /* */ - /* FT_SFNT_PCLT :: To access the font's @TT_PCLT structure. */ - /* */ - typedef enum FT_Sfnt_Tag_ - { - FT_SFNT_HEAD, - FT_SFNT_MAXP, - FT_SFNT_OS2, - FT_SFNT_HHEA, - FT_SFNT_VHEA, - FT_SFNT_POST, - FT_SFNT_PCLT, - - FT_SFNT_MAX - - } FT_Sfnt_Tag; - - /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */ - /* values instead */ -#define ft_sfnt_head FT_SFNT_HEAD -#define ft_sfnt_maxp FT_SFNT_MAXP -#define ft_sfnt_os2 FT_SFNT_OS2 -#define ft_sfnt_hhea FT_SFNT_HHEA -#define ft_sfnt_vhea FT_SFNT_VHEA -#define ft_sfnt_post FT_SFNT_POST -#define ft_sfnt_pclt FT_SFNT_PCLT - - - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Sfnt_Table */ - /* */ - /* */ - /* Return a pointer to a given SFNT table stored within a face. */ - /* */ - /* */ - /* face :: A handle to the source. */ - /* */ - /* tag :: The index of the SFNT table. */ - /* */ - /* */ - /* A type-less pointer to the table. This will be NULL in case of */ - /* error, or if the corresponding table was not found *OR* loaded */ - /* from the file. */ - /* */ - /* Use a typecast according to `tag' to access the structure */ - /* elements. */ - /* */ - /* */ - /* The table is owned by the face object and disappears with it. */ - /* */ - /* This function is only useful to access SFNT tables that are loaded */ - /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ - /* a list. */ - /* */ - /* Here an example how to access the `vhea' table: */ - /* */ - /* { */ - /* TT_VertHeader* vert_header; */ - /* */ - /* */ - /* vert_header = */ - /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */ - /* } */ - /* */ - FT_EXPORT( void* ) - FT_Get_Sfnt_Table( FT_Face face, - FT_Sfnt_Tag tag ); - - - /************************************************************************** - * - * @function: - * FT_Load_Sfnt_Table - * - * @description: - * Load any SFNT font table into client memory. - * - * @input: - * face :: - * A handle to the source face. - * - * tag :: - * The four-byte tag of the table to load. Use value~0 if you want - * to access the whole font file. Otherwise, you can use one of the - * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new - * one with @FT_MAKE_TAG. - * - * offset :: - * The starting offset in the table (or file if tag~==~0). - * - * @output: - * buffer :: - * The target buffer address. The client must ensure that the memory - * array is big enough to hold the data. - * - * @inout: - * length :: - * If the `length' parameter is NULL, try to load the whole table. - * Return an error code if it fails. - * - * Else, if `*length' is~0, exit immediately while returning the - * table's (or file) full size in it. - * - * Else the number of bytes to read from the table or file, from the - * starting offset. - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * If you need to determine the table's length you should first call this - * function with `*length' set to~0, as in the following example: - * - * { - * FT_ULong length = 0; - * - * - * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); - * if ( error ) { ... table does not exist ... } - * - * buffer = malloc( length ); - * if ( buffer == NULL ) { ... not enough memory ... } - * - * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); - * if ( error ) { ... could not load table ... } - * } - * - * Note that structures like @TT_Header or @TT_OS2 can't be used with - * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that - * those structures depend on the processor architecture, with varying - * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian). - * - */ - FT_EXPORT( FT_Error ) - FT_Load_Sfnt_Table( FT_Face face, - FT_ULong tag, - FT_Long offset, - FT_Byte* buffer, - FT_ULong* length ); - - - /************************************************************************** - * - * @function: - * FT_Sfnt_Table_Info - * - * @description: - * Return information on an SFNT table. - * - * @input: - * face :: - * A handle to the source face. - * - * table_index :: - * The index of an SFNT table. The function returns - * FT_Err_Table_Missing for an invalid value. - * - * @inout: - * tag :: - * The name tag of the SFNT table. If the value is NULL, `table_index' - * is ignored, and `length' returns the number of SFNT tables in the - * font. - * - * @output: - * length :: - * The length of the SFNT table (or the number of SFNT tables, depending - * on `tag'). - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * While parsing fonts, FreeType handles SFNT tables with length zero as - * missing. - * - */ - FT_EXPORT( FT_Error ) - FT_Sfnt_Table_Info( FT_Face face, - FT_UInt table_index, - FT_ULong *tag, - FT_ULong *length ); - - /*************************************************************************/ /* */ /* */