* 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,: simplification of service lookup macros, updating the PFR and WINFNT font drivers to new services
This commit is contained in:
parent
17dd0634f2
commit
e2d12842e1
|
@ -16,6 +16,15 @@
|
||||||
removing various compiler warnings
|
removing various compiler warnings
|
||||||
|
|
||||||
|
|
||||||
|
* 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,:
|
||||||
|
|
||||||
|
simplification of service lookup macros, updating the PFR and
|
||||||
|
WINFNT font drivers to new services
|
||||||
|
|
||||||
|
|
||||||
2003-09-19 David Bevan <dbevan@emtex.com>
|
2003-09-19 David Bevan <dbevan@emtex.com>
|
||||||
|
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
/***************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* fnttypes.h */
|
|
||||||
/* */
|
|
||||||
/* Basic Windows FNT/FON type definitions and interface (specification */
|
|
||||||
/* only). */
|
|
||||||
/* */
|
|
||||||
/* Copyright 1996-2001, 2002, 2003 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 __FNTTYPES_H__
|
|
||||||
#define __FNTTYPES_H__
|
|
||||||
|
|
||||||
|
|
||||||
#include <ft2build.h>
|
|
||||||
#include FT_FREETYPE_H
|
|
||||||
#include FT_WINFONTS_H
|
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct WinMZ_HeaderRec_
|
|
||||||
{
|
|
||||||
FT_UShort magic;
|
|
||||||
/* skipped content */
|
|
||||||
FT_UShort lfanew;
|
|
||||||
|
|
||||||
} WinMZ_HeaderRec;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct WinNE_HeaderRec_
|
|
||||||
{
|
|
||||||
FT_UShort magic;
|
|
||||||
/* skipped content */
|
|
||||||
FT_UShort resource_tab_offset;
|
|
||||||
FT_UShort rname_tab_offset;
|
|
||||||
|
|
||||||
} WinNE_HeaderRec;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct WinNameInfoRec_
|
|
||||||
{
|
|
||||||
FT_UShort offset;
|
|
||||||
FT_UShort length;
|
|
||||||
FT_UShort flags;
|
|
||||||
FT_UShort id;
|
|
||||||
FT_UShort handle;
|
|
||||||
FT_UShort usage;
|
|
||||||
|
|
||||||
} WinNameInfoRec;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct WinResourceInfoRec_
|
|
||||||
{
|
|
||||||
FT_UShort type_id;
|
|
||||||
FT_UShort count;
|
|
||||||
|
|
||||||
} WinResourceInfoRec;
|
|
||||||
|
|
||||||
|
|
||||||
#define WINFNT_MZ_MAGIC 0x5A4D
|
|
||||||
#define WINFNT_NE_MAGIC 0x454E
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct FNT_FontRec_
|
|
||||||
{
|
|
||||||
FT_ULong offset;
|
|
||||||
FT_Int size_shift;
|
|
||||||
|
|
||||||
FT_WinFNT_HeaderRec header;
|
|
||||||
|
|
||||||
FT_Byte* fnt_frame;
|
|
||||||
FT_ULong fnt_size;
|
|
||||||
|
|
||||||
} FNT_FontRec, *FNT_Font;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct FNT_FaceRec_
|
|
||||||
{
|
|
||||||
FT_FaceRec root;
|
|
||||||
FNT_Font font;
|
|
||||||
|
|
||||||
FT_CharMap charmap_handle;
|
|
||||||
FT_CharMapRec charmap; /* a single charmap per face */
|
|
||||||
|
|
||||||
} FNT_FaceRec, *FNT_Face;
|
|
||||||
|
|
||||||
|
|
||||||
FT_END_HEADER
|
|
||||||
|
|
||||||
#endif /* __FNTTYPES_H__ */
|
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
|
|
@ -46,7 +46,7 @@ FT_BEGIN_HEADER
|
||||||
* id ::
|
* id ::
|
||||||
* A string describing the service as defined in the service's
|
* A string describing the service as defined in the service's
|
||||||
* header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
|
* header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
|
||||||
* `multi-masters').
|
* `multi-masters'). It will be prefixed with "FT_SERVICE_ID_" !!
|
||||||
*
|
*
|
||||||
* face ::
|
* face ::
|
||||||
* The source face handle.
|
* The source face handle.
|
||||||
|
@ -60,17 +60,17 @@ FT_BEGIN_HEADER
|
||||||
* A variable that receives the service pointer. Will be NULL
|
* A variable that receives the service pointer. Will be NULL
|
||||||
* if not found.
|
* if not found.
|
||||||
*/
|
*/
|
||||||
#define FT_FACE_FIND_SERVICE( ptrtype, ptr, face, id ) \
|
#define FT_FACE_FIND_SERVICE( ptr, face, id ) \
|
||||||
FT_BEGIN_STMNT \
|
FT_BEGIN_STMNT \
|
||||||
FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
|
FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
|
||||||
\
|
FT_Pointer* pptr = (FT_Pointer*) &(ptr); \
|
||||||
\
|
\
|
||||||
(ptr) = NULL; \
|
/* the strange cast is to allow C++ compilation */ \
|
||||||
if ( module->clazz->get_interface ) \
|
*pptr = NULL; \
|
||||||
(ptr) = (ptrtype)module->clazz->get_interface( module, id ); \
|
if ( module->clazz->get_interface ) \
|
||||||
|
*pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
|
||||||
FT_END_STMNT
|
FT_END_STMNT
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -122,13 +122,19 @@ FT_BEGIN_HEADER
|
||||||
*
|
*
|
||||||
* All fields should have the type FT_Pointer to relax compilation
|
* All fields should have the type FT_Pointer to relax compilation
|
||||||
* dependencies. We assume the developer isn't completely stupid.
|
* 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
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct FT_ServiceCacheRec_
|
typedef struct FT_ServiceCacheRec_
|
||||||
{
|
{
|
||||||
FT_Pointer postscript_name;
|
FT_Pointer service_POSTSCRIPT_NAME;
|
||||||
FT_Pointer multi_masters;
|
FT_Pointer service_MULTI_MASTERS;
|
||||||
FT_Pointer glyph_dict;
|
FT_Pointer service_GLYPH_DICT;
|
||||||
FT_Pointer pfr_metrics;
|
FT_Pointer service_PFR_METRICS;
|
||||||
|
FT_Pointer service_WINFNT;
|
||||||
|
|
||||||
} FT_ServiceCacheRec, *FT_ServiceCache;
|
} FT_ServiceCacheRec, *FT_ServiceCache;
|
||||||
|
|
||||||
|
@ -165,22 +171,27 @@ FT_BEGIN_HEADER
|
||||||
* ptr ::
|
* ptr ::
|
||||||
* A variable receiving the service data. NULL if not available.
|
* A variable receiving the service data. NULL if not available.
|
||||||
*/
|
*/
|
||||||
#define FT_FACE_LOOKUP_SERVICE( face, ptrtype, ptr, field, id ) \
|
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
|
||||||
FT_BEGIN_STMNT \
|
FT_BEGIN_STMNT \
|
||||||
(ptr) = (ptrtype)FT_FACE(face)->internal->services.field ; \
|
FT_Pointer* pptr = (FT_Pointer*)&(ptr); \
|
||||||
if ( (ptr) == FT_SERVICE_UNAVAILABLE ) \
|
FT_Pointer svc; \
|
||||||
(ptr) = NULL; \
|
\
|
||||||
else if ( (ptr) == NULL ) \
|
/* the strange cast is to allow C++ compilation */ \
|
||||||
{ \
|
\
|
||||||
FT_FACE_FIND_SERVICE( ptrtype, ptr, face, id ); \
|
svc = FT_FACE(face)->internal->services. service_ ## id ; \
|
||||||
\
|
if ( svc == FT_SERVICE_UNAVAILABLE ) \
|
||||||
FT_FACE(face)->internal->services.field = \
|
svc = NULL; \
|
||||||
(FT_Pointer)( (ptr) != NULL ? (ptr) \
|
else if ( svc == NULL ) \
|
||||||
: FT_SERVICE_UNAVAILABLE ); \
|
{ \
|
||||||
} \
|
FT_FACE_FIND_SERVICE( svc, face, id ); \
|
||||||
|
\
|
||||||
|
FT_FACE(face)->internal->services. service_ ## id = \
|
||||||
|
(FT_Pointer)( svc != NULL ? svc \
|
||||||
|
: FT_SERVICE_UNAVAILABLE ); \
|
||||||
|
*pptr = svc; \
|
||||||
|
} \
|
||||||
FT_END_STMNT
|
FT_END_STMNT
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A macro used to define new service structure types.
|
* A macro used to define new service structure types.
|
||||||
*/
|
*/
|
||||||
|
@ -205,7 +216,9 @@ FT_BEGIN_HEADER
|
||||||
#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.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_SFNT_H <freetype/internal/services/svsfnt.h>
|
||||||
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
|
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
|
||||||
|
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/***************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* svwinfnt.h */
|
||||||
|
/* */
|
||||||
|
/* The FreeType Windows FNT/FONT service */
|
||||||
|
/* */
|
||||||
|
/* Copyright 2003 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 __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 );
|
||||||
|
|
||||||
|
FT_DEFINE_SERVICE( WinFnt )
|
||||||
|
{
|
||||||
|
FT_WinFnt_GetHeaderFunc get_header;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
|
FT_END_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __SVWINFNT_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -37,19 +37,19 @@
|
||||||
if ( face )
|
if ( face )
|
||||||
{
|
{
|
||||||
FT_Service_BDF service;
|
FT_Service_BDF service;
|
||||||
|
|
||||||
|
|
||||||
FT_FACE_FIND_SERVICE( FT_Service_BDF, service,
|
|
||||||
|
FT_FACE_FIND_SERVICE( service,
|
||||||
face,
|
face,
|
||||||
FT_SERVICE_ID_BDF );
|
BDF );
|
||||||
|
|
||||||
if ( service && service->get_charset_id )
|
if ( service && service->get_charset_id )
|
||||||
error = service->get_charset_id( face, &encoding, ®istry );
|
error = service->get_charset_id( face, &encoding, ®istry );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( acharset_encoding )
|
if ( acharset_encoding )
|
||||||
*acharset_encoding = encoding;
|
*acharset_encoding = encoding;
|
||||||
|
|
||||||
if ( acharset_registry )
|
if ( acharset_registry )
|
||||||
*acharset_registry = registry;
|
*acharset_registry = registry;
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@
|
||||||
if ( face )
|
if ( face )
|
||||||
{
|
{
|
||||||
FT_Service_BDF service;
|
FT_Service_BDF service;
|
||||||
|
|
||||||
|
|
||||||
FT_FACE_FIND_SERVICE( FT_Service_BDF, service,
|
|
||||||
|
FT_FACE_FIND_SERVICE( service,
|
||||||
face,
|
face,
|
||||||
FT_SERVICE_ID_BDF );
|
BDF );
|
||||||
|
|
||||||
if ( service && service->get_property )
|
if ( service && service->get_property )
|
||||||
error = service->get_property( face, prop_name, aproperty );
|
error = service->get_property( face, prop_name, aproperty );
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,21 +37,20 @@
|
||||||
FT_Service_MultiMasters *aservice )
|
FT_Service_MultiMasters *aservice )
|
||||||
{
|
{
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
*aservice = NULL;
|
*aservice = NULL;
|
||||||
|
|
||||||
if ( !face )
|
if ( !face )
|
||||||
return FT_Err_Invalid_Face_Handle;
|
return FT_Err_Invalid_Face_Handle;
|
||||||
|
|
||||||
error = FT_Err_Invalid_Argument;
|
error = FT_Err_Invalid_Argument;
|
||||||
|
|
||||||
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
|
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
|
||||||
{
|
{
|
||||||
FT_FACE_LOOKUP_SERVICE( face,
|
FT_FACE_LOOKUP_SERVICE( face,
|
||||||
FT_Service_MultiMasters, *aservice,
|
*aservice,
|
||||||
multi_masters,
|
MULTI_MASTERS );
|
||||||
FT_SERVICE_ID_MULTI_MASTERS );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -75,7 +74,7 @@
|
||||||
if ( service->get_mm )
|
if ( service->get_mm )
|
||||||
error = service->get_mm( face, amaster );
|
error = service->get_mm( face, amaster );
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
{
|
{
|
||||||
FT_Pointer result = NULL;
|
FT_Pointer result = NULL;
|
||||||
FT_ServiceDesc desc = service_descriptors;
|
FT_ServiceDesc desc = service_descriptors;
|
||||||
|
|
||||||
|
|
||||||
if ( desc && service_id )
|
if ( desc && service_id )
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_BASE_DEF( void )
|
FT_BASE_DEF( void )
|
||||||
|
@ -1188,7 +1188,7 @@
|
||||||
pfb_data[4] = 0;
|
pfb_data[4] = 0;
|
||||||
pfb_data[5] = 0;
|
pfb_data[5] = 0;
|
||||||
pfb_pos = 7;
|
pfb_pos = 7;
|
||||||
pfb_lenpos = 2;
|
pfb_lenpos = 2;
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
type = 1;
|
type = 1;
|
||||||
|
@ -1527,12 +1527,12 @@
|
||||||
|
|
||||||
#ifdef FT_MACINTOSH
|
#ifdef FT_MACINTOSH
|
||||||
/*
|
/*
|
||||||
I know this section is within code which is normally turned off
|
I know this section is within code which is normally turned off
|
||||||
for the Mac. It provides an alternative approach to reading the
|
for the Mac. It provides an alternative approach to reading the
|
||||||
mac resource forks on OS/X in the event that a user does not wish
|
mac resource forks on OS/X in the event that a user does not wish
|
||||||
to compile ftmac.c.
|
to compile ftmac.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format ||
|
if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format ||
|
||||||
FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) &&
|
FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) &&
|
||||||
( args->flags & FT_OPEN_PATHNAME ) )
|
( args->flags & FT_OPEN_PATHNAME ) )
|
||||||
|
@ -2399,33 +2399,9 @@
|
||||||
FT_Service_GlyphDict service;
|
FT_Service_GlyphDict service;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
FT_FACE_LOOKUP_SERVICE( face,
|
FT_FACE_LOOKUP_SERVICE( face,
|
||||||
FT_Service_GlyphDict, service,
|
service,
|
||||||
glyph_dict,
|
GLYPH_DICT );
|
||||||
FT_SERVICE_ID_GLYPH_DICT );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
service = (FT_Service_GlyphDict)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 = (FT_Service_GlyphDict)module->clazz->get_interface(
|
|
||||||
module, FT_SERVICE_ID_GLYPH_DICT );
|
|
||||||
|
|
||||||
face->internal->services.glyph_dict =
|
|
||||||
service != NULL ? (FT_Pointer)service
|
|
||||||
: FT_SERVICE_UNAVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* 1 */
|
|
||||||
|
|
||||||
if ( service && service->name_index )
|
if ( service && service->name_index )
|
||||||
result = service->name_index( face, glyph_name );
|
result = service->name_index( face, glyph_name );
|
||||||
|
@ -2458,9 +2434,8 @@
|
||||||
|
|
||||||
|
|
||||||
FT_FACE_LOOKUP_SERVICE( face,
|
FT_FACE_LOOKUP_SERVICE( face,
|
||||||
FT_Service_GlyphDict, service,
|
service,
|
||||||
glyph_dict,
|
GLYPH_DICT );
|
||||||
FT_SERVICE_ID_GLYPH_DICT );
|
|
||||||
|
|
||||||
if ( service && service->get_name )
|
if ( service && service->get_name )
|
||||||
error = service->get_name( face, glyph_index, buffer, buffer_max );
|
error = service->get_name( face, glyph_index, buffer, buffer_max );
|
||||||
|
@ -2487,9 +2462,8 @@
|
||||||
|
|
||||||
|
|
||||||
FT_FACE_LOOKUP_SERVICE( face,
|
FT_FACE_LOOKUP_SERVICE( face,
|
||||||
FT_Service_PsName, service,
|
service,
|
||||||
postscript_name,
|
POSTSCRIPT_NAME );
|
||||||
FT_SERVICE_ID_POSTSCRIPT_NAME );
|
|
||||||
|
|
||||||
if ( service && service->get_ps_name )
|
if ( service && service->get_ps_name )
|
||||||
result = service->get_ps_name( face );
|
result = service->get_ps_name( face );
|
||||||
|
@ -2512,13 +2486,13 @@
|
||||||
|
|
||||||
if ( face && FT_IS_SFNT( face ) )
|
if ( face && FT_IS_SFNT( face ) )
|
||||||
{
|
{
|
||||||
FT_FACE_FIND_SERVICE( FT_Service_SFNT_Table, service,
|
FT_FACE_FIND_SERVICE( service,
|
||||||
face,
|
face,
|
||||||
FT_SERVICE_ID_SFNT_TABLE );
|
SFNT_TABLE );
|
||||||
if ( service != NULL )
|
if ( service != NULL )
|
||||||
table = service->get_table( face, tag );
|
table = service->get_table( face, tag );
|
||||||
}
|
}
|
||||||
|
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2538,12 +2512,12 @@
|
||||||
if ( !face || !FT_IS_SFNT( face ) )
|
if ( !face || !FT_IS_SFNT( face ) )
|
||||||
return FT_Err_Invalid_Face_Handle;
|
return FT_Err_Invalid_Face_Handle;
|
||||||
|
|
||||||
FT_FACE_FIND_SERVICE( FT_Service_SFNT_Table, service,
|
FT_FACE_FIND_SERVICE( service,
|
||||||
face,
|
face,
|
||||||
FT_SERVICE_ID_SFNT_TABLE );
|
SFNT_TABLE );
|
||||||
if ( service == NULL )
|
if ( service == NULL )
|
||||||
return FT_Err_Unimplemented_Feature;
|
return FT_Err_Unimplemented_Feature;
|
||||||
|
|
||||||
return service->load_table( face, tag, offset, buffer, length );
|
return service->load_table( face, tag, offset, buffer, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
{
|
{
|
||||||
FT_Service_PfrMetrics service;
|
FT_Service_PfrMetrics service;
|
||||||
|
|
||||||
FT_FACE_LOOKUP_SERVICE( face, FT_Service_PfrMetrics, service,
|
FT_FACE_LOOKUP_SERVICE( face, service, PFR_METRICS );
|
||||||
pfr_metrics, FT_SERVICE_ID_PFR_METRICS );
|
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,40 +18,29 @@
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_WINFONTS_H
|
#include FT_WINFONTS_H
|
||||||
#include FT_INTERNAL_FNT_TYPES_H
|
|
||||||
#include FT_INTERNAL_OBJECTS_H
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
|
#include FT_SERVICE_WINFNT_H
|
||||||
|
|
||||||
|
|
||||||
FT_EXPORT_DEF( FT_Error )
|
FT_EXPORT_DEF( FT_Error )
|
||||||
FT_Get_WinFNT_Header( FT_Face face,
|
FT_Get_WinFNT_Header( FT_Face face,
|
||||||
FT_WinFNT_HeaderRec *header )
|
FT_WinFNT_HeaderRec *header )
|
||||||
{
|
{
|
||||||
FT_Error error;
|
FT_Service_WinFnt service;
|
||||||
|
FT_Error error;
|
||||||
|
|
||||||
error = FT_Err_Invalid_Argument;
|
error = FT_Err_Invalid_Argument;
|
||||||
|
|
||||||
if ( face != NULL && face->driver != NULL )
|
if ( face != NULL )
|
||||||
{
|
{
|
||||||
FT_Module driver = (FT_Module) face->driver;
|
FT_FACE_LOOKUP_SERVICE( face, service, WINFNT );
|
||||||
|
|
||||||
|
if ( service != NULL )
|
||||||
if ( driver->clazz && driver->clazz->module_name &&
|
|
||||||
ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 )
|
|
||||||
{
|
{
|
||||||
FNT_Face fnt_face = (FNT_Face)face;
|
error = service->get_header( face, header );
|
||||||
FNT_Font font = fnt_face->font;
|
|
||||||
|
|
||||||
|
|
||||||
if ( font )
|
|
||||||
{
|
|
||||||
FT_MEM_COPY( header, &font->header, sizeof ( *header ) );
|
|
||||||
error = FT_Err_Ok;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
|
@ -28,8 +28,9 @@
|
||||||
|
|
||||||
|
|
||||||
if ( face )
|
if ( face )
|
||||||
FT_FACE_FIND_SERVICE( const char*, result,
|
FT_FACE_FIND_SERVICE( result,
|
||||||
face, FT_SERVICE_ID_XF86_NAME );
|
face,
|
||||||
|
XF86_NAME );
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_INTERNAL_PFR_H
|
#include FT_SERVICE_PFR_H
|
||||||
|
#include FT_SERVICE_XFREE86_NAME_H
|
||||||
#include "pfrdrivr.h"
|
#include "pfrdrivr.h"
|
||||||
#include "pfrobjs.h"
|
#include "pfrobjs.h"
|
||||||
|
|
||||||
#include "pfrerror.h"
|
#include "pfrerror.h"
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
pfr_get_kerning( PFR_Face face,
|
pfr_get_kerning( PFR_Face face,
|
||||||
FT_UInt left,
|
FT_UInt left,
|
||||||
|
@ -52,6 +52,10 @@
|
||||||
return PFR_Err_Ok;
|
return PFR_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PFR METRICS SERVICE
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
pfr_get_advance( PFR_Face face,
|
pfr_get_advance( PFR_Face face,
|
||||||
|
@ -119,13 +123,35 @@
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_TABLE_DEF
|
FT_CALLBACK_TABLE_DEF
|
||||||
const FT_PFR_ServiceRec pfr_service_rec =
|
const FT_Service_PfrMetricsRec pfr_metrics_service_rec =
|
||||||
{
|
{
|
||||||
(FT_PFR_GetMetricsFunc) pfr_get_metrics,
|
(FT_PFR_GetMetricsFunc) pfr_get_metrics,
|
||||||
(FT_PFR_GetKerningFunc) pfr_get_kerning,
|
(FT_PFR_GetKerningFunc) pfr_face_get_kerning,
|
||||||
(FT_PFR_GetAdvanceFunc) pfr_get_advance
|
(FT_PFR_GetAdvanceFunc) pfr_get_advance
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SERVICE LIST
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const FT_ServiceDescRec pfr_services[] =
|
||||||
|
{
|
||||||
|
{ FT_SERVICE_ID_PFR_METRICS, & pfr_metrics_service_rec },
|
||||||
|
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PFR },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static FT_Module_Interface
|
||||||
|
pfr_get_service( FT_Driver driver,
|
||||||
|
const FT_String* service_id )
|
||||||
|
{
|
||||||
|
FT_UNUSED( driver );
|
||||||
|
|
||||||
|
return ft_service_list_lookup( pfr_services, service_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_TABLE_DEF
|
FT_CALLBACK_TABLE_DEF
|
||||||
const FT_Driver_ClassRec pfr_driver_class =
|
const FT_Driver_ClassRec pfr_driver_class =
|
||||||
|
@ -140,11 +166,11 @@
|
||||||
0x10000L,
|
0x10000L,
|
||||||
0x20000L,
|
0x20000L,
|
||||||
|
|
||||||
(FT_PFR_Service) &pfr_service_rec, /* format interface */
|
NULL,
|
||||||
|
|
||||||
(FT_Module_Constructor)NULL,
|
(FT_Module_Constructor)NULL,
|
||||||
(FT_Module_Destructor) NULL,
|
(FT_Module_Destructor) NULL,
|
||||||
(FT_Module_Requester) NULL
|
(FT_Module_Requester) pfr_get_service
|
||||||
},
|
},
|
||||||
|
|
||||||
sizeof( PFR_FaceRec ),
|
sizeof( PFR_FaceRec ),
|
||||||
|
|
|
@ -21,12 +21,11 @@
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_INTERNAL_OBJECTS_H
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
#include FT_INTERNAL_FNT_TYPES_H
|
|
||||||
|
|
||||||
#include "winfnt.h"
|
#include "winfnt.h"
|
||||||
|
|
||||||
#include "fnterrs.h"
|
#include "fnterrs.h"
|
||||||
|
#include FT_SERVICE_WINFNT_H
|
||||||
|
#include FT_SERVICE_XFREE86_NAME_H
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
@ -632,6 +631,47 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static FT_Error
|
||||||
|
winfnt_get_header( FT_Face face,
|
||||||
|
FT_WinFNT_HeaderRec *aheader )
|
||||||
|
{
|
||||||
|
FNT_Font font = ((FNT_Face)face)->font;
|
||||||
|
|
||||||
|
*aheader = font->header;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const FT_Service_WinFntRec winfnt_service_rec =
|
||||||
|
{
|
||||||
|
winfnt_get_header
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SERVICE LIST
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const FT_ServiceDescRec winfnt_services[] =
|
||||||
|
{
|
||||||
|
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_WINFNT },
|
||||||
|
{ FT_SERVICE_ID_WINFNT, & winfnt_service_rec },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static FT_Module_Interface
|
||||||
|
winfnt_get_service( FT_Driver driver,
|
||||||
|
const FT_String* service_id )
|
||||||
|
{
|
||||||
|
FT_UNUSED( driver );
|
||||||
|
|
||||||
|
return ft_service_list_lookup( winfnt_services, service_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_TABLE_DEF
|
FT_CALLBACK_TABLE_DEF
|
||||||
const FT_Driver_ClassRec winfnt_driver_class =
|
const FT_Driver_ClassRec winfnt_driver_class =
|
||||||
{
|
{
|
||||||
|
@ -648,7 +688,7 @@
|
||||||
|
|
||||||
(FT_Module_Constructor)0,
|
(FT_Module_Constructor)0,
|
||||||
(FT_Module_Destructor) 0,
|
(FT_Module_Destructor) 0,
|
||||||
(FT_Module_Requester) 0
|
(FT_Module_Requester) winfnt_get_service
|
||||||
},
|
},
|
||||||
|
|
||||||
sizeof( FNT_FaceRec ),
|
sizeof( FNT_FaceRec ),
|
||||||
|
|
|
@ -21,11 +21,78 @@
|
||||||
|
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
|
#include FT_WINFONTS_H
|
||||||
#include FT_INTERNAL_DRIVER_H
|
#include FT_INTERNAL_DRIVER_H
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
typedef struct WinMZ_HeaderRec_
|
||||||
|
{
|
||||||
|
FT_UShort magic;
|
||||||
|
/* skipped content */
|
||||||
|
FT_UShort lfanew;
|
||||||
|
|
||||||
|
} WinMZ_HeaderRec;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct WinNE_HeaderRec_
|
||||||
|
{
|
||||||
|
FT_UShort magic;
|
||||||
|
/* skipped content */
|
||||||
|
FT_UShort resource_tab_offset;
|
||||||
|
FT_UShort rname_tab_offset;
|
||||||
|
|
||||||
|
} WinNE_HeaderRec;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct WinNameInfoRec_
|
||||||
|
{
|
||||||
|
FT_UShort offset;
|
||||||
|
FT_UShort length;
|
||||||
|
FT_UShort flags;
|
||||||
|
FT_UShort id;
|
||||||
|
FT_UShort handle;
|
||||||
|
FT_UShort usage;
|
||||||
|
|
||||||
|
} WinNameInfoRec;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct WinResourceInfoRec_
|
||||||
|
{
|
||||||
|
FT_UShort type_id;
|
||||||
|
FT_UShort count;
|
||||||
|
|
||||||
|
} WinResourceInfoRec;
|
||||||
|
|
||||||
|
|
||||||
|
#define WINFNT_MZ_MAGIC 0x5A4D
|
||||||
|
#define WINFNT_NE_MAGIC 0x454E
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct FNT_FontRec_
|
||||||
|
{
|
||||||
|
FT_ULong offset;
|
||||||
|
FT_Int size_shift;
|
||||||
|
|
||||||
|
FT_WinFNT_HeaderRec header;
|
||||||
|
|
||||||
|
FT_Byte* fnt_frame;
|
||||||
|
FT_ULong fnt_size;
|
||||||
|
|
||||||
|
} FNT_FontRec, *FNT_Font;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct FNT_FaceRec_
|
||||||
|
{
|
||||||
|
FT_FaceRec root;
|
||||||
|
FNT_Font font;
|
||||||
|
|
||||||
|
FT_CharMap charmap_handle;
|
||||||
|
FT_CharMapRec charmap; /* a single charmap per face */
|
||||||
|
|
||||||
|
} FNT_FaceRec, *FNT_Face;
|
||||||
|
|
||||||
|
|
||||||
FT_EXPORT_VAR( const FT_Driver_ClassRec ) winfnt_driver_class;
|
FT_EXPORT_VAR( const FT_Driver_ClassRec ) winfnt_driver_class;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue