Formatting.

This commit is contained in:
Werner Lemberg 2011-01-03 06:50:36 +01:00
parent 91843dfc4a
commit fa1e6b35b4
3 changed files with 72 additions and 45 deletions

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Auto-fitter hinting routines for latin script (body). */ /* Auto-fitter hinting routines for latin script (body). */
/* */ /* */
/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ /* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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, */ /* This file is part of the FreeType project, and may only be used, */
@ -156,7 +156,8 @@
#define AF_LATIN_MAX_TEST_CHARACTERS 12 #define AF_LATIN_MAX_TEST_CHARACTERS 12
static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES][AF_LATIN_MAX_TEST_CHARACTERS+1] = static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES]
[AF_LATIN_MAX_TEST_CHARACTERS+1] =
{ {
"THEZOCQS", "THEZOCQS",
"HEZLOCUS", "HEZLOCUS",
@ -548,7 +549,8 @@
if ( scaled != fitted ) if ( scaled != fitted )
{ {
scale = FT_MulDiv( scale, fitted, scaled ); scale = FT_MulDiv( scale, fitted, scaled );
AF_LOG(( "== scaled x-top = %.2g fitted = %.2g, scaling = %.4g\n", scaled/64.0, fitted/64.0, (fitted*1.0)/scaled )); AF_LOG(( "== scaled x-top = %.2g fitted = %.2g, scaling = %.4g\n",
scaled / 64.0, fitted / 64.0, ( fitted * 1.0 ) / scaled ));
} }
#endif #endif
} }
@ -624,7 +626,9 @@
blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); blue->ref.fit = FT_PIX_ROUND( blue->ref.cur );
blue->shoot.fit = blue->ref.fit + delta2; blue->shoot.fit = blue->ref.fit + delta2;
AF_LOG(( ">> activating blue zone %d: ref.cur=%.2g ref.fit=%.2g shoot.cur=%.2g shoot.fit=%.2g\n", AF_LOG(( ">> activating blue zone %d:"
" ref.cur=%.2g ref.fit=%.2g"
" shoot.cur=%.2g shoot.fit=%.2g\n",
nn, blue->ref.cur / 64.0, blue->ref.fit / 64.0, nn, blue->ref.cur / 64.0, blue->ref.fit / 64.0,
blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 ));
@ -1137,7 +1141,8 @@
/* insert a new edge in the list and */ /* insert a new edge in the list and */
/* sort according to the position */ /* sort according to the position */
error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, memory, &edge ); error = af_axis_hints_new_edge( axis, seg->pos, seg->dir,
memory, &edge );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -1796,7 +1801,8 @@
AF_LOG(( "==== hinting %s edges =====\n", dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); AF_LOG(( "==== hinting %s edges =====\n",
dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ));
/* we begin by aligning all stems relative to the blue zone */ /* we begin by aligning all stems relative to the blue zone */
/* if needed -- that's only for horizontal edges */ /* if needed -- that's only for horizontal edges */
@ -1965,7 +1971,8 @@
org_left = org_pos + ((org_len - cur_len) >> 1); org_left = org_pos + ((org_len - cur_len) >> 1);
org_right = org_pos + ((org_len + cur_len) >> 1); org_right = org_pos + ((org_len + cur_len) >> 1);
AF_LOG(( "ALIGN: left=%.2f right=%.2f ", org_left/64.0, org_right/64.0 )); AF_LOG(( "ALIGN: left=%.2f right=%.2f ",
org_left / 64.0, org_right / 64.0 ));
cur_center = org_center; cur_center = org_center;
if ( edge2->flags & AF_EDGE_DONE ) if ( edge2->flags & AF_EDGE_DONE )
@ -2215,12 +2222,15 @@
FT_MulDiv( edge->opos - before->opos, FT_MulDiv( edge->opos - before->opos,
after->pos - before->pos, after->pos - before->pos,
after->opos - before->opos ); after->opos - before->opos );
AF_LOG(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f) from %d (opos=%.2f)\n", AF_LOG(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)"
edge-edges, edge->opos / 64.0, edge->pos / 64.0, before - edges, before->opos / 64.0 )); " from %d (opos=%.2f)\n",
edge-edges, edge->opos / 64.0, edge->pos / 64.0,
before - edges, before->opos / 64.0 ));
} }
else else
{ {
edge->pos = anchor->pos + (( edge->opos - anchor->opos + 16) & ~31); edge->pos = anchor->pos +
( ( edge->opos - anchor->opos + 16 ) & ~31 );
AF_LOG(( "SERIF_LINK2: edge %d (opos=%.2f) snapped to (%.2f)\n", AF_LOG(( "SERIF_LINK2: edge %d (opos=%.2f) snapped to (%.2f)\n",
edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
@ -2321,7 +2331,7 @@
static const AF_Script_UniRangeRec af_latin2_uniranges[] = static const AF_Script_UniRangeRec af_latin2_uniranges[] =
{ {
AF_UNIRANGE_REC( 32UL, 127UL ), /* XXX: TODO: Add new Unicode ranges here! */ AF_UNIRANGE_REC( 32UL, 127UL ), /* TODO: Add new Unicode ranges here! */
AF_UNIRANGE_REC( 160UL, 255UL ), AF_UNIRANGE_REC( 160UL, 255UL ),
AF_UNIRANGE_REC( 0UL, 0UL ) AF_UNIRANGE_REC( 0UL, 0UL )
}; };

View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType position independent code services for autofit module. */ /* The FreeType position independent code services for autofit module. */
/* */ /* */
/* Copyright 2009, 2010 by */ /* Copyright 2009, 2010, 2011 by */
/* Oran Agra and Mickey Gabel. */ /* Oran Agra and Mickey Gabel. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -24,7 +24,8 @@
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
/* forward declaration of PIC init functions from afmodule.c */ /* forward declaration of PIC init functions from afmodule.c */
void FT_Init_Class_af_autofitter_service( FT_Library, FT_AutoHinter_ServiceRec*); void FT_Init_Class_af_autofitter_service( FT_Library,
FT_AutoHinter_ServiceRec* );
/* forward declaration of PIC init functions from script classes */ /* forward declaration of PIC init functions from script classes */
#include "aflatin.h" #include "aflatin.h"
@ -38,6 +39,8 @@
{ {
FT_PIC_Container* pic_container = &library->pic_container; FT_PIC_Container* pic_container = &library->pic_container;
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
if ( pic_container->autofit ) if ( pic_container->autofit )
{ {
FT_FREE( pic_container->autofit ); FT_FREE( pic_container->autofit );
@ -62,26 +65,35 @@
FT_MEM_SET( container, 0, sizeof ( *container ) ); FT_MEM_SET( container, 0, sizeof ( *container ) );
pic_container->autofit = container; pic_container->autofit = container;
/* initialize pointer table - this is how the module usually expects this data */ /* initialize pointer table - */
/* this is how the module usually expects this data */
for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ ) for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ )
{ {
container->af_script_classes[ss] = &container->af_script_classes_rec[ss]; container->af_script_classes[ss] =
&container->af_script_classes_rec[ss];
} }
container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL; container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL;
/* add call to initialization function when you add new scripts */ /* add call to initialization function when you add new scripts */
ss = 0; ss = 0;
FT_Init_Class_af_dummy_script_class(&container->af_script_classes_rec[ss++]); FT_Init_Class_af_dummy_script_class(
&container->af_script_classes_rec[ss++] );
#ifdef FT_OPTION_AUTOFIT2 #ifdef FT_OPTION_AUTOFIT2
FT_Init_Class_af_latin2_script_class(&container->af_script_classes_rec[ss++]); FT_Init_Class_af_latin2_script_class(
&container->af_script_classes_rec[ss++] );
#endif #endif
FT_Init_Class_af_latin_script_class(&container->af_script_classes_rec[ss++]); FT_Init_Class_af_latin_script_class(
FT_Init_Class_af_cjk_script_class(&container->af_script_classes_rec[ss++]); &container->af_script_classes_rec[ss++] );
FT_Init_Class_af_indic_script_class(&container->af_script_classes_rec[ss++]); FT_Init_Class_af_cjk_script_class(
&container->af_script_classes_rec[ss++] );
FT_Init_Class_af_indic_script_class(
&container->af_script_classes_rec[ss++] );
FT_Init_Class_af_autofitter_service(library, &container->af_autofitter_service); FT_Init_Class_af_autofitter_service(
library, &container->af_autofitter_service );
/* Exit: */ /* Exit: */
if ( error ) if ( error )
autofit_module_class_pic_free( library ); autofit_module_class_pic_free( library );
return error; return error;

View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType position independent code services for autofit module. */ /* The FreeType position independent code services for autofit module. */
/* */ /* */
/* Copyright 2009 by */ /* Copyright 2009, 2011 by */
/* Oran Agra and Mickey Gabel. */ /* Oran Agra and Mickey Gabel. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -33,7 +33,8 @@ FT_BEGIN_HEADER
#include "aftypes.h" #include "aftypes.h"
/* increase these when you add new scripts, and update autofit_module_class_pic_init */ /* increase these when you add new scripts, */
/* and update autofit_module_class_pic_init */
#ifdef FT_OPTION_AUTOFIT2 #ifdef FT_OPTION_AUTOFIT2
#define AF_SCRIPT_CLASSES_COUNT 6 #define AF_SCRIPT_CLASSES_COUNT 6
#else #else
@ -46,11 +47,15 @@ FT_BEGIN_HEADER
AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT]; AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT];
AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT]; AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT];
FT_AutoHinter_ServiceRec af_autofitter_service; FT_AutoHinter_ServiceRec af_autofitter_service;
} AFModulePIC; } AFModulePIC;
#define GET_PIC(lib) ((AFModulePIC*)((lib)->pic_container.autofit)) #define GET_PIC( lib ) \
#define AF_SCRIPT_CLASSES_GET (GET_PIC(FT_FACE_LIBRARY(globals->face))->af_script_classes) ( (AFModulePIC*)((lib)->pic_container.autofit) )
#define AF_AF_AUTOFITTER_SERVICE_GET (GET_PIC(library)->af_autofitter_service) #define AF_SCRIPT_CLASSES_GET \
( GET_PIC( FT_FACE_LIBRARY(globals->face) )->af_script_classes )
#define AF_AF_AUTOFITTER_SERVICE_GET \
( GET_PIC( library )->af_autofitter_service )
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */