b08fe2dc7a
want to list them all here. The operations performed were all logical transformations of the sources: - trying to convert all enums and constants to CAPITALIZED_STYLE, with #define definitions like #define my_old_constants MY_NEW_CONSTANT - big, big update of the documentation comments * include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c, include/freetype/ftimage.h: adding support for LCD-optimized rendering though the new constants/enums: FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V this is still work in progress, don't expect everything to work correctly though most of the features have been implemented. * adding new FT_LOAD_XXX flags, used to specify both hinting and rendering targets: FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering FT_LOAD_TARGET_MONO :: monochrome bitmaps FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering note that FT_LOAD_TARGET_NORMAL is 0, which means that the default behaviour of the font engine is _unchanged_.
138 lines
4.1 KiB
C
138 lines
4.1 KiB
C
/***************************************************************************/
|
|
/* */
|
|
/* ahmodule.c */
|
|
/* */
|
|
/* Auto-hinting module implementation (declaration). */
|
|
/* */
|
|
/* Copyright 2000-2001, 2002 Catharon Productions Inc. */
|
|
/* Author: David Turner */
|
|
/* */
|
|
/* This file is part of the Catharon Typography Project and shall only */
|
|
/* be used, modified, and distributed under the terms of the Catharon */
|
|
/* Open Source License that should come with this file under the name */
|
|
/* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
|
|
/* this file you indicate that you have read the license and */
|
|
/* understand and accept it fully. */
|
|
/* */
|
|
/* Note that this license is compatible with the FreeType license. */
|
|
/* */
|
|
/***************************************************************************/
|
|
|
|
|
|
#include <ft2build.h>
|
|
#include FT_MODULE_H
|
|
#include "ahhint.h"
|
|
|
|
|
|
#ifdef DEBUG_HINTER
|
|
AH_Hinter ah_debug_hinter = NULL;
|
|
FT_Bool ah_debug_disable_horz = 0;
|
|
FT_Bool ah_debug_disable_vert = 0;
|
|
#endif
|
|
|
|
typedef struct FT_AutoHinterRec_
|
|
{
|
|
FT_ModuleRec root;
|
|
AH_Hinter hinter;
|
|
|
|
} FT_AutoHinterRec;
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
ft_autohinter_init( FT_AutoHinter module )
|
|
{
|
|
FT_Error error;
|
|
|
|
|
|
error = ah_hinter_new( module->root.library, &module->hinter );
|
|
#ifdef DEBUG_HINTER
|
|
if ( !error )
|
|
ah_debug_hinter = module->hinter;
|
|
#endif
|
|
return error;
|
|
}
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
|
ft_autohinter_done( FT_AutoHinter module )
|
|
{
|
|
ah_hinter_done( module->hinter );
|
|
|
|
#ifdef DEBUG_HINTER
|
|
ah_debug_hinter = NULL;
|
|
#endif
|
|
}
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
ft_autohinter_load_glyph( FT_AutoHinter module,
|
|
FT_GlyphSlot slot,
|
|
FT_Size size,
|
|
FT_UInt glyph_index,
|
|
FT_ULong load_flags )
|
|
{
|
|
return ah_hinter_load_glyph( module->hinter,
|
|
slot, size, glyph_index, load_flags );
|
|
}
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
|
ft_autohinter_reset_globals( FT_AutoHinter module,
|
|
FT_Face face )
|
|
{
|
|
FT_UNUSED( module );
|
|
|
|
if ( face->autohint.data )
|
|
ah_hinter_done_face_globals( (AH_Face_Globals )(face->autohint.data) );
|
|
}
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
|
ft_autohinter_get_globals( FT_AutoHinter module,
|
|
FT_Face face,
|
|
void** global_hints,
|
|
long* global_len )
|
|
{
|
|
ah_hinter_get_global_hints( module->hinter, face,
|
|
global_hints, global_len );
|
|
}
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
|
ft_autohinter_done_globals( FT_AutoHinter module,
|
|
void* global_hints )
|
|
{
|
|
ah_hinter_done_global_hints( module->hinter, global_hints );
|
|
}
|
|
|
|
|
|
FT_CALLBACK_TABLE_DEF
|
|
const FT_AutoHinter_ServiceRec ft_autohinter_service =
|
|
{
|
|
ft_autohinter_reset_globals,
|
|
ft_autohinter_get_globals,
|
|
ft_autohinter_done_globals,
|
|
ft_autohinter_load_glyph
|
|
};
|
|
|
|
|
|
FT_CALLBACK_TABLE_DEF
|
|
const FT_Module_Class autohint_module_class =
|
|
{
|
|
ft_module_hinter,
|
|
sizeof ( FT_AutoHinterRec ),
|
|
|
|
"autohinter",
|
|
0x10000L, /* version 1.0 of the autohinter */
|
|
0x20000L, /* requires FreeType 2.0 or above */
|
|
|
|
(const void*) &ft_autohinter_service,
|
|
|
|
(FT_Module_Constructor)ft_autohinter_init,
|
|
(FT_Module_Destructor) ft_autohinter_done,
|
|
(FT_Module_Requester) 0
|
|
};
|
|
|
|
|
|
/* END */
|