ref: 013efd14103cbe453714749c1abe16258385d911
parent: 104dd41d968d29056cdbe2bdbd2d1e3462261421
author: Werner Lemberg <[email protected]>
date: Wed Sep 17 01:26:33 EDT 2003
Formatting.
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -125,7 +125,6 @@
(*TT_Done_Face_Func)( TT_Face face );
-
/*************************************************************************/
/* */
/* <FuncType> */
@@ -451,7 +450,6 @@
/* */
typedef void
(*TT_Free_Table_Func)( TT_Face face );
-
/*************************************************************************/
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -38,11 +38,13 @@
{
FT_Service_BDF service;
+
FT_FACE_FIND_SERVICE( service, face, FT_SERVICE_ID_BDF );
if ( service && service->get_charset_id )
error = service->get_charset_id( face, &encoding, ®istry );
}
+
if ( acharset_encoding )
*acharset_encoding = encoding;
@@ -69,11 +71,13 @@
{
FT_Service_BDF service;
+
FT_FACE_FIND_SERVICE( service, face, FT_SERVICE_ID_BDF );
if ( service && service->get_property )
error = service->get_property( face, prop_name, aproperty );
}
+
return error;
}
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -4,7 +4,7 @@
/* */
/* Multiple Master font support (body). */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,6 +31,7 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_mm
+
static FT_Error
ft_face_get_mm_service( FT_Face face,
FT_Service_MultiMasters *aservice )
@@ -37,6 +38,7 @@
{
FT_Error error;
+
*aservice = NULL;
if ( !face )
@@ -50,6 +52,7 @@
multi_masters,
FT_SERVICE_ID_MULTI_MASTERS );
}
+
return error;
}
@@ -63,6 +66,7 @@
FT_Error error;
FT_Service_MultiMasters service;
+
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
@@ -85,6 +89,7 @@
FT_Error error;
FT_Service_MultiMasters service;
+
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
@@ -92,6 +97,7 @@
if ( service->set_mm_design )
error = service->set_mm_design( face, num_coords, coords );
}
+
return error;
}
@@ -106,6 +112,7 @@
FT_Error error;
FT_Service_MultiMasters service;
+
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
@@ -113,7 +120,9 @@
if ( service->set_mm_blend )
error = service->set_mm_blend( face, num_coords, coords );
}
+
return error;
}
+
/* END */
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -31,6 +31,7 @@
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
+
FT_BASE_DEF( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id )
@@ -38,6 +39,7 @@
FT_Pointer result = NULL;
FT_ServiceDesc desc = service_descriptors;
+
if ( desc && service_id )
{
for ( ; desc->serv_id != NULL; desc++ )
@@ -44,14 +46,16 @@
{
if ( ft_strcmp( desc->serv_id, service_id ) == 0 )
{
- result = (FT_Pointer) desc->serv_data;
+ result = (FT_Pointer)desc->serv_data;
break;
}
}
}
+
return result;
}
+
FT_BASE_DEF( void )
ft_validator_init( FT_Validator valid,
const FT_Byte* base,
@@ -1215,8 +1219,8 @@
type = flags >> 8;
len = rlen;
- pfb_data[pfb_pos++] = (FT_Byte) type;
- pfb_lenpos = (FT_Byte) pfb_pos;
+ pfb_data[pfb_pos++] = (FT_Byte)type;
+ pfb_lenpos = (FT_Byte)pfb_pos;
pfb_data[pfb_pos++] = 0; /* 4-byte length, fill in later */
pfb_data[pfb_pos++] = 0;
pfb_data[pfb_pos++] = 0;
@@ -1378,7 +1382,7 @@
if ( error )
goto Exit;
- head2[15] = (FT_Byte)(head[15] + 1); /* make it be different */
+ head2[15] = (FT_Byte)( head[15] + 1 ); /* make it be different */
error = FT_Stream_Read( stream, (FT_Byte*)head2, 16 );
if ( error )
@@ -2394,31 +2398,38 @@
{
FT_Service_GlyphDict service;
+
#if 0
+
FT_FACE_LOOKUP_SERVICE( face, service,
glyph_dict,
FT_SERVICE_ID_GLYPH_DICT );
+
#else
- service = face->internal->services . glyph_dict;
- if ( service == FT_SERVICE_UNAVAILABLE )
- service = NULL;
- else if ( service == NULL )
- {
- FT_Module module = FT_MODULE(face->driver);
+
+ service = face->internal->services.glyph_dict;
+ if ( service == FT_SERVICE_UNAVAILABLE )
+ service = NULL;
+ else if ( service == NULL )
+ {
+ FT_Module module = FT_MODULE( face->driver );
+
- if ( module->clazz->get_interface )
- service = module->clazz->get_interface( module,
- FT_SERVICE_ID_GLYPH_DICT );
+ if ( module->clazz->get_interface )
+ service = module->clazz->get_interface( module,
+ FT_SERVICE_ID_GLYPH_DICT );
- face->internal->services . glyph_dict = service != NULL
- ? service
- : FT_SERVICE_UNAVAILABLE;
- }
+ face->internal->services.glyph_dict =
+ service != NULL ? service
+ : FT_SERVICE_UNAVAILABLE;
+ }
-#endif
+#endif /* 1 */
+
if ( service && service->name_index )
result = service->name_index( face, glyph_name );
- }
+ }
+
return result;
}
@@ -2444,14 +2455,13 @@
{
FT_Service_GlyphDict service;
+
FT_FACE_LOOKUP_SERVICE( face, service,
glyph_dict,
FT_SERVICE_ID_GLYPH_DICT );
if ( service && service->get_name )
- {
error = service->get_name( face, glyph_index, buffer, buffer_max );
- }
}
return error;
@@ -2473,6 +2483,7 @@
{
FT_Service_PsName service;
+
FT_FACE_LOOKUP_SERVICE( face, service,
postscript_name,
FT_SERVICE_ID_POSTSCRIPT_NAME );
@@ -2480,6 +2491,7 @@
if ( service && service->get_ps_name )
result = service->get_ps_name( face );
}
+
Exit:
return result;
}
@@ -2493,6 +2505,7 @@
{
void* table = 0;
FT_Service_SFNT_Table service;
+
if ( face && FT_IS_SFNT( face ) )
{
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -712,8 +712,8 @@
static const FT_Service_BDFRec bdf_service_bdf =
{
- (FT_BDF_GetCharsetIdFunc) bdf_get_charset_id,
- (FT_BDF_GetPropertyFunc) bdf_get_bdf_property
+ (FT_BDF_GetCharsetIdFunc)bdf_get_charset_id,
+ (FT_BDF_GetPropertyFunc) bdf_get_bdf_property
};
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -312,10 +312,10 @@
}
- static const FT_Service_GlyphDictRec cff_service_glyph_dict =
+ static const FT_Service_GlyphDictRec cff_service_glyph_dict =
{
- (FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc) cff_get_name_index,
+ (FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
+ (FT_GlyphDict_NameIndexFunc)cff_get_name_index,
};
@@ -333,12 +333,13 @@
static const FT_ServiceDescRec cff_services[] =
{
- { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF },
+ { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF },
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- { FT_SERVICE_ID_GLYPH_DICT, & cff_service_glyph_dict },
+ { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict },
#endif
{ NULL, NULL }
};
+
static FT_Module_Interface
cff_get_interface( CFF_Driver driver,
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -54,6 +54,7 @@
return result;
}
+
static const FT_Service_PsNameRec cid_service_ps_name =
{
@@ -60,6 +61,7 @@
(FT_PsName_GetFunc) cid_get_postscript_name
};
+
/*
* SERVICE LIST
*
@@ -67,10 +69,11 @@
static const FT_ServiceDescRec cid_services[] =
{
- { FT_SERVICE_ID_POSTSCRIPT_NAME, & cid_service_ps_name },
- { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID },
+ { FT_SERVICE_ID_POSTSCRIPT_NAME, &cid_service_ps_name },
+ { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID },
{ NULL, NULL }
};
+
static FT_Module_Interface
cid_get_interface( FT_Driver driver,
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -510,10 +510,11 @@
return PCF_Err_Invalid_Argument;
}
+
static FT_Service_BDFRec pcf_service_bdf =
{
- (FT_BDF_GetCharsetIdFunc) NULL, /* unimplemented ? */
- (FT_BDF_GetPropertyFunc) pcf_get_bdf_property
+ (FT_BDF_GetCharsetIdFunc)NULL, /* unimplemented ? */
+ (FT_BDF_GetPropertyFunc) pcf_get_bdf_property
};
@@ -525,7 +526,7 @@
static FT_ServiceDescRec pcf_services[] =
{
- { FT_SERVICE_ID_BDF, & pcf_service_bdf },
+ { FT_SERVICE_ID_BDF, &pcf_service_bdf },
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PCF },
{ NULL, NULL }
};
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -609,23 +609,26 @@
}
- /* the kerning data embedded in a PFR font are (charcode,charcode)
- * pairs, we need to translate them to (gindex,gindex) and sort
- * the resulting array
+ /*
+ * The kerning data embedded in a PFR font are (charcode,charcode)
+ * pairs; we need to translate them to (gindex,gindex) and sort
+ * the resulting array.
*/
static FT_UInt
- pfr_get_gindex( PFR_Char chars,
- FT_UInt count,
- FT_UInt charcode )
+ pfr_get_gindex( PFR_Char chars,
+ FT_UInt count,
+ FT_UInt charcode )
{
- FT_UInt min = 0;
- FT_UInt max = count;
+ FT_UInt min = 0;
+ FT_UInt max = count;
+
while ( min < max )
{
- FT_UInt mid = (min+max) >> 1;
+ FT_UInt mid = ( min + max ) >> 1;
PFR_Char c = chars + mid;
+
if ( c->char_code == charcode )
return mid + 1;
@@ -639,12 +642,13 @@
FT_CALLBACK_DEF( int )
- pfr_compare_kern_pairs( const void* pair1,
- const void* pair2 )
+ pfr_compare_kern_pairs( const void* pair1,
+ const void* pair2 )
{
FT_UInt32 p1 = PFR_KERN_PAIR_INDEX( (PFR_KernPair)pair1 );
FT_UInt32 p2 = PFR_KERN_PAIR_INDEX( (PFR_KernPair)pair2 );
+
if ( p1 < p2 )
return -1;
if ( p1 > p2 )
@@ -654,8 +658,8 @@
static FT_Error
- pfr_sort_kerning_pairs( FT_Stream stream,
- PFR_PhyFont phy_font )
+ pfr_sort_kerning_pairs( FT_Stream stream,
+ PFR_PhyFont phy_font )
{
FT_Error error;
FT_Memory memory = stream->memory;
@@ -665,6 +669,7 @@
FT_UInt num_chars = phy_font->num_chars;
FT_UInt count;
+
/* create kerning pairs array
*/
if ( FT_NEW_ARRAY( phy_font->kern_pairs, phy_font->num_kern_pairs ) )
@@ -682,6 +687,7 @@
FT_UInt limit = count + item->pair_count;
FT_Byte* p;
+
if ( limit > phy_font->num_kern_pairs )
{
error = PFR_Err_Invalid_Table;
@@ -700,6 +706,7 @@
FT_UInt char1, char2;
FT_Int kerning;
+
if ( item->flags & PFR_KERN_2BYTE_CHAR )
{
char1 = FT_NEXT_USHORT( p );
@@ -744,10 +751,10 @@
static const PFR_ExtraItemRec pfr_phy_font_extra_items[] =
{
- { 1, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_bitmap_info },
- { 2, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_font_id },
- { 3, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_stem_snaps },
- { 4, (PFR_ExtraItem_ParseFunc) pfr_extra_item_load_kerning_pairs },
+ { 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
+ { 2, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_font_id },
+ { 3, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_stem_snaps },
+ { 4, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_kerning_pairs },
{ 0, NULL }
};
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -425,6 +425,7 @@
FT_UNUSED( error ); /* just needed as syntactical sugar */
+
kerning->x = 0;
kerning->y = 0;
@@ -433,10 +434,11 @@
while ( min < max )
{
- FT_UInt mid = (min+max) >> 1;
+ FT_UInt mid = ( min + max ) >> 1;
PFR_KernPair pair = pairs + mid;
FT_UInt32 pidx = PFR_KERN_PAIR_INDEX( pair );
+
if ( pidx == idx )
{
kerning->x = pair->kerning;
@@ -444,7 +446,7 @@
}
if ( pidx < idx )
- min = mid+1;
+ min = mid + 1;
else
max = mid;
}
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -119,11 +119,12 @@
static const FT_Service_GlyphDictRec sfnt_service_glyph_dict =
{
- (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc) NULL
+ (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
+ (FT_GlyphDict_NameIndexFunc)NULL
};
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
+
/*
* POSTSCRIPT NAME SERVICE
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -359,12 +359,13 @@
FT_Module sfntd;
SFNT_Service sfnt;
+
result = ft_service_list_lookup( tt_services, tt_interface );
if ( result != NULL )
return result;
/* only return the default interface from the SFNT module */
- sfntd = FT_Get_Module( driver->root.root.library, "sfnt" );
+ sfntd = FT_Get_Module( driver->root.root.library, "sfnt" );
if ( sfntd )
{
sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -98,8 +98,8 @@
static const FT_Service_GlyphDictRec t1_service_glyph_dict =
{
- (FT_GlyphDict_GetNameFunc) t1_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc) t1_get_name_index
+ (FT_GlyphDict_GetNameFunc) t1_get_glyph_name,
+ (FT_GlyphDict_NameIndexFunc)t1_get_name_index
};
@@ -116,7 +116,7 @@
static const FT_Service_PsNameRec t1_service_ps_name =
{
- (FT_PsName_GetFunc) & t1_get_ps_name
+ (FT_PsName_GetFunc) &t1_get_ps_name
};
@@ -128,9 +128,9 @@
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
static const FT_Service_MultiMastersRec t1_service_multi_masters =
{
- (FT_Get_MM_Func) T1_Get_Multi_Master,
- (FT_Set_MM_Design_Func) T1_Set_MM_Design,
- (FT_Set_MM_Blend_Func) T1_Set_MM_Blend
+ (FT_Get_MM_Func) T1_Get_Multi_Master,
+ (FT_Set_MM_Design_Func)T1_Set_MM_Design,
+ (FT_Set_MM_Blend_Func) T1_Set_MM_Blend
};
#endif
@@ -143,8 +143,8 @@
static const FT_ServiceDescRec t1_services[] =
{
{ FT_SERVICE_ID_POSTSCRIPT_NAME, &t1_service_ps_name },
- { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict },
- { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_1 },
+ { FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict },
+ { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_1 },
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
{ FT_SERVICE_ID_MULTI_MASTERS, &t1_service_multi_masters },
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -104,8 +104,8 @@
static FT_Service_GlyphDictRec t42_service_glyph_dict =
{
- (FT_GlyphDict_GetNameFunc) t42_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc) t42_get_name_index
+ (FT_GlyphDict_GetNameFunc) t42_get_glyph_name,
+ (FT_GlyphDict_NameIndexFunc)t42_get_name_index
};
@@ -124,7 +124,7 @@
static FT_Service_PsNameRec t42_service_ps_name =
{
- (FT_PsName_GetFunc) t42_get_ps_name
+ (FT_PsName_GetFunc)t42_get_ps_name
};
@@ -136,11 +136,12 @@
static const FT_ServiceDescRec t42_services[] =
{
- { FT_SERVICE_ID_GLYPH_DICT, & t42_service_glyph_dict },
- { FT_SERVICE_ID_POSTSCRIPT_NAME, & t42_service_ps_name },
+ { FT_SERVICE_ID_GLYPH_DICT, &t42_service_glyph_dict },
+ { FT_SERVICE_ID_POSTSCRIPT_NAME, &t42_service_ps_name },
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_42 },
{ NULL, NULL }
};
+
static FT_Module_Interface
T42_Get_Interface( FT_Driver driver,