Formatting.

Fixing a bug in FT_Get_Kerning().

Moving FT_Get_Module_Interface() to ftoutln.c.
This commit is contained in:
Werner Lemberg 2000-07-14 06:16:47 +00:00
parent 8cfcf6e057
commit 5aa646c565
21 changed files with 242 additions and 225 deletions

View File

@ -7,8 +7,8 @@
/* Copyright 1996-2000 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 */
/* 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. */

View File

@ -2,7 +2,7 @@
/* */
/* fterrors.h */
/* */
/* FreeType error codes (specification). */
/* FreeType error codes (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* ftglyph.h */
/* */
/* FreeType convenience functions to handle glyphs.. */
/* FreeType convenience functions to handle glyphs (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,10 +2,11 @@
/* */
/* ftimage.h */
/* */
/* FreeType glyph image formats and default raster interface. */
/* FreeType glyph image formats and default raster interface */
/* (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* 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 */

View File

@ -2,7 +2,7 @@
/* */
/* ftmm.h */
/* */
/* FreeType Multiple Master font interface. */
/* FreeType Multiple Master font interface (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -47,7 +47,7 @@
FT_String* name;
FT_Long minimum;
FT_Long maximum;
} FT_MM_Axis;
@ -75,13 +75,13 @@
FT_UInt num_axis;
FT_UInt num_designs;
FT_MM_Axis axis[T1_MAX_MM_AXIS];
} FT_Multi_Master;
typedef FT_Error (*FT_Get_MM_Func)( FT_Face face,
FT_Multi_Master* master );
typedef FT_Error (*FT_Set_MM_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );

View File

@ -2,7 +2,7 @@
/* */
/* ftmodule.h */
/* */
/* FreeType modules public interface. */
/* FreeType modules public interface (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -99,7 +99,7 @@
FT_Module_Constructor module_init;
FT_Module_Destructor module_done;
FT_Module_Requester get_interface;
} FT_Module_Class;
@ -151,32 +151,6 @@
const char* module_name );
/*************************************************************************/
/* */
/* <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_EXPORT_DEF( const void* ) FT_Get_Module_Interface(
FT_Library library,
const char* mod_name );
/*************************************************************************/
/* */
/* <Function> */
@ -244,7 +218,7 @@
typedef void (*FT_DebugHook_Func)( void* arg );
/*************************************************************************/
/* */
/* <Function> */

View File

@ -2,8 +2,8 @@
/* */
/* ftoutln.h */
/* */
/* Support for the FT_Outline type (used to store glyph shapes of */
/* most scalable font formats) */
/* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* ftrender.h */
/* */
/* FreeType renderer modules public interface */
/* FreeType renderer modules public interface (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* ftsystem.h */
/* */
/* FreeType low-level system interface definition */
/* FreeType low-level system interface definition (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* fttypes.h */
/* */
/* FreeType simple types definitions */
/* FreeType simple types definitions (specification only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* autohint.h */
/* */
/* High-level `autohint" module-specific interface (specification) */
/* High-level `autohint' module-specific interface (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -13,159 +13,172 @@
/* 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 */
/* when a format-specific hinter isn't available.. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* 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
* agressively 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 require a lot more horsepower.
*
* Because a sufficiently sophisticated font management system would
* typically implement a 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 :o)
*
* I initially though that it'd be a good idea to cache the glyph hints too,
* however, if my general idea now is that if you really need to cache these
* too, you're simply in need of a new font format, where all this information
* could be stored within the font file and decoded on the fly :-)
*
*/
/*************************************************************************/
/* */
/* 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 */
/* agressively 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 <freetype/freetype.h>
typedef struct FT_AutoHinterRec_ *FT_AutoHinter;
/***********************************************************************
*
* <FuncType>
* FT_AutoHinter_Get_Global_Func
*
* <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_Done_Global_Func.
*
* <Input>
* hinter :: handle to source auto-hinter
* face :: handle to source face object
*
* <Output>
* global_hints :: typeless pointer to the global hints
* global_len :: size in bytes of global hints
*
*/
typedef void (*FT_AutoHinter_Get_Global_Func)( FT_AutoHinter hinter,
FT_Face face,
void* *global_hints,
long *global_len );
/***********************************************************************
*
* <FuncType>
* FT_AutoHinter_Done_Global_Func
*
* <Description>
* Discards the global hints retrieved through
* FT_AutoHinter_Get_Global_Func. This is the only way these hints
* are freed from memory.
*
* <Input>
* hinter :: handle to auto-hinter module
* global :: pointer to retrieved global hints to discard
*/
typedef void (*FT_AutoHinter_Done_Global_Func)( FT_AutoHinter hinter,
void* global );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_Get_Global_Func */
/* */
/* <Description> */
/* Retrieves 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_Done_Global_Func(). */
/* */
/* <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_Get_Global_Func)(
FT_AutoHinter hinter,
FT_Face face,
void** global_hints,
long* global_len );
/***********************************************************************
*
* <FuncType>
* FT_AutoHinter_Reset_Func
*
* <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 :: handle to source auto-hinter
* face :: handle to the face.
*
*
*/
typedef void (*FT_AutoHinter_Reset_Func)( FT_AutoHinter hinter,
FT_Face face );
/***********************************************************************
*
* <FuncType>
* FT_AutoHinter_Load_Func
*
* <Description>
* This function is used to load, scale and automatically hint a glyph
* from a given face.
*
* <Input>
* face :: handle to the face.
* glyph_index :: glyph index
* load_flags :: 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_Load_Func)(
FT_AutoHinter hinter,
FT_GlyphSlot slot,
FT_Size size,
FT_UInt glyph_index,
FT_ULong load_flags );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_Done_Global_Func */
/* */
/* <Description> */
/* Discards the global hints retrieved through */
/* FT_AutoHinter_Get_Global_Func(). 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_Done_Global_Func)( FT_AutoHinter hinter,
void* global );
/***********************************************************************
*
* <Struct>
* FT_AutoHinter_Interface
*
* <Description>
* The auto-hinter module's interface.
*
*/
typedef struct FT_AutoHinter_Interface
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_Reset_Func */
/* */
/* <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_Reset_Func)( FT_AutoHinter hinter,
FT_Face face );
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_AutoHinter_Load_Func */
/* */
/* <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_Load_Func)( FT_AutoHinter hinter,
FT_GlyphSlot slot,
FT_Size size,
FT_UInt glyph_index,
FT_ULong load_flags );
/*************************************************************************/
/* */
/* <Struct> */
/* FT_AutoHinter_Interface */
/* */
/* <Description> */
/* The auto-hinter module's interface. */
/* */
typedef struct FT_AutoHinter_Interface
{
FT_AutoHinter_Reset_Func reset_face;
FT_AutoHinter_Load_Func load_glyph;
@ -175,5 +188,8 @@
} FT_AutoHinter_Interface;
#endif /* AUTOHINT_H */
/* END */

View File

@ -5,10 +5,10 @@
/* The FreeType private base classes (specification). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* 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 */
/* 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. */
@ -142,6 +142,32 @@
#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 :-) */
/* */
BASE_DEF( const void* ) FT_Get_Module_Interface( FT_Library library,
const char* mod_name );
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/

View File

@ -2,7 +2,8 @@
/* */
/* t1tables.h */
/* */
/* Basic Type 1/Type 2 tables definitions and interface */
/* Basic Type 1/Type 2 tables definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -139,7 +140,7 @@
/* maximum number of Multiple Masters designs, as defined in the spec */
#define T1_MAX_MM_DESIGNS 16
/* maximum number of Multiple Masters axes, as defined in the spec */
#define T1_MAX_MM_AXIS 4
@ -153,7 +154,7 @@
FT_Byte num_points;
FT_Fixed* design_points;
FT_Fixed* blend_points;
} T1_DesignMap;
@ -161,19 +162,19 @@
{
FT_UInt num_designs;
FT_UInt num_axis;
FT_String* axis_names[T1_MAX_MM_AXIS];
FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
T1_DesignMap design_map[T1_MAX_MM_AXIS];
FT_Fixed* weight_vector;
FT_Fixed* default_weight_vector;
T1_FontInfo* font_infos[T1_MAX_MM_DESIGNS + 1];
T1_Private* privates [T1_MAX_MM_DESIGNS + 1];
FT_ULong blend_bitflags;
} T1_Blend;
@ -185,7 +186,7 @@
FT_Fixed forcebold_threshold;
FT_Pos stroke_width;
FT_Fixed expansion_factor;
FT_Byte paint_type;
FT_Byte font_type;
FT_Matrix font_matrix;

View File

@ -2,7 +2,7 @@
/* */
/* ttmakeid.h */
/* */
/* TrueType name ID definitions */
/* TrueType name ID definitions (specification only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -3,6 +3,7 @@
/* tttables.h */
/* */
/* Basic SFNT/TrueType tables definitions and interface */
/* (specification only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -428,7 +429,7 @@
FT_Char WidthType;
FT_Byte SerifStyle;
FT_Byte Reserved;
} TT_PCLT;

View File

@ -9,7 +9,7 @@
/* */
/* 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 */
/* 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. */
/* */

View File

@ -2,7 +2,7 @@
/* */
/* ftbase.c */
/* */
/* Single object library component. */
/* Single object library component (body only). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* ftextend.h */
/* */
/* FreeType extensions implementation (body). */
/* FreeType extensions implementation (body). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* ftinit.c */
/* */
/* FreeType initialisation layer (body). */
/* FreeType initialization layer (body). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */

View File

@ -2,7 +2,7 @@
/* */
/* ftobjs.c */
/* */
/* The FreeType private base classes (base). */
/* The FreeType private base classes (body). */
/* */
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
@ -2088,32 +2088,30 @@
driver = face->driver;
memory = driver->root.memory;
kerning->x = 0;
kerning->y = 0;
if ( driver->clazz->get_kerning )
{
error = driver->clazz->get_kerning( face,
left_glyph,
right_glyph,
kerning );
}
if ( !error )
{
if ( kern_mode != ft_kerning_unscaled )
if ( !error )
{
kerning->x = FT_MulFix( kerning->x, face->size->metrics.x_scale );
kerning->y = FT_MulFix( kerning->y, face->size->metrics.y_scale );
if ( kern_mode != ft_kerning_unfitted )
if ( kern_mode != ft_kerning_unscaled )
{
kerning->x = ( kerning->x + 32 ) & -64;
kerning->y = ( kerning->y + 32 ) & -64;
kerning->x = FT_MulFix( kerning->x, face->size->metrics.x_scale );
kerning->y = FT_MulFix( kerning->y, face->size->metrics.y_scale );
if ( kern_mode != ft_kerning_unfitted )
{
kerning->x = ( kerning->x + 32 ) & -64;
kerning->y = ( kerning->y + 32 ) & -64;
}
}
}
}
else
{
kerning->x = 0;
kerning->y = 0;
}
return error;
}
@ -2922,9 +2920,8 @@
/* You should better be familiar with FreeType internals to know */
/* which module to look for, and what its interface is :-) */
/* */
FT_EXPORT_FUNC( const void* ) FT_Get_Module_Interface(
FT_Library library,
const char* mod_name )
BASE_FUNC( const void* ) FT_Get_Module_Interface( FT_Library library,
const char* mod_name )
{
FT_Module module;

View File

@ -1264,7 +1264,7 @@
args = stack;
/* adding six more points; 4 control points, 2 on-curve point */
/* adding six more points; 4 control points, 2 on-curve points */
if ( start_point( builder, x, y ) ||
check_points ( builder, 6 ) )
goto Memory_Error;
@ -1316,7 +1316,7 @@
FT_TRACE4(( " flex1" ));
/* adding five more points; 4 control points, 1 on-curve point */
/* adding six more points; 4 control points, 2 on-curve points */
if ( start_point( builder, x, y ) ||
check_points( builder, 6 ) )
goto Memory_Error;
@ -1355,7 +1355,7 @@
args += 2;
}
/* is last operand a x or y delta ? */
/* is last operand an x- or y-delta? */
if ( horizontal )
{
x += args[0];
@ -1389,7 +1389,8 @@
{
x += args[0];
y += args[1];
add_point( builder, x, y, (FT_Bool)( count == 3 || count == 0) );
add_point( builder, x, y,
(FT_Bool)( count == 3 || count == 0 ) );
args += 2;
}