* src/truetype/ttobjs.c (TT_Size_Init): Fix typo.

* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
This commit is contained in:
Werner Lemberg 2002-03-31 06:56:56 +00:00
parent f1c46e5e00
commit 9bba0634a0
10 changed files with 629 additions and 541 deletions

View File

@ -1,3 +1,11 @@
2002-03-31 Yao Zhang <yaoz@vidar.niaaa.nih.gov>
* src/truetype/ttobjs.c (TT_Size_Init): Fix typo.
2002-03-31 Werner Lemberg <wl@gnu.org>
* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h: s/index/idx/.
2002-03-30 David Turner <david@freetype.org>
* include/freetype/internal/tttypes.h: Adding comments to some of

File diff suppressed because it is too large Load Diff

View File

@ -1,205 +1,208 @@
/***************************************************************************
*
* otlcommn.h
*
* OpenType Layout common tables processing
*
* this header provides several routines used to process common table
* found in various OpenType Layout tables..
*/
#ifndef __OTLAYOUT_COMMON_H__
#define __OTLAYOUT_COMMON_H__
/***************************************************************************/
/* */
/* otlcommn.h */
/* */
/* OpenType layout support, common tables (specification). */
/* */
/* Copyright 2002 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 __OTLCOMMN_H__
#define __OTLCOMMN_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** COVERAGE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** COVERAGE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate coverage table */
/* validate coverage table */
OTL_LOCALDEF( void )
otl_coverage_validate( OTL_Bytes base,
OTL_Validator valid );
/* return number of covered glyphs */
/* return number of covered glyphs */
OTL_LOCALDEF( OTL_UInt )
otl_coverage_get_count( OTL_Bytes base );
otl_coverage_get_count( OTL_Bytes base );
/* return the coverage index corresponding to a glyph glyph index. */
/* returns -1 if the glyph isn't covered.. */
/* Return the coverage index corresponding to a glyph glyph index. */
/* Return -1 if the glyph isn't covered. */
OTL_LOCALDEF( OTL_Int )
otl_coverage_get_index( OTL_Bytes base,
OTL_UInt glyph_index );
otl_coverage_get_index( OTL_Bytes base,
OTL_UInt glyph_index );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CLASS DEFINITION TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CLASS DEFINITION TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate class definition table */
/* validate class definition table */
OTL_LOCALDEF( void )
otl_class_definition_validate( OTL_Bytes table,
OTL_Validator valid );
/* return class value for a given glyph index */
/* return class value for a given glyph index */
OTL_LOCALDEF( OTL_UInt )
otl_class_definition_get_value( OTL_Bytes table,
OTL_UInt glyph_index );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** DEVICE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** DEVICE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate a device table */
/* validate a device table */
OTL_LOCALDEF( void )
otl_device_table_validate( OTL_Bytes table,
OTL_Validator valid );
/* return a device table's first size */
/* return a device table's first size */
OTL_LOCALDEF( OTL_UInt )
otl_device_table_get_start( OTL_Bytes table );
/* return a device table's last size */
/* return a device table's last size */
OTL_LOCALDEF( OTL_UInt )
otl_device_table_get_end( OTL_Bytes table );
/* return pixel adjustment for a given size */
/* return pixel adjustment for a given size */
OTL_LOCALDEF( OTL_Int )
otl_device_table_get_delta( OTL_Bytes table,
OTL_UInt size );
otl_device_table_get_delta( OTL_Bytes table,
OTL_UInt size );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate lookup table */
/* validate lookup table */
OTL_LOCALDEF( void )
otl_lookup_validate( OTL_Bytes table,
OTL_Validator valid );
/* return number of sub-tables in a lookup */
/* return number of sub-tables in a lookup */
OTL_LOCALDEF( OTL_UInt )
otl_lookup_get_count( OTL_Bytes table );
/* return lookup sub-table */
/* return lookup sub-table */
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_get_table( OTL_Bytes table,
OTL_UInt index );
OTL_UInt idx );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUP LISTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUP LISTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate lookup list */
/* validate lookup list */
OTL_LOCALDEF( void )
otl_lookup_list_validate( OTL_Bytes table,
OTL_Validator valid );
/* return number of lookups in list */
/* return number of lookups in list */
OTL_LOCALDEF( OTL_UInt )
otl_lookup_list_get_count( OTL_Bytes table );
/* return a given lookup from a list */
/* return a given lookup from a list */
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_lookup( OTL_Bytes table,
OTL_UInt index );
OTL_UInt idx );
/* return lookup sub-table from a list */
/* return lookup sub-table from a list */
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_table( OTL_Bytes table,
OTL_UInt lookup_index,
OTL_UInt table_index );
/* iterate over lookup list */
/* iterate over lookup list */
OTL_LOCALDEF( void )
otl_lookup_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
OTL_Pointer func_data );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURES *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate feature table */
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURES *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate feature table */
OTL_LOCALDEF( void )
otl_feature_validate( OTL_Bytes table,
OTL_Validator valid );
/* return feature's lookup count */
/* return feature's lookup count */
OTL_LOCALDEF( OTL_UInt )
otl_feature_get_count( OTL_Bytes table );
otl_feature_get_count( OTL_Bytes table );
/* get several lookups indices from a feature. returns the number of lookups */
/* grabbed */
/* get several lookups indices from a feature. returns the number of */
/* lookups grabbed */
OTL_LOCALDEF( OTL_UInt )
otl_feature_get_lookups( OTL_Bytes table,
OTL_UInt start,
OTL_UInt count,
OTL_UInt *lookups );
otl_feature_get_lookups( OTL_Bytes table,
OTL_UInt start,
OTL_UInt count,
OTL_UInt *lookups );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURE LIST *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate a feature list */
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURE LIST *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate a feature list */
OTL_LOCALDEF( void )
otl_feature_list_validate( OTL_Bytes table,
OTL_Validator valid );
/* return number of features in list */
/* return number of features in list */
OTL_LOCALDEF( OTL_UInt )
otl_feature_list_get_count( OTL_Bytes table );
/* return a given feature from a list */
/* return a given feature from a list */
OTL_LOCALDEF( OTL_Bytes )
otl_feature_list_get_feature( OTL_Bytes table,
OTL_UInt index );
OTL_UInt idx );
/* iterate over all features in a list */
/* iterate over all features in a list */
OTL_LOCALDEF( void )
otl_feature_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
@ -209,4 +212,7 @@ OTL_BEGIN_HEADER
OTL_END_HEADER
#endif /* __OTLAYOUT_COMMON_H__ */
#endif /* __OTLCOMMN_H__ */
/* END */

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2001 by
# Copyright (C) 2001, 2002 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
Copyright (C) 2000-2001 by
Copyright (C) 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
FreeType font driver for pcf files
Copyright (C) 2000-2001 by
Copyright (C) 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -40,9 +40,10 @@ THE SOFTWARE.
#undef FT_COMPONENT
#define FT_COMPONENT trace_pcfread
#ifdef FT_CONFIG_OPTION_USE_CMAPS
typedef struct PCF_CMapRec_
typedef struct PCF_CMapRec_
{
FT_CMapRec cmap;
FT_UInt num_encodings;
@ -52,11 +53,12 @@ THE SOFTWARE.
FT_CALLBACK_DEF( FT_Error )
pcf_cmap_init( PCF_CMap cmap )
pcf_cmap_init( PCF_CMap cmap )
{
PCF_Face face = (PCF_Face) FT_CMAP_FACE(cmap);
PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap );
cmap->num_encodings = (FT_UInt) face->nencodings;
cmap->num_encodings = (FT_UInt)face->nencodings;
cmap->encodings = face->encodings;
return FT_Err_Ok;
@ -79,6 +81,7 @@ THE SOFTWARE.
FT_UInt min, max, mid;
FT_UInt result = 0;
min = 0;
max = cmap->num_encodings;
@ -86,6 +89,7 @@ THE SOFTWARE.
{
FT_UInt32 code;
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
@ -98,7 +102,7 @@ THE SOFTWARE.
if ( charcode < code )
max = mid;
else
min = mid+1;
min = mid + 1;
}
return result;
@ -114,6 +118,7 @@ THE SOFTWARE.
FT_UInt32 charcode = *acharcode + 1;
FT_UInt result = 0;
min = 0;
max = cmap->num_encodings;
@ -121,6 +126,7 @@ THE SOFTWARE.
{
FT_UInt32 code;
mid = ( min + max ) >> 1;
code = encodings[mid].enc;
@ -133,7 +139,7 @@ THE SOFTWARE.
if ( charcode < code )
max = mid;
else
min = mid+1;
min = mid + 1;
}
charcode = 0;
@ -152,10 +158,10 @@ THE SOFTWARE.
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class =
{
sizeof( PCF_CMapRec ),
(FT_CMap_InitFunc) pcf_cmap_init,
(FT_CMap_DoneFunc) pcf_cmap_done,
(FT_CMap_CharIndexFunc) pcf_cmap_char_index,
(FT_CMap_CharNextFunc) pcf_cmap_char_next
(FT_CMap_InitFunc) pcf_cmap_init,
(FT_CMap_DoneFunc) pcf_cmap_done,
(FT_CMap_CharIndexFunc)pcf_cmap_char_index,
(FT_CMap_CharNextFunc) pcf_cmap_char_next
};
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
@ -243,7 +249,7 @@ THE SOFTWARE.
FT_CALLBACK_DEF( FT_Error )
PCF_Face_Done( PCF_Face face )
{
FT_Memory memory = FT_FACE_MEMORY( face );
FT_Memory memory = FT_FACE_MEMORY( face );
FT_FREE( face->encodings );
@ -251,9 +257,10 @@ THE SOFTWARE.
/* free properties */
{
PCF_Property prop = face->properties;
FT_Int i;
PCF_Property prop = face->properties;
FT_Int i;
for ( i = 0; i < face->nprops; i++ )
{
prop = &face->properties[i];
@ -298,8 +305,8 @@ THE SOFTWARE.
/* set-up charmap */
{
FT_String *charset_registry, *charset_encoding;
FT_Bool unicode_charmap = 0;
FT_String *charset_registry, *charset_encoding;
FT_Bool unicode_charmap = 0;
charset_registry = face->charset_registry;
@ -315,10 +322,12 @@ THE SOFTWARE.
}
#ifdef FT_CONFIG_OPTION_USE_CMAPS
{
FT_CharMapRec charmap;
charmap.face = FT_FACE(face);
charmap.face = FT_FACE( face );
charmap.encoding = ft_encoding_none;
charmap.platform_id = 0;
charmap.encoding_id = 0;
@ -332,6 +341,7 @@ THE SOFTWARE.
error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
}
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
/* XXX: charmaps. For now, report unicode for Unicode and Latin 1 */
@ -378,13 +388,13 @@ THE SOFTWARE.
if ( size->metrics.y_ppem == face->root.available_sizes->height )
{
size->metrics.ascender = face->accel.fontAscent << 6;
size->metrics.descender = face->accel.fontDescent * (-64);
size->metrics.ascender = face->accel.fontAscent << 6;
size->metrics.descender = face->accel.fontDescent * (-64);
#if 0
size->metrics.height = face->accel.maxbounds.ascent << 6;
size->metrics.height = face->accel.maxbounds.ascent << 6;
#endif
size->metrics.height = size->metrics.ascender -
size->metrics.descender;
size->metrics.height = size->metrics.ascender -
size->metrics.descender;
size->metrics.max_advance = face->accel.maxbounds.characterWidth << 6;
@ -407,12 +417,11 @@ THE SOFTWARE.
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
FT_Stream stream = face->root.stream;
FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_Memory memory = FT_FACE( face )->memory;
FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric;
int bytes;
FT_UNUSED( load_flags );
@ -464,7 +473,7 @@ THE SOFTWARE.
if ( FT_ALLOC( bitmap->buffer, bytes ) )
goto Exit;
if ( FT_STREAM_SEEK( metric->bits ) ||
if ( FT_STREAM_SEEK( metric->bits ) ||
FT_STREAM_READ( bitmap->buffer, bytes ) )
goto Exit;
@ -531,39 +540,38 @@ THE SOFTWARE.
sizeof( FT_SizeRec ),
sizeof( FT_GlyphSlotRec ),
(FT_Face_InitFunc) PCF_Face_Init,
(FT_Face_DoneFunc) PCF_Face_Done,
(FT_Size_InitFunc) 0,
(FT_Size_DoneFunc) 0,
(FT_Slot_InitFunc)0,
(FT_Slot_DoneFunc)0,
(FT_Face_InitFunc) PCF_Face_Init,
(FT_Face_DoneFunc) PCF_Face_Done,
(FT_Size_InitFunc) 0,
(FT_Size_DoneFunc) 0,
(FT_Slot_InitFunc) 0,
(FT_Slot_DoneFunc) 0,
(FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
(FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
(FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
(FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
(FT_Slot_LoadFunc) PCF_Glyph_Load,
(FT_Slot_LoadFunc) PCF_Glyph_Load,
#ifndef FT_CONFIG_OPTION_USE_CMAPS
(FT_CharMap_CharIndexFunc) PCF_Char_Get_Index,
(FT_CharMap_CharIndexFunc)PCF_Char_Get_Index,
#else
(FT_CharMap_CharIndexFunc) 0,
(FT_CharMap_CharIndexFunc)0,
#endif
(FT_Face_GetKerningFunc) 0,
(FT_Face_AttachFunc) 0,
(FT_Face_GetAdvancesFunc) 0,
(FT_Face_GetKerningFunc) 0,
(FT_Face_AttachFunc) 0,
(FT_Face_GetAdvancesFunc) 0,
#ifndef FT_CONFIG_OPTION_USE_CMAPS
(FT_CharMap_CharNextFunc) PCF_Char_Get_Next,
(FT_CharMap_CharNextFunc) PCF_Char_Get_Next,
#else
(FT_CharMap_CharNextFunc) 0
(FT_CharMap_CharNextFunc) 0
#endif
};
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
/*************************************************************************/
/* */
/* <Function> */

View File

@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
Copyright 2000-2001 by
Copyright 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
Copyright 2000-2001 by
Copyright 2000-2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -98,7 +98,7 @@ THE SOFTWARE.
FT_UInt n;
if ( FT_STREAM_SEEK ( 0 ) ||
if ( FT_STREAM_SEEK ( 0 ) ||
FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )
return PCF_Err_Cannot_Open_Resource;
@ -130,7 +130,7 @@ THE SOFTWARE.
for( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ )
if ( tables[i].type == (FT_UInt)( 1 << j ) )
name = tableNames[j];
FT_TRACE4(( "Table %d: type=%-6s format=0x%04lX "
"size=0x%06lX (%8ld) offset=0x%04lX\n",
i, name,
@ -200,8 +200,6 @@ THE SOFTWARE.
};
static FT_Error
pcf_get_metric( FT_Stream stream,
FT_ULong format,
@ -212,15 +210,16 @@ THE SOFTWARE.
if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
{
const FT_Frame_Field* fields;
const FT_Frame_Field* fields;
/* parsing normal metrics */
fields = PCF_BYTE_ORDER( format ) == MSBFirst
? pcf_metric_msb_header
: pcf_metric_header;
? pcf_metric_msb_header
: pcf_metric_header;
/* the following sets 'error' but doesn't return in case of failure */
(void) FT_STREAM_READ_FIELDS( fields, metric );
/* the following sets 'error' but doesn't return in case of failure */
(void)FT_STREAM_READ_FIELDS( fields, metric );
}
else
{
@ -267,7 +266,7 @@ THE SOFTWARE.
*asize = tables[i].size; /* unused - to be removed */
*aformat = tables[i].format;
return PCF_Err_Ok;
}
@ -491,7 +490,7 @@ THE SOFTWARE.
error = FT_READ_ULONG_LE( format );
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
!PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )
return PCF_Err_Invalid_File_Format;
@ -650,11 +649,11 @@ THE SOFTWARE.
error = pcf_seek_to_table_type( stream,
face->toc.tables,
face->toc.count,
PCF_BDF_ENCODINGS,
&format,
&size );
face->toc.tables,
face->toc.count,
PCF_BDF_ENCODINGS,
&format,
&size );
if ( error )
return error;
@ -809,7 +808,7 @@ THE SOFTWARE.
error = FT_READ_ULONG_LE( format );
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
!PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) )
goto Bail;
@ -973,12 +972,12 @@ THE SOFTWARE.
prop = pcf_find_property( face, "PIXEL_SIZE" );
if ( prop != NULL )
{
root->available_sizes->height =
root->available_sizes->height =
root->available_sizes->width = (FT_Short)( prop->value.integer );
size_set = 1;
}
else
else
{
prop = pcf_find_property( face, "POINT_SIZE" );
if ( prop != NULL )
@ -993,13 +992,13 @@ THE SOFTWARE.
if ( ( yres != NULL ) && ( xres != NULL ) )
{
root->available_sizes->height =
(FT_Short)( prop->value.integer *
yres->value.integer / 720 );
(FT_Short)( prop->value.integer *
yres->value.integer / 720 );
root->available_sizes->width =
(FT_Short)( prop->value.integer *
(FT_Short)( prop->value.integer *
xres->value.integer / 720 );
size_set = 1;
}
}
@ -1014,11 +1013,11 @@ THE SOFTWARE.
/* set-up charset */
{
PCF_Property charset_registry = 0, charset_encoding = 0;
charset_registry = pcf_find_property( face, "CHARSET_REGISTRY" );
charset_encoding = pcf_find_property( face, "CHARSET_ENCODING" );
if ( ( charset_registry != NULL ) &&
( charset_encoding != NULL ) )
{
@ -1028,26 +1027,26 @@ THE SOFTWARE.
if ( FT_NEW_ARRAY( face->charset_encoding,
strlen( charset_encoding->value.atom ) + 1 ) )
goto Exit;
if ( FT_NEW_ARRAY( face->charset_registry,
strlen( charset_registry->value.atom ) + 1 ) )
goto Exit;
strcpy( face->charset_registry, charset_registry->value.atom );
strcpy( face->charset_encoding, charset_encoding->value.atom );
}
}
}
}
Exit:
if (error)
if ( error )
{
/* this is done to respect the behaviour of the original */
/* PCF font driver.. */
/* PCF font driver. */
error = PCF_Err_Invalid_File_Format;
}
return error;
}

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2000 by
# Copyright (C) 2000, 2001 by
# Francesco Zappa Nardelli
#
# Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -436,7 +436,7 @@
Fail_Memory:
TT_Done_Size( size );
TT_Size_Done( size );
return error;
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */