2000-12-08 03:42:29 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* cffobjs.c */
|
|
|
|
/* */
|
|
|
|
/* OpenType objects manager (body). */
|
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
/* Copyright 1996-2001 by */
|
2000-12-08 03:42:29 +01:00
|
|
|
/* 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_INTERNAL_CALC_H
|
|
|
|
#include FT_INTERNAL_STREAM_H
|
|
|
|
#include FT_ERRORS_H
|
2001-03-20 15:50:04 +01:00
|
|
|
#include FT_TRUETYPE_IDS_H
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_TRUETYPE_TAGS_H
|
|
|
|
#include FT_INTERNAL_SFNT_H
|
|
|
|
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
|
2001-12-20 14:14:18 +01:00
|
|
|
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "cffobjs.h"
|
|
|
|
#include "cffload.h"
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
|
|
|
|
#include "cfferrs.h"
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <string.h> /* for strlen() */
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
|
|
|
#undef FT_COMPONENT
|
2001-01-03 01:21:59 +01:00
|
|
|
#define FT_COMPONENT trace_cffobjs
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* SIZE FUNCTIONS */
|
|
|
|
/* */
|
2001-12-20 22:22:02 +01:00
|
|
|
/* Note that we store the global hints in the size's "internal" root */
|
|
|
|
/* field. */
|
2001-12-20 14:14:18 +01:00
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
static PSH_Globals_Funcs
|
|
|
|
CFF_Size_Get_Globals_Funcs( CFF_Size size )
|
|
|
|
{
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
CFF_Face face = (CFF_Face)size->face;
|
2002-03-14 09:57:10 +01:00
|
|
|
CFF_Font font = (CFF_FontRec *)face->extra.data;
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
PSHinter_Service pshinter = (PSHinter_Service)font->pshinter;
|
|
|
|
FT_Module module;
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
module = FT_Get_Module( size->face->driver->root.library,
|
|
|
|
"pshinter" );
|
|
|
|
return ( module && pshinter && pshinter->get_globals_funcs )
|
|
|
|
? pshinter->get_globals_funcs( module )
|
2001-12-20 22:22:02 +01:00
|
|
|
: 0;
|
2001-12-20 14:14:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Size_Done( CFF_Size size )
|
|
|
|
{
|
|
|
|
if ( size->internal )
|
|
|
|
{
|
|
|
|
PSH_Globals_Funcs funcs;
|
|
|
|
|
|
|
|
|
|
|
|
funcs = CFF_Size_Get_Globals_Funcs( size );
|
|
|
|
if ( funcs )
|
|
|
|
funcs->destroy( (PSH_Globals)size->internal );
|
|
|
|
|
|
|
|
size->internal = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Size_Init( CFF_Size size )
|
|
|
|
{
|
|
|
|
FT_Error error = 0;
|
|
|
|
PSH_Globals_Funcs funcs = CFF_Size_Get_Globals_Funcs( size );
|
|
|
|
|
|
|
|
|
|
|
|
if ( funcs )
|
|
|
|
{
|
2002-02-28 19:59:37 +01:00
|
|
|
PSH_Globals globals;
|
|
|
|
CFF_Face face = (CFF_Face)size->face;
|
2002-03-14 09:57:10 +01:00
|
|
|
CFF_Font font = (CFF_FontRec *)face->extra.data;
|
|
|
|
CFF_SubFont subfont = &font->top_font;
|
2001-12-20 14:14:18 +01:00
|
|
|
|
2002-02-28 19:59:37 +01:00
|
|
|
CFF_Private cpriv = &subfont->private_dict;
|
|
|
|
PS_PrivateRec priv;
|
2001-12-20 14:14:18 +01:00
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
|
|
|
|
/* IMPORTANT: The CFF and Type1 private dictionaries have */
|
|
|
|
/* slightly different structures; we need to */
|
|
|
|
/* synthetize a type1 dictionary on the fly here. */
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
{
|
2001-12-20 22:22:02 +01:00
|
|
|
FT_UInt n, count;
|
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
MEM_Set( &priv, 0, sizeof ( priv ) );
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
count = priv.num_blue_values = cpriv->num_blue_values;
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.blue_values[n] = (FT_Short)cpriv->blue_values[n];
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
count = priv.num_other_blues = cpriv->num_other_blues;
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.other_blues[n] = (FT_Short)cpriv->other_blues[n];
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
count = priv.num_family_blues = cpriv->num_family_blues;
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.family_blues[n] = (FT_Short)cpriv->family_blues[n];
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
count = priv.num_family_other_blues = cpriv->num_family_other_blues;
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
|
2001-12-20 14:14:18 +01:00
|
|
|
|
|
|
|
priv.blue_scale = cpriv->blue_scale;
|
|
|
|
priv.blue_shift = cpriv->blue_shift;
|
|
|
|
priv.blue_fuzz = cpriv->blue_fuzz;
|
|
|
|
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.standard_width[0] = (FT_UShort)cpriv->standard_width;
|
|
|
|
priv.standard_height[0] = (FT_UShort)cpriv->standard_height;
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
count = priv.num_snap_widths = cpriv->num_snap_widths;
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.snap_widths[n] = (FT_Short)cpriv->snap_widths[n];
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
count = priv.num_snap_heights = cpriv->num_snap_heights;
|
|
|
|
for ( n = 0; n < count; n++ )
|
2002-01-09 22:01:18 +01:00
|
|
|
priv.snap_heights[n] = (FT_Short)cpriv->snap_heights[n];
|
2001-12-20 14:14:18 +01:00
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
priv.force_bold = cpriv->force_bold;
|
|
|
|
priv.language_group = cpriv->language_group;
|
|
|
|
priv.lenIV = cpriv->lenIV;
|
2001-12-20 14:14:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
error = funcs->create( size->face->memory, &priv, &globals );
|
|
|
|
if ( !error )
|
|
|
|
size->internal = (FT_Size_Internal)(void*)globals;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Size_Reset( CFF_Size size )
|
|
|
|
{
|
|
|
|
PSH_Globals_Funcs funcs = CFF_Size_Get_Globals_Funcs( size );
|
|
|
|
FT_Error error = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ( funcs )
|
|
|
|
error = funcs->set_scale( (PSH_Globals)size->internal,
|
|
|
|
size->metrics.x_scale,
|
|
|
|
size->metrics.y_scale,
|
|
|
|
0, 0 );
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* SLOT FUNCTIONS */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_GlyphSlot_Done( CFF_GlyphSlot slot )
|
|
|
|
{
|
|
|
|
slot->root.internal->glyph_hints = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-12-20 22:22:02 +01:00
|
|
|
CFF_GlyphSlot_Init( CFF_GlyphSlot slot )
|
2001-12-20 14:14:18 +01:00
|
|
|
{
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
CFF_Face face = (CFF_Face)slot->root.face;
|
2002-03-14 09:57:10 +01:00
|
|
|
CFF_Font font = (CFF_FontRec *)face->extra.data;
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
PSHinter_Service pshinter = (PSHinter_Service)font->pshinter;
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
if ( pshinter )
|
2001-12-20 14:14:18 +01:00
|
|
|
{
|
|
|
|
FT_Module module;
|
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
|
|
|
|
module = FT_Get_Module( slot->root.face->driver->root.library,
|
|
|
|
"pshinter" );
|
|
|
|
if ( module )
|
2001-12-20 14:14:18 +01:00
|
|
|
{
|
|
|
|
T2_Hints_Funcs funcs;
|
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
funcs = pshinter->get_t2_funcs( module );
|
|
|
|
slot->root.internal->glyph_hints = (void*)funcs;
|
|
|
|
}
|
|
|
|
}
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* FACE FUNCTIONS */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_String*
|
|
|
|
CFF_StrCopy( FT_Memory memory,
|
|
|
|
const FT_String* source )
|
2000-12-08 03:42:29 +01:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_String* result = 0;
|
|
|
|
FT_Int len = (FT_Int)strlen( source );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !ALLOC( result, len + 1 ) )
|
|
|
|
{
|
|
|
|
MEM_Copy( result, source, len );
|
|
|
|
result[len] = 0;
|
|
|
|
}
|
2002-02-19 17:30:15 +01:00
|
|
|
|
|
|
|
FT_UNUSED( error );
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Encoding
|
|
|
|
find_encoding( int platform_id,
|
|
|
|
int encoding_id )
|
2000-12-08 03:42:29 +01:00
|
|
|
{
|
|
|
|
typedef struct TEncoding
|
|
|
|
{
|
|
|
|
int platform_id;
|
|
|
|
int encoding_id;
|
|
|
|
FT_Encoding encoding;
|
|
|
|
|
|
|
|
} TEncoding;
|
|
|
|
|
|
|
|
static
|
|
|
|
const TEncoding tt_encodings[] =
|
|
|
|
{
|
|
|
|
{ TT_PLATFORM_ISO, -1, ft_encoding_unicode },
|
|
|
|
|
|
|
|
{ TT_PLATFORM_APPLE_UNICODE, -1, ft_encoding_unicode },
|
|
|
|
|
|
|
|
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, ft_encoding_apple_roman },
|
|
|
|
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, ft_encoding_unicode },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, ft_encoding_sjis },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, ft_encoding_gb2312 },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, ft_encoding_big5 },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, ft_encoding_wansung },
|
|
|
|
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, ft_encoding_johab }
|
|
|
|
};
|
|
|
|
|
|
|
|
const TEncoding *cur, *limit;
|
|
|
|
|
|
|
|
|
|
|
|
cur = tt_encodings;
|
|
|
|
limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] );
|
|
|
|
|
|
|
|
for ( ; cur < limit; cur++ )
|
|
|
|
{
|
|
|
|
if ( cur->platform_id == platform_id )
|
|
|
|
{
|
|
|
|
if ( cur->encoding_id == encoding_id ||
|
|
|
|
cur->encoding_id == -1 )
|
|
|
|
return cur->encoding;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ft_encoding_none;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Face_Init( FT_Stream stream,
|
2001-06-27 21:46:12 +02:00
|
|
|
CFF_Face face,
|
|
|
|
FT_Int face_index,
|
|
|
|
FT_Int num_params,
|
|
|
|
FT_Parameter* params )
|
2000-12-08 03:42:29 +01:00
|
|
|
{
|
2001-12-20 22:22:02 +01:00
|
|
|
FT_Error error;
|
2002-02-28 17:10:29 +01:00
|
|
|
SFNT_Service sfnt;
|
|
|
|
PSNames_Service psnames;
|
|
|
|
PSHinter_Service pshinter;
|
2001-12-20 22:22:02 +01:00
|
|
|
FT_Bool pure_cff = 1;
|
|
|
|
FT_Bool sfnt_format = 0;
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
sfnt = (SFNT_Service)FT_Get_Module_Interface(
|
2000-12-08 03:42:29 +01:00
|
|
|
face->root.driver->root.library, "sfnt" );
|
|
|
|
if ( !sfnt )
|
|
|
|
goto Bad_Format;
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
psnames = (PSNames_Service)FT_Get_Module_Interface(
|
2000-12-08 03:42:29 +01:00
|
|
|
face->root.driver->root.library, "psnames" );
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
|
2001-12-20 14:14:18 +01:00
|
|
|
face->root.driver->root.library, "pshinter" );
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
/* create input stream from resource */
|
|
|
|
if ( FILE_Seek( 0 ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* check that we have a valid OpenType file */
|
|
|
|
error = sfnt->init_face( stream, face, face_index, num_params, params );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */
|
|
|
|
{
|
|
|
|
FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
|
|
|
|
goto Bad_Format;
|
|
|
|
}
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
/* if we are performing a simple font format check, exit immediately */
|
2000-12-08 03:42:29 +01:00
|
|
|
if ( face_index < 0 )
|
2001-01-03 01:21:59 +01:00
|
|
|
return CFF_Err_Ok;
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
sfnt_format = 1;
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
/* now, the font can be either an OpenType/CFF font, or an SVG CEF */
|
|
|
|
/* font in the later case; it doesn't have a `head' table */
|
2000-12-08 03:42:29 +01:00
|
|
|
error = face->goto_table( face, TTAG_head, stream, 0 );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
pure_cff = 0;
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
/* load font directory */
|
2000-12-08 03:42:29 +01:00
|
|
|
error = sfnt->load_face( stream, face,
|
|
|
|
face_index, num_params, params );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* load the `cmap' table by hand */
|
|
|
|
error = sfnt->load_charmaps( face, stream );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
/* XXX: we don't load the GPOS table, as OpenType Layout */
|
|
|
|
/* support will be added later to a layout library on top of */
|
|
|
|
/* FreeType 2 */
|
2000-12-08 03:42:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now, load the CFF part of the file */
|
|
|
|
error = face->goto_table( face, TTAG_CFF, stream, 0 );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* rewind to start of file; we are going to load a pure-CFF font */
|
|
|
|
if ( FILE_Seek( 0 ) )
|
|
|
|
goto Exit;
|
* README: Formatting.
* Jamfile: Fix typo.
* src/cff/cffparse.c: Move error code #defines to...
* include/freetype/internal/cfferrs.h: This file.
* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffload.c: Replaced
`FT_Err_*' with `CFF_Err_*'.
* src/cid/cidparse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* src/psaux/psobjs.c, src/psaux/t1decode.c: Ditto.
* src/sfnt/sfobcs.c, src/sfnt/ttload.c: Replaced `FT_Err_*' with
`TT_Err_*'.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Ditto.
* src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c,
src/type1/t1parse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* include/freetype/internal/cfferrs.h: Add
`CFF_Err_Unknown_File_Format'.
* include/freetype/internal/t1errors.h: Add
`T1_Err_Unknown_File_Format'.
* include/freetype/internal/tterrors.h: Add
`TT_Err_Unknown_File_Format'.
* src/cff/cffload.h: Add `cff_*_encoding' and `cff_*_charset'
references.
* src/psaux/psobjs.c: Include `FT_INTERNAL_TYPE1_ERRORS_H'.
* src/cff/cffobjs.c (CFF_Init_Face, CFF_Done_Face): Use
FT_LOCAL_DEF.
* src/cid/cidobjs.c (CID_Done_Driver): Ditto.
* src/trutype/ttobjs.c (TT_Init_Face, TT_Done_Face, TT_Init_Size):
Ditto.
* src/type1/t1objs.c (T1_Done_Driver): Ditto.
* src/pcf/pcfdriver.c (PCF_Done_Face): Ditto.
* src/pcf/pcf.h: Use FT_LOCAL for `PCF_Done_Face'.
2001-04-03 01:54:01 +02:00
|
|
|
error = CFF_Err_Ok;
|
2000-12-08 03:42:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now load and parse the CFF table in the file */
|
|
|
|
{
|
2002-03-14 09:57:10 +01:00
|
|
|
CFF_Font cff;
|
2000-12-08 03:42:29 +01:00
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
FT_Face root;
|
|
|
|
FT_UInt flags;
|
|
|
|
|
|
|
|
|
|
|
|
if ( ALLOC( cff, sizeof ( *cff ) ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
face->extra.data = cff;
|
|
|
|
error = CFF_Load_Font( stream, face_index, cff );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2001-12-20 14:14:18 +01:00
|
|
|
cff->pshinter = pshinter;
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
/* Complement the root flags with some interesting information. */
|
2000-12-08 17:17:16 +01:00
|
|
|
/* Note that this is only necessary for pure CFF and CEF fonts. */
|
2000-12-08 03:42:29 +01:00
|
|
|
|
2001-12-20 22:22:02 +01:00
|
|
|
root = &face->root;
|
2001-12-20 14:14:18 +01:00
|
|
|
root->num_glyphs = cff->num_glyphs;
|
2001-12-20 22:22:02 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
if ( pure_cff )
|
|
|
|
{
|
2002-03-14 09:57:10 +01:00
|
|
|
CFF_FontRecDict dict = &cff->top_font.font_dict;
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* we need the `PSNames' module for pure-CFF and CEF formats */
|
|
|
|
if ( !psnames )
|
|
|
|
{
|
2001-12-20 14:14:18 +01:00
|
|
|
FT_ERROR(( "CFF_Face_Init:" ));
|
2000-12-08 03:42:29 +01:00
|
|
|
FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
|
|
|
|
FT_ERROR(( " " ));
|
|
|
|
FT_ERROR(( " without the `PSNames' module\n" ));
|
|
|
|
goto Bad_Format;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set up num_faces. */
|
|
|
|
root->num_faces = cff->num_faces;
|
|
|
|
|
|
|
|
/* compute number of glyphs */
|
|
|
|
if ( dict->cid_registry )
|
|
|
|
root->num_glyphs = dict->cid_count;
|
|
|
|
else
|
|
|
|
root->num_glyphs = cff->charstrings_index.count;
|
|
|
|
|
|
|
|
/* set global bbox, as well as EM size */
|
2002-03-05 16:55:28 +01:00
|
|
|
root->bbox.xMin = dict->font_bbox.xMin >> 16;
|
|
|
|
root->bbox.yMin = dict->font_bbox.yMin >> 16;
|
|
|
|
root->bbox.xMax = (dict->font_bbox.xMax + 0xFFFFU) >> 16;
|
|
|
|
root->bbox.yMax = (dict->font_bbox.yMax + 0xFFFFU) >> 16;
|
|
|
|
|
|
|
|
|
|
|
|
root->ascender = (FT_Short)( root->bbox.yMax );
|
|
|
|
root->descender = (FT_Short)( root->bbox.yMin );
|
2001-06-20 01:03:41 +02:00
|
|
|
root->height = (FT_Short)(
|
|
|
|
( ( root->ascender - root->descender ) * 12 ) / 10 );
|
2000-12-08 03:42:29 +01:00
|
|
|
|
2001-02-07 02:08:34 +01:00
|
|
|
if ( dict->units_per_em )
|
|
|
|
root->units_per_EM = dict->units_per_em;
|
|
|
|
else
|
|
|
|
root->units_per_EM = 1000;
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
/* retrieve font family & style name */
|
|
|
|
root->family_name = CFF_Get_Name( &cff->name_index, face_index );
|
|
|
|
if ( dict->cid_registry )
|
2001-01-03 01:21:59 +01:00
|
|
|
root->style_name = CFF_StrCopy( memory, "Regular" ); /* XXXX */
|
2000-12-08 03:42:29 +01:00
|
|
|
else
|
|
|
|
root->style_name = CFF_Get_String( &cff->string_index,
|
|
|
|
dict->weight,
|
|
|
|
psnames );
|
|
|
|
|
|
|
|
/*******************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Compute face flags. */
|
|
|
|
/* */
|
|
|
|
flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
|
|
|
|
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
|
|
|
|
|
|
|
|
if ( sfnt_format )
|
|
|
|
flags |= FT_FACE_FLAG_SFNT;
|
|
|
|
|
|
|
|
/* fixed width font? */
|
|
|
|
if ( dict->is_fixed_pitch )
|
|
|
|
flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
/* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
|
2000-12-08 03:42:29 +01:00
|
|
|
#if 0
|
|
|
|
/* kerning available? */
|
|
|
|
if ( face->kern_pairs )
|
|
|
|
flags |= FT_FACE_FLAG_KERNING;
|
|
|
|
#endif
|
|
|
|
|
2001-03-16 14:40:50 +01:00
|
|
|
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
|
|
|
|
flags |= FT_FACE_FLAG_GLYPH_NAMES;
|
|
|
|
#endif
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
root->face_flags = flags;
|
|
|
|
|
|
|
|
/*******************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Compute style flags. */
|
|
|
|
/* */
|
|
|
|
flags = 0;
|
|
|
|
|
|
|
|
if ( dict->italic_angle )
|
|
|
|
flags |= FT_STYLE_FLAG_ITALIC;
|
|
|
|
|
|
|
|
/* XXX: may not be correct */
|
|
|
|
if ( cff->top_font.private_dict.force_bold )
|
|
|
|
flags |= FT_STYLE_FLAG_BOLD;
|
|
|
|
|
|
|
|
root->style_flags = flags;
|
|
|
|
|
|
|
|
/* set the charmaps if any */
|
|
|
|
if ( sfnt_format )
|
|
|
|
{
|
|
|
|
/*****************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Polish the charmaps. */
|
|
|
|
/* */
|
|
|
|
/* Try to set the charmap encoding according to the platform & */
|
|
|
|
/* encoding ID of each charmap. */
|
|
|
|
/* */
|
|
|
|
TT_CharMap charmap;
|
|
|
|
FT_Int n;
|
|
|
|
|
|
|
|
|
|
|
|
charmap = face->charmaps;
|
|
|
|
root->num_charmaps = face->num_charmaps;
|
|
|
|
|
|
|
|
/* allocate table of pointers */
|
|
|
|
if ( ALLOC_ARRAY( root->charmaps, root->num_charmaps, FT_CharMap ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
for ( n = 0; n < root->num_charmaps; n++, charmap++ )
|
|
|
|
{
|
|
|
|
FT_Int platform = charmap->cmap.platformID;
|
|
|
|
FT_Int encoding = charmap->cmap.platformEncodingID;
|
|
|
|
|
|
|
|
|
|
|
|
charmap->root.face = (FT_Face)face;
|
2001-06-19 10:28:24 +02:00
|
|
|
charmap->root.platform_id = (FT_UShort)platform;
|
|
|
|
charmap->root.encoding_id = (FT_UShort)encoding;
|
2000-12-08 03:42:29 +01:00
|
|
|
charmap->root.encoding = find_encoding( platform, encoding );
|
|
|
|
|
|
|
|
/* now, set root->charmap with a unicode charmap */
|
|
|
|
/* wherever available */
|
|
|
|
if ( !root->charmap &&
|
|
|
|
charmap->root.encoding == ft_encoding_unicode )
|
|
|
|
root->charmap = (FT_CharMap)charmap;
|
|
|
|
|
|
|
|
root->charmaps[n] = (FT_CharMap)charmap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
|
|
|
|
Bad_Format:
|
* README: Formatting.
* Jamfile: Fix typo.
* src/cff/cffparse.c: Move error code #defines to...
* include/freetype/internal/cfferrs.h: This file.
* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffload.c: Replaced
`FT_Err_*' with `CFF_Err_*'.
* src/cid/cidparse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* src/psaux/psobjs.c, src/psaux/t1decode.c: Ditto.
* src/sfnt/sfobcs.c, src/sfnt/ttload.c: Replaced `FT_Err_*' with
`TT_Err_*'.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Ditto.
* src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c,
src/type1/t1parse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* include/freetype/internal/cfferrs.h: Add
`CFF_Err_Unknown_File_Format'.
* include/freetype/internal/t1errors.h: Add
`T1_Err_Unknown_File_Format'.
* include/freetype/internal/tterrors.h: Add
`TT_Err_Unknown_File_Format'.
* src/cff/cffload.h: Add `cff_*_encoding' and `cff_*_charset'
references.
* src/psaux/psobjs.c: Include `FT_INTERNAL_TYPE1_ERRORS_H'.
* src/cff/cffobjs.c (CFF_Init_Face, CFF_Done_Face): Use
FT_LOCAL_DEF.
* src/cid/cidobjs.c (CID_Done_Driver): Ditto.
* src/trutype/ttobjs.c (TT_Init_Face, TT_Done_Face, TT_Init_Size):
Ditto.
* src/type1/t1objs.c (T1_Done_Driver): Ditto.
* src/pcf/pcfdriver.c (PCF_Done_Face): Ditto.
* src/pcf/pcf.h: Use FT_LOCAL for `PCF_Done_Face'.
2001-04-03 01:54:01 +02:00
|
|
|
error = CFF_Err_Unknown_File_Format;
|
2000-12-08 03:42:29 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Face_Done( CFF_Face face )
|
2000-12-08 03:42:29 +01:00
|
|
|
{
|
|
|
|
FT_Memory memory = face->root.memory;
|
2002-02-28 17:10:29 +01:00
|
|
|
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( sfnt )
|
|
|
|
sfnt->done_face( face );
|
|
|
|
|
|
|
|
{
|
2002-03-14 09:57:10 +01:00
|
|
|
CFF_Font cff = (CFF_Font)face->extra.data;
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( cff )
|
|
|
|
{
|
|
|
|
CFF_Done_Font( cff );
|
|
|
|
FREE( face->extra.data );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Driver_Init( CFF_Driver driver )
|
2000-12-08 03:42:29 +01:00
|
|
|
{
|
|
|
|
/* init extension registry if needed */
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
|
|
|
|
|
|
|
|
return TT_Init_Extensions( driver );
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
FT_UNUSED( driver );
|
|
|
|
|
2001-01-03 01:21:59 +01:00
|
|
|
return CFF_Err_Ok;
|
2000-12-08 03:42:29 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-12-20 14:14:18 +01:00
|
|
|
CFF_Driver_Done( CFF_Driver driver )
|
2000-12-08 03:42:29 +01:00
|
|
|
{
|
|
|
|
/* destroy extensions registry if needed */
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
|
|
|
|
|
|
|
|
TT_Done_Extensions( driver );
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
FT_UNUSED( driver );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|