ref: 2fce88c6b97a781fd24292dd9a8376d87727c174
parent: 17ae985d3838bb4f83644ecad27a87a1a8730a4c
author: David Turner <[email protected]>
date: Fri Jan 7 09:01:59 EST 2000
Removed some unused source code (it came from the old FT2 beta, and was moved to "src/sfn")
--- a/src/shared/otlayout/otlayout.h
+++ /dev/null
@@ -1,372 +1,0 @@
-/***************************************************************************/
-/* */
-/* otlayout.h */
-/* */
-/* OpenType layout type definitions (specification only). */
-/* */
-/* Copyright 1996-1999 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 OTLAYOUT_H
-#define OTLAYOUT_H
-
-#include <tttypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_LangSys */
- /* */
- /* <Description> */
- /* An OTL LangSys record. */
- /* */
- /* <Fields> */
- /* lang_tag :: The language tag. */
- /* lang_offset :: The offset of the langsys data in the
- /* resource. */
- /* */
- /* lookup_order :: Always 0 for OTL 1.0. */
- /* req_feature_index :: The `required feature' index. */
- /* num_feature_indices :: The number of feature indices. */
- /* feature_indices :: An array of feature indices. */
- /* */
- typedef struct OTL_LangSys_
- {
- TT_ULong lang_tag;
- TT_ULong lang_offset;
-
- TT_UShort lookup_order; /* always 0 for TT Open 1.0 */
- TT_UShort req_feature_index; /* required FeatureIndex */
- TT_UShort num_feature_indices; /* number of Feature indices */
- TT_UShort* feature_indices; /* array of Feature indices */
-
- } OTL_LangSys;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Script */
- /* */
- /* <Description> */
- /* An OTL Script record. */
- /* */
- /* <Fields> */
- /* script_tag :: The script tag. */
- /* script_offset :: The offset of the script data in the resource. */
- /* */
- /* num_langsys :: The number of langsys records. */
- /* langsys :: An array of langsys records. */
- /* langsys_default :: A pointer to the default langsys table for this */
- /* script. */
- /* */
- typedef struct OTL_Script_
- {
- TT_ULong script_tag;
- TT_ULong script_offset;
-
- TT_UShort num_langsys;
- OTL_LangSys* langsys;
- OTL_LangSys* langsys_default;
-
- } OTL_Script;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Script_List */
- /* */
- /* <Description> */
- /* An OTL Script List record. */
- /* */
- /* <Fields> */
- /* num_scripts :: The number of scripts records. */
- /* scripts :: An array of script records. */
- /* */
- typedef struct OTL_Script_List_
- {
- TT_UShort num_scripts;
- OTL_Script* scripts;
-
- } OTL_Script_List;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Feature */
- /* */
- /* <Description> */
- /* An OTL Feature record. */
- /* */
- /* <Fields> */
- /* feature_tag :: The feature tag. */
- /* feature_offset :: The offset of the feature data in the resource. */
- /* */
- /* feature_params :: Always 0 for OpenType Layout 1.0. */
- /* num_lookups :: The number of lookup indices. */
- /* lookups :: An array of lookup indices. */
- /* */
- typedef struct OTL_Feature_
- {
- TT_ULong feature_tag;
- TT_ULong feature_offset;
-
- TT_UShort feature_params; /* always 0 for OpenType Layout 1.0 */
- TT_UShort num_lookups;
- TT_UShort* lookups;
-
- } OTL_Feature;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Feature_List */
- /* */
- /* <Description> */
- /* An OTL Feature List record. */
- /* */
- /* <Fields> */
- /* num_features :: The number of features. */
- /* features :: An array of features. */
- /* */
- typedef struct OTL_Feature_List_
- {
- TT_UShort num_features;
- OTL_Feature* features;
-
- } OTL_Feature_List;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Lookup */
- /* */
- /* <Description> */
- /* An OTL Lookup record. */
- /* */
- /* <Fields> */
- /* lookup_offset :: The offset of the lookup data in the resource. */
- /* lookup_type :: The lookup type. */
- /* lookup_flag :: The lookup bit flags. */
- /* */
- /* num_subtables :: The number of subtables. */
- /* subtable_offsets :: An array of offsets to the subtables. */
- /* subtables :: An array of pointers to the subtable records. */
- /* */
- /* <Note> */
- /* The format of each lookup sub-table is determined by the parent */
- /* OpenType table, and cannot be known here. */
- /* */
- /* The `subtable_offsets' array is filled when the lookup table is */
- /* loaded the first time. It is up to OT table handlers to read the */
- /* corresponding sub-table records and store them in the `subtables' */
- /* array. */
- /* */
- typedef struct OTL_Lookup_
- {
- TT_ULong lookup_offset;
- TT_UShort lookup_type;
- TT_UShort lookup_flag;
-
- TT_UShort num_subtables;
- TT_ULong* subtable_offsets;
- void** subtables;
-
- } OTL_Lookup;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Lookup_List */
- /* */
- /* <Description> */
- /* An OTL Lookup List record. */
- /* */
- /* <Fields> */
- /* num_lookups :: The number of lookups. */
- /* lookups :: An array of lookups. */
- /* */
- typedef struct OTL_Lookup_List_
- {
- TT_UShort num_lookups;
- OTL_Lookup* lookups;
-
- } OTL_Lookup_List;
-
-
-#define OTL_LOOKUP_FLAG_RIGHT_TO_LEFT 1
-#define OTL_LOOKUP_FLAG_IGNORE_BASE_GLYPHS 2
-#define OTL_LOOKUP_FLAG_IGNORE_LIGATURES 4
-#define OTL_LOOKUP_FLAG_IGNORE_MARKS 8
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_SubTable1 */
- /* */
- /* <Description> */
- /* The first generic OTL sub-table format. */
- /* */
- /* <Fields> */
- /* num_indices :: The number of indices. */
- /* indices :: An array of indices. */
- /* data :: A generic value. */
- /* */
- typedef struct OTL_SubTable1_
- {
- TT_UShort num_indices;
- TT_UShort* indices;
- TT_UShort data;
-
- } OTL_SubTable1;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_SubTable2_Rec */
- /* */
- /* <Description> */
- /* A record for the second generic OTL sub-table format. */
- /* */
- /* <Fields> */
- /* start :: The first element in the range. */
- /* end :: The last element in the range. */
- /* data :: A generic value. */
- /* */
- typedef struct OTL_SubTable2_Rec_
- {
- TT_UShort start;
- TT_UShort end;
- TT_UShort data;
-
- } OTL_SubTable2_Rec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_SubTable2 */
- /* */
- /* <Description> */
- /* The second generic OTL sub-table format. */
- /* */
- /* <Fields> */
- /* num_ranges :: The number of ranges. */
- /* ranges :: An array of ranges. */
- /* */
- typedef struct OTL_SubTable2_
- {
- TT_UShort num_ranges;
- OTL_SubTable2_Rec* ranges;
-
- } OTL_SubTable2;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_SubTable */
- /* */
- /* <Description> */
- /* A generic OTL sub-table which is a union of two possible formats */
- /* just defined. */
- /* */
- /* <Fields> */
- /* format :: The format of the sub-table. */
- /* set :: A union of `format1' and `format2', representing */
- /* sub-tables. */
- /* */
- typedef struct OTL_SubTable_
- {
- TT_UShort format;
-
- union
- {
- OTL_SubTable1 format1;
- OTL_SubTable2 format2;
-
- } set;
-
- } OTL_SubTable;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Coverage */
- /* */
- /* <Description> */
- /* An OTL Coverage sub-table. */
- /* */
- typedef OTL_SubTable OTL_Coverage;
- typedef OTL_SubTable1 OTL_Coverage1;
- typedef OTL_SubTable2 OTL_Coverage2;
- typedef OTL_SubTable2_Rec OTL_Coverage2_Rec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Class_Def */
- /* */
- /* <Description> */
- /* An OTL Class Definition sub-table. */
- /* */
- typedef OTL_SubTable OTL_Class_Def;
- typedef OTL_SubTable1 OTL_Class_Def1;
- typedef OTL_SubTable2 OTL_Class_Def2;
- typedef OTL_SubTable2_Rec OTL_Class_Def2_Rec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* OTL_Device */
- /* */
- /* <Description> */
- /* An OTL Device sub-table */
- /* */
- /* <Fields> */
- /* start_size :: The smallest size to correct. */
- /* end_size :: The largest size to correct. */
- /* delta_format :: The format of the `delta_values' array. */
- /* delta_values :: An array of compressed delta values. */
- typedef struct OTL_Device_
- {
- TT_UShort start_size;
- TT_UShort end_size;
- TT_UShort delta_format;
- TT_UShort* delta_values;
-
- } OTL_Device;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* OTLAYOUT_H */
-
-
-/* END */
--- a/src/shared/otlayout/otload.c
+++ /dev/null
@@ -1,890 +1,0 @@
-/***************************************************************************/
-/* */
-/* otload.c */
-/* */
-/* OpenType Layout loader (body). */
-/* */
-/* Copyright 1996-1999 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 <otlayout.h>
-#include <otload.h>
-
-#include <tterrors.h>
-
-
- /***************************
- * Script related functions
- ***************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Script_List */
- /* */
- /* <Description> */
- /* Releases a given OpenType Script list. */
- /* */
- /* <Input> */
- /* list :: The target script list. */
- /* system :: The current system object. */
- /* */
- LOCAL_FUNC
- void OTL_Free_Script_List( OTL_Script_List* list,
- FT_System system )
- {
- if ( list )
- {
- if ( list->scripts )
- {
- OTL_Script* script = list->scripts;
- OTL_Script* script_limit = script + list->num_scripts;
-
-
- for ( ; script < script_limit; script++ )
- {
- if ( script->langsys )
- {
- OTL_LangSys* langsys = script->langsys;
- OTL_LangSys* langsys_limit = langsys + script->num_langsys;
-
-
- for ( ; langsys < langsys_limit; langsys++ )
- {
- FREE( langsys->feature_indices );
- langsys->num_feature_indices = 0;
- }
- FREE( script->langsys );
- }
- script->langsys_default = NULL;
- script->num_langsys = 0;
- }
- FREE( list->scripts );
- }
- list->num_scripts = 0;
- }
- }
-
-
- static
- TT_Error Load_OTL_LangSys_List( OTL_Script* script,
- FT_Stream stream,
- TT_ULong default_offset )
- {
- FT_System system = stream->system;
- TT_Error error;
-
- TT_UShort n, count;
- OTL_LangSys* langsys;
-
-
- /* read the langsys tags and offsets */
- {
- count = script->num_langsys;
- langsys = script->langsys;
-
- if ( ACCESS_Frame( 6L * count ) )
- goto Exit;
-
- for ( n = 0; n < count; n++, langsys++ )
- {
- TT_ULong offset;
-
-
- langsys->lang_tag = GET_ULong();
- offset = GET_UShort();
-
- if ( langsys->lang_offset == default_offset )
- script->langsys_default = langsys;
-
- langsys->lang_offset = offset + script->script_offset;
- }
-
- FORGET_Frame();
- }
-
- /* now read each langsys record */
- {
- count = script->num_langsys;
- langsys = script->langsys;
-
- for ( n = 0; n < count; n++, langsys++ )
- {
- TT_UShort num_feature_indices, i;
-
-
- if ( FILE_Seek( langsys->lang_offset ) ||
- ACCESS_Frame( 8L ) )
- goto Exit;
-
- langsys->lookup_order = GET_ULong();
- langsys->req_feature_index = GET_UShort();
- langsys->num_feature_indices = GET_UShort();
-
- FORGET_Frame();
-
- num_feature_indices = langsys->num_feature_indices;
-
- if ( ALLOC_ARRAY ( langsys->feature_indices,
- num_feature_indices, TT_UShort ) ||
- ACCESS_Frame( num_feature_indices * 2L ) )
- goto Exit;
-
- for ( i = 0; i < num_feature_indices; i++ )
- langsys->feature_indices[i] = GET_UShort();
-
- FORGET_Frame();
- }
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Script_List */
- /* */
- /* <Description> */
- /* Loads an OpenType Script List from a font resource. */
- /* */
- /* <Input> */
- /* list :: The target script list. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Script_List( OTL_Script_List* list,
- FT_Stream stream )
- {
- FT_System system = stream->system;
- TT_Error error;
-
- TT_ULong start_pos;
- TT_UShort num_scripts;
- OTL_Script* scripts;
-
-
- start_pos = FILE_Pos();
-
- if ( READ_UShort( list->num_scripts ) )
- goto Exit;
-
- num_scripts = list->num_scripts;
-
- /* Allocate the scripts table, read their tags and offsets */
- {
- TT_UShort n;
-
-
- if ( ALLOC_ARRAY( list->scripts, num_scripts, OTL_Script ) ||
- ACCESS_Frame( num_scripts * 6L ) )
- goto Exit;
-
- scripts = list->scripts;
-
- for ( n = 0; n < num_scripts; n++ )
- {
- scripts[n].script_tag = GET_ULong();
- scripts[n].script_offset = GET_UShort() + start_pos;
- }
-
- FORGET_Frame();
- }
-
- /* now read each script in the table */
- {
- TT_UShort n;
- OTL_Script* script = scripts;
-
-
- for ( n = num_scripts; n > 0; n--, script++ )
- {
- TT_ULong default_langsys_offset;
-
-
- if ( FILE_Seek ( script->script_offset ) ||
- READ_ULong ( default_langsys_offset ) ||
- READ_UShort( script->num_langsys ) ||
- ALLOC_ARRAY( script->langsys,
- script->num_langsys, OTL_LangSys ) )
- goto Exit;
-
- /* read the corresponding langsys list */
- error = Load_OTL_LangSys_List(
- script,
- stream,
- default_langsys_offset + script->script_offset );
- if ( error )
- goto Exit;
- }
- }
-
- Exit:
- if ( error )
- OTL_Free_Script_List( list, system );
-
- return error;
- }
-
-
- /*********************************
- * Feature List related functions
- *********************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Features_List */
- /* */
- /* <Description> */
- /* Releases a given OpenType Features list. */
- /* */
- /* <Input> */
- /* list :: The target feature list. */
- /* system :: The current system object. */
- /* */
- LOCAL_FUNC
- void OTL_Free_Features_List( OTL_Feature_List* list,
- FT_System system )
- {
- if ( list )
- {
- if ( list->features )
- {
- OTL_Feature* feature = list->features;
- OTL_Feature* feature_limit = feature + list->num_features;
-
-
- for ( ; feature < feature_limit; feature++ )
- {
- FREE( feature->lookups );
- feature->num_lookups = 0;
- }
-
- FREE( list->features );
- }
- list->num_features = 0;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Feature_List */
- /* */
- /* <Description> */
- /* Loads an OpenType Feature List from a font resource. */
- /* */
- /* <Input> */
- /* list :: The target feature list. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Feature_List( OTL_Feature_List* list,
- FT_Stream stream )
- {
- FT_System system = stream->system;
- TT_Error error;
- TT_ULong start_pos;
- TT_UShort num_features, n;
-
-
- start_pos = FILE_Pos();
-
- if ( READ_UShort( num_features ) )
- goto Exit;
-
- /* allocate the features array and read their tag and offset */
- {
- OTL_Feature* feature;
- OTL_Feature* feature_limit;
-
-
- if ( ALLOC_ARRAY ( list->features, num_features, OTL_Feature ) ||
- ACCESS_Frame( num_features * 6L ) )
- goto Exit;
-
- list->num_features = num_features;
- feature = list->features;
- feature_limit = feature + num_features;
-
- for ( ; feature < feature_limit; feature++ )
- {
- feature->feature_tag = GET_ULong();
- feature->feature_offset = GET_UShort() + start_pos;
- }
-
- FORGET_Frame();
- }
-
- /* now read each feature */
- {
- OTL_Feature* feature;
- OTL_Feature* feature_limit;
-
-
- feature = list->features;
- feature_limit = feature + num_features;
-
- for ( ; feature < feature_limit; feature++ )
- {
- TT_UShort num_lookups;
- TT_UShort* lookup;
- TT_UShort* lookup_limit;
-
-
- if ( FILE_Seek ( feature->feature_offset ) ||
- READ_ULong ( feature->feature_params ) ||
- READ_UShort ( num_lookups ) ||
- ALLOC_ARRAY ( feature->lookups,
- num_lookups, TT_UShort ) ||
- ACCESS_Frame( num_lookups * 2L ) )
- goto Exit;
-
- feature->num_lookups = num_lookups;
- lookup = feature->lookups;
- lookup_limit = lookup + num_lookups;
-
- for ( ; lookup < lookup_limit; lookup++ )
- lookup[0] = GET_UShort();
-
- FORGET_Frame();
- }
- }
-
- Exit:
- if ( error )
- OTL_Free_Feature_List( list, system );
-
- return error;
- }
-
-
- /********************************
- * Lookup List related functions
- ********************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Iterate_Lookup_List */
- /* */
- /* <Description> */
- /* Scans an OpenType Lookup List. This can be used to load the */
- /* Lookup sub-tables in a GSUB or GPOS loader. */
- /* */
- /* <Input> */
- /* list :: The source list. */
- /* iterator :: The iterator -- a function which is called on each */
- /* element of the list. */
- /* closure :: User-specified data which is passed to each iterator */
- /* with the lookup element pointer. */
- /* */
- /* <Return> */
- /* If one iterator call returns a non-zero `result', the list parsing */
- /* is aborted and the value is returned to the caller. Otherwise, */
- /* the function returns 0 when the list has been parsed completely. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Iterate_Lookup_List( OTL_Lookup_List* list,
- OTL_Lookup_Iterator iterator,
- void* closure )
- {
- int result = 0;
-
-
- if ( list->lookups )
- {
- OTL_Lookup* lookup = list->lookups;
- OTL_Lookup* limit = lookup + list->num_lookups;
-
-
- for ( ; lookup < limit; lookup++ )
- {
- result = iterator( lookup, closure );
- if ( result )
- break;
- }
- }
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Lookup_List */
- /* */
- /* <Description> */
- /* Releases a given OpenType Lookup list. Uses a destructor called */
- /* to destroy the Lookup sub-tables. */
- /* */
- /* <Input> */
- /* list :: The target lookup list. */
- /* system :: The current system object. */
- /* destructor :: A destructor function called on each lookup element. */
- /* Can be used to destroy sub-tables. Ignored if NULL. */
- /* */
- LOCAL_FUNC
- void OTL_Free_Lookup_List( OTL_Lookup_List* list,
- FT_System system,
- OTL_Lookup_Destructor destroy )
- {
- if ( list )
- {
- if ( list->lookups )
- {
- OTL_Lookup* lookup = list->lookups;
- OTL_Lookup* limit = lookup + list->num_lookups;
-
-
- for ( ; lookup < limit; lookup++ )
- {
- if ( destroy )
- destroy( lookup, system );
-
- FREE( lookup->subtable_offsets );
- lookup->num_subtables = 0;
- }
-
- FREE( list->lookups );
- }
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Lookup_List */
- /* */
- /* <Description> */
- /* Loads an OpenType Lookup List from a font resource. */
- /* */
- /* <Input> */
- /* list :: The target lookup list. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* This function does NOT load the lookup sub-tables. Instead, it */
- /* stores the file offsets of the particular table in each lookup */
- /* element. It is up to the caller to load these sub-tables. This */
- /* can be done more easily with OTL_Iterate_Lookup_List(). */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Lookup_List( OTL_Lookup_List* list,
- FT_Stream stream )
- {
- FT_System system = stream->system;
- TT_Error error;
-
- TT_UShort num_lookups;
- TT_ULong start_pos;
-
-
- start_pos = GET_ULong();
-
- if ( READ_UShort( num_lookups ) )
- goto Exit;
-
- /* allocate the lookups array and read their tags and offset */
- {
- TT_UShort n;
-
-
- if ( ALLOC_ARRAY ( list->lookups, num_lookups, OTL_Lookup ) ||
- ACCESS_Frame( num_lookups * 2L ) )
- goto Exit;
-
- list->num_lookups = num_lookups;
- for ( n = 0; n < num_lookups; n++ )
- list->lookups[n].lookup_offset = start_pos + GET_UShort();
-
- FORGET_Frame();
- }
-
- /* now read each lookup table */
- /* NOTE that we don't load the sub-tables here, but simply */
- /* store their file offsets in the `subtable_offsets' array */
- {
- OTL_Lookup* lookup = list->lookups;
- OTL_Lookup* lookup_limit = lookup + num_lookups;
-
-
- for ( ; lookup < lookup_limit; lookup++ )
- {
- TT_UShort n, num_subtables;
- TT_ULong* offsets;
-
-
- if ( FILE_Seek ( lookup->lookup_offset ) ||
- ACCESS_Frame( 6L ) )
- goto Exit;
-
- lookup->lookup_type = GET_UShort();
- lookup->lookup_flag = GET_UShort();
- lookup->num_subtables = GET_UShort();
-
- num_subtables = lookup->num_subtables;
-
- FORGET_Frame();
-
- if ( ALLOC_ARRAY ( lookup->subtable_offsets,
- num_subtables, TT_ULong ) ||
- ACCESS_Frame( num_subtables * 2L ) )
- goto Exit;
-
- offsets = lookup->subtable_offsets;
- for ( n = 0; n < num_subtables; n++ )
- offsets[n] = lookup->lookup_offset + GET_UShort();
-
- FORGET_Frame();
- }
- }
-
- Exit:
- if ( error )
- OTL_Free_Lookup_List( list, system, 0 );
-
- return error;
- }
-
-
- /* generic sub-table freeing and loading */
-
- static
- void Free_SubTable( OTL_SubTable* subtable,
- FT_System system )
- {
- if ( subtable )
- {
- switch ( subtable->format )
- {
- case 1:
- {
- OTL_SubTable1* st = &subtable->set.format1;
-
-
- FREE( st->indices );
- st->num_indices = 0;
- FREE( st );
- }
- break;
-
- case 2:
- {
- OTL_SubTable2* st = &subtable->set.format2;
-
-
- FREE( st->ranges );
- st->num_ranges = 0;
- FREE( st );
- }
- break;
-
- default:
- break;
- }
-
- FREE( subtable );
- }
- }
-
-
- static
- TT_Error Load_SubTable( OTL_SubTable* subtable,
- FT_Stream stream )
- {
- FT_System system = stream->system;
- TT_Error error;
-
-
- if ( READ_UShort( subtable->format ) )
- goto Exit;
-
- switch ( subtable->format )
- {
- case 1:
- {
- OTL_SubTable1* st = &subtable->set.format1;
- TT_UShort num_indices, n;
-
-
- if ( READ_UShort ( num_indices ) ||
- ALLOC_ARRAY ( st->indices, num_indices, TT_UShort ) ||
- ACCESS_Frame( num_indices * 2L ) )
- goto Exit;
-
- st->num_indices = num_indices;
- for ( n = 0; n < num_indices; n++ )
- st->indices[n] = GET_UShort();
-
- FORGET_Frame();
- }
-
- case 2:
- {
- OTL_SubTable2* st = &subtable->set.format2;
- TT_UShort num_ranges, n;
- OTL_SubTable2_Rec* range;
-
-
- if ( READ_UShort( num_ranges ) ||
- ALLOC_ARRAY( st->ranges, num_ranges, OTL_SubTable2_Rec ) ||
- ACCESS_Frame( num_ranges * 6L ) )
- goto Exit;
-
- st->num_ranges = num_ranges;
- range = st->ranges;
- for ( ; num_ranges > 0; num_ranges--, range++ )
- {
- range->start = GET_UShort();
- range->end = GET_UShort();
- range->data = GET_UShort();
- }
-
- FORGET_Frame();
- }
- break;
-
- default:
- error = TT_Err_Invalid_File_Format;
- }
-
- Exit:
- if ( error )
- Free_SubTable( subtable, system );
-
- return error;
- }
-
-
- /*****************************
- * Coverage related functions
- *****************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Coverage */
- /* */
- /* <Description> */
- /* Releases a given OpenType Coverage table. */
- /* */
- /* <Input> */
- /* coverage :: The target coverage. */
- /* system :: The current system object. */
- /* */
- LOCAL_FUNC
- void OTL_Free_Coverage( OTL_Coverage* coverage,
- FT_System system )
- {
- Free_SubTable( (OTL_SubTable*)coverage, system );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Coverage */
- /* */
- /* <Description> */
- /* Loads an OpenType Coverage table from a font resource. */
- /* */
- /* <Input> */
- /* coverage :: The target coverage. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Coverage( OTL_Coverage* coverage,
- FT_Stream stream )
- {
- return Load_SubTable( (OTL_SubTable*)coverage, stream );
- }
-
-
- /*************************************
- * Class Definition related functions
- *************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Class_Def */
- /* */
- /* <Description> */
- /* Releases a given OpenType Class Definition table. */
- /* */
- /* <Input> */
- /* class_def :: The target class definition. */
- /* system :: The current system object. */
- /* */
- LOCAL_FUNC
- void OTL_Free_Class_Def( OTL_Class_Def* class_def,
- FT_System system )
- {
- Free_SubTable( (OTL_SubTable*)class_def, system );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Class_Def */
- /* */
- /* <Description> */
- /* Loads an OpenType Class Definition table from a resource. */
- /* */
- /* <Input> */
- /* class_def :: The target class definition. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Class_Def( OTL_Class_Def* class_def,
- FT_Stream stream )
- {
- return OTL_Load_SubTable( (OTL_SubTable*)class_def, stream );
- }
-
-
- /*************************************
- * Device related functions
- *************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Device */
- /* */
- /* <Description> */
- /* Releases a given OpenType Layout Device table. */
- /* */
- /* <Input> */
- /* device :: The target device table. */
- /* system :: The current system object. */
- /* */
- LOCAL_FUNC
- void OTL_Free_Device( OTL_Device* device,
- FT_System system )
- {
- if ( device )
- {
- FREE( device->delta_values );
- FREE( device );
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Device */
- /* */
- /* <Description> */
- /* Loads an OpenType Device table from a font resource. */
- /* */
- /* <Input> */
- /* device :: The target device table. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Device( OTL_Device* device,
- FT_Stream stream )
- {
- FT_System system = stream->system;
- TT_Error error;
- TT_UShort* deltas;
- TT_UShort num_deltas, num_values;
-
-
- if ( ACCESS_Frame( 6L ) )
- goto Exit;
-
- device->start_size = GET_UShort();
- device->end_size = GET_UShort();
- device->delta_format = GET_UShort();
-
- FORGET_Frame();
-
- num_deltas = device->end_size - device->start_size + 1;
-
- switch ( device->delta_format )
- {
- case 1:
- num_values = ( num_deltas + 7 ) >> 3;
- break;
-
- case 2:
- num_values = ( num_deltas + 3 ) >> 2;
- break;
-
- case 3:
- num_values = ( num_deltas + 1 ) >> 1;
- break;
-
- default:
- error = TT_Err_Invalid_File_Format;
- goto Exit;
- }
-
- if ( ALLOC_ARRAY( deltas, num_values, TT_UShort ) )
- goto Exit;
-
- if ( !ACCESS_Frame( num_values * 2L ) )
- {
- TT_UShort n;
-
-
- for ( n = 0; n < num_values; n++ )
- deltas[n] = GET_UShort();
-
- FORGET_Frame();
-
- device->delta_values = deltas;
- }
- else
- FREE( deltas );
-
- Exit:
- return error;
- }
-
-
-/* END */
--- a/src/shared/otlayout/otload.h
+++ /dev/null
@@ -1,297 +1,0 @@
-/***************************************************************************/
-/* */
-/* otload.h */
-/* */
-/* OpenType layout loader functions (specification). */
-/* */
-/* Copyright 1996-1999 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 OTLOAD_H
-#define OTLOAD_H
-
-#include <otlayout.h>
-#include <ftstream.h>
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Script_List */
- /* */
- /* <Description> */
- /* Loads an OpenType Script List from a font resource. */
- /* */
- /* <Input> */
- /* list :: The target script list. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error OTL_Load_Script_List( OTL_Script_List* list,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Feature_List */
- /* */
- /* <Description> */
- /* Loads an OpenType Feature List from a font resource. */
- /* */
- /* <Input> */
- /* list :: The target feature list. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error OTL_Load_Feature_List( OTL_Feature_List* list,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Lookup_List */
- /* */
- /* <Description> */
- /* Loads an OpenType Lookup List from a font resource. */
- /* */
- /* <Input> */
- /* list :: The target lookup list. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* This function does NOT load the lookup sub-tables. Instead, it */
- /* stores the file offsets of the particular table in each lookup */
- /* element. It is up to the caller to load these sub-tables. This */
- /* can be done more easily with OTL_Iterate_Lookup_List(). */
- /* */
- LOCAL_DEF
- TT_Error OTL_Load_Lookup_List( OTL_Lookup_List* list,
- FT_Stream stream );
-
-
- typedef int OTL_Lookup_Iterator( OTL_Lookup* lookup,
- void* closure );
-
-
- typedef void OTL_Lookup_Destructor( OTL_Lookup* lookup,
- FT_System system );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Iterate_Lookup_List */
- /* */
- /* <Description> */
- /* Scans an OpenType Lookup List. This can be used to load the */
- /* Lookup sub-tables in a GSUB or GPOS loader. */
- /* */
- /* <Input> */
- /* list :: The source list. */
- /* iterator :: The iterator -- a function which is called on each */
- /* element of the list. */
- /* closure :: User-specified data which is passed to each iterator */
- /* with the lookup element pointer. */
- /* */
- /* <Return> */
- /* If one iterator call returns a non-zero `result', the list parsing */
- /* is aborted and the value is returned to the caller. Otherwise, */
- /* the function returns 0 when the list has been parsed completely. */
- /* */
- LOCAL_DEF
- TT_Error OTL_Iterate_Lookup_List( OTL_Lookup_List* list,
- OTL_Lookup_Iterator iterator,
- void* closure );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Coverage */
- /* */
- /* <Description> */
- /* Loads an OpenType Coverage table from a font resource. */
- /* */
- /* <Input> */
- /* coverage :: The target coverage. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error OTL_Load_Coverage( OTL_Coverage* coverage,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Class_Def */
- /* */
- /* <Description> */
- /* Loads an OpenType Class Definition table from a resource. */
- /* */
- /* <Input> */
- /* class_def :: The target class definition. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error OTL_Load_Class_Def( OTL_Class_Def* class_def,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Load_Device */
- /* */
- /* <Description> */
- /* Loads an OpenType Device table from a font resource. */
- /* */
- /* <Input> */
- /* device :: The target device table. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error OTL_Load_Device( OTL_Device* device,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Script_List */
- /* */
- /* <Description> */
- /* Releases a given OpenType Script list. */
- /* */
- /* <Input> */
- /* list :: The target script list. */
- /* system :: The current system object. */
- /* */
- LOCAL_DEF
- void OTL_Free_Script_List( OTL_Script_List* list,
- FT_System system );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Features_List */
- /* */
- /* <Description> */
- /* Releases a given OpenType Features list. */
- /* */
- /* <Input> */
- /* list :: The target feature list. */
- /* system :: The current system object. */
- /* */
- LOCAL_DEF
- void OTL_Free_Features_List( OTL_Feature_List* list,
- FT_System system );
-
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Lookup_List */
- /* */
- /* <Description> */
- /* Releases a given OpenType Lookup list. Uses a destructor called */
- /* to destroy the Lookup sub-tables. */
- /* */
- /* <Input> */
- /* list :: The target lookup list. */
- /* system :: The current system object. */
- /* destructor :: A destructor function called on each lookup element. */
- /* Can be used to destroy sub-tables. Ignored if NULL. */
- /* */
- LOCAL_DEF
- void OTL_Free_Lookup_List( OTL_Lookup_List* list,
- FT_System system,
- OTL_Lookup_Destructor destroy );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Coverage */
- /* */
- /* <Description> */
- /* Releases a given OpenType Coverage table. */
- /* */
- /* <Input> */
- /* coverage :: The target coverage. */
- /* system :: The current system object. */
- /* */
- LOCAL_DEF
- void OTL_Free_Coverage( OTL_Coverage* coverage,
- FT_System system );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Class_Def */
- /* */
- /* <Description> */
- /* Releases a given OpenType Class Definition table. */
- /* */
- /* <Input> */
- /* class_def :: The target class definition. */
- /* system :: The current system object. */
- /* */
- LOCAL_DEF
- void OTL_Free_Class_Def( OTL_Class_Def* class_def,
- FT_System system );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* OTL_Free_Device */
- /* */
- /* <Description> */
- /* Releases a given OpenType Layout Device table. */
- /* */
- /* <Input> */
- /* device :: The target device table. */
- /* system :: The current system object. */
- /* */
- LOCAL_DEF
- void OTL_Free_Device( OTL_Device* device,
- FT_System system );
-
-
-#endif /* OTLOAD_H */
-
-
-/* END */
--- a/src/shared/sfnt/rules.mk
+++ /dev/null
@@ -1,58 +1,0 @@
-#****************************************************************************
-#* *
-#* SFNT/TrueType Makefile *
-#* *
-#* Copyright 1996-1999 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. *
-#* *
-#****************************************************************************
-
-
-#****************************************************************************
-#* *
-#* IMPORTANT NOTE: This Makefile is intended for GNU Make! *
-#* If you provide Makefiles for other make utilities, *
-#* please place them in `freetype/lib/arch/<system>'. *
-#* *
-#* *
-#* This file is to be included by the Makefiles of each driver that uses *
-#* the shared source code in `freetype2/lib/drivers/sfnt'. This code *
-#* contains type definitions as well as interface which are common to all *
-#* `sfnt' font formats (i.e., TrueType, OpenType-TTF, and OpenType-CFF). *
-#* *
-#* *
-#* The purpose of this Makefile is to define two make variables that are *
-#* used directly by the parent Makefile. *
-#* *
-#****************************************************************************
-
-
-# SFNT_DIR is the directory to the `sfnt' sources
-#
-SFNT_DIR := $(SRC)$(SEP)shared$(SEP)sfnt
-SFNT_DIR_ := $(SFNT_DIR)$(SEP)
-
-
-# SFNT_H is the list of all header files on which the client drivers depend
-#
-SFNT_H := $(SFNT_DIR_)tttypes.h \
- $(SFNT_DIR_)ttload.h \
- $(SFNT_DIR_)ttsbit.h \
- $(SFNT_DIR_)ttpost.h \
- $(SFNT_DIR_)sfnt.h
-
-# SFNT_SRC is the list of all shared source files that are included by any
-# client driver
-#
-SFNT_SRC := $(SFNT_DIR_)ttload.c \
- $(SFNT_DIR_)ttsbit.c \
- $(SFNT_DIR_)ttpost.c
-
-
-# END
--- a/src/shared/sfnt/sfnt.h
+++ /dev/null
@@ -1,50 +1,0 @@
-/***************************************************************************/
-/* */
-/* sfnt.h */
-/* */
-/* Defines the function interface used to access SFNT files, i.e., */
-/* TrueType, OpenType-TT, and OpenType-T2 files (specification only). */
-/* */
-/* Copyright 1996-1999 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 SFNT_H
-#define SFNT_H
-
-#include <tttypes.h>
-
-
- typedef TT_Long (*SFNT_LookUp_Table)( TT_Face face,
- TT_ULong tag );
-
-
- typedef TT_Error (*SFNT_Load_Table)( TT_Face face,
- TT_ULong tag,
- TT_Long offset,
- void* buffer,
- TT_Long* length );
-
- typedef TT_Error (*SFNT_Get_PS_Name)( TT_Face face,
- TT_UShort index,
- TT_String* *ps_name );
-
- typedef struct SFNT_Interface_
- {
- SFNT_LookUp_Table lookup_table;
- SFNT_Load_Table load_table;
-
- } SFNT_Interface;
-
-
-#endif /* SFNT_H */
-
-
-/* END */
--- a/src/shared/sfnt/ttload.c
+++ /dev/null
@@ -1,1488 +1,0 @@
-/***************************************************************************/
-/* */
-/* ttload.c */
-/* */
-/* TrueType tables loader (body). */
-/* */
-/* Copyright 1996-1999 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. */
-/* */
-/* */
-/* WARNING: This file should not be compiled directly; it is meant to be */
-/* included in the source of several font drivers (i.e., the TTF */
-/* and OTF drivers). */
-/* */
-/***************************************************************************/
-
-
-#include <ftdebug.h>
-
-#include <ttload.h>
-#include <tttags.h>
-#include <ttcmap.h>
-
-
-/* required by the tracing mode */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttload
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_LookUp_Table */
- /* */
- /* <Description> */
- /* Looks for a TrueType table by name. */
- /* */
- /* <Input> */
- /* face :: A face object handle. */
- /* tag :: The searched tag. */
- /* */
- /* <Return> */
- /* Index of table if found, -1 otherwise. */
- /* */
- EXPORT_FUNC
- FT_Long TT_LookUp_Table( TT_Face face,
- TT_ULong tag )
- {
- TT_Long i, found;
-
-
- FT_TRACE4(( "TT_LookUp_Table( %08lx, %c%c%c%c )\n",
- (TT_Long)face,
- (TT_Char)(tag >> 24),
- (TT_Char)(tag >> 16),
- (TT_Char)(tag >> 8),
- (TT_Char)(tag) ));
-
- found = -1;
- for ( i = 0; i < face->num_tables; i++ )
- if ( face->dir_tables[i].Tag == tag )
- {
- found = i;
- break;
- }
-
- if ( found == -1 )
- {
- FT_TRACE4(( " Could not find table!\n" ));
- }
-
- return found;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Collection */
- /* */
- /* <Description> */
- /* Loads the TTC table directory into face table. */
- /* */
- /* <Input> */
- /* face :: A face object handle. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- static
- TT_Error TT_Load_Collection( TT_Face face,
- FT_Stream stream )
- {
- TT_Long n;
- TT_Error error;
- FT_Memory memory = stream->memory;
-
-
- FT_TRACE3(( "TT_Load_Collection( %08lx )\n", (TT_Long)face ));
-
- if ( FILE_Seek ( 0L ) ||
- ACCESS_Frame( 12L ) )
- goto Exit;
-
- face->ttc_header.Tag = GET_Tag4();
- face->ttc_header.version = GET_Long();
- face->ttc_header.DirCount = GET_Long(); /* see comment in tttypes.h */
-
- FORGET_Frame();
-
- if ( face->ttc_header.Tag != TTAG_ttcf )
- {
- face->ttc_header.Tag = 0;
- face->ttc_header.version = 0;
- face->ttc_header.DirCount = 0;
-
- face->ttc_header.TableDirectory = NULL;
-
- FT_TRACE3(( "skipped.\n" ));
-
- error = TT_Err_File_Is_Not_Collection;
- goto Exit;
- }
-
- if ( ALLOC_ARRAY( face->ttc_header.TableDirectory,
- face->ttc_header.DirCount,
- TT_ULong ) ||
- ACCESS_Frame( face->ttc_header.DirCount * 4L ) )
- goto Exit;
-
- for ( n = 0; n < face->ttc_header.DirCount; n++ )
- face->ttc_header.TableDirectory[n] = GET_ULong();
-
- FORGET_Frame();
-
- FT_TRACE3(( "collections directory loaded.\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Directory */
- /* */
- /* <Description> */
- /* Loads the table directory into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* faceIndex :: The index of the TrueType font, if we're opening a */
- /* collection. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Directory( TT_Face face,
- FT_Stream stream,
- TT_Long faceIndex )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_UShort n, limit;
- TT_TableDir tableDir;
-
- TT_TableDirEntry* entry;
-
-
- FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n",
- (TT_Long)face, faceIndex ));
-
- error = TT_Load_Collection( face, stream );
- if ( error )
- {
- /* if this is a `traditional' error, exit now */
- if ( error != TT_Err_File_Is_Not_Collection )
- goto Exit;
-
- /* the file isn't a collection, exit if we're asking */
- /* for a collected font */
-
- /* Note that we don't exit during font format checking (i.e., */
- /* faceIndex is -1) */
- if ( faceIndex > 0 )
- goto Exit;
-
- /* Now skip to the beginning of the file */
- if ( FILE_Seek( 0 ) )
- goto Exit;
- }
- else
- {
- /* The file is a collection. Check the font index */
- if ( faceIndex >= face->ttc_header.DirCount )
- {
- error = TT_Err_Bad_Argument;
- goto Exit;
- }
-
- /* if we're checking the font format, exit immediately */
- if ( faceIndex < 0 )
- goto Exit;
-
- /* select a TrueType font in the ttc file */
- if ( FILE_Seek( face->ttc_header.TableDirectory[faceIndex] ) )
- goto Exit;
- }
-
- if ( ACCESS_Frame( 12L ) )
- goto Exit;
-
- tableDir.version = GET_Long();
- tableDir.numTables = GET_UShort();
-
- tableDir.searchRange = GET_UShort();
- tableDir.entrySelector = GET_UShort();
- tableDir.rangeShift = GET_UShort();
-
- FORGET_Frame();
-
- FT_TRACE2(( "-- Tables count : %12u\n", tableDir.numTables ));
- FT_TRACE2(( "-- Format version : %08lx\n", tableDir.version ));
-
- /* Check that we have a `sfnt' format there */
- /* We must also be able to accept Mac/GX fonts, as well as OT ones */
-
- if ( tableDir.version != 0x00010000 &&
- tableDir.version != TTAG_true &&
- tableDir.version != TTAG_OTTO )
- {
- FT_TRACE2(( "[not a valid TTF or OTF font]" ));
- error = TT_Err_Invalid_File_Format;
- goto Exit;
- }
-
- /* if we're performing a font format check, exit immediately */
- /* with success */
- if ( faceIndex < 0 )
- goto Exit;
-
- face->num_tables = tableDir.numTables;
-
- if ( ALLOC_ARRAY( face->dir_tables,
- face->num_tables,
- TT_TableDirEntry ) )
- goto Exit;
-
- if ( ACCESS_Frame( face->num_tables * 16L ) )
- goto Exit;
-
- limit = face->num_tables;
- entry = face->dir_tables;
-
- for ( n = 0; n < limit; n++ )
- { /* loop through the tables and get all entries */
- entry->Tag = GET_Tag4();
- entry->CheckSum = GET_ULong();
- entry->Offset = GET_Long();
- entry->Length = GET_Long();
-
- FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n",
- (TT_Char)(entry->Tag >> 24),
- (TT_Char)(entry->Tag >> 16),
- (TT_Char)(entry->Tag >> 8 ),
- (TT_Char)(entry->Tag),
- entry->Offset,
- entry->Length ));
- entry++;
- }
-
- FORGET_Frame();
-
- FT_TRACE2(( "Directory loaded\n\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Any */
- /* */
- /* <Description> */
- /* Loads any font table into client memory. Used by the */
- /* TT_Get_Font_Data() API function. */
- /* */
- /* <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> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Any( TT_Face face,
- TT_ULong tag,
- TT_Long offset,
- void* buffer,
- TT_Long* length )
- {
- TT_Error error;
- FT_Stream stream;
- TT_Long table;
- TT_ULong size;
-
-
- if ( tag != 0 )
- {
- /* look for tag in font directory */
- table = TT_LookUp_Table( face, tag );
- if ( table < 0 )
- {
- error = TT_Err_Table_Missing;
- goto Exit;
- }
-
- offset += face->dir_tables[table].Offset;
- size = face->dir_tables[table].Length;
- }
- else
- /* tag = 0 -- the use want to access the font file directly */
- {
- size = face->root.stream->size;
- }
-
- if ( length && *length == 0 )
- {
- *length = size;
-
- return TT_Err_Ok;
- }
-
- if ( length )
- size = *length;
-
- stream = face->root.stream;
- (void)FILE_Read_At( offset, buffer, size );
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Header */
- /* */
- /* <Description> */
- /* Loads the TrueType font header. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Header( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
-
- TT_Long table;
- TT_Header* header;
-
-
- FT_TRACE2(( "Load_TT_Header( %08lx )\n", (TT_Long)face ));
-
- if ( ( table = TT_LookUp_Table( face, TTAG_head ) ) < 0 )
- {
- FT_TRACE0(( "Font Header is missing!\n" ));
- error = TT_Err_Header_Table_Missing;
-
- goto Exit;
- }
-
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- ACCESS_Frame( 54L ) )
- goto Exit;
-
- header = &face->header;
-
- header->Table_Version = GET_ULong();
- header->Font_Revision = GET_ULong();
-
- header->CheckSum_Adjust = GET_Long();
- header->Magic_Number = GET_Long();
-
- header->Flags = GET_UShort();
- header->Units_Per_EM = GET_UShort();
-
- header->Created [0] = GET_Long();
- header->Created [1] = GET_Long();
- header->Modified[0] = GET_Long();
- header->Modified[1] = GET_Long();
-
- header->xMin = GET_Short();
- header->yMin = GET_Short();
- header->xMax = GET_Short();
- header->yMax = GET_Short();
-
- header->Mac_Style = GET_UShort();
- header->Lowest_Rec_PPEM = GET_UShort();
-
- header->Font_Direction = GET_Short();
- header->Index_To_Loc_Format = GET_Short();
- header->Glyph_Data_Format = GET_Short();
-
- FORGET_Frame();
-
- FT_TRACE2(( " Units per EM : %8u\n", header->Units_Per_EM ));
- FT_TRACE2(( " IndexToLoc : %8d\n", header->Index_To_Loc_Format ));
- FT_TRACE2(( "Font Header Loaded.\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_MaxProfile */
- /* */
- /* <Description> */
- /* Loads the maximum profile into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_MaxProfile( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
-
- TT_Long i;
- TT_MaxProfile* maxProfile = &face->max_profile;
-
-
- FT_TRACE2(( "Load_TT_MaxProfile( %08lx )\n", (TT_Long)face ));
-
- if ( ( i = TT_LookUp_Table( face, TTAG_maxp ) ) < 0 )
- {
- error = TT_Err_Max_Profile_Missing;
-
- goto Exit;
- }
-
- if ( FILE_Seek( face->dir_tables[i].Offset ) ||
- ACCESS_Frame( 32L ) )
- goto Exit;
-
- /* read frame data into face table */
- maxProfile->version = GET_ULong();
- maxProfile->numGlyphs = GET_UShort();
-
- maxProfile->maxPoints = GET_UShort();
- maxProfile->maxContours = GET_UShort();
- maxProfile->maxCompositePoints = GET_UShort();
- maxProfile->maxCompositeContours = GET_UShort();
-
- maxProfile->maxZones = GET_UShort();
- maxProfile->maxTwilightPoints = GET_UShort();
-
- maxProfile->maxStorage = GET_UShort();
- maxProfile->maxFunctionDefs = GET_UShort();
- maxProfile->maxInstructionDefs = GET_UShort();
- maxProfile->maxStackElements = GET_UShort();
- maxProfile->maxSizeOfInstructions = GET_UShort();
- maxProfile->maxComponentElements = GET_UShort();
- maxProfile->maxComponentDepth = GET_UShort();
-
- FORGET_Frame();
-
- /* XXX: an adjustment that is necessary to load certain */
- /* broken fonts like `Keystrokes MT' :-( */
- /* */
- /* We allocate 64 function entries by default when */
- /* the maxFunctionDefs field is null. */
-
- if ( maxProfile->maxFunctionDefs == 0 )
- maxProfile->maxFunctionDefs = 64;
-
- face->root.num_glyphs = maxProfile->numGlyphs;
-
- face->root.max_points = MAX( maxProfile->maxCompositePoints,
- maxProfile->maxPoints );
-
- face->root.max_contours = MAX( maxProfile->maxCompositeContours,
- maxProfile->maxContours );
-
- face->max_components = (TT_ULong)maxProfile->maxComponentElements +
- maxProfile->maxComponentDepth;
-
- FT_TRACE2(( "GASP loaded.\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Metrics */
- /* */
- /* <Description> */
- /* Loads the horizontal or vertical metrics table into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* vertical :: A boolean flag. If set, load vertical metrics. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- static
- TT_Error TT_Load_Metrics( TT_Face face,
- FT_Stream stream,
- TT_Bool vertical )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_UShort n, num_shorts, num_longs;
- TT_Long table;
-
- TT_LongMetrics** longs;
- TT_ShortMetrics** shorts;
-
- TT_LongMetrics* long_metric;
-
- FT_TRACE2(( "TT_Load_%s_Metrics( %08lx )\n",
- vertical ? "Vertical" : "Horizontal", (TT_Long)face ));
-
- if ( vertical )
- {
- /* The table is optional, quit silently if it wasn't found */
- /* XXX: Some fonts have a valid vertical header with a non-null */
- /* `number_of_VMetrics' fields, but no corresponding `vmtx' */
- /* table to get the metrics from (e.g. mingliu). */
- /* */
- /* For safety, we set the field to 0! */
- /* */
- table = TT_LookUp_Table( face, TTAG_vmtx );
- if ( table < 0 )
- {
- /* Set the number_Of_VMetrics to 0! */
- FT_TRACE2(( " no vertical header in file.\n" ));
- face->vertical.number_Of_VMetrics = 0;
- error = TT_Err_Ok;
-
- goto Exit;
- }
-
- num_longs = face->vertical.number_Of_VMetrics;
- longs = (TT_LongMetrics**)&face->vertical.long_metrics;
- shorts = (TT_ShortMetrics**)&face->vertical.short_metrics;
- }
- else
- {
- if ( ( table = TT_LookUp_Table( face, TTAG_hmtx ) ) < 0 )
- {
- FT_ERROR(( " no horizontal metrics in file!\n" ));
- error = TT_Err_Hmtx_Table_Missing;
-
- goto Exit;
- }
-
- num_longs = face->horizontal.number_Of_HMetrics;
- longs = (TT_LongMetrics**)&face->horizontal.long_metrics;
- shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics;
- }
-
- num_shorts = face->max_profile.numGlyphs - num_longs;
-
- if ( num_longs > face->max_profile.numGlyphs ) /* sanity check */
- {
- FT_ERROR(( " more metrics than glyphs!\n" ));
- error = TT_Err_Invalid_Horiz_Metrics;
-
- goto Exit;
- }
-
- if ( ALLOC_ARRAY( *longs, num_longs, TT_LongMetrics ) ||
- ALLOC_ARRAY( *shorts, num_shorts, TT_ShortMetrics ) )
- goto Exit;
-
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- ACCESS_Frame( face->dir_tables[table].Length ) )
- goto Exit;
-
- long_metric = *longs;
- for ( n = 0; n < num_longs; n++ )
- {
- long_metric->advance = GET_UShort();
- long_metric->bearing = GET_Short();
- long_metric++;
- }
-
- for ( n = 0; n < num_shorts; n++ )
- (*shorts)[n] = GET_Short();
-
- FORGET_Frame();
-
- FT_TRACE2(( "loaded\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Metrics_Header */
- /* */
- /* <Description> */
- /* Loads the horizontal or vertical header in a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* vertical :: A boolean flag. If set, load vertical metrics. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Metrics_Header( TT_Face face,
- FT_Stream stream,
- TT_Bool vertical )
- {
- TT_Error error;
-
- TT_Long table;
- TT_HoriHeader* header;
-
-
- FT_TRACE2(( vertical ? "Vertical header " : "Horizontal header " ));
-
- if ( vertical )
- {
- face->vertical_info = 0;
-
- /* The vertical header table is optional, so return quietly if */
- /* we don't find it. */
- if ( ( table = TT_LookUp_Table( face, TTAG_vhea ) ) < 0 )
- {
- error = TT_Err_Ok;
-
- goto Exit;
- }
-
- face->vertical_info = 1;
- header = (TT_HoriHeader*)&face->vertical;
- }
- else
- {
- /* The horizontal header is mandatory, return an error if we */
- /* don't find it. */
- if ( ( table = TT_LookUp_Table( face, TTAG_hhea ) ) < 0 )
- {
- error = TT_Err_Horiz_Header_Missing;
-
- goto Exit;
- }
-
- header = &face->horizontal;
- }
-
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- ACCESS_Frame( 36L ) )
- goto Exit;
-
- header->Version = GET_ULong();
- header->Ascender = GET_Short();
- header->Descender = GET_Short();
- header->Line_Gap = GET_Short();
-
- header->advance_Width_Max = GET_UShort();
-
- header->min_Left_Side_Bearing = GET_Short();
- header->min_Right_Side_Bearing = GET_Short();
- header->xMax_Extent = GET_Short();
- header->caret_Slope_Rise = GET_Short();
- header->caret_Slope_Run = GET_Short();
-
- header->Reserved[0] = GET_Short();
- header->Reserved[1] = GET_Short();
- header->Reserved[2] = GET_Short();
- header->Reserved[3] = GET_Short();
- header->Reserved[4] = GET_Short();
-
- header->metric_Data_Format = GET_Short();
- header->number_Of_HMetrics = GET_UShort();
-
- FORGET_Frame();
-
- header->long_metrics = NULL;
- header->short_metrics = NULL;
-
- FT_TRACE2(( "loaded\n" ));
-
- /* Now try to load the corresponding metrics */
-
- error = TT_Load_Metrics( face, stream, vertical );
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Names */
- /* */
- /* <Description> */
- /* Loads the name records. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Names( TT_Face face, FT_Stream stream )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_UShort i;
- TT_Long table;
- TT_Long storageSize;
-
- TT_NameTable* names;
- TT_NameRec* namerec;
-
-
- FT_TRACE2(( "Names " ));
-
- if ( ( table = TT_LookUp_Table( face, TTAG_name ) ) < 0 )
- {
- /* The name table is required so indicate failure. */
- FT_TRACE2(( "is missing!\n" ));
- error = TT_Err_Name_Table_Missing;
-
- goto Exit;
- }
-
- /* Seek to the beginning of the table and check the frame access. */
- /* The names table has a 6 byte header. */
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- ACCESS_Frame( 6L ) )
- goto Exit;
-
- names = &face->name_table;
-
- /* Load the initial names data. */
- names->format = GET_UShort();
- names->numNameRecords = GET_UShort();
- names->storageOffset = GET_UShort();
-
- FORGET_Frame();
-
- /* Allocate the array of name records. */
- if ( ALLOC_ARRAY( names->names,
- names->numNameRecords,
- TT_NameRec ) ||
- ACCESS_Frame( names->numNameRecords * 12L ) )
- goto Exit;
-
- /* Load the name records and determine how much storage is needed */
- /* to hold the strings themselves. */
- namerec = names->names;
- storageSize = 0;
-
- for ( i = 0; i < names->numNameRecords; i++, namerec++ )
- {
- TT_Long upper;
-
-
- namerec->platformID = GET_UShort();
- namerec->encodingID = GET_UShort();
- namerec->languageID = GET_UShort();
- namerec->nameID = GET_UShort();
- namerec->stringLength = GET_UShort();
- namerec->stringOffset = GET_UShort();
-
- upper = namerec->stringOffset + namerec->stringLength;
- if ( upper > storageSize ) storageSize = upper;
- }
-
- FORGET_Frame();
-
- if ( ALLOC( names->storage, storageSize ) ||
- FILE_Read_At( face->dir_tables[table].Offset + names->storageOffset,
- (void*)names->storage, storageSize ) )
- goto Exit;
-
- /* Go through and assign the string pointers to the name records. */
- namerec = names->names;
- for ( i = 0; i < names->numNameRecords; i++, namerec++ )
- namerec->string = names->storage + namerec->stringOffset;
-
- /* Print Name Record Table in case of debugging */
-#if 0
- namerec = names->names;
- for ( i = 0; i < names->numNameRecords; i++, namerec++ )
- {
- TT_UShort j;
-
-
- FT_TRACE2(( "%d %d %x %d ",
- namerec->platformID,
- namerec->encodingID,
- namerec->languageID,
- namerec->nameID ));
-
- /* I know that M$ encoded strings are Unicode, */
- /* but this works reasonable well for debugging purposes. */
- if ( namerec->string )
- for ( j = 0; j < namerec->stringLength; j++ )
- {
- TT_Char c = *(namerec->string + j);
-
- if ( (TT_Byte)c < 128 )
- FT_TRACE2(( "%c", c ));
- }
- }
- FT_TRACE2(( "\n" ));
-#endif
-
- FT_TRACE2(( "loaded\n" ));
-
- Exit:
- return error;
-
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Free_Names */
- /* */
- /* <Description> */
- /* Frees the name records. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Free_Names( TT_Face face )
- {
- FT_Memory memory = face->root.driver->memory;
- TT_NameTable* names = &face->name_table;
-
-
- /* free strings table */
- FREE( names->names );
-
- /* free strings storage */
- FREE( names->storage );
-
- names->numNameRecords = 0;
- names->format = 0;
- names->storageOffset = 0;
-
- return TT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_CMap */
- /* */
- /* <Description> */
- /* Loads the cmap directory in a face object. The cmaps itselves 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> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_CMap( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_Long i, off, cur_off, table_start;
- TT_UShort n, limit;
-
- TT_CMapDir cmap_dir;
- TT_CharMap charmap;
- TT_CMapTable* cmap;
-
-
- FT_TRACE2(( "CMaps " ));
-
- if ( ( i = TT_LookUp_Table( face, TTAG_cmap ) ) < 0 )
- {
- error = TT_Err_CMap_Table_Missing;
-
- goto Exit;
- }
-
- table_start = face->dir_tables[i].Offset;
-
- if ( ( FILE_Seek( table_start ) ) ||
- ( ACCESS_Frame( 4L ) ) ) /* 4 bytes cmap header */
- goto Exit;
-
- cmap_dir.tableVersionNumber = GET_UShort();
- cmap_dir.numCMaps = GET_UShort();
-
- FORGET_Frame();
-
- off = FILE_Pos(); /* save offset to cmapdir[] which follows */
-
- /* save space in face table for cmap tables */
- if ( ALLOC_ARRAY( face->charmaps,
- cmap_dir.numCMaps,
- TT_CharMapRec ) )
- goto Exit;
-
- face->num_charmaps = cmap_dir.numCMaps;
-
- limit = face->num_charmaps;
- charmap = face->charmaps;
-
- for ( n = 0; n < limit; n++ )
- {
- charmap->root.face = (FT_Face)face;
- cmap = &charmap->cmap;
-
- if ( FILE_Seek( off ) ||
- ACCESS_Frame( 8L ) )
- goto Exit;
-
- cmap->loaded = FALSE;
- cmap->platformID = GET_UShort();
- cmap->platformEncodingID = GET_UShort();
-
- cur_off = GET_Long();
-
- FORGET_Frame();
-
- off = FILE_Pos();
-
- if ( FILE_Seek( table_start + cur_off ) ||
- ACCESS_Frame( 6L ) )
- goto Exit;
-
- cmap->format = GET_UShort();
- cmap->length = GET_UShort();
- cmap->version = GET_UShort();
-
- FORGET_Frame();
-
- cmap->offset = FILE_Pos();
-
- charmap++;
- }
-
- FT_TRACE2(( "loaded\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_OS2 */
- /* */
- /* <Description> */
- /* Loads the OS2 table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_OS2( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
-
- TT_Long i;
- TT_Int j;
- TT_OS2* os2;
-
-
- FT_TRACE2(( "OS/2 Table " ));
-
- /* We now support old Mac fonts where the OS/2 table doesn't */
- /* exist. Simply put, we set the `version' field to 0xFFFF */
- /* and test this value each time we need to access the table. */
- if ( ( i = TT_LookUp_Table( face, TTAG_OS2 ) ) < 0 )
- {
- FT_TRACE2(( "is missing\n!" ));
- face->os2.version = 0xFFFF;
- error = TT_Err_Ok;
-
- goto Exit;
- }
-
- if ( FILE_Seek( face->dir_tables[i].Offset ) ||
- ACCESS_Frame( 78L ) )
- goto Exit;
-
- os2 = &face->os2;
-
- os2->version = GET_UShort();
- os2->xAvgCharWidth = GET_Short();
- os2->usWeightClass = GET_UShort();
- os2->usWidthClass = GET_UShort();
- os2->fsType = GET_Short();
- os2->ySubscriptXSize = GET_Short();
- os2->ySubscriptYSize = GET_Short();
- os2->ySubscriptXOffset = GET_Short();
- os2->ySubscriptYOffset = GET_Short();
- os2->ySuperscriptXSize = GET_Short();
- os2->ySuperscriptYSize = GET_Short();
- os2->ySuperscriptXOffset = GET_Short();
- os2->ySuperscriptYOffset = GET_Short();
- os2->yStrikeoutSize = GET_Short();
- os2->yStrikeoutPosition = GET_Short();
- os2->sFamilyClass = GET_Short();
-
- for ( j = 0; j < 10; j++ )
- os2->panose[j] = GET_Byte();
-
- os2->ulUnicodeRange1 = GET_ULong();
- os2->ulUnicodeRange2 = GET_ULong();
- os2->ulUnicodeRange3 = GET_ULong();
- os2->ulUnicodeRange4 = GET_ULong();
-
- for ( j = 0; j < 4; j++ )
- os2->achVendID[j] = GET_Byte();
-
- os2->fsSelection = GET_UShort();
- os2->usFirstCharIndex = GET_UShort();
- os2->usLastCharIndex = GET_UShort();
- os2->sTypoAscender = GET_Short();
- os2->sTypoDescender = GET_Short();
- os2->sTypoLineGap = GET_Short();
- os2->usWinAscent = GET_UShort();
- os2->usWinDescent = GET_UShort();
-
- FORGET_Frame();
-
- if ( os2->version >= 0x0001 )
- {
- /* only version 1 tables */
-
- if ( ACCESS_Frame( 8L ) ) /* read into frame */
- goto Exit;
-
- os2->ulCodePageRange1 = GET_ULong();
- os2->ulCodePageRange2 = GET_ULong();
-
- FORGET_Frame();
- }
- else
- {
- os2->ulCodePageRange1 = 0;
- os2->ulCodePageRange2 = 0;
- }
-
- FT_TRACE2(( "loaded\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Postscript */
- /* */
- /* <Description> */
- /* Loads the Postscript table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_PostScript( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
- TT_Long i;
- TT_Postscript* post = &face->postscript;
-
-
- FT_TRACE2(( "PostScript " ));
-
- if ( ( i = TT_LookUp_Table( face, TTAG_post ) ) < 0 )
- return TT_Err_Post_Table_Missing;
-
- if ( FILE_Seek( face->dir_tables[i].Offset ) ||
- ACCESS_Frame( 32L ) )
- return error;
-
- /* read frame data into face table */
-
- post->FormatType = GET_ULong();
- post->italicAngle = GET_ULong();
- post->underlinePosition = GET_Short();
- post->underlineThickness = GET_Short();
- post->isFixedPitch = GET_ULong();
- post->minMemType42 = GET_ULong();
- post->maxMemType42 = GET_ULong();
- post->minMemType1 = GET_ULong();
- post->maxMemType1 = GET_ULong();
-
- FORGET_Frame();
-
- /* we don't load the glyph names, we do that in another */
- /* module (ttpost). */
-
- FT_TRACE2(( "loaded\n" ));
-
- return TT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_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> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Gasp( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_Long table;
- TT_UShort num_ranges;
- TT_UShort j;
- TT_GaspRange* gaspranges;
-
-
- FT_TRACE2(( "TT_Load_Gasp( %08lx )\n", (TT_Long)face ));
-
- error = TT_Err_Ok;
-
- /* the gasp table is optional */
- if ( ( table = TT_LookUp_Table( face, TTAG_gasp ) ) < 0 )
- goto Exit;
-
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- ACCESS_Frame( 4L ) )
- goto Exit;
-
- face->gasp.version = GET_UShort();
- face->gasp.numRanges = GET_UShort();
-
- FORGET_Frame();
-
- num_ranges = face->gasp.numRanges;
- FT_TRACE3(( "number of ranges = %d\n", num_ranges ));
-
- if ( ALLOC_ARRAY( gaspranges, num_ranges, TT_GaspRange ) ||
- ACCESS_Frame( num_ranges * 4L ) )
- goto Exit;
-
- face->gasp.gaspRanges = gaspranges;
-
- for ( j = 0; j < num_ranges; j++ )
- {
- gaspranges[j].maxPPEM = GET_UShort();
- gaspranges[j].gaspFlag = GET_UShort();
-
- FT_TRACE3(( " [max:%d flag:%d]",
- gaspranges[j].maxPPEM,
- gaspranges[j].gaspFlag ));
- }
- FT_TRACE3(( "\n" ));
-
- FORGET_Frame();
-
- FT_TRACE2(( "GASP loaded\n" ));
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Kern */
- /* */
- /* <Description> */
- /* Loads the first kerning table with format 0 in the font. Only */
- /* accepts the first horizontal kerning table. Developers should use */
- /* the `ftxkern' extension to access other kerning tables in the font */
- /* file, if they really want to. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Kern( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_Long table;
- TT_UShort n, num_tables, version;
-
-
- error = TT_Err_Ok;
- table = TT_LookUp_Table( face, TTAG_kern );
- if ( table < 0 )
- goto Exit;
-
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- READ_UShort( version ) ||
- READ_UShort( num_tables ) )
- goto Exit;
-
- for ( n = 0; n < num_tables; n++ )
- {
- TT_UShort coverage;
-
-
- if ( FILE_Skip( 4L ) ||
- READ_UShort( coverage ) )
- goto Exit;
-
- if ( coverage == 0x0001 )
- {
- TT_UShort num_pairs, m;
- TT_Kern_0_Pair* pair;
-
-
- /* found a horizontal format 0 kerning table ! */
- if ( READ_UShort( num_pairs ) ||
- FILE_Skip( 6 ) )
- goto Exit;
-
- /* allocate array of kerning pairs */
- if ( ALLOC_ARRAY( face->kern_pairs, num_pairs, TT_Kern_0_Pair ) )
- goto Exit;
-
- /* read the kerning pairs */
- if ( ACCESS_Frame( 6L * num_pairs ) )
- goto Exit;
-
- pair = face->kern_pairs;
- for ( m = 0; m < num_pairs; m++ )
- {
- pair->left = GET_UShort();
- pair->right = GET_UShort();
- pair->value = GET_UShort();
- pair++;
- }
-
- FORGET_Frame();
-
- face->num_kern_pairs = num_pairs;
- face->kern_table_index = n;
- goto Exit;
- }
- }
-
- /* no kern table found -- doesn't matter */
- face->kern_table_index = -1;
- face->num_kern_pairs = 0;
- face->kern_pairs = NULL;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Hdmx */
- /* */
- /* <Description> */
- /* Loads the horizontal device metrics table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_Hdmx( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
- TT_HdmxRec* rec;
- TT_Hdmx hdmx;
- TT_Long table;
- TT_UShort n;
- TT_Long num_glyphs;
- TT_Long record_size;
-
- hdmx.version = 0;
- hdmx.num_records = 0;
- hdmx.records = 0;
-
- face->hdmx = hdmx;
-
- error = TT_Err_Ok;
-
- /* ths table is optional */
- if ( ( table = TT_LookUp_Table( face, TTAG_hdmx ) ) < 0 )
- return error;
-
- if ( FILE_Seek( face->dir_tables[table].Offset ) ||
- ACCESS_Frame( 8L ) )
- goto Exit;
-
- hdmx.version = GET_UShort();
- hdmx.num_records = GET_Short();
- record_size = GET_Long();
-
- FORGET_Frame();
-
- /* Only recognize format 0 */
- if ( hdmx.version != 0 )
- goto Exit;
-
- if ( ALLOC( hdmx.records, sizeof ( TT_HdmxRec ) * hdmx.num_records ) )
- goto Exit;
-
- num_glyphs = face->root.num_glyphs;
- record_size -= num_glyphs + 2;
- rec = hdmx.records;
-
- for ( n = 0; n < hdmx.num_records; n++ )
- {
- /* read record */
- if ( READ_Byte( rec->ppem ) ||
- READ_Byte( rec->max_width ) )
- goto Exit;
-
- if ( ALLOC( rec->widths, num_glyphs ) ||
- FILE_Read( rec->widths, num_glyphs ) )
- goto Exit;
-
- /* skip padding bytes */
- if ( record_size > 0 )
- if ( FILE_Skip( record_size ) )
- goto Exit;
-
- rec++;
- }
-
- face->hdmx = hdmx;
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Free_Hdmx */
- /* */
- /* <Description> */
- /* Frees the horizontal device metrics table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Free_Hdmx( TT_Face face )
- {
- if ( face )
- {
- TT_UShort n;
- FT_Memory memory = face->root.driver->memory;
-
-
- for ( n = 0; n < face->hdmx.num_records; n++ )
- FREE( face->hdmx.records[n].widths );
-
- FREE( face->hdmx.records );
- face->hdmx.num_records = 0;
- }
-
- return TT_Err_Ok;
- }
-
-
-/* END */
--- a/src/shared/sfnt/ttload.h
+++ /dev/null
@@ -1,353 +1,0 @@
-/***************************************************************************/
-/* */
-/* ttload.h */
-/* */
-/* Load the basic TrueType tables, i.e., tables that can be either in */
-/* TTF or OTF font (specification). */
-/* */
-/* Copyright 1996-1999 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 TTLOAD_H
-#define TTLOAD_H
-
-
-#include <ftstream.h>
-#include <ttobjs.h>
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_LookUp_Table */
- /* */
- /* <Description> */
- /* Looks for a TrueType table by name. */
- /* */
- /* <Input> */
- /* face :: A face object handle. */
- /* tag :: The searched tag. */
- /* */
- /* <Return> */
- /* Index of table if found, -1 otherwise. */
- /* */
- EXPORT_DEF
- TT_Long TT_LookUp_Table( TT_Face face,
- TT_ULong tag );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Directory */
- /* */
- /* <Description> */
- /* Loads the table directory into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* faceIndex :: The index of the TrueType font, if we're opening a */
- /* collection. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Directory( TT_Face face,
- FT_Stream stream,
- TT_Long faceIndex );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Any */
- /* */
- /* <Description> */
- /* Loads any font table into client memory. Used by the */
- /* TT_Get_Font_Data() API function. */
- /* */
- /* <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> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Any( TT_Face face,
- TT_ULong tag,
- TT_Long offset,
- void* buffer,
- TT_Long* length );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Header */
- /* */
- /* <Description> */
- /* Loads the TrueType font header. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Header( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Metrics_Header */
- /* */
- /* <Description> */
- /* Loads the horizontal or vertical header in a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* vertical :: A boolean flag. If set, load vertical metrics. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Metrics_Header( TT_Face face,
- FT_Stream stream,
- TT_Bool vertical );
-
-
- LOCAL_DEF
- TT_Error TT_Load_CMap( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_MaxProfile */
- /* */
- /* <Description> */
- /* Loads the maximum profile into a face object. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_MaxProfile( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Names */
- /* */
- /* <Description> */
- /* Loads the name records. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Names( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_OS2 */
- /* */
- /* <Description> */
- /* Loads the OS2 table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_OS2( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Postscript */
- /* */
- /* <Description> */
- /* Loads the Postscript table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_PostScript( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Hdmx */
- /* */
- /* <Description> */
- /* Loads the horizontal device metrics table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: A handle to the input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Hdmx( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Free_Names */
- /* */
- /* <Description> */
- /* Frees the name records. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Free_Names( TT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Free_Hdmx */
- /* */
- /* <Description> */
- /* Frees the horizontal device metrics table. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Free_Hdmx ( TT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Kern */
- /* */
- /* <Description> */
- /* Loads the first kerning table with format 0 in the font. Only */
- /* accepts the first horizontal kerning table. Developers should use */
- /* the `ftxkern' extension to access other kerning tables in the font */
- /* file, if they really want to. */
- /* */
- /* <Input> */
- /* face :: A handle to the target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Kern( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_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> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_Gasp( TT_Face face,
- FT_Stream stream );
-
-
-#endif /* TTLOAD_H */
-
-
-/* END */
--- a/src/shared/sfnt/ttpost.c
+++ /dev/null
@@ -1,713 +1,0 @@
-/***************************************************************************/
-/* */
-/* ttpost.c */
-/* */
-/* Postscript names table processing (body). */
-/* */
-/* Copyright 1996-1999 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. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The post table is not completely loaded by the core engine. This */
- /* file loads the missing PS glyph names and implements an API to access */
- /* them. */
- /* */
- /*************************************************************************/
-
-
-#include <ttpost.h>
-#include <ftstream.h>
-#include <tterrors.h>
-#include <ttload.h>
-#include <tttags.h>
-
- /* the 258 default Mac PS glyph names */
-
- const TT_String* TT_Mac_Postscript_Names[258] =
- {
- /* 0 */
- ".notdef",
- ".null",
- "CR",
- "space",
- "exclam",
- "quotedbl",
- "numbersign",
- "dollar",
- "percent",
- "ampersand",
-
- /* 10 */
- "quotesingle",
- "parenleft",
- "parenright",
- "asterisk",
- "plus",
- "comma",
- "hyphen",
- "period",
- "slash",
- "zero",
-
- /* 20 */
- "one",
- "two",
- "three",
- "four",
- "five",
- "six",
- "seven",
- "eight",
- "nine",
- "colon",
-
- /* 30 */
- "semicolon",
- "less",
- "equal",
- "greater", "question",
- "at",
- "A",
- "B",
- "C",
- "D",
-
- /* 40 */
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
-
- /* 50 */
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
-
- /* 60 */
- "Y",
- "Z",
- "bracketleft",
- "backslash",
- "bracketright",
- "asciicircum",
- "underscore",
- "grave",
- "a",
- "b",
-
- /* 70 */
- "c",
- "d",
- "e",
- "f",
- "g",
- "h",
- "i",
- "j",
- "k",
- "l",
-
- /* 80 */
- "m",
- "n",
- "o",
- "p",
- "q",
- "r",
- "s",
- "t",
- "u",
- "v",
-
- /* 90 */
- "w",
- "x",
- "y",
- "z",
- "braceleft",
- "bar",
- "braceright",
- "asciitilde",
- "Adieresis",
- "Aring",
-
- /* 100 */
- "Ccedilla",
- "Eacute",
- "Ntilde",
- "Odieresis",
- "Udieresis",
- "aacute",
- "agrave",
- "acircumflex",
- "adieresis",
- "atilde",
-
- /* 110 */
- "aring",
- "ccedilla",
- "eacute",
- "egrave",
- "ecircumflex",
- "edieresis",
- "iacute",
- "igrave",
- "icircumflex",
- "idieresis",
-
- /* 120 */
- "ntilde",
- "oacute",
- "ograve",
- "ocircumflex",
- "odieresis",
- "otilde",
- "uacute",
- "ugrave",
- "ucircumflex",
- "udieresis",
-
- /* 130 */
- "dagger",
- "degree",
- "cent",
- "sterling",
- "section",
- "bullet",
- "paragraph",
- "germandbls",
- "registered",
- "copyright",
-
- /* 140 */
- "trademark",
- "acute",
- "dieresis",
- "notequal",
- "AE",
- "Oslash",
- "infinity",
- "plusminus",
- "lessequal",
- "greaterequal",
-
- /* 150 */
- "yen",
- "mu",
- "partialdiff",
- "summation",
- "product",
- "pi",
- "integral",
- "ordfeminine",
- "ordmasculine",
- "Omega",
-
- /* 160 */
- "ae",
- "oslash",
- "questiondown",
- "exclamdown",
- "logicalnot",
- "radical",
- "florin",
- "approxequal",
- "Delta",
- "guillemotleft",
-
- /* 170 */
- "guillemotright",
- "ellipsis",
- "nbspace",
- "Agrave",
- "Atilde",
- "Otilde",
- "OE",
- "oe",
- "endash",
- "emdash",
-
- /* 180 */
- "quotedblleft",
- "quotedblright",
- "quoteleft",
- "quoteright",
- "divide",
- "lozenge",
- "ydieresis",
- "Ydieresis",
- "fraction",
- "currency",
-
- /* 190 */
- "guilsinglleft",
- "guilsinglright",
- "fi",
- "fl",
- "daggerdbl",
- "periodcentered",
- "quotesinglbase",
- "quotedblbase",
- "perthousand",
- "Acircumflex",
-
- /* 200 */
- "Ecircumflex",
- "Aacute",
- "Edieresis",
- "Egrave",
- "Iacute",
- "Icircumflex",
- "Idieresis",
- "Igrave",
- "Oacute",
- "Ocircumflex",
-
- /* 210 */
- "apple",
- "Ograve",
- "Uacute",
- "Ucircumflex",
- "Ugrave",
- "dotlessi",
- "circumflex",
- "tilde",
- "macron",
- "breve",
-
- /* 220 */
- "dotaccent",
- "ring",
- "cedilla",
- "hungarumlaut",
- "ogonek",
- "caron",
- "Lslash",
- "lslash",
- "Scaron",
- "scaron",
-
- /* 230 */
- "Zcaron",
- "zcaron",
- "brokenbar",
- "Eth",
- "eth",
- "Yacute",
- "yacute",
- "Thorn",
- "thorn",
- "minus",
-
- /* 240 */
- "multiply",
- "onesuperior",
- "twosuperior",
- "threesuperior",
- "onehalf",
- "onequarter",
- "threequarters",
- "franc",
- "Gbreve",
- "gbreve",
-
- /* 250 */
- "Idot",
- "Scedilla",
- "scedilla",
- "Cacute",
- "cacute",
- "Ccaron",
- "ccaron",
- "dmacron",
- };
-
-
- static
- TT_Error Load_Format_20( TT_Face face,
- FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
- TT_Error error;
-
- TT_UShort num_glyphs;
- TT_UShort num_names;
-
- TT_UShort* glyph_indices = 0;
- TT_Char** name_strings = 0;
-
-
- if ( READ_UShort( num_glyphs ) )
- goto Exit;
-
- /* UNDOCUMENTED! The number of glyphs in this table can be smaller */
- /* than the value in the maxp table (cf. cyberbit.ttf). */
-
- /* There already exist fonts which have more than 32768 glyph names */
- /* in this table, so the test for this threshold has been dropped. */
-
- if ( num_glyphs > face->root.num_glyphs )
- {
- error = TT_Err_Invalid_File_Format;
- goto Exit;
- }
-
- /* load the indices */
- {
- TT_UShort n;
-
-
- if ( ALLOC_ARRAY ( glyph_indices, num_glyphs, TT_UShort ) ||
- ACCESS_Frame( num_glyphs * 2L ) )
- goto Fail;
-
- for ( n = 0; n < num_glyphs; n++ )
- glyph_indices[n] = GET_UShort();
-
- FORGET_Frame();
- }
-
- /* compute number of names stored in table */
- {
- TT_UShort n;
-
-
- num_names = 0;
-
- for ( n = 0; n < num_glyphs; n++ )
- {
- TT_UShort index;
-
-
- index = glyph_indices[n];
- if ( index >= 258 )
- {
- index -= 257;
- if ( index > num_names )
- num_names = index;
- }
- }
- }
-
- /* now load the name strings */
- {
- TT_UShort n;
-
-
- if ( ALLOC_ARRAY( name_strings, num_names, TT_Char* ) )
- goto Fail;
-
- for ( n = 0; n < num_names; n++ )
- {
- TT_Byte len;
-
-
- if ( READ_Byte ( len ) ||
- ALLOC_ARRAY( name_strings[n], len+1, TT_Char ) ||
- FILE_Read ( name_strings[n], len ) )
- goto Fail1;
-
- name_strings[n][len] = '\0';
- }
- }
-
- /* all right, set table fields and exit successfuly */
- {
- TT_Post_20* table = &face->postscript_names.names.format_20;
-
-
- table->num_glyphs = num_glyphs;
- table->num_names = num_names;
- table->glyph_indices = glyph_indices;
- table->glyph_names = name_strings;
- }
- return TT_Err_Ok;
-
-
- Fail1:
- {
- TT_UShort n;
-
-
- for ( n = 0; n < num_names; n++ )
- FREE( name_strings[n] );
- }
-
- Fail:
- FREE( name_strings );
- FREE( glyph_indices );
-
- Exit:
- return error;
- }
-
-
- static
- TT_Error Load_Format_25( TT_Face face,
- FT_Stream stream )
- {
- FT_Memory memory = stream->memory;
- TT_Error error;
-
- TT_UShort num_glyphs;
- TT_Char* offset_table = 0;
-
-
- /* UNDOCUMENTED! This value appears only in the Apple TT specs. */
- if ( READ_UShort( num_glyphs ) )
- goto Exit;
-
- /* check the number of glyphs */
- if ( num_glyphs > face->root.num_glyphs || num_glyphs > 258 )
- {
- error = TT_Err_Invalid_File_Format;
- goto Exit;
- }
-
- if ( ALLOC ( offset_table, num_glyphs ) ||
- FILE_Read( offset_table, num_glyphs ) )
- goto Fail;
-
- /* now check the offset table */
- {
- TT_UShort n;
-
-
- for ( n = 0; n < num_glyphs; n++ )
- {
- TT_Long index = (TT_Long)n + offset_table[n];
-
-
- if ( index < 0 || index > num_glyphs )
- {
- error = TT_Err_Invalid_File_Format;
- goto Fail;
- }
- }
- }
-
- /* OK, set table fields and exit successfuly */
- {
- TT_Post_25* table = &face->postscript_names.names.format_25;
-
-
- table->num_glyphs = num_glyphs;
- table->offsets = offset_table;
- }
-
- return TT_Err_Ok;
-
- Fail:
- FREE( offset_table );
-
- Exit:
- return error;
- }
-
-
- static
- TT_Error Load_Post_Names( TT_Face face )
- {
- FT_Stream stream;
- TT_Error error;
-
- /* get a stream for the face's resource */
- stream = face->root.stream;
-
- /* seek to the beginning of the PS names table */
- {
- TT_Long table;
-
-
- table = TT_LookUp_Table( face, TTAG_post );
- if ( FILE_Seek( face->dir_tables[table].Offset + 32L ) )
- goto Exit;
- }
-
- /* now read postscript table */
- switch ( face->postscript.FormatType )
- {
- case 0x00020000:
- error = Load_Format_20( face, stream );
- break;
-
- case 0x00028000:
- error = Load_Format_25( face, stream );
- break;
-
- default:
- error = TT_Err_Invalid_File_Format;
- }
-
- face->postscript_names.loaded = 1;
-
- Exit:
- return error;
- }
-
-
- LOCAL_FUNC
- void TT_Free_Post_Names( TT_Face face )
- {
- FT_Memory memory = face->root.memory;
- TT_Post_Names* names = &face->postscript_names;
-
-
- if ( names->loaded )
- {
- switch ( face->postscript.FormatType )
- {
- case 0x00020000:
- {
- TT_Post_20* table = &names->names.format_20;
- TT_UShort n;
-
-
- FREE( table->glyph_indices );
- table->num_glyphs = 0;
-
- for ( n = 0; n < table->num_names; n++ )
- FREE( table->glyph_names[n] );
-
- FREE( table->glyph_names );
- table->num_names = 0;
- }
- break;
-
- case 0x00028000:
- {
- TT_Post_25* table = &names->names.format_25;
-
-
- FREE( table->offsets );
- table->num_glyphs = 0;
- }
- break;
- }
- }
- names->loaded = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Get_PS_Name */
- /* */
- /* <Description> */
- /* Gets the PostScript glyph name of a glyph. */
- /* */
- /* <Input> */
- /* index :: The glyph index. */
- /* */
- /* PSname :: The address of a string pointer. Will be NULL in case */
- /* of error, otherwise it is a pointer to the glyph name. */
- /* */
- /* You must not modify the returned string! */
- /* */
- /* <Output> */
- /* TrueType error code. 0 means success. */
- /* */
- EXPORT_FUNC
- TT_Error TT_Get_PS_Name( TT_Face face,
- TT_UInt index,
- TT_String** PSname )
- {
- TT_Error error;
- TT_Post_Names* names;
-
- if ( !face )
- return TT_Err_Invalid_Face_Handle;
-
- if ( index >= face->root.num_glyphs )
- return TT_Err_Invalid_Glyph_Index;
-
- names = &face->postscript_names;
-
- /* `.notdef' by default */
- *PSname = (TT_String*)TT_Mac_Postscript_Names[0];
-
- switch ( face->postscript.FormatType )
- {
- case 0x00010000:
- if ( index < 258 ) /* paranoid checking */
- *PSname = (TT_String*)TT_Mac_Postscript_Names[index];
- break;
-
- case 0x00020000:
- {
- TT_Post_20* table = &names->names.format_20;
-
-
- if ( !names->loaded )
- {
- error = Load_Post_Names( face );
- if ( error )
- break;
- }
-
- if ( index < table->num_glyphs )
- {
- TT_UShort name_index = table->glyph_indices[index];
-
-
- if ( name_index < 258 )
- *PSname = (TT_String*)TT_Mac_Postscript_Names[name_index];
- else
- *PSname = (TT_String*)table->glyph_names[name_index - 258];
- }
- }
- break;
-
- case 0x00028000:
- {
- TT_Post_25* table = &names->names.format_25;
-
-
- if ( !names->loaded )
- {
- error = Load_Post_Names( face );
- if ( error )
- break;
- }
-
- if ( index < table->num_glyphs ) /* paranoid checking */
- {
- index += table->offsets[index];
- *PSname = (TT_String*)TT_Mac_Postscript_Names[index];
- }
- }
- break;
-
- case 0x00030000:
- break; /* nothing to do */
- }
-
- return TT_Err_Ok;
- }
-
-
-/* END */
--- a/src/shared/sfnt/ttpost.h
+++ /dev/null
@@ -1,95 +1,0 @@
-/***************************************************************************/
-/* */
-/* ttpost.h */
-/* */
-/* Postcript name table processing for TrueType and OpenType fonts */
-/* (specification). */
-/* */
-/* Copyright 1996-1999 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. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The post table is not completely loaded by the core engine. This */
- /* file loads the missing PS glyph names and implements an API to access */
- /* them. */
- /* */
- /*************************************************************************/
-
-
-#ifndef TTPOST_H
-#define TTPOST_H
-
-#include <ftconfig.h>
-#include <tttypes.h>
-#include <ttconfig.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define TT_Err_Invalid_Post_Table_Format 0x0B00
-#define TT_Err_Invalid_Post_Table 0x0B01
-
-
-#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-
-#if 0
- /* the 258 standard Mac glyph names, used for format 1.0 and 2.5 */
- LOCAL_DEF
- const TT_String* TT_Mac_Postscript_Names[];
-#endif
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Get_PS_Name */
- /* */
- /* <Description> */
- /* Gets the PostScript glyph name of a glyph. */
- /* */
- /* <Input> */
- /* index :: The glyph index. */
- /* */
- /* PSname :: The address of a string pointer. Will be NULL in case */
- /* of error, otherwise it is a pointer to the glyph name. */
- /* */
- /* You must not modify the returned string! */
- /* */
- /* <Output> */
- /* TrueType error code. 0 means success. */
- /* */
- EXPORT_DEF
- TT_Error TT_Get_PS_Name( TT_Face face,
- TT_UInt index,
- TT_String** PSname );
-
-
- LOCAL_DEF
- void TT_Free_Post_Names( TT_Face face );
-
-
-#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* TTPOST_H */
-
-
-/* END */
--- a/src/shared/sfnt/ttsbit.c
+++ /dev/null
@@ -1,1443 +1,0 @@
-/***************************************************************************/
-/* */
-/* ttsbit.c */
-/* */
-/* TrueType and OpenType embedded bitmap support (body). */
-/* */
-/* Copyright 1996-1999 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. */
-/* */
-/* */
-/* WARNING: This file should not be compiled directly, it is meant to be */
-/* included in the source of several font drivers (i.e., the TTF */
-/* and OTF drivers). */
-/* */
-/***************************************************************************/
-
-
-#include <ftdebug.h>
-
-#include <ttsbit.h>
-#include <tttags.h>
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* blit_sbit */
- /* */
- /* <Description> */
- /* Blits a bitmap from an input stream into a given target. Supports */
- /* x and y offsets as well as byte padded lines. */
- /* */
- /* <Input> */
- /* target :: The target bitmap/pixmap. */
- /* */
- /* source :: The input packed bitmap data. */
- /* */
- /* line_bits :: The number of bits per line. */
- /* */
- /* byte_padded :: A flag which is true if lines are byte-padded. */
- /* */
- /* x_offset :: The horizontal offset. */
- /* */
- /* y_offset :: The vertical offset. */
- /* */
- /* <Note> */
- /* IMPORTANT: The x and y offsets are relative to the top corner of */
- /* the target bitmap (unlike the normal TrueType */
- /* convention). A positive y offset indicates a downwards */
- /* direction! */
- /* */
- static
- void blit_sbit( FT_Bitmap* target,
- FT_Byte* source,
- FT_Int line_bits,
- FT_Bool byte_padded,
- FT_Int x_offset,
- FT_Int y_offset )
- {
- FT_Byte* line_buff;
- FT_Int line_incr;
- FT_Int height;
-
- FT_UShort acc;
- FT_Byte loaded;
-
-
- /* first of all, compute starting write position */
- line_incr = target->pitch;
- line_buff = target->buffer;
-
- if (line_incr < 0)
- line_buff -= line_incr*(target->rows-1);
-
- line_buff += (x_offset >> 3) + y_offset * line_incr;
-
- /***********************************************************************/
- /* */
- /* We use the extra-classic `accumulator' trick to extract the bits */
- /* from the source byte stream. */
- /* */
- /* Namely, the variable `acc' is a 16-bit accumulator containing the */
- /* last `loaded' bits from the input stream. The bits are shifted to */
- /* the upmost position in `acc'. */
- /* */
- /***********************************************************************/
-
- acc = 0; /* clear accumulator */
- loaded = 0; /* no bits were loaded */
-
- for ( height = target->rows; height > 0; height-- )
- {
- FT_Byte* cur = line_buff; /* current write cursor */
- FT_Int count = line_bits; /* # of bits to extract per line */
- FT_Byte shift = x_offset & 7; /* current write shift */
- FT_Byte space = 8 - shift;
-
-
- /* first of all, read individual source bytes */
- if ( count >= 8 )
- {
- count -= 8;
- {
- do
- {
- FT_Byte val;
-
- /* ensure that there are at least 8 bits in the accumulator */
- if ( loaded < 8 )
- {
- acc |= ((FT_UShort)*source++) << (8 - loaded);
- loaded += 8;
- }
-
- /* now write one byte */
- val = (FT_Byte)(acc >> 8);
- if (shift)
- {
- cur[0] |= val >> shift;
- cur[1] |= val << space;
- }
- else
- cur[0] = val;
-
- cur++;
- acc <<= 8; /* remove bits from accumulator */
- loaded -= 8;
- count -= 8;
- }
- while ( count >= 0 );
- }
-
- /* restore `count' to correct value */
- count += 8;
- }
-
- /* now write remaining bits (count < 8) */
- if ( count > 0 )
- {
- FT_Byte val;
-
-
- /* ensure that there are at least `count' bits in the accumulator */
- if ( loaded < count )
- {
- acc |= ((FT_UShort)*source++) << (8 - loaded);
- loaded += 8;
- }
-
- /* now write remaining bits */
- val = ((FT_Byte)(acc >> 8)) & ~(0xFF >> count);
- cur[0] |= val >> shift;
-
- if ( count > space )
- cur[1] |= val << space;
-
- acc <<= count;
- loaded -= count;
- }
-
- /* now, skip to next line */
- if ( byte_padded )
- acc = loaded = 0; /* clear accumulator on byte-padded lines */
-
- line_buff += line_incr;
- }
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_Small_SBit_Metrics */
- /* */
- /* <Description> */
- /* Loads a small bitmap metrics record. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* metrics :: A small metrics structure. */
- /* */
- static
- void TT_Load_Small_SBit_Metrics( TT_SBit_Small_Metrics* metrics,
- FT_Stream stream )
- {
- metrics->height = GET_Byte();
- metrics->width = GET_Byte();
- metrics->bearingX = GET_Char();
- metrics->bearingY = GET_Char();
- metrics->advance = GET_Byte();
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Metrics */
- /* */
- /* <Description> */
- /* Loads a bitmap metrics record. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* metrics :: A metrics structure. */
- /* */
- static
- void TT_Load_SBit_Metrics( TT_SBit_Metrics* metrics,
- FT_Stream stream )
- {
- metrics->height = GET_Byte();
- metrics->width = GET_Byte();
-
- metrics->horiBearingX = GET_Char();
- metrics->horiBearingY = GET_Char();
- metrics->horiAdvance = GET_Byte();
-
- metrics->vertBearingX = GET_Char();
- metrics->vertBearingY = GET_Char();
- metrics->vertAdvance = GET_Byte();
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Line_Metrics */
- /* */
- /* <Description> */
- /* Loads a bitmap line metrics record. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* metrics :: A line metrics structure. */
- /* */
- static
- void TT_Load_SBit_Line_Metrics( TT_SBit_Line_Metrics* metrics,
- FT_Stream stream )
- {
- metrics->ascender = GET_Char();
- metrics->descender = GET_Char();
- metrics->max_width = GET_Byte();
-
- metrics->caret_slope_numerator = GET_Char();
- metrics->caret_slope_denominator = GET_Char();
- metrics->caret_offset = GET_Char();
-
- metrics->min_origin_SB = GET_Char();
- metrics->min_advance_SB = GET_Char();
- metrics->max_before_BL = GET_Char();
- metrics->min_after_BL = GET_Char();
- metrics->pads[0] = GET_Char();
- metrics->pads[1] = GET_Char();
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Const_Metrics */
- /* */
- /* <Description> */
- /* Loads the metrics for `EBLC' index tables format 2 and 5. */
- /* */
- /* <Input> */
- /* range :: The target range. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- static
- TT_Error Load_SBit_Const_Metrics( TT_SBit_Range* range,
- FT_Stream stream )
- {
- TT_Error error;
-
- if ( !ACCESS_Frame( 12L ) )
- {
- range->image_size = GET_ULong();
- TT_Load_SBit_Metrics( &range->metrics, stream );
-
- FORGET_Frame();
- }
-
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Range_Codes */
- /* */
- /* <Description> */
- /* Loads the range codes for `EBLC' index tables format 4 and 5. */
- /* */
- /* <Input> */
- /* range :: The target range. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* load_offsets :: A flag whether to load the glyph offset table. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- static
- TT_Error Load_SBit_Range_Codes( TT_SBit_Range* range,
- FT_Stream stream,
- TT_Bool load_offsets )
- {
- TT_Error error;
- TT_ULong count, n, size;
- FT_Memory memory = stream->memory;
-
-
- if ( READ_ULong( count ) )
- goto Exit;
-
- range->num_glyphs = count;
-
- /* Allocate glyph offsets table if needed */
- if ( load_offsets )
- {
- if ( ALLOC_ARRAY( range->glyph_offsets, count, TT_ULong ) )
- goto Exit;
-
- size = count * 4L;
- }
- else
- size = count * 2L;
-
- /* Allocate glyph codes table and access frame */
- if ( ALLOC_ARRAY ( range->glyph_codes, count, TT_UShort ) ||
- ACCESS_Frame( size ) )
- goto Exit;
-
- for ( n = 0; n < count; n++ )
- {
- range->glyph_codes[n] = GET_UShort();
-
- if (load_offsets)
- range->glyph_offsets[n] = (TT_ULong)range->image_offset +
- GET_UShort();
- }
-
- FORGET_Frame();
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Range */
- /* */
- /* <Description> */
- /* Loads a given `EBLC' index/range table. */
- /* */
- /* <Input> */
- /* range :: The target range. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- static
- TT_Error Load_SBit_Range( TT_SBit_Range* range,
- FT_Stream stream )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
-
-
- switch( range->index_format )
- {
- case 1: /* variable metrics with 4-byte offsets */
- case 3: /* variable metrics with 2-byte offsets */
- {
- TT_ULong num_glyphs, n;
- TT_Int size_elem;
- TT_Bool large = (range->index_format == 1);
-
-
- num_glyphs = range->last_glyph - range->first_glyph + 1L;
- range->num_glyphs = num_glyphs;
- num_glyphs++; /* XXX : BEWARE - see spec */
-
- size_elem = ( large ? 4 : 2 );
-
- if ( ALLOC_ARRAY( range->glyph_offsets,
- num_glyphs, TT_ULong ) ||
-
- ACCESS_Frame( num_glyphs * size_elem ) )
- goto Exit;
-
- for ( n = 0; n < num_glyphs; n++ )
- range->glyph_offsets[n] = (TT_ULong)( range->image_offset +
- (large ? GET_ULong() : GET_UShort()) );
- FORGET_Frame();
- }
- break;
-
- case 2: /* all glyphs have identical metrics */
- error = Load_SBit_Const_Metrics( range, stream );
- break;
-
- case 4:
- error = Load_SBit_Range_Codes( range, stream, 1 );
- break;
-
- case 5:
- error = Load_SBit_Const_Metrics( range, stream ) ||
- Load_SBit_Range_Codes( range, stream, 0 );
- break;
-
- default:
- error = TT_Err_Invalid_File_Format;
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Strikes */
- /* */
- /* <Description> */
- /* Loads the table of embedded bitmap sizes for this face. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_SBit_Strikes( TT_Face face,
- FT_Stream stream )
- {
- TT_Error error = 0;
- FT_Memory memory = stream->memory;
- TT_Fixed version;
- TT_ULong num_strikes;
- TT_ULong table_base;
- TT_Long table;
-
-
- /* this table is optional */
- if ( ( table = TT_LookUp_Table( face, TTAG_EBLC ) ) < 0 )
- goto Exit;
-
- table_base = face->dir_tables[table].Offset;
- if ( FILE_Seek( table_base ) ||
- ACCESS_Frame( 8L ) )
- goto Exit;
-
- version = GET_Long();
- num_strikes = GET_ULong();
-
- FORGET_Frame();
-
- /* check version number and strike count */
- if ( version != 0x00020000 ||
- num_strikes >= 0x10000 )
- {
- FT_ERROR(( "TT_Load_SBit_Strikes: invalid table version!\n" ));
- error = TT_Err_Invalid_File_Format;
-
- goto Exit;
- }
-
- /* allocate the strikes table */
- if ( ALLOC_ARRAY( face->sbit_strikes, num_strikes, TT_SBit_Strike ) )
- goto Exit;
-
- face->num_sbit_strikes = num_strikes;
-
- /* now read each strike table separately */
- {
- TT_SBit_Strike* strike = face->sbit_strikes;
- TT_ULong count = num_strikes;
-
- if ( ACCESS_Frame( 48L * num_strikes ) )
- goto Exit;
-
- while ( count > 0 )
- {
- TT_ULong indexTablesSize;
-
-
- strike->ranges_offset = GET_ULong();
- indexTablesSize = GET_ULong(); /* don't save */
-
- strike->num_ranges = GET_ULong();
- strike->color_ref = GET_ULong();
-
- TT_Load_SBit_Line_Metrics( &strike->hori, stream );
- TT_Load_SBit_Line_Metrics( &strike->vert, stream );
-
- strike->start_glyph = GET_UShort();
- strike->end_glyph = GET_UShort();
- strike->x_ppem = GET_Byte();
- strike->y_ppem = GET_Byte();
- strike->bit_depth = GET_Byte();
- strike->flags = GET_Char();
-
- count--;
- strike++;
- }
-
- FORGET_Frame();
- }
-
- /* allocate the index ranges for each strike table */
- {
- TT_SBit_Strike* strike = face->sbit_strikes;
- TT_ULong count = num_strikes;
-
-
- while ( count > 0 )
- {
- TT_SBit_Range* range;
- TT_ULong count2 = strike->num_ranges;
-
-
- if ( ALLOC_ARRAY( strike->sbit_ranges,
- strike->num_ranges,
- TT_SBit_Range ) )
- goto Exit;
-
- /* read each range */
- if ( FILE_Seek( table_base + strike->ranges_offset ) ||
- ACCESS_Frame( strike->num_ranges * 8L ) )
- goto Exit;
-
- range = strike->sbit_ranges;
- while ( count2 > 0 )
- {
- range->first_glyph = GET_UShort();
- range->last_glyph = GET_UShort();
- range->table_offset = table_base + strike->ranges_offset
- + GET_ULong();
- count2--;
- range++;
- }
-
- FORGET_Frame();
-
- /* Now, read each index table */
- count2 = strike->num_ranges;
- range = strike->sbit_ranges;
- while ( count2 > 0 )
- {
- /* Read the header */
- if ( FILE_Seek( range->table_offset ) ||
- ACCESS_Frame( 8L ) )
- goto Exit;
-
- range->index_format = GET_UShort();
- range->image_format = GET_UShort();
- range->image_offset = GET_ULong();
-
- FORGET_Frame();
-
- error = Load_SBit_Range( range, stream );
- if ( error )
- goto Exit;
-
- count2--;
- range++;
- }
-
- count--;
- strike++;
- }
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Free_SBit_Strikes */
- /* */
- /* <Description> */
- /* Releases the embedded bitmap tables. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- LOCAL_FUNC
- void TT_Free_SBit_Strikes( TT_Face face )
- {
- FT_Memory memory = face->root.memory;
- TT_SBit_Strike* strike = face->sbit_strikes;
- TT_SBit_Strike* strike_limit = strike + face->num_sbit_strikes;
-
-
- if ( strike )
- {
- for ( ; strike < strike_limit; strike++ )
- {
- TT_SBit_Range* range = strike->sbit_ranges;
- TT_SBit_Range* range_limit = range + strike->num_ranges;
-
- if ( range )
- {
- for ( ; range < range_limit; range++ )
- {
- /* release the glyph offsets and codes tables */
- /* where appropriate */
- FREE( range->glyph_offsets );
- FREE( range->glyph_codes );
- }
- }
- FREE( strike->sbit_ranges );
- strike->num_ranges = 0;
- }
- FREE( face->sbit_strikes );
- }
- face->num_sbit_strikes = 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Find_SBit_Range */
- /* */
- /* <Description> */
- /* Scans a given strike's ranges and return, for a given glyph */
- /* index, the corresponding sbit range, and `EBDT' offset. */
- /* */
- /* <Input> */
- /* glyph_index :: The glyph index. */
- /* strike :: The source/current sbit strike. */
- /* */
- /* <Output> */
- /* arange :: The sbit range containing the glyph index. */
- /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means the glyph index was found. */
- /* */
- static
- TT_Error Find_SBit_Range( TT_UShort glyph_index,
- TT_SBit_Strike* strike,
- TT_SBit_Range** arange,
- TT_ULong* aglyph_offset )
- {
- TT_SBit_Range *range, *range_limit;
-
-
- /* check whether the glyph index is within this strike's */
- /* glyph range */
- if ( glyph_index < strike->start_glyph ||
- glyph_index > strike->end_glyph )
- goto Fail;
-
- /* scan all ranges in strike */
- range = strike->sbit_ranges;
- range_limit = range + strike->num_ranges;
- if ( !range )
- goto Fail;
-
- for ( ; range < range_limit; range++ )
- {
- if ( glyph_index >= range->first_glyph &&
- glyph_index <= range->last_glyph )
- {
- TT_UShort delta = glyph_index - range->first_glyph;
-
-
- switch ( range->index_format )
- {
- case 1:
- case 3:
- *aglyph_offset = range->glyph_offsets[delta];
- break;
-
- case 2:
- *aglyph_offset = range->image_offset +
- range->image_size * delta;
- break;
-
- case 4:
- case 5:
- {
- TT_ULong n;
-
-
- for ( n = 0; n < range->num_glyphs; n++ )
- {
- if ( range->glyph_codes[n] == glyph_index )
- {
- if ( range->index_format == 4 )
- *aglyph_offset = range->glyph_offsets[n];
- else
- *aglyph_offset = range->image_offset +
- n * range->image_size;
- break;
- }
- }
- }
-
- /* fall-through */
- default:
- goto Fail;
- }
-
- /* return successfully! */
- *arange = range;
-
- return 0;
- }
- }
-
- Fail:
- *arange = 0;
- *aglyph_offset = 0;
-
- return TT_Err_Invalid_Argument;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Find_SBit_Image */
- /* */
- /* <Description> */
- /* Checks whether an embedded bitmap (an `sbit') exists for a given */
- /* glyph, at given x and y ppems. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* glyph_index :: The glyph index. */
- /* x_ppem :: The horizontal resolution in points per EM. */
- /* y_ppem :: The vertical resolution in points per EM. */
- /* */
- /* <Output> */
- /* arange :: The SBit range containing the glyph index. */
- /* astrike :: The SBit strike containing the glyph index. */
- /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. Returns */
- /* TT_Err_Invalid_Argument if no sbit exist for the requested glyph. */
- /* */
- static
- TT_Error Find_SBit_Image( TT_Face face,
- TT_UShort glyph_index,
- TT_Int x_ppem,
- TT_Int y_ppem,
-
- TT_SBit_Range** arange,
- TT_SBit_Strike** astrike,
- TT_ULong* aglyph_offset )
- {
- TT_SBit_Strike* strike = face->sbit_strikes;
- TT_SBit_Strike* strike_limit = strike + face->num_sbit_strikes;
-
-
- if ( !strike)
- goto Fail;
-
- for ( ; strike < strike_limit; strike++ )
- {
- if ( strike->x_ppem == x_ppem && strike->y_ppem == y_ppem )
- {
- TT_Error error;
-
-
- error = Find_SBit_Range( glyph_index, strike, arange, aglyph_offset );
- if ( error )
- goto Fail;
-
- *astrike = strike;
-
- return TT_Err_Ok;
- }
- }
-
- Fail:
- /* no embedded bitmap for this glyph in face */
- *arange = 0;
- *astrike = 0;
- *aglyph_offset = 0;
-
- return TT_Err_Invalid_Argument;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Load_SBit_Metrics */
- /* */
- /* <Description> */
- /* Gets the big metrics for a given SBit. */
- /* */
- /* <Input> */
- /* stream :: The input stream. */
- /* range :: The SBit range containing the glyph. */
- /* */
- /* <Output> */
- /* big_metrics :: A big SBit metrics structure for the glyph. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- /* <Note> */
- /* The stream cursor must be positioned at the glyph's offset within */
- /* the `EBDT' table before the call. */
- /* */
- /* If the image format uses variable metrics, the stream cursor is */
- /* positioned just after the metrics header in the `EBDT' table on */
- /* function exit. */
- /* */
- static
- TT_Error Load_SBit_Metrics( FT_Stream stream,
- TT_SBit_Range* range,
- TT_SBit_Metrics* metrics )
- {
- TT_Error error = TT_Err_Ok;
-
-
- switch ( range->index_format )
- {
- case 1: /* variable metrics */
- case 3:
- case 4:
- {
- switch ( range->image_format )
- {
- case 1: /* small metrics */
- case 2:
- case 8:
- {
- TT_SBit_Small_Metrics smetrics;
-
-
- /* read small metrics */
- if ( ACCESS_Frame( 5L ) )
- goto Exit;
- TT_Load_Small_SBit_Metrics( &smetrics, stream );
- FORGET_Frame();
-
- /* convert it to a big metrics */
- metrics->height = smetrics.height;
- metrics->width = smetrics.width;
- metrics->horiBearingX = smetrics.bearingX;
- metrics->horiBearingY = smetrics.bearingY;
- metrics->horiAdvance = smetrics.advance;
-
- /* these metrics are made up at a higher level when */
- /* needed. */
- metrics->vertBearingX = 0;
- metrics->vertBearingY = 0;
- metrics->vertAdvance = 0;
- }
- break;
-
- default: /* big metrics */
- if ( ACCESS_Frame( 8L ) )
- goto Exit;
- TT_Load_SBit_Metrics( metrics, stream );
- FORGET_Frame();
- }
- }
- break;
-
- default: /* constant metrics */
- *metrics = range->metrics;
- }
-
- Exit:
- return error;
- }
-
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* Crop_Bitmap */
- /* */
- /* <Description> */
- /* Crops a bitmap to its tightest bounding box, and adjusts its */
- /* metrics. */
- /* */
- /* <Input> */
- /* image :: The input glyph slot. */
- /* */
- /* metrics :: The corresponding metrics structure. */
- /* */
- static
- void Crop_Bitmap( FT_Bitmap* map,
- TT_SBit_Metrics* metrics )
- {
- /***********************************************************************/
- /* */
- /* In this situation, some bounding boxes of embedded bitmaps are too */
- /* large. We need to crop it to a reasonable size. */
- /* */
- /* --------- */
- /* | | ----- */
- /* | *** | |***| */
- /* | * | | * | */
- /* | * | ------> | * | */
- /* | * | | * | */
- /* | * | | * | */
- /* | *** | |***| */
- /* --------- ----- */
- /* */
- /***********************************************************************/
-
- TT_Int rows, count;
- TT_Long line_len;
- TT_Byte* line;
-
-
- /***********************************************************************/
- /* */
- /* first of all, checks the top-most lines of the bitmap, and removes */
- /* them if they're empty. */
- /* */
- {
- line = (TT_Byte*)map->buffer;
- rows = map->rows;
- line_len = map->pitch;
-
-
- for ( count = 0; count < rows; count++ )
- {
- TT_Byte* cur = line;
- TT_Byte* limit = line + line_len;
-
-
- for ( ; cur < limit; cur++ )
- if ( cur[0] )
- goto Found_Top;
-
- /* the current line was empty - skip to next one */
- line = limit;
- }
-
- Found_Top:
- /* check that we have at least one filled line */
- if ( count >= rows )
- goto Empty_Bitmap;
-
- /* now, crop the empty upper lines */
- if ( count > 0 )
- {
- line = (TT_Byte*)map->buffer;
-
- MEM_Move( line, line + count * line_len, (rows - count) * line_len );
-
- metrics->height -= count;
- metrics->horiBearingY -= count;
- metrics->vertBearingY -= count;
-
- map->rows -= count;
- rows -= count;
- }
- }
-
- /***********************************************************************/
- /* */
- /* second, crop the lower lines */
- /* */
- {
- line = (TT_Byte*)map->buffer + (rows - 1) * line_len;
-
- for ( count = 0; count < rows; count++ )
- {
- TT_Byte* cur = line;
- TT_Byte* limit = line + line_len;
-
-
- for ( ; cur < limit; cur++ )
- if ( cur[0] )
- goto Found_Bottom;
-
- /* the current line was empty - skip to previous one */
- line -= line_len;
- }
-
- Found_Bottom:
- if ( count > 0 )
- {
- metrics->height -= count;
- rows -= count;
- map->rows -= count;
- }
- }
-
- /***********************************************************************/
- /* */
- /* third, get rid of the space on the left side of the glyph */
- /* */
- do
- {
- TT_Byte* limit;
-
-
- line = (TT_Byte*)map->buffer;
- limit = line + rows * line_len;
-
- for ( ; line < limit; line += line_len )
- if ( line[0] & 0x80 )
- goto Found_Left;
-
- /* shift the whole glyph one pixel to the left */
- line = (TT_Byte*)map->buffer;
- limit = line + rows * line_len;
-
- for ( ; line < limit; line += line_len )
- {
- TT_Int n, width = map->width;
- TT_Byte old;
- TT_Byte* cur = line;
-
-
- old = cur[0] << 1;
- for ( n = 8; n < width; n += 8 )
- {
- TT_Byte val;
-
-
- val = cur[1];
- cur[0] = old | (val >> 7);
- old = val << 1;
- cur++;
- }
- cur[0] = old;
- }
-
- map->width--;
- metrics->horiBearingX++;
- metrics->vertBearingX++;
- metrics->width--;
- } while ( map->width > 0 );
-
- Found_Left:
-
- /***********************************************************************/
- /* */
- /* finally, crop the bitmap width to get rid of the space on the right */
- /* side of the glyph. */
- /* */
- do
- {
- TT_Int right = map->width-1;
- TT_Byte* limit;
- TT_Byte mask;
-
-
- line = (TT_Byte*)map->buffer + (right >> 3);
- limit = line + rows*line_len;
- mask = 0x80 >> (right & 7);
-
- for ( ; line < limit; line += line_len )
- if ( line[0] & mask )
- goto Found_Right;
-
- /* crop the whole glyph to the right */
- map->width--;
- metrics->width--;
- } while ( map->width > 0 );
-
- Found_Right:
- /* all right, the bitmap was cropped */
- return;
-
- Empty_Bitmap:
- map->width = 0;
- map->rows = 0;
- map->pitch = 0;
- map->pixel_mode = ft_pixel_mode_mono;
- }
-
-
- static
- TT_Error Load_SBit_Single( FT_Bitmap* map,
- TT_Int x_offset,
- TT_Int y_offset,
- TT_Int pix_bits,
- TT_UShort image_format,
- TT_SBit_Metrics* metrics,
- FT_Stream stream )
- {
- TT_Error error;
-
-
- /* check that the source bitmap fits into the target pixmap */
- if ( x_offset < 0 || x_offset + metrics->width > map->width ||
- y_offset < 0 || y_offset + metrics->height > map->rows )
- {
- error = TT_Err_Invalid_Argument;
-
- goto Exit;
- }
-
- {
- TT_Int glyph_width = metrics->width;
- TT_Int glyph_height = metrics->height;
- TT_Int glyph_size;
- TT_Int line_bits = pix_bits * glyph_width;
- TT_Bool pad_bytes = 0;
-
-
- /* compute size of glyph image */
- switch ( image_format )
- {
- case 1: /* byte-padded formats */
- case 6:
- {
- TT_Int line_length;
-
-
- switch ( pix_bits )
- {
- case 1: line_length = (glyph_width+7) >> 3; break;
- case 2: line_length = (glyph_width+3) >> 2; break;
- case 4: line_length = (glyph_width+1) >> 1; break;
- default: line_length = glyph_width;
- }
-
- glyph_size = glyph_height * line_length;
- pad_bytes = 1;
- }
- break;
-
- case 2:
- case 5:
- case 7:
- line_bits = glyph_width * pix_bits;
- glyph_size = (glyph_height * line_bits + 7) >> 3;
- break;
-
- default: /* invalid format */
- return TT_Err_Invalid_File_Format;
- }
-
- /* Now read data and draw glyph into target pixmap */
- if ( ACCESS_Frame( glyph_size ) )
- goto Exit;
-
- /* don't forget to multiply `x_offset' by `map->pix_bits' as */
- /* the sbit blitter doesn't make a difference between pixmap */
- /* depths. */
- blit_sbit( map, stream->cursor, line_bits, pad_bytes,
- x_offset * pix_bits, y_offset );
-
- FORGET_Frame();
- }
-
- Exit:
- return error;
- }
-
-
- static
- TT_Error Load_SBit_Image( TT_SBit_Strike* strike,
- TT_SBit_Range* range,
- TT_ULong ebdt_pos,
- TT_ULong glyph_offset,
- FT_Bitmap* map,
- TT_Int x_offset,
- TT_Int y_offset,
- FT_Stream stream,
- TT_SBit_Metrics* metrics )
- {
- FT_Memory memory = stream->memory;
- TT_Error error;
-
-
- /* place stream at beginning of glyph data and read metrics */
- if ( FILE_Seek( ebdt_pos + glyph_offset ) )
- goto Exit;
-
- error = Load_SBit_Metrics( stream, range, metrics );
- if ( error )
- goto Exit;
-
- /* this function is recursive. At the top-level call, the */
- /* field map.buffer is NULL. We thus begin by finding the */
- /* dimensions of the higher-level glyph to allocate the */
- /* final pixmap buffer */
- if ( map->buffer == 0 )
- {
- TT_Long size;
-
-
- map->width = metrics->width;
- map->rows = metrics->height;
-
- switch ( strike->bit_depth )
- {
- case 1:
- map->pixel_mode = ft_pixel_mode_mono;
- map->pitch = (map->width+7) >> 3;
- break;
- case 2:
- map->pixel_mode = ft_pixel_mode_pal2;
- map->pitch = (map->width+3) >> 2;
- break;
- case 4:
- map->pixel_mode = ft_pixel_mode_pal4;
- map->pitch = (map->width+1) >> 1;
- break;
- case 8:
- map->pixel_mode = ft_pixel_mode_grays;
- map->pitch = map->width;
- break;
-
- default:
- return TT_Err_Invalid_File_Format;
- }
-
- size = map->rows * map->pitch;
-
- /* check that there is no empty image */
- if ( size == 0 )
- goto Exit; /* exit successfully! */
-
- if ( ALLOC( map->buffer, size ) )
- goto Exit;
- }
-
- switch ( range->image_format )
- {
- case 1: /* single sbit image - load it */
- case 2:
- case 5:
- case 6:
- case 7:
- return Load_SBit_Single( map, x_offset, y_offset, strike->bit_depth,
- range->image_format, metrics, stream );
-
- case 8: /* compound format */
- case 9:
- break;
-
- default: /* invalid image format */
- return TT_Err_Invalid_File_Format;
- }
-
- /* All right, we're in a compound format. First of all, read */
- /* the array of elements */
- {
- TT_SBit_Component* components;
- TT_SBit_Component* comp;
- TT_UShort num_components, count;
-
-
- if ( READ_UShort( num_components ) ||
- ALLOC_ARRAY( components, num_components, TT_SBit_Component ) )
- goto Exit;
-
- count = num_components;
-
- if ( ACCESS_Frame( 4L * num_components ) )
- goto Fail_Memory;
-
- for ( comp = components; count > 0; count--, comp++ )
- {
- comp->glyph_code = GET_UShort();
- comp->x_offset = GET_Char();
- comp->y_offset = GET_Char();
- }
-
- FORGET_Frame();
-
- /* Now recursively load each element glyph */
- count = num_components;
- comp = components;
- for ( ; count > 0; count--, comp++ )
- {
- TT_SBit_Range* elem_range;
- TT_SBit_Metrics elem_metrics;
- TT_ULong elem_offset;
-
-
- /* find the range for this element */
- error = Find_SBit_Range( comp->glyph_code,
- strike,
- &elem_range,
- &elem_offset );
- if ( error )
- goto Fail_Memory;
-
- /* now load the element, recursively */
- error = Load_SBit_Image( strike,
- elem_range,
- ebdt_pos,
- elem_offset,
- map,
- x_offset + comp->x_offset,
- y_offset + comp->y_offset,
- stream,
- &elem_metrics );
- if ( error )
- goto Fail_Memory;
- }
-
- Fail_Memory:
- FREE( components );
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Image */
- /* */
- /* <Description> */
- /* Loads a given glyph sbit image from the font resource. This also */
- /* returns its metrics. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- /* x_ppem :: The horizontal resolution in points per EM. */
- /* */
- /* y_ppem :: The vertical resolution in points per EM. */
- /* */
- /* glyph_index :: The current glyph index. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* map :: The target pixmap. */
- /* metrics :: A big sbit metrics structure for the glyph image. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. Returns an error if no */
- /* glyph sbit exists for the index. */
- /* */
- /* <Note> */
- /* The `map.buffer' field is always freed before the glyph is loaded. */
- /* */
- LOCAL_FUNC
- TT_Error TT_Load_SBit_Image( TT_Face face,
- TT_Int x_ppem,
- TT_Int y_ppem,
- TT_UInt glyph_index,
- FT_Stream stream,
- FT_Bitmap* map,
- TT_SBit_Metrics* metrics )
- {
- TT_Error error;
- FT_Memory memory = stream->memory;
- TT_ULong ebdt_pos, glyph_offset;
-
- TT_SBit_Strike* strike;
- TT_SBit_Range* range;
-
-
- /* Check whether there is a glyph sbit for the current index */
- error = Find_SBit_Image( face, glyph_index, x_ppem, y_ppem,
- &range, &strike, &glyph_offset );
- if ( error )
- goto Exit;
-
- /* now, find the location of the `EBDT' table in */
- /* the font file */
- {
- TT_Long table = TT_LookUp_Table( face, TTAG_EBDT );
-
-
- if ( table < 0 )
- {
- error = TT_Err_Invalid_File_Format;
- goto Exit;
- }
-
- ebdt_pos = face->dir_tables[table].Offset;
- }
-
- /* clear the bitmap & load the bitmap */
- FREE( map->buffer );
- map->rows = map->pitch = map->width = 0;
-
- error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,
- map, 0, 0, stream, metrics );
- if ( error )
- goto Exit;
-
- /* setup vertical metrics if needed */
- if ( strike->flags & 1 )
- {
- /* in case of a horizontal strike only */
- FT_Int advance;
- FT_Int top;
-
-
- advance = strike->hori.ascender - strike->hori.descender;
- top = advance / 10;
-
- metrics->vertBearingX = -metrics->width / 2;
- metrics->vertBearingY = advance / 10;
- metrics->vertAdvance = advance * 12 / 10;
- }
-
- /* Crop the bitmap now */
- Crop_Bitmap( map, metrics );
-
- Exit:
- return error;
- }
-
-
-/* END */
--- a/src/shared/sfnt/ttsbit.h
+++ /dev/null
@@ -1,104 +1,0 @@
-/***************************************************************************/
-/* */
-/* ttsbit.h */
-/* */
-/* TrueType and OpenType embedded bitmap support (specification). */
-/* */
-/* Copyright 1996-1999 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 TTSBIT_H
-#define TTSBIT_H
-
-#include <ttload.h>
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Strikes */
- /* */
- /* <Description> */
- /* Loads the table of embedded bitmap sizes for this face. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* stream :: The input stream. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_SBit_Strikes( TT_Face face,
- FT_Stream stream );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Free_SBit_Strikes */
- /* */
- /* <Description> */
- /* Releases the embedded bitmap tables. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- LOCAL_DEF
- void TT_Free_SBit_Strikes( TT_Face face );
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* TT_Load_SBit_Image */
- /* */
- /* <Description> */
- /* Loads a given glyph sbit image from the font resource. This also */
- /* returns its metrics. */
- /* */
- /* <Input> */
- /* face :: The target face object. */
- /* */
- /* x_ppem :: The horizontal resolution in points per EM. */
- /* */
- /* y_ppem :: The vertical resolution in points per EM. */
- /* */
- /* glyph_index :: The current glyph index. */
- /* */
- /* stream :: The input stream. */
- /* */
- /* <Output> */
- /* map :: The target pixmap. */
- /* metrics :: A big sbit metrics structure for the glyph image. */
- /* */
- /* <Return> */
- /* TrueType error code. 0 means success. Returns an error if no */
- /* glyph sbit exists for the index. */
- /* */
- /* <Note> */
- /* The `map.buffer' field is always freed before the glyph is loaded. */
- /* */
- LOCAL_DEF
- TT_Error TT_Load_SBit_Image( TT_Face face,
- TT_Int x_ppem,
- TT_Int y_ppem,
- TT_UInt glyph_index,
- FT_Stream stream,
- FT_Bitmap* map,
- TT_SBit_Metrics* metrics );
-
-
-#endif /* TTSBIT_H */
-
-
-/* END */
--- a/src/shared/sfnt/tttypes.h
+++ /dev/null
@@ -1,1848 +1,0 @@
-/***************************************************************************/
-/* */
-/* tttypes.h */
-/* */
-/* Basic SFNT/TrueType type definitions and interface (specification */
-/* only). */
-/* */
-/* This code is shared by all TrueType and OpenType drivers. */
-/* */
-/* */
-/* Copyright 1996-1999 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 TTTYPES_H
-#define TTTYPES_H
-
-
-#include <freetype.h>
-
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** DEFINITIONS OF BASIC DATA TYPES ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* The REDEFINE() macro is used to convert a FreeType generic type into */
- /* a TrueType-specific one. It simply replaces the `FT_' prefix by */
- /* `TT_' in order to define compatible types like TT_Long, TT_Error, */
- /* TT_Outline, etc. */
- /* */
-#undef REDEFINE
-#define REDEFINE( type ) typedef FT_##type TT_##type
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Bool */
- /* */
- /* <Description> */
- /* A typedef of unsigned char, used for simple booleans. */
- /* */
- REDEFINE( Bool );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_FWord */
- /* */
- /* <Description> */
- /* A signed 16-bit integer used to store a distance in original font */
- /* units. */
- /* */
- REDEFINE( FWord );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_UFWord */
- /* */
- /* <Description> */
- /* An unsigned 16-bit integer used to store a distance in original */
- /* font units. */
- /* */
- REDEFINE( UFWord );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Char */
- /* */
- /* <Description> */
- /* A simple typedef for the _signed_ char type. */
- /* */
- REDEFINE( Char );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Byte */
- /* */
- /* <Description> */
- /* A simple typedef for the _unsigned_ char type. */
- /* */
- REDEFINE( Byte );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_String */
- /* */
- /* <Description> */
- /* A simple typedef for the char type, usually used for strings. */
- /* */
- REDEFINE( String );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Short */
- /* */
- /* <Description> */
- /* A typedef for signed short. */
- /* */
- REDEFINE( Short );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_UShort */
- /* */
- /* <Description> */
- /* A typedef for unsigned short. */
- /* */
- REDEFINE( UShort );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Int */
- /* */
- /* <Description> */
- /* A typedef for the int type. */
- /* */
- REDEFINE( Int );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_UInt */
- /* */
- /* <Description> */
- /* A typedef for the unsigned int type. */
- /* */
- REDEFINE( UInt );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Long */
- /* */
- /* <Description> */
- /* A typedef for signed long. */
- /* */
- REDEFINE( Long );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_ULong */
- /* */
- /* <Description> */
- /* A typedef for unsigned long. */
- /* */
- REDEFINE( ULong );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_F2Dot14 */
- /* */
- /* <Description> */
- /* A signed 2.14 fixed float type used for unit vectors. */
- /* */
- REDEFINE( F2Dot14 );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_F26Dot6 */
- /* */
- /* <Description> */
- /* A signed 26.6 fixed float type used for vectorial pixel */
- /* coordinates. */
- /* */
- REDEFINE( F26Dot6 );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Fixed */
- /* */
- /* <Description> */
- /* This type is used to store 16.16 fixed float values, like scales */
- /* or matrix coefficients. */
- /* */
- REDEFINE( Fixed );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Pos */
- /* */
- /* <Description> */
- /* The type FT_Pos is a 32-bit integer used to store vectorial */
- /* coordinates. Depending on the context, these can represent */
- /* distances in integer font units, or 26.6 fixed float pixel */
- /* coordinates. */
- /* */
- REDEFINE( Pos );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Vector */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2d vector; coordinates are of */
- /* the TT_Pos type. */
- /* */
- /* <Fields> */
- /* x :: The horizontal coordinate. */
- /* y :: The vertical coordinate. */
- /* */
- REDEFINE( Vector );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_UnitVector */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2d vector unit vector. Uses */
- /* TT_F2Dot14 types. */
- /* */
- /* <Fields> */
- /* x :: Horizontal coordinate. */
- /* y :: Vertical coordinate. */
- /* */
- REDEFINE( UnitVector );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Matrix */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2x2 matrix. Coefficients are */
- /* in 16.16 fixed float format. The computation performed is: */
- /* */
- /* { */
- /* x' = x*xx + y*xy */
- /* y' = x*yx + y*yy */
- /* } */
- /* */
- /* <Fields> */
- /* xx :: Matrix coefficient. */
- /* xy :: Matrix coefficient. */
- /* yx :: Matrix coefficient. */
- /* yy :: Matrix coefficient. */
- /* */
- REDEFINE( Matrix );
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_BBox */
- /* */
- /* <Description> */
- /* A structure used to hold an outline's bounding box, i.e., the */
- /* coordinates of its extrema in the horizontal and vertical */
- /* directions. */
- /* */
- /* <Fields> */
- /* xMin :: The horizontal minimum (left-most). */
- /* yMin :: The vertical minimum (bottom-most). */
- /* xMax :: The horizontal maximum (right-most). */
- /* yMax :: The vertical maximum (top-most). */
- /* */
- REDEFINE( BBox );
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Error */
- /* */
- /* <Description> */
- /* The TrueType error code type. A value of 0 is always interpreted */
- /* as a successful operation. */
- /* */
- REDEFINE( Error );
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TTC_Header */
- /* */
- /* <Description> */
- /* TrueType collection header. This table contains the offsets of */
- /* the font headers of each distinct TrueType face in the file. */
- /* */
- /* <Fields> */
- /* tag :: Must be `ttc ' to indicate a TrueType collection. */
- /* version :: The version number. */
- /* count :: The number of faces in the collection. The */
- /* specification says this should be an unsigned long, but */
- /* we use a signed long since we need the value -1 for */
- /* specific purposes. */
- /* offsets :: The offsets of the font headers, one per face. */
- /* */
- typedef struct TTC_Header_
- {
- TT_ULong Tag;
- TT_Fixed version;
- TT_Long DirCount;
- TT_ULong* TableDirectory;
-
- } TTC_Header;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_TableDir */
- /* */
- /* <Description> */
- /* This structure models a TrueType table directory. It is used to */
- /* access the various tables of the font face. */
- /* */
- /* <Fields> */
- /* version :: The version number; starts with 0x00010000. */
- /* numTables :: The number of tables. */
- /* */
- /* searchRange :: Unused. */
- /* entrySelector :: Unused. */
- /* rangeShift :: Unused. */
- /* */
- /* <Note> */
- /* This structure is only used during font opening. */
- /* */
- typedef struct TT_TableDir_
- {
- TT_Fixed version; /* should be 0x10000 */
- TT_UShort numTables; /* number of tables */
-
- TT_UShort searchRange; /* These parameters are only used */
- TT_UShort entrySelector; /* for a dichotomy search in the */
- TT_UShort rangeShift; /* directory. We ignore them. */
-
- } TT_TableDir;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_TableDirEntry */
- /* */
- /* <Description> */
- /* This structure describes a given table of a TrueType font. */
- /* */
- /* <Fields> */
- /* Tag :: A four-bytes tag describing the table. */
- /* CheckSum :: The table checksum. This value can be ignored. */
- /* Offset :: The offset of the table from the start of the TrueType */
- /* font in its resource. */
- /* Length :: The table length (in bytes). */
- /* */
- typedef struct TT_TableDirEntry_
- {
- TT_ULong Tag; /* table type */
- TT_ULong CheckSum; /* table checksum */
- TT_ULong Offset; /* table file offset */
- TT_ULong Length; /* table length */
-
- } TT_TableDirEntry;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Header */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType font header table. All */
- /* fields follow the TrueType specification. */
- /* */
- typedef struct TT_Header_
- {
- TT_Fixed Table_Version;
- TT_Fixed Font_Revision;
-
- TT_Long CheckSum_Adjust;
- TT_Long Magic_Number;
-
- TT_UShort Flags;
- TT_UShort Units_Per_EM;
-
- TT_Long Created [2];
- TT_Long Modified[2];
-
- TT_FWord xMin;
- TT_FWord yMin;
- TT_FWord xMax;
- TT_FWord yMax;
-
- TT_UShort Mac_Style;
- TT_UShort Lowest_Rec_PPEM;
-
- TT_Short Font_Direction;
- TT_Short Index_To_Loc_Format;
- TT_Short Glyph_Data_Format;
-
- } TT_Header;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_HoriHeader */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType horizontal header, the `hhea' */
- /* table, as well as the corresponding horizontal metrics table, */
- /* i.e., the `hmtx' table. */
- /* */
- /* <Fields> */
- /* Version :: The table version. */
- /* */
- /* Ascender :: The font's ascender, i.e., the distance */
- /* from the baseline to the top-most of all */
- /* glyph points found in the font. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of the */
- /* glyphs found in the font (maybe ASCII). */
- /* */
- /* You should use the `sTypoAscender' field */
- /* of the OS/2 table instead if you want */
- /* the correct one. */
- /* */
- /* Descender :: The font's descender, i.e., the distance */
- /* from the baseline to the bottom-most of */
- /* all glyph points found in the font. It */
- /* is negative. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of the */
- /* glyphs found in the font (maybe ASCII). */
- /* */
- /* You should use the `sTypoDescender' */
- /* field of the OS/2 table instead if you */
- /* want the correct one. */
- /* */
- /* Line_Gap :: The font's line gap, i.e., the distance */
- /* to add to the ascender and descender to */
- /* get the BTB, i.e., the */
- /* baseline-to-baseline distance for the */
- /* font. */
- /* */
- /* advance_Width_Max :: This field is the maximum of all advance */
- /* widths found in the font. It can be */
- /* used to compute the maximum width of an */
- /* arbitrary string of text. */
- /* */
- /* min_Left_Side_Bearing :: The minimum left side bearing of all */
- /* glyphs within the font. */
- /* */
- /* min_Right_Side_Bearing :: The minimum right side bearing of all */
- /* glyphs within the font. */
- /* */
- /* xMax_Extent :: The maximum horizontal extent (i.e., the */
- /* `width' of a glyph's bounding box) for */
- /* all glyphs in the font. */
- /* */
- /* caret_Slope_Rise :: The rise coefficient of the cursor's */
- /* slope of the cursor (slope=rise/run). */
- /* */
- /* caret_Slope_Run :: The run coefficient of the cursor's */
- /* slope. */
- /* */
- /* Reserved :: 10 reserved bytes. */
- /* */
- /* metric_Data_Format :: Always 0. */
- /* */
- /* number_Of_HMetrics :: Number of HMetrics entries in the `hmtx' */
- /* table -- this value can be smaller than */
- /* the total number of glyphs in the font. */
- /* */
- /* long_metrics :: A pointer into the `hmtx' table. */
- /* */
- /* short_metrics :: A pointer into the `hmtx' table. */
- /* */
- /* <Note> */
- /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */
- /* be identical except for the names of their fields which */
- /* are different. */
- /* */
- /* This ensures that a single function in the `ttload' */
- /* module is able to read both the horizontal and vertical */
- /* headers. */
- /* */
- typedef struct TT_HoriHeader_
- {
- TT_Fixed Version;
- TT_FWord Ascender;
- TT_FWord Descender;
- TT_FWord Line_Gap;
-
- TT_UFWord advance_Width_Max; /* advance width maximum */
-
- TT_FWord min_Left_Side_Bearing; /* minimum left-sb */
- TT_FWord min_Right_Side_Bearing; /* minimum right-sb */
- TT_FWord xMax_Extent; /* xmax extents */
- TT_FWord caret_Slope_Rise;
- TT_FWord caret_Slope_Run;
- TT_FWord caret_Offset;
-
- TT_Short Reserved[4];
-
- TT_Short metric_Data_Format;
- TT_UShort number_Of_HMetrics;
-
- /* The following fields are not defined by the TrueType specification */
- /* but they're used to connect the metrics header to the relevant */
- /* `HMTX' table. */
-
- void* long_metrics;
- void* short_metrics;
-
- } TT_HoriHeader;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_VertHeader */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType vertical header, the `vhea' */
- /* table, as well as the corresponding vertical metrics table, i.e., */
- /* the `vmtx' table. */
- /* */
- /* <Fields> */
- /* Version :: The table version. */
- /* */
- /* Ascender :: The font's ascender, i.e., the distance */
- /* from the baseline to the top-most of */
- /* all glyph points found in the font. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of */
- /* the glyphs found in the font (maybe */
- /* ASCII). */
- /* */
- /* You should use the `sTypoAscender' */
- /* field of the OS/2 table instead if you */
- /* want the correct one. */
- /* */
- /* Descender :: The font's descender, i.e., the */
- /* distance from the baseline to the */
- /* bottom-most of all glyph points found */
- /* in the font. It is negative. */
- /* */
- /* This value is invalid in many fonts, as */
- /* it is usually set by the font designer, */
- /* and often reflects only a portion of */
- /* the glyphs found in the font (maybe */
- /* ASCII). */
- /* */
- /* You should use the `sTypoDescender' */
- /* field of the OS/2 table instead if you */
- /* want the correct one. */
- /* */
- /* Line_Gap :: The font's line gap, i.e., the distance */
- /* to add to the ascender and descender to */
- /* get the BTB, i.e., the */
- /* baseline-to-baseline distance for the */
- /* font. */
- /* */
- /* advance_Height_Max :: This field is the maximum of all */
- /* advance heights found in the font. It */
- /* can be used to compute the maximum */
- /* height of an arbitrary string of text. */
- /* */
- /* min_Top_Side_Bearing :: The minimum top side bearing of all */
- /* glyphs within the font. */
- /* */
- /* min_Bottom_Side_Bearing :: The minimum bottom side bearing of all */
- /* glyphs within the font. */
- /* */
- /* yMax_Extent :: The maximum vertical extent (i.e., the */
- /* `height' of a glyph's bounding box) for */
- /* all glyphs in the font. */
- /* */
- /* caret_Slope_Rise :: The rise coefficient of the cursor's */
- /* slope of the cursor (slope=rise/run). */
- /* */
- /* caret_Slope_Run :: The run coefficient of the cursor's */
- /* slope. */
- /* */
- /* Reserved :: 10 reserved bytes. */
- /* */
- /* metric_Data_Format :: Always 0. */
- /* */
- /* number_Of_HMetrics :: Number of VMetrics entries in the */
- /* `vmtx' table -- this value can be */
- /* smaller than the total number of glyphs */
- /* in the font. */
- /* */
- /* long_metrics :: A pointer into the `vmtx' table. */
- /* */
- /* short_metrics :: A pointer into the `vmtx' table. */
- /* */
- /* <Note> */
- /* IMPORTANT: The TT_HoriHeader and TT_VertHeader structures should */
- /* be identical except for the names of their fields which */
- /* are different. */
- /* */
- /* This ensures that a single function in the `ttload' */
- /* module is able to read both the horizontal and vertical */
- /* headers. */
- /* */
- typedef struct TT_VertHeader_
- {
- TT_Fixed Version;
- TT_FWord Ascender;
- TT_FWord Descender;
- TT_FWord Line_Gap;
-
- TT_UFWord advance_Height_Max; /* advance height maximum */
-
- TT_FWord min_Top_Side_Bearing; /* minimum left-sb or top-sb */
- TT_FWord min_Bottom_Side_Bearing; /* minimum right-sb or bottom-sb */
- TT_FWord yMax_Extent; /* xmax or ymax extents */
- TT_FWord caret_Slope_Rise;
- TT_FWord caret_Slope_Run;
- TT_FWord caret_Offset;
-
- TT_Short Reserved[4];
-
- TT_Short metric_Data_Format;
- TT_UShort number_Of_VMetrics;
-
- /* The following fields are not defined by the TrueType specification */
- /* but they're used to connect the metrics header to the relevant */
- /* `HMTX' or `VMTX' table. */
-
- void* long_metrics;
- void* short_metrics;
-
- } TT_VertHeader;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_OS2 */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType OS/2 table. This is the long */
- /* table version. All fields comply to the TrueType specification. */
- /* */
- /* Note that we now support old Mac fonts which do not include an */
- /* OS/2 table. In this case, the `version' field is always set to */
- /* 0xFFFF. */
- /* */
- typedef struct TT_OS2_
- {
- TT_UShort version; /* 0x0001 - more or 0xFFFF */
- TT_FWord xAvgCharWidth;
- TT_UShort usWeightClass;
- TT_UShort usWidthClass;
- TT_Short fsType;
- TT_FWord ySubscriptXSize;
- TT_FWord ySubscriptYSize;
- TT_FWord ySubscriptXOffset;
- TT_FWord ySubscriptYOffset;
- TT_FWord ySuperscriptXSize;
- TT_FWord ySuperscriptYSize;
- TT_FWord ySuperscriptXOffset;
- TT_FWord ySuperscriptYOffset;
- TT_FWord yStrikeoutSize;
- TT_FWord yStrikeoutPosition;
- TT_Short sFamilyClass;
-
- TT_Byte panose[10];
-
- TT_ULong ulUnicodeRange1; /* Bits 0-31 */
- TT_ULong ulUnicodeRange2; /* Bits 32-63 */
- TT_ULong ulUnicodeRange3; /* Bits 64-95 */
- TT_ULong ulUnicodeRange4; /* Bits 96-127 */
-
- TT_Char achVendID[4];
-
- TT_UShort fsSelection;
- TT_UShort usFirstCharIndex;
- TT_UShort usLastCharIndex;
- TT_Short sTypoAscender;
- TT_Short sTypoDescender;
- TT_Short sTypoLineGap;
- TT_UShort usWinAscent;
- TT_UShort usWinDescent;
-
- /* only version 1 tables: */
-
- TT_ULong ulCodePageRange1; /* Bits 0-31 */
- TT_ULong ulCodePageRange2; /* Bits 32-63 */
-
- } TT_OS2;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Postscript */
- /* */
- /* <Description> */
- /* A structure used to model a TrueType Postscript table. All fields */
- /* comply to the TrueType table. This structure does not reference */
- /* the Postscript glyph names, which can be nevertheless accessed */
- /* with the `ttpost' module. */
- /* */
- typedef struct TT_Postscript_
- {
- TT_Fixed FormatType;
- TT_Fixed italicAngle;
- TT_FWord underlinePosition;
- TT_FWord underlineThickness;
- TT_ULong isFixedPitch;
- TT_ULong minMemType42;
- TT_ULong maxMemType42;
- TT_ULong minMemType1;
- TT_ULong maxMemType1;
-
- /* Glyph names follow in the file, but we don't */
- /* load them by default. See the ttpost.c file. */
-
- } TT_Postscript;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_CMapDir */
- /* */
- /* <Description> */
- /* This structure describes the directory of the `cmap' table, */
- /* containing the font's character mappings table. */
- /* */
- /* <Fields> */
- /* tableVersionNumber :: The version number. */
- /* numCMaps :: The number of charmaps in the font. */
- /* */
- /* <Note> */
- /* This structure is only used during font loading. */
- /* */
- typedef struct TT_CMapDir_
- {
- TT_UShort tableVersionNumber;
- TT_UShort numCMaps;
-
- } TT_CMapDir;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_CMapDirEntry */
- /* */
- /* <Description> */
- /* This structure describes a charmap in a TrueType font. */
- /* */
- /* <Fields> */
- /* platformID :: An ID used to specify for which platform this */
- /* charmap is defined (FreeType manages all platforms). */
- /* */
- /* encodingID :: A platform-specific ID used to indicate which source */
- /* encoding is used in this charmap. */
- /* */
- /* offset :: The offset of the charmap relative to the start of */
- /* the `cmap' table. */
- /* */
- /* <Note> */
- /* This structure is only used during font loading. */
- /* */
- typedef struct TT_CMapDirEntry_
- {
- TT_UShort platformID;
- TT_UShort platformEncodingID;
- TT_Long offset;
-
- } TT_CMapDirEntry;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_MaxProfile */
- /* */
- /* <Description> */
- /* The maximum profile is a table containing many max values which */
- /* can be used to pre-allocate arrays. This ensures that no memory */
- /* allocation occurs during a glyph load. */
- /* */
- /* <Fields> */
- /* version :: The version number. */
- /* */
- /* numGlyphs :: The number of glyphs in this TrueType */
- /* font. */
- /* */
- /* maxPoints :: The maximum number of points in a */
- /* non-composite TrueType glyph. See also */
- /* the structure element */
- /* `maxCompositePoints'. */
- /* */
- /* maxContours :: The maximum number of contours in a */
- /* non-composite TrueType glyph. See also */
- /* the structure element */
- /* `maxCompositeContours'. */
- /* */
- /* maxCompositePoints :: The maximum number of points in a */
- /* composite TrueType glyph. See also the */
- /* structure element `maxPoints'. */
- /* */
- /* maxCompositeContours :: The maximum number of contours in a */
- /* composite TrueType glyph. See also the */
- /* structure element `maxContours'. */
- /* */
- /* maxZones :: The maximum number of zones used for */
- /* glyph hinting. */
- /* */
- /* maxTwilightPoints :: The maximum number of points in the */
- /* twilight zone used for glyph hinting. */
- /* */
- /* maxStorage :: The maximum number of elements in the */
- /* storage area used for glyph hinting. */
- /* */
- /* maxFunctionDefs :: The maximum number of function */
- /* definitions in the TrueType bytecode for */
- /* this font. */
- /* */
- /* maxInstructionDefs :: The maximum number of instruction */
- /* definitions in the TrueType bytecode for */
- /* this font. */
- /* */
- /* maxStackElements :: The maximum number of stack elements used */
- /* during bytecode interpretation. */
- /* */
- /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */
- /* used for glyph hinting. */
- /* */
- /* maxComponentElements :: An obscure value related to composite */
- /* glyphs definitions. */
- /* */
- /* maxComponentDepth :: An obscure value related to composite */
- /* glyphs definitions. Probably the maximum */
- /* number of simple glyphs in a composite. */
- /* */
- /* <Note> */
- /* This structure is only used during font loading. */
- /* */
- typedef struct TT_MaxProfile_
- {
- TT_Fixed version;
- TT_UShort numGlyphs;
- TT_UShort maxPoints;
- TT_UShort maxContours;
- TT_UShort maxCompositePoints;
- TT_UShort maxCompositeContours;
- TT_UShort maxZones;
- TT_UShort maxTwilightPoints;
- TT_UShort maxStorage;
- TT_UShort maxFunctionDefs;
- TT_UShort maxInstructionDefs;
- TT_UShort maxStackElements;
- TT_UShort maxSizeOfInstructions;
- TT_UShort maxComponentElements;
- TT_UShort maxComponentDepth;
-
- } TT_MaxProfile;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_LongMetrics */
- /* */
- /* <Description> */
- /* A structure modeling the long metrics of the `hmtx' and `vmtx' */
- /* TrueType tables. The values are expressed in font units. */
- /* */
- /* <Fields> */
- /* advance :: The advance width or height for the glyph. */
- /* bearing :: The left-side or top-side bearing for the glyph. */
- /* */
- typedef struct TT_LongMetrics_
- {
- TT_UShort advance;
- TT_Short bearing;
-
- } TT_LongMetrics;
-
-
- /*************************************************************************/
- /* */
- /* <Type> TT_ShortMetrics */
- /* */
- /* <Description> */
- /* A simple type to model the short metrics of the `hmtx' and `vmtx' */
- /* tables. */
- /* */
- typedef TT_Short TT_ShortMetrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_NameRec */
- /* */
- /* <Description> */
- /* A structure modeling TrueType name records. Name records are used */
- /* to store important strings like family name, style name, */
- /* copyright, etc. in _localized_ versions (i.e., language, encoding, */
- /* etc). */
- /* */
- /* <Fields> */
- /* platformID :: The ID of the name's encoding platform. */
- /* */
- /* encodingID :: The platform-specific ID for the name's encoding. */
- /* */
- /* languageID :: The platform-specific ID for the name's language. */
- /* */
- /* nameID :: The ID specifying what kind of name this is. */
- /* */
- /* stringLength :: The length of the string in bytes. */
- /* */
- /* stringOffset :: The offset to the string in the `name' table. */
- /* */
- /* string :: A pointer to the string's bytes. Note that these */
- /* are usually UTF-16 encoded characters. */
- /* */
- typedef struct TT_NameRec_
- {
- TT_UShort platformID;
- TT_UShort encodingID;
- TT_UShort languageID;
- TT_UShort nameID;
- TT_UShort stringLength;
- TT_UShort stringOffset;
-
- /* this last field is not defined in the spec */
- /* but used by the FreeType engine */
-
- TT_Byte* string;
-
- } TT_NameRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_NameTable */
- /* */
- /* <Description> */
- /* A structure modeling the TrueType name table. */
- /* */
- /* <Fields> */
- /* format :: The format of the name table. */
- /* */
- /* numNameRecords :: The number of names in table. */
- /* */
- /* storageOffset :: The offset of the name table in the `name' */
- /* TrueType table. */
- /* */
- /* names :: An array of name records. */
- /* */
- /* storage :: The names storage area. */
- /* */
- typedef struct TT_NameTable_
- {
- TT_UShort format;
- TT_UShort numNameRecords;
- TT_UShort storageOffset;
- TT_NameRec* names;
- TT_Byte* storage;
-
- } TT_NameTable;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_GaspRange */
- /* */
- /* <Description> */
- /* A tiny structure used to model a gasp range according to the */
- /* TrueType specification. */
- /* */
- /* <Fields> */
- /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
- /* */
- /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
- /* modes to be used. */
- /* */
- typedef struct TT_GaspRange_
- {
- TT_UShort maxPPEM;
- TT_UShort gaspFlag;
-
- } TT_GaspRange;
-
-
-#define TT_GASP_GRIDFIT 0x01
-#define TT_GASP_DOGRAY 0x02
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Gasp */
- /* */
- /* <Description> */
- /* A structure modeling the TrueType `gasp' table used to specify */
- /* grid-fitting and anti-aliasing behaviour. */
- /* */
- /* <Fields> */
- /* version :: The version number. */
- /* numRanges :: The number of gasp ranges in table. */
- /* gaspRanges :: An array of gasp ranges. */
- /* */
- typedef struct TT_Gasp_
- {
- TT_UShort version;
- TT_UShort numRanges;
- TT_GaspRange* gaspRanges;
-
- } TT_Gasp;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_HdmxRec */
- /* */
- /* <Description> */
- /* A small structure used to model the pre-computed widths of a given */
- /* size. They're found in the `hdmx' table. */
- /* */
- /* <Fields> */
- /* ppem :: The pixels per EM value at which these metrics apply. */
- /* */
- /* max_width :: The maximum advance width for this metric. */
- /* */
- /* widths :: An array of widths. Note: These are 8-bit bytes. */
- /* */
- typedef struct TT_HdmxRec_
- {
- TT_Byte ppem;
- TT_Byte max_width;
- TT_Byte* widths;
-
- } TT_HdmxRec;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_HdmxRec */
- /* */
- /* <Description> */
- /* A structure used to model the `hdmx' table, which contains */
- /* pre-computed widths for a set of given sizes/dimensions. */
- /* */
- /* <Fields> */
- /* version :: The version number. */
- /* num_records :: The number of hdmx records. */
- /* records :: An array of hdmx records. */
- /* */
- typedef struct TT_Hdmx_
- {
- TT_UShort version;
- TT_Short num_records;
- TT_HdmxRec* records;
-
- } TT_Hdmx;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Kern_0_Pair */
- /* */
- /* <Description> */
- /* A structure used to model a kerning pair for the kerning table */
- /* format 0. The engine now loads this table if it finds one in the */
- /* font file. */
- /* */
- /* <Fields> */
- /* left :: The index of the left glyph in pair. */
- /* right :: The index of the right glyph in pair. */
- /* value :: The kerning distance. A positive value spaces the */
- /* glyphs, a negative one makes them closer. */
- /* */
- typedef struct TT_Kern_0_Pair_
- {
- TT_UShort left; /* index of left glyph in pair */
- TT_UShort right; /* index of right glyph in pair */
- TT_FWord value; /* kerning value */
-
- } TT_Kern_0_Pair;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Metrics */
- /* */
- /* <Description> */
- /* A structure used to hold the big metrics of a given glyph bitmap */
- /* in a TrueType or OpenType font. These are usually found in the */
- /* `EBDT' (Microsoft) or `bdat' (Apple) table. */
- /* */
- /* <Fields> */
- /* height :: The glyph height in pixels. */
- /* */
- /* width :: The glyph width in pixels. */
- /* */
- /* horiBearingX :: The horizontal left bearing. */
- /* */
- /* horiBearingY :: The horizontal top bearing. */
- /* */
- /* horiAdvance :: The horizontal advance. */
- /* */
- /* vertBearingX :: The vertical left bearing. */
- /* */
- /* vertBearingY :: The vertical top bearing. */
- /* */
- /* vertAdvance :: The vertical advance. */
- /* */
- typedef struct TT_SBit_Metrics_
- {
- TT_Byte height;
- TT_Byte width;
-
- TT_Char horiBearingX;
- TT_Char horiBearingY;
- TT_Byte horiAdvance;
-
- TT_Char vertBearingX;
- TT_Char vertBearingY;
- TT_Byte vertAdvance;
-
- } TT_SBit_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Small_Metrics */
- /* */
- /* <Description> */
- /* A structure used to hold the small metrics of a given glyph bitmap */
- /* in a TrueType or OpenType font. These are usually found in the */
- /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
- /* */
- /* <Fields> */
- /* height :: The glyph height in pixels. */
- /* */
- /* width :: The glyph width in pixels. */
- /* */
- /* bearingX :: The left-side bearing. */
- /* */
- /* bearingY :: The top-side bearing. */
- /* */
- /* advance :: The advance width or height. */
- /* */
- typedef struct TT_SBit_Small_Metrics_
- {
- TT_Byte height;
- TT_Byte width;
-
- TT_Char bearingX;
- TT_Char bearingY;
- TT_Byte advance;
-
- } TT_SBit_Small_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Line_Metrics */
- /* */
- /* <Description> */
- /* A structure used to describe the text line metrics of a given */
- /* bitmap strike, for either a horizontal or vertical layout. */
- /* */
- /* <Fields> */
- /* ascender :: The ascender in pixels. */
- /* */
- /* descender :: The descender in pixels. */
- /* */
- /* max_width :: The maximum glyph width in pixels. */
- /* */
- /* caret_slope_enumerator :: Rise of the caret slope, typically set */
- /* to 1 for non-italic fonts. */
- /* */
- /* caret_slope_denominator :: Rise of the caret slope, typically set */
- /* to 0 for non-italic fonts. */
- /* */
- /* caret_offset :: Offset in pixels to move the caret for */
- /* proper positioning. */
- /* */
- /* min_origin_SB :: Minimum of horiBearingX (resp. */
- /* vertBearingY). */
- /* min_advance_SB :: Minimum of */
- /* */
- /* horizontal advance - */
- /* ( horiBearingX + width ) */
- /* */
- /* resp. */
- /* */
- /* vertical advance - */
- /* ( vertBearingY + height ) */
- /* */
- /* max_before_BL :: Maximum of horiBearingY (resp. */
- /* vertBearingY). */
- /* */
- /* min_after_BL :: Minimum of */
- /* */
- /* horiBearingY - height */
- /* */
- /* resp. */
- /* */
- /* vertBearingX - width */
- /* */
- typedef struct TT_SBit_Line_Metrics_
- {
- TT_Char ascender;
- TT_Char descender;
- TT_Byte max_width;
- TT_Char caret_slope_numerator;
- TT_Char caret_slope_denominator;
- TT_Char caret_offset;
- TT_Char min_origin_SB;
- TT_Char min_advance_SB;
- TT_Char max_before_BL;
- TT_Char min_after_BL;
- TT_Char pads[2];
-
- } TT_SBit_Line_Metrics;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Range */
- /* */
- /* <Description> */
- /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
- /* (Microsoft) or `bloc' (Apple) tables. */
- /* */
- /* <Fields> */
- /* first_glyph :: The first glyph index in the range. */
- /* */
- /* last_glyph :: The last glyph index in the range. */
- /* */
- /* index_format :: The format of index table. Valid values are 1 */
- /* to 5. */
- /* */
- /* image_format :: The format of `EBDT' image data. */
- /* */
- /* image_offset :: The offset to image data in `EBDT'. */
- /* */
- /* image_size :: For index formats 2 and 5. This is the size in */
- /* bytes of each glyph bitmap. */
- /* */
- /* big_metrics :: For index formats 2 and 5. This is the big */
- /* metrics for each glyph bitmap. */
- /* */
- /* num_glyphs :: For index formats 4 and 5. This is the number of */
- /* glyphs in the code array. */
- /* */
- /* glyph_offsets :: For index formats 1 and 3. */
- /* */
- /* glyph_codes :: For index formats 4 and 5. */
- /* */
- /* table_offset :: The offset of the index table in the `EBLC' */
- /* table. Only used during strike loading. */
- /* */
- typedef struct TT_SBit_Range
- {
- TT_UShort first_glyph;
- TT_UShort last_glyph;
-
- TT_UShort index_format;
- TT_UShort image_format;
- TT_ULong image_offset;
-
- TT_ULong image_size;
- TT_SBit_Metrics metrics;
- TT_ULong num_glyphs;
-
- TT_ULong* glyph_offsets;
- TT_UShort* glyph_codes;
-
- TT_ULong table_offset;
-
- } TT_SBit_Range;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Strike */
- /* */
- /* <Description> */
- /* A structure used describe a given bitmap strike in the `EBLC' */
- /* (Microsoft) or `bloc' (Apple) tables. */
- /* */
- /* <Fields> */
- /* num_index_ranges :: The number of index ranges. */
- /* */
- /* index_ranges :: An array of glyph index ranges. */
- /* */
- /* color_ref :: Unused. A color reference? */
- /* */
- /* hori :: The line metrics for horizontal layouts. */
- /* */
- /* vert :: The line metrics for vertical layouts. */
- /* */
- /* start_glyph :: The lowest glyph index for this strike. */
- /* */
- /* end_glyph :: The highest glyph index for this strike. */
- /* */
- /* x_ppem :: The number of horizontal pixels per EM. */
- /* */
- /* y_ppem :: The number of vertical pixels per EM. */
- /* */
- /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
- /* and 8. */
- /* */
- /* flags :: Is this a vertical or horizontal strike? */
- /* */
- typedef struct TT_SBit_Strike_
- {
- TT_Int num_ranges;
- TT_SBit_Range* sbit_ranges;
- TT_ULong ranges_offset;
-
- TT_ULong color_ref;
-
- TT_SBit_Line_Metrics hori;
- TT_SBit_Line_Metrics vert;
-
- TT_UShort start_glyph;
- TT_UShort end_glyph;
-
- TT_Byte x_ppem;
- TT_Byte y_ppem;
-
- TT_Byte bit_depth;
- TT_Char flags;
-
- } TT_SBit_Strike;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Component */
- /* */
- /* <Description> */
- /* A simple structure to describe a compound sbit element. */
- /* */
- /* <Fields> */
- /* glyph_code :: The element's glyph index. */
- /* x_offset :: The element's left bearing. */
- /* y_offset :: The element's top bearing. */
- /* */
- typedef struct TT_SBit_Component_
- {
- TT_UShort glyph_code;
-
- TT_Char x_offset;
- TT_Char y_offset;
-
- } TT_SBit_Component;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_SBit_Scale */
- /* */
- /* <Description> */
- /* A structure used describe a given bitmap scaling table, as defined */
- /* in the `EBSC' table. */
- /* */
- /* <Fields> */
- /* hori :: The horizontal line metrics. */
- /* */
- /* vert :: The vertical line metrics. */
- /* */
- /* x_ppem :: The number of horizontal pixels per EM. */
- /* */
- /* y_ppem :: The number of vertical pixels per EM. */
- /* */
- /* x_ppem_substitute :: Substitution x_ppem value. */
- /* */
- /* y_ppem_substitute :: Substitution y_ppem value. */
- /* */
- typedef struct TT_SBit_Scale_
- {
- TT_SBit_Line_Metrics hori;
- TT_SBit_Line_Metrics vert;
-
- TT_Byte x_ppem;
- TT_Byte y_ppem;
-
- TT_Byte x_ppem_substitute;
- TT_Byte y_ppem_substitute;
-
- } TT_SBit_Scale;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Post_20 */
- /* */
- /* <Description> */
- /* Postscript names sub-table, format 2.0. Stores the PS name of */
- /* each glyph in the font face. */
- /* */
- /* <Fields> */
- /* num_glyphs :: The number of named glyphs in the table. */
- /* */
- /* num_names :: The number of PS names stored in the table. */
- /* */
- /* glyph_indices :: The indices of the glyphs in the names arrays. */
- /* */
- /* glyph_names :: The PS names not in Mac Encoding. */
- /* */
- typedef struct TT_Post_20_
- {
- TT_UShort num_glyphs;
- TT_UShort num_names;
- TT_UShort* glyph_indices;
- TT_Char** glyph_names;
-
- } TT_Post_20;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Post_25 */
- /* */
- /* <Description> */
- /* Postscript names sub-table, format 2.5. Stores the PS name of */
- /* each glyph in the font face. */
- /* */
- /* <Fields> */
- /* num_glyphs :: The number of glyphs in the table. */
- /* */
- /* offsets :: An array of signed offsets in a normal Mac */
- /* Postscript name encoding. */
- /* */
- typedef struct TT_Post_25_
- {
- TT_UShort num_glyphs;
- TT_Char* offsets;
-
- } TT_Post_25;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* TT_Post_Names */
- /* */
- /* <Description> */
- /* Postscript names table, either format 2.0 or 2.5. */
- /* */
- /* <Fields> */
- /* loaded :: A flag to indicate whether the PS names are loaded. */
- /* */
- /* format_20 :: The sub-table used for format 2.0. */
- /* */
- /* format_25 :: The sub-table used for format 2.5. */
- /* */
- typedef struct TT_Post_Names_
- {
- TT_Bool loaded;
-
- union
- {
- TT_Post_20 format_20;
- TT_Post_25 format_25;
-
- } names;
-
- } TT_Post_Names;
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /*** ***/
- /*** ***/
- /*** ORIGINAL TT_FACE CLASS DEFINITION ***/
- /*** ***/
- /*** ***/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This structure/class is defined here because it is common to the */
- /* following formats: TTF, OpenType-TT, and OpenType-CFF. */
- /* */
- /* Note however that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
- /* are not shared between font drivers, and are thus defined normally in */
- /* `drivers/truetype/ttobjs.h'. */
- /* */
- /*************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* TT_Face */
- /* */
- /* <Description> */
- /* A handle to a TrueType face/font object. A TT_Face encapsulates */
- /* the resolution and scaling independent parts of a TrueType font */
- /* resource. */
- /* */
- /* <Note> */
- /* The TT_Face structure is also used as a `parent class' for the */
- /* OpenType-CFF class (T2_Face). */
- /* */
- typedef struct TT_FaceRec_* TT_Face;
-
-
- /*************************************************************************/
- /* */
- /* TrueType Face Type */
- /* */
- /* <Struct> */
- /* TT_Face */
- /* */
- /* <Description> */
- /* The TrueType face class. These objects model the resolution and */
- /* point-size independent data found in a TrueType font file. */
- /* */
- /* <Fields> */
- /* root :: The base FT_Face structure, managed by the */
- /* base layer. */
- /* */
- /* ttcHeader :: The TrueType collection header, used when the */
- /* file is a `ttc' rather than a `ttf'. For */
- /* ordinary font files, the field */
- /* `ttcHeader.DirCount' is set to 0. */
- /* */
- /* num_tables :: The number of TrueType tables in this font */
- /* file. */
- /* */
- /* dir_tables :: The directory of TrueType tables for this */
- /* font file. */
- /* */
- /* header :: The font's font header (`head' table). Read */
- /* on font opening. */
- /* */
- /* horizontal :: The font's horizontal header (`hhea' table). */
- /* This field also contains the associated */
- /* horizontal metrics table (`hmtx'). */
- /* */
- /* max_profile :: The font's maximum profile table. Read on */
- /* font opening. Note that some maximum values */
- /* cannot be taken directly from this table. We */
- /* thus define additional fields below to hold */
- /* the computed maxima. */
- /* */
- /* max_components :: The maximum number of glyph components */
- /* required to load any composite glyph from */
- /* this font. Used to size the load stack. */
- /* */
- /* vertical_info :: A boolean which is set when the font file */
- /* contains vertical metrics. If not, the value */
- /* of the `vertical' field is undefined. */
- /* */
- /* vertical :: The font's vertical header (`vhea' table). */
- /* This field also contains the associated */
- /* vertical metrics table (`vmtx'), if found. */
- /* IMPORTANT: The contents of this field is */
- /* undefined if the `verticalInfo' field is */
- /* unset. */
- /* */
- /* num_names :: The number of name records within this */
- /* TrueType font. */
- /* */
- /* name_table :: The table of name records (`name'). */
- /* */
- /* os2 :: The font's OS/2 table (`OS/2'). */
- /* */
- /* postscript :: The font's PostScript table (`post' table). */
- /* The PostScript glyph names are not loaded by */
- /* the driver on face opening. See the `ttpost' */
- /* module for more details. */
- /* */
- /* num_charmaps :: The number of character mappings in the font. */
- /* */
- /* charmaps :: The array of charmap objects for this font */
- /* file. Note that this field is a typeless */
- /* pointer. The Reason is that the format of */
- /* charmaps varies with the underlying font */
- /* format and cannot be determined here. */
- /* */
- /* hdmx :: The face's horizontal device metrics (`hdmx' */
- /* table). This table is optional in */
- /* TrueType/OpenType fonts. */
- /* */
- /* gasp :: The grid-fitting and scaling properties table */
- /* (`gasp'). This table is optional in */
- /* TrueType/OpenType fonts. */
- /* */
- /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */
- /* sizes, embedded in this font. */
- /* */
- /* sbit_strikes :: An array of sbit strikes embedded in this */
- /* font. This table is optional in a */
- /* TrueType/OpenType font. */
- /* */
- /* num_sbit_scales :: The number of sbit scales for this font. */
- /* */
- /* sbit_scales :: Array of sbit scales embedded in this font. */
- /* This table is optional in a TrueType/OpenType */
- /* font. */
- /* */
- /* postscript_names :: A table used to store the Postscript names of */
- /* the glyphs for this font. See the file */
- /* `ttconfig.h' for comments on the */
- /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
- /* */
- /* num_locations :: The number of glyph locations in this */
- /* TrueType file. This should be identical to */
- /* the number of glyphs. Ignored for Type 2 */
- /* fonts. */
- /* */
- /* glyph_locations :: An array of longs. These are offsets to */
- /* glyph data within the `glyf' table. Ignored */
- /* for Type 2 font faces. */
- /* */
- /* font_program_size :: Size in bytecodes of the face's font program. */
- /* 0 if none defined. Ignored for Type 2 fonts. */
- /* */
- /* font_program :: The face's font program (bytecode stream) */
- /* executed at load time, also used during glyph */
- /* rendering. Comes from the `fpgm' table. */
- /* Ignored for Type 2 font fonts. */
- /* */
- /* cvt_program_size :: Size in bytecodes of the face's cvt program. */
- /* Ignored for Type 2 fonts. */
- /* */
- /* cvt_program :: The face's cvt program (bytecode stream) */
- /* executed each time an instance/size is */
- /* changed/reset. Comes from the `prep' table. */
- /* Ignored for Type 2 fonts. */
- /* */
- /* cvt_size :: Size of the control value table (in entries). */
- /* Ignored for Type 2 fonts. */
- /* */
- /* cvt :: The face's original control value table. */
- /* Coordinates are expressed in unscaled font */
- /* units. Comes from the `cvt ` table. Ignored */
- /* for Type 2 fonts. */
- /* */
- /* num_kern_pairs :: The number of kerning pairs present in the */
- /* font file. The engine only loads the first */
- /* horizontal format 0 kern table it finds in */
- /* the font file. You should use the `ttxkern' */
- /* structures if you want to access other */
- /* kerning tables. Ignored for Type 2 fonts. */
- /* */
- /* kern_table_index :: The index of the kerning table in the font */
- /* kerning directory. Only used by the ttxkern */
- /* extension to avoid data duplication. Ignored */
- /* for Type 2 fonts. */
- /* */
- /* kern_pairs :: Array of kerning pairs, if any. Ignored for */
- /* Type 2 fonts. */
- /* */
- typedef struct TT_FaceRec_
- {
- FT_FaceRec root;
-
- TTC_Header ttc_header;
-
- TT_UShort num_tables;
- TT_TableDirEntry* dir_tables;
-
- TT_Header header; /* TrueType header table */
- TT_HoriHeader horizontal; /* TrueType horizontal header */
-
- TT_MaxProfile max_profile;
- TT_ULong max_components;
-
- TT_Bool vertical_info;
- TT_VertHeader vertical; /* TT Vertical header, if present */
-
- TT_Int num_names; /* number of name records */
- TT_NameTable name_table; /* name table */
-
- TT_OS2 os2; /* TrueType OS/2 table */
- TT_Postscript postscript; /* TrueType Postscript table */
-
- TT_Int num_charmaps;
- void* charmaps; /* array of TT_CharMapRec */
-
- /***********************************************************************/
- /* */
- /* Optional TrueType/OpenType tables */
- /* */
- /***********************************************************************/
-
- /* horizontal device metrics */
- TT_Hdmx hdmx;
-
- /* grid-fitting and scaling table */
- TT_Gasp gasp; /* the `gasp' table */
-
- /* embedded bitmaps support */
- TT_Int num_sbit_strikes;
- TT_SBit_Strike* sbit_strikes;
-
- TT_Int num_sbit_scales;
- TT_SBit_Scale* sbit_scales;
-
- /* postscript names table */
- TT_Post_Names postscript_names;
-
- /***********************************************************************/
- /* */
- /* TrueType-specific fields (ignored by the OTF-Type2 driver) */
- /* */
- /***********************************************************************/
-
- /* the glyph locations */
- TT_UShort num_locations;
- TT_Long* glyph_locations;
-
- /* the font program, if any */
- TT_ULong font_program_size;
- TT_Byte* font_program;
-
- /* the cvt program, if any */
- TT_ULong cvt_program_size;
- TT_Byte* cvt_program;
-
- /* the original, unscaled, control value table */
- TT_ULong cvt_size;
- TT_Short* cvt;
-
- /* the format 0 kerning table, if any */
- TT_Int num_kern_pairs;
- TT_Int kern_table_index;
- TT_Kern_0_Pair* kern_pairs;
-
- } TT_FaceRec;
-
-
-#ifdef __cplusplus
- }
-#endif
-
-
-#endif /* TTTYPES_H */
-
-
-/* END */
--- a/src/shared/type1/rules.mk
+++ /dev/null
@@ -1,54 +1,0 @@
-#****************************************************************************
-#* *
-#* Shared/Type1 Makefile *
-#* *
-#* Copyright 1996-1999 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. *
-#* *
-#****************************************************************************
-
-
-#****************************************************************************
-#* *
-#* IMPORTANT NOTE: This Makefile is intended for GNU Make! *
-#* If you provide Makefiles for other make utilities, *
-#* please place them in `freetype/lib/arch/<system>'. *
-#* *
-#* *
-#* This file is to be included by the Makefiles of each driver that uses *
-#* the shared source code in `freetype2/lib/drivers/type1'. This code *
-#* contains type definitions as well as interface which are common to all *
-#* supported Postscript font formats (i.e. Type1 and Type2). *
-#* *
-#* *
-#* The purpose of this Makefile is to define make variables that are used *
-#* directly by the parent Makefile. *
-#* *
-#****************************************************************************
-
-
-# T1SHARED_DIR is the directory to the `shared/type1' sources
-#
-T1SHARED_DIR := $(SRC)/shared/type1
-T1SHARED_DIR_ := $(T1SHARED_DIR)$(SEP)
-
-
-# T1SHARED_H is the list of all header files on which the client drivers
-# depend
-#
-T1SHARED_H := $(T1SHARED_DIR_)t1types.h \
- $(T1SHARED_DIR_)t1encode.h
-
-# T1SHARED_SRC is the list of all shared source files that are included
-# by any client driver
-#
-T1SHARED_SRC := $(T1SHARED_DIR_)t1encode.c
-
-
-# END
--- a/src/shared/type1/t1encode.c
+++ /dev/null
@@ -1,330 +1,0 @@
-/***************************************************************************/
-/* */
-/* t1encode.c */
-/* */
-/* Type 1 standard encoding tables definitions (body). */
-/* */
-/* Copyright 1996-1999 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. */
-/* */
-/* */
-/* This file is included by both the Type1 and Type2 driver. */
-/* It should never be compiled directly. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* t1_standard_strings: */
- /* */
- /* This array contains the Adobe Standard Glyph Names ordered by */
- /* SID. It was taken from the CFF specification. */
- /* */
- LOCAL_FUNC
- const T1_String* t1_standard_strings[] =
- {
- /* 0 */
- ".notdef", "space", "exclam", "quotedbl", "numbersign",
- "dollar", "percent", "ampersand", "quoteright", "parenleft",
- /* 10 */
- "parenright", "asterisk", "plus", "comma", "hyphen",
- "period", "slash", "zero", "one", "two",
- /* 20 */
- "three", "four", "five", "six", "seven",
- "height", "nine", "colon", "semicolon", "less",
- /* 30 */
- "equal", "greater", "question", "at", "A",
- "B", "C", "D", "E", "F",
- /* 40 */
- "G", "H", "I", "J", "K",
- "L", "M", "N", "O", "P",
- /* 50 */
- "Q", "R", "S", "T", "U",
- "V", "W", "X", "Y", "Z",
- /* 60 */
- "bracketleft", "backslash", "bracketright", "asciicircum", "underscore",
- "quoteleft", "a", "b", "c", "d",
- /* 70 */
- "e", "f", "g", "h", "i",
- "j", "k", "l", "m", "n",
- /* 80 */
- "o", "p", "q", "r", "s",
- "t", "u", "v", "w", "x",
- /* 90 */
- "y", "z", "braceleft", "bar", "braceright",
- "asciitilde", "exclamdown", "cent", "sterling", "fraction",
- /* 100 */
- "yen", "florin", "section", "currency", "quotesingle",
- "quotedblleft", "quillemotleft", "guilsinglleft", "guilsinglright", "fi",
- /* 110 */
- "fl", "endash", "dagger", "daggerdbl", "periodcenter",
- "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright",
- /* 120 */
- "quillemotright", "ellipsis", "perthousand", "questiondown", "grave",
- "acute", "circumflex", "tilde", "macron", "breve",
- /* 130 */
- "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut",
- "ogonek", "caron", "emdash", "AE", "ordfeminine",
- /* 140 */
- "Lslash", "Oslash", "OE", "ordmasculine", "ae",
- "dotlessi", "Islash", "oslash", "oe", "germandbls",
- /* 150 */
- "onesuperior", "logicalnot", "mu", "trademark", "Eth",
- "onehalf", "plusminus", "Thorn", "onequarter", "divide",
- /* 160 */
- "brokenbar", "degree", "thorn", "threequarters", "twosuperior",
- "regitered", "minus", "eth", "multiply", "threesuperior",
- /* 170 */
- "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave",
- "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex",
- /* 180 */
- "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis",
- "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis",
- /* 190 */
- "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex",
- "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron",
- /* 200 */
- "aacute", "acircumflex", "adieresis", "agrave", "aring",
- "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis",
- /* 210 */
- "egrave", "iacute", "icircumflex", "idieresis", "igrave",
- "ntilde", "oacute", "ocircumflex", "odieresis", "ograve",
- /* 220 */
- "otilde", "scaron", "uacute", "ucircumflex", "udieresis",
- "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall",
- /* 230 */
- "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall",
- "Acutesmall",
- "parenleftsuperior", "parenrightsuperior", "twodotenleader",
- "onedotenleader", "zerooldstyle",
- /* 240 */
- "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle",
- "fiveoldstyle",
- "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle",
- "commasuperior",
- /* 250 */
- "threequartersemdash", "periodsuperior", "questionsmall", "asuperior",
- "bsuperior",
- "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior",
- /* 260 */
- "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior",
- "tsuperior", "ff", "ffi", "ffl", "parenleftinferior",
- /* 270 */
- "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall",
- "Asmall",
- "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall",
- /* 280 */
- "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall",
- "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall",
- /* 290 */
- "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall",
- "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall",
- /* 300 */
- "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall",
- "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall",
- "Dieresissmall",
- /* 310 */
- "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash",
- "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall",
- "questiondownsmall",
- /* 320 */
- "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird",
- "twothirds", "zerosuperior", "foursuperior", "fivesuperior",
- "sixsuperior",
- /* 330 */
- "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior",
- "oneinferior",
- "twoinferior", "threeinferior", "fourinferior", "fiveinferior",
- "sixinferior",
- /* 340 */
- "seveninferior", "eightinferior", "nineinferior", "centinferior",
- "dollarinferior",
- "periodinferior", "commainferior", "Agravesmall", "Aacutesmall",
- "Acircumflexsmall",
- /* 350 */
- "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall",
- "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall",
- "Igravesmall",
- /* 360 */
- "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall",
- "Ntildesmall",
- "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall",
- "Odieresissmall",
- /* 370 */
- "OEsmall", "Oslashsmall", "Ugravesmall", "Uacautesmall",
- "Ucircumflexsmall",
- "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall",
- "001.000",
- /* 380 */
- "001.001", "001.002", "001.003", "Black", "Bold",
- "Book", "Light", "Medium", "Regular", "Roman",
- /* 390 */
- "Semibold"
- };
-
-
- /*************************************************************************/
- /* */
- /* t1_standard_encoding: */
- /* */
- /* A simple table used to encode the Adobe StandardEncoding. The */
- /* table values are the SID of the standard glyphs; the table index */
- /* is the character code for the encoding. */
- /* */
- /* Example: */
- /* */
- /* t1_standard_encoding[33] == 2 */
- /* */
- /* which means that the glyph name for character code 32 is */
- /* */
- /* t1_standard_strings[2] == "exclam" */
- /* */
- /* (this correspond to the exclamation mark `!'). */
- /* */
- LOCAL_FUNC
- T1_Short t1_standard_encoding[256] =
- {
- /* 0 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- /* 50 */
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- /* 100 */
- 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
- 89, 90, 91, 92, 93, 94, 95, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 150 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 0, 111, 112, 113,
- 114, 0, 115, 116, 117, 118, 119, 120, 121, 122,
- 0, 123, 0, 124, 125, 126, 127, 128, 129, 130,
- /* 200 */
- 131, 0, 132, 133, 0, 134, 135, 136, 137, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 138, 0, 139, 0, 0,
- 0, 0, 140, 141, 142, 143, 0, 0, 0, 0,
- 0, 144, 0, 0, 0, 145, 0, 0, 146, 147,
- /* 250 */
- 148, 149, 0, 0, 0, 0
- };
-
-
- /*************************************************************************/
- /* */
- /* t1_expert_encoding: */
- /* */
- /* A simple table used to encode the Adobe ExpertEncoding. The */
- /* table values are the SID of the standard glyphs; the table index */
- /* is the character code for the encoding. */
- /* */
- /* Example: */
- /* */
- /* t1_expert_encoding[33] == 229 */
- /* */
- /* which means that the glyph name for character code 32 is */
- /* */
- /* t1_standard_strings[229] == "exclamsmall" */
- /* */
- LOCAL_FUNC
- T1_Short t1_expert_encoding[256] =
- {
- /* 0 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 229, 230, 0, 231, 232, 233, 234,
- 235, 236, 237, 238, 13, 14, 15, 99, 239, 240,
- /* 50 */
- 241, 242, 243, 244, 245, 246, 247, 248, 27, 28,
- 249, 250, 251, 252, 0, 253, 254, 255, 256, 257,
- 0, 0, 0, 258, 0, 0, 259, 260, 261, 262,
- 0, 0, 263, 264, 265, 0, 266, 109, 110, 267,
- 268, 269, 0, 270, 271, 272, 273, 274, 275, 276,
- /* 100 */
- 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
- 287, 288, 289, 290, 291, 292, 293, 294, 295, 296,
- 297, 298, 299, 300, 301, 302, 303, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 150 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 304, 305, 306, 0, 0, 307, 308, 309, 310,
- 311, 0, 312, 0, 0, 312, 0, 0, 314, 315,
- 0, 0, 316, 317, 318, 0, 0, 0, 158, 155,
- 163, 319, 320, 321, 322, 323, 324, 325, 0, 0,
- /* 200 */
- 326, 150, 164, 169, 327, 328, 329, 330, 331, 332,
- 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
- 343, 344, 345, 346, 347, 348, 349, 350, 351, 352,
- 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
- 363, 364, 365, 366, 367, 368, 369, 370, 371, 372,
- /* 250 */
- 373, 374, 375, 376, 377, 378
- };
-
-
- /*************************************************************************/
- /* */
- /* t1_expert_subset_encoding: */
- /* */
- /* A simple table used to encode the Adobe ExpertEncoding subset */
- /* defined in the CFF specification. It will probably evolve into */
- /* another form sooner or later, as we deal with charsets */
- /* differently than with encodings. */
- /* */
- LOCAL_FUNC
- FT_Short t1_expert_subset_encoding[256] =
- {
- /* 0 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 231, 232, 0, 0,
- 235, 236, 237, 238, 13, 14, 15, 99, 239, 240,
- /* 50 */
- 241, 242, 243, 244, 245, 246, 247, 248, 27, 28,
- 249, 250, 251, 252, 0, 253, 254, 255, 256, 257,
- 0, 0, 0, 258, 0, 0, 259, 260, 261, 262,
- 0, 0, 263, 264, 265, 0, 266, 109, 110, 267,
- 268, 269, 0, 270, 0, 272, 0, 0, 0, 0,
- /* 100 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 300, 301, 302, 303, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 150 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 304, 305, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 314, 315,
- 0, 0, 0, 0, 0, 0, 0, 0, 158, 155,
- 163, 0, 320, 321, 322, 323, 324, 325, 0, 0,
- /* 200 */
- 326, 150, 164, 169, 327, 328, 329, 330, 331, 332,
- 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
- 343, 344, 345, 346, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 250 */
- 0, 0, 0, 0, 0, 0
- };
-
-
-/* END */
--- a/src/shared/type1/t1encode.h
+++ /dev/null
@@ -1,98 +1,0 @@
-/***************************************************************************/
-/* */
-/* t1encode.h */
-/* */
-/* Type 1 standard encoding tables definitions (specification). */
-/* */
-/* Copyright 1996-1999 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. */
-/* */
-/* */
-/* This file is included by both the Type1 and Type2 driver. */
-/* It should never be compiled directly. */
-/* */
-/***************************************************************************/
-
-
-#ifndef T1ENCODE_H
-#define T1ENCODE_H
-
-#include <t1types.h>
-
-
- /*************************************************************************/
- /* */
- /* t1_standard_strings: */
- /* */
- /* This array contains the Adobe Standard Glyph Names ordered by */
- /* SID. It was taken from the CFF specification. */
- /* */
- LOCAL_DEF
- const T1_String* t1_standard_strings[];
-
-
- /*************************************************************************/
- /* */
- /* t1_standard_encoding: */
- /* */
- /* A simple table used to encode the Adobe StandardEncoding. The */
- /* table values are the SID of the standard glyphs; the table index */
- /* is the character code for the encoding. */
- /* */
- /* Example: */
- /* */
- /* t1_standard_encoding[33] == 2 */
- /* */
- /* which means that the glyph name for character code 32 is */
- /* */
- /* t1_standard_strings[2] == "exclam" */
- /* */
- /* (this correspond to the exclamation mark `!'). */
- /* */
- LOCAL_DEF
- T1_Short t1_standard_encoding[256];
-
-
- /*************************************************************************/
- /* */
- /* t1_expert_encoding: */
- /* */
- /* A simple table used to encode the Adobe ExpertEncoding. The */
- /* table values are the SID of the standard glyphs; the table index */
- /* is the character code for the encoding. */
- /* */
- /* Example: */
- /* */
- /* t1_expert_encoding[33] == 229 */
- /* */
- /* which means that the glyph name for character code 32 is */
- /* */
- /* t1_standard_strings[229] == "exclamsmall" */
- /* */
- LOCAL_DEF
- T1_Short t1_expert_encoding[256];
-
-
- /*************************************************************************/
- /* */
- /* t1_expert_subset_encoding: */
- /* */
- /* A simple table used to encode the Adobe ExpertEncoding subset */
- /* defined in the CFF specification. It will probably evolve into */
- /* another form sooner or later, as we deal with charsets */
- /* differently than with encodings. */
- /* */
- LOCAL_DEF
- T1_Short t1_expert_subset_encoding[256];
-
-
-#endif /* T1ENCODE_H */
-
-
-/* END */
--- a/src/shared/type1/t1types.h
+++ /dev/null
@@ -1,485 +1,0 @@
-/*******************************************************************
- *
- * t1types.h 1.0
- *
- * Basic Type1/Type2 type definitions and interface.
- *
- * This code is shared by the Type1 and Type2 drivers
- *
- *
- * Copyright 1996-1999 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 T1TYPES_H
-#define T1TYPES_H
-
-#include <freetype.h>
-
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-
-
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-/*** ***/
-/*** ***/
-/*** DEFINITIONS OF BASIC DATA TYPES ***/
-/*** ***/
-/*** ***/
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-
-
-/* The REDEFINE macro is used to convert a FreeType generic type into */
-/* a TrueType-specific one. It simply replaces the "FT_" prefix by "T1_" */
-/* in order to define compatible T1_Long, T1_Error, T1_Outline, etc.. */
-/* */
-#undef REDEFINE
-#define REDEFINE( type ) typedef FT_##type T1_##type
-
-
- /* <Type> T1_Bool */
- /* */
- /* <Description> */
- /* A simple typedef of unsigned char, used for simple booleans. */
- /* */
- REDEFINE( Bool );
-
-
- /* <Type> T1_FWord */
- /* */
- /* <Description> */
- /* a signed 16-bit integer used to store a distance in original */
- /* font units. */
- /* */
- REDEFINE( FWord );
-
-
- /* <Type> T1_UFWord */
- /* */
- /* <Description> */
- /* an unsigned 16-bit integer used to store a distance in original */
- /* font units. */
- /* */
- REDEFINE( UFWord );
-
-
- /* <Type> T1_Char */
- /* */
- /* <Description> */
- /* a simple typedef for the _signed_ char type. */
- /* */
- REDEFINE( Char );
-
-
- /* <Type> T1_Byte */
- /* */
- /* <Description> */
- /* a simple typedef for the _unsigned_ char type. */
- /* */
- REDEFINE( Byte );
-
-
- /* <Type> T1_String */
- /* */
- /* <Description> */
- /* a simple typedef for the char type, used for strings usually. */
- /* */
- REDEFINE( String );
-
-
- /* <Type> T1_Short */
- /* */
- /* <Description> */
- /* a typedef for signed short */
- /* */
- REDEFINE( Short );
-
-
- /* <Type> T1_UShort */
- /* */
- /* <Description> */
- /* a typedef for unsigned short */
- /* */
- REDEFINE( UShort );
-
-
- /* <Type> FT_Int */
- /* */
- /* <Description> */
- /* a typedef for the int type */
- /* */
- REDEFINE( Int );
-
-
- /* <Type> FT_UInt */
- /* */
- /* <Description> */
- /* a typedef for the unsigned int type */
- /* */
- REDEFINE( UInt );
-
-
- /* <Type> T1_Long */
- /* */
- /* <Description> */
- /* a typedef for signed long */
- /* */
- REDEFINE( Long );
-
-
- /* <Type> T1_ULong */
- /* */
- /* <Description> */
- /* a typedef for unsigned long */
- /* */
- REDEFINE( ULong );
-
-
- /* <Type> T1_F2Dot14 */
- /* */
- /* <Description> */
- /* a signed 2.14 fixed float used for unit vectors */
- /* */
- REDEFINE( F2Dot14 );
-
-
- /* <Type> T1_F26Dot6 */
- /* */
- /* <Description> */
- /* a signed 26.6 fixed float used for vectorial pixel coordinates */
- /* */
- REDEFINE( F26Dot6 );
-
-
- /* <Type> T1_Fixed */
- /* */
- /* <Description> */
- /* This type is used to store 16.16 fixed float values, like */
- /* scales or matrix coefficients.. */
- /* */
- REDEFINE( Fixed );
-
-
- /* <Type> T1_Pos */
- /* */
- /* <Description> */
- /* The type T1_Pos is a 32-bits integer used to store vectorial */
- /* coordinates. Depending on the context, these can represent */
- /* distances in integer font units, or 26.6 fixed float pixel */
- /* coordinates.. */
- /* */
- REDEFINE( Pos );
-
-
- /* <Struct> T1_Vector */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2d vector, coordinates */
- /* are of the T1_Pos type. */
- /* */
- /* <Fields> */
- /* x :: horizontal coordinate */
- /* y :: vertical coordinate */
- /* */
- REDEFINE( Vector );
-
- /* <Struct> T1_UnitVector */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2d vector unit vector. */
- /* uses T1_F2Dot14 types. */
- /* */
- /* <Fields> */
- /* x :: horizontal coordinate */
- /* y :: vertical coordinate */
- /* */
- REDEFINE( UnitVector );
-
-
- /* <Struct> T1_Matrix */
- /* */
- /* <Description> */
- /* A simple structure used to store a 2x2 matrix. Coefficients */
- /* are in 16.16 fixed float format. The computation performed */
- /* is : */
- /* { */
- /* x' = x*xx + y*xy */
- /* y' = x*yx + y*yy */
- /* } */
- /* */
- /* <Fields> */
- /* xx :: matrix coefficient */
- /* xy :: matrix coefficient */
- /* yx :: matrix coefficient */
- /* yy :: matrix coefficient */
- /* */
- REDEFINE( Matrix );
-
-
- /* <Struct> T1_BBox */
- /* */
- /* <Description> */
- /* A structure used to hold an outline's bounding box, i.e. */
- /* the coordinates of its extrema in the horizontal and vertical */
- /* directions. */
- /* */
- /* <Fields> */
- /* xMin :: the horizontal minimum (left-most) */
- /* yMin :: the vertical minimum (bottom-most) */
- /* xMax :: the horizontal maximum (right-most) */
- /* yMax :: the vertical maximum (top-most) */
- /* */
- REDEFINE( BBox );
-
-
- /* <Type> T1_Error */
- /* */
- /* <Description> */
- /* The FreeType error code type. A value of 0 is always */
- /* interpreted as a succesful operation. */
- /* */
- REDEFINE( Error );
-
-
-
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-/*** ***/
-/*** ***/
-/*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/
-/*** ***/
-/*** ***/
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-
- /***********************************************************************/
- /* */
- /* <Struct> T1_FontInfo */
- /* */
- /* <Description> */
- /* The FontInfo dictionary structure. */
- /* */
- /* <Fields> */
- /* version :: */
- /* notice :: */
- /* full_name :: */
- /* family_name :: */
- /* weight :: */
- /* italic_angle :: */
- /* is_fixed_pitch :: */
- /* underline_position :: */
- /* underline_thickness :: */
- /* */
- typedef struct T1_FontInfo_
- {
- T1_String* version;
- T1_String* notice;
- T1_String* full_name;
- T1_String* family_name;
- T1_String* weight;
- T1_Long italic_angle;
- T1_Bool is_fixed_pitch;
- T1_Short underline_position;
- T1_UShort underline_thickness;
-
- } T1_FontInfo;
-
-
- /***********************************************************************/
- /* */
- /* <Struct> T1_Private */
- /* */
- /* <Description> */
- /* The Private dictionary structure. */
- /* */
- /* <Fields> */
- /* unique_id :: the font's unique id */
- /* lenIV :: length of decrypt padding */
- /* */
- /* num_blues :: number of blue values */
- /* num_other_blues :: number of other blue values */
- /* num_family_blues :: number of family blue values */
- /* num_family_other_blues :: number of family other blue values */
- /* */
- /* blue_values :: array of blue values */
- /* other_blues :: array of other blue values */
- /* family_blues :: array of family blue values */
- /* family_other_blues :: array of family other blue values */
- /* */
- /* blue_scale :: */
- /* blue_shift :: */
- /* blue_scale :: */
- /* */
- /* standard_width :: */
- /* standard_height :: */
- /* */
- /* num_snap_widths :: */
- /* num_snap_heights :: */
- /* force_bold :: */
- /* round_stem_up :: */
- /* */
- /* stem_snap_widths :: */
- /* stem_snap_heights :: */
- /* */
- /* language_group :: */
- /* password :: */
- /* */
- /* min_feature :: */
- /* */
- /* */
- typedef struct T1_Private_
- {
- T1_Int unique_id;
- T1_Int lenIV;
-
- T1_Byte num_blues;
- T1_Byte num_other_blues;
- T1_Byte num_family_blues;
- T1_Byte num_family_other_blues;
-
- T1_Short blue_values[14];
- T1_Short other_blues[10];
-
- T1_Short family_blues [14];
- T1_Short family_other_blues[10];
-
- T1_Fixed blue_scale;
- T1_Int blue_shift;
- T1_Int blue_fuzz;
-
- T1_UShort standard_width;
- T1_UShort standard_height;
-
- T1_Byte num_snap_widths;
- T1_Byte num_snap_heights;
- T1_Bool force_bold;
- T1_Bool round_stem_up;
-
- T1_Short stem_snap_widths [13]; /* reserve one place for the std */
- T1_Short stem_snap_heights[13]; /* reserve one place for the std */
-
- T1_Long language_group;
- T1_Long password;
-
- T1_Short min_feature[2];
-
- } T1_Private;
-
-
-
- /***********************************************************************/
- /* */
- /* <Struct> T1_Private */
- /* */
- /* <Description> */
- /* The Private dictionary structure. */
- /* */
- /* <Fields> */
- /* num_chars :: number of char codes in encoding. Usually 256 */
- /* code_first :: lower char code in encoding */
- /* code_last :: higher char code in encoding */
- /* */
- /* char_code :: array of character codes */
- /* char_index :: array of correpsonding glyph indices */
- /* char_name :: array of correpsonding glyph names */
- /* */
- typedef struct T1_Encoding_
- {
- T1_Int num_chars;
- T1_Int code_first;
- T1_Int code_last;
-
- T1_Short* char_index;
- T1_String** char_name;
-
- } T1_Encoding;
-
-
-
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-/*** ***/
-/*** ***/
-/*** ORIGINAL TT_FACE CLASS DEFINITION ***/
-/*** ***/
-/*** ***/
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-/*** ***/
-/*** ***/
-/*** This structure/class is defined here because it is common ***/
-/*** to the following formats : TTF, OpenType-TT and OpenType-CFF ***/
-/*** ***/
-/*** Note however that the classes TT_Size, TT_GlyphSlot and ***/
-/*** TT_CharMap are not shared between font drivers, and are ***/
-/*** thus defined normally in "drivers/truetype/ttobjs.h" ***/
-/*** ***/
-/*** ***/
-/*************************************************************************/
-/*************************************************************************/
-/*************************************************************************/
-
-
- typedef struct T1_FaceRec_* T1_Face;
-
-
- /***************************************************/
- /* */
- /* T1_Face : */
- /* */
- /* Type1 face record.. */
- /* */
-
- typedef struct T1_FaceRec_
- {
- FT_FaceRec root;
-
- T1_FontInfo font_info;
- FT_String* font_name;
-
- T1_Encoding encoding;
-
- T1_Byte* subrs_block;
- T1_Byte* charstrings_block;
-
- T1_Int num_subrs;
- T1_Byte** subrs;
- T1_Int* subrs_len;
-
- T1_Int num_glyphs;
- T1_String** glyph_names; /* array of glyph names */
- T1_Byte** charstrings; /* array of glyph charstrings */
- T1_Int* charstrings_len;
-
- T1_Byte paint_type;
- T1_Byte font_type;
- T1_Matrix font_matrix;
- T1_BBox font_bbox;
- T1_Long unique_id;
- T1_Long font_id;
-
- T1_Int stroke_width;
- T1_Private private_dict;
-
- } T1_FaceRec;
-
-
-#endif /* T1TYPES_H */