Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4348 → Rev 4349

/contrib/sdk/sources/freetype/include/freetype/internal/autohint.h
0,0 → 1,244
/***************************************************************************/
/* */
/* autohint.h */
/* */
/* High-level `autohint' module-specific interface (specification). */
/* */
/* Copyright 1996-2002, 2007, 2009, 2012 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. */
/* */
/***************************************************************************/
 
 
/*************************************************************************/
/* */
/* The auto-hinter is used to load and automatically hint glyphs if a */
/* format-specific hinter isn't available. */
/* */
/*************************************************************************/
 
 
#ifndef __AUTOHINT_H__
#define __AUTOHINT_H__
 
 
/*************************************************************************/
/* */
/* A small technical note regarding automatic hinting in order to */
/* clarify this module interface. */
/* */
/* An automatic hinter might compute two kinds of data for a given face: */
/* */
/* - global hints: Usually some metrics that describe global properties */
/* of the face. It is computed by scanning more or less */
/* aggressively the glyphs in the face, and thus can be */
/* very slow to compute (even if the size of global */
/* hints is really small). */
/* */
/* - glyph hints: These describe some important features of the glyph */
/* outline, as well as how to align them. They are */
/* generally much faster to compute than global hints. */
/* */
/* The current FreeType auto-hinter does a pretty good job while */
/* performing fast computations for both global and glyph hints. */
/* However, we might be interested in introducing more complex and */
/* powerful algorithms in the future, like the one described in the John */
/* D. Hobby paper, which unfortunately requires a lot more horsepower. */
/* */
/* Because a sufficiently sophisticated font management system would */
/* typically implement an LRU cache of opened face objects to reduce */
/* memory usage, it is a good idea to be able to avoid recomputing */
/* global hints every time the same face is re-opened. */
/* */
/* We thus provide the ability to cache global hints outside of the face */
/* object, in order to speed up font re-opening time. Of course, this */
/* feature is purely optional, so most client programs won't even notice */
/* it. */
/* */
/* I initially thought that it would be a good idea to cache the glyph */
/* hints too. However, my general idea now is that if you really need */
/* to cache these too, you are simply in need of a new font format, */
/* where all this information could be stored within the font file and */
/* decoded on the fly. */
/* */
/*************************************************************************/
 
 
#include <ft2build.h>
#include FT_FREETYPE_H
 
 
FT_BEGIN_HEADER
 
 
typedef struct FT_AutoHinterRec_ *FT_AutoHinter;
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_GlobalGetFunc */
/* */
/* <Description> */
/* Retrieve the global hints computed for a given face object. The */
/* resulting data is dissociated from the face and will survive a */
/* call to FT_Done_Face(). It must be discarded through the API */
/* FT_AutoHinter_GlobalDoneFunc(). */
/* */
/* <Input> */
/* hinter :: A handle to the source auto-hinter. */
/* */
/* face :: A handle to the source face object. */
/* */
/* <Output> */
/* global_hints :: A typeless pointer to the global hints. */
/* */
/* global_len :: The size in bytes of the global hints. */
/* */
typedef void
(*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,
FT_Face face,
void** global_hints,
long* global_len );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_GlobalDoneFunc */
/* */
/* <Description> */
/* Discard the global hints retrieved through */
/* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */
/* are freed from memory. */
/* */
/* <Input> */
/* hinter :: A handle to the auto-hinter module. */
/* */
/* global :: A pointer to retrieved global hints to discard. */
/* */
typedef void
(*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,
void* global );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_GlobalResetFunc */
/* */
/* <Description> */
/* This function is used to recompute the global metrics in a given */
/* font. This is useful when global font data changes (e.g. Multiple */
/* Masters fonts where blend coordinates change). */
/* */
/* <Input> */
/* hinter :: A handle to the source auto-hinter. */
/* */
/* face :: A handle to the face. */
/* */
typedef void
(*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,
FT_Face face );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_GlyphLoadFunc */
/* */
/* <Description> */
/* This function is used to load, scale, and automatically hint a */
/* glyph from a given face. */
/* */
/* <Input> */
/* face :: A handle to the face. */
/* */
/* glyph_index :: The glyph index. */
/* */
/* load_flags :: The load flags. */
/* */
/* <Note> */
/* This function is capable of loading composite glyphs by hinting */
/* each sub-glyph independently (which improves quality). */
/* */
/* It will call the font driver with @FT_Load_Glyph, with */
/* @FT_LOAD_NO_SCALE set. */
/* */
typedef FT_Error
(*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,
FT_GlyphSlot slot,
FT_Size size,
FT_UInt glyph_index,
FT_Int32 load_flags );
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_AutoHinter_InterfaceRec */
/* */
/* <Description> */
/* The auto-hinter module's interface. */
/* */
typedef struct FT_AutoHinter_InterfaceRec_
{
FT_AutoHinter_GlobalResetFunc reset_face;
FT_AutoHinter_GlobalGetFunc get_global_hints;
FT_AutoHinter_GlobalDoneFunc done_global_hints;
FT_AutoHinter_GlyphLoadFunc load_glyph;
 
} FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
class_, \
reset_face_, \
get_global_hints_, \
done_global_hints_, \
load_glyph_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_AutoHinter_InterfaceRec class_ = \
{ \
reset_face_, \
get_global_hints_, \
done_global_hints_, \
load_glyph_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
class_, \
reset_face_, \
get_global_hints_, \
done_global_hints_, \
load_glyph_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_AutoHinter_InterfaceRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->reset_face = reset_face_; \
clazz->get_global_hints = get_global_hints_; \
clazz->done_global_hints = done_global_hints_; \
clazz->load_glyph = load_glyph_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
FT_END_HEADER
 
#endif /* __AUTOHINT_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftcalc.h
0,0 → 1,167
/***************************************************************************/
/* */
/* ftcalc.h */
/* */
/* Arithmetic computations (specification). */
/* */
/* Copyright 1996-2006, 2008, 2009, 2012-2013 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 __FTCALC_H__
#define __FTCALC_H__
 
 
#include <ft2build.h>
#include FT_FREETYPE_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_FixedSqrt */
/* */
/* <Description> */
/* Computes the square root of a 16.16 fixed-point value. */
/* */
/* <Input> */
/* x :: The value to compute the root for. */
/* */
/* <Return> */
/* The result of `sqrt(x)'. */
/* */
/* <Note> */
/* This function is not very fast. */
/* */
FT_BASE( FT_Int32 )
FT_SqrtFixed( FT_Int32 x );
 
 
/*************************************************************************/
/* */
/* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
/* */
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_MulDiv_No_Round */
/* */
/* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */
/* (without rounding) with maximum accuracy (it uses a 64-bit */
/* intermediate integer whenever necessary). */
/* */
/* This function isn't necessarily as fast as some processor specific */
/* operations, but is at least completely portable. */
/* */
/* <Input> */
/* a :: The first multiplier. */
/* b :: The second multiplier. */
/* c :: The divisor. */
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
FT_BASE( FT_Long )
FT_MulDiv_No_Round( FT_Long a,
FT_Long b,
FT_Long c );
 
 
/*
* A variant of FT_Matrix_Multiply which scales its result afterwards.
* The idea is that both `a' and `b' are scaled by factors of 10 so that
* the values are as precise as possible to get a correct result during
* the 64bit multiplication. Let `sa' and `sb' be the scaling factors of
* `a' and `b', respectively, then the scaling factor of the result is
* `sa*sb'.
*/
FT_BASE( void )
FT_Matrix_Multiply_Scaled( const FT_Matrix* a,
FT_Matrix *b,
FT_Long scaling );
 
 
/*
* A variant of FT_Vector_Transform. See comments for
* FT_Matrix_Multiply_Scaled.
*/
FT_BASE( void )
FT_Vector_Transform_Scaled( FT_Vector* vector,
const FT_Matrix* matrix,
FT_Long scaling );
 
 
/*
* Return -1, 0, or +1, depending on the orientation of a given corner.
* We use the Cartesian coordinate system, with positive vertical values
* going upwards. The function returns +1 if the corner turns to the
* left, -1 to the right, and 0 for undecidable cases.
*/
FT_BASE( FT_Int )
ft_corner_orientation( FT_Pos in_x,
FT_Pos in_y,
FT_Pos out_x,
FT_Pos out_y );
 
/*
* Return TRUE if a corner is flat or nearly flat. This is equivalent to
* saying that the angle difference between the `in' and `out' vectors is
* very small.
*/
FT_BASE( FT_Int )
ft_corner_is_flat( FT_Pos in_x,
FT_Pos in_y,
FT_Pos out_x,
FT_Pos out_y );
 
 
/*
* Return the most significant bit index.
*/
FT_BASE( FT_Int )
FT_MSB( FT_UInt32 z );
 
 
/*
* Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses
* two fixed-point arguments instead.
*/
FT_BASE( FT_Fixed )
FT_Hypot( FT_Fixed x,
FT_Fixed y );
 
 
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )
 
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
: ( -( ( 32 - (x) ) & -64 ) ) )
 
 
FT_END_HEADER
 
#endif /* __FTCALC_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftdebug.h
0,0 → 1,255
/***************************************************************************/
/* */
/* ftdebug.h */
/* */
/* Debugging and logging component (specification). */
/* */
/* Copyright 1996-2002, 2004, 2006-2009, 2013 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. */
/* */
/* */
/* IMPORTANT: A description of FreeType's debugging support can be */
/* found in `docs/DEBUG.TXT'. Read it if you need to use or */
/* understand this code. */
/* */
/***************************************************************************/
 
 
#ifndef __FTDEBUG_H__
#define __FTDEBUG_H__
 
 
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_FREETYPE_H
 
 
FT_BEGIN_HEADER
 
 
/* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
/* is already defined; this simplifies the following #ifdefs */
/* */
#ifdef FT_DEBUG_LEVEL_TRACE
#undef FT_DEBUG_LEVEL_ERROR
#define FT_DEBUG_LEVEL_ERROR
#endif
 
 
/*************************************************************************/
/* */
/* Define the trace enums as well as the trace levels array when they */
/* are needed. */
/* */
/*************************************************************************/
 
#ifdef FT_DEBUG_LEVEL_TRACE
 
#define FT_TRACE_DEF( x ) trace_ ## x ,
 
/* defining the enumeration */
typedef enum FT_Trace_
{
#include FT_INTERNAL_TRACE_H
trace_count
 
} FT_Trace;
 
 
/* defining the array of trace levels, provided by `src/base/ftdebug.c' */
extern int ft_trace_levels[trace_count];
 
#undef FT_TRACE_DEF
 
#endif /* FT_DEBUG_LEVEL_TRACE */
 
 
/*************************************************************************/
/* */
/* Define the FT_TRACE macro */
/* */
/* IMPORTANT! */
/* */
/* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
/* value before using any TRACE macro. */
/* */
/*************************************************************************/
 
#ifdef FT_DEBUG_LEVEL_TRACE
 
#define FT_TRACE( level, varformat ) \
do \
{ \
if ( ft_trace_levels[FT_COMPONENT] >= level ) \
FT_Message varformat; \
} while ( 0 )
 
#else /* !FT_DEBUG_LEVEL_TRACE */
 
#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */
 
#endif /* !FT_DEBUG_LEVEL_TRACE */
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Trace_Get_Count */
/* */
/* <Description> */
/* Return the number of available trace components. */
/* */
/* <Return> */
/* The number of trace components. 0 if FreeType 2 is not built with */
/* FT_DEBUG_LEVEL_TRACE definition. */
/* */
/* <Note> */
/* This function may be useful if you want to access elements of */
/* the internal `ft_trace_levels' array by an index. */
/* */
FT_BASE( FT_Int )
FT_Trace_Get_Count( void );
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Trace_Get_Name */
/* */
/* <Description> */
/* Return the name of a trace component. */
/* */
/* <Input> */
/* The index of the trace component. */
/* */
/* <Return> */
/* The name of the trace component. This is a statically allocated */
/* C string, so do not free it after use. NULL if FreeType 2 is not */
/* built with FT_DEBUG_LEVEL_TRACE definition. */
/* */
/* <Note> */
/* Use @FT_Trace_Get_Count to get the number of available trace */
/* components. */
/* */
/* This function may be useful if you want to control FreeType 2's */
/* debug level in your application. */
/* */
FT_BASE( const char * )
FT_Trace_Get_Name( FT_Int idx );
 
 
/*************************************************************************/
/* */
/* You need two opening and closing parentheses! */
/* */
/* Example: FT_TRACE0(( "Value is %i", foo )) */
/* */
/* Output of the FT_TRACEX macros is sent to stderr. */
/* */
/*************************************************************************/
 
#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )
#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )
#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )
#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )
#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
 
 
/*************************************************************************/
/* */
/* Define the FT_ERROR macro. */
/* */
/* Output of this macro is sent to stderr. */
/* */
/*************************************************************************/
 
#ifdef FT_DEBUG_LEVEL_ERROR
 
#define FT_ERROR( varformat ) FT_Message varformat
 
#else /* !FT_DEBUG_LEVEL_ERROR */
 
#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */
 
#endif /* !FT_DEBUG_LEVEL_ERROR */
 
 
/*************************************************************************/
/* */
/* Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw' */
/* makes it possible to easily set a breakpoint at this function. */
/* */
/*************************************************************************/
 
#ifdef FT_DEBUG_LEVEL_ERROR
 
#define FT_ASSERT( condition ) \
do \
{ \
if ( !( condition ) ) \
FT_Panic( "assertion failed on line %d of file %s\n", \
__LINE__, __FILE__ ); \
} while ( 0 )
 
#define FT_THROW( e ) \
( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \
__LINE__, \
__FILE__ ) | \
FT_ERR_CAT( FT_ERR_PREFIX, e ) )
 
#else /* !FT_DEBUG_LEVEL_ERROR */
 
#define FT_ASSERT( condition ) do { } while ( 0 )
 
#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
 
#endif /* !FT_DEBUG_LEVEL_ERROR */
 
 
/*************************************************************************/
/* */
/* Define `FT_Message' and `FT_Panic' when needed. */
/* */
/*************************************************************************/
 
#ifdef FT_DEBUG_LEVEL_ERROR
 
#include "stdio.h" /* for vfprintf() */
 
/* print a message */
FT_BASE( void )
FT_Message( const char* fmt,
... );
 
/* print a message and exit */
FT_BASE( void )
FT_Panic( const char* fmt,
... );
 
/* report file name and line number of an error */
FT_BASE( int )
FT_Throw( FT_Error error,
int line,
const char* file );
 
#endif /* FT_DEBUG_LEVEL_ERROR */
 
 
FT_BASE( void )
ft_debug_init( void );
 
FT_END_HEADER
 
#endif /* __FTDEBUG_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftdriver.h
0,0 → 1,409
/***************************************************************************/
/* */
/* ftdriver.h */
/* */
/* FreeType font driver interface (specification). */
/* */
/* Copyright 1996-2003, 2006, 2008, 2011-2013 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 __FTDRIVER_H__
#define __FTDRIVER_H__
 
 
#include <ft2build.h>
#include FT_MODULE_H
 
 
FT_BEGIN_HEADER
 
 
typedef FT_Error
(*FT_Face_InitFunc)( FT_Stream stream,
FT_Face face,
FT_Int typeface_index,
FT_Int num_params,
FT_Parameter* parameters );
 
typedef void
(*FT_Face_DoneFunc)( FT_Face face );
 
 
typedef FT_Error
(*FT_Size_InitFunc)( FT_Size size );
 
typedef void
(*FT_Size_DoneFunc)( FT_Size size );
 
 
typedef FT_Error
(*FT_Slot_InitFunc)( FT_GlyphSlot slot );
 
typedef void
(*FT_Slot_DoneFunc)( FT_GlyphSlot slot );
 
 
typedef FT_Error
(*FT_Size_RequestFunc)( FT_Size size,
FT_Size_Request req );
 
typedef FT_Error
(*FT_Size_SelectFunc)( FT_Size size,
FT_ULong size_index );
 
typedef FT_Error
(*FT_Slot_LoadFunc)( FT_GlyphSlot slot,
FT_Size size,
FT_UInt glyph_index,
FT_Int32 load_flags );
 
 
typedef FT_UInt
(*FT_CharMap_CharIndexFunc)( FT_CharMap charmap,
FT_Long charcode );
 
typedef FT_Long
(*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
FT_Long charcode );
 
 
typedef FT_Error
(*FT_Face_GetKerningFunc)( FT_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning );
 
 
typedef FT_Error
(*FT_Face_AttachFunc)( FT_Face face,
FT_Stream stream );
 
 
typedef FT_Error
(*FT_Face_GetAdvancesFunc)( FT_Face face,
FT_UInt first,
FT_UInt count,
FT_Int32 flags,
FT_Fixed* advances );
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Driver_ClassRec */
/* */
/* <Description> */
/* The font driver class. This structure mostly contains pointers to */
/* driver methods. */
/* */
/* <Fields> */
/* root :: The parent module. */
/* */
/* face_object_size :: The size of a face object in bytes. */
/* */
/* size_object_size :: The size of a size object in bytes. */
/* */
/* slot_object_size :: The size of a glyph object in bytes. */
/* */
/* init_face :: The format-specific face constructor. */
/* */
/* done_face :: The format-specific face destructor. */
/* */
/* init_size :: The format-specific size constructor. */
/* */
/* done_size :: The format-specific size destructor. */
/* */
/* init_slot :: The format-specific slot constructor. */
/* */
/* done_slot :: The format-specific slot destructor. */
/* */
/* */
/* load_glyph :: A function handle to load a glyph to a slot. */
/* This field is mandatory! */
/* */
/* get_kerning :: A function handle to return the unscaled */
/* kerning for a given pair of glyphs. Can be */
/* set to 0 if the format doesn't support */
/* kerning. */
/* */
/* attach_file :: This function handle is used to read */
/* additional data for a face from another */
/* file/stream. For example, this can be used to */
/* add data from AFM or PFM files on a Type 1 */
/* face, or a CIDMap on a CID-keyed face. */
/* */
/* get_advances :: A function handle used to return advance */
/* widths of `count' glyphs (in font units), */
/* starting at `first'. The `vertical' flag must */
/* be set to get vertical advance heights. The */
/* `advances' buffer is caller-allocated. */
/* The idea of this function is to be able to */
/* perform device-independent text layout without */
/* loading a single glyph image. */
/* */
/* request_size :: A handle to a function used to request the new */
/* character size. Can be set to 0 if the */
/* scaling done in the base layer suffices. */
/* */
/* select_size :: A handle to a function used to select a new */
/* fixed size. It is used only if */
/* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */
/* to 0 if the scaling done in the base layer */
/* suffices. */
/* <Note> */
/* Most function pointers, with the exception of `load_glyph', can be */
/* set to 0 to indicate a default behaviour. */
/* */
typedef struct FT_Driver_ClassRec_
{
FT_Module_Class root;
 
FT_Long face_object_size;
FT_Long size_object_size;
FT_Long slot_object_size;
 
FT_Face_InitFunc init_face;
FT_Face_DoneFunc done_face;
 
FT_Size_InitFunc init_size;
FT_Size_DoneFunc done_size;
 
FT_Slot_InitFunc init_slot;
FT_Slot_DoneFunc done_slot;
 
FT_Slot_LoadFunc load_glyph;
 
FT_Face_GetKerningFunc get_kerning;
FT_Face_AttachFunc attach_file;
FT_Face_GetAdvancesFunc get_advances;
 
/* since version 2.2 */
FT_Size_RequestFunc request_size;
FT_Size_SelectFunc select_size;
 
} FT_Driver_ClassRec, *FT_Driver_Class;
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DECLARE_DRIVER */
/* */
/* <Description> */
/* Used to create a forward declaration of an FT_Driver_ClassRec */
/* struct instance. */
/* */
/* <Macro> */
/* FT_DEFINE_DRIVER */
/* */
/* <Description> */
/* Used to initialize an instance of FT_Driver_ClassRec struct. */
/* */
/* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */
/* called with a pointer where the allocated structure is returned. */
/* And when it is no longer needed a `destroy' function needs to be */
/* called to release that allocation. */
/* */
/* `fcinit.c' (ft_create_default_module_classes) already contains a */
/* mechanism to call these functions for the default modules */
/* described in `ftmodule.h'. */
/* */
/* Notice that the created `create' and `destroy' functions call */
/* `pic_init' and `pic_free' to allow you to manually allocate and */
/* initialize any additional global data, like a module specific */
/* interface, and put them in the global pic container defined in */
/* `ftpic.h'. If you don't need them just implement the functions as */
/* empty to resolve the link error. Also the `pic_init' and */
/* `pic_free' functions should be declared in `pic.h', to be referred */
/* by driver definition calling `FT_DEFINE_DRIVER' in following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro is */
/* used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DECLARE_DRIVER( class_ ) \
FT_CALLBACK_TABLE \
const FT_Driver_ClassRec class_;
 
#define FT_DEFINE_DRIVER( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_, \
face_object_size_, \
size_object_size_, \
slot_object_size_, \
init_face_, \
done_face_, \
init_size_, \
done_size_, \
init_slot_, \
done_slot_, \
load_glyph_, \
get_kerning_, \
attach_file_, \
get_advances_, \
request_size_, \
select_size_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_Driver_ClassRec class_ = \
{ \
FT_DEFINE_ROOT_MODULE( flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
\
face_object_size_, \
size_object_size_, \
slot_object_size_, \
\
init_face_, \
done_face_, \
\
init_size_, \
done_size_, \
\
init_slot_, \
done_slot_, \
\
load_glyph_, \
\
get_kerning_, \
attach_file_, \
get_advances_, \
\
request_size_, \
select_size_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ )
 
#define FT_DEFINE_DRIVER( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_, \
face_object_size_, \
size_object_size_, \
slot_object_size_, \
init_face_, \
done_face_, \
init_size_, \
done_size_, \
init_slot_, \
done_slot_, \
load_glyph_, \
get_kerning_, \
attach_file_, \
get_advances_, \
request_size_, \
select_size_ ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_Module_Class* clazz ) \
{ \
FT_Memory memory = library->memory; \
FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \
\
\
class_ ## _pic_free( library ); \
if ( dclazz ) \
FT_FREE( dclazz ); \
} \
\
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_Module_Class** output_class ) \
{ \
FT_Driver_Class clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
return error; \
\
error = class_ ## _pic_init( library ); \
if ( error ) \
{ \
FT_FREE( clazz ); \
return error; \
} \
\
FT_DEFINE_ROOT_MODULE( flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
\
clazz->face_object_size = face_object_size_; \
clazz->size_object_size = size_object_size_; \
clazz->slot_object_size = slot_object_size_; \
\
clazz->init_face = init_face_; \
clazz->done_face = done_face_; \
\
clazz->init_size = init_size_; \
clazz->done_size = done_size_; \
\
clazz->init_slot = init_slot_; \
clazz->done_slot = done_slot_; \
\
clazz->load_glyph = load_glyph_; \
\
clazz->get_kerning = get_kerning_; \
clazz->attach_file = attach_file_; \
clazz->get_advances = get_advances_; \
\
clazz->request_size = request_size_; \
clazz->select_size = select_size_; \
\
*output_class = (FT_Module_Class*)clazz; \
\
return FT_Err_Ok; \
}
 
 
#endif /* FT_CONFIG_OPTION_PIC */
 
FT_END_HEADER
 
#endif /* __FTDRIVER_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftgloadr.h
0,0 → 1,168
/***************************************************************************/
/* */
/* ftgloadr.h */
/* */
/* The FreeType glyph loader (specification). */
/* */
/* Copyright 2002, 2003, 2005, 2006 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 __FTGLOADR_H__
#define __FTGLOADR_H__
 
 
#include <ft2build.h>
#include FT_FREETYPE_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_GlyphLoader */
/* */
/* <Description> */
/* The glyph loader is an internal object used to load several glyphs */
/* together (for example, in the case of composites). */
/* */
/* <Note> */
/* The glyph loader implementation is not part of the high-level API, */
/* hence the forward structure declaration. */
/* */
typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ;
 
 
#if 0 /* moved to freetype.h in version 2.2 */
#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
#define FT_SUBGLYPH_FLAG_SCALE 8
#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
#define FT_SUBGLYPH_FLAG_2X2 0x80
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
#endif
 
 
typedef struct FT_SubGlyphRec_
{
FT_Int index;
FT_UShort flags;
FT_Int arg1;
FT_Int arg2;
FT_Matrix transform;
 
} FT_SubGlyphRec;
 
 
typedef struct FT_GlyphLoadRec_
{
FT_Outline outline; /* outline */
FT_Vector* extra_points; /* extra points table */
FT_Vector* extra_points2; /* second extra points table */
FT_UInt num_subglyphs; /* number of subglyphs */
FT_SubGlyph subglyphs; /* subglyphs */
 
} FT_GlyphLoadRec, *FT_GlyphLoad;
 
 
typedef struct FT_GlyphLoaderRec_
{
FT_Memory memory;
FT_UInt max_points;
FT_UInt max_contours;
FT_UInt max_subglyphs;
FT_Bool use_extra;
 
FT_GlyphLoadRec base;
FT_GlyphLoadRec current;
 
void* other; /* for possible future extension? */
 
} FT_GlyphLoaderRec;
 
 
/* create new empty glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_New( FT_Memory memory,
FT_GlyphLoader *aloader );
 
/* add an extra points table to a glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );
 
/* destroy a glyph loader */
FT_BASE( void )
FT_GlyphLoader_Done( FT_GlyphLoader loader );
 
/* reset a glyph loader (frees everything int it) */
FT_BASE( void )
FT_GlyphLoader_Reset( FT_GlyphLoader loader );
 
/* rewind a glyph loader */
FT_BASE( void )
FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
 
/* check that there is enough space to add `n_points' and `n_contours' */
/* to the glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
FT_UInt n_points,
FT_UInt n_contours );
 
 
#define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \
( (_count) == 0 || ((_loader)->base.outline.n_points + \
(_loader)->current.outline.n_points + \
(unsigned long)(_count)) <= (_loader)->max_points )
 
#define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \
( (_count) == 0 || ((_loader)->base.outline.n_contours + \
(_loader)->current.outline.n_contours + \
(unsigned long)(_count)) <= (_loader)->max_contours )
 
#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours ) \
( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \
FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \
? 0 \
: FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )
 
 
/* check that there is enough space to add `n_subs' sub-glyphs to */
/* a glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
FT_UInt n_subs );
 
/* prepare a glyph loader, i.e. empty the current glyph */
FT_BASE( void )
FT_GlyphLoader_Prepare( FT_GlyphLoader loader );
 
/* add the current glyph to the base glyph */
FT_BASE( void )
FT_GlyphLoader_Add( FT_GlyphLoader loader );
 
/* copy points from one glyph loader to another */
FT_BASE( FT_Error )
FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
FT_GlyphLoader source );
 
/* */
 
 
FT_END_HEADER
 
#endif /* __FTGLOADR_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftmemory.h
0,0 → 1,378
/***************************************************************************/
/* */
/* ftmemory.h */
/* */
/* The FreeType memory management macros (specification). */
/* */
/* Copyright 1996-2002, 2004-2007, 2010, 2013 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 __FTMEMORY_H__
#define __FTMEMORY_H__
 
 
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_TYPES_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_SET_ERROR */
/* */
/* <Description> */
/* This macro is used to set an implicit `error' variable to a given */
/* expression's value (usually a function call), and convert it to a */
/* boolean which is set whenever the value is != 0. */
/* */
#undef FT_SET_ERROR
#define FT_SET_ERROR( expression ) \
( ( error = (expression) ) != 0 )
 
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** M E M O R Y ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*
* C++ refuses to handle statements like p = (void*)anything, with `p' a
* typed pointer. Since we don't have a `typeof' operator in standard
* C++, we have to use a template to emulate it.
*/
 
#ifdef __cplusplus
 
extern "C++"
template <typename T> inline T*
cplusplus_typeof( T*,
void *v )
{
return static_cast <T*> ( v );
}
 
#define FT_ASSIGNP( p, val ) (p) = cplusplus_typeof( (p), (val) )
 
#else
 
#define FT_ASSIGNP( p, val ) (p) = (val)
 
#endif
 
 
 
#ifdef FT_DEBUG_MEMORY
 
FT_BASE( const char* ) _ft_debug_file;
FT_BASE( long ) _ft_debug_lineno;
 
#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \
_ft_debug_lineno = __LINE__, \
(exp) )
 
#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \
_ft_debug_lineno = __LINE__, \
FT_ASSIGNP( p, exp ) )
 
#else /* !FT_DEBUG_MEMORY */
 
#define FT_DEBUG_INNER( exp ) (exp)
#define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp )
 
#endif /* !FT_DEBUG_MEMORY */
 
 
/*
* The allocation functions return a pointer, and the error code
* is written to through the `p_error' parameter. See below for
* for documentation.
*/
 
FT_BASE( FT_Pointer )
ft_mem_alloc( FT_Memory memory,
FT_Long size,
FT_Error *p_error );
 
FT_BASE( FT_Pointer )
ft_mem_qalloc( FT_Memory memory,
FT_Long size,
FT_Error *p_error );
 
FT_BASE( FT_Pointer )
ft_mem_realloc( FT_Memory memory,
FT_Long item_size,
FT_Long cur_count,
FT_Long new_count,
void* block,
FT_Error *p_error );
 
FT_BASE( FT_Pointer )
ft_mem_qrealloc( FT_Memory memory,
FT_Long item_size,
FT_Long cur_count,
FT_Long new_count,
void* block,
FT_Error *p_error );
 
FT_BASE( void )
ft_mem_free( FT_Memory memory,
const void* P );
 
 
#define FT_MEM_ALLOC( ptr, size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \
(FT_Long)(size), \
&error ) )
 
#define FT_MEM_FREE( ptr ) \
FT_BEGIN_STMNT \
ft_mem_free( memory, (ptr) ); \
(ptr) = NULL; \
FT_END_STMNT
 
#define FT_MEM_NEW( ptr ) \
FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
 
#define FT_MEM_REALLOC( ptr, cursz, newsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
1, \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
 
#define FT_MEM_QALLOC( ptr, size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \
(FT_Long)(size), \
&error ) )
 
#define FT_MEM_QNEW( ptr ) \
FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
 
#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
1, \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
 
#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
(FT_Long)(item_size), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
 
#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
(FT_Long)(itmsz), \
(FT_Long)(oldcnt), \
(FT_Long)(newcnt), \
(ptr), \
&error ) )
 
#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
(FT_Long)(item_size), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
 
#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
(FT_Long)(itmsz), \
(FT_Long)(oldcnt), \
(FT_Long)(newcnt), \
(ptr), \
&error ) )
 
 
#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
 
 
#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count )
 
#define FT_MEM_COPY( dest, source, count ) ft_memcpy( dest, source, count )
 
#define FT_MEM_MOVE( dest, source, count ) ft_memmove( dest, source, count )
 
 
#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
 
#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
 
 
#define FT_ARRAY_ZERO( dest, count ) \
FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) )
 
#define FT_ARRAY_COPY( dest, source, count ) \
FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) )
 
#define FT_ARRAY_MOVE( dest, source, count ) \
FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )
 
 
/*
* Return the maximum number of addressable elements in an array.
* We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid
* any problems.
*/
#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) )
 
#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) )
 
 
/*************************************************************************/
/* */
/* The following functions macros expect that their pointer argument is */
/* _typed_ in order to automatically compute array element sizes. */
/* */
 
#define FT_MEM_NEW_ARRAY( ptr, count ) \
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
sizeof ( *(ptr) ), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
 
#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
sizeof ( *(ptr) ), \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
 
#define FT_MEM_QNEW_ARRAY( ptr, count ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
sizeof ( *(ptr) ), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
 
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
sizeof ( *(ptr) ), \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
 
#define FT_ALLOC( ptr, size ) \
FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
 
#define FT_REALLOC( ptr, cursz, newsz ) \
FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )
 
#define FT_ALLOC_MULT( ptr, count, item_size ) \
FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )
 
#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \
newcnt, itmsz ) )
 
#define FT_QALLOC( ptr, size ) \
FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )
 
#define FT_QREALLOC( ptr, cursz, newsz ) \
FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )
 
#define FT_QALLOC_MULT( ptr, count, item_size ) \
FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )
 
#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \
newcnt, itmsz ) )
 
#define FT_FREE( ptr ) FT_MEM_FREE( ptr )
 
#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )
 
#define FT_NEW_ARRAY( ptr, count ) \
FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
 
#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \
FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
 
#define FT_QNEW( ptr ) \
FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )
 
#define FT_QNEW_ARRAY( ptr, count ) \
FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
 
#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \
FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
 
 
FT_BASE( FT_Pointer )
ft_mem_strdup( FT_Memory memory,
const char* str,
FT_Error *p_error );
 
FT_BASE( FT_Pointer )
ft_mem_dup( FT_Memory memory,
const void* address,
FT_ULong size,
FT_Error *p_error );
 
 
#define FT_MEM_STRDUP( dst, str ) \
(dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
 
#define FT_STRDUP( dst, str ) \
FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
 
#define FT_MEM_DUP( dst, address, size ) \
(dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
 
#define FT_DUP( dst, address, size ) \
FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
 
 
/* Return >= 1 if a truncation occurs. */
/* Return 0 if the source string fits the buffer. */
/* This is *not* the same as strlcpy(). */
FT_BASE( FT_Int )
ft_mem_strcpyn( char* dst,
const char* src,
FT_ULong size );
 
#define FT_STRCPYN( dst, src, size ) \
ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
 
/* */
 
 
FT_END_HEADER
 
#endif /* __FTMEMORY_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftobjs.h
0,0 → 1,1569
/***************************************************************************/
/* */
/* ftobjs.h */
/* */
/* The FreeType private base classes (specification). */
/* */
/* Copyright 1996-2006, 2008, 2010, 2012-2013 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. */
/* */
/***************************************************************************/
 
 
/*************************************************************************/
/* */
/* This file contains the definition of all internal FreeType classes. */
/* */
/*************************************************************************/
 
 
#ifndef __FTOBJS_H__
#define __FTOBJS_H__
 
#include <ft2build.h>
#include FT_RENDER_H
#include FT_SIZES_H
#include FT_LCD_FILTER_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_GLYPH_LOADER_H
#include FT_INTERNAL_DRIVER_H
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_SERVICE_H
#include FT_INTERNAL_PIC_H
 
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
#endif
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/* */
/* Some generic definitions. */
/* */
#ifndef TRUE
#define TRUE 1
#endif
 
#ifndef FALSE
#define FALSE 0
#endif
 
#ifndef NULL
#define NULL (void*)0
#endif
 
 
/*************************************************************************/
/* */
/* The min and max functions missing in C. As usual, be careful not to */
/* write things like FT_MIN( a++, b++ ) to avoid side effects. */
/* */
#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
 
#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
 
 
#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) )
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
 
#define FT_PIX_FLOOR( x ) ( (x) & ~63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
 
 
/*
* Return the highest power of 2 that is <= value; this correspond to
* the highest bit in a given 32-bit value.
*/
FT_BASE( FT_UInt32 )
ft_highpow2( FT_UInt32 value );
 
 
/*
* character classification functions -- since these are used to parse
* font files, we must not use those in <ctypes.h> which are
* locale-dependent
*/
#define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )
 
#define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \
( (unsigned)(x) - 'a' ) < 6U || \
( (unsigned)(x) - 'A' ) < 6U )
 
/* the next two macros assume ASCII representation */
#define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )
#define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )
 
#define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )
#define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** C H A R M A P S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
/* handle to internal charmap object */
typedef struct FT_CMapRec_* FT_CMap;
 
/* handle to charmap class structure */
typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
 
/* internal charmap object structure */
typedef struct FT_CMapRec_
{
FT_CharMapRec charmap;
FT_CMap_Class clazz;
 
} FT_CMapRec;
 
/* typecase any pointer to a charmap handle */
#define FT_CMAP( x ) ((FT_CMap)( x ))
 
/* obvious macros */
#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
 
 
/* class method definitions */
typedef FT_Error
(*FT_CMap_InitFunc)( FT_CMap cmap,
FT_Pointer init_data );
 
typedef void
(*FT_CMap_DoneFunc)( FT_CMap cmap );
 
typedef FT_UInt
(*FT_CMap_CharIndexFunc)( FT_CMap cmap,
FT_UInt32 char_code );
 
typedef FT_UInt
(*FT_CMap_CharNextFunc)( FT_CMap cmap,
FT_UInt32 *achar_code );
 
typedef FT_UInt
(*FT_CMap_CharVarIndexFunc)( FT_CMap cmap,
FT_CMap unicode_cmap,
FT_UInt32 char_code,
FT_UInt32 variant_selector );
 
typedef FT_Bool
(*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap,
FT_UInt32 char_code,
FT_UInt32 variant_selector );
 
typedef FT_UInt32 *
(*FT_CMap_VariantListFunc)( FT_CMap cmap,
FT_Memory mem );
 
typedef FT_UInt32 *
(*FT_CMap_CharVariantListFunc)( FT_CMap cmap,
FT_Memory mem,
FT_UInt32 char_code );
 
typedef FT_UInt32 *
(*FT_CMap_VariantCharListFunc)( FT_CMap cmap,
FT_Memory mem,
FT_UInt32 variant_selector );
 
 
typedef struct FT_CMap_ClassRec_
{
FT_ULong size;
FT_CMap_InitFunc init;
FT_CMap_DoneFunc done;
FT_CMap_CharIndexFunc char_index;
FT_CMap_CharNextFunc char_next;
 
/* Subsequent entries are special ones for format 14 -- the variant */
/* selector subtable which behaves like no other */
 
FT_CMap_CharVarIndexFunc char_var_index;
FT_CMap_CharVarIsDefaultFunc char_var_default;
FT_CMap_VariantListFunc variant_list;
FT_CMap_CharVariantListFunc charvariant_list;
FT_CMap_VariantCharListFunc variantchar_list;
 
} FT_CMap_ClassRec;
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DECLARE_CMAP_CLASS( class_ ) \
FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
 
#define FT_DEFINE_CMAP_CLASS( \
class_, \
size_, \
init_, \
done_, \
char_index_, \
char_next_, \
char_var_index_, \
char_var_default_, \
variant_list_, \
charvariant_list_, \
variantchar_list_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_CMap_ClassRec class_ = \
{ \
size_, \
init_, \
done_, \
char_index_, \
char_next_, \
char_var_index_, \
char_var_default_, \
variant_list_, \
charvariant_list_, \
variantchar_list_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DECLARE_CMAP_CLASS( class_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_CMap_ClassRec* clazz );
 
#define FT_DEFINE_CMAP_CLASS( \
class_, \
size_, \
init_, \
done_, \
char_index_, \
char_next_, \
char_var_index_, \
char_var_default_, \
variant_list_, \
charvariant_list_, \
variantchar_list_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_CMap_ClassRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->size = size_; \
clazz->init = init_; \
clazz->done = done_; \
clazz->char_index = char_index_; \
clazz->char_next = char_next_; \
clazz->char_var_index = char_var_index_; \
clazz->char_var_default = char_var_default_; \
clazz->variant_list = variant_list_; \
clazz->charvariant_list = charvariant_list_; \
clazz->variantchar_list = variantchar_list_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
/* create a new charmap and add it to charmap->face */
FT_BASE( FT_Error )
FT_CMap_New( FT_CMap_Class clazz,
FT_Pointer init_data,
FT_CharMap charmap,
FT_CMap *acmap );
 
/* destroy a charmap and remove it from face's list */
FT_BASE( void )
FT_CMap_Done( FT_CMap cmap );
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Face_InternalRec */
/* */
/* <Description> */
/* This structure contains the internal fields of each FT_Face */
/* object. These fields may change between different releases of */
/* FreeType. */
/* */
/* <Fields> */
/* max_points :: */
/* The maximum number of points used to store the vectorial outline */
/* of any glyph in this face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this should be set to 0. */
/* Only relevant for scalable formats. */
/* */
/* max_contours :: */
/* The maximum number of contours used to store the vectorial */
/* outline of any glyph in this face. If this value cannot be */
/* known in advance, or if the face isn't scalable, this should be */
/* set to 0. Only relevant for scalable formats. */
/* */
/* transform_matrix :: */
/* A 2x2 matrix of 16.16 coefficients used to transform glyph */
/* outlines after they are loaded from the font. Only used by the */
/* convenience functions. */
/* */
/* transform_delta :: */
/* A translation vector used to transform glyph outlines after they */
/* are loaded from the font. Only used by the convenience */
/* functions. */
/* */
/* transform_flags :: */
/* Some flags used to classify the transform. Only used by the */
/* convenience functions. */
/* */
/* services :: */
/* A cache for frequently used services. It should be only */
/* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */
/* */
/* incremental_interface :: */
/* If non-null, the interface through which glyph data and metrics */
/* are loaded incrementally for faces that do not provide all of */
/* this data when first opened. This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
/* ignore_unpatented_hinter :: */
/* This boolean flag instructs the glyph loader to ignore the */
/* native font hinter, if one is found. This is exclusively used */
/* in the case when the unpatented hinter is compiled within the */
/* library. */
/* */
/* refcount :: */
/* A counter initialized to~1 at the time an @FT_Face structure is */
/* created. @FT_Reference_Face increments this counter, and */
/* @FT_Done_Face only destroys a face if the counter is~1, */
/* otherwise it simply decrements it. */
/* */
typedef struct FT_Face_InternalRec_
{
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
 
FT_ServiceCacheRec services;
 
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec* incremental_interface;
#endif
 
FT_Bool ignore_unpatented_hinter;
FT_Int refcount;
 
} FT_Face_InternalRec;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Slot_InternalRec */
/* */
/* <Description> */
/* This structure contains the internal fields of each FT_GlyphSlot */
/* object. These fields may change between different releases of */
/* FreeType. */
/* */
/* <Fields> */
/* loader :: The glyph loader object used to load outlines */
/* into the glyph slot. */
/* */
/* flags :: Possible values are zero or */
/* FT_GLYPH_OWN_BITMAP. The latter indicates */
/* that the FT_GlyphSlot structure owns the */
/* bitmap buffer. */
/* */
/* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */
/* must be transformed through a specific */
/* font transformation. This is _not_ the same */
/* as the face transform set through */
/* FT_Set_Transform(). */
/* */
/* glyph_matrix :: The 2x2 matrix corresponding to the glyph */
/* transformation, if necessary. */
/* */
/* glyph_delta :: The 2d translation vector corresponding to */
/* the glyph transformation, if necessary. */
/* */
/* glyph_hints :: Format-specific glyph hints management. */
/* */
 
#define FT_GLYPH_OWN_BITMAP 0x1
 
typedef struct FT_Slot_InternalRec_
{
FT_GlyphLoader loader;
FT_UInt flags;
FT_Bool glyph_transformed;
FT_Matrix glyph_matrix;
FT_Vector glyph_delta;
void* glyph_hints;
 
} FT_GlyphSlot_InternalRec;
 
 
#if 0
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Size_InternalRec */
/* */
/* <Description> */
/* This structure contains the internal fields of each FT_Size */
/* object. Currently, it's empty. */
/* */
/*************************************************************************/
 
typedef struct FT_Size_InternalRec_
{
/* empty */
 
} FT_Size_InternalRec;
 
#endif
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** M O D U L E S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_ModuleRec */
/* */
/* <Description> */
/* A module object instance. */
/* */
/* <Fields> */
/* clazz :: A pointer to the module's class. */
/* */
/* library :: A handle to the parent library object. */
/* */
/* memory :: A handle to the memory manager. */
/* */
typedef struct FT_ModuleRec_
{
FT_Module_Class* clazz;
FT_Library library;
FT_Memory memory;
 
} FT_ModuleRec;
 
 
/* typecast an object to an FT_Module */
#define FT_MODULE( x ) ((FT_Module)( x ))
#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
 
 
#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_FONT_DRIVER )
 
#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_RENDERER )
 
#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_HINTER )
 
#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_STYLER )
 
#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_DRIVER_SCALABLE )
 
#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_DRIVER_NO_OUTLINES )
 
#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
FT_MODULE_DRIVER_HAS_HINTER )
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Module_Interface */
/* */
/* <Description> */
/* Finds a module and returns its specific interface as a typeless */
/* pointer. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
/* */
/* module_name :: The module's name (as an ASCII string). */
/* */
/* <Return> */
/* A module-specific interface if available, 0 otherwise. */
/* */
/* <Note> */
/* You should better be familiar with FreeType internals to know */
/* which module to look for, and what its interface is :-) */
/* */
FT_BASE( const void* )
FT_Get_Module_Interface( FT_Library library,
const char* mod_name );
 
FT_BASE( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id );
 
/* */
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
/* a few macros used to perform easy typecasts with minimal brain damage */
 
#define FT_FACE( x ) ((FT_Face)(x))
#define FT_SIZE( x ) ((FT_Size)(x))
#define FT_SLOT( x ) ((FT_GlyphSlot)(x))
 
#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
#define FT_FACE_STREAM( x ) FT_FACE( x )->stream
 
#define FT_SIZE_FACE( x ) FT_SIZE( x )->face
#define FT_SLOT_FACE( x ) FT_SLOT( x )->face
 
#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
#define FT_FACE_SIZE( x ) FT_FACE( x )->size
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_GlyphSlot */
/* */
/* <Description> */
/* It is sometimes useful to have more than one glyph slot for a */
/* given face object. This function is used to create additional */
/* slots. All of them are automatically discarded when the face is */
/* destroyed. */
/* */
/* <Input> */
/* face :: A handle to a parent face object. */
/* */
/* <Output> */
/* aslot :: A handle to a new glyph slot object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_BASE( FT_Error )
FT_New_GlyphSlot( FT_Face face,
FT_GlyphSlot *aslot );
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_GlyphSlot */
/* */
/* <Description> */
/* Destroys a given glyph slot. Remember however that all slots are */
/* automatically destroyed with its parent. Using this function is */
/* not always mandatory. */
/* */
/* <Input> */
/* slot :: A handle to a target glyph slot. */
/* */
FT_BASE( void )
FT_Done_GlyphSlot( FT_GlyphSlot slot );
 
/* */
 
#define FT_REQUEST_WIDTH( req ) \
( (req)->horiResolution \
? (FT_Pos)( (req)->width * (req)->horiResolution + 36 ) / 72 \
: (req)->width )
 
#define FT_REQUEST_HEIGHT( req ) \
( (req)->vertResolution \
? (FT_Pos)( (req)->height * (req)->vertResolution + 36 ) / 72 \
: (req)->height )
 
 
/* Set the metrics according to a bitmap strike. */
FT_BASE( void )
FT_Select_Metrics( FT_Face face,
FT_ULong strike_index );
 
 
/* Set the metrics according to a size request. */
FT_BASE( void )
FT_Request_Metrics( FT_Face face,
FT_Size_Request req );
 
 
/* Match a size request against `available_sizes'. */
FT_BASE( FT_Error )
FT_Match_Size( FT_Face face,
FT_Size_Request req,
FT_Bool ignore_width,
FT_ULong* size_index );
 
 
/* Use the horizontal metrics to synthesize the vertical metrics. */
/* If `advance' is zero, it is also synthesized. */
FT_BASE( void )
ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,
FT_Pos advance );
 
 
/* Free the bitmap of a given glyphslot when needed (i.e., only when it */
/* was allocated with ft_glyphslot_alloc_bitmap). */
FT_BASE( void )
ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
 
 
/* Allocate a new bitmap buffer in a glyph slot. */
FT_BASE( FT_Error )
ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
FT_ULong size );
 
 
/* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */
/* will not be freed by a later call to ft_glyphslot_free_bitmap. */
FT_BASE( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Byte* buffer );
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** R E N D E R E R S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
#define FT_RENDERER( x ) ((FT_Renderer)( x ))
#define FT_GLYPH( x ) ((FT_Glyph)( x ))
#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x ))
#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
 
 
typedef struct FT_RendererRec_
{
FT_ModuleRec root;
FT_Renderer_Class* clazz;
FT_Glyph_Format glyph_format;
FT_Glyph_Class glyph_class;
 
FT_Raster raster;
FT_Raster_Render_Func raster_render;
FT_Renderer_RenderFunc render;
 
} FT_RendererRec;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** F O N T D R I V E R S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/* typecast a module into a driver easily */
#define FT_DRIVER( x ) ((FT_Driver)(x))
 
/* typecast a module as a driver, and get its driver class */
#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_DriverRec */
/* */
/* <Description> */
/* The root font driver class. A font driver is responsible for */
/* managing and loading font files of a given format. */
/* */
/* <Fields> */
/* root :: Contains the fields of the root module class. */
/* */
/* clazz :: A pointer to the font driver's class. Note that */
/* this is NOT root.clazz. `class' wasn't used */
/* as it is a reserved word in C++. */
/* */
/* faces_list :: The list of faces currently opened by this */
/* driver. */
/* */
/* glyph_loader :: The glyph loader for all faces managed by this */
/* driver. This object isn't defined for unscalable */
/* formats. */
/* */
typedef struct FT_DriverRec_
{
FT_ModuleRec root;
FT_Driver_Class clazz;
FT_ListRec faces_list;
FT_GlyphLoader glyph_loader;
 
} FT_DriverRec;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** L I B R A R I E S ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/* This hook is used by the TrueType debugger. It must be set to an */
/* alternate truetype bytecode interpreter function. */
#define FT_DEBUG_HOOK_TRUETYPE 0
 
 
/* Set this debug hook to a non-null pointer to force unpatented hinting */
/* for all faces when both TT_USE_BYTECODE_INTERPRETER and */
/* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. This is only used */
/* during debugging. */
#define FT_DEBUG_HOOK_UNPATENTED_HINTING 1
 
 
typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,
FT_Render_Mode render_mode,
FT_Library library );
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* FT_LibraryRec */
/* */
/* <Description> */
/* The FreeType library class. This is the root of all FreeType */
/* data. Use FT_New_Library() to create a library object, and */
/* FT_Done_Library() to discard it and all child objects. */
/* */
/* <Fields> */
/* memory :: The library's memory object. Manages memory */
/* allocation. */
/* */
/* version_major :: The major version number of the library. */
/* */
/* version_minor :: The minor version number of the library. */
/* */
/* version_patch :: The current patch level of the library. */
/* */
/* num_modules :: The number of modules currently registered */
/* within this library. This is set to 0 for new */
/* libraries. New modules are added through the */
/* FT_Add_Module() API function. */
/* */
/* modules :: A table used to store handles to the currently */
/* registered modules. Note that each font driver */
/* contains a list of its opened faces. */
/* */
/* renderers :: The list of renderers currently registered */
/* within the library. */
/* */
/* cur_renderer :: The current outline renderer. This is a */
/* shortcut used to avoid parsing the list on */
/* each call to FT_Outline_Render(). It is a */
/* handle to the current renderer for the */
/* FT_GLYPH_FORMAT_OUTLINE format. */
/* */
/* auto_hinter :: XXX */
/* */
/* raster_pool :: The raster object's render pool. This can */
/* ideally be changed dynamically at run-time. */
/* */
/* raster_pool_size :: The size of the render pool in bytes. */
/* */
/* debug_hooks :: XXX */
/* */
/* lcd_filter :: If subpixel rendering is activated, the */
/* selected LCD filter mode. */
/* */
/* lcd_extra :: If subpixel rendering is activated, the number */
/* of extra pixels needed for the LCD filter. */
/* */
/* lcd_weights :: If subpixel rendering is activated, the LCD */
/* filter weights, if any. */
/* */
/* lcd_filter_func :: If subpixel rendering is activated, the LCD */
/* filtering callback function. */
/* */
/* pic_container :: Contains global structs and tables, instead */
/* of defining them globallly. */
/* */
/* refcount :: A counter initialized to~1 at the time an */
/* @FT_Library structure is created. */
/* @FT_Reference_Library increments this counter, */
/* and @FT_Done_Library only destroys a library */
/* if the counter is~1, otherwise it simply */
/* decrements it. */
/* */
typedef struct FT_LibraryRec_
{
FT_Memory memory; /* library's memory manager */
 
FT_Int version_major;
FT_Int version_minor;
FT_Int version_patch;
 
FT_UInt num_modules;
FT_Module modules[FT_MAX_MODULES]; /* module objects */
 
FT_ListRec renderers; /* list of renderers */
FT_Renderer cur_renderer; /* current outline renderer */
FT_Module auto_hinter;
 
FT_Byte* raster_pool; /* scan-line conversion */
/* render pool */
FT_ULong raster_pool_size; /* size of render pool in bytes */
 
FT_DebugHook_Func debug_hooks[4];
 
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
FT_LcdFilter lcd_filter;
FT_Int lcd_extra; /* number of extra pixels */
FT_Byte lcd_weights[7]; /* filter weights, if any */
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#endif
 
#ifdef FT_CONFIG_OPTION_PIC
FT_PIC_Container pic_container;
#endif
 
FT_Int refcount;
 
} FT_LibraryRec;
 
 
FT_BASE( FT_Renderer )
FT_Lookup_Renderer( FT_Library library,
FT_Glyph_Format format,
FT_ListNode* node );
 
FT_BASE( FT_Error )
FT_Render_Glyph_Internal( FT_Library library,
FT_GlyphSlot slot,
FT_Render_Mode render_mode );
 
typedef const char*
(*FT_Face_GetPostscriptNameFunc)( FT_Face face );
 
typedef FT_Error
(*FT_Face_GetGlyphNameFunc)( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max );
 
typedef FT_UInt
(*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,
FT_String* glyph_name );
 
 
#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Memory */
/* */
/* <Description> */
/* Creates a new memory object. */
/* */
/* <Return> */
/* A pointer to the new memory object. 0 in case of error. */
/* */
FT_BASE( FT_Memory )
FT_New_Memory( void );
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Done_Memory */
/* */
/* <Description> */
/* Discards memory manager. */
/* */
/* <Input> */
/* memory :: A handle to the memory manager. */
/* */
FT_BASE( void )
FT_Done_Memory( FT_Memory memory );
 
#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
 
 
/* Define default raster's interface. The default raster is located in */
/* `src/base/ftraster.c'. */
/* */
/* Client applications can register new rasters through the */
/* FT_Set_Raster() API. */
 
#ifndef FT_NO_DEFAULT_RASTER
FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
#endif
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** P I C S U P P O R T ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/* PIC support macros for ftimage.h */
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DEFINE_OUTLINE_FUNCS */
/* */
/* <Description> */
/* Used to initialize an instance of FT_Outline_Funcs struct. */
/* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
/* be called with a pre-allocated structure to be filled. */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_OUTLINE_FUNCS( \
class_, \
move_to_, \
line_to_, \
conic_to_, \
cubic_to_, \
shift_, \
delta_ ) \
static const FT_Outline_Funcs class_ = \
{ \
move_to_, \
line_to_, \
conic_to_, \
cubic_to_, \
shift_, \
delta_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_OUTLINE_FUNCS( \
class_, \
move_to_, \
line_to_, \
conic_to_, \
cubic_to_, \
shift_, \
delta_ ) \
static FT_Error \
Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \
{ \
clazz->move_to = move_to_; \
clazz->line_to = line_to_; \
clazz->conic_to = conic_to_; \
clazz->cubic_to = cubic_to_; \
clazz->shift = shift_; \
clazz->delta = delta_; \
\
return FT_Err_Ok; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DEFINE_RASTER_FUNCS */
/* */
/* <Description> */
/* Used to initialize an instance of FT_Raster_Funcs struct. */
/* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
/* be called with a pre-allocated structure to be filled. */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_RASTER_FUNCS( \
class_, \
glyph_format_, \
raster_new_, \
raster_reset_, \
raster_set_mode_, \
raster_render_, \
raster_done_ ) \
const FT_Raster_Funcs class_ = \
{ \
glyph_format_, \
raster_new_, \
raster_reset_, \
raster_set_mode_, \
raster_render_, \
raster_done_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_RASTER_FUNCS( \
class_, \
glyph_format_, \
raster_new_, \
raster_reset_, \
raster_set_mode_, \
raster_render_, \
raster_done_ ) \
void \
FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \
{ \
clazz->glyph_format = glyph_format_; \
clazz->raster_new = raster_new_; \
clazz->raster_reset = raster_reset_; \
clazz->raster_set_mode = raster_set_mode_; \
clazz->raster_render = raster_render_; \
clazz->raster_done = raster_done_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
/* PIC support macros for ftrender.h */
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DEFINE_GLYPH */
/* */
/* <Description> */
/* Used to initialize an instance of FT_Glyph_Class struct. */
/* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */
/* be called with a pre-allocated stcture to be filled. */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_GLYPH( \
class_, \
size_, \
format_, \
init_, \
done_, \
copy_, \
transform_, \
bbox_, \
prepare_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_Glyph_Class class_ = \
{ \
size_, \
format_, \
init_, \
done_, \
copy_, \
transform_, \
bbox_, \
prepare_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_GLYPH( \
class_, \
size_, \
format_, \
init_, \
done_, \
copy_, \
transform_, \
bbox_, \
prepare_ ) \
void \
FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \
{ \
clazz->glyph_size = size_; \
clazz->glyph_format = format_; \
clazz->glyph_init = init_; \
clazz->glyph_done = done_; \
clazz->glyph_copy = copy_; \
clazz->glyph_transform = transform_; \
clazz->glyph_bbox = bbox_; \
clazz->glyph_prepare = prepare_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DECLARE_RENDERER */
/* */
/* <Description> */
/* Used to create a forward declaration of a */
/* FT_Renderer_Class struct instance. */
/* */
/* <Macro> */
/* FT_DEFINE_RENDERER */
/* */
/* <Description> */
/* Used to initialize an instance of FT_Renderer_Class struct. */
/* */
/* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */
/* to be called with a pointer where the allocated structure is */
/* returned. And when it is no longer needed a `destroy' function */
/* needs to be called to release that allocation. */
/* `fcinit.c' (ft_create_default_module_classes) already contains */
/* a mechanism to call these functions for the default modules */
/* described in `ftmodule.h'. */
/* */
/* Notice that the created `create' and `destroy' functions call */
/* `pic_init' and `pic_free' to allow you to manually allocate and */
/* initialize any additional global data, like a module specific */
/* interface, and put them in the global pic container defined in */
/* `ftpic.h'. If you don't need them just implement the functions as */
/* empty to resolve the link error. Also the `pic_init' and */
/* `pic_free' functions should be declared in `pic.h', to be referred */
/* by the renderer definition calling `FT_DEFINE_RENDERER' in the */
/* following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DECLARE_RENDERER( class_ ) \
FT_EXPORT_VAR( const FT_Renderer_Class ) class_;
 
#define FT_DEFINE_RENDERER( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_, \
glyph_format_, \
render_glyph_, \
transform_glyph_, \
get_glyph_cbox_, \
set_mode_, \
raster_class_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_Renderer_Class class_ = \
{ \
FT_DEFINE_ROOT_MODULE( flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
glyph_format_, \
\
render_glyph_, \
transform_glyph_, \
get_glyph_cbox_, \
set_mode_, \
\
raster_class_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ )
 
#define FT_DEFINE_RENDERER( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_, \
glyph_format_, \
render_glyph_, \
transform_glyph_, \
get_glyph_cbox_, \
set_mode_, \
raster_class_ ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_Module_Class* clazz ) \
{ \
FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \
FT_Memory memory = library->memory; \
\
\
class_ ## _pic_free( library ); \
if ( rclazz ) \
FT_FREE( rclazz ); \
} \
\
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_Module_Class** output_class ) \
{ \
FT_Renderer_Class* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
return error; \
\
error = class_ ## _pic_init( library ); \
if ( error ) \
{ \
FT_FREE( clazz ); \
return error; \
} \
\
FT_DEFINE_ROOT_MODULE( flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
\
clazz->glyph_format = glyph_format_; \
\
clazz->render_glyph = render_glyph_; \
clazz->transform_glyph = transform_glyph_; \
clazz->get_glyph_cbox = get_glyph_cbox_; \
clazz->set_mode = set_mode_; \
\
clazz->raster_class = raster_class_; \
\
*output_class = (FT_Module_Class*)clazz; \
\
return FT_Err_Ok; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
/* PIC support macros for ftmodapi.h **/
 
 
#ifdef FT_CONFIG_OPTION_PIC
 
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Module_Creator */
/* */
/* <Description> */
/* A function used to create (allocate) a new module class object. */
/* The object's members are initialized, but the module itself is */
/* not. */
/* */
/* <Input> */
/* memory :: A handle to the memory manager. */
/* output_class :: Initialized with the newly allocated class. */
/* */
typedef FT_Error
(*FT_Module_Creator)( FT_Memory memory,
FT_Module_Class** output_class );
 
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Module_Destroyer */
/* */
/* <Description> */
/* A function used to destroy (deallocate) a module class object. */
/* */
/* <Input> */
/* memory :: A handle to the memory manager. */
/* clazz :: Module class to destroy. */
/* */
typedef void
(*FT_Module_Destroyer)( FT_Memory memory,
FT_Module_Class* clazz );
 
#endif
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DECLARE_MODULE */
/* */
/* <Description> */
/* Used to create a forward declaration of a */
/* FT_Module_Class struct instance. */
/* */
/* <Macro> */
/* FT_DEFINE_MODULE */
/* */
/* <Description> */
/* Used to initialize an instance of an FT_Module_Class struct. */
/* */
/* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */
/* be called with a pointer where the allocated structure is */
/* returned. And when it is no longer needed a `destroy' function */
/* needs to be called to release that allocation. */
/* `fcinit.c' (ft_create_default_module_classes) already contains */
/* a mechanism to call these functions for the default modules */
/* described in `ftmodule.h'. */
/* */
/* Notice that the created `create' and `destroy' functions call */
/* `pic_init' and `pic_free' to allow you to manually allocate and */
/* initialize any additional global data, like a module specific */
/* interface, and put them in the global pic container defined in */
/* `ftpic.h'. If you don't need them just implement the functions as */
/* empty to resolve the link error. Also the `pic_init' and */
/* `pic_free' functions should be declared in `pic.h', to be referred */
/* by the module definition calling `FT_DEFINE_MODULE' in the */
/* following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
/* is used). */
/* */
/* <Macro> */
/* FT_DEFINE_ROOT_MODULE */
/* */
/* <Description> */
/* Used to initialize an instance of an FT_Module_Class struct inside */
/* another struct that contains it or in a function that initializes */
/* that containing struct. */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DECLARE_MODULE( class_ ) \
FT_CALLBACK_TABLE \
const FT_Module_Class class_;
 
#define FT_DEFINE_ROOT_MODULE( \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
{ \
flags_, \
size_, \
\
name_, \
version_, \
requires_, \
\
interface_, \
\
init_, \
done_, \
get_interface_, \
},
 
#define FT_DEFINE_MODULE( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_Module_Class class_ = \
{ \
flags_, \
size_, \
\
name_, \
version_, \
requires_, \
\
interface_, \
\
init_, \
done_, \
get_interface_, \
};
 
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DECLARE_MODULE( class_ ) \
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_Module_Class** output_class ); \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_Module_Class* clazz );
 
#define FT_DEFINE_ROOT_MODULE( \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
clazz->root.module_flags = flags_; \
clazz->root.module_size = size_; \
clazz->root.module_name = name_; \
clazz->root.module_version = version_; \
clazz->root.module_requires = requires_; \
\
clazz->root.module_interface = interface_; \
\
clazz->root.module_init = init_; \
clazz->root.module_done = done_; \
clazz->root.get_interface = get_interface_;
 
#define FT_DEFINE_MODULE( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_Module_Class* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
class_ ## _pic_free( library ); \
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_Module_Class** output_class ) \
{ \
FT_Memory memory = library->memory; \
FT_Module_Class* clazz = NULL; \
FT_Error error; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \
return error; \
error = class_ ## _pic_init( library ); \
if ( error ) \
{ \
FT_FREE( clazz ); \
return error; \
} \
\
clazz->module_flags = flags_; \
clazz->module_size = size_; \
clazz->module_name = name_; \
clazz->module_version = version_; \
clazz->module_requires = requires_; \
\
clazz->module_interface = interface_; \
\
clazz->module_init = init_; \
clazz->module_done = done_; \
clazz->get_interface = get_interface_; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
FT_END_HEADER
 
#endif /* __FTOBJS_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftpic.h
0,0 → 1,71
/***************************************************************************/
/* */
/* ftpic.h */
/* */
/* The FreeType position independent code services (declaration). */
/* */
/* Copyright 2009, 2012 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* 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. */
/* */
/***************************************************************************/
 
/*************************************************************************/
/* */
/* Modules that ordinarily have const global data that need address */
/* can instead define pointers here. */
/* */
/*************************************************************************/
 
 
#ifndef __FTPIC_H__
#define __FTPIC_H__
 
 
FT_BEGIN_HEADER
 
#ifdef FT_CONFIG_OPTION_PIC
 
typedef struct FT_PIC_Container_
{
/* pic containers for base */
void* base;
 
/* pic containers for modules */
void* autofit;
void* cff;
void* pshinter;
void* psnames;
void* raster;
void* sfnt;
void* smooth;
void* truetype;
 
} FT_PIC_Container;
 
 
/* Initialize the various function tables, structs, etc. */
/* stored in the container. */
FT_BASE( FT_Error )
ft_pic_container_init( FT_Library library );
 
 
/* Destroy the contents of the container. */
FT_BASE( void )
ft_pic_container_destroy( FT_Library library );
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
FT_END_HEADER
 
#endif /* __FTPIC_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftrfork.h
0,0 → 1,258
/***************************************************************************/
/* */
/* ftrfork.h */
/* */
/* Embedded resource forks accessor (specification). */
/* */
/* Copyright 2004, 2006, 2007, 2012 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* 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. */
/* */
/***************************************************************************/
 
/***************************************************************************/
/* Development of the code in this file is support of */
/* Information-technology Promotion Agency, Japan. */
/***************************************************************************/
 
 
#ifndef __FTRFORK_H__
#define __FTRFORK_H__
 
 
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
 
 
FT_BEGIN_HEADER
 
 
/* Number of guessing rules supported in `FT_Raccess_Guess'. */
/* Don't forget to increment the number if you add a new guessing rule. */
#define FT_RACCESS_N_RULES 9
 
 
/* A structure to describe a reference in a resource by its resource ID */
/* and internal offset. The `POST' resource expects to be concatenated */
/* by the order of resource IDs instead of its appearance in the file. */
 
typedef struct FT_RFork_Ref_
{
FT_UShort res_id;
FT_ULong offset;
 
} FT_RFork_Ref;
 
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
typedef FT_Error
(*ft_raccess_guess_func)( FT_Library library,
FT_Stream stream,
char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
 
typedef enum FT_RFork_Rule_ {
FT_RFork_Rule_invalid = -2,
FT_RFork_Rule_uknown, /* -1 */
FT_RFork_Rule_apple_double,
FT_RFork_Rule_apple_single,
FT_RFork_Rule_darwin_ufs_export,
FT_RFork_Rule_darwin_newvfs,
FT_RFork_Rule_darwin_hfsplus,
FT_RFork_Rule_vfat,
FT_RFork_Rule_linux_cap,
FT_RFork_Rule_linux_double,
FT_RFork_Rule_linux_netatalk
} FT_RFork_Rule;
 
/* For fast translation between rule index and rule type,
* the macros FT_RFORK_xxx should be kept consistent with
* the raccess_guess_funcs table
*/
typedef struct ft_raccess_guess_rec_ {
ft_raccess_guess_func func;
FT_RFork_Rule type;
} ft_raccess_guess_rec;
 
#ifndef FT_CONFIG_OPTION_PIC
 
/* this array is a storage in non-PIC mode, so ; is needed in END */
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
const type name[] = {
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
{ raccess_guess_ ## func_suffix, \
FT_RFork_Rule_ ## type_suffix },
#define CONST_FT_RFORK_RULE_ARRAY_END };
 
#else /* FT_CONFIG_OPTION_PIC */
 
/* this array is a function in PIC mode, so no ; is needed in END */
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
void \
FT_Init_ ## name( type* storage ) \
{ \
type* local = storage; \
\
\
int i = 0;
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
local[i].func = raccess_guess_ ## func_suffix; \
local[i].type = FT_RFork_Rule_ ## type_suffix; \
i++;
#define CONST_FT_RFORK_RULE_ARRAY_END }
 
#endif /* FT_CONFIG_OPTION_PIC */
 
#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Raccess_Guess */
/* */
/* <Description> */
/* Guess a file name and offset where the actual resource fork is */
/* stored. The macro FT_RACCESS_N_RULES holds the number of */
/* guessing rules; the guessed result for the Nth rule is */
/* represented as a triplet: a new file name (new_names[N]), a file */
/* offset (offsets[N]), and an error code (errors[N]). */
/* */
/* <Input> */
/* library :: */
/* A FreeType library instance. */
/* */
/* stream :: */
/* A file stream containing the resource fork. */
/* */
/* base_name :: */
/* The (base) file name of the resource fork used for some */
/* guessing rules. */
/* */
/* <Output> */
/* new_names :: */
/* An array of guessed file names in which the resource forks may */
/* exist. If `new_names[N]' is NULL, the guessed file name is */
/* equal to `base_name'. */
/* */
/* offsets :: */
/* An array of guessed file offsets. `offsets[N]' holds the file */
/* offset of the possible start of the resource fork in file */
/* `new_names[N]'. */
/* */
/* errors :: */
/* An array of FreeType error codes. `errors[N]' is the error */
/* code of Nth guessing rule function. If `errors[N]' is not */
/* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
/* */
FT_BASE( void )
FT_Raccess_Guess( FT_Library library,
FT_Stream stream,
char* base_name,
char** new_names,
FT_Long* offsets,
FT_Error* errors );
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Raccess_Get_HeaderInfo */
/* */
/* <Description> */
/* Get the information from the header of resource fork. The */
/* information includes the file offset where the resource map */
/* starts, and the file offset where the resource data starts. */
/* `FT_Raccess_Get_DataOffsets' requires these two data. */
/* */
/* <Input> */
/* library :: */
/* A FreeType library instance. */
/* */
/* stream :: */
/* A file stream containing the resource fork. */
/* */
/* rfork_offset :: */
/* The file offset where the resource fork starts. */
/* */
/* <Output> */
/* map_offset :: */
/* The file offset where the resource map starts. */
/* */
/* rdata_pos :: */
/* The file offset where the resource data starts. */
/* */
/* <Return> */
/* FreeType error code. FT_Err_Ok means success. */
/* */
FT_BASE( FT_Error )
FT_Raccess_Get_HeaderInfo( FT_Library library,
FT_Stream stream,
FT_Long rfork_offset,
FT_Long *map_offset,
FT_Long *rdata_pos );
 
 
/*************************************************************************/
/* */
/* <Function> */
/* FT_Raccess_Get_DataOffsets */
/* */
/* <Description> */
/* Get the data offsets for a tag in a resource fork. Offsets are */
/* stored in an array because, in some cases, resources in a resource */
/* fork have the same tag. */
/* */
/* <Input> */
/* library :: */
/* A FreeType library instance. */
/* */
/* stream :: */
/* A file stream containing the resource fork. */
/* */
/* map_offset :: */
/* The file offset where the resource map starts. */
/* */
/* rdata_pos :: */
/* The file offset where the resource data starts. */
/* */
/* tag :: */
/* The resource tag. */
/* */
/* <Output> */
/* offsets :: */
/* The stream offsets for the resource data specified by `tag'. */
/* This array is allocated by the function, so you have to call */
/* @ft_mem_free after use. */
/* */
/* count :: */
/* The length of offsets array. */
/* */
/* <Return> */
/* FreeType error code. FT_Err_Ok means success. */
/* */
/* <Note> */
/* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
/* value for `map_offset' and `rdata_pos'. */
/* */
FT_BASE( FT_Error )
FT_Raccess_Get_DataOffsets( FT_Library library,
FT_Stream stream,
FT_Long map_offset,
FT_Long rdata_pos,
FT_Long tag,
FT_Long **offsets,
FT_Long *count );
 
 
FT_END_HEADER
 
#endif /* __FTRFORK_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftserv.h
0,0 → 1,763
/***************************************************************************/
/* */
/* ftserv.h */
/* */
/* The FreeType services (specification only). */
/* */
/* Copyright 2003-2007, 2009, 2012, 2013 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. */
/* */
/***************************************************************************/
 
/*************************************************************************/
/* */
/* Each module can export one or more `services'. Each service is */
/* identified by a constant string and modeled by a pointer; the latter */
/* generally corresponds to a structure containing function pointers. */
/* */
/* Note that a service's data cannot be a mere function pointer because */
/* in C it is possible that function pointers might be implemented */
/* differently than data pointers (e.g. 48 bits instead of 32). */
/* */
/*************************************************************************/
 
 
#ifndef __FTSERV_H__
#define __FTSERV_H__
 
 
FT_BEGIN_HEADER
 
/*
* @macro:
* FT_FACE_FIND_SERVICE
*
* @description:
* This macro is used to look up a service from a face's driver module.
*
* @input:
* face ::
* The source face handle.
*
* 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 is automatically prefixed with
* `FT_SERVICE_ID_'.
*
* @output:
* ptr ::
* A variable that receives the service pointer. Will be NULL
* if not found.
*/
#ifdef __cplusplus
 
#define FT_FACE_FIND_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_ = NULL; \
FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \
\
\
if ( module->clazz->get_interface ) \
_tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
*_pptr_ = _tmp_; \
FT_END_STMNT
 
#else /* !C++ */
 
#define FT_FACE_FIND_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_ = NULL; \
\
if ( module->clazz->get_interface ) \
_tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
ptr = _tmp_; \
FT_END_STMNT
 
#endif /* !C++ */
 
 
/*
* @macro:
* FT_FACE_FIND_GLOBAL_SERVICE
*
* @description:
* This macro is used to look up a service from all modules.
*
* @input:
* face ::
* The source face handle.
*
* 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 is automatically prefixed with
* `FT_SERVICE_ID_'.
*
* @output:
* ptr ::
* A variable that receives the service pointer. Will be NULL
* if not found.
*/
#ifdef __cplusplus
 
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_; \
FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \
\
\
_tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
*_pptr_ = _tmp_; \
FT_END_STMNT
 
#else /* !C++ */
 
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \
FT_Pointer _tmp_; \
\
\
_tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
ptr = _tmp_; \
FT_END_STMNT
 
#endif /* !C++ */
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** S E R V I C E D E S C R I P T O R S *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
/*
* 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;
 
 
/*************************************************************************/
/* */
/* <Macro> */
/* FT_DEFINE_SERVICEDESCREC1 */
/* FT_DEFINE_SERVICEDESCREC2 */
/* FT_DEFINE_SERVICEDESCREC3 */
/* FT_DEFINE_SERVICEDESCREC4 */
/* FT_DEFINE_SERVICEDESCREC5 */
/* FT_DEFINE_SERVICEDESCREC6 */
/* FT_DEFINE_SERVICEDESCREC7 */
/* */
/* <Description> */
/* Used to initialize an array of FT_ServiceDescRec structures. */
/* */
/* When FT_CONFIG_OPTION_PIC is defined a `create' function needs to */
/* be called with a pointer to return an allocated array. As soon as */
/* it is no longer needed, a `destroy' function needs to be called to */
/* release that allocation. */
/* */
/* These functions should be manually called from the `pic_init' and */
/* `pic_free' functions of your module (see FT_DEFINE_MODULE). */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the array will be */
/* allocated in the global scope (or the scope where the macro is */
/* used). */
/* */
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICEDESCREC1( class_, \
serv_id_1, serv_data_1 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ NULL, NULL } \
};
 
#define FT_DEFINE_SERVICEDESCREC2( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ NULL, NULL } \
};
 
#define FT_DEFINE_SERVICEDESCREC3( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ serv_id_3, serv_data_3 }, \
{ NULL, NULL } \
};
 
#define FT_DEFINE_SERVICEDESCREC4( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ serv_id_3, serv_data_3 }, \
{ serv_id_4, serv_data_4 }, \
{ NULL, NULL } \
};
 
#define FT_DEFINE_SERVICEDESCREC5( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ serv_id_3, serv_data_3 }, \
{ serv_id_4, serv_data_4 }, \
{ serv_id_5, serv_data_5 }, \
{ NULL, NULL } \
};
 
#define FT_DEFINE_SERVICEDESCREC6( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ serv_id_3, serv_data_3 }, \
{ serv_id_4, serv_data_4 }, \
{ serv_id_5, serv_data_5 }, \
{ serv_id_6, serv_data_6 }, \
{ NULL, NULL } \
};
 
#define FT_DEFINE_SERVICEDESCREC7( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6, \
serv_id_7, serv_data_7 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ serv_id_3, serv_data_3 }, \
{ serv_id_4, serv_data_4 }, \
{ serv_id_5, serv_data_5 }, \
{ serv_id_6, serv_data_6 }, \
{ serv_id_7, serv_data_7 }, \
{ NULL, NULL } \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICEDESCREC1( class_, \
serv_id_1, serv_data_1 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 2 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = NULL; \
clazz[1].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#define FT_DEFINE_SERVICEDESCREC2( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = NULL; \
clazz[2].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#define FT_DEFINE_SERVICEDESCREC3( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = NULL; \
clazz[3].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#define FT_DEFINE_SERVICEDESCREC4( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = NULL; \
clazz[4].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#define FT_DEFINE_SERVICEDESCREC5( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = NULL; \
clazz[5].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#define FT_DEFINE_SERVICEDESCREC6( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = serv_id_6; \
clazz[5].serv_data = serv_data_6; \
clazz[6].serv_id = NULL; \
clazz[6].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#define FT_DEFINE_SERVICEDESCREC7( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6, \
serv_id_7, serv_data_7 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz = NULL; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = serv_id_6; \
clazz[5].serv_data = serv_data_6; \
clazz[6].serv_id = serv_id_7; \
clazz[6].serv_data = serv_data_7; \
clazz[7].serv_id = NULL; \
clazz[7].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
 
/*
* Parse a list of FT_ServiceDescRec descriptors and look for
* a specific service by ID. Note that the last element in the
* array must be { NULL, NULL }, and that the function should
* return NULL if the service isn't available.
*
* This function can be used by modules to implement their
* `get_service' method.
*/
FT_BASE( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id );
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** S E R V I C E S C A C H E *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
/*
* This structure is used to store a cache for several frequently used
* services. It is the type of `face->internal->services'. You
* should only use FT_FACE_LOOKUP_SERVICE to access it.
*
* 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' 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_
{
FT_Pointer service_POSTSCRIPT_FONT_NAME;
FT_Pointer service_MULTI_MASTERS;
FT_Pointer service_GLYPH_DICT;
FT_Pointer service_PFR_METRICS;
FT_Pointer service_WINFNT;
 
} FT_ServiceCacheRec, *FT_ServiceCache;
 
 
/*
* A magic number used within the services cache.
*/
 
/* ensure that value `1' has the same width as a pointer */
#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1)
 
 
/*
* @macro:
* FT_FACE_LOOKUP_SERVICE
*
* @description:
* This macro is used to lookup a service from a face's driver module
* using its cache.
*
* @input:
* face::
* The source face handle containing the cache.
*
* field ::
* The field name in the cache.
*
* id ::
* The service ID.
*
* @output:
* ptr ::
* A variable receiving the service data. NULL if not available.
*/
#ifdef __cplusplus
 
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Pointer svc; \
FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \
\
\
svc = FT_FACE( face )->internal->services. service_ ## id; \
if ( svc == FT_SERVICE_UNAVAILABLE ) \
svc = NULL; \
else if ( svc == NULL ) \
{ \
FT_FACE_FIND_SERVICE( face, svc, id ); \
\
FT_FACE( face )->internal->services. service_ ## id = \
(FT_Pointer)( svc != NULL ? svc \
: FT_SERVICE_UNAVAILABLE ); \
} \
*Pptr = svc; \
FT_END_STMNT
 
#else /* !C++ */
 
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Pointer svc; \
\
\
svc = FT_FACE( face )->internal->services. service_ ## id; \
if ( svc == FT_SERVICE_UNAVAILABLE ) \
svc = NULL; \
else if ( svc == NULL ) \
{ \
FT_FACE_FIND_SERVICE( face, svc, id ); \
\
FT_FACE( face )->internal->services. service_ ## id = \
(FT_Pointer)( svc != NULL ? svc \
: FT_SERVICE_UNAVAILABLE ); \
} \
ptr = svc; \
FT_END_STMNT
 
#endif /* !C++ */
 
/*
* A macro used to define new service structure types.
*/
 
#define FT_DEFINE_SERVICE( name ) \
typedef struct FT_Service_ ## name ## Rec_ \
FT_Service_ ## name ## Rec ; \
typedef struct FT_Service_ ## name ## Rec_ \
const * FT_Service_ ## name ; \
struct FT_Service_ ## name ## Rec_
 
/* */
 
/*
* The header files containing the services.
*/
 
#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
#define FT_SERVICE_CID_H <freetype/internal/services/svcid.h>
#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
#define FT_SERVICE_GX_VALIDATE_H <freetype/internal/services/svgxval.h>
#define FT_SERVICE_KERNING_H <freetype/internal/services/svkern.h>
#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h>
#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h>
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h>
#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h>
#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h>
#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
#define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h>
#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h>
#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
 
/* */
 
FT_END_HEADER
 
#endif /* __FTSERV_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftstream.h
0,0 → 1,536
/***************************************************************************/
/* */
/* ftstream.h */
/* */
/* Stream handling (specification). */
/* */
/* Copyright 1996-2002, 2004-2006, 2011, 2013 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 __FTSTREAM_H__
#define __FTSTREAM_H__
 
 
#include <ft2build.h>
#include FT_SYSTEM_H
#include FT_INTERNAL_OBJECTS_H
 
 
FT_BEGIN_HEADER
 
 
/* format of an 8-bit frame_op value: */
/* */
/* bit 76543210 */
/* xxxxxxes */
/* */
/* s is set to 1 if the value is signed. */
/* e is set to 1 if the value is little-endian. */
/* xxx is a command. */
 
#define FT_FRAME_OP_SHIFT 2
#define FT_FRAME_OP_SIGNED 1
#define FT_FRAME_OP_LITTLE 2
#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT )
 
#define FT_MAKE_FRAME_OP( command, little, sign ) \
( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )
 
#define FT_FRAME_OP_END 0
#define FT_FRAME_OP_START 1 /* start a new frame */
#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */
#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */
#define FT_FRAME_OP_LONG 4 /* read 4-byte value */
#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */
#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */
 
 
typedef enum FT_Frame_Op_
{
ft_frame_end = 0,
ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),
 
ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ),
ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ),
 
ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),
ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),
ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),
ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),
 
ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),
ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),
ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),
ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),
 
ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),
ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),
ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),
 
ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),
ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )
 
} FT_Frame_Op;
 
 
typedef struct FT_Frame_Field_
{
FT_Byte value;
FT_Byte size;
FT_UShort offset;
 
} FT_Frame_Field;
 
 
/* Construct an FT_Frame_Field out of a structure type and a field name. */
/* The structure type must be set in the FT_STRUCTURE macro before */
/* calling the FT_FRAME_START() macro. */
/* */
#define FT_FIELD_SIZE( f ) \
(FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
 
#define FT_FIELD_SIZE_DELTA( f ) \
(FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
 
#define FT_FIELD_OFFSET( f ) \
(FT_UShort)( offsetof( FT_STRUCTURE, f ) )
 
#define FT_FRAME_FIELD( frame_op, field ) \
{ \
frame_op, \
FT_FIELD_SIZE( field ), \
FT_FIELD_OFFSET( field ) \
}
 
#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }
 
#define FT_FRAME_START( size ) { ft_frame_start, 0, size }
#define FT_FRAME_END { ft_frame_end, 0, 0 }
 
#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f )
#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f )
#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f )
#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f )
#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f )
#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f )
#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f )
#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f )
 
#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f )
#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f )
#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f )
#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f )
#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f )
#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f )
 
#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }
#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
 
#define FT_FRAME_BYTES( field, count ) \
{ \
ft_frame_bytes, \
count, \
FT_FIELD_OFFSET( field ) \
}
 
#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }
 
 
/*************************************************************************/
/* */
/* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */
/* type `char*' or equivalent (1-byte elements). */
/* */
 
#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] )
 
#define FT_INT16( x ) ( (FT_Int16)(x) )
#define FT_UINT16( x ) ( (FT_UInt16)(x) )
#define FT_INT32( x ) ( (FT_Int32)(x) )
#define FT_UINT32( x ) ( (FT_UInt32)(x) )
 
 
#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )
#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
 
 
#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \
FT_BYTE_U16( p, 1, 0) )
 
#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
FT_BYTE_U16( p, 1, 0 ) )
 
#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \
FT_BYTE_U32( p, 1, 16 ) | \
FT_BYTE_U32( p, 2, 8 ) | \
FT_BYTE_U32( p, 3, 0 ) )
 
#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \
FT_BYTE_U32( p, 1, 16 ) | \
FT_BYTE_U32( p, 2, 8 ) | \
FT_BYTE_U32( p, 3, 0 ) )
 
#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 2, 0 ) )
 
#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 2, 0 ) )
 
#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \
FT_BYTE_U16( p, 0, 0 ) )
 
#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \
FT_BYTE_U16( p, 0, 0 ) )
 
#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \
FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )
 
#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \
FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )
 
#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )
 
#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )
 
 
#define FT_NEXT_CHAR( buffer ) \
( (signed char)*buffer++ )
 
#define FT_NEXT_BYTE( buffer ) \
( (unsigned char)*buffer++ )
 
#define FT_NEXT_SHORT( buffer ) \
( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )
 
#define FT_NEXT_USHORT( buffer ) \
( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )
 
#define FT_NEXT_OFF3( buffer ) \
( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )
 
#define FT_NEXT_UOFF3( buffer ) \
( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )
 
#define FT_NEXT_LONG( buffer ) \
( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )
 
#define FT_NEXT_ULONG( buffer ) \
( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )
 
 
#define FT_NEXT_SHORT_LE( buffer ) \
( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )
 
#define FT_NEXT_USHORT_LE( buffer ) \
( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )
 
#define FT_NEXT_OFF3_LE( buffer ) \
( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )
 
#define FT_NEXT_UOFF3_LE( buffer ) \
( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )
 
#define FT_NEXT_LONG_LE( buffer ) \
( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )
 
#define FT_NEXT_ULONG_LE( buffer ) \
( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )
 
 
/*************************************************************************/
/* */
/* Each GET_xxxx() macro uses an implicit `stream' variable. */
/* */
#if 0
#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor )
 
#define FT_GET_CHAR() FT_GET_MACRO( CHAR )
#define FT_GET_BYTE() FT_GET_MACRO( BYTE )
#define FT_GET_SHORT() FT_GET_MACRO( SHORT )
#define FT_GET_USHORT() FT_GET_MACRO( USHORT )
#define FT_GET_OFF3() FT_GET_MACRO( OFF3 )
#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 )
#define FT_GET_LONG() FT_GET_MACRO( LONG )
#define FT_GET_ULONG() FT_GET_MACRO( ULONG )
#define FT_GET_TAG4() FT_GET_MACRO( ULONG )
 
#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE )
#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE )
#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE )
#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE )
 
#else
#define FT_GET_MACRO( func, type ) ( (type)func( stream ) )
 
#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )
#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )
#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )
#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )
#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )
#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )
#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long )
#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
 
#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )
#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )
#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )
#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )
#endif
 
#define FT_READ_MACRO( func, type, var ) \
( var = (type)func( stream, &error ), \
error != FT_Err_Ok )
 
#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )
#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )
#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )
#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )
#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )
#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )
#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )
#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )
 
#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )
#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )
#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )
#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )
 
 
#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
 
/* initialize a stream for reading a regular system stream */
FT_BASE( FT_Error )
FT_Stream_Open( FT_Stream stream,
const char* filepathname );
 
#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
 
 
/* create a new (input) stream from an FT_Open_Args structure */
FT_BASE( FT_Error )
FT_Stream_New( FT_Library library,
const FT_Open_Args* args,
FT_Stream *astream );
 
/* free a stream */
FT_BASE( void )
FT_Stream_Free( FT_Stream stream,
FT_Int external );
 
/* initialize a stream for reading in-memory data */
FT_BASE( void )
FT_Stream_OpenMemory( FT_Stream stream,
const FT_Byte* base,
FT_ULong size );
 
/* close a stream (does not destroy the stream structure) */
FT_BASE( void )
FT_Stream_Close( FT_Stream stream );
 
 
/* seek within a stream. position is relative to start of stream */
FT_BASE( FT_Error )
FT_Stream_Seek( FT_Stream stream,
FT_ULong pos );
 
/* skip bytes in a stream */
FT_BASE( FT_Error )
FT_Stream_Skip( FT_Stream stream,
FT_Long distance );
 
/* return current stream position */
FT_BASE( FT_Long )
FT_Stream_Pos( FT_Stream stream );
 
/* read bytes from a stream into a user-allocated buffer, returns an */
/* error if not all bytes could be read. */
FT_BASE( FT_Error )
FT_Stream_Read( FT_Stream stream,
FT_Byte* buffer,
FT_ULong count );
 
/* read bytes from a stream at a given position */
FT_BASE( FT_Error )
FT_Stream_ReadAt( FT_Stream stream,
FT_ULong pos,
FT_Byte* buffer,
FT_ULong count );
 
/* try to read bytes at the end of a stream; return number of bytes */
/* really available */
FT_BASE( FT_ULong )
FT_Stream_TryRead( FT_Stream stream,
FT_Byte* buffer,
FT_ULong count );
 
/* Enter a frame of `count' consecutive bytes in a stream. Returns an */
/* error if the frame could not be read/accessed. The caller can use */
/* the FT_Stream_Get_XXX functions to retrieve frame data without */
/* error checks. */
/* */
/* You must _always_ call FT_Stream_ExitFrame() once you have entered */
/* a stream frame! */
/* */
FT_BASE( FT_Error )
FT_Stream_EnterFrame( FT_Stream stream,
FT_ULong count );
 
/* exit a stream frame */
FT_BASE( void )
FT_Stream_ExitFrame( FT_Stream stream );
 
/* Extract a stream frame. If the stream is disk-based, a heap block */
/* is allocated and the frame bytes are read into it. If the stream */
/* is memory-based, this function simply set a pointer to the data. */
/* */
/* Useful to optimize access to memory-based streams transparently. */
/* */
/* All extracted frames must be `freed' with a call to the function */
/* FT_Stream_ReleaseFrame(). */
/* */
FT_BASE( FT_Error )
FT_Stream_ExtractFrame( FT_Stream stream,
FT_ULong count,
FT_Byte** pbytes );
 
/* release an extract frame (see FT_Stream_ExtractFrame) */
FT_BASE( void )
FT_Stream_ReleaseFrame( FT_Stream stream,
FT_Byte** pbytes );
 
/* read a byte from an entered frame */
FT_BASE( FT_Char )
FT_Stream_GetChar( FT_Stream stream );
 
/* read a 16-bit big-endian unsigned integer from an entered frame */
FT_BASE( FT_UShort )
FT_Stream_GetUShort( FT_Stream stream );
 
/* read a 24-bit big-endian unsigned integer from an entered frame */
FT_BASE( FT_ULong )
FT_Stream_GetUOffset( FT_Stream stream );
 
/* read a 32-bit big-endian unsigned integer from an entered frame */
FT_BASE( FT_ULong )
FT_Stream_GetULong( FT_Stream stream );
 
/* read a 16-bit little-endian unsigned integer from an entered frame */
FT_BASE( FT_UShort )
FT_Stream_GetUShortLE( FT_Stream stream );
 
/* read a 32-bit little-endian unsigned integer from an entered frame */
FT_BASE( FT_ULong )
FT_Stream_GetULongLE( FT_Stream stream );
 
 
/* read a byte from a stream */
FT_BASE( FT_Char )
FT_Stream_ReadChar( FT_Stream stream,
FT_Error* error );
 
/* read a 16-bit big-endian unsigned integer from a stream */
FT_BASE( FT_UShort )
FT_Stream_ReadUShort( FT_Stream stream,
FT_Error* error );
 
/* read a 24-bit big-endian unsigned integer from a stream */
FT_BASE( FT_ULong )
FT_Stream_ReadUOffset( FT_Stream stream,
FT_Error* error );
 
/* read a 32-bit big-endian integer from a stream */
FT_BASE( FT_ULong )
FT_Stream_ReadULong( FT_Stream stream,
FT_Error* error );
 
/* read a 16-bit little-endian unsigned integer from a stream */
FT_BASE( FT_UShort )
FT_Stream_ReadUShortLE( FT_Stream stream,
FT_Error* error );
 
/* read a 32-bit little-endian unsigned integer from a stream */
FT_BASE( FT_ULong )
FT_Stream_ReadULongLE( FT_Stream stream,
FT_Error* error );
 
/* Read a structure from a stream. The structure must be described */
/* by an array of FT_Frame_Field records. */
FT_BASE( FT_Error )
FT_Stream_ReadFields( FT_Stream stream,
const FT_Frame_Field* fields,
void* structure );
 
 
#define FT_STREAM_POS() \
FT_Stream_Pos( stream )
 
#define FT_STREAM_SEEK( position ) \
FT_SET_ERROR( FT_Stream_Seek( stream, \
(FT_ULong)(position) ) )
 
#define FT_STREAM_SKIP( distance ) \
FT_SET_ERROR( FT_Stream_Skip( stream, \
(FT_Long)(distance) ) )
 
#define FT_STREAM_READ( buffer, count ) \
FT_SET_ERROR( FT_Stream_Read( stream, \
(FT_Byte*)(buffer), \
(FT_ULong)(count) ) )
 
#define FT_STREAM_READ_AT( position, buffer, count ) \
FT_SET_ERROR( FT_Stream_ReadAt( stream, \
(FT_ULong)(position), \
(FT_Byte*)buffer, \
(FT_ULong)(count) ) )
 
#define FT_STREAM_READ_FIELDS( fields, object ) \
FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
 
 
#define FT_FRAME_ENTER( size ) \
FT_SET_ERROR( \
FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \
(FT_ULong)(size) ) ) )
 
#define FT_FRAME_EXIT() \
FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
 
#define FT_FRAME_EXTRACT( size, bytes ) \
FT_SET_ERROR( \
FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \
(FT_ULong)(size), \
(FT_Byte**)&(bytes) ) ) )
 
#define FT_FRAME_RELEASE( bytes ) \
FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \
(FT_Byte**)&(bytes) ) )
 
 
FT_END_HEADER
 
#endif /* __FTSTREAM_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/fttrace.h
0,0 → 1,152
/***************************************************************************/
/* */
/* fttrace.h */
/* */
/* Tracing handling (specification only). */
/* */
/* Copyright 2002, 2004-2007, 2009, 2011-2013 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. */
/* */
/***************************************************************************/
 
 
/* definitions of trace levels for FreeType 2 */
 
/* the first level must always be `trace_any' */
FT_TRACE_DEF( any )
 
/* base components */
FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */
FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */
FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */
FT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */
FT_TRACE_DEF( list ) /* list management (ftlist.c) */
FT_TRACE_DEF( init ) /* initialization (ftinit.c) */
FT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */
FT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */
FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */
FT_TRACE_DEF( gloader ) /* glyph loader (ftgloadr.c) */
 
FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */
FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */
FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */
 
/* Cache sub-system */
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
 
/* SFNT driver components */
FT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
FT_TRACE_DEF( ttmtx ) /* metrics-related tables (ttmtx.c) */
FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
FT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */
 
/* TrueType driver components */
FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */
FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */
FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */
FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */
FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */
FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */
 
/* Type 1 driver components */
FT_TRACE_DEF( t1afm )
FT_TRACE_DEF( t1driver )
FT_TRACE_DEF( t1gload )
FT_TRACE_DEF( t1hint )
FT_TRACE_DEF( t1load )
FT_TRACE_DEF( t1objs )
FT_TRACE_DEF( t1parse )
 
/* PostScript helper module `psaux' */
FT_TRACE_DEF( t1decode )
FT_TRACE_DEF( psobjs )
FT_TRACE_DEF( psconv )
 
/* PostScript hinting module `pshinter' */
FT_TRACE_DEF( pshrec )
FT_TRACE_DEF( pshalgo1 )
FT_TRACE_DEF( pshalgo2 )
 
/* Type 2 driver components */
FT_TRACE_DEF( cffdriver )
FT_TRACE_DEF( cffgload )
FT_TRACE_DEF( cffload )
FT_TRACE_DEF( cffobjs )
FT_TRACE_DEF( cffparse )
 
FT_TRACE_DEF( cf2blues )
FT_TRACE_DEF( cf2hints )
FT_TRACE_DEF( cf2interp )
 
/* Type 42 driver component */
FT_TRACE_DEF( t42 )
 
/* CID driver components */
FT_TRACE_DEF( cidafm )
FT_TRACE_DEF( ciddriver )
FT_TRACE_DEF( cidgload )
FT_TRACE_DEF( cidload )
FT_TRACE_DEF( cidobjs )
FT_TRACE_DEF( cidparse )
 
/* Windows font component */
FT_TRACE_DEF( winfnt )
 
/* PCF font components */
FT_TRACE_DEF( pcfdriver )
FT_TRACE_DEF( pcfread )
 
/* BDF font components */
FT_TRACE_DEF( bdfdriver )
FT_TRACE_DEF( bdflib )
 
/* PFR font component */
FT_TRACE_DEF( pfr )
 
/* OpenType validation components */
FT_TRACE_DEF( otvmodule )
FT_TRACE_DEF( otvcommon )
FT_TRACE_DEF( otvbase )
FT_TRACE_DEF( otvgdef )
FT_TRACE_DEF( otvgpos )
FT_TRACE_DEF( otvgsub )
FT_TRACE_DEF( otvjstf )
FT_TRACE_DEF( otvmath )
 
/* TrueTypeGX/AAT validation components */
FT_TRACE_DEF( gxvmodule )
FT_TRACE_DEF( gxvcommon )
FT_TRACE_DEF( gxvfeat )
FT_TRACE_DEF( gxvmort )
FT_TRACE_DEF( gxvmorx )
FT_TRACE_DEF( gxvbsln )
FT_TRACE_DEF( gxvjust )
FT_TRACE_DEF( gxvkern )
FT_TRACE_DEF( gxvopbd )
FT_TRACE_DEF( gxvtrak )
FT_TRACE_DEF( gxvprop )
FT_TRACE_DEF( gxvlcar )
 
/* autofit components */
FT_TRACE_DEF( afmodule )
FT_TRACE_DEF( afhints )
FT_TRACE_DEF( afcjk )
FT_TRACE_DEF( aflatin )
FT_TRACE_DEF( aflatin2 )
FT_TRACE_DEF( afwarp )
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/ftvalid.h
0,0 → 1,161
/***************************************************************************/
/* */
/* ftvalid.h */
/* */
/* FreeType validation support (specification). */
/* */
/* Copyright 2004, 2013 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 __FTVALID_H__
#define __FTVALID_H__
 
#include <ft2build.h>
#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** V A L I D A T I O N ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
/* handle to a validation object */
typedef struct FT_ValidatorRec_ volatile* FT_Validator;
 
 
/*************************************************************************/
/* */
/* There are three distinct validation levels defined here: */
/* */
/* FT_VALIDATE_DEFAULT :: */
/* A table that passes this validation level can be used reliably by */
/* FreeType. It generally means that all offsets have been checked to */
/* prevent out-of-bound reads, that array counts are correct, etc. */
/* */
/* FT_VALIDATE_TIGHT :: */
/* A table that passes this validation level can be used reliably and */
/* doesn't contain invalid data. For example, a charmap table that */
/* returns invalid glyph indices will not pass, even though it can */
/* be used with FreeType in default mode (the library will simply */
/* return an error later when trying to load the glyph). */
/* */
/* It also checks that fields which must be a multiple of 2, 4, or 8, */
/* don't have incorrect values, etc. */
/* */
/* FT_VALIDATE_PARANOID :: */
/* Only for font debugging. Checks that a table follows the */
/* specification by 100%. Very few fonts will be able to pass this */
/* level anyway but it can be useful for certain tools like font */
/* editors/converters. */
/* */
typedef enum FT_ValidationLevel_
{
FT_VALIDATE_DEFAULT = 0,
FT_VALIDATE_TIGHT,
FT_VALIDATE_PARANOID
 
} FT_ValidationLevel;
 
 
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
/* We disable the warning `structure was padded due to */
/* __declspec(align())' in order to compile cleanly with */
/* the maximum level of warnings. */
#pragma warning( push )
#pragma warning( disable : 4324 )
#endif /* _MSC_VER */
 
/* validator structure */
typedef struct FT_ValidatorRec_
{
const FT_Byte* base; /* address of table in memory */
const FT_Byte* limit; /* `base' + sizeof(table) in memory */
FT_ValidationLevel level; /* validation level */
FT_Error error; /* error returned. 0 means success */
 
ft_jmp_buf jump_buffer; /* used for exception handling */
 
} FT_ValidatorRec;
 
#if defined( _MSC_VER )
#pragma warning( pop )
#endif
 
#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) )
 
 
FT_BASE( void )
ft_validator_init( FT_Validator valid,
const FT_Byte* base,
const FT_Byte* limit,
FT_ValidationLevel level );
 
/* Do not use this. It's broken and will cause your validator to crash */
/* if you run it on an invalid font. */
FT_BASE( FT_Int )
ft_validator_run( FT_Validator valid );
 
/* Sets the error field in a validator, then calls `longjmp' to return */
/* to high-level caller. Using `setjmp/longjmp' avoids many stupid */
/* error checks within the validation routines. */
/* */
FT_BASE( void )
ft_validator_error( FT_Validator valid,
FT_Error error );
 
 
/* Calls ft_validate_error. Assumes that the `valid' local variable */
/* holds a pointer to the current validator object. */
/* */
/* Use preprocessor prescan to pass FT_ERR_PREFIX. */
/* */
#define FT_INVALID( _prefix, _error ) FT_INVALID_( _prefix, _error )
#define FT_INVALID_( _prefix, _error ) \
ft_validator_error( valid, _prefix ## _error )
 
/* called when a broken table is detected */
#define FT_INVALID_TOO_SHORT \
FT_INVALID( FT_ERR_PREFIX, Invalid_Table )
 
/* called when an invalid offset is detected */
#define FT_INVALID_OFFSET \
FT_INVALID( FT_ERR_PREFIX, Invalid_Offset )
 
/* called when an invalid format/value is detected */
#define FT_INVALID_FORMAT \
FT_INVALID( FT_ERR_PREFIX, Invalid_Table )
 
/* called when an invalid glyph index is detected */
#define FT_INVALID_GLYPH_ID \
FT_INVALID( FT_ERR_PREFIX, Invalid_Glyph_Index )
 
/* called when an invalid field value is detected */
#define FT_INVALID_DATA \
FT_INVALID( FT_ERR_PREFIX, Invalid_Table )
 
 
FT_END_HEADER
 
#endif /* __FTVALID_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/internal.h
0,0 → 1,63
/***************************************************************************/
/* */
/* internal.h */
/* */
/* Internal header files (specification only). */
/* */
/* Copyright 1996-2004, 2013 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. */
/* */
/***************************************************************************/
 
 
/*************************************************************************/
/* */
/* This file is automatically included by `ft2build.h'. */
/* Do not include it manually! */
/* */
/*************************************************************************/
 
 
#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
#define FT_INTERNAL_PIC_H <freetype/internal/ftpic.h>
#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h>
#define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h>
#define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h>
 
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
 
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
 
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
 
 
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
 
/* We disable the warning `conditional expression is constant' here */
/* in order to compile cleanly with the maximum level of warnings. */
/* In particular, the warning complains about stuff like `while(0)' */
/* which is very useful in macro definitions. There is no benefit */
/* in having it enabled. */
#pragma warning( disable : 4127 )
 
#endif /* _MSC_VER */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/psaux.h
0,0 → 1,877
/***************************************************************************/
/* */
/* psaux.h */
/* */
/* Auxiliary functions and data structures related to PostScript fonts */
/* (specification). */
/* */
/* Copyright 1996-2004, 2006, 2008, 2009, 2012 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 __PSAUX_H__
#define __PSAUX_H__
 
 
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TYPE1_TYPES_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1_TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
 
typedef struct PS_TableRec_* PS_Table;
typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* PS_Table_FuncsRec */
/* */
/* <Description> */
/* A set of function pointers to manage PS_Table objects. */
/* */
/* <Fields> */
/* table_init :: Used to initialize a table. */
/* */
/* table_done :: Finalizes resp. destroy a given table. */
/* */
/* table_add :: Adds a new object to a table. */
/* */
/* table_release :: Releases table data, then finalizes it. */
/* */
typedef struct PS_Table_FuncsRec_
{
FT_Error
(*init)( PS_Table table,
FT_Int count,
FT_Memory memory );
 
void
(*done)( PS_Table table );
 
FT_Error
(*add)( PS_Table table,
FT_Int idx,
void* object,
FT_PtrDist length );
 
void
(*release)( PS_Table table );
 
} PS_Table_FuncsRec;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* PS_TableRec */
/* */
/* <Description> */
/* A PS_Table is a simple object used to store an array of objects in */
/* a single memory block. */
/* */
/* <Fields> */
/* block :: The address in memory of the growheap's block. This */
/* can change between two object adds, due to */
/* reallocation. */
/* */
/* cursor :: The current top of the grow heap within its block. */
/* */
/* capacity :: The current size of the heap block. Increments by */
/* 1kByte chunks. */
/* */
/* init :: Set to 0xDEADBEEF if `elements' and `lengths' have */
/* been allocated. */
/* */
/* max_elems :: The maximum number of elements in table. */
/* */
/* num_elems :: The current number of elements in table. */
/* */
/* elements :: A table of element addresses within the block. */
/* */
/* lengths :: A table of element sizes within the block. */
/* */
/* memory :: The object used for memory operations */
/* (alloc/realloc). */
/* */
/* funcs :: A table of method pointers for this object. */
/* */
typedef struct PS_TableRec_
{
FT_Byte* block; /* current memory block */
FT_Offset cursor; /* current cursor in memory block */
FT_Offset capacity; /* current size of memory block */
FT_Long init;
 
FT_Int max_elems;
FT_Int num_elems;
FT_Byte** elements; /* addresses of table elements */
FT_PtrDist* lengths; /* lengths of table elements */
 
FT_Memory memory;
PS_Table_FuncsRec funcs;
 
} PS_TableRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 FIELDS & TOKENS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
typedef struct PS_ParserRec_* PS_Parser;
 
typedef struct T1_TokenRec_* T1_Token;
 
typedef struct T1_FieldRec_* T1_Field;
 
 
/* simple enumeration type used to identify token types */
typedef enum T1_TokenType_
{
T1_TOKEN_TYPE_NONE = 0,
T1_TOKEN_TYPE_ANY,
T1_TOKEN_TYPE_STRING,
T1_TOKEN_TYPE_ARRAY,
T1_TOKEN_TYPE_KEY, /* aka `name' */
 
/* do not remove */
T1_TOKEN_TYPE_MAX
 
} T1_TokenType;
 
 
/* a simple structure used to identify tokens */
typedef struct T1_TokenRec_
{
FT_Byte* start; /* first character of token in input stream */
FT_Byte* limit; /* first character after the token */
T1_TokenType type; /* type of token */
 
} T1_TokenRec;
 
 
/* enumeration type used to identify object fields */
typedef enum T1_FieldType_
{
T1_FIELD_TYPE_NONE = 0,
T1_FIELD_TYPE_BOOL,
T1_FIELD_TYPE_INTEGER,
T1_FIELD_TYPE_FIXED,
T1_FIELD_TYPE_FIXED_1000,
T1_FIELD_TYPE_STRING,
T1_FIELD_TYPE_KEY,
T1_FIELD_TYPE_BBOX,
T1_FIELD_TYPE_MM_BBOX,
T1_FIELD_TYPE_INTEGER_ARRAY,
T1_FIELD_TYPE_FIXED_ARRAY,
T1_FIELD_TYPE_CALLBACK,
 
/* do not remove */
T1_FIELD_TYPE_MAX
 
} T1_FieldType;
 
 
typedef enum T1_FieldLocation_
{
T1_FIELD_LOCATION_CID_INFO,
T1_FIELD_LOCATION_FONT_DICT,
T1_FIELD_LOCATION_FONT_EXTRA,
T1_FIELD_LOCATION_FONT_INFO,
T1_FIELD_LOCATION_PRIVATE,
T1_FIELD_LOCATION_BBOX,
T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE,
T1_FIELD_LOCATION_BLEND,
 
/* do not remove */
T1_FIELD_LOCATION_MAX
 
} T1_FieldLocation;
 
 
typedef void
(*T1_Field_ParseFunc)( FT_Face face,
FT_Pointer parser );
 
 
/* structure type used to model object fields */
typedef struct T1_FieldRec_
{
const char* ident; /* field identifier */
T1_FieldLocation location;
T1_FieldType type; /* type of field */
T1_Field_ParseFunc reader;
FT_UInt offset; /* offset of field in object */
FT_Byte size; /* size of field in bytes */
FT_UInt array_max; /* maximum number of elements for */
/* array */
FT_UInt count_offset; /* offset of element count for */
/* arrays; must not be zero if in */
/* use -- in other words, a */
/* `num_FOO' element must not */
/* start the used structure if we */
/* parse a `FOO' array */
FT_UInt dict; /* where we expect it */
} T1_FieldRec;
 
#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */
#define T1_FIELD_DICT_PRIVATE ( 1 << 1 )
 
 
 
#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \
{ \
_ident, T1CODE, _type, \
0, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, \
_dict \
},
 
#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \
{ \
_ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
(T1_Field_ParseFunc)_reader, \
0, 0, \
0, 0, \
_dict \
},
 
#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \
{ \
_ident, T1CODE, _type, \
0, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_max, \
FT_FIELD_OFFSET( num_ ## _fname ), \
_dict \
},
 
#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \
{ \
_ident, T1CODE, _type, \
0, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_max, 0, \
_dict \
},
 
 
#define T1_FIELD_BOOL( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )
 
#define T1_FIELD_NUM( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )
 
#define T1_FIELD_FIXED( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )
 
#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \
_dict )
 
#define T1_FIELD_STRING( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )
 
#define T1_FIELD_KEY( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )
 
#define T1_FIELD_BBOX( _ident, _fname, _dict ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )
 
 
#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \
T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
_fname, _fmax, _dict )
 
#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \
T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
_fname, _fmax, _dict )
 
#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \
T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
_fname, _fmax, _dict )
 
#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \
T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
_fname, _fmax, _dict )
 
#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \
T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 PARSER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs;
 
typedef struct PS_Parser_FuncsRec_
{
void
(*init)( PS_Parser parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory );
 
void
(*done)( PS_Parser parser );
 
void
(*skip_spaces)( PS_Parser parser );
void
(*skip_PS_token)( PS_Parser parser );
 
FT_Long
(*to_int)( PS_Parser parser );
FT_Fixed
(*to_fixed)( PS_Parser parser,
FT_Int power_ten );
 
FT_Error
(*to_bytes)( PS_Parser parser,
FT_Byte* bytes,
FT_Offset max_bytes,
FT_Long* pnum_bytes,
FT_Bool delimiters );
 
FT_Int
(*to_coord_array)( PS_Parser parser,
FT_Int max_coords,
FT_Short* coords );
FT_Int
(*to_fixed_array)( PS_Parser parser,
FT_Int max_values,
FT_Fixed* values,
FT_Int power_ten );
 
void
(*to_token)( PS_Parser parser,
T1_Token token );
void
(*to_token_array)( PS_Parser parser,
T1_Token tokens,
FT_UInt max_tokens,
FT_Int* pnum_tokens );
 
FT_Error
(*load_field)( PS_Parser parser,
const T1_Field field,
void** objects,
FT_UInt max_objects,
FT_ULong* pflags );
 
FT_Error
(*load_field_table)( PS_Parser parser,
const T1_Field field,
void** objects,
FT_UInt max_objects,
FT_ULong* pflags );
 
} PS_Parser_FuncsRec;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* PS_ParserRec */
/* */
/* <Description> */
/* A PS_Parser is an object used to parse a Type 1 font very quickly. */
/* */
/* <Fields> */
/* cursor :: The current position in the text. */
/* */
/* base :: Start of the processed text. */
/* */
/* limit :: End of the processed text. */
/* */
/* error :: The last error returned. */
/* */
/* memory :: The object used for memory operations (alloc/realloc). */
/* */
/* funcs :: A table of functions for the parser. */
/* */
typedef struct PS_ParserRec_
{
FT_Byte* cursor;
FT_Byte* base;
FT_Byte* limit;
FT_Error error;
FT_Memory memory;
 
PS_Parser_FuncsRec funcs;
 
} PS_ParserRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 BUILDER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
 
typedef struct T1_BuilderRec_* T1_Builder;
 
 
typedef FT_Error
(*T1_Builder_Check_Points_Func)( T1_Builder builder,
FT_Int count );
 
typedef void
(*T1_Builder_Add_Point_Func)( T1_Builder builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag );
 
typedef FT_Error
(*T1_Builder_Add_Point1_Func)( T1_Builder builder,
FT_Pos x,
FT_Pos y );
 
typedef FT_Error
(*T1_Builder_Add_Contour_Func)( T1_Builder builder );
 
typedef FT_Error
(*T1_Builder_Start_Point_Func)( T1_Builder builder,
FT_Pos x,
FT_Pos y );
 
typedef void
(*T1_Builder_Close_Contour_Func)( T1_Builder builder );
 
 
typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs;
 
typedef struct T1_Builder_FuncsRec_
{
void
(*init)( T1_Builder builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Bool hinting );
 
void
(*done)( T1_Builder builder );
 
T1_Builder_Check_Points_Func check_points;
T1_Builder_Add_Point_Func add_point;
T1_Builder_Add_Point1_Func add_point1;
T1_Builder_Add_Contour_Func add_contour;
T1_Builder_Start_Point_Func start_point;
T1_Builder_Close_Contour_Func close_contour;
 
} T1_Builder_FuncsRec;
 
 
/* an enumeration type to handle charstring parsing states */
typedef enum T1_ParseState_
{
T1_Parse_Start,
T1_Parse_Have_Width,
T1_Parse_Have_Moveto,
T1_Parse_Have_Path
 
} T1_ParseState;
 
 
/*************************************************************************/
/* */
/* <Structure> */
/* T1_BuilderRec */
/* */
/* <Description> */
/* A structure used during glyph loading to store its outline. */
/* */
/* <Fields> */
/* memory :: The current memory object. */
/* */
/* face :: The current face object. */
/* */
/* glyph :: The current glyph slot. */
/* */
/* loader :: XXX */
/* */
/* base :: The base glyph outline. */
/* */
/* current :: The current glyph outline. */
/* */
/* max_points :: maximum points in builder outline */
/* */
/* max_contours :: Maximum number of contours in builder outline. */
/* */
/* pos_x :: The horizontal translation (if composite glyph). */
/* */
/* pos_y :: The vertical translation (if composite glyph). */
/* */
/* left_bearing :: The left side bearing point. */
/* */
/* advance :: The horizontal advance vector. */
/* */
/* bbox :: Unused. */
/* */
/* parse_state :: An enumeration which controls the charstring */
/* parsing state. */
/* */
/* load_points :: If this flag is not set, no points are loaded. */
/* */
/* no_recurse :: Set but not used. */
/* */
/* metrics_only :: A boolean indicating that we only want to compute */
/* the metrics of a given glyph, not load all of its */
/* points. */
/* */
/* funcs :: An array of function pointers for the builder. */
/* */
typedef struct T1_BuilderRec_
{
FT_Memory memory;
FT_Face face;
FT_GlyphSlot glyph;
FT_GlyphLoader loader;
FT_Outline* base;
FT_Outline* current;
 
FT_Pos pos_x;
FT_Pos pos_y;
 
FT_Vector left_bearing;
FT_Vector advance;
 
FT_BBox bbox; /* bounding box */
T1_ParseState parse_state;
FT_Bool load_points;
FT_Bool no_recurse;
 
FT_Bool metrics_only;
 
void* hints_funcs; /* hinter-specific */
void* hints_globals; /* hinter-specific */
 
T1_Builder_FuncsRec funcs;
 
} T1_BuilderRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 DECODER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
#if 0
 
/*************************************************************************/
/* */
/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
/* calls during glyph loading. */
/* */
#define T1_MAX_SUBRS_CALLS 8
 
 
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
/* minimum of 16 is required. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
 
#endif /* 0 */
 
 
typedef struct T1_Decoder_ZoneRec_
{
FT_Byte* cursor;
FT_Byte* base;
FT_Byte* limit;
 
} T1_Decoder_ZoneRec, *T1_Decoder_Zone;
 
 
typedef struct T1_DecoderRec_* T1_Decoder;
typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs;
 
 
typedef FT_Error
(*T1_Decoder_Callback)( T1_Decoder decoder,
FT_UInt glyph_index );
 
 
typedef struct T1_Decoder_FuncsRec_
{
FT_Error
(*init)( T1_Decoder decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
PS_Blend blend,
FT_Bool hinting,
FT_Render_Mode hint_mode,
T1_Decoder_Callback callback );
 
void
(*done)( T1_Decoder decoder );
 
FT_Error
(*parse_charstrings)( T1_Decoder decoder,
FT_Byte* base,
FT_UInt len );
 
} T1_Decoder_FuncsRec;
 
 
typedef struct T1_DecoderRec_
{
T1_BuilderRec builder;
 
FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
FT_Long* top;
 
T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
T1_Decoder_Zone zone;
 
FT_Service_PsCMaps psnames; /* for seac */
FT_UInt num_glyphs;
FT_Byte** glyph_names;
 
FT_Int lenIV; /* internal for sub routine calls */
FT_UInt num_subrs;
FT_Byte** subrs;
FT_PtrDist* subrs_len; /* array of subrs length (optional) */
 
FT_Matrix font_matrix;
FT_Vector font_offset;
 
FT_Int flex_state;
FT_Int num_flex_vectors;
FT_Vector flex_vectors[7];
 
PS_Blend blend; /* for multiple master support */
 
FT_Render_Mode hint_mode;
 
T1_Decoder_Callback parse_callback;
T1_Decoder_FuncsRec funcs;
 
FT_Long* buildchar;
FT_UInt len_buildchar;
 
FT_Bool seac;
 
} T1_DecoderRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** AFM PARSER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
typedef struct AFM_ParserRec_* AFM_Parser;
 
typedef struct AFM_Parser_FuncsRec_
{
FT_Error
(*init)( AFM_Parser parser,
FT_Memory memory,
FT_Byte* base,
FT_Byte* limit );
 
void
(*done)( AFM_Parser parser );
 
FT_Error
(*parse)( AFM_Parser parser );
 
} AFM_Parser_FuncsRec;
 
 
typedef struct AFM_StreamRec_* AFM_Stream;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* AFM_ParserRec */
/* */
/* <Description> */
/* An AFM_Parser is a parser for the AFM files. */
/* */
/* <Fields> */
/* memory :: The object used for memory operations (alloc and */
/* realloc). */
/* */
/* stream :: This is an opaque object. */
/* */
/* FontInfo :: The result will be stored here. */
/* */
/* get_index :: A user provided function to get a glyph index by its */
/* name. */
/* */
typedef struct AFM_ParserRec_
{
FT_Memory memory;
AFM_Stream stream;
 
AFM_FontInfo FontInfo;
 
FT_Int
(*get_index)( const char* name,
FT_Offset len,
void* user_data );
 
void* user_data;
 
} AFM_ParserRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** TYPE1 CHARMAPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes;
 
typedef struct T1_CMap_ClassesRec_
{
FT_CMap_Class standard;
FT_CMap_Class expert;
FT_CMap_Class custom;
FT_CMap_Class unicode;
 
} T1_CMap_ClassesRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** PSAux Module Interface *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
typedef struct PSAux_ServiceRec_
{
/* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */
const PS_Table_FuncsRec* ps_table_funcs;
const PS_Parser_FuncsRec* ps_parser_funcs;
const T1_Builder_FuncsRec* t1_builder_funcs;
const T1_Decoder_FuncsRec* t1_decoder_funcs;
 
void
(*t1_decrypt)( FT_Byte* buffer,
FT_Offset length,
FT_UShort seed );
 
T1_CMap_Classes t1_cmap_classes;
 
/* fields after this comment line were added after version 2.1.10 */
const AFM_Parser_FuncsRec* afm_parser_funcs;
 
} PSAux_ServiceRec, *PSAux_Service;
 
/* backwards-compatible type definition */
typedef PSAux_ServiceRec PSAux_Interface;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** Some convenience functions *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
#define IS_PS_NEWLINE( ch ) \
( (ch) == '\r' || \
(ch) == '\n' )
 
#define IS_PS_SPACE( ch ) \
( (ch) == ' ' || \
IS_PS_NEWLINE( ch ) || \
(ch) == '\t' || \
(ch) == '\f' || \
(ch) == '\0' )
 
#define IS_PS_SPECIAL( ch ) \
( (ch) == '/' || \
(ch) == '(' || (ch) == ')' || \
(ch) == '<' || (ch) == '>' || \
(ch) == '[' || (ch) == ']' || \
(ch) == '{' || (ch) == '}' || \
(ch) == '%' )
 
#define IS_PS_DELIM( ch ) \
( IS_PS_SPACE( ch ) || \
IS_PS_SPECIAL( ch ) )
 
#define IS_PS_DIGIT( ch ) \
( (ch) >= '0' && (ch) <= '9' )
 
#define IS_PS_XDIGIT( ch ) \
( IS_PS_DIGIT( ch ) || \
( (ch) >= 'A' && (ch) <= 'F' ) || \
( (ch) >= 'a' && (ch) <= 'f' ) )
 
#define IS_PS_BASE85( ch ) \
( (ch) >= '!' && (ch) <= 'u' )
 
#define IS_PS_TOKEN( cur, limit, token ) \
( (char)(cur)[0] == (token)[0] && \
( (cur) + sizeof ( (token) ) == (limit) || \
( (cur) + sizeof( (token) ) < (limit) && \
IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \
ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )
 
 
FT_END_HEADER
 
#endif /* __PSAUX_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/pshints.h
0,0 → 1,722
/***************************************************************************/
/* */
/* pshints.h */
/* */
/* Interface to Postscript-specific (Type 1 and Type 2) hints */
/* recorders (specification only). These are used to support native */
/* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */
/* */
/* Copyright 2001-2003, 2005-2007, 2009, 2012 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 __PSHINTS_H__
#define __PSHINTS_H__
 
 
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TYPE1_TABLES_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** INTERNAL REPRESENTATION OF GLOBALS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
typedef struct PSH_GlobalsRec_* PSH_Globals;
 
typedef FT_Error
(*PSH_Globals_NewFunc)( FT_Memory memory,
T1_Private* private_dict,
PSH_Globals* aglobals );
 
typedef FT_Error
(*PSH_Globals_SetScaleFunc)( PSH_Globals globals,
FT_Fixed x_scale,
FT_Fixed y_scale,
FT_Fixed x_delta,
FT_Fixed y_delta );
 
typedef void
(*PSH_Globals_DestroyFunc)( PSH_Globals globals );
 
 
typedef struct PSH_Globals_FuncsRec_
{
PSH_Globals_NewFunc create;
PSH_Globals_SetScaleFunc set_scale;
PSH_Globals_DestroyFunc destroy;
 
} PSH_Globals_FuncsRec, *PSH_Globals_Funcs;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** PUBLIC TYPE 1 HINTS RECORDER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
/*************************************************************************
*
* @type:
* T1_Hints
*
* @description:
* This is a handle to an opaque structure used to record glyph hints
* from a Type 1 character glyph character string.
*
* The methods used to operate on this object are defined by the
* @T1_Hints_FuncsRec structure. Recording glyph hints is normally
* achieved through the following scheme:
*
* - Open a new hint recording session by calling the `open' method.
* This rewinds the recorder and prepare it for new input.
*
* - For each hint found in the glyph charstring, call the corresponding
* method (`stem', `stem3', or `reset'). Note that these functions do
* not return an error code.
*
* - Close the recording session by calling the `close' method. It
* returns an error code if the hints were invalid or something
* strange happened (e.g., memory shortage).
*
* The hints accumulated in the object can later be used by the
* PostScript hinter.
*
*/
typedef struct T1_HintsRec_* T1_Hints;
 
 
/*************************************************************************
*
* @type:
* T1_Hints_Funcs
*
* @description:
* A pointer to the @T1_Hints_FuncsRec structure that defines the API of
* a given @T1_Hints object.
*
*/
typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs;
 
 
/*************************************************************************
*
* @functype:
* T1_Hints_OpenFunc
*
* @description:
* A method of the @T1_Hints class used to prepare it for a new Type 1
* hints recording session.
*
* @input:
* hints ::
* A handle to the Type 1 hints recorder.
*
* @note:
* You should always call the @T1_Hints_CloseFunc method in order to
* close an opened recording session.
*
*/
typedef void
(*T1_Hints_OpenFunc)( T1_Hints hints );
 
 
/*************************************************************************
*
* @functype:
* T1_Hints_SetStemFunc
*
* @description:
* A method of the @T1_Hints class used to record a new horizontal or
* vertical stem. This corresponds to the Type 1 `hstem' and `vstem'
* operators.
*
* @input:
* hints ::
* A handle to the Type 1 hints recorder.
*
* dimension ::
* 0 for horizontal stems (hstem), 1 for vertical ones (vstem).
*
* coords ::
* Array of 2 coordinates in 16.16 format, used as (position,length)
* stem descriptor.
*
* @note:
* Use vertical coordinates (y) for horizontal stems (dim=0). Use
* horizontal coordinates (x) for vertical stems (dim=1).
*
* `coords[0]' is the absolute stem position (lowest coordinate);
* `coords[1]' is the length.
*
* The length can be negative, in which case it must be either -20 or
* -21. It is interpreted as a `ghost' stem, according to the Type 1
* specification.
*
* If the length is -21 (corresponding to a bottom ghost stem), then
* the real stem position is `coords[0]+coords[1]'.
*
*/
typedef void
(*T1_Hints_SetStemFunc)( T1_Hints hints,
FT_UInt dimension,
FT_Fixed* coords );
 
 
/*************************************************************************
*
* @functype:
* T1_Hints_SetStem3Func
*
* @description:
* A method of the @T1_Hints class used to record three
* counter-controlled horizontal or vertical stems at once.
*
* @input:
* hints ::
* A handle to the Type 1 hints recorder.
*
* dimension ::
* 0 for horizontal stems, 1 for vertical ones.
*
* coords ::
* An array of 6 values in 16.16 format, holding 3 (position,length)
* pairs for the counter-controlled stems.
*
* @note:
* Use vertical coordinates (y) for horizontal stems (dim=0). Use
* horizontal coordinates (x) for vertical stems (dim=1).
*
* The lengths cannot be negative (ghost stems are never
* counter-controlled).
*
*/
typedef void
(*T1_Hints_SetStem3Func)( T1_Hints hints,
FT_UInt dimension,
FT_Fixed* coords );
 
 
/*************************************************************************
*
* @functype:
* T1_Hints_ResetFunc
*
* @description:
* A method of the @T1_Hints class used to reset the stems hints in a
* recording session.
*
* @input:
* hints ::
* A handle to the Type 1 hints recorder.
*
* end_point ::
* The index of the last point in the input glyph in which the
* previously defined hints apply.
*
*/
typedef void
(*T1_Hints_ResetFunc)( T1_Hints hints,
FT_UInt end_point );
 
 
/*************************************************************************
*
* @functype:
* T1_Hints_CloseFunc
*
* @description:
* A method of the @T1_Hints class used to close a hint recording
* session.
*
* @input:
* hints ::
* A handle to the Type 1 hints recorder.
*
* end_point ::
* The index of the last point in the input glyph.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The error code is set to indicate that an error occurred during the
* recording session.
*
*/
typedef FT_Error
(*T1_Hints_CloseFunc)( T1_Hints hints,
FT_UInt end_point );
 
 
/*************************************************************************
*
* @functype:
* T1_Hints_ApplyFunc
*
* @description:
* A method of the @T1_Hints class used to apply hints to the
* corresponding glyph outline. Must be called once all hints have been
* recorded.
*
* @input:
* hints ::
* A handle to the Type 1 hints recorder.
*
* outline ::
* A pointer to the target outline descriptor.
*
* globals ::
* The hinter globals for this font.
*
* hint_mode ::
* Hinting information.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* On input, all points within the outline are in font coordinates. On
* output, they are in 1/64th of pixels.
*
* The scaling transformation is taken from the `globals' object which
* must correspond to the same font as the glyph.
*
*/
typedef FT_Error
(*T1_Hints_ApplyFunc)( T1_Hints hints,
FT_Outline* outline,
PSH_Globals globals,
FT_Render_Mode hint_mode );
 
 
/*************************************************************************
*
* @struct:
* T1_Hints_FuncsRec
*
* @description:
* The structure used to provide the API to @T1_Hints objects.
*
* @fields:
* hints ::
* A handle to the T1 Hints recorder.
*
* open ::
* The function to open a recording session.
*
* close ::
* The function to close a recording session.
*
* stem ::
* The function to set a simple stem.
*
* stem3 ::
* The function to set counter-controlled stems.
*
* reset ::
* The function to reset stem hints.
*
* apply ::
* The function to apply the hints to the corresponding glyph outline.
*
*/
typedef struct T1_Hints_FuncsRec_
{
T1_Hints hints;
T1_Hints_OpenFunc open;
T1_Hints_CloseFunc close;
T1_Hints_SetStemFunc stem;
T1_Hints_SetStem3Func stem3;
T1_Hints_ResetFunc reset;
T1_Hints_ApplyFunc apply;
 
} T1_Hints_FuncsRec;
 
 
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** PUBLIC TYPE 2 HINTS RECORDER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
 
/*************************************************************************
*
* @type:
* T2_Hints
*
* @description:
* This is a handle to an opaque structure used to record glyph hints
* from a Type 2 character glyph character string.
*
* The methods used to operate on this object are defined by the
* @T2_Hints_FuncsRec structure. Recording glyph hints is normally
* achieved through the following scheme:
*
* - Open a new hint recording session by calling the `open' method.
* This rewinds the recorder and prepare it for new input.
*
* - For each hint found in the glyph charstring, call the corresponding
* method (`stems', `hintmask', `counters'). Note that these
* functions do not return an error code.
*
* - Close the recording session by calling the `close' method. It
* returns an error code if the hints were invalid or something
* strange happened (e.g., memory shortage).
*
* The hints accumulated in the object can later be used by the
* Postscript hinter.
*
*/
typedef struct T2_HintsRec_* T2_Hints;
 
 
/*************************************************************************
*
* @type:
* T2_Hints_Funcs
*
* @description:
* A pointer to the @T2_Hints_FuncsRec structure that defines the API of
* a given @T2_Hints object.
*
*/
typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs;
 
 
/*************************************************************************
*
* @functype:
* T2_Hints_OpenFunc
*
* @description:
* A method of the @T2_Hints class used to prepare it for a new Type 2
* hints recording session.
*
* @input:
* hints ::
* A handle to the Type 2 hints recorder.
*
* @note:
* You should always call the @T2_Hints_CloseFunc method in order to
* close an opened recording session.
*
*/
typedef void
(*T2_Hints_OpenFunc)( T2_Hints hints );
 
 
/*************************************************************************
*
* @functype:
* T2_Hints_StemsFunc
*
* @description:
* A method of the @T2_Hints class used to set the table of stems in
* either the vertical or horizontal dimension. Equivalent to the
* `hstem', `vstem', `hstemhm', and `vstemhm' Type 2 operators.
*
* @input:
* hints ::
* A handle to the Type 2 hints recorder.
*
* dimension ::
* 0 for horizontal stems (hstem), 1 for vertical ones (vstem).
*
* count ::
* The number of stems.
*
* coords ::
* An array of `count' (position,length) pairs in 16.16 format.
*
* @note:
* Use vertical coordinates (y) for horizontal stems (dim=0). Use
* horizontal coordinates (x) for vertical stems (dim=1).
*
* There are `2*count' elements in the `coords' array. Each even
* element is an absolute position in font units, each odd element is a
* length in font units.
*
* A length can be negative, in which case it must be either -20 or
* -21. It is interpreted as a `ghost' stem, according to the Type 1
* specification.
*
*/
typedef void
(*T2_Hints_StemsFunc)( T2_Hints hints,
FT_UInt dimension,
FT_UInt count,
FT_Fixed* coordinates );
 
 
/*************************************************************************
*
* @functype:
* T2_Hints_MaskFunc
*
* @description:
* A method of the @T2_Hints class used to set a given hintmask (this
* corresponds to the `hintmask' Type 2 operator).
*
* @input:
* hints ::
* A handle to the Type 2 hints recorder.
*
* end_point ::
* The glyph index of the last point to which the previously defined
* or activated hints apply.
*
* bit_count ::
* The number of bits in the hint mask.
*
* bytes ::
* An array of bytes modelling the hint mask.
*
* @note:
* If the hintmask starts the charstring (before any glyph point
* definition), the value of `end_point' should be 0.
*
* `bit_count' is the number of meaningful bits in the `bytes' array; it
* must be equal to the total number of hints defined so far (i.e.,
* horizontal+verticals).
*
* The `bytes' array can come directly from the Type 2 charstring and
* respects the same format.
*
*/
typedef void
(*T2_Hints_MaskFunc)( T2_Hints hints,
FT_UInt end_point,
FT_UInt bit_count,
const FT_Byte* bytes );
 
 
/*************************************************************************
*
* @functype:
* T2_Hints_CounterFunc
*
* @description:
* A method of the @T2_Hints class used to set a given counter mask
* (this corresponds to the `hintmask' Type 2 operator).
*
* @input:
* hints ::
* A handle to the Type 2 hints recorder.
*
* end_point ::
* A glyph index of the last point to which the previously defined or
* active hints apply.
*
* bit_count ::
* The number of bits in the hint mask.
*
* bytes ::
* An array of bytes modelling the hint mask.
*
* @note:
* If the hintmask starts the charstring (before any glyph point
* definition), the value of `end_point' should be 0.
*
* `bit_count' is the number of meaningful bits in the `bytes' array; it
* must be equal to the total number of hints defined so far (i.e.,
* horizontal+verticals).
*
* The `bytes' array can come directly from the Type 2 charstring and
* respects the same format.
*
*/
typedef void
(*T2_Hints_CounterFunc)( T2_Hints hints,
FT_UInt bit_count,
const FT_Byte* bytes );
 
 
/*************************************************************************
*
* @functype:
* T2_Hints_CloseFunc
*
* @description:
* A method of the @T2_Hints class used to close a hint recording
* session.
*
* @input:
* hints ::
* A handle to the Type 2 hints recorder.
*
* end_point ::
* The index of the last point in the input glyph.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The error code is set to indicate that an error occurred during the
* recording session.
*
*/
typedef FT_Error
(*T2_Hints_CloseFunc)( T2_Hints hints,
FT_UInt end_point );
 
 
/*************************************************************************
*
* @functype:
* T2_Hints_ApplyFunc
*
* @description:
* A method of the @T2_Hints class used to apply hints to the
* corresponding glyph outline. Must be called after the `close'
* method.
*
* @input:
* hints ::
* A handle to the Type 2 hints recorder.
*
* outline ::
* A pointer to the target outline descriptor.
*
* globals ::
* The hinter globals for this font.
*
* hint_mode ::
* Hinting information.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* On input, all points within the outline are in font coordinates. On
* output, they are in 1/64th of pixels.
*
* The scaling transformation is taken from the `globals' object which
* must correspond to the same font than the glyph.
*
*/
typedef FT_Error
(*T2_Hints_ApplyFunc)( T2_Hints hints,
FT_Outline* outline,
PSH_Globals globals,
FT_Render_Mode hint_mode );
 
 
/*************************************************************************
*
* @struct:
* T2_Hints_FuncsRec
*
* @description:
* The structure used to provide the API to @T2_Hints objects.
*
* @fields:
* hints ::
* A handle to the T2 hints recorder object.
*
* open ::
* The function to open a recording session.
*
* close ::
* The function to close a recording session.
*
* stems ::
* The function to set the dimension's stems table.
*
* hintmask ::
* The function to set hint masks.
*
* counter ::
* The function to set counter masks.
*
* apply ::
* The function to apply the hints on the corresponding glyph outline.
*
*/
typedef struct T2_Hints_FuncsRec_
{
T2_Hints hints;
T2_Hints_OpenFunc open;
T2_Hints_CloseFunc close;
T2_Hints_StemsFunc stems;
T2_Hints_MaskFunc hintmask;
T2_Hints_CounterFunc counter;
T2_Hints_ApplyFunc apply;
 
} T2_Hints_FuncsRec;
 
 
/* */
 
 
typedef struct PSHinter_Interface_
{
PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module );
T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module );
T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module );
 
} PSHinter_Interface;
 
typedef PSHinter_Interface* PSHinter_Service;
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_PSHINTER_INTERFACE( \
class_, \
get_globals_funcs_, \
get_t1_funcs_, \
get_t2_funcs_ ) \
static const PSHinter_Interface class_ = \
{ \
get_globals_funcs_, \
get_t1_funcs_, \
get_t2_funcs_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_PSHINTER_INTERFACE( \
class_, \
get_globals_funcs_, \
get_t1_funcs_, \
get_t2_funcs_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
PSHinter_Interface* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->get_globals_funcs = get_globals_funcs_; \
clazz->get_t1_funcs = get_t1_funcs_; \
clazz->get_t2_funcs = get_t2_funcs_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
FT_END_HEADER
 
#endif /* __PSHINTS_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svbdf.h
0,0 → 1,82
/***************************************************************************/
/* */
/* svbdf.h */
/* */
/* The FreeType BDF services (specification). */
/* */
/* Copyright 2003, 2009, 2012 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 __SVBDF_H__
#define __SVBDF_H__
 
#include FT_BDF_H
#include FT_INTERNAL_SERVICE_H
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_BDF "bdf"
 
typedef FT_Error
(*FT_BDF_GetCharsetIdFunc)( FT_Face face,
const char* *acharset_encoding,
const char* *acharset_registry );
 
typedef FT_Error
(*FT_BDF_GetPropertyFunc)( FT_Face face,
const char* prop_name,
BDF_PropertyRec *aproperty );
 
 
FT_DEFINE_SERVICE( BDF )
{
FT_BDF_GetCharsetIdFunc get_charset_id;
FT_BDF_GetPropertyFunc get_property;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_BDFRec( class_, \
get_charset_id_, \
get_property_ ) \
static const FT_Service_BDFRec class_ = \
{ \
get_charset_id_, get_property_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_BDFRec( class_, \
get_charset_id_, \
get_property_ ) \
void \
FT_Init_Class_ ## class_( FT_Service_BDFRec* clazz ) \
{ \
clazz->get_charset_id = get_charset_id_; \
clazz->get_property = get_property_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVBDF_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svcid.h
0,0 → 1,89
/***************************************************************************/
/* */
/* svcid.h */
/* */
/* The FreeType CID font services (specification). */
/* */
/* Copyright 2007, 2009, 2012 by Derek Clegg, Michael Toftdal. */
/* */
/* 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 __SVCID_H__
#define __SVCID_H__
 
#include FT_INTERNAL_SERVICE_H
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_CID "CID"
 
typedef FT_Error
(*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face,
const char* *registry,
const char* *ordering,
FT_Int *supplement );
typedef FT_Error
(*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face,
FT_Bool *is_cid );
typedef FT_Error
(*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face,
FT_UInt glyph_index,
FT_UInt *cid );
 
FT_DEFINE_SERVICE( CID )
{
FT_CID_GetRegistryOrderingSupplementFunc get_ros;
FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid;
FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_CIDREC( class_, \
get_ros_, \
get_is_cid_, \
get_cid_from_glyph_index_ ) \
static const FT_Service_CIDRec class_ = \
{ \
get_ros_, get_is_cid_, get_cid_from_glyph_index_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_CIDREC( class_, \
get_ros_, \
get_is_cid_, \
get_cid_from_glyph_index_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_CIDRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->get_ros = get_ros_; \
clazz->get_is_cid = get_is_cid_; \
clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVCID_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svgldict.h
0,0 → 1,88
/***************************************************************************/
/* */
/* svgldict.h */
/* */
/* The FreeType glyph dictionary services (specification). */
/* */
/* Copyright 2003, 2009, 2012 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 __SVGLDICT_H__
#define __SVGLDICT_H__
 
#include FT_INTERNAL_SERVICE_H
 
 
FT_BEGIN_HEADER
 
 
/*
* A service used to retrieve glyph names, as well as to find the
* index of a given glyph name in a font.
*
*/
 
#define FT_SERVICE_ID_GLYPH_DICT "glyph-dict"
 
 
typedef FT_Error
(*FT_GlyphDict_GetNameFunc)( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max );
 
typedef FT_UInt
(*FT_GlyphDict_NameIndexFunc)( FT_Face face,
FT_String* glyph_name );
 
 
FT_DEFINE_SERVICE( GlyphDict )
{
FT_GlyphDict_GetNameFunc get_name;
FT_GlyphDict_NameIndexFunc name_index; /* optional */
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
get_name_, \
name_index_) \
static const FT_Service_GlyphDictRec class_ = \
{ \
get_name_, name_index_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
get_name_, \
name_index_) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_GlyphDictRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->get_name = get_name_; \
clazz->name_index = name_index_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVGLDICT_H__ */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svgxval.h
0,0 → 1,72
/***************************************************************************/
/* */
/* svgxval.h */
/* */
/* FreeType API for validating TrueTypeGX/AAT tables (specification). */
/* */
/* Copyright 2004, 2005 by */
/* Masatake YAMATO, Red Hat K.K., */
/* 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. */
/* */
/***************************************************************************/
 
/***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout is supported by the Information-technology */
/* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/
 
 
#ifndef __SVGXVAL_H__
#define __SVGXVAL_H__
 
#include FT_GX_VALIDATE_H
#include FT_INTERNAL_VALIDATE_H
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_GX_VALIDATE "truetypegx-validate"
#define FT_SERVICE_ID_CLASSICKERN_VALIDATE "classickern-validate"
 
typedef FT_Error
(*gxv_validate_func)( FT_Face face,
FT_UInt gx_flags,
FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
FT_UInt table_length );
 
 
typedef FT_Error
(*ckern_validate_func)( FT_Face face,
FT_UInt ckern_flags,
FT_Bytes *ckern_table );
 
 
FT_DEFINE_SERVICE( GXvalidate )
{
gxv_validate_func validate;
};
 
FT_DEFINE_SERVICE( CKERNvalidate )
{
ckern_validate_func validate;
};
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVGXVAL_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svkern.h
0,0 → 1,51
/***************************************************************************/
/* */
/* svkern.h */
/* */
/* The FreeType Kerning service (specification). */
/* */
/* Copyright 2006 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 __SVKERN_H__
#define __SVKERN_H__
 
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
 
 
FT_BEGIN_HEADER
 
#define FT_SERVICE_ID_KERNING "kerning"
 
 
typedef FT_Error
(*FT_Kerning_TrackGetFunc)( FT_Face face,
FT_Fixed point_size,
FT_Int degree,
FT_Fixed* akerning );
 
FT_DEFINE_SERVICE( Kerning )
{
FT_Kerning_TrackGetFunc get_track;
};
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVKERN_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svmm.h
0,0 → 1,113
/***************************************************************************/
/* */
/* svmm.h */
/* */
/* The FreeType Multiple Masters and GX var services (specification). */
/* */
/* Copyright 2003, 2004, 2009, 2012 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 __SVMM_H__
#define __SVMM_H__
 
#include FT_INTERNAL_SERVICE_H
 
 
FT_BEGIN_HEADER
 
 
/*
* A service used to manage multiple-masters data in a given face.
*
* See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).
*
*/
 
#define FT_SERVICE_ID_MULTI_MASTERS "multi-masters"
 
 
typedef FT_Error
(*FT_Get_MM_Func)( FT_Face face,
FT_Multi_Master* master );
 
typedef FT_Error
(*FT_Get_MM_Var_Func)( FT_Face face,
FT_MM_Var* *master );
 
typedef FT_Error
(*FT_Set_MM_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
 
typedef FT_Error
(*FT_Set_Var_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords );
 
typedef FT_Error
(*FT_Set_MM_Blend_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
 
 
FT_DEFINE_SERVICE( MultiMasters )
{
FT_Get_MM_Func get_mm;
FT_Set_MM_Design_Func set_mm_design;
FT_Set_MM_Blend_Func set_mm_blend;
FT_Get_MM_Var_Func get_mm_var;
FT_Set_Var_Design_Func set_var_design;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
get_mm_, \
set_mm_design_, \
set_mm_blend_, \
get_mm_var_, \
set_var_design_ ) \
static const FT_Service_MultiMastersRec class_ = \
{ \
get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
get_mm_, \
set_mm_design_, \
set_mm_blend_, \
get_mm_var_, \
set_var_design_ ) \
void \
FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \
{ \
clazz->get_mm = get_mm_; \
clazz->set_mm_design = set_mm_design_; \
clazz->set_mm_blend = set_mm_blend_; \
clazz->get_mm_var = get_mm_var_; \
clazz->set_var_design = set_var_design_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
#endif /* __SVMM_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svotval.h
0,0 → 1,55
/***************************************************************************/
/* */
/* svotval.h */
/* */
/* The FreeType OpenType validation service (specification). */
/* */
/* Copyright 2004, 2006 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 __SVOTVAL_H__
#define __SVOTVAL_H__
 
#include FT_OPENTYPE_VALIDATE_H
#include FT_INTERNAL_VALIDATE_H
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate"
 
 
typedef FT_Error
(*otv_validate_func)( FT_Face volatile face,
FT_UInt ot_flags,
FT_Bytes *base,
FT_Bytes *gdef,
FT_Bytes *gpos,
FT_Bytes *gsub,
FT_Bytes *jstf );
 
 
FT_DEFINE_SERVICE( OTvalidate )
{
otv_validate_func validate;
};
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVOTVAL_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svpfr.h
0,0 → 1,66
/***************************************************************************/
/* */
/* svpfr.h */
/* */
/* Internal PFR service functions (specification). */
/* */
/* Copyright 2003, 2006 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 __SVPFR_H__
#define __SVPFR_H__
 
#include FT_PFR_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,
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 )
{
FT_PFR_GetMetricsFunc get_metrics;
FT_PFR_GetKerningFunc get_kerning;
FT_PFR_GetAdvanceFunc get_advance;
 
};
 
/* */
 
FT_END_HEADER
 
#endif /* __SVPFR_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svpostnm.h
0,0 → 1,81
/***************************************************************************/
/* */
/* svpostnm.h */
/* */
/* The FreeType PostScript name services (specification). */
/* */
/* Copyright 2003, 2007, 2009, 2012 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 __SVPOSTNM_H__
#define __SVPOSTNM_H__
 
#include FT_INTERNAL_SERVICE_H
 
 
FT_BEGIN_HEADER
 
/*
* A trivial service used to retrieve the PostScript name of a given
* font when available. The `get_name' field should never be NULL.
*
* The corresponding function can return NULL to indicate that the
* PostScript name is not available.
*
* The name is owned by the face and will be destroyed with it.
*/
 
#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name"
 
 
typedef const char*
(*FT_PsName_GetFunc)( FT_Face face );
 
 
FT_DEFINE_SERVICE( PsFontName )
{
FT_PsName_GetFunc get_ps_font_name;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
static const FT_Service_PsFontNameRec class_ = \
{ \
get_ps_font_name_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_PsFontNameRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->get_ps_font_name = get_ps_font_name_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVPOSTNM_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svprop.h
0,0 → 1,81
/***************************************************************************/
/* */
/* svprop.h */
/* */
/* The FreeType property service (specification). */
/* */
/* Copyright 2012 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 __SVPROP_H__
#define __SVPROP_H__
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_PROPERTIES "properties"
 
 
typedef FT_Error
(*FT_Properties_SetFunc)( FT_Module module,
const char* property_name,
const void* value );
 
typedef FT_Error
(*FT_Properties_GetFunc)( FT_Module module,
const char* property_name,
void* value );
 
 
FT_DEFINE_SERVICE( Properties )
{
FT_Properties_SetFunc set_property;
FT_Properties_GetFunc get_property;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \
set_property_, \
get_property_ ) \
static const FT_Service_PropertiesRec class_ = \
{ \
set_property_, \
get_property_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \
set_property_, \
get_property_ ) \
void \
FT_Init_Class_ ## class_( FT_Service_PropertiesRec* clazz ) \
{ \
clazz->set_property = set_property_; \
clazz->get_property = get_property_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVPROP_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svpscmap.h
0,0 → 1,177
/***************************************************************************/
/* */
/* svpscmap.h */
/* */
/* The FreeType PostScript charmap service (specification). */
/* */
/* Copyright 2003, 2006, 2009, 2012 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 __SVPSCMAP_H__
#define __SVPSCMAP_H__
 
#include FT_INTERNAL_OBJECTS_H
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps"
 
 
/*
* Adobe glyph name to unicode value.
*/
typedef FT_UInt32
(*PS_Unicode_ValueFunc)( const char* glyph_name );
 
/*
* Macintosh name id to glyph name. NULL if invalid index.
*/
typedef const char*
(*PS_Macintosh_NameFunc)( FT_UInt name_index );
 
/*
* Adobe standard string ID to glyph name. NULL if invalid index.
*/
typedef const char*
(*PS_Adobe_Std_StringsFunc)( FT_UInt string_index );
 
 
/*
* Simple unicode -> glyph index charmap built from font glyph names
* table.
*/
typedef struct PS_UniMap_
{
FT_UInt32 unicode; /* bit 31 set: is glyph variant */
FT_UInt glyph_index;
 
} PS_UniMap;
 
 
typedef struct PS_UnicodesRec_* PS_Unicodes;
 
typedef struct PS_UnicodesRec_
{
FT_CMapRec cmap;
FT_UInt num_maps;
PS_UniMap* maps;
 
} PS_UnicodesRec;
 
 
/*
* A function which returns a glyph name for a given index. Returns
* NULL if invalid index.
*/
typedef const char*
(*PS_GetGlyphNameFunc)( FT_Pointer data,
FT_UInt string_index );
 
/*
* A function used to release the glyph name returned by
* PS_GetGlyphNameFunc, when needed
*/
typedef void
(*PS_FreeGlyphNameFunc)( FT_Pointer data,
const char* name );
 
typedef FT_Error
(*PS_Unicodes_InitFunc)( FT_Memory memory,
PS_Unicodes unicodes,
FT_UInt num_glyphs,
PS_GetGlyphNameFunc get_glyph_name,
PS_FreeGlyphNameFunc free_glyph_name,
FT_Pointer glyph_data );
 
typedef FT_UInt
(*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,
FT_UInt32 unicode );
 
typedef FT_UInt32
(*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,
FT_UInt32 *unicode );
 
 
FT_DEFINE_SERVICE( PsCMaps )
{
PS_Unicode_ValueFunc unicode_value;
 
PS_Unicodes_InitFunc unicodes_init;
PS_Unicodes_CharIndexFunc unicodes_char_index;
PS_Unicodes_CharNextFunc unicodes_char_next;
 
PS_Macintosh_NameFunc macintosh_name;
PS_Adobe_Std_StringsFunc adobe_std_strings;
const unsigned short* adobe_std_encoding;
const unsigned short* adobe_expert_encoding;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
unicode_value_, \
unicodes_init_, \
unicodes_char_index_, \
unicodes_char_next_, \
macintosh_name_, \
adobe_std_strings_, \
adobe_std_encoding_, \
adobe_expert_encoding_ ) \
static const FT_Service_PsCMapsRec class_ = \
{ \
unicode_value_, unicodes_init_, \
unicodes_char_index_, unicodes_char_next_, macintosh_name_, \
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
unicode_value_, \
unicodes_init_, \
unicodes_char_index_, \
unicodes_char_next_, \
macintosh_name_, \
adobe_std_strings_, \
adobe_std_encoding_, \
adobe_expert_encoding_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_PsCMapsRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->unicode_value = unicode_value_; \
clazz->unicodes_init = unicodes_init_; \
clazz->unicodes_char_index = unicodes_char_index_; \
clazz->unicodes_char_next = unicodes_char_next_; \
clazz->macintosh_name = macintosh_name_; \
clazz->adobe_std_strings = adobe_std_strings_; \
clazz->adobe_std_encoding = adobe_std_encoding_; \
clazz->adobe_expert_encoding = adobe_expert_encoding_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVPSCMAP_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svpsinfo.h
0,0 → 1,111
/***************************************************************************/
/* */
/* svpsinfo.h */
/* */
/* The FreeType PostScript info service (specification). */
/* */
/* Copyright 2003, 2004, 2009, 2011, 2012 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 __SVPSINFO_H__
#define __SVPSINFO_H__
 
#include FT_INTERNAL_SERVICE_H
#include FT_INTERNAL_TYPE1_TYPES_H
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info"
 
 
typedef FT_Error
(*PS_GetFontInfoFunc)( FT_Face face,
PS_FontInfoRec* afont_info );
 
typedef FT_Error
(*PS_GetFontExtraFunc)( FT_Face face,
PS_FontExtraRec* afont_extra );
 
typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face );
 
typedef FT_Error
(*PS_GetFontPrivateFunc)( FT_Face face,
PS_PrivateRec* afont_private );
 
typedef FT_Long
(*PS_GetFontValueFunc)( FT_Face face,
PS_Dict_Keys key,
FT_UInt idx,
void *value,
FT_Long value_len );
 
 
FT_DEFINE_SERVICE( PsInfo )
{
PS_GetFontInfoFunc ps_get_font_info;
PS_GetFontExtraFunc ps_get_font_extra;
PS_HasGlyphNamesFunc ps_has_glyph_names;
PS_GetFontPrivateFunc ps_get_font_private;
PS_GetFontValueFunc ps_get_font_value;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_PSINFOREC( class_, \
get_font_info_, \
ps_get_font_extra_, \
has_glyph_names_, \
get_font_private_, \
get_font_value_ ) \
static const FT_Service_PsInfoRec class_ = \
{ \
get_font_info_, ps_get_font_extra_, has_glyph_names_, \
get_font_private_, get_font_value_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_PSINFOREC( class_, \
get_font_info_, \
ps_get_font_extra_, \
has_glyph_names_, \
get_font_private_, \
get_font_value_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_PsInfoRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->ps_get_font_info = get_font_info_; \
clazz->ps_get_font_extra = ps_get_font_extra_; \
clazz->ps_has_glyph_names = has_glyph_names_; \
clazz->ps_get_font_private = get_font_private_; \
clazz->ps_get_font_value = get_font_value_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVPSINFO_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svsfnt.h
0,0 → 1,103
/***************************************************************************/
/* */
/* svsfnt.h */
/* */
/* The FreeType SFNT table loading service (specification). */
/* */
/* Copyright 2003, 2004, 2009, 2012 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 __SVSFNT_H__
#define __SVSFNT_H__
 
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
 
 
FT_BEGIN_HEADER
 
 
/*
* SFNT table loading service.
*/
 
#define FT_SERVICE_ID_SFNT_TABLE "sfnt-table"
 
 
/*
* Used to implement FT_Load_Sfnt_Table().
*/
typedef FT_Error
(*FT_SFNT_TableLoadFunc)( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
 
/*
* Used to implement FT_Get_Sfnt_Table().
*/
typedef void*
(*FT_SFNT_TableGetFunc)( FT_Face face,
FT_Sfnt_Tag tag );
 
 
/*
* Used to implement FT_Sfnt_Table_Info().
*/
typedef FT_Error
(*FT_SFNT_TableInfoFunc)( FT_Face face,
FT_UInt idx,
FT_ULong *tag,
FT_ULong *offset,
FT_ULong *length );
 
 
FT_DEFINE_SERVICE( SFNT_Table )
{
FT_SFNT_TableLoadFunc load_table;
FT_SFNT_TableGetFunc get_table;
FT_SFNT_TableInfoFunc table_info;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
static const FT_Service_SFNT_TableRec class_ = \
{ \
load_, get_, info_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
void \
FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec* clazz ) \
{ \
clazz->load_table = load_; \
clazz->get_table = get_; \
clazz->table_info = info_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVSFNT_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svttcmap.h
0,0 → 1,107
/***************************************************************************/
/* */
/* svttcmap.h */
/* */
/* The FreeType TrueType/sfnt cmap extra information service. */
/* */
/* Copyright 2003 by */
/* Masatake YAMATO, Redhat K.K. */
/* */
/* Copyright 2003, 2008, 2009, 2012 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. */
/* */
/***************************************************************************/
 
/* Development of this service is support of
Information-technology Promotion Agency, Japan. */
 
#ifndef __SVTTCMAP_H__
#define __SVTTCMAP_H__
 
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapInfo */
/* */
/* <Description> */
/* A structure used to store TrueType/sfnt specific cmap information */
/* which is not covered by the generic @FT_CharMap structure. This */
/* structure can be accessed with the @FT_Get_TT_CMap_Info function. */
/* */
/* <Fields> */
/* language :: */
/* The language ID used in Mac fonts. Definitions of values are in */
/* freetype/ttnameid.h. */
/* */
/* format :: */
/* The cmap format. OpenType 1.5 defines the formats 0 (byte */
/* encoding table), 2~(high-byte mapping through table), 4~(segment */
/* mapping to delta values), 6~(trimmed table mapping), 8~(mixed */
/* 16-bit and 32-bit coverage), 10~(trimmed array), 12~(segmented */
/* coverage), and 14 (Unicode Variation Sequences). */
/* */
typedef struct TT_CMapInfo_
{
FT_ULong language;
FT_Long format;
 
} TT_CMapInfo;
 
 
typedef FT_Error
(*TT_CMap_Info_GetFunc)( FT_CharMap charmap,
TT_CMapInfo *cmap_info );
 
 
FT_DEFINE_SERVICE( TTCMaps )
{
TT_CMap_Info_GetFunc get_cmap_info;
};
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
static const FT_Service_TTCMapsRec class_ = \
{ \
get_cmap_info_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_TTCMapsRec* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->get_cmap_info = get_cmap_info_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
#endif /* __SVTTCMAP_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svtteng.h
0,0 → 1,53
/***************************************************************************/
/* */
/* svtteng.h */
/* */
/* The FreeType TrueType engine query service (specification). */
/* */
/* Copyright 2006 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 __SVTTENG_H__
#define __SVTTENG_H__
 
#include FT_INTERNAL_SERVICE_H
#include FT_MODULE_H
 
 
FT_BEGIN_HEADER
 
 
/*
* SFNT table loading service.
*/
 
#define FT_SERVICE_ID_TRUETYPE_ENGINE "truetype-engine"
 
/*
* Used to implement FT_Get_TrueType_Engine_Type
*/
 
FT_DEFINE_SERVICE( TrueTypeEngine )
{
FT_TrueTypeEngineType engine_type;
};
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVTTENG_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svttglyf.h
0,0 → 1,68
/***************************************************************************/
/* */
/* svttglyf.h */
/* */
/* The FreeType TrueType glyph service. */
/* */
/* Copyright 2007, 2009, 2012 by David Turner. */
/* */
/* 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 __SVTTGLYF_H__
#define __SVTTGLYF_H__
 
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
 
 
FT_BEGIN_HEADER
 
 
#define FT_SERVICE_ID_TT_GLYF "tt-glyf"
 
 
typedef FT_ULong
(*TT_Glyf_GetLocationFunc)( FT_Face face,
FT_UInt gindex,
FT_ULong *psize );
 
FT_DEFINE_SERVICE( TTGlyf )
{
TT_Glyf_GetLocationFunc get_location;
};
 
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
static const FT_Service_TTGlyfRec class_ = \
{ \
get_location_ \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
void \
FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \
{ \
clazz->get_location = get_location_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
/* */
 
 
FT_END_HEADER
 
#endif /* __SVTTGLYF_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svwinfnt.h
0,0 → 1,50
/***************************************************************************/
/* */
/* svwinfnt.h */
/* */
/* The FreeType Windows FNT/FONT service (specification). */
/* */
/* 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 */
/contrib/sdk/sources/freetype/include/freetype/internal/services/svxf86nm.h
0,0 → 1,55
/***************************************************************************/
/* */
/* svxf86nm.h */
/* */
/* The FreeType XFree86 services (specification only). */
/* */
/* 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 __SVXF86NM_H__
#define __SVXF86NM_H__
 
#include FT_INTERNAL_SERVICE_H
 
 
FT_BEGIN_HEADER
 
 
/*
* A trivial service used to return the name of a face's font driver,
* according to the XFree86 nomenclature. Note that the service data
* is a simple constant string pointer.
*/
 
#define FT_SERVICE_ID_XF86_NAME "xf86-driver-name"
 
#define FT_XF86_FORMAT_TRUETYPE "TrueType"
#define FT_XF86_FORMAT_TYPE_1 "Type 1"
#define FT_XF86_FORMAT_BDF "BDF"
#define FT_XF86_FORMAT_PCF "PCF"
#define FT_XF86_FORMAT_TYPE_42 "Type 42"
#define FT_XF86_FORMAT_CID "CID Type 1"
#define FT_XF86_FORMAT_CFF "CFF"
#define FT_XF86_FORMAT_PFR "PFR"
#define FT_XF86_FORMAT_WINFNT "Windows FNT"
 
/* */
 
 
FT_END_HEADER
 
 
#endif /* __SVXF86NM_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/sfnt.h
0,0 → 1,707
/***************************************************************************/
/* */
/* sfnt.h */
/* */
/* High-level `sfnt' driver interface (specification). */
/* */
/* Copyright 1996-2006, 2009, 2012-2013 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 __SFNT_H__
#define __SFNT_H__
 
 
#include <ft2build.h>
#include FT_INTERNAL_DRIVER_H
#include FT_INTERNAL_TRUETYPE_TYPES_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Init_Face_Func */
/* */
/* <Description> */
/* First part of the SFNT face object initialization. This finds */
/* the face in a SFNT file or collection, and load its format tag in */
/* face->format_tag. */
/* */
/* <Input> */
/* stream :: The input stream. */
/* */
/* face :: A handle to the target face object. */
/* */
/* face_index :: The index of the TrueType font, if we are opening a */
/* collection. */
/* */
/* num_params :: The number of additional parameters. */
/* */
/* params :: Optional additional parameters. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The stream cursor must be at the font file's origin. */
/* */
/* This function recognizes fonts embedded in a `TrueType */
/* collection'. */
/* */
/* Once the format tag has been validated by the font driver, it */
/* should then call the TT_Load_Face_Func() callback to read the rest */
/* of the SFNT tables in the object. */
/* */
typedef FT_Error
(*TT_Init_Face_Func)( FT_Stream stream,
TT_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_Face_Func */
/* */
/* <Description> */
/* Second part of the SFNT face object initialization. This loads */
/* the common SFNT tables (head, OS/2, maxp, metrics, etc.) in the */
/* face object. */
/* */
/* <Input> */
/* stream :: The input stream. */
/* */
/* face :: A handle to the target face object. */
/* */
/* face_index :: The index of the TrueType font, if we are opening a */
/* collection. */
/* */
/* num_params :: The number of additional parameters. */
/* */
/* params :: Optional additional parameters. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function must be called after TT_Init_Face_Func(). */
/* */
typedef FT_Error
(*TT_Load_Face_Func)( FT_Stream stream,
TT_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Done_Face_Func */
/* */
/* <Description> */
/* A callback used to delete the common SFNT data from a face. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* */
/* <Note> */
/* This function does NOT destroy the face object. */
/* */
typedef void
(*TT_Done_Face_Func)( TT_Face face );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_Any_Func */
/* */
/* <Description> */
/* Load any font table into client memory. */
/* */
/* <Input> */
/* face :: The face object to look for. */
/* */
/* tag :: The tag of table to load. Use the value 0 if you want */
/* to access the whole font file, else set this parameter */
/* to a valid TrueType table tag that you can forge with */
/* the MAKE_TT_TAG macro. */
/* */
/* offset :: The starting offset in the table (or the file if */
/* tag == 0). */
/* */
/* length :: The address of the decision variable: */
/* */
/* If length == NULL: */
/* Loads the whole table. Returns an error if */
/* `offset' == 0! */
/* */
/* If *length == 0: */
/* Exits immediately; returning the length of the given */
/* table or of the font file, depending on the value of */
/* `tag'. */
/* */
/* If *length != 0: */
/* Loads the next `length' bytes of table or font, */
/* starting at offset `offset' (in table or font too). */
/* */
/* <Output> */
/* buffer :: The address of target buffer. */
/* */
/* <Return> */
/* TrueType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_Load_Any_Func)( TT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte *buffer,
FT_ULong* length );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Find_SBit_Image_Func */
/* */
/* <Description> */
/* Check whether an embedded bitmap (an `sbit') exists for a given */
/* glyph, at a given strike. */
/* */
/* <Input> */
/* face :: The target face object. */
/* */
/* glyph_index :: The glyph index. */
/* */
/* strike_index :: The current strike index. */
/* */
/* <Output> */
/* arange :: The SBit range containing the glyph index. */
/* */
/* astrike :: The SBit strike containing the glyph index. */
/* */
/* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns */
/* SFNT_Err_Invalid_Argument if no sbit exists for the requested */
/* glyph. */
/* */
typedef FT_Error
(*TT_Find_SBit_Image_Func)( TT_Face face,
FT_UInt glyph_index,
FT_ULong strike_index,
TT_SBit_Range *arange,
TT_SBit_Strike *astrike,
FT_ULong *aglyph_offset );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_SBit_Metrics_Func */
/* */
/* <Description> */
/* Get the big metrics for a given embedded bitmap. */
/* */
/* <Input> */
/* stream :: The input stream. */
/* */
/* range :: The SBit range containing the glyph. */
/* */
/* <Output> */
/* big_metrics :: A big SBit metrics structure for the glyph. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The stream cursor must be positioned at the glyph's offset within */
/* the `EBDT' table before the call. */
/* */
/* If the image format uses variable metrics, the stream cursor is */
/* positioned just after the metrics header in the `EBDT' table on */
/* function exit. */
/* */
typedef FT_Error
(*TT_Load_SBit_Metrics_Func)( FT_Stream stream,
TT_SBit_Range range,
TT_SBit_Metrics metrics );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_SBit_Image_Func */
/* */
/* <Description> */
/* Load a given glyph sbit image from the font resource. This also */
/* returns its metrics. */
/* */
/* <Input> */
/* face :: */
/* The target face object. */
/* */
/* strike_index :: */
/* The strike index. */
/* */
/* glyph_index :: */
/* The current glyph index. */
/* */
/* load_flags :: */
/* The current load flags. */
/* */
/* stream :: */
/* The input stream. */
/* */
/* <Output> */
/* amap :: */
/* The target pixmap. */
/* */
/* ametrics :: */
/* A big sbit metrics structure for the glyph image. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns an error if no */
/* glyph sbit exists for the index. */
/* */
/* <Note> */
/* The `map.buffer' field is always freed before the glyph is loaded. */
/* */
typedef FT_Error
(*TT_Load_SBit_Image_Func)( TT_Face face,
FT_ULong strike_index,
FT_UInt glyph_index,
FT_UInt load_flags,
FT_Stream stream,
FT_Bitmap *amap,
TT_SBit_MetricsRec *ametrics );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Set_SBit_Strike_Func */
/* */
/* <Description> */
/* Select an sbit strike for a given size request. */
/* */
/* <Input> */
/* face :: The target face object. */
/* */
/* req :: The size request. */
/* */
/* <Output> */
/* astrike_index :: The index of the sbit strike. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns an error if no */
/* sbit strike exists for the selected ppem values. */
/* */
typedef FT_Error
(*TT_Set_SBit_Strike_Func)( TT_Face face,
FT_Size_Request req,
FT_ULong* astrike_index );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_Strike_Metrics_Func */
/* */
/* <Description> */
/* Load the metrics of a given strike. */
/* */
/* <Input> */
/* face :: The target face object. */
/* */
/* strike_index :: The strike index. */
/* */
/* <Output> */
/* metrics :: the metrics of the strike. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns an error if no */
/* such sbit strike exists. */
/* */
typedef FT_Error
(*TT_Load_Strike_Metrics_Func)( TT_Face face,
FT_ULong strike_index,
FT_Size_Metrics* metrics );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Get_PS_Name_Func */
/* */
/* <Description> */
/* Get the PostScript glyph name of a glyph. */
/* */
/* <Input> */
/* idx :: The glyph index. */
/* */
/* PSname :: The address of a string pointer. Will be NULL in case */
/* of error, otherwise it is a pointer to the glyph name. */
/* */
/* You must not modify the returned string! */
/* */
/* <Output> */
/* FreeType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_Get_PS_Name_Func)( TT_Face face,
FT_UInt idx,
FT_String** PSname );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_Metrics_Func */
/* */
/* <Description> */
/* Load a metrics table, which is a table with a horizontal and a */
/* vertical version. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* */
/* stream :: The input stream. */
/* */
/* vertical :: A boolean flag. If set, load the vertical one. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_Load_Metrics_Func)( TT_Face face,
FT_Stream stream,
FT_Bool vertical );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Get_Metrics_Func */
/* */
/* <Description> */
/* Load the horizontal or vertical header in a face object. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* */
/* stream :: The input stream. */
/* */
/* vertical :: A boolean flag. If set, load vertical metrics. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_Get_Metrics_Func)( TT_Face face,
FT_Bool vertical,
FT_UInt gindex,
FT_Short* abearing,
FT_UShort* aadvance );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_Table_Func */
/* */
/* <Description> */
/* Load a given TrueType table. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* */
/* stream :: The input stream. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The function uses `face->goto_table' to seek the stream to the */
/* start of the table, except while loading the font directory. */
/* */
typedef FT_Error
(*TT_Load_Table_Func)( TT_Face face,
FT_Stream stream );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Free_Table_Func */
/* */
/* <Description> */
/* Free a given TrueType table. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* */
typedef void
(*TT_Free_Table_Func)( TT_Face face );
 
 
/*
* @functype:
* TT_Face_GetKerningFunc
*
* @description:
* Return the horizontal kerning value between two glyphs.
*
* @input:
* face :: A handle to the source face object.
* left_glyph :: The left glyph index.
* right_glyph :: The right glyph index.
*
* @return:
* The kerning value in font units.
*/
typedef FT_Int
(*TT_Face_GetKerningFunc)( TT_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph );
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* SFNT_Interface */
/* */
/* <Description> */
/* This structure holds pointers to the functions used to load and */
/* free the basic tables that are required in a `sfnt' font file. */
/* */
/* <Fields> */
/* Check the various xxx_Func() descriptions for details. */
/* */
typedef struct SFNT_Interface_
{
TT_Loader_GotoTableFunc goto_table;
 
TT_Init_Face_Func init_face;
TT_Load_Face_Func load_face;
TT_Done_Face_Func done_face;
FT_Module_Requester get_interface;
 
TT_Load_Any_Func load_any;
 
/* these functions are called by `load_face' but they can also */
/* be called from external modules, if there is a need to do so */
TT_Load_Table_Func load_head;
TT_Load_Metrics_Func load_hhea;
TT_Load_Table_Func load_cmap;
TT_Load_Table_Func load_maxp;
TT_Load_Table_Func load_os2;
TT_Load_Table_Func load_post;
 
TT_Load_Table_Func load_name;
TT_Free_Table_Func free_name;
 
/* this field was called `load_kerning' up to version 2.1.10 */
TT_Load_Table_Func load_kern;
 
TT_Load_Table_Func load_gasp;
TT_Load_Table_Func load_pclt;
 
/* see `ttload.h'; this field was called `load_bitmap_header' up to */
/* version 2.1.10 */
TT_Load_Table_Func load_bhed;
 
TT_Load_SBit_Image_Func load_sbit_image;
 
/* see `ttpost.h' */
TT_Get_PS_Name_Func get_psname;
TT_Free_Table_Func free_psnames;
 
/* starting here, the structure differs from version 2.1.7 */
 
/* this field was introduced in version 2.1.8, named `get_psname' */
TT_Face_GetKerningFunc get_kerning;
 
/* new elements introduced after version 2.1.10 */
 
/* load the font directory, i.e., the offset table and */
/* the table directory */
TT_Load_Table_Func load_font_dir;
TT_Load_Metrics_Func load_hmtx;
 
TT_Load_Table_Func load_eblc;
TT_Free_Table_Func free_eblc;
 
TT_Set_SBit_Strike_Func set_sbit_strike;
TT_Load_Strike_Metrics_Func load_strike_metrics;
 
TT_Get_Metrics_Func get_metrics;
 
} SFNT_Interface;
 
 
/* transitional */
typedef SFNT_Interface* SFNT_Service;
 
#ifndef FT_CONFIG_OPTION_PIC
 
#define FT_DEFINE_SFNT_INTERFACE( \
class_, \
goto_table_, \
init_face_, \
load_face_, \
done_face_, \
get_interface_, \
load_any_, \
load_head_, \
load_hhea_, \
load_cmap_, \
load_maxp_, \
load_os2_, \
load_post_, \
load_name_, \
free_name_, \
load_kern_, \
load_gasp_, \
load_pclt_, \
load_bhed_, \
load_sbit_image_, \
get_psname_, \
free_psnames_, \
get_kerning_, \
load_font_dir_, \
load_hmtx_, \
load_eblc_, \
free_eblc_, \
set_sbit_strike_, \
load_strike_metrics_, \
get_metrics_ ) \
static const SFNT_Interface class_ = \
{ \
goto_table_, \
init_face_, \
load_face_, \
done_face_, \
get_interface_, \
load_any_, \
load_head_, \
load_hhea_, \
load_cmap_, \
load_maxp_, \
load_os2_, \
load_post_, \
load_name_, \
free_name_, \
load_kern_, \
load_gasp_, \
load_pclt_, \
load_bhed_, \
load_sbit_image_, \
get_psname_, \
free_psnames_, \
get_kerning_, \
load_font_dir_, \
load_hmtx_, \
load_eblc_, \
free_eblc_, \
set_sbit_strike_, \
load_strike_metrics_, \
get_metrics_, \
};
 
#else /* FT_CONFIG_OPTION_PIC */
 
#define FT_INTERNAL( a, a_ ) \
clazz->a = a_;
 
#define FT_DEFINE_SFNT_INTERFACE( \
class_, \
goto_table_, \
init_face_, \
load_face_, \
done_face_, \
get_interface_, \
load_any_, \
load_head_, \
load_hhea_, \
load_cmap_, \
load_maxp_, \
load_os2_, \
load_post_, \
load_name_, \
free_name_, \
load_kern_, \
load_gasp_, \
load_pclt_, \
load_bhed_, \
load_sbit_image_, \
get_psname_, \
free_psnames_, \
get_kerning_, \
load_font_dir_, \
load_hmtx_, \
load_eblc_, \
free_eblc_, \
set_sbit_strike_, \
load_strike_metrics_, \
get_metrics_ ) \
void \
FT_Init_Class_ ## class_( FT_Library library, \
SFNT_Interface* clazz ) \
{ \
FT_UNUSED( library ); \
\
clazz->goto_table = goto_table_; \
clazz->init_face = init_face_; \
clazz->load_face = load_face_; \
clazz->done_face = done_face_; \
clazz->get_interface = get_interface_; \
clazz->load_any = load_any_; \
clazz->load_head = load_head_; \
clazz->load_hhea = load_hhea_; \
clazz->load_cmap = load_cmap_; \
clazz->load_maxp = load_maxp_; \
clazz->load_os2 = load_os2_; \
clazz->load_post = load_post_; \
clazz->load_name = load_name_; \
clazz->free_name = free_name_; \
clazz->load_kern = load_kern_; \
clazz->load_gasp = load_gasp_; \
clazz->load_pclt = load_pclt_; \
clazz->load_bhed = load_bhed_; \
clazz->load_sbit_image = load_sbit_image_; \
clazz->get_psname = get_psname_; \
clazz->free_psnames = free_psnames_; \
clazz->get_kerning = get_kerning_; \
clazz->load_font_dir = load_font_dir_; \
clazz->load_hmtx = load_hmtx_; \
clazz->load_eblc = load_eblc_; \
clazz->free_eblc = free_eblc_; \
clazz->set_sbit_strike = set_sbit_strike_; \
clazz->load_strike_metrics = load_strike_metrics_; \
clazz->get_metrics = get_metrics_; \
}
 
#endif /* FT_CONFIG_OPTION_PIC */
 
FT_END_HEADER
 
#endif /* __SFNT_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/t1types.h
0,0 → 1,255
/***************************************************************************/
/* */
/* t1types.h */
/* */
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 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 __T1TYPES_H__
#define __T1TYPES_H__
 
 
#include <ft2build.h>
#include FT_TYPE1_TABLES_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include FT_INTERNAL_SERVICE_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* T1_EncodingRec */
/* */
/* <Description> */
/* A structure modeling a custom encoding. */
/* */
/* <Fields> */
/* num_chars :: The number of character codes in the encoding. */
/* Usually 256. */
/* */
/* code_first :: The lowest valid character code in the encoding. */
/* */
/* code_last :: The highest valid character code in the encoding */
/* + 1. When equal to code_first there are no valid */
/* character codes. */
/* */
/* char_index :: An array of corresponding glyph indices. */
/* */
/* char_name :: An array of corresponding glyph names. */
/* */
typedef struct T1_EncodingRecRec_
{
FT_Int num_chars;
FT_Int code_first;
FT_Int code_last;
 
FT_UShort* char_index;
FT_String** char_name;
 
} T1_EncodingRec, *T1_Encoding;
 
 
/* used to hold extra data of PS_FontInfoRec that
* cannot be stored in the publicly defined structure.
*
* Note these can't be blended with multiple-masters.
*/
typedef struct PS_FontExtraRec_
{
FT_UShort fs_type;
 
} PS_FontExtraRec;
 
 
typedef struct T1_FontRec_
{
PS_FontInfoRec font_info; /* font info dictionary */
PS_FontExtraRec font_extra; /* font info extra fields */
PS_PrivateRec private_dict; /* private dictionary */
FT_String* font_name; /* top-level dictionary */
 
T1_EncodingType encoding_type;
T1_EncodingRec encoding;
 
FT_Byte* subrs_block;
FT_Byte* charstrings_block;
FT_Byte* glyph_names_block;
 
FT_Int num_subrs;
FT_Byte** subrs;
FT_PtrDist* subrs_len;
 
FT_Int num_glyphs;
FT_String** glyph_names; /* array of glyph names */
FT_Byte** charstrings; /* array of glyph charstrings */
FT_PtrDist* charstrings_len;
 
FT_Byte paint_type;
FT_Byte font_type;
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_BBox font_bbox;
FT_Long font_id;
 
FT_Fixed stroke_width;
 
} T1_FontRec, *T1_Font;
 
 
typedef struct CID_SubrsRec_
{
FT_UInt num_subrs;
FT_Byte** code;
 
} CID_SubrsRec, *CID_Subrs;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** AFM FONT INFORMATION STRUCTURES ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
typedef struct AFM_TrackKernRec_
{
FT_Int degree;
FT_Fixed min_ptsize;
FT_Fixed min_kern;
FT_Fixed max_ptsize;
FT_Fixed max_kern;
 
} AFM_TrackKernRec, *AFM_TrackKern;
 
typedef struct AFM_KernPairRec_
{
FT_Int index1;
FT_Int index2;
FT_Int x;
FT_Int y;
 
} AFM_KernPairRec, *AFM_KernPair;
 
typedef struct AFM_FontInfoRec_
{
FT_Bool IsCIDFont;
FT_BBox FontBBox;
FT_Fixed Ascender;
FT_Fixed Descender;
AFM_TrackKern TrackKerns; /* free if non-NULL */
FT_Int NumTrackKern;
AFM_KernPair KernPairs; /* free if non-NULL */
FT_Int NumKernPair;
 
} AFM_FontInfoRec, *AFM_FontInfo;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** ORIGINAL T1_FACE CLASS DEFINITION ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
typedef struct T1_FaceRec_* T1_Face;
typedef struct CID_FaceRec_* CID_Face;
 
 
typedef struct T1_FaceRec_
{
FT_FaceRec root;
T1_FontRec type1;
const void* psnames;
const void* psaux;
const void* afm_data;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];
 
/* support for Multiple Masters fonts */
PS_Blend blend;
 
/* undocumented, optional: indices of subroutines that express */
/* the NormalizeDesignVector and the ConvertDesignVector procedure, */
/* respectively, as Type 2 charstrings; -1 if keywords not present */
FT_Int ndv_idx;
FT_Int cdv_idx;
 
/* undocumented, optional: has the same meaning as len_buildchar */
/* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */
FT_UInt len_buildchar;
FT_Long* buildchar;
 
/* since version 2.1 - interface to PostScript hinter */
const void* pshinter;
 
} T1_FaceRec;
 
 
typedef struct CID_FaceRec_
{
FT_FaceRec root;
void* psnames;
void* psaux;
CID_FaceInfoRec cid;
PS_FontExtraRec font_extra;
#if 0
void* afm_data;
#endif
CID_Subrs subrs;
 
/* since version 2.1 - interface to PostScript hinter */
void* pshinter;
 
/* since version 2.1.8, but was originally positioned after `afm_data' */
FT_Byte* binary_data; /* used if hex data has been converted */
FT_Stream cid_stream;
 
} CID_FaceRec;
 
 
FT_END_HEADER
 
#endif /* __T1TYPES_H__ */
 
 
/* END */
/contrib/sdk/sources/freetype/include/freetype/internal/tttypes.h
0,0 → 1,1440
/***************************************************************************/
/* */
/* tttypes.h */
/* */
/* Basic SFNT/TrueType type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2002, 2004-2008, 2012-2013 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 __TTTYPES_H__
#define __TTTYPES_H__
 
 
#include <ft2build.h>
#include FT_TRUETYPE_TABLES_H
#include FT_INTERNAL_OBJECTS_H
 
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include FT_MULTIPLE_MASTERS_H
#endif
 
 
FT_BEGIN_HEADER
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TTC_HeaderRec */
/* */
/* <Description> */
/* TrueType collection header. This table contains the offsets of */
/* the font headers of each distinct TrueType face in the file. */
/* */
/* <Fields> */
/* tag :: Must be `ttc ' to indicate a TrueType collection. */
/* */
/* version :: The version number. */
/* */
/* count :: The number of faces in the collection. The */
/* specification says this should be an unsigned long, but */
/* we use a signed long since we need the value -1 for */
/* specific purposes. */
/* */
/* offsets :: The offsets of the font headers, one per face. */
/* */
typedef struct TTC_HeaderRec_
{
FT_ULong tag;
FT_Fixed version;
FT_Long count;
FT_ULong* offsets;
 
} TTC_HeaderRec;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* SFNT_HeaderRec */
/* */
/* <Description> */
/* SFNT file format header. */
/* */
/* <Fields> */
/* format_tag :: The font format tag. */
/* */
/* num_tables :: The number of tables in file. */
/* */
/* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */
/* */
/* entry_selector :: Must be log2 of `search_range / 16'. */
/* */
/* range_shift :: Must be `num_tables * 16 - search_range'. */
/* */
typedef struct SFNT_HeaderRec_
{
FT_ULong format_tag;
FT_UShort num_tables;
FT_UShort search_range;
FT_UShort entry_selector;
FT_UShort range_shift;
 
FT_ULong offset; /* not in file */
 
} SFNT_HeaderRec, *SFNT_Header;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_TableRec */
/* */
/* <Description> */
/* This structure describes a given table of a TrueType font. */
/* */
/* <Fields> */
/* Tag :: A four-bytes tag describing the table. */
/* */
/* CheckSum :: The table checksum. This value can be ignored. */
/* */
/* Offset :: The offset of the table from the start of the TrueType */
/* font in its resource. */
/* */
/* Length :: The table length (in bytes). */
/* */
typedef struct TT_TableRec_
{
FT_ULong Tag; /* table type */
FT_ULong CheckSum; /* table checksum */
FT_ULong Offset; /* table file offset */
FT_ULong Length; /* table length */
 
} TT_TableRec, *TT_Table;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_LongMetricsRec */
/* */
/* <Description> */
/* A structure modeling the long metrics of the `hmtx' and `vmtx' */
/* TrueType tables. The values are expressed in font units. */
/* */
/* <Fields> */
/* advance :: The advance width or height for the glyph. */
/* */
/* bearing :: The left-side or top-side bearing for the glyph. */
/* */
typedef struct TT_LongMetricsRec_
{
FT_UShort advance;
FT_Short bearing;
 
} TT_LongMetricsRec, *TT_LongMetrics;
 
 
/*************************************************************************/
/* */
/* <Type> */
/* TT_ShortMetrics */
/* */
/* <Description> */
/* A simple type to model the short metrics of the `hmtx' and `vmtx' */
/* tables. */
/* */
typedef FT_Short TT_ShortMetrics;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_NameEntryRec */
/* */
/* <Description> */
/* A structure modeling TrueType name records. Name records are used */
/* to store important strings like family name, style name, */
/* copyright, etc. in _localized_ versions (i.e., language, encoding, */
/* etc). */
/* */
/* <Fields> */
/* platformID :: The ID of the name's encoding platform. */
/* */
/* encodingID :: The platform-specific ID for the name's encoding. */
/* */
/* languageID :: The platform-specific ID for the name's language. */
/* */
/* nameID :: The ID specifying what kind of name this is. */
/* */
/* stringLength :: The length of the string in bytes. */
/* */
/* stringOffset :: The offset to the string in the `name' table. */
/* */
/* string :: A pointer to the string's bytes. Note that these */
/* are usually UTF-16 encoded characters. */
/* */
typedef struct TT_NameEntryRec_
{
FT_UShort platformID;
FT_UShort encodingID;
FT_UShort languageID;
FT_UShort nameID;
FT_UShort stringLength;
FT_ULong stringOffset;
 
/* this last field is not defined in the spec */
/* but used by the FreeType engine */
 
FT_Byte* string;
 
} TT_NameEntryRec, *TT_NameEntry;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_NameTableRec */
/* */
/* <Description> */
/* A structure modeling the TrueType name table. */
/* */
/* <Fields> */
/* format :: The format of the name table. */
/* */
/* numNameRecords :: The number of names in table. */
/* */
/* storageOffset :: The offset of the name table in the `name' */
/* TrueType table. */
/* */
/* names :: An array of name records. */
/* */
/* stream :: the file's input stream. */
/* */
typedef struct TT_NameTableRec_
{
FT_UShort format;
FT_UInt numNameRecords;
FT_UInt storageOffset;
TT_NameEntryRec* names;
FT_Stream stream;
 
} TT_NameTableRec, *TT_NameTable;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_GaspRangeRec */
/* */
/* <Description> */
/* A tiny structure used to model a gasp range according to the */
/* TrueType specification. */
/* */
/* <Fields> */
/* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
/* */
/* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
/* modes to be used. */
/* */
typedef struct TT_GaspRangeRec_
{
FT_UShort maxPPEM;
FT_UShort gaspFlag;
 
} TT_GaspRangeRec, *TT_GaspRange;
 
 
#define TT_GASP_GRIDFIT 0x01
#define TT_GASP_DOGRAY 0x02
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_GaspRec */
/* */
/* <Description> */
/* A structure modeling the TrueType `gasp' table used to specify */
/* grid-fitting and anti-aliasing behaviour. */
/* */
/* <Fields> */
/* version :: The version number. */
/* */
/* numRanges :: The number of gasp ranges in table. */
/* */
/* gaspRanges :: An array of gasp ranges. */
/* */
typedef struct TT_Gasp_
{
FT_UShort version;
FT_UShort numRanges;
TT_GaspRange gaspRanges;
 
} TT_GaspRec;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** EMBEDDED BITMAPS SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_MetricsRec */
/* */
/* <Description> */
/* A structure used to hold the big metrics of a given glyph bitmap */
/* in a TrueType or OpenType font. These are usually found in the */
/* `EBDT' (Microsoft) or `bloc' (Apple) table. */
/* */
/* <Fields> */
/* height :: The glyph height in pixels. */
/* */
/* width :: The glyph width in pixels. */
/* */
/* horiBearingX :: The horizontal left bearing. */
/* */
/* horiBearingY :: The horizontal top bearing. */
/* */
/* horiAdvance :: The horizontal advance. */
/* */
/* vertBearingX :: The vertical left bearing. */
/* */
/* vertBearingY :: The vertical top bearing. */
/* */
/* vertAdvance :: The vertical advance. */
/* */
typedef struct TT_SBit_MetricsRec_
{
FT_Byte height;
FT_Byte width;
 
FT_Char horiBearingX;
FT_Char horiBearingY;
FT_Byte horiAdvance;
 
FT_Char vertBearingX;
FT_Char vertBearingY;
FT_Byte vertAdvance;
 
} TT_SBit_MetricsRec, *TT_SBit_Metrics;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_SmallMetricsRec */
/* */
/* <Description> */
/* A structure used to hold the small metrics of a given glyph bitmap */
/* in a TrueType or OpenType font. These are usually found in the */
/* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
/* */
/* <Fields> */
/* height :: The glyph height in pixels. */
/* */
/* width :: The glyph width in pixels. */
/* */
/* bearingX :: The left-side bearing. */
/* */
/* bearingY :: The top-side bearing. */
/* */
/* advance :: The advance width or height. */
/* */
typedef struct TT_SBit_Small_Metrics_
{
FT_Byte height;
FT_Byte width;
 
FT_Char bearingX;
FT_Char bearingY;
FT_Byte advance;
 
} TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_LineMetricsRec */
/* */
/* <Description> */
/* A structure used to describe the text line metrics of a given */
/* bitmap strike, for either a horizontal or vertical layout. */
/* */
/* <Fields> */
/* ascender :: The ascender in pixels. */
/* */
/* descender :: The descender in pixels. */
/* */
/* max_width :: The maximum glyph width in pixels. */
/* */
/* caret_slope_enumerator :: Rise of the caret slope, typically set */
/* to 1 for non-italic fonts. */
/* */
/* caret_slope_denominator :: Rise of the caret slope, typically set */
/* to 0 for non-italic fonts. */
/* */
/* caret_offset :: Offset in pixels to move the caret for */
/* proper positioning. */
/* */
/* min_origin_SB :: Minimum of horiBearingX (resp. */
/* vertBearingY). */
/* min_advance_SB :: Minimum of */
/* */
/* horizontal advance - */
/* ( horiBearingX + width ) */
/* */
/* resp. */
/* */
/* vertical advance - */
/* ( vertBearingY + height ) */
/* */
/* max_before_BL :: Maximum of horiBearingY (resp. */
/* vertBearingY). */
/* */
/* min_after_BL :: Minimum of */
/* */
/* horiBearingY - height */
/* */
/* resp. */
/* */
/* vertBearingX - width */
/* */
/* pads :: Unused (to make the size of the record */
/* a multiple of 32 bits. */
/* */
typedef struct TT_SBit_LineMetricsRec_
{
FT_Char ascender;
FT_Char descender;
FT_Byte max_width;
FT_Char caret_slope_numerator;
FT_Char caret_slope_denominator;
FT_Char caret_offset;
FT_Char min_origin_SB;
FT_Char min_advance_SB;
FT_Char max_before_BL;
FT_Char min_after_BL;
FT_Char pads[2];
 
} TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_RangeRec */
/* */
/* <Description> */
/* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
/* (Microsoft) or `bloc' (Apple) tables. */
/* */
/* <Fields> */
/* first_glyph :: The first glyph index in the range. */
/* */
/* last_glyph :: The last glyph index in the range. */
/* */
/* index_format :: The format of index table. Valid values are 1 */
/* to 5. */
/* */
/* image_format :: The format of `EBDT' image data. */
/* */
/* image_offset :: The offset to image data in `EBDT'. */
/* */
/* image_size :: For index formats 2 and 5. This is the size in */
/* bytes of each glyph bitmap. */
/* */
/* big_metrics :: For index formats 2 and 5. This is the big */
/* metrics for each glyph bitmap. */
/* */
/* num_glyphs :: For index formats 4 and 5. This is the number of */
/* glyphs in the code array. */
/* */
/* glyph_offsets :: For index formats 1 and 3. */
/* */
/* glyph_codes :: For index formats 4 and 5. */
/* */
/* table_offset :: The offset of the index table in the `EBLC' */
/* table. Only used during strike loading. */
/* */
typedef struct TT_SBit_RangeRec_
{
FT_UShort first_glyph;
FT_UShort last_glyph;
 
FT_UShort index_format;
FT_UShort image_format;
FT_ULong image_offset;
 
FT_ULong image_size;
TT_SBit_MetricsRec metrics;
FT_ULong num_glyphs;
 
FT_ULong* glyph_offsets;
FT_UShort* glyph_codes;
 
FT_ULong table_offset;
 
} TT_SBit_RangeRec, *TT_SBit_Range;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_StrikeRec */
/* */
/* <Description> */
/* A structure used describe a given bitmap strike in the `EBLC' */
/* (Microsoft) or `bloc' (Apple) tables. */
/* */
/* <Fields> */
/* num_index_ranges :: The number of index ranges. */
/* */
/* index_ranges :: An array of glyph index ranges. */
/* */
/* color_ref :: Unused. `color_ref' is put in for future */
/* enhancements, but these fields are already */
/* in use by other platforms (e.g. Newton). */
/* For details, please see */
/* */
/* http://fonts.apple.com/ */
/* TTRefMan/RM06/Chap6bloc.html */
/* */
/* hori :: The line metrics for horizontal layouts. */
/* */
/* vert :: The line metrics for vertical layouts. */
/* */
/* start_glyph :: The lowest glyph index for this strike. */
/* */
/* end_glyph :: The highest glyph index for this strike. */
/* */
/* x_ppem :: The number of horizontal pixels per EM. */
/* */
/* y_ppem :: The number of vertical pixels per EM. */
/* */
/* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
/* and 8. */
/* */
/* flags :: Is this a vertical or horizontal strike? For */
/* details, please see */
/* */
/* http://fonts.apple.com/ */
/* TTRefMan/RM06/Chap6bloc.html */
/* */
typedef struct TT_SBit_StrikeRec_
{
FT_Int num_ranges;
TT_SBit_Range sbit_ranges;
FT_ULong ranges_offset;
 
FT_ULong color_ref;
 
TT_SBit_LineMetricsRec hori;
TT_SBit_LineMetricsRec vert;
 
FT_UShort start_glyph;
FT_UShort end_glyph;
 
FT_Byte x_ppem;
FT_Byte y_ppem;
 
FT_Byte bit_depth;
FT_Char flags;
 
} TT_SBit_StrikeRec, *TT_SBit_Strike;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_ComponentRec */
/* */
/* <Description> */
/* A simple structure to describe a compound sbit element. */
/* */
/* <Fields> */
/* glyph_code :: The element's glyph index. */
/* */
/* x_offset :: The element's left bearing. */
/* */
/* y_offset :: The element's top bearing. */
/* */
typedef struct TT_SBit_ComponentRec_
{
FT_UShort glyph_code;
FT_Char x_offset;
FT_Char y_offset;
 
} TT_SBit_ComponentRec, *TT_SBit_Component;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_SBit_ScaleRec */
/* */
/* <Description> */
/* A structure used describe a given bitmap scaling table, as defined */
/* in the `EBSC' table. */
/* */
/* <Fields> */
/* hori :: The horizontal line metrics. */
/* */
/* vert :: The vertical line metrics. */
/* */
/* x_ppem :: The number of horizontal pixels per EM. */
/* */
/* y_ppem :: The number of vertical pixels per EM. */
/* */
/* x_ppem_substitute :: Substitution x_ppem value. */
/* */
/* y_ppem_substitute :: Substitution y_ppem value. */
/* */
typedef struct TT_SBit_ScaleRec_
{
TT_SBit_LineMetricsRec hori;
TT_SBit_LineMetricsRec vert;
 
FT_Byte x_ppem;
FT_Byte y_ppem;
 
FT_Byte x_ppem_substitute;
FT_Byte y_ppem_substitute;
 
} TT_SBit_ScaleRec, *TT_SBit_Scale;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** POSTSCRIPT GLYPH NAMES SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Post_20Rec */
/* */
/* <Description> */
/* Postscript names sub-table, format 2.0. Stores the PS name of */
/* each glyph in the font face. */
/* */
/* <Fields> */
/* num_glyphs :: The number of named glyphs in the table. */
/* */
/* num_names :: The number of PS names stored in the table. */
/* */
/* glyph_indices :: The indices of the glyphs in the names arrays. */
/* */
/* glyph_names :: The PS names not in Mac Encoding. */
/* */
typedef struct TT_Post_20Rec_
{
FT_UShort num_glyphs;
FT_UShort num_names;
FT_UShort* glyph_indices;
FT_Char** glyph_names;
 
} TT_Post_20Rec, *TT_Post_20;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Post_25Rec */
/* */
/* <Description> */
/* Postscript names sub-table, format 2.5. Stores the PS name of */
/* each glyph in the font face. */
/* */
/* <Fields> */
/* num_glyphs :: The number of glyphs in the table. */
/* */
/* offsets :: An array of signed offsets in a normal Mac */
/* Postscript name encoding. */
/* */
typedef struct TT_Post_25_
{
FT_UShort num_glyphs;
FT_Char* offsets;
 
} TT_Post_25Rec, *TT_Post_25;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_Post_NamesRec */
/* */
/* <Description> */
/* Postscript names table, either format 2.0 or 2.5. */
/* */
/* <Fields> */
/* loaded :: A flag to indicate whether the PS names are loaded. */
/* */
/* format_20 :: The sub-table used for format 2.0. */
/* */
/* format_25 :: The sub-table used for format 2.5. */
/* */
typedef struct TT_Post_NamesRec_
{
FT_Bool loaded;
 
union
{
TT_Post_20Rec format_20;
TT_Post_25Rec format_25;
 
} names;
 
} TT_Post_NamesRec, *TT_Post_Names;
 
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** GX VARIATION TABLE SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
typedef struct GX_BlendRec_ *GX_Blend;
#endif
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
/*
* These types are used to support a `BDF ' table that isn't part of the
* official TrueType specification. It is mainly used in SFNT-based
* bitmap fonts that were generated from a set of BDF fonts.
*
* The format of the table is as follows.
*
* USHORT version `BDF ' table version number, should be 0x0001.
* USHORT strikeCount Number of strikes (bitmap sizes) in this table.
* ULONG stringTable Offset (from start of BDF table) to string
* table.
*
* This is followed by an array of `strikeCount' descriptors, having the
* following format.
*
* USHORT ppem Vertical pixels per EM for this strike.
* USHORT numItems Number of items for this strike (properties and
* atoms). Maximum is 255.
*
* This array in turn is followed by `strikeCount' value sets. Each
* `value set' is an array of `numItems' items with the following format.
*
* ULONG item_name Offset in string table to item name.
* USHORT item_type The item type. Possible values are
* 0 => string (e.g., COMMENT)
* 1 => atom (e.g., FONT or even SIZE)
* 2 => int32
* 3 => uint32
* 0x10 => A flag to indicate a properties. This
* is ORed with the above values.
* ULONG item_value For strings => Offset into string table without
* the corresponding double quotes.
* For atoms => Offset into string table.
* For integers => Direct value.
*
* All strings in the string table consist of bytes and are
* zero-terminated.
*
*/
 
#ifdef TT_CONFIG_OPTION_BDF
 
typedef struct TT_BDFRec_
{
FT_Byte* table;
FT_Byte* table_end;
FT_Byte* strings;
FT_ULong strings_size;
FT_UInt num_strikes;
FT_Bool loaded;
 
} TT_BDFRec, *TT_BDF;
 
#endif /* TT_CONFIG_OPTION_BDF */
 
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** ORIGINAL TT_FACE CLASS DEFINITION ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* This structure/class is defined here because it is common to the */
/* following formats: TTF, OpenType-TT, and OpenType-CFF. */
/* */
/* Note, however, that the classes TT_Size and TT_GlyphSlot are not */
/* shared between font drivers, and are thus defined in `ttobjs.h'. */
/* */
/*************************************************************************/
 
 
/*************************************************************************/
/* */
/* <Type> */
/* TT_Face */
/* */
/* <Description> */
/* A handle to a TrueType face/font object. A TT_Face encapsulates */
/* the resolution and scaling independent parts of a TrueType font */
/* resource. */
/* */
/* <Note> */
/* The TT_Face structure is also used as a `parent class' for the */
/* OpenType-CFF class (T2_Face). */
/* */
typedef struct TT_FaceRec_* TT_Face;
 
 
/* a function type used for the truetype bytecode interpreter hooks */
typedef FT_Error
(*TT_Interpreter)( void* exec_context );
 
/* forward declaration */
typedef struct TT_LoaderRec_* TT_Loader;
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Loader_GotoTableFunc */
/* */
/* <Description> */
/* Seeks a stream to the start of a given TrueType table. */
/* */
/* <Input> */
/* face :: A handle to the target face object. */
/* */
/* tag :: A 4-byte tag used to name the table. */
/* */
/* stream :: The input stream. */
/* */
/* <Output> */
/* length :: The length of the table in bytes. Set to 0 if not */
/* needed. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The stream cursor must be at the font file's origin. */
/* */
typedef FT_Error
(*TT_Loader_GotoTableFunc)( TT_Face face,
FT_ULong tag,
FT_Stream stream,
FT_ULong* length );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Loader_StartGlyphFunc */
/* */
/* <Description> */
/* Seeks a stream to the start of a given glyph element, and opens a */
/* frame for it. */
/* */
/* <Input> */
/* loader :: The current TrueType glyph loader object. */
/* */
/* glyph index :: The index of the glyph to access. */
/* */
/* offset :: The offset of the glyph according to the */
/* `locations' table. */
/* */
/* byte_count :: The size of the frame in bytes. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function is normally equivalent to FT_STREAM_SEEK(offset) */
/* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */
/* but alternative formats (e.g. compressed ones) might use something */
/* different. */
/* */
typedef FT_Error
(*TT_Loader_StartGlyphFunc)( TT_Loader loader,
FT_UInt glyph_index,
FT_ULong offset,
FT_UInt byte_count );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Loader_ReadGlyphFunc */
/* */
/* <Description> */
/* Reads one glyph element (its header, a simple glyph, or a */
/* composite) from the loader's current stream frame. */
/* */
/* <Input> */
/* loader :: The current TrueType glyph loader object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_Loader_ReadGlyphFunc)( TT_Loader loader );
 
 
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Loader_EndGlyphFunc */
/* */
/* <Description> */
/* Closes the current loader stream frame for the glyph. */
/* */
/* <Input> */
/* loader :: The current TrueType glyph loader object. */
/* */
typedef void
(*TT_Loader_EndGlyphFunc)( TT_Loader loader );
 
 
/*************************************************************************/
/* */
/* TrueType Face Type */
/* */
/* <Struct> */
/* TT_Face */
/* */
/* <Description> */
/* The TrueType face class. These objects model the resolution and */
/* point-size independent data found in a TrueType font file. */
/* */
/* <Fields> */
/* root :: The base FT_Face structure, managed by the */
/* base layer. */
/* */
/* ttc_header :: The TrueType collection header, used when */
/* the file is a `ttc' rather than a `ttf'. */
/* For ordinary font files, the field */
/* `ttc_header.count' is set to 0. */
/* */
/* format_tag :: The font format tag. */
/* */
/* num_tables :: The number of TrueType tables in this font */
/* file. */
/* */
/* dir_tables :: The directory of TrueType tables for this */
/* font file. */
/* */
/* header :: The font's font header (`head' table). */
/* Read on font opening. */
/* */
/* horizontal :: The font's horizontal header (`hhea' */
/* table). This field also contains the */
/* associated horizontal metrics table */
/* (`hmtx'). */
/* */
/* max_profile :: The font's maximum profile table. Read on */
/* font opening. Note that some maximum */
/* values cannot be taken directly from this */
/* table. We thus define additional fields */
/* below to hold the computed maxima. */
/* */
/* vertical_info :: A boolean which is set when the font file */
/* contains vertical metrics. If not, the */
/* value of the `vertical' field is */
/* undefined. */
/* */
/* vertical :: The font's vertical header (`vhea' table). */
/* This field also contains the associated */
/* vertical metrics table (`vmtx'), if found. */
/* IMPORTANT: The contents of this field is */
/* undefined if the `verticalInfo' field is */
/* unset. */
/* */
/* num_names :: The number of name records within this */
/* TrueType font. */
/* */
/* name_table :: The table of name records (`name'). */
/* */
/* os2 :: The font's OS/2 table (`OS/2'). */
/* */
/* postscript :: The font's PostScript table (`post' */
/* table). The PostScript glyph names are */
/* not loaded by the driver on face opening. */
/* See the `ttpost' module for more details. */
/* */
/* cmap_table :: Address of the face's `cmap' SFNT table */
/* in memory (it's an extracted frame). */
/* */
/* cmap_size :: The size in bytes of the `cmap_table' */
/* described above. */
/* */
/* goto_table :: A function called by each TrueType table */
/* loader to position a stream's cursor to */
/* the start of a given table according to */
/* its tag. It defaults to TT_Goto_Face but */
/* can be different for strange formats (e.g. */
/* Type 42). */
/* */
/* access_glyph_frame :: A function used to access the frame of a */
/* given glyph within the face's font file. */
/* */
/* forget_glyph_frame :: A function used to forget the frame of a */
/* given glyph when all data has been loaded. */
/* */
/* read_glyph_header :: A function used to read a glyph header. */
/* It must be called between an `access' and */
/* `forget'. */
/* */
/* read_simple_glyph :: A function used to read a simple glyph. */
/* It must be called after the header was */
/* read, and before the `forget'. */
/* */
/* read_composite_glyph :: A function used to read a composite glyph. */
/* It must be called after the header was */
/* read, and before the `forget'. */
/* */
/* sfnt :: A pointer to the SFNT service. */
/* */
/* psnames :: A pointer to the PostScript names service. */
/* */
/* hdmx :: The face's horizontal device metrics */
/* (`hdmx' table). This table is optional in */
/* TrueType/OpenType fonts. */
/* */
/* gasp :: The grid-fitting and scaling properties */
/* table (`gasp'). This table is optional in */
/* TrueType/OpenType fonts. */
/* */
/* pclt :: The `pclt' SFNT table. */
/* */
/* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */
/* sizes, embedded in this font. */
/* */
/* sbit_strikes :: An array of sbit strikes embedded in this */
/* font. This table is optional in a */
/* TrueType/OpenType font. */
/* */
/* num_sbit_scales :: The number of sbit scales for this font. */
/* */
/* sbit_scales :: Array of sbit scales embedded in this */
/* font. This table is optional in a */
/* TrueType/OpenType font. */
/* */
/* postscript_names :: A table used to store the Postscript names */
/* of the glyphs for this font. See the */
/* file `ttconfig.h' for comments on the */
/* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
/* */
/* num_locations :: The number of glyph locations in this */
/* TrueType file. This should be */
/* identical to the number of glyphs. */
/* Ignored for Type 2 fonts. */
/* */
/* glyph_locations :: An array of longs. These are offsets to */
/* glyph data within the `glyf' table. */
/* Ignored for Type 2 font faces. */
/* */
/* glyf_len :: The length of the `glyf' table. Needed */
/* for malformed `loca' tables. */
/* */
/* font_program_size :: Size in bytecodes of the face's font */
/* program. 0 if none defined. Ignored for */
/* Type 2 fonts. */
/* */
/* font_program :: The face's font program (bytecode stream) */
/* executed at load time, also used during */
/* glyph rendering. Comes from the `fpgm' */
/* table. Ignored for Type 2 font fonts. */
/* */
/* cvt_program_size :: The size in bytecodes of the face's cvt */
/* program. Ignored for Type 2 fonts. */
/* */
/* cvt_program :: The face's cvt program (bytecode stream) */
/* executed each time an instance/size is */
/* changed/reset. Comes from the `prep' */
/* table. Ignored for Type 2 fonts. */
/* */
/* cvt_size :: Size of the control value table (in */
/* entries). Ignored for Type 2 fonts. */
/* */
/* cvt :: The face's original control value table. */
/* Coordinates are expressed in unscaled font */
/* units. Comes from the `cvt ' table. */
/* Ignored for Type 2 fonts. */
/* */
/* num_kern_pairs :: The number of kerning pairs present in the */
/* font file. The engine only loads the */
/* first horizontal format 0 kern table it */
/* finds in the font file. Ignored for */
/* Type 2 fonts. */
/* */
/* kern_table_index :: The index of the kerning table in the font */
/* kerning directory. Ignored for Type 2 */
/* fonts. */
/* */
/* interpreter :: A pointer to the TrueType bytecode */
/* interpreters field is also used to hook */
/* the debugger in `ttdebug'. */
/* */
/* unpatented_hinting :: If true, use only unpatented methods in */
/* the bytecode interpreter. */
/* */
/* doblend :: A boolean which is set if the font should */
/* be blended (this is for GX var). */
/* */
/* blend :: Contains the data needed to control GX */
/* variation tables (rather like Multiple */
/* Master data). */
/* */
/* extra :: Reserved for third-party font drivers. */
/* */
/* postscript_name :: The PS name of the font. Used by the */
/* postscript name service. */
/* */
typedef struct TT_FaceRec_
{
FT_FaceRec root;
 
TTC_HeaderRec ttc_header;
 
FT_ULong format_tag;
FT_UShort num_tables;
TT_Table dir_tables;
 
TT_Header header; /* TrueType header table */
TT_HoriHeader horizontal; /* TrueType horizontal header */
 
TT_MaxProfile max_profile;
 
FT_Bool vertical_info;
TT_VertHeader vertical; /* TT Vertical header, if present */
 
FT_UShort num_names; /* number of name records */
TT_NameTableRec name_table; /* name table */
 
TT_OS2 os2; /* TrueType OS/2 table */
TT_Postscript postscript; /* TrueType Postscript table */
 
FT_Byte* cmap_table; /* extracted `cmap' table */
FT_ULong cmap_size;
 
TT_Loader_GotoTableFunc goto_table;
 
TT_Loader_StartGlyphFunc access_glyph_frame;
TT_Loader_EndGlyphFunc forget_glyph_frame;
TT_Loader_ReadGlyphFunc read_glyph_header;
TT_Loader_ReadGlyphFunc read_simple_glyph;
TT_Loader_ReadGlyphFunc read_composite_glyph;
 
/* a typeless pointer to the SFNT_Interface table used to load */
/* the basic TrueType tables in the face object */
void* sfnt;
 
/* a typeless pointer to the FT_Service_PsCMapsRec table used to */
/* handle glyph names <-> unicode & Mac values */
void* psnames;
 
 
/***********************************************************************/
/* */
/* Optional TrueType/OpenType tables */
/* */
/***********************************************************************/
 
/* grid-fitting and scaling table */
TT_GaspRec gasp; /* the `gasp' table */
 
/* PCL 5 table */
TT_PCLT pclt;
 
/* embedded bitmaps support */
FT_ULong num_sbit_scales;
TT_SBit_Scale sbit_scales;
 
/* postscript names table */
TT_Post_NamesRec postscript_names;
 
 
/***********************************************************************/
/* */
/* TrueType-specific fields (ignored by the OTF-Type2 driver) */
/* */
/***********************************************************************/
 
/* the font program, if any */
FT_ULong font_program_size;
FT_Byte* font_program;
 
/* the cvt program, if any */
FT_ULong cvt_program_size;
FT_Byte* cvt_program;
 
/* the original, unscaled, control value table */
FT_ULong cvt_size;
FT_Short* cvt;
 
/* A pointer to the bytecode interpreter to use. This is also */
/* used to hook the debugger for the `ttdebug' utility. */
TT_Interpreter interpreter;
 
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
/* Use unpatented hinting only. */
FT_Bool unpatented_hinting;
#endif
 
/***********************************************************************/
/* */
/* Other tables or fields. This is used by derivative formats like */
/* OpenType. */
/* */
/***********************************************************************/
 
FT_Generic extra;
 
const char* postscript_name;
 
FT_ULong glyf_len;
 
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_Bool doblend;
GX_Blend blend;
#endif
 
/* since version 2.2 */
 
FT_Byte* horz_metrics;
FT_ULong horz_metrics_size;
 
FT_Byte* vert_metrics;
FT_ULong vert_metrics_size;
 
FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */
FT_Byte* glyph_locations;
 
FT_Byte* hdmx_table;
FT_ULong hdmx_table_size;
FT_UInt hdmx_record_count;
FT_ULong hdmx_record_size;
FT_Byte* hdmx_record_sizes;
 
FT_Byte* sbit_table;
FT_ULong sbit_table_size;
FT_UInt sbit_num_strikes;
 
FT_Byte* kern_table;
FT_ULong kern_table_size;
FT_UInt num_kern_tables;
FT_UInt32 kern_avail_bits;
FT_UInt32 kern_order_bits;
 
#ifdef TT_CONFIG_OPTION_BDF
TT_BDFRec bdf;
#endif /* TT_CONFIG_OPTION_BDF */
 
/* since 2.3.0 */
FT_ULong horz_metrics_offset;
FT_ULong vert_metrics_offset;
 
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
/* since 2.4.12 */
FT_ULong sph_found_func_flags; /* special functions found */
/* for this face */
FT_Bool sph_compatibility_mode;
#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 
} TT_FaceRec;
 
 
/*************************************************************************/
/* */
/* <Struct> */
/* TT_GlyphZoneRec */
/* */
/* <Description> */
/* A glyph zone is used to load, scale and hint glyph outline */
/* coordinates. */
/* */
/* <Fields> */
/* memory :: A handle to the memory manager. */
/* */
/* max_points :: The maximum size in points of the zone. */
/* */
/* max_contours :: Max size in links contours of the zone. */
/* */
/* n_points :: The current number of points in the zone. */
/* */
/* n_contours :: The current number of contours in the zone. */
/* */
/* org :: The original glyph coordinates (font */
/* units/scaled). */
/* */
/* cur :: The current glyph coordinates (scaled/hinted). */
/* */
/* tags :: The point control tags. */
/* */
/* contours :: The contours end points. */
/* */
/* first_point :: Offset of the current subglyph's first point. */
/* */
typedef struct TT_GlyphZoneRec_
{
FT_Memory memory;
FT_UShort max_points;
FT_UShort max_contours;
FT_UShort n_points; /* number of points in zone */
FT_Short n_contours; /* number of contours */
 
FT_Vector* org; /* original point coordinates */
FT_Vector* cur; /* current point coordinates */
FT_Vector* orus; /* original (unscaled) point coordinates */
 
FT_Byte* tags; /* current touch flags */
FT_UShort* contours; /* contour end points */
 
FT_UShort first_point; /* offset of first (#0) point */
 
} TT_GlyphZoneRec, *TT_GlyphZone;
 
 
/* handle to execution context */
typedef struct TT_ExecContextRec_* TT_ExecContext;
 
/* glyph loader structure */
typedef struct TT_LoaderRec_
{
FT_Face face;
FT_Size size;
FT_GlyphSlot glyph;
FT_GlyphLoader gloader;
 
FT_ULong load_flags;
FT_UInt glyph_index;
 
FT_Stream stream;
FT_Int byte_len;
 
FT_Short n_contours;
FT_BBox bbox;
FT_Int left_bearing;
FT_Int advance;
FT_Int linear;
FT_Bool linear_def;
FT_Bool preserve_pps;
FT_Vector pp1;
FT_Vector pp2;
 
FT_ULong glyf_offset;
 
/* the zone where we load our glyphs */
TT_GlyphZoneRec base;
TT_GlyphZoneRec zone;
 
TT_ExecContext exec;
FT_Byte* instructions;
FT_ULong ins_pos;
 
/* for possible extensibility in other formats */
void* other;
 
/* since version 2.1.8 */
FT_Int top_bearing;
FT_Int vadvance;
FT_Vector pp3;
FT_Vector pp4;
 
/* since version 2.2.1 */
FT_Byte* cursor;
FT_Byte* limit;
 
} TT_LoaderRec;
 
 
FT_END_HEADER
 
#endif /* __TTTYPES_H__ */
 
 
/* END */