Day 481 of removing unused freetype code

Remove the unused Sfnt table stuff
This commit is contained in:
UnknownShadow200 2020-05-09 16:50:31 +10:00
parent 96676fb374
commit 5ac5b79aa7
5 changed files with 1 additions and 454 deletions

View File

@ -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;

View File

@ -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 )

View File

@ -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

View File

@ -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 */

View File

@ -578,213 +578,6 @@ FT_BEGIN_HEADER
} TT_MaxProfile;
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Sfnt_Tag */
/* */
/* <Description> */
/* 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. */
/* */
/* <Values> */
/* 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
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Sfnt_Table */
/* */
/* <Description> */
/* Return a pointer to a given SFNT table stored within a face. */
/* */
/* <Input> */
/* face :: A handle to the source. */
/* */
/* tag :: The index of the SFNT table. */
/* */
/* <Return> */
/* 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. */
/* */
/* <Note> */
/* 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 );
/*************************************************************************/
/* */
/* <Function> */