* include/freetype/internal/ftserv.h,

include/freetype/internal/service/svpfr.h,
        include/freetype/internal/pfr.h,
        src/base/ftpfr.c:

          migrating the functions of "ftpfr.h" to the new
          service-base internal API

        * src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
        src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
        src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
        src/type42/t42objs.c, src/winfonts/winfnt.c:

          removing various compiler warnings
This commit is contained in:
David Turner 2003-09-21 16:04:05 +00:00
parent 99ee499ef8
commit 17dd0634f2
15 changed files with 120 additions and 83 deletions

View File

@ -1,3 +1,22 @@
2003-09-21 David Turner <david@freetype.org>
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-19 David Bevan <dbevan@emtex.com>
* src/type1/t1parse.c (pfb_tag_fields): Removed.
@ -117,7 +136,7 @@
* src/base/ftbdf.c: Include FT_SERVICE_BDF_H.
(test_font_type): Removed.
(FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Use services
provided in `FT_SERVICE_ID_BDF'
provided in `FT_SERVICE_ID_BDF'
* src/base/ftmm.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
(ft_face_get_mm_service): New auxiliary function to get services

View File

@ -78,16 +78,16 @@ FT_BEGIN_HEADER
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*
* The following structure is used to _describe_ a given service
* to the library. This is useful to build simple static service lists.
*/
*/
typedef struct FT_ServiceDescRec_
{
const char* serv_id; /* service name */
const void* serv_data; /* service pointer/data */
} FT_ServiceDescRec;
typedef const FT_ServiceDescRec* FT_ServiceDesc;
@ -114,7 +114,7 @@ FT_BEGIN_HEADER
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*
* This structure is used to store a cache for several frequently used
* services. It is the type of `face->internal->services'. You
@ -128,7 +128,8 @@ FT_BEGIN_HEADER
FT_Pointer postscript_name;
FT_Pointer multi_masters;
FT_Pointer glyph_dict;
FT_Pointer pfr_metrics;
} FT_ServiceCacheRec, *FT_ServiceCache;
@ -196,13 +197,14 @@ FT_BEGIN_HEADER
/*
* The header files containing the services.
*/
#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h>
#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h>
#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
FT_END_HEADER

View File

@ -1,6 +1,6 @@
/***************************************************************************/
/* */
/* pfr.h */
/* svpfr.h */
/* */
/* Internal PFR service functions (specification only). */
/* */
@ -16,15 +16,15 @@
/***************************************************************************/
#ifndef __PFR_H__
#define __PFR_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifndef __SVPFR_H__
#define __SVPFR_H__
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_PFR_METRICS "pfr-metrics"
typedef FT_Error (*FT_PFR_GetMetricsFunc)( FT_Face face,
FT_UInt *aoutline,
FT_UInt *ametrics,
@ -41,20 +41,19 @@ FT_BEGIN_HEADER
FT_Pos *aadvance );
typedef struct FT_PFR_ServiceRec_
FT_DEFINE_SERVICE( PfrMetrics )
{
FT_PFR_GetMetricsFunc get_metrics;
FT_PFR_GetKerningFunc get_kerning;
FT_PFR_GetAdvanceFunc get_advance;
} FT_PFR_ServiceRec, *FT_PFR_Service;
#define FT_PFR_SERVICE_NAME "pfr"
};
/* */
FT_END_HEADER
#endif /* __PFR_H__ */
#endif /* __SVPFR_H__ */
/* END */

View File

@ -16,34 +16,20 @@
/***************************************************************************/
#include <ft2build.h>
#include FT_INTERNAL_PFR_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_PFR_H
/* check the format */
static FT_Error
ft_pfr_check( FT_Face face,
FT_PFR_Service *aservice )
static FT_Service_PfrMetrics
ft_pfr_check( FT_Face face )
{
FT_Error error = FT_Err_Bad_Argument;
FT_Service_PfrMetrics service;
FT_FACE_LOOKUP_SERVICE( face, FT_Service_PfrMetrics, service,
pfr_metrics, FT_SERVICE_ID_PFR_METRICS );
if ( face && face->driver )
{
FT_Module module = (FT_Module) face->driver;
const char* name = module->clazz->module_name;
if ( name[0] == 'p' &&
name[1] == 'f' &&
name[2] == 'r' &&
name[3] == 0 )
{
*aservice = (FT_PFR_Service) module->clazz->module_interface;
error = 0;
}
}
return error;
return service;
}
@ -54,12 +40,12 @@
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale )
{
FT_Error error;
FT_PFR_Service service;
FT_Error error;
FT_Service_PfrMetrics service;
error = ft_pfr_check( face, &service );
if ( !error )
service = ft_pfr_check( face );
if ( service )
{
error = service->get_metrics( face,
aoutline_resolution,
@ -67,6 +53,26 @@
ametrics_x_scale,
ametrics_y_scale );
}
else if ( face )
{
FT_Fixed x_scale, y_scale;
/* this is not a PFR font */
*aoutline_resolution = face->units_per_EM;
*ametrics_resolution = face->units_per_EM;
x_scale = y_scale = 0x10000L;
if ( face->size )
{
x_scale = face->size->metrics.x_scale;
y_scale = face->size->metrics.y_scale;
}
*ametrics_x_scale = x_scale;
*ametrics_y_scale = y_scale;
}
else
error = FT_Err_Invalid_Argument;
return error;
}
@ -77,15 +83,22 @@
FT_UInt right,
FT_Vector *avector )
{
FT_Error error;
FT_PFR_Service service;
FT_Error error;
FT_Service_PfrMetrics service;
error = ft_pfr_check( face, &service );
if ( !error )
service = ft_pfr_check( face );
if ( service )
{
error = service->get_kerning( face, left, right, avector );
}
else if ( face )
{
error = FT_Get_Kerning( face, left, right, FT_KERNING_UNSCALED, avector );
}
else
error = FT_Err_Invalid_Argument;
return error;
}
@ -95,15 +108,19 @@
FT_UInt gindex,
FT_Pos *aadvance )
{
FT_Error error;
FT_PFR_Service service;
FT_Error error;
FT_Service_PfrMetrics service;
error = ft_pfr_check( face, &service );
if ( !error )
service = ft_pfr_check( face );
if ( service )
{
error = service->get_advance( face, gindex, aadvance );
}
else
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
error = FT_Err_Invalid_Argument;
return error;
}

View File

@ -396,8 +396,8 @@
else
root->units_per_EM = 1000;
root->underline_position = dict->underline_position >> 16;
root->underline_thickness = dict->underline_thickness >> 16;
root->underline_position = (FT_Short) (dict->underline_position >> 16);
root->underline_thickness = (FT_Short) (dict->underline_thickness >> 16);
/* retrieve font family & style name */
root->family_name = cff_index_get_name( &cff->name_index, face_index );

View File

@ -199,12 +199,12 @@
if ( face->subrs )
{
FT_Int n;
for ( n = 0; n < cid->num_dicts; n++ )
{
CID_Subrs subr = face->subrs + n;
if ( subr->code )
{
@ -423,8 +423,8 @@
root->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 );
root->underline_position = info->underline_position >> 16;
root->underline_thickness = info->underline_thickness >> 16;
root->underline_position = (FT_Short) (info->underline_position >> 16);
root->underline_thickness = (FT_Short) (info->underline_thickness >> 16);
root->internal->max_points = 0;
root->internal->max_contours = 0;

View File

@ -654,7 +654,7 @@
error = pfr_load_bitmap_bits( p,
stream->limit,
format,
face->header.color_flags & 2,
FT_BOOL(face->header.color_flags & 2),
&glyph->root.bitmap );
}
}

View File

@ -589,14 +589,14 @@
/* All white-space charcters are ignored. */
skip_spaces( &cur, limit );
b = T1Radix( 16, &cur, cur + 1 );
b = (FT_Byte) T1Radix( 16, &cur, cur + 1 );
if ( cur == cur2 )
break;
/* <f> == <f0> != <0f> */
bytes[n / 2] = ( n % 2 ) ? bytes[n / 2] + b
: b * 16;
bytes[n / 2] = (FT_Byte)( ( n % 2 ) ? bytes[n / 2] + b
: b * 16 );
}
skip_spaces( &cur, limit );

View File

@ -89,7 +89,7 @@
* GLYPH DICT SERVICE
*
*/
static FT_Error
sfnt_get_glyph_name( TT_Face face,
FT_UInt glyph_index,
@ -130,7 +130,7 @@
* POSTSCRIPT NAME SERVICE
*
*/
static const char*
sfnt_get_ps_name( TT_Face face )
{
@ -243,7 +243,7 @@
static const FT_Service_PsNameRec sfnt_service_ps_name =
{
(FT_PsName_GetFunc) & sfnt_get_ps_name
(FT_PsName_GetFunc) sfnt_get_ps_name
};
@ -258,10 +258,10 @@
{ FT_SERVICE_ID_POSTSCRIPT_NAME, & sfnt_service_ps_name },
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
{ FT_SERVICE_ID_GLYPH_DICT, & sfnt_service_glyph_dict },
#endif
#endif
{ NULL, NULL }
};
};
FT_CALLBACK_DEF( FT_Module_Interface )

View File

@ -643,14 +643,14 @@
FT_Bitmap_Size* bsize = root->available_sizes + n;
TT_SBit_Strike strike = face->sbit_strikes + n;
FT_UShort fupem = face->header.Units_Per_EM;
FT_Short height = face->horizontal.Ascender -
face->horizontal.Descender +
face->horizontal.Line_Gap;
FT_Short height = (FT_Short)( face->horizontal.Ascender -
face->horizontal.Descender +
face->horizontal.Line_Gap );
FT_Short avg = face->os2.xAvgCharWidth;
/* assume 72dpi */
bsize->height =
bsize->height =
(FT_Short)( ( height * strike->y_ppem + fupem/2 ) / fupem );
bsize->width =
(FT_Short)( ( avg * strike->y_ppem + fupem/2 ) / fupem );

View File

@ -228,7 +228,7 @@
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
/* Determine whether unpatented hinting is to be used for this face. */
face->unpatented_hinting =
face->unpatented_hinting = FT_BOOL
( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );
{

View File

@ -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
};
@ -145,10 +145,10 @@
{ 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 },
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
{ FT_SERVICE_ID_MULTI_MASTERS, &t1_service_multi_masters },
#endif
#endif
{ NULL, NULL }
};

View File

@ -434,8 +434,8 @@
root->max_advance_height = root->height;
root->underline_position = info->underline_position >> 16;
root->underline_thickness = info->underline_thickness >> 16;
root->underline_position = (FT_Short)( info->underline_position >> 16 );
root->underline_thickness = (FT_Short)( info->underline_thickness >> 16 );
root->internal->max_points = 0;
root->internal->max_contours = 0;

View File

@ -278,8 +278,8 @@
root->max_advance_width = face->ttf_face->max_advance_width;
root->max_advance_height = face->ttf_face->max_advance_height;
root->underline_position = info->underline_position >> 16;
root->underline_thickness = info->underline_thickness >> 16;
root->underline_position = (FT_Short)( info->underline_position >> 16 );
root->underline_thickness = (FT_Short)( info->underline_thickness >> 16 );
root->internal->max_points = 0;
root->internal->max_contours = 0;

View File

@ -453,10 +453,10 @@
bsize->width = font->header.avg_width;
bsize->height =
font->header.pixel_height + font->header.external_leading;
bsize->height = (FT_Short)(
font->header.pixel_height + font->header.external_leading );
bsize->size = font->header.nominal_point_size << 6;
bsize->x_ppem =
bsize->x_ppem =
(FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )
/ 72 );
bsize->y_ppem =