* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE):

Fix compilation warning (s/pptr/Pptr/).

* include/freetype/internal/internal.h (FT_INTERNAL_PFR_H,
FT_INTERNAL_FNT_TYPES_H): Removed.
This commit is contained in:
Werner Lemberg 2003-09-22 09:53:56 +00:00
parent e2d12842e1
commit a259b6dddb
13 changed files with 123 additions and 76 deletions

View File

@ -1,30 +1,64 @@
2003-09-21 Werner Lemberg <wl@gnu.org>
* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE):
Fix compilation warning (s/pptr/Pptr/).
* include/freetype/internal/internal.h (FT_INTERNAL_PFR_H,
FT_INTERNAL_FNT_TYPES_H): Removed.
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 PFR and WINFNT drivers to the new service-based
internal API.
migrating the functions of "ftpfr.h" to the new
service-base internal API
* include/freetype/internal/fnttypes.h: Removed. Most of its data
are moved to winfnt.h and...
* include/freetype/internal/services/svwinfnt.h: New file.
* 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:
* include/freetype/internal/pfr.h: Removed. Most of its data are
moved to...
* include/freetype/internal/services/svpfr.h: New file.
removing various compiler warnings
* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE,
FT_FACE_LOOKUP_SERVICE): Simplify fix of 2003-09-16 by removing
pointer type argument.
Updated all callers.
Update macro names of services header files.
* src/base/ftobjs.c (FT_Get_Name_Index): Simplified code.
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
* src/base/ftpfr.c: Include FT_SERVICE_PFR_H instead of
FT_INTERNAL_PFR_H.
(ft_pfr_check, FT_Get_PFR_Metrics, FT_Get_PFR_Kerning,
FT_Get_PFR_Advance): Use services provided in `PFR_METRICS'.
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
* src/base/ftwinfnt.c: Include FT_SERVICE_WINFNT_H instead of
FT_INTERNAL_FNT_TYPES_H.
(FT_Get_WinFNT_Header): Use service provided in `WINFNT'.
* src/pfr/pfrdrivr.c: Include FT_SERVICE_PFR_H and
FT_SERVICE_XFREE86_NAME_H instead of FT_INTERNAL_PFR_H.
(pfr_service_bdf): Updated.
(pfr_services): New services list.
(pfr_get_service): New function.
(pfr_driver_class): Updated.
* src/winfonts/winfnt.c: Include FT_SERVICE_WINFNT_H and
FT_SERVICE_XFREE86_NAME_H instead of FT_INTERNAL_FNT_TYPES_H.
(winfnt_get_header, winfnt_get_service): New functions.
(winfnt_service_rec): New structure providing WINFNT services.
(winfnt_services): New services list.
(winfnt_driver_class): Updated.
* src/winfonts/winfnt.h: Add most of the removed fnttypes.h data.
* src/sfnt/sfdriver.c (sfnt_service_ps_name): Fix typo.
* src/type1/t1driver.c (t1_service_ps_name): Fix typo.
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfobjs.c, src/truetype/ttobjs.c,
src/type1/t1objs.c, src/type42/t42objs.c: Removing various compiler
warnings.
2003-09-19 David Bevan <dbevan@emtex.com>
@ -145,7 +179,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

@ -46,15 +46,12 @@ FT_BEGIN_HEADER
* id ::
* A string describing the service as defined in the service's
* header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
* `multi-masters'). It will be prefixed with "FT_SERVICE_ID_" !!
* `multi-masters'). It is automatically prefixed with
* `FT_SERVICE_ID_'.
*
* face ::
* The source face handle.
*
* ptrtype ::
* The pointer type of `ptr'. This is needed to make FreeType
* compile cleanly with C++.
*
* @output:
* ptr ::
* A variable that receives the service pointer. Will be NULL
@ -63,14 +60,16 @@ FT_BEGIN_HEADER
#define FT_FACE_FIND_SERVICE( ptr, face, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
FT_Pointer* pptr = (FT_Pointer*) &(ptr); \
\
/* the strange cast is to allow C++ compilation */ \
*pptr = NULL; \
FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \
\
\
*Pptr = NULL; \
if ( module->clazz->get_interface ) \
*pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
*Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
FT_END_STMNT
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -123,9 +122,9 @@ FT_BEGIN_HEADER
* All fields should have the type FT_Pointer to relax compilation
* dependencies. We assume the developer isn't completely stupid.
*
* Each field must be named service_XXXX where XXX correspond to
* the correct FT_SERVICE_ID_XXXX macro. see the definition of
* FT_FACE_LOOKUP_SERVICE below to see why
* Each field must be named `service_XXXX' where `XXX' corresponds to
* the correct FT_SERVICE_ID_XXXX macro. See the definition of
* FT_FACE_LOOKUP_SERVICE below how this is implemented.
*
*/
typedef struct FT_ServiceCacheRec_
@ -163,20 +162,16 @@ FT_BEGIN_HEADER
* id ::
* The service ID.
*
* ptrtype ::
* The pointer type of `ptr'. This is needed to make FreeType
* compile cleanly with C++.
*
* @output:
* ptr ::
* A variable receiving the service data. NULL if not available.
*/
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
/* the strange cast is to allow C++ compilation */ \
FT_Pointer* pptr = (FT_Pointer*)&(ptr); \
FT_Pointer svc; \
\
/* the strange cast is to allow C++ compilation */ \
\
svc = FT_FACE(face)->internal->services. service_ ## id ; \
if ( svc == FT_SERVICE_UNAVAILABLE ) \
@ -192,6 +187,7 @@ FT_BEGIN_HEADER
} \
FT_END_STMNT
/*
* A macro used to define new service structure types.
*/

View File

@ -39,9 +39,7 @@
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
#define FT_INTERNAL_TYPE42_TYPES_H <freetype/internal/t42types.h>
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
#define FT_INTERNAL_BDF_TYPES_H <freetype/internal/bdftypes.h>
#define FT_INTERNAL_PFR_H <freetype/internal/pfr.h>
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>

View File

@ -2,9 +2,9 @@
/* */
/* svpfr.h */
/* */
/* Internal PFR service functions (specification only). */
/* Internal PFR service functions (specification). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -21,24 +21,30 @@
#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,
FT_Fixed *ax_scale,
FT_Fixed *ay_scale );
#define FT_SERVICE_ID_PFR_METRICS "pfr-metrics"
typedef FT_Error (*FT_PFR_GetKerningFunc)( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
typedef FT_Error (*FT_PFR_GetAdvanceFunc)( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
typedef FT_Error
(*FT_PFR_GetMetricsFunc)( FT_Face face,
FT_UInt *aoutline,
FT_UInt *ametrics,
FT_Fixed *ax_scale,
FT_Fixed *ay_scale );
typedef FT_Error
(*FT_PFR_GetKerningFunc)( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
typedef FT_Error
(*FT_PFR_GetAdvanceFunc)( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
FT_DEFINE_SERVICE( PfrMetrics )

View File

@ -2,7 +2,7 @@
/* */
/* svwinfnt.h */
/* */
/* The FreeType Windows FNT/FONT service */
/* The FreeType Windows FNT/FONT service (specification). */
/* */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -19,17 +19,19 @@
#ifndef __SVWINFNT_H__
#define __SVWINFNT_H__
#include FT_INTERNAL_SERVICE_H
#include FT_WINFONTS_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_WINFNT "winfonts"
typedef FT_Error (*FT_WinFnt_GetHeaderFunc)( FT_Face face,
FT_WinFNT_HeaderRec *aheader );
typedef FT_Error
(*FT_WinFnt_GetHeaderFunc)( FT_Face face,
FT_WinFNT_HeaderRec *aheader );
FT_DEFINE_SERVICE( WinFnt )
{
@ -38,6 +40,7 @@ FT_BEGIN_HEADER
/* */
FT_END_HEADER

View File

@ -2,7 +2,7 @@
/* */
/* svxf86nm.h */
/* */
/* The FreeType XFree86 services (specification). */
/* The FreeType XFree86 services (specification only). */
/* */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -56,6 +56,7 @@
{
FT_Fixed x_scale, y_scale;
/* this is not a PFR font */
*aoutline_resolution = face->units_per_EM;
*ametrics_resolution = face->units_per_EM;
@ -88,13 +89,10 @@
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 );
}
error = FT_Get_Kerning( face, left, right,
FT_KERNING_UNSCALED, avector );
else
error = FT_Err_Invalid_Argument;
@ -117,7 +115,7 @@
error = service->get_advance( face, gindex, aadvance );
}
else
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
/* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
error = FT_Err_Invalid_Argument;
return error;

View File

@ -29,6 +29,7 @@
FT_Service_WinFnt service;
FT_Error error;
error = FT_Err_Invalid_Argument;
if ( face != NULL )
@ -40,7 +41,9 @@
error = service->get_header( face, header );
}
}
return error;
return error;
}
/* END */

View File

@ -396,8 +396,10 @@
else
root->units_per_EM = 1000;
root->underline_position = (FT_Short) (dict->underline_position >> 16);
root->underline_thickness = (FT_Short) (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

@ -423,8 +423,10 @@
root->height = (FT_Short)(
( ( root->ascender - root->descender ) * 12 ) / 10 );
root->underline_position = (FT_Short) (info->underline_position >> 16);
root->underline_thickness = (FT_Short) (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

@ -651,11 +651,12 @@
error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
if ( !error )
{
error = pfr_load_bitmap_bits( p,
stream->limit,
format,
FT_BOOL(face->header.color_flags & 2),
&glyph->root.bitmap );
error = pfr_load_bitmap_bits(
p,
stream->limit,
format,
FT_BOOL(face->header.color_flags & 2),
&glyph->root.bitmap );
}
}
}

View File

@ -434,8 +434,10 @@
root->max_advance_height = root->height;
root->underline_position = (FT_Short)( info->underline_position >> 16 );
root->underline_thickness = (FT_Short)( 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

@ -637,11 +637,13 @@
{
FNT_Font font = ((FNT_Face)face)->font;
*aheader = font->header;
return 0;
}
static const FT_Service_WinFntRec winfnt_service_rec =
{
winfnt_get_header