From fa1e6b35b4571c49bc8e424f77839ecd856dab9b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 3 Jan 2011 06:50:36 +0100 Subject: [PATCH] Formatting. --- src/autofit/aflatin2.c | 44 ++++++++++++++++++++++++---------------- src/autofit/afpic.c | 46 ++++++++++++++++++++++++++---------------- src/autofit/afpic.h | 27 +++++++++++++++---------- 3 files changed, 72 insertions(+), 45 deletions(-) diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c index 6546475a1..4a8af0c07 100644 --- a/src/autofit/aflatin2.c +++ b/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* 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. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -156,7 +156,8 @@ #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", "HEZLOCUS", @@ -182,9 +183,9 @@ FT_GlyphSlot glyph = face->glyph; - /* we compute the blues simply by loading each character from the */ + /* we compute the blues simply by loading each character from the */ /* 'af_latin2_blue_chars[blues]' string, then compute its top-most or */ - /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ + /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ AF_LOG(( "blue zones computation\n" )); AF_LOG(( "------------------------------------------------\n" )); @@ -548,7 +549,8 @@ if ( scaled != fitted ) { 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 } @@ -624,9 +626,11 @@ blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); 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", - nn, blue->ref.cur/64.0, blue->ref.fit/64.0, - blue->shoot.cur/64.0, blue->shoot.fit/64.0 )); + 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, + blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); blue->flags |= AF_LATIN_BLUE_ACTIVE; } @@ -1137,7 +1141,8 @@ /* insert a new edge in the list and */ /* 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 ) 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 */ /* if needed -- that's only for horizontal edges */ @@ -1965,7 +1971,8 @@ org_left = 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; if ( edge2->flags & AF_EDGE_DONE ) @@ -2066,8 +2073,8 @@ edge->pos = cur_center - (cur_len >> 1); edge2->pos = edge->pos + cur_len; - AF_LOG(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f) " - "snapped to (%.2f) and (%.2f), org_len = %.2f cur_len=%.2f\n", + AF_LOG(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f)" + " snapped to (%.2f) and (%.2f), org_len=%.2f cur_len=%.2f\n", edge-edges, edge->opos / 64.0, edge2-edges, edge2->opos / 64.0, edge->pos / 64.0, edge2->pos / 64.0, @@ -2215,12 +2222,15 @@ FT_MulDiv( edge->opos - before->opos, after->pos - before->pos, after->opos - before->opos ); - AF_LOG(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f) from %d (opos=%.2f)\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0, before - edges, before->opos / 64.0 )); + AF_LOG(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)" + " from %d (opos=%.2f)\n", + edge-edges, edge->opos / 64.0, edge->pos / 64.0, + before - edges, before->opos / 64.0 )); } 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", edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); @@ -2321,7 +2331,7 @@ 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( 0UL, 0UL ) }; diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index 5b9aba691..3aefbc51c 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2011 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,7 +24,8 @@ #ifdef FT_CONFIG_OPTION_PIC /* 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 */ #include "aflatin.h" @@ -34,10 +35,12 @@ #include "afindic.h" void - autofit_module_class_pic_free( FT_Library library ) + autofit_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->autofit ) { FT_FREE( pic_container->autofit ); @@ -62,28 +65,37 @@ FT_MEM_SET( container, 0, sizeof ( *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++ ) { - 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 */ 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 - 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 - FT_Init_Class_af_latin_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_latin_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:*/ - if(error) - autofit_module_class_pic_free(library); +/* Exit: */ + + if ( error ) + autofit_module_class_pic_free( library ); return error; } diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h index 80e62d39a..c1632e76e 100644 --- a/src/autofit/afpic.h +++ b/src/autofit/afpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2011 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,24 +33,29 @@ FT_BEGIN_HEADER #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 - #define AF_SCRIPT_CLASSES_COUNT 6 +#define AF_SCRIPT_CLASSES_COUNT 6 #else - #define AF_SCRIPT_CLASSES_COUNT 5 +#define AF_SCRIPT_CLASSES_COUNT 5 #endif -#define AF_SCRIPT_CLASSES_REC_COUNT (AF_SCRIPT_CLASSES_COUNT-1) +#define AF_SCRIPT_CLASSES_REC_COUNT ( AF_SCRIPT_CLASSES_COUNT - 1 ) typedef struct AFModulePIC_ { - AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT]; - AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT]; - FT_AutoHinter_ServiceRec af_autofitter_service; + AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT]; + AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT]; + FT_AutoHinter_ServiceRec af_autofitter_service; + } AFModulePIC; -#define GET_PIC(lib) ((AFModulePIC*)((lib)->pic_container.autofit)) -#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) +#define GET_PIC( lib ) \ + ( (AFModulePIC*)((lib)->pic_container.autofit) ) +#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 */