diff -Nru freetype-2.7.1/debian/changelog freetype-2.8/debian/changelog --- freetype-2.7.1/debian/changelog 2017-10-09 07:24:26.000000000 +0000 +++ freetype-2.8/debian/changelog 2017-10-09 07:24:27.000000000 +0000 @@ -1,12 +1,12 @@ -freetype (2.7.1-0ubuntu0.17.04ppa1) zesty; urgency=low +freetype (2.8-0ubuntu0.17.04ppa2) zesty; urgency=low * Ignore compiler warnings - * Update freetype to 2.7.1 + * Update freetype to 2.8 * Remove unnecessary patches * Add infinality patch * Ignore extra symbols - -- Bob Chez Mon, 17 Apr 2017 22:17:50 +0000 + -- Bob Chez Mon, 09 Oct 2017 07:13:26 +0000 freetype (2.6.3-3ubuntu2) zesty; urgency=medium diff -Nru freetype-2.7.1/debian/patches-freetype/0002-infinality-2.7.1-2017.01.11.patch freetype-2.8/debian/patches-freetype/0002-infinality-2.7.1-2017.01.11.patch --- freetype-2.7.1/debian/patches-freetype/0002-infinality-2.7.1-2017.01.11.patch 2017-10-09 07:24:26.000000000 +0000 +++ freetype-2.8/debian/patches-freetype/0002-infinality-2.7.1-2017.01.11.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,5720 +0,0 @@ -diff -ruN freetype-2.7.1-orig/builds/freetype.mk freetype-2.7.1/builds/freetype.mk ---- freetype-2.7.1-orig/builds/freetype.mk 2017-01-11 12:28:16.720016867 +0100 -+++ freetype-2.7.1/builds/freetype.mk 2017-01-11 12:28:34.873016390 +0100 -@@ -161,6 +161,7 @@ - $(CFLAGS) \ - $DFT2_BUILD_LIBRARY \ - $DFT_CONFIG_MODULES_H="" \ -+ $D_GNU_SOURCE \ - $(FTOPTION_FLAG) - - -diff -ruN freetype-2.7.1-orig/configure freetype-2.7.1/configure ---- freetype-2.7.1-orig/configure 2017-01-11 12:28:16.730016867 +0100 -+++ freetype-2.7.1/configure 2017-01-11 12:28:34.873016390 +0100 -@@ -13,6 +13,8 @@ - # Call the `configure' script located in `builds/unix'. - # - -+export LDFLAGS="$LDFLAGS -lm" -+ - rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk - - # respect GNUMAKE environment variable for backwards compatibility -diff -ruN freetype-2.7.1-orig/devel/ftoption.h freetype-2.7.1/devel/ftoption.h ---- freetype-2.7.1-orig/devel/ftoption.h 2017-01-11 12:28:16.713016867 +0100 -+++ freetype-2.7.1/devel/ftoption.h 2017-01-11 12:28:34.874016390 +0100 -@@ -626,6 +626,16 @@ - /* */ - #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - -+ /*************************************************************************/ -+ /* */ -+ /* Define FT_CONFIG_OPTION_INFINALITY_PATCHSET if you want to enable */ -+ /* all additional infinality patches, which are configured via env */ -+ /* variables. */ -+ /* */ -+ /* This option requires TT_CONFIG_OPTION_SUBPIXEL_HINTING to */ -+ /* defined. */ -+ /* */ -+#define FT_CONFIG_OPTION_INFINALITY_PATCHSET - - /*************************************************************************/ - /* */ -diff -ruN freetype-2.7.1-orig/include/freetype/config/ftoption.h freetype-2.7.1/include/freetype/config/ftoption.h ---- freetype-2.7.1-orig/include/freetype/config/ftoption.h 2017-01-11 12:28:16.720016867 +0100 -+++ freetype-2.7.1/include/freetype/config/ftoption.h 2017-01-11 12:31:27.676011855 +0100 -@@ -122,7 +122,7 @@ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ --/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ -+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - - /*************************************************************************/ -@@ -626,6 +626,17 @@ - /* */ - #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - -+ /*************************************************************************/ -+ /* */ -+ /* Define FT_CONFIG_OPTION_INFINALITY_PATCHSET if you want to enable */ -+ /* all additional infinality patches, which are configured via env */ -+ /* variables. */ -+ /* */ -+ /* This option requires TT_CONFIG_OPTION_SUBPIXEL_HINTING to */ -+ /* defined. */ -+ /* */ -+#define FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ - - /*************************************************************************/ - /* */ -@@ -675,8 +686,8 @@ - /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ - /* */ - /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ --#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 --/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */ -+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 -+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) - - - /*************************************************************************/ -diff -ruN freetype-2.7.1-orig/src/autofit/aflatin.c freetype-2.7.1/src/autofit/aflatin.c ---- freetype-2.7.1-orig/src/autofit/aflatin.c 2017-01-11 12:28:16.724016867 +0100 -+++ freetype-2.7.1/src/autofit/aflatin.c 2017-01-11 12:28:34.876016390 +0100 -@@ -24,7 +24,10 @@ - #include "afpic.h" - #include "aflatin.h" - #include "aferrors.h" -- -+#include "strings.h" -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "../base/ftinf.h" -+#endif - - #ifdef AF_CONFIG_OPTION_USE_WARPER - #include "afwarp.h" -@@ -40,6 +43,10 @@ - #undef FT_COMPONENT - #define FT_COMPONENT trace_aflatin - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+FT_Pos infinality_cur_width = 0; -+#endif -+ - - /* needed for computation of round vs. flat segments */ - #define FLAT_THRESHOLD( x ) ( x / 14 ) -@@ -1028,7 +1035,10 @@ - FT_Pos delta; - AF_LatinAxis axis; - FT_UInt nn; -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ FT_Bool adjust_heights = FALSE; -+ if(ftinf) adjust_heights=ftinf->autohint_increase_glyph_heights; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - - if ( dim == AF_DIMENSION_HORZ ) - { -@@ -1056,7 +1066,7 @@ - { - AF_LatinAxis Axis = &metrics->axis[AF_DIMENSION_VERT]; - AF_LatinBlue blue = NULL; -- -+ int threshold = 40; - - for ( nn = 0; nn < Axis->blue_count; nn++ ) - { -@@ -1066,7 +1076,12 @@ - break; - } - } -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( adjust_heights && -+ metrics->root.scaler.face->size->metrics.x_ppem < 15 && -+ metrics->root.scaler.face->size->metrics.x_ppem > 5 ) -+ threshold = 52; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - if ( blue ) - { - FT_Pos scaled; -@@ -1222,7 +1237,13 @@ - - /* a blue zone is only active if it is less than 3/4 pixels tall */ - dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); -+ -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ /* Do at low ppems ( ~< 200 ), in order to prevent fringes */ -+ if ( dist <= 256 && dist >= -256 ) -+#else - if ( dist <= 48 && dist >= -48 ) -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - { - #if 0 - FT_Pos delta1; -@@ -1273,7 +1294,12 @@ - delta2 = -delta2; - - blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ /* Round to prevent fringes */ -+ blue->shoot.fit = FT_PIX_ROUND( blue->ref.fit - delta2 ); -+#else - blue->shoot.fit = blue->ref.fit - delta2; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - - #endif - -@@ -2407,7 +2433,10 @@ - dist = edge->fpos - blue->shoot.org; - if ( dist < 0 ) - dist = -dist; -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ /* round down to pixels */ -+ /*dist = FT_MulFix( dist, scale ) & ~63;*/ -+#endif - dist = FT_MulFix( dist, scale ); - if ( dist < best_dist ) - { -@@ -2583,8 +2612,17 @@ - FT_Pos dist = width; - FT_Int sign = 0; - FT_Int vertical = ( dim == AF_DIMENSION_VERT ); -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ FT_Int infinality_dist = 0; -+ FT_UInt autohint_snap_stem_height = 0; -+ if( ftinf ) autohint_snap_stem_height=ftinf->autohint_snap_stem_height; -+ if ( autohint_snap_stem_height > 100 ) -+ autohint_snap_stem_height = 100; -+ else if ( autohint_snap_stem_height < 0 ) -+ autohint_snap_stem_height = 0; - -- -+ if ( autohint_snap_stem_height == 0 ) -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || - axis->extra_light ) - return width; -@@ -2594,9 +2632,76 @@ - dist = -width; - sign = 1; - } -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ /* Calculate snap value differently than standard freetype */ -+ if ( autohint_snap_stem_height > 0 && -+ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || -+ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ) -+ { -+ infinality_dist = af_latin_snap_width( axis->widths, -+ axis->width_count, dist ); -+ -+ if ( metrics->root.scaler.face->size->metrics.x_ppem > 9 && -+ axis->width_count > 0 && -+ abs( axis->widths[0].cur - infinality_dist ) < 32 && -+ axis->widths[0].cur > 52 ) -+ { -+ const char *style_name=metrics->root.scaler.face->style_name; -+ if ( style_name!=NULL && -+ ( strstr( style_name, "Regular" ) || -+ strstr( style_name, "Book" ) || -+ strstr( style_name, "Medium" ) || -+ strcmp( style_name, "Italic" ) == 0 || -+ strcmp( style_name, "Oblique" ) == 0 ) -+ ) -+ { -+ /* regular weight */ -+ if ( axis->widths[0].cur < 64 ) -+ infinality_dist = 64; -+ else if ( axis->widths[0].cur < 88 ) -+ infinality_dist = 64; -+ else if ( axis->widths[0].cur < 160 ) -+ infinality_dist = 128; -+ else if ( axis->widths[0].cur < 240 ) -+ infinality_dist = 190; -+ else infinality_dist = ( infinality_dist ) & ~63; -+ } -+ else -+ { -+ /* bold gets a different threshold */ -+ if ( axis->widths[0].cur < 64 ) -+ infinality_dist = 64 ; -+ else if ( axis->widths[0].cur < 108 ) -+ infinality_dist = 64; -+ else if ( axis->widths[0].cur < 160 ) -+ infinality_dist = 128; -+ else if ( axis->widths[0].cur < 222 ) -+ infinality_dist = 190; -+ else if ( axis->widths[0].cur < 288 ) -+ infinality_dist = 254; -+ else infinality_dist = ( infinality_dist + 16 ) & ~63; -+ } - -- if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || -+ } -+ if ( infinality_dist < 52 ) -+ { -+ if ( metrics->root.scaler.face->size->metrics.x_ppem < 9 ) -+ { -+ if ( infinality_dist < 32 ) -+ infinality_dist = 32; -+ } -+ else -+ infinality_dist = 64; -+ } -+ } -+ else if ( autohint_snap_stem_height < 100 && -+ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || -+ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ) -+#else -+ -+ if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || - ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - { - /* smooth hinting process: very lightly quantize the stem width */ - -@@ -2688,6 +2793,9 @@ - } - } - else -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( autohint_snap_stem_height < 100 ) -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - { - /* strong hinting process: snap the stem width to integer pixels */ - -@@ -2695,7 +2803,10 @@ - - - dist = af_latin_snap_width( axis->widths, axis->width_count, dist ); -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( autohint_snap_stem_height > 0 ) -+ goto Done_Width; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - if ( vertical ) - { - /* in the case of vertical hinting, always round */ -@@ -2758,6 +2869,32 @@ - } - - Done_Width: -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( axis->widths[0].cur > 42 ) -+ /* weighted average */ -+ dist = (dist * ( 100 - autohint_snap_stem_height ) -+ + infinality_dist * autohint_snap_stem_height ) / 100; -+ -+ { -+ int factor = 100; -+ if ( axis->standard_width < 100 ) -+ factor = axis->standard_width; -+ -+ if ( metrics->root.scaler.face->size->metrics.x_ppem >= 9 && dist < 52 ) -+ dist += ( (52 - dist) * factor ) / 100; -+ if ( metrics->root.scaler.face->size->metrics.x_ppem < 9 && dist < 32 ) -+ dist += ( (32 - dist) * factor ) / 100; -+ -+ if ( axis->standard_width > 100 && -+ metrics->root.scaler.face->size->metrics.x_ppem >= 11 && -+ dist < 64 ) -+ dist = 64; -+ if ( axis->standard_width > 100 && -+ metrics->root.scaler.face->size->metrics.x_ppem >= 9 && -+ dist < 52 ) -+ dist = 52; -+ } -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - if ( sign ) - dist = -dist; - -@@ -2776,6 +2913,8 @@ - FT_Pos dist, base_delta; - FT_Pos fitted_width; - -+/* if fitted_width causes stem_edge->pos to land basically on top of an existing -+ * stem_edge->pos, then add or remove 64. Need to figure out a way to do this */ - - dist = stem_edge->opos - base_edge->opos; - base_delta = base_edge->pos - base_edge->opos; -@@ -3384,8 +3523,11 @@ - int dim; - - AF_LatinAxis axis; -- -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ FT_Int emboldening_strength = 0; -+ FT_Bool use_various_tweaks = FALSE; -+ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - error = af_glyph_hints_reload( hints, outline ); - if ( error ) - goto Exit; -@@ -3455,7 +3597,11 @@ - } - - af_glyph_hints_save( hints, outline ); -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ { -+ infinality_cur_width = metrics->axis->widths[0].cur; -+ } -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - Exit: - return error; - } -diff -ruN freetype-2.7.1-orig/src/autofit/aflatin.h freetype-2.7.1/src/autofit/aflatin.h ---- freetype-2.7.1-orig/src/autofit/aflatin.h 2017-01-11 12:28:16.724016867 +0100 -+++ freetype-2.7.1/src/autofit/aflatin.h 2017-01-11 12:28:34.877016390 +0100 -@@ -64,6 +64,9 @@ - - #define AF_LATIN_MAX_WIDTHS 16 - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ extern FT_Pos infinality_cur_width; -+#endif - - #define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */ - #define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */ -diff -ruN freetype-2.7.1-orig/src/autofit/afmodule.c freetype-2.7.1/src/autofit/afmodule.c ---- freetype-2.7.1-orig/src/autofit/afmodule.c 2017-01-11 12:28:16.724016867 +0100 -+++ freetype-2.7.1/src/autofit/afmodule.c 2017-01-11 12:28:34.877016390 +0100 -@@ -22,6 +22,10 @@ - #include "aferrors.h" - #include "afpic.h" - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "../base/ftinf.h" -+#endif -+ - #ifdef FT_DEBUG_AUTOFIT - - #ifndef FT_MAKE_OPTION_SINGLE_OBJECT -@@ -466,6 +470,9 @@ - module->warping = 0; - #endif - module->no_stem_darkening = TRUE; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if(ftinf) module->no_stem_darkening = !ftinf->stem_darkening_autofit; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - - module->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; - module->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; -diff -ruN freetype-2.7.1-orig/src/base/ftbase.c freetype-2.7.1/src/base/ftbase.c ---- freetype-2.7.1-orig/src/base/ftbase.c 2017-01-11 12:28:16.726016867 +0100 -+++ freetype-2.7.1/src/base/ftbase.c 2017-01-11 12:28:34.878016390 +0100 -@@ -34,6 +34,9 @@ - #include "ftstream.c" - #include "fttrigon.c" - #include "ftutil.c" -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "ftinf.c" -+#endif - - #ifdef FT_MACINTOSH - #include "ftmac.c" -diff -ruN freetype-2.7.1-orig/src/base/ftinf.c freetype-2.7.1/src/base/ftinf.c ---- freetype-2.7.1-orig/src/base/ftinf.c 1970-01-01 01:00:00.000000000 +0100 -+++ freetype-2.7.1/src/base/ftinf.c 2017-01-11 12:28:34.879016390 +0100 -@@ -0,0 +1,363 @@ -+#include -+#include "ftinf.h" -+#define true 1 -+#define false 0 -+ -+#define on 1 -+#define off 0 -+#define end (-128) -+ -+#define sw2pv 18 /* STEM_WIDTH_2_PPEM */ -+#define maxp 100 /* MAX_PPEM */ -+ -+typedef signed char pv; /* ppm and values type */ -+/* the arrays start with existence flag + values */ -+typedef struct sa_rules_s { -+ const char *name; -+ pv always_use_100[1+4+1]; -+ pv brightness[1+2+1]; -+ pv contrast[1+2+1]; -+ pv edge_detection[1+4+1]; -+ pv m[1+4+1]; -+ pv bearing_correction[1+2+1]; -+ pv spacing[1+5+1]; -+ pv start[1+5+1]; -+ pv stem_scaling[1+6+1]; -+ pv stem_translating[1+2+1]; -+ pv stem_translating_only[1+10+1]; -+ pv stem_widths[1+4]; /* these end with maxp */ -+ pv synthesize_stems[1+2+1]; -+} sa_rules_t; -+ -+#pragma GCC diagnostic ignored "-Wpedantic" /* C99 struct initializer tags are needed */ -+#pragma GCC diagnostic ignored "-Wunused-function" -+ -+const ftinf_t *ftinf; -+/* final settings, updated from environment */ -+ftinf_t _env; -+ -+/* rules and hashing function */ -+#include "ftinf_rh.c" -+ -+/* rules selection */ -+void ftinf_fill_stem_values( Stem_Data *stem_values, -+ const char *family, int ppem, int use_known ){ -+ /* set the defaults */ -+ stem_values->bearing_correction = TRUE; -+ stem_values->brightness = 0.0; -+ stem_values->contrast = 0.0; -+ stem_values->edge_detection = FALSE; -+ stem_values->m = -1; -+ stem_values->stem_scaling = -1; -+ stem_values->stem_spacing = -1; -+ stem_values->stem_start = -1; -+ stem_values->stem_translating = 0; -+ stem_values->stem_translating_only = -1024; -+ stem_values->stem_width = -1; -+ stem_values->synth_stems = FALSE; -+ stem_values->use_100 = FALSE; -+ /* pick from known rules if requested and they exist for current family */ -+ if( !use_known ) -+ return; -+ else { -+ const sa_rules_t *r=ftinf_rules( family ); -+ int i; -+ if( r==NULL ) return; -+ if( r->stem_widths[0]==on ) -+ for( i=1; r->stem_widths[i]!=maxp; ++i ) -+ if( ppem < r->stem_widths[i] ){ -+ stem_values->stem_width = i-1; -+ break; -+ } -+ -+ if( r->stem_scaling[0]==on ) -+ for( i=1; r->stem_scaling[i]!=end; i+=2 ) -+ if( ppem==r->stem_scaling[i] ){ -+ stem_values->stem_scaling = r->stem_scaling[i+1]; -+ break; -+ } -+ -+ if( r->m[0]==on ) -+ for( i=1; r->m[i]!=end; i+=2 ) -+ if( ppem==r->m[i] ){ -+ stem_values->m = r->m[i+1]; -+ break; -+ } -+ -+ if( r->stem_translating_only[0]==on ) -+ for( i=1; r->stem_translating_only[i]!=end; i+=2 ) -+ if( ppem==r->stem_translating_only[i] || r->stem_translating_only[i]==0 ){ -+ stem_values->stem_translating_only = r->stem_translating_only[i+1]; -+ break; -+ } -+ -+ if( r->stem_translating[0]==on ) -+ for( i=1; r->stem_translating[i]!=end; i+=2 ) -+ if( ppem==r->stem_translating[i] || r->stem_translating[i]==0 ){ -+ stem_values->stem_translating = r->stem_translating[i+1]; -+ break; -+ } -+ -+ if( r->always_use_100[0]==on ) -+ for( i=1; r->always_use_100[i]!=end; i+=2 ) -+ if( ppem>=r->always_use_100[i] && ppem<=r->always_use_100[i+1] ){ -+ stem_values->use_100 = TRUE; -+ break; -+ } -+ -+ if( r->synthesize_stems[0]==on ) -+ for( i=1; r->synthesize_stems[i]!=end; i+=2 ) -+ if( ppem>=r->synthesize_stems[i] && ppem<=r->synthesize_stems[i+1] ){ -+ stem_values->synth_stems = TRUE; -+ break; -+ } -+ -+ if( r->edge_detection[0]==on ) -+ for( i=1; r->edge_detection[i]!=end; i+=2 ) -+ if( ppem>=r->edge_detection[i] && ppem<=r->edge_detection[i+1] ){ -+ stem_values->edge_detection = TRUE; -+ break; -+ } -+ -+ if( r->bearing_correction[0]==on ) -+ for( i=1; r->bearing_correction[i]!=end; i+=2 ) -+ if( ppem>=r->bearing_correction[i] && ppem<=r->bearing_correction[i+1] ){ -+ stem_values->bearing_correction = FALSE; -+ break; -+ } -+ -+#if(0) -+ if( r->brightness[0]==on ) -+ for( i=1; r->brightness[i]!=end; i+=2 ) -+ if( ppem==r->brightness[i]||r->brightness[i]==0 ){ -+ stem_values->brightness=r->brightness[i+1]*(1.0f/300.0f); -+ break; -+ } -+ -+ if( r->contrast[0]==on ) -+ for( i=1; r->contrast[i]!=end; i+=2 ) -+ if( ppem==r->contrast[i]||r->contrast[i]==0 ){ -+ stem_values->contrast=r->contrast[i+1]*(1.0f/300.0f); -+ break; -+ } -+ if( r->spacing[0]==on ){ -+ /* not used by original code */ -+ } -+ if( r->start[0]==on ){ -+ /* not used by original code */ -+ } -+#endif -+ } -+ return; -+} -+ -+void ftinf_get_bc( const char *family, int ppem, float *brightness, float *contrast ){ -+ const sa_rules_t *r=ftinf_rules( family ); -+ *brightness=0; -+ *contrast=0; -+ if( r ){ -+ int i; -+ if( r->brightness[0]==on ) -+ for( i=1; r->brightness[i]!=end; i+=2 ) -+ if( ppem==r->brightness[i]||r->brightness[i]==0 ){ -+ *brightness=r->brightness[i+1]*(1.0f/300.0f); -+ break; -+ } -+ -+ if( r->contrast[0]==on ) -+ for( i=1; r->contrast[i]!=end; i+=2 ) -+ if( ppem==r->contrast[i]||r->contrast[i]==0 ){ -+ *contrast=r->contrast[i+1]*(1.0f/300.0f); -+ break; -+ } -+ } -+ return; -+} -+ -+static int -+bool_val( const char *s ){ -+ if ( s != NULL ) -+ return strcasecmp(s, "true") == 0 -+ || strcasecmp(s, "1") == 0 -+ || strcasecmp(s, "on") == 0 -+ || strcasecmp(s, "yes") ==0; -+ else -+ return 0; -+} -+ -+static int -+int_val( const char *s, int min, int max ){ -+ int val; -+ sscanf ( s, "%d", &val ); -+ if ( val > max ) -+ val = max; -+ else if ( val < min ) -+ val = min; -+ return val; -+} -+ -+/* settings and hashing function */ -+#include "ftinf_sh.c" -+ -+/* -+ Get active Infinality settings -+ */ -+void ftinf_env(){ -+ const char *s; -+ ftinf=ftinf_settings( getenv( "INFINALITY_FT" ) ); -+ -+ if( ftinf==NULL ){ -+ ftinf=ftinf_settings( "ultimate3" ); -+ /* this should always succeed */ -+#if(0) -+ if( ftinf==NULL ){ -+ /* put an error here */ -+ exit(-1); -+ } -+#endif -+ } -+ _env=ftinf[0]; /* copy as defaults */ -+ -+ /* check if custom environment values are set and update with them */ -+ s=getenv( "INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS" ); -+ if( s ) _env.autohint_increase_glyph_heights=bool_val( s ); -+ s=getenv( "INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT" ); -+ if( s ) _env.autohint_snap_stem_height=int_val( s, 0, 100 ); -+ s=getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); -+ if( s ) _env.use_various_tweaks=bool_val( s ); -+ s=getenv( "INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS" ); -+ if( s ) _env.use_known_settings_on_selected_fonts=bool_val(s); -+#if(0) /* not used (naming error also) */ -+ s=getenv( "INFINALITY_FT_AUTOHINT_MINIMUM_STEM_WIDTH" ); -+ if( s ) _env.autohint_minimum_stem_height=int_val( s, 0, 100 ); -+#endif -+ s=getenv( "INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE" ); -+ if( s ) sscanf( s, "%d", &_env.stem_snapping_sliding_scale ); -+ s=getenv( "INFINALITY_FT_STEM_ALIGNMENT_STRENGTH" ); -+ if( s ) sscanf( s, "%d", &_env.stem_alignment_strength ); -+ s=getenv( "INFINALITY_FT_STEM_DARKENING_AUTOFIT" ); -+ if( s ) _env.stem_darkening_autofit=bool_val( s ); -+ s=getenv( "INFINALITY_FT_STEM_DARKENING_CFF" ); -+ if( s ) _env.stem_darkening_cff=bool_val( s ); -+ s=getenv( "INFINALITY_FT_STEM_FITTING_STRENGTH" ); -+ if( s ) sscanf( s, "%d", &_env.stem_fitting_strength ); -+ s=getenv( "INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH" ); -+ if( s ) _env.chromeos_style_sharpening_strength=int_val( s, 0, 100 ); -+ s=getenv( "INFINALITY_FT_BRIGHTNESS" ); -+ if( s ) sscanf( s, "%d", &_env.brightness ); -+ s=getenv( "INFINALITY_FT_CONTRAST" ); -+ if( s ) sscanf( s, "%d", &_env.contrast ); -+ s=getenv( "INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH" ); -+ if( s ) _env.windows_style_sharpening_strength=int_val( s, 0, 100 ); -+ s=getenv( "INFINALITY_FT_GAMMA_CORRECTION" ); -+ if( s ){ -+ float *f=_env.gamma_correction; -+ sscanf ( s, "%f %f", &f[0], &f[1] ); -+ if( f[1] < 1.0f ) f[1]=1.0f; -+ } -+ s=getenv( "INFINALITY_FT_FRINGE_FILTER_STRENGTH" ); -+ if( s ) sscanf( s, "%d", &_env.fringe_filter_strength ); -+ s=getenv( "INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH" ); -+ if( s ) sscanf( s, "%d", &_env.grayscale_filter_strength ); -+ s=getenv( "INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH" ); -+ if( s ) sscanf( s, "%d", &_env.autohint_horizontal_stem_darken_strength ); -+ s=getenv( "INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH" ); -+ if( s ) sscanf( s, "%d", &_env.autohint_vertical_stem_darken_strength ); -+ s=getenv( "INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE" ); -+ if( s ) sscanf( s, "%d", &_env.global_embolden_x_value ); -+ s=getenv( "INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE" ); -+ if( s ) sscanf( s, "%d", &_env.global_embolden_y_value ); -+ s=getenv( "INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE" ); -+ if( s ) sscanf( s, "%d", &_env.bold_embolden_x_value ); -+ s=getenv( "INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE" ); -+ if( s ) sscanf( s, "%d", &_env.bold_embolden_y_value ); -+ s=getenv( "INFINALITY_FT_FILTER_PARAMS" ); -+ if( s ) { -+ int *f=_env.filter_params; -+ if( sscanf( s, "%d %d %d %d %d", f+1, f+2, f+3, f+4, f+5 )==5 ) -+ f[0]=on; -+ else -+ f[0]=off; /* FIXME: put a warning? */ -+ } -+ /* do the range verifications as in original code */ -+ if ( _env.stem_snapping_sliding_scale > maxp ) -+ _env.stem_snapping_sliding_scale = 0; -+ else if ( _env.stem_snapping_sliding_scale < 0 ) -+ _env.stem_snapping_sliding_scale = 0; -+ if (_env.stem_snapping_sliding_scale < 11 && -+ _env.stem_snapping_sliding_scale > 0 ) -+ _env.stem_snapping_sliding_scale = 11; -+ -+ if ( _env.stem_alignment_strength > 100 ) -+ _env.stem_alignment_strength = 100; -+ else if ( _env.stem_alignment_strength < 0 ) -+ _env.stem_alignment_strength = 0; -+ -+ if ( _env.stem_fitting_strength > 100 ) -+ _env.stem_fitting_strength = 100; -+ else if ( _env.stem_fitting_strength < 0 ) -+ _env.stem_fitting_strength = 0; -+ -+ if ( _env.chromeos_style_sharpening_strength > 100 ) -+ _env.chromeos_style_sharpening_strength = 100; -+ else if ( _env.chromeos_style_sharpening_strength < 0 ) -+ _env.chromeos_style_sharpening_strength = 0; -+ -+ if ( _env.brightness > 100 ) -+ _env.brightness = 100; -+ else if ( _env.brightness < -100 ) -+ _env.brightness = 0; -+ -+ if ( _env.contrast > 100 ) -+ _env.contrast = 100; -+ else if ( _env.contrast < -100 ) -+ _env.contrast = 0; -+ -+ if ( _env.windows_style_sharpening_strength > 100 ) -+ _env.windows_style_sharpening_strength = 100; -+ else if ( _env.windows_style_sharpening_strength < 0 ) -+ _env.windows_style_sharpening_strength = 0; -+ -+ if ( _env.fringe_filter_strength > 100 ) -+ _env.fringe_filter_strength = 100; -+ else if ( _env.fringe_filter_strength < 0 ) -+ _env.fringe_filter_strength = 0; -+ -+ if ( _env.grayscale_filter_strength > 100 ) -+ _env.grayscale_filter_strength = 100; -+ else if ( _env.grayscale_filter_strength < 0 ) -+ _env.grayscale_filter_strength = 0; -+ -+ if ( _env.autohint_horizontal_stem_darken_strength > 100 ) -+ _env.autohint_horizontal_stem_darken_strength = 100; -+ else if ( _env.autohint_horizontal_stem_darken_strength < 0 ) -+ _env.autohint_horizontal_stem_darken_strength = 0; -+ -+ if ( _env.autohint_vertical_stem_darken_strength > 100 ) -+ _env.autohint_vertical_stem_darken_strength = 100; -+ else if ( _env.autohint_horizontal_stem_darken_strength < 0 ) -+ _env.autohint_vertical_stem_darken_strength = 0; -+ -+ if ( _env.global_embolden_x_value > 128 ) -+ _env.global_embolden_x_value = 128; -+ else if ( _env.global_embolden_x_value < -128 ) -+ _env.global_embolden_x_value = -128; -+ -+ if ( _env.global_embolden_y_value > 128 ) -+ _env.global_embolden_y_value = 128; -+ else if ( _env.global_embolden_y_value < -128 ) -+ _env.global_embolden_y_value = -128; -+ -+ if ( _env.bold_embolden_x_value > 128 ) -+ _env.bold_embolden_x_value = 128; -+ else if (_env.bold_embolden_x_value < -128 ) -+ _env.bold_embolden_x_value = -128; -+ -+ if ( _env.bold_embolden_y_value > 128 ) -+ _env.bold_embolden_y_value = 128; -+ else if ( _env.bold_embolden_y_value < -128 ) -+ _env.bold_embolden_y_value = -128; -+ -+ /* point to the combined and checked settings */ -+ ftinf=&_env; -+} -diff -ruN freetype-2.7.1-orig/src/base/ftinf.h freetype-2.7.1/src/base/ftinf.h ---- freetype-2.7.1-orig/src/base/ftinf.h 1970-01-01 01:00:00.000000000 +0100 -+++ freetype-2.7.1/src/base/ftinf.h 2017-01-11 12:28:34.879016390 +0100 -@@ -0,0 +1,66 @@ -+#ifndef _FTINF_H_ -+#define _FTINF_H_ -+/* -+ Stem snapping rules -+ (base freetype typedefs assumed already included) -+ */ -+typedef struct -+{ -+ FT_Int stem_width; -+ FT_Int stem_spacing; -+ FT_Int stem_start; -+ FT_Int stem_scaling; -+ FT_Int stem_translating_only; -+ FT_Int stem_translating; -+ float brightness; -+ float contrast; -+ FT_Bool use_100; -+ FT_Bool synth_stems; -+ FT_Bool edge_detection; -+ FT_Bool bearing_correction; -+ FT_Int m; -+} Stem_Data; -+ -+/* -+ Infinality settings -+ */ -+typedef struct ftinf_s { -+ const char *name; -+ int autohint_horizontal_stem_darken_strength; -+ int autohint_snap_stem_height; -+ int autohint_increase_glyph_heights; -+ int autohint_vertical_stem_darken_strength; -+ int bold_embolden_x_value; -+ int bold_embolden_y_value; -+ int brightness; -+ int chromeos_style_sharpening_strength; -+ int contrast; -+ int filter_params[6]; /* 1st one used as existence flag */ -+ int fringe_filter_strength; -+ float gamma_correction[2]; -+ int global_embolden_x_value; -+ int global_embolden_y_value; -+ int grayscale_filter_strength; -+ int stem_alignment_strength; -+ int stem_darkening_autofit; -+ int stem_darkening_cff; -+ int stem_fitting_strength; -+ int stem_snapping_sliding_scale; -+ int use_known_settings_on_selected_fonts; -+ int use_various_tweaks; -+ int windows_style_sharpening_strength; -+} ftinf_t; -+ -+extern FT_Pos infinality_cur_width; /* defined in aflatin.c */ -+ -+extern const ftinf_t *ftinf; /* active settings */ -+ -+extern void ftinf_fill_stem_values( Stem_Data *stem_values, -+ const char *family, int ppem, int use_known ); -+extern void ftinf_get_bc( const char *family, int ppem, -+ float *brightness, float *contrast ); -+ -+/* get values from environment (FIXME: maybe update with using user files) */ -+extern void ftinf_env(); -+ -+#endif -diff -ruN freetype-2.7.1-orig/src/base/ftinf_rh.c freetype-2.7.1/src/base/ftinf_rh.c ---- freetype-2.7.1-orig/src/base/ftinf_rh.c 1970-01-01 01:00:00.000000000 +0100 -+++ freetype-2.7.1/src/base/ftinf_rh.c 2017-01-11 12:28:34.880016390 +0100 -@@ -0,0 +1,626 @@ -+/* ANSI-C code produced by gperf version 3.1 */ -+/* Command-line: gperf --output-file=ftinf_rh.c ftinf_rh.gperf */ -+/* Computed positions: -k'1,$' */ -+ -+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ -+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ -+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ -+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ -+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ -+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ -+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ -+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ -+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ -+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ -+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ -+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ -+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ -+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ -+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ -+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ -+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ -+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ -+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ -+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ -+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ -+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ -+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) -+/* The character set is not based on ISO-646. */ -+#error "gperf generated tables don't work with this execution character set. Please report a bug to ." -+#endif -+ -+#line 9 "ftinf_rh.gperf" -+ -+#include -+static const struct sa_rules_s* _rules_get( const char*str, unsigned len ); -+/* maximum key range = 82, duplicates = 0 */ -+ -+#ifdef __GNUC__ -+__inline -+#else -+#ifdef __cplusplus -+inline -+#endif -+#endif -+static unsigned int -+_rules_hash (register const char *str, register unsigned int len) -+{ -+ static const unsigned char asso_values[] = -+ { -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 0, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 5, 45, 5, -+ 35, 25, 35, 35, 50, 45, 85, 85, 0, 25, -+ 40, 5, 0, 85, 50, 20, 20, 0, 10, 10, -+ 85, 10, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, -+ 85, 85, 85, 85, 85, 85 -+ }; -+ return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; -+} -+ -+#ifdef __GNUC__ -+__inline -+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ -+__attribute__ ((__gnu_inline__)) -+#endif -+#endif -+const struct sa_rules_s * -+_rules_get (register const char *str, register unsigned int len) -+{ -+ enum -+ { -+ TOTAL_KEYWORDS = 58, -+ MIN_WORD_LENGTH = 3, -+ MAX_WORD_LENGTH = 24, -+ MIN_HASH_VALUE = 3, -+ MAX_HASH_VALUE = 84 -+ }; -+ -+ static const struct sa_rules_s wordlist[] = -+ { -+#line 15 "ftinf_rh.gperf" -+{ .name="---", -+ .synthesize_stems={on, 13, 13, end} -+}, -+#line 253 "ftinf_rh.gperf" -+{ .name="ubuntu", -+ .always_use_100={on, 12, 13, 15, 15, end} -+}, -+#line 31 "ftinf_rh.gperf" -+{ .name="arial", -+ .always_use_100={on, 0, maxp, end}, -+ .edge_detection={on, 11, 11, 13, 13, end}, -+ .spacing={on, 10, 11, 23, 25, 30, end}, -+ .start={on, 11, 18, 23, 30, 30, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, 16, -24, end} -+}, -+#line 87 "ftinf_rh.gperf" -+{ .name="corbel", -+ .stem_translating_only={on, 10, 16, end}, -+ .stem_widths={on, 10, 21, maxp} -+}, -+#line 71 "ftinf_rh.gperf" -+{ .name="canwell", -+ .stem_scaling={on, 13, 0, end} -+}, -+#line 216 "ftinf_rh.gperf" -+{ .name="pragmata", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 67 "ftinf_rh.gperf" -+{ .name="cantarell", -+ .stem_translating_only={on, 11, 0, 12, 0, end}, -+ .stem_widths={on, 10, 22, maxp,} -+}, -+#line 39 "ftinf_rh.gperf" -+{ .name="arimo", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end} -+}, -+#line 207 "ftinf_rh.gperf" -+{ .name="optima", -+ .brightness={on, 0, -20, end}, -+ .contrast={on, 0, 25, end}, -+ .stem_scaling={on, 17, 1, end}, -+ .stem_translating_only={on, 10, 0, 11, 0, 12, 0, end} -+}, -+#line 63 "ftinf_rh.gperf" -+{ .name="candara", -+ .stem_scaling={on, 14, 1, 17, 1, end}, -+ .stem_translating_only={on, 10, 16, end} -+}, -+#line 77 "ftinf_rh.gperf" -+{ .name="comfortaa", -+ .stem_widths={on, 10, 19, 22, maxp}, -+ .stem_scaling={on, 11, 0, end} -+}, -+#line 161 "ftinf_rh.gperf" -+{ .name="liberation mono", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 18 "ftinf_rh.gperf" -+{ .name="andale mono", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_scaling={on, 11, 1, end}, -+ .stem_widths={on, 10, 21, maxp,} -+}, -+#line 256 "ftinf_rh.gperf" -+{ .name="verdana", -+ .always_use_100={on, 0, 14, 16, maxp, end}, -+ .stem_scaling={on, 12, 1, 15, 1, end}, -+ .stem_translating_only={on, 8, 16, 15, 16, 14, 32, 18, 32, 19, 24, end} -+}, -+#line 74 "ftinf_rh.gperf" -+{ .name="century gothic", -+ .stem_widths={on, 10, 22, maxp,} -+}, -+#line 91 "ftinf_rh.gperf" -+{ .name="courier new", -+ .always_use_100={on, 12, 12, end}, -+ .edge_detection={on, 10, 12, end}, -+ .m={on, 13, 1, 14, 1, end} -+}, -+#line 23 "ftinf_rh.gperf" -+{ .name="arial narrow", -+ .stem_widths={on, 10, 21, maxp,} -+}, -+#line 185 "ftinf_rh.gperf" -+{ .name="luxi sans", -+ .always_use_100={on, 13, 13, end}, -+ .stem_widths={on, 10, 17, sw2pv, maxp,} -+}, -+#line 225 "ftinf_rh.gperf" -+{ .name="samba", -+ .stem_scaling={on, 11, 0, end} -+}, -+#line 233 "ftinf_rh.gperf" -+{ .name="tahoma", -+ .always_use_100={on, 11, 11, 14, maxp, end}, -+ .edge_detection={on, 11, 11, end}, -+ .spacing={on, 10, 12, 18, 18, 30, end}, -+ .start={on, 14, 17, 30, 100, 100, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 7, 32, 8, 32, 9, 32, end}, -+}, -+#line 164 "ftinf_rh.gperf" -+{ .name="liberation sans narrow", -+ .stem_widths={on,10, 22, maxp,} -+}, -+#line 81 "ftinf_rh.gperf" -+{ .name="consolas", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating_only={on, 8, 32, 9, 32, end}, -+ .stem_widths={on, 10, 20, maxp,}, -+ .stem_scaling={on, 11, 1, end} -+}, -+#line 203 "ftinf_rh.gperf" -+{ .name="open sans", -+ .stem_translating_only={on, 10, 16, 9, 16, end}, -+ .stem_widths={on, 10, 20, maxp,} -+}, -+#line 167 "ftinf_rh.gperf" -+{ .name="liberation sans", -+ .edge_detection={on, 11, 11, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end}, -+ .stem_widths={on,10, 19, maxp,} -+}, -+#line 193 "ftinf_rh.gperf" -+{ .name="monaco", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 101 "ftinf_rh.gperf" -+{ .name="cousine", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 176 "ftinf_rh.gperf" -+{ .name="lucida grande", -+ .stem_scaling={on, 13, 1, end}, -+ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, -+ .stem_widths={on, 10, 16, sw2pv, maxp}, -+}, -+#line 173 "ftinf_rh.gperf" -+{ .name="lucida console", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 196 "ftinf_rh.gperf" -+{ .name="myriad pro", -+ .stem_scaling={on, 14, 1, 17, 1, end}, -+ .stem_translating_only={on, 10, 16, 11, 0, 9, 16, end} -+}, -+#line 26 "ftinf_rh.gperf" -+{ .name="arial unicode ms", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} -+}, -+#line 213 "ftinf_rh.gperf" -+{ .name="palatino linotype", -+ .edge_detection={on, 0, 100, end} -+}, -+#line 181 "ftinf_rh.gperf" -+{ .name="lucida sans unicode", -+ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, -+ .stem_widths={on,10, 16, sw2pv, maxp,} -+}, -+#line 140 "ftinf_rh.gperf" -+{ .name="futura", -+ .stem_widths={on, 10, 14, sw2pv, maxp,} -+}, -+#line 147 "ftinf_rh.gperf" -+{ .name="georgia", -+ .stem_translating_only={on, 13, 16, 14, 16, 15, 0, end} -+}, -+#line 125 "ftinf_rh.gperf" -+{ .name="freemono", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 200 "ftinf_rh.gperf" -+{ .name="nina", -+ .stem_scaling={on, 11, 0, 12, 0, 13, 0, end} -+}, -+#line 121 "ftinf_rh.gperf" -+{ .name="essential pragmatapro", -+ .always_use_100={on, 0, maxp, end}, -+ .m={on, 13, 0, 14, 0, end} -+}, -+#line 247 "ftinf_rh.gperf" -+{ .name="trebuchet ms", -+ .always_use_100={on, 13, 13, end}, -+ .stem_scaling={on, 13, 0, 17, 0, 20, 1, end}, -+ .stem_translating_only={on, 10, 16, 11, 0, 8, 32, 9, 32, end}, -+ .stem_widths={on, 10, 17, sw2pv, maxp,} -+}, -+#line 114 "ftinf_rh.gperf" -+{ .name="droid sans mono", -+ .m={on, 12, 0, end} -+}, -+#line 104 "ftinf_rh.gperf" -+{ .name="dejavu sans mono", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating_only={on, 7, 16, 8, 32, 9, 16, end} -+}, -+#line 57 "ftinf_rh.gperf" -+{ .name="calibri", -+ .always_use_100={on, 23, maxp, end}, -+ .stem_scaling={on, 15, 1, 17, 1, 18, 1, end}, -+ .stem_translating_only={on, 10, 16, 15, 0, end}, -+ .stem_widths={on, 1, 10, 19, maxp,} -+}, -+#line 156 "ftinf_rh.gperf" -+{ .name="inconsolata", -+ .stem_scaling={on, 12, 1, 15, 1, end}, -+ .stem_translating_only={on, 10, 24, 9, 32, end}, -+ .stem_widths={on, 10, 23, maxp,}, -+}, -+#line 96 "ftinf_rh.gperf" -+{ .name="courier", -+ .always_use_100={on, 0, maxp, end}, -+ .m={on, 13, 1, 14, 1, end}, -+ .stem_translating_only={on, 13, 16, 15, 0, end} -+}, -+#line 128 "ftinf_rh.gperf" -+{ .name="freesans", -+ .always_use_100={on, 0, maxp, end}, -+ .edge_detection={on, 11, 11, 13, 13, end}, -+ .spacing={on, 10, 12, 18, 18, 30, end}, -+ .start={on, 10, 18, 18, 25, 30, end}, -+ .stem_scaling={on, 16, 0, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 16, 9, 8, end} -+}, -+#line 150 "ftinf_rh.gperf" -+{ .name="gill sans", -+ .stem_widths={on, 10, 17, sw2pv, maxp,} -+}, -+#line 117 "ftinf_rh.gperf" -+{ .name="droid sans", -+ .always_use_100={on, 12, 12, 15, 15, end}, -+ .stem_translating_only={on, 8, 16, 9, 16, end} -+}, -+#line 108 "ftinf_rh.gperf" -+{ .name="dejavu sans", -+ .always_use_100={on, 10, 14, 16, 17, end}, -+ .m={on, 12, 0, end}, -+ .stem_scaling={on, 12, 1, end}, -+ .stem_translating_only={on, 8, 16, 15, -20, end} -+}, -+#line 219 "ftinf_rh.gperf" -+{ .name="raleway", -+ .stem_scaling={on, 15, 0, end} -+}, -+#line 153 "ftinf_rh.gperf" -+{ .name="helvetica cy", -+ .stem_widths={on, 10, 23, maxp,} -+}, -+#line 228 "ftinf_rh.gperf" -+{ .name="segoe ui", -+ .always_use_100={on, 11, 12, 14, 14, end}, -+ .stem_translating_only={on, 10, 0, 7, 32, 8, 16, 9, 24, end}, -+ .stem_widths={on, 10, 23, maxp,} -+}, -+#line 48 "ftinf_rh.gperf" -+{ .name="bitstream vera sans mono", -+ .always_use_100={on, 0, maxp, end} -+}, -+#line 241 "ftinf_rh.gperf" -+{ .name="times new roman", -+ .always_use_100={on, 14, 14, 16, 16, end}, -+ .bearing_correction={0, 100, end}, -+ .stem_scaling={on, 17, 1, end}, -+ .stem_translating_only={on, 17, 8, end} -+}, -+#line 222 "ftinf_rh.gperf" -+{ .name="rokkitt", -+ .stem_widths={on, 10, 21, maxp,} -+}, -+#line 143 "ftinf_rh.gperf" -+{ .name="garamond", -+ .brightness={on, 0, -20, end}, -+ .contrast={on, 0, 25, end} -+}, -+#line 137 "ftinf_rh.gperf" -+{ .name="freeserif", -+ .stem_scaling={on, 13, 1, 17, 1, end} -+}, -+#line 189 "ftinf_rh.gperf" -+{ .name="microsoft sans serif", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} -+}, -+#line 44 "ftinf_rh.gperf" -+{ .name="baskerville", -+ .brightness={on, 0, -20, end}, -+ .contrast={on, 0, 25, end} -+}, -+#line 51 "ftinf_rh.gperf" -+{ .name="bitstream vera sans", -+ .always_use_100={on, 10, 14, 16, 17, end}, -+ .m={on, 12, 0, end}, -+ .stem_scaling={on ,12, 1, end}, -+ .stem_translating_only={on, 8, 16, end} -+} -+ }; -+ -+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) -+ { -+ register int key = _rules_hash (str, len); -+ -+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) -+ { -+ register const struct sa_rules_s *resword; -+ -+ switch (key - 3) -+ { -+ case 0: -+ resword = &wordlist[0]; -+ goto compare; -+ case 3: -+ resword = &wordlist[1]; -+ goto compare; -+ case 7: -+ resword = &wordlist[2]; -+ goto compare; -+ case 8: -+ resword = &wordlist[3]; -+ goto compare; -+ case 9: -+ resword = &wordlist[4]; -+ goto compare; -+ case 10: -+ resword = &wordlist[5]; -+ goto compare; -+ case 11: -+ resword = &wordlist[6]; -+ goto compare; -+ case 12: -+ resword = &wordlist[7]; -+ goto compare; -+ case 13: -+ resword = &wordlist[8]; -+ goto compare; -+ case 14: -+ resword = &wordlist[9]; -+ goto compare; -+ case 16: -+ resword = &wordlist[10]; -+ goto compare; -+ case 17: -+ resword = &wordlist[11]; -+ goto compare; -+ case 18: -+ resword = &wordlist[12]; -+ goto compare; -+ case 19: -+ resword = &wordlist[13]; -+ goto compare; -+ case 21: -+ resword = &wordlist[14]; -+ goto compare; -+ case 23: -+ resword = &wordlist[15]; -+ goto compare; -+ case 24: -+ resword = &wordlist[16]; -+ goto compare; -+ case 26: -+ resword = &wordlist[17]; -+ goto compare; -+ case 27: -+ resword = &wordlist[18]; -+ goto compare; -+ case 28: -+ resword = &wordlist[19]; -+ goto compare; -+ case 29: -+ resword = &wordlist[20]; -+ goto compare; -+ case 30: -+ resword = &wordlist[21]; -+ goto compare; -+ case 31: -+ resword = &wordlist[22]; -+ goto compare; -+ case 32: -+ resword = &wordlist[23]; -+ goto compare; -+ case 33: -+ resword = &wordlist[24]; -+ goto compare; -+ case 34: -+ resword = &wordlist[25]; -+ goto compare; -+ case 35: -+ resword = &wordlist[26]; -+ goto compare; -+ case 36: -+ resword = &wordlist[27]; -+ goto compare; -+ case 37: -+ resword = &wordlist[28]; -+ goto compare; -+ case 38: -+ resword = &wordlist[29]; -+ goto compare; -+ case 39: -+ resword = &wordlist[30]; -+ goto compare; -+ case 41: -+ resword = &wordlist[31]; -+ goto compare; -+ case 43: -+ resword = &wordlist[32]; -+ goto compare; -+ case 44: -+ resword = &wordlist[33]; -+ goto compare; -+ case 45: -+ resword = &wordlist[34]; -+ goto compare; -+ case 46: -+ resword = &wordlist[35]; -+ goto compare; -+ case 48: -+ resword = &wordlist[36]; -+ goto compare; -+ case 49: -+ resword = &wordlist[37]; -+ goto compare; -+ case 52: -+ resword = &wordlist[38]; -+ goto compare; -+ case 53: -+ resword = &wordlist[39]; -+ goto compare; -+ case 54: -+ resword = &wordlist[40]; -+ goto compare; -+ case 58: -+ resword = &wordlist[41]; -+ goto compare; -+ case 59: -+ resword = &wordlist[42]; -+ goto compare; -+ case 60: -+ resword = &wordlist[43]; -+ goto compare; -+ case 61: -+ resword = &wordlist[44]; -+ goto compare; -+ case 62: -+ resword = &wordlist[45]; -+ goto compare; -+ case 63: -+ resword = &wordlist[46]; -+ goto compare; -+ case 64: -+ resword = &wordlist[47]; -+ goto compare; -+ case 69: -+ resword = &wordlist[48]; -+ goto compare; -+ case 70: -+ resword = &wordlist[49]; -+ goto compare; -+ case 71: -+ resword = &wordlist[50]; -+ goto compare; -+ case 72: -+ resword = &wordlist[51]; -+ goto compare; -+ case 74: -+ resword = &wordlist[52]; -+ goto compare; -+ case 75: -+ resword = &wordlist[53]; -+ goto compare; -+ case 76: -+ resword = &wordlist[54]; -+ goto compare; -+ case 77: -+ resword = &wordlist[55]; -+ goto compare; -+ case 78: -+ resword = &wordlist[56]; -+ goto compare; -+ case 81: -+ resword = &wordlist[57]; -+ goto compare; -+ } -+ return 0; -+ compare: -+ { -+ register const char *s = resword->name; -+ -+ if (*str == *s && !strcmp (str + 1, s + 1)) -+ return resword; -+ } -+ } -+ } -+ return 0; -+} -+#line 261 "ftinf_rh.gperf" -+ -+ -+static const sa_rules_t* -+ftinf_rules( const char *name ){ -+ if( name ){ -+ enum { -+ max_wlen=31 -+ }; -+ char buf[max_wlen+1]; -+ int len=strlen( name ); -+ if( len <= max_wlen ){ -+ int i; -+ for( i=0; i -+static const struct sa_rules_s* _rules_get( const char*str, unsigned len ); -+%} -+struct sa_rules_s; -+%% -+{ .name="---", -+ .synthesize_stems={on, 13, 13, end} -+}, -+{ .name="andale mono", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_scaling={on, 11, 1, end}, -+ .stem_widths={on, 10, 21, maxp,} -+}, -+{ .name="arial narrow", -+ .stem_widths={on, 10, 21, maxp,} -+}, -+{ .name="arial unicode ms", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} -+}, -+{ .name="arial", -+ .always_use_100={on, 0, maxp, end}, -+ .edge_detection={on, 11, 11, 13, 13, end}, -+ .spacing={on, 10, 11, 23, 25, 30, end}, -+ .start={on, 11, 18, 23, 30, 30, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, 16, -24, end} -+}, -+{ .name="arimo", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end} -+}, -+{ .name="baskerville", -+ .brightness={on, 0, -20, end}, -+ .contrast={on, 0, 25, end} -+}, -+{ .name="bitstream vera sans mono", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="bitstream vera sans", -+ .always_use_100={on, 10, 14, 16, 17, end}, -+ .m={on, 12, 0, end}, -+ .stem_scaling={on ,12, 1, end}, -+ .stem_translating_only={on, 8, 16, end} -+}, -+{ .name="calibri", -+ .always_use_100={on, 23, maxp, end}, -+ .stem_scaling={on, 15, 1, 17, 1, 18, 1, end}, -+ .stem_translating_only={on, 10, 16, 15, 0, end}, -+ .stem_widths={on, 1, 10, 19, maxp,} -+}, -+{ .name="candara", -+ .stem_scaling={on, 14, 1, 17, 1, end}, -+ .stem_translating_only={on, 10, 16, end} -+}, -+{ .name="cantarell", -+ .stem_translating_only={on, 11, 0, 12, 0, end}, -+ .stem_widths={on, 10, 22, maxp,} -+}, -+{ .name="canwell", -+ .stem_scaling={on, 13, 0, end} -+}, -+{ .name="century gothic", -+ .stem_widths={on, 10, 22, maxp,} -+}, -+{ .name="comfortaa", -+ .stem_widths={on, 10, 19, 22, maxp}, -+ .stem_scaling={on, 11, 0, end} -+}, -+{ .name="consolas", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating_only={on, 8, 32, 9, 32, end}, -+ .stem_widths={on, 10, 20, maxp,}, -+ .stem_scaling={on, 11, 1, end} -+}, -+{ .name="corbel", -+ .stem_translating_only={on, 10, 16, end}, -+ .stem_widths={on, 10, 21, maxp} -+}, -+{ .name="courier new", -+ .always_use_100={on, 12, 12, end}, -+ .edge_detection={on, 10, 12, end}, -+ .m={on, 13, 1, 14, 1, end} -+}, -+{ .name="courier", -+ .always_use_100={on, 0, maxp, end}, -+ .m={on, 13, 1, 14, 1, end}, -+ .stem_translating_only={on, 13, 16, 15, 0, end} -+}, -+{ .name="cousine", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="dejavu sans mono", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating_only={on, 7, 16, 8, 32, 9, 16, end} -+}, -+{ .name="dejavu sans", -+ .always_use_100={on, 10, 14, 16, 17, end}, -+ .m={on, 12, 0, end}, -+ .stem_scaling={on, 12, 1, end}, -+ .stem_translating_only={on, 8, 16, 15, -20, end} -+}, -+{ .name="droid sans mono", -+ .m={on, 12, 0, end} -+}, -+{ .name="droid sans", -+ .always_use_100={on, 12, 12, 15, 15, end}, -+ .stem_translating_only={on, 8, 16, 9, 16, end} -+}, -+{ .name="essential pragmatapro", -+ .always_use_100={on, 0, maxp, end}, -+ .m={on, 13, 0, 14, 0, end} -+}, -+{ .name="freemono", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="freesans", -+ .always_use_100={on, 0, maxp, end}, -+ .edge_detection={on, 11, 11, 13, 13, end}, -+ .spacing={on, 10, 12, 18, 18, 30, end}, -+ .start={on, 10, 18, 18, 25, 30, end}, -+ .stem_scaling={on, 16, 0, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 16, 9, 8, end} -+}, -+{ .name="freeserif", -+ .stem_scaling={on, 13, 1, 17, 1, end} -+}, -+{ .name="futura", -+ .stem_widths={on, 10, 14, sw2pv, maxp,} -+}, -+{ .name="garamond", -+ .brightness={on, 0, -20, end}, -+ .contrast={on, 0, 25, end} -+}, -+{ .name="georgia", -+ .stem_translating_only={on, 13, 16, 14, 16, 15, 0, end} -+}, -+{ .name="gill sans", -+ .stem_widths={on, 10, 17, sw2pv, maxp,} -+}, -+{ .name="helvetica cy", -+ .stem_widths={on, 10, 23, maxp,} -+}, -+{ .name="inconsolata", -+ .stem_scaling={on, 12, 1, 15, 1, end}, -+ .stem_translating_only={on, 10, 24, 9, 32, end}, -+ .stem_widths={on, 10, 23, maxp,}, -+}, -+{ .name="liberation mono", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="liberation sans narrow", -+ .stem_widths={on,10, 22, maxp,} -+}, -+{ .name="liberation sans", -+ .edge_detection={on, 11, 11, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end}, -+ .stem_widths={on,10, 19, maxp,} -+}, -+{ .name="lucida console", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="lucida grande", -+ .stem_scaling={on, 13, 1, end}, -+ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, -+ .stem_widths={on, 10, 16, sw2pv, maxp}, -+}, -+{ .name="lucida sans unicode", -+ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, -+ .stem_widths={on,10, 16, sw2pv, maxp,} -+}, -+{ .name="luxi sans", -+ .always_use_100={on, 13, 13, end}, -+ .stem_widths={on, 10, 17, sw2pv, maxp,} -+}, -+{ .name="microsoft sans serif", -+ .always_use_100={on, 0, maxp, end}, -+ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} -+}, -+{ .name="monaco", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="myriad pro", -+ .stem_scaling={on, 14, 1, 17, 1, end}, -+ .stem_translating_only={on, 10, 16, 11, 0, 9, 16, end} -+}, -+{ .name="nina", -+ .stem_scaling={on, 11, 0, 12, 0, 13, 0, end} -+}, -+{ .name="open sans", -+ .stem_translating_only={on, 10, 16, 9, 16, end}, -+ .stem_widths={on, 10, 20, maxp,} -+}, -+{ .name="optima", -+ .brightness={on, 0, -20, end}, -+ .contrast={on, 0, 25, end}, -+ .stem_scaling={on, 17, 1, end}, -+ .stem_translating_only={on, 10, 0, 11, 0, 12, 0, end} -+}, -+{ .name="palatino linotype", -+ .edge_detection={on, 0, 100, end} -+}, -+{ .name="pragmata", -+ .always_use_100={on, 0, maxp, end} -+}, -+{ .name="raleway", -+ .stem_scaling={on, 15, 0, end} -+}, -+{ .name="rokkitt", -+ .stem_widths={on, 10, 21, maxp,} -+}, -+{ .name="samba", -+ .stem_scaling={on, 11, 0, end} -+}, -+{ .name="segoe ui", -+ .always_use_100={on, 11, 12, 14, 14, end}, -+ .stem_translating_only={on, 10, 0, 7, 32, 8, 16, 9, 24, end}, -+ .stem_widths={on, 10, 23, maxp,} -+}, -+{ .name="tahoma", -+ .always_use_100={on, 11, 11, 14, maxp, end}, -+ .edge_detection={on, 11, 11, end}, -+ .spacing={on, 10, 12, 18, 18, 30, end}, -+ .start={on, 14, 17, 30, 100, 100, end}, -+ .stem_translating={on, 11, 32, end}, -+ .stem_translating_only={on, 7, 32, 8, 32, 9, 32, end}, -+}, -+{ .name="times new roman", -+ .always_use_100={on, 14, 14, 16, 16, end}, -+ .bearing_correction={0, 100, end}, -+ .stem_scaling={on, 17, 1, end}, -+ .stem_translating_only={on, 17, 8, end} -+}, -+{ .name="trebuchet ms", -+ .always_use_100={on, 13, 13, end}, -+ .stem_scaling={on, 13, 0, 17, 0, 20, 1, end}, -+ .stem_translating_only={on, 10, 16, 11, 0, 8, 32, 9, 32, end}, -+ .stem_widths={on, 10, 17, sw2pv, maxp,} -+}, -+{ .name="ubuntu", -+ .always_use_100={on, 12, 13, 15, 15, end} -+}, -+{ .name="verdana", -+ .always_use_100={on, 0, 14, 16, maxp, end}, -+ .stem_scaling={on, 12, 1, 15, 1, end}, -+ .stem_translating_only={on, 8, 16, 15, 16, 14, 32, 18, 32, 19, 24, end} -+}, -+%% -+ -+static const sa_rules_t* -+ftinf_rules( const char *name ){ -+ if( name ){ -+ enum { -+ max_wlen=31 -+ }; -+ char buf[max_wlen+1]; -+ int len=strlen( name ); -+ if( len <= max_wlen ){ -+ int i; -+ for( i=0; i' == 62) && ('?' == 63) && ('A' == 65) \ -+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ -+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ -+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ -+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ -+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ -+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ -+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ -+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ -+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ -+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ -+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ -+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ -+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ -+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ -+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) -+/* The character set is not based on ISO-646. */ -+#error "gperf generated tables don't work with this execution character set. Please report a bug to ." -+#endif -+ -+#line 9 "ftinf_sh.gperf" -+ -+#include -+static const struct ftinf_s* _settings_get( const char*str, unsigned len); -+/* maximum key range = 37, duplicates = 0 */ -+ -+#ifdef __GNUC__ -+__inline -+#else -+#ifdef __cplusplus -+inline -+#endif -+#endif -+static unsigned int -+_settings_hash (register const char *str, register unsigned int len) -+{ -+ static const unsigned char asso_values[] = -+ { -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 13, -+ 8, 30, 25, 20, 40, 10, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 5, 40, 0, -+ 0, 0, 40, 40, 10, 0, 40, 40, 15, 5, -+ 10, 0, 10, 40, 40, 0, 0, 0, 0, 0, -+ 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, -+ 40, 40, 40, 40, 40, 40 -+ }; -+ return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; -+} -+ -+#ifdef __GNUC__ -+__inline -+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ -+__attribute__ ((__gnu_inline__)) -+#endif -+#endif -+const struct ftinf_s * -+_settings_get (register const char *str, register unsigned int len) -+{ -+ enum -+ { -+ TOTAL_KEYWORDS = 22, -+ MIN_WORD_LENGTH = 3, -+ MAX_WORD_LENGTH = 14, -+ MIN_HASH_VALUE = 3, -+ MAX_HASH_VALUE = 39 -+ }; -+ -+ static const struct ftinf_s wordlist[] = -+ { -+#line 76 "ftinf_sh.gperf" -+{ .name="osx", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_vertical_stem_darken_strength=25, -+ .bold_embolden_x_value=16, -+ .brightness=10, -+ .contrast=20, -+ .filter_params={on, 3, 32, 38, 32, 3}, -+ .gamma_correction={1000, 80}, -+ .global_embolden_y_value=8, -+ .grayscale_filter_strength=25, -+}, -+#line 37 "ftinf_sh.gperf" -+{ .name="ipad", -+ .filter_params={on, 0, 0, 100, 0, 0}, -+ .gamma_correction={1000, 80}, -+ .grayscale_filter_strength=100 -+}, -+#line 114 "ftinf_sh.gperf" -+{ .name="shove", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=100, -+ .stem_fitting_strength=100, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true -+}, -+#line 126 "ftinf_sh.gperf" -+{ .name="ubuntu", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_vertical_stem_darken_strength=25, -+ .brightness=-10, -+ .contrast=15, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={1000, 80}, -+ .use_various_tweaks=true -+}, -+#line 27 "ftinf_sh.gperf" -+{ .name="classic", -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .filter_params={on, 6, 25, 38, 25, 6}, -+ .gamma_correction={0, 100}, -+ .use_various_tweaks=true -+}, -+#line 34 "ftinf_sh.gperf" -+{ .name="disabled", -+ .gamma_correction={0, 100}, -+}, -+#line 100 "ftinf_sh.gperf" -+{ .name="sharpened", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=25, -+ .stem_fitting_strength=25, -+ .stem_snapping_sliding_scale=40, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=65 -+}, -+#line 42 "ftinf_sh.gperf" -+{ .name="infinality", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=25, -+ .stem_fitting_strength=25, -+ .stem_snapping_sliding_scale=40, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=5 -+}, -+#line 15 "ftinf_sh.gperf" -+{ .name="custom", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 8, 24, 48, 24, 8}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=75, -+ .stem_fitting_strength=50, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true -+}, -+#line 180 "ftinf_sh.gperf" -+{ .name="vanilla", -+ .filter_params={on, 6, 25, 38, 25, 6}, -+ .gamma_correction={0, 100}, -+}, -+#line 184 "ftinf_sh.gperf" -+{ .name="windows7light", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .contrast=20, -+ .filter_params={on, 20, 25, 38, 25, 05}, -+ .fringe_filter_strength=100, -+ .gamma_correction={1000, 160}, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=100 -+}, -+#line 226 "ftinf_sh.gperf" -+{ .name="windowsxplight", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .brightness=20, -+ .contrast=30, -+ .filter_params={on, 6, 25, 44, 25, 6}, -+ .fringe_filter_strength=100, -+ .gamma_correction={1000, 120}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=65 -+}, -+#line 64 "ftinf_sh.gperf" -+{ .name="nudge", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=25, -+ .stem_fitting_strength=15, -+ .stem_snapping_sliding_scale=30, -+ .use_various_tweaks=true, -+}, -+#line 144 "ftinf_sh.gperf" -+{ .name="ultimate2", -+ .filter_params={on, 6, 22, 36, 22, 6}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+#line 197 "ftinf_sh.gperf" -+{ .name="windows7", -+ .filter_params={on, 20, 25, 42, 25, 06}, -+ .fringe_filter_strength=100, -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_vertical_stem_darken_strength=25, -+ .windows_style_sharpening_strength=65, -+ .gamma_correction={1000, 120}, -+ .brightness=10, -+ .contrast=20, -+ .use_various_tweaks=true, -+ .autohint_snap_stem_height=100, -+ .use_known_settings_on_selected_fonts=true, -+}, -+#line 210 "ftinf_sh.gperf" -+{ .name="windowsxp", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .brightness=10, -+ .contrast=20, -+ .filter_params={on, 6, 25, 44, 25, 6}, -+ .fringe_filter_strength=100, -+ .gamma_correction={1000, 120}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=65 -+}, -+#line 56 "ftinf_sh.gperf" -+{ .name="linux", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 6, 25, 44, 25, 6}, -+ .gamma_correction={0, 100}, -+ .use_various_tweaks=true -+}, -+#line 135 "ftinf_sh.gperf" -+{ .name="ultimate1", -+ .filter_params={on, 4, 22, 38, 22, 4}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+#line 87 "ftinf_sh.gperf" -+{ .name="push", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=75, -+ .stem_fitting_strength=50, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true -+}, -+#line 171 "ftinf_sh.gperf" -+{ .name="ultimate5", -+ .filter_params={on, 12, 28, 42, 28, 12}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+#line 162 "ftinf_sh.gperf" -+{ .name="ultimate4", -+ .filter_params={on, 10, 25, 37, 25, 10}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+#line 153 "ftinf_sh.gperf" -+{ .name="ultimate3", -+ .filter_params={on, 8, 24, 36, 24, 8}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+} -+ }; -+ -+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) -+ { -+ register int key = _settings_hash (str, len); -+ -+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) -+ { -+ register const struct ftinf_s *resword; -+ -+ switch (key - 3) -+ { -+ case 0: -+ resword = &wordlist[0]; -+ goto compare; -+ case 1: -+ resword = &wordlist[1]; -+ goto compare; -+ case 2: -+ resword = &wordlist[2]; -+ goto compare; -+ case 3: -+ resword = &wordlist[3]; -+ goto compare; -+ case 4: -+ resword = &wordlist[4]; -+ goto compare; -+ case 5: -+ resword = &wordlist[5]; -+ goto compare; -+ case 6: -+ resword = &wordlist[6]; -+ goto compare; -+ case 7: -+ resword = &wordlist[7]; -+ goto compare; -+ case 8: -+ resword = &wordlist[8]; -+ goto compare; -+ case 9: -+ resword = &wordlist[9]; -+ goto compare; -+ case 10: -+ resword = &wordlist[10]; -+ goto compare; -+ case 11: -+ resword = &wordlist[11]; -+ goto compare; -+ case 12: -+ resword = &wordlist[12]; -+ goto compare; -+ case 14: -+ resword = &wordlist[13]; -+ goto compare; -+ case 15: -+ resword = &wordlist[14]; -+ goto compare; -+ case 16: -+ resword = &wordlist[15]; -+ goto compare; -+ case 17: -+ resword = &wordlist[16]; -+ goto compare; -+ case 19: -+ resword = &wordlist[17]; -+ goto compare; -+ case 21: -+ resword = &wordlist[18]; -+ goto compare; -+ case 26: -+ resword = &wordlist[19]; -+ goto compare; -+ case 31: -+ resword = &wordlist[20]; -+ goto compare; -+ case 36: -+ resword = &wordlist[21]; -+ goto compare; -+ } -+ return 0; -+ compare: -+ { -+ register const char *s = resword->name; -+ -+ if (*str == *s && !strcmp (str + 1, s + 1)) -+ return resword; -+ } -+ } -+ } -+ return 0; -+} -+#line 242 "ftinf_sh.gperf" -+ -+ -+static const ftinf_t* -+ftinf_settings( const char *name ){ -+ if( name ){ -+ enum { -+ max_wlen=31 -+ }; -+ char buf[max_wlen+1]; -+ int len=strlen( name ); -+ if( len <= max_wlen ){ -+ int i; -+ for( i=0; i -+static const struct ftinf_s* _settings_get( const char*str, unsigned len); -+%} -+struct ftinf_s; -+%% -+{ .name="custom", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 8, 24, 48, 24, 8}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=75, -+ .stem_fitting_strength=50, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true -+}, -+{ .name="classic", -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .filter_params={on, 6, 25, 38, 25, 6}, -+ .gamma_correction={0, 100}, -+ .use_various_tweaks=true -+}, -+{ .name="disabled", -+ .gamma_correction={0, 100}, -+}, -+{ .name="ipad", -+ .filter_params={on, 0, 0, 100, 0, 0}, -+ .gamma_correction={1000, 80}, -+ .grayscale_filter_strength=100 -+}, -+{ .name="infinality", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=25, -+ .stem_fitting_strength=25, -+ .stem_snapping_sliding_scale=40, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=5 -+}, -+{ .name="linux", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 6, 25, 44, 25, 6}, -+ .gamma_correction={0, 100}, -+ .use_various_tweaks=true -+}, -+{ .name="nudge", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=25, -+ .stem_fitting_strength=15, -+ .stem_snapping_sliding_scale=30, -+ .use_various_tweaks=true, -+}, -+{ .name="osx", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_vertical_stem_darken_strength=25, -+ .bold_embolden_x_value=16, -+ .brightness=10, -+ .contrast=20, -+ .filter_params={on, 3, 32, 38, 32, 3}, -+ .gamma_correction={1000, 80}, -+ .global_embolden_y_value=8, -+ .grayscale_filter_strength=25, -+}, -+{ .name="push", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=75, -+ .stem_fitting_strength=50, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true -+}, -+{ .name="sharpened", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=25, -+ .stem_fitting_strength=25, -+ .stem_snapping_sliding_scale=40, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=65 -+}, -+{ .name="shove", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_increase_glyph_heights=true, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=100, -+ .stem_fitting_strength=100, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true -+}, -+{ .name="ubuntu", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_vertical_stem_darken_strength=25, -+ .brightness=-10, -+ .contrast=15, -+ .filter_params={on, 11, 22, 38, 22, 11}, -+ .gamma_correction={1000, 80}, -+ .use_various_tweaks=true -+}, -+{ .name="ultimate1", -+ .filter_params={on, 4, 22, 38, 22, 4}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+{ .name="ultimate2", -+ .filter_params={on, 6, 22, 36, 22, 6}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+{ .name="ultimate3", -+ .filter_params={on, 8, 24, 36, 24, 8}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+{ .name="ultimate4", -+ .filter_params={on, 10, 25, 37, 25, 10}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+{ .name="ultimate5", -+ .filter_params={on, 12, 28, 42, 28, 12}, -+ .fringe_filter_strength=25, -+ .gamma_correction={0, 100}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=25 -+}, -+{ .name="vanilla", -+ .filter_params={on, 6, 25, 38, 25, 6}, -+ .gamma_correction={0, 100}, -+}, -+{ .name="windows7light", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .contrast=20, -+ .filter_params={on, 20, 25, 38, 25, 05}, -+ .fringe_filter_strength=100, -+ .gamma_correction={1000, 160}, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=100 -+}, -+{ .name="windows7", -+ .filter_params={on, 20, 25, 42, 25, 06}, -+ .fringe_filter_strength=100, -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_vertical_stem_darken_strength=25, -+ .windows_style_sharpening_strength=65, -+ .gamma_correction={1000, 120}, -+ .brightness=10, -+ .contrast=20, -+ .use_various_tweaks=true, -+ .autohint_snap_stem_height=100, -+ .use_known_settings_on_selected_fonts=true, -+}, -+{ .name="windowsxp", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .brightness=10, -+ .contrast=20, -+ .filter_params={on, 6, 25, 44, 25, 6}, -+ .fringe_filter_strength=100, -+ .gamma_correction={1000, 120}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=65 -+}, -+{ .name="windowsxplight", -+ .autohint_horizontal_stem_darken_strength=10, -+ .autohint_snap_stem_height=100, -+ .autohint_vertical_stem_darken_strength=25, -+ .brightness=20, -+ .contrast=30, -+ .filter_params={on, 6, 25, 44, 25, 6}, -+ .fringe_filter_strength=100, -+ .gamma_correction={1000, 120}, -+ .stem_alignment_strength=15, -+ .stem_fitting_strength=15, -+ .stem_snapping_sliding_scale=30, -+ .use_known_settings_on_selected_fonts=true, -+ .use_various_tweaks=true, -+ .windows_style_sharpening_strength=65 -+}, -+%% -+ -+static const ftinf_t* -+ftinf_settings( const char *name ){ -+ if( name ){ -+ enum { -+ max_wlen=31 -+ }; -+ char buf[max_wlen+1]; -+ int len=strlen( name ); -+ if( len <= max_wlen ){ -+ int i; -+ for( i=0; i -+#include -+#include -+#include "ftinf.h" - - #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - -@@ -307,11 +310,36 @@ - FT_Library_SetLcdFilter( FT_Library library, - FT_LcdFilter filter ) - { -- static const FT_Byte default_filter[5] = -- { 0x08, 0x4d, 0x56, 0x4d, 0x08 }; - static const FT_Byte light_filter[5] = - { 0x00, 0x55, 0x56, 0x55, 0x00 }; -- -+#ifndef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ static const FT_Byte default_filter[5] = -+ { 0x08, 0x4d, 0x56, 0x4d, 0x08 }; -+#else -+ FT_Byte default_filter[5]; -+ if( ftinf && ftinf->filter_params[0] ) -+ { -+ const int *f=ftinf->filter_params; -+ /* Assume we were given integers [0-100] get them to [0-255] */ -+ int val; /* 2611=2.55*1024 */ -+ val=(f[1]*2611+512)>>10; if( val > 255 ) val=255; -+ default_filter[0] = (FT_Byte) val; -+ val=(f[2]*2611+512)>>10; if( val > 255 ) val=255; -+ default_filter[1] = (FT_Byte) val; -+ val=(f[3]*2611+512)>>10; if( val > 255 ) val=255; -+ default_filter[2] = (FT_Byte) val; -+ val=(f[4]*2611+512)>>10; if( val > 255 ) val=255; -+ default_filter[3] = (FT_Byte) val; -+ val=(f[5]*2611+512)>>10; if( val > 255 ) val=255; -+ default_filter[4] = (FT_Byte) val; -+ } else { -+ default_filter[0]=0x08; -+ default_filter[1]=0x4d; -+ default_filter[2]=0x56; -+ default_filter[3]=0x4d; -+ default_filter[4]=0x08; -+ } -+#endif - - if ( !library ) - return FT_THROW( Invalid_Library_Handle ); -diff -ruN freetype-2.7.1-orig/src/base/ftobjs.c freetype-2.7.1/src/base/ftobjs.c ---- freetype-2.7.1-orig/src/base/ftobjs.c 2017-01-11 12:28:16.727016867 +0100 -+++ freetype-2.7.1/src/base/ftobjs.c 2017-01-11 12:28:34.885016390 +0100 -@@ -40,7 +40,9 @@ - #ifdef FT_CONFIG_OPTION_MAC_FONTS - #include "ftbase.h" - #endif -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "ftinf.h" -+#endif - - #ifdef FT_DEBUG_LEVEL_TRACE - -@@ -78,6 +80,11 @@ - - #define GRID_FIT_METRICS - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include -+#include -+#include "../autofit/aflatin.h" -+#endif - - /* forward declaration */ - static FT_Error -@@ -563,6 +570,25 @@ - ft_lookup_glyph_renderer( FT_GlyphSlot slot ); - - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ static void -+ ft_glyphslot_enlarge_metrics( FT_GlyphSlot slot, -+ FT_Render_Mode mode ) -+ { -+ FT_Glyph_Metrics* metrics = &slot->metrics; -+ FT_Pos enlarge_cbox = 0; -+ -+ -+ /* enlarge for grayscale rendering */ -+ if ( mode == FT_RENDER_MODE_NORMAL ) -+ enlarge_cbox = 64; -+ -+ metrics->horiBearingX -= enlarge_cbox; -+ metrics->width += 2 * enlarge_cbox; -+ } -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ -+ -+ - #ifdef GRID_FIT_METRICS - static void - ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot, -@@ -621,8 +647,18 @@ - FT_Bool autohint = FALSE; - FT_Module hinter; - TT_Face ttface = (TT_Face)face; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET - -+ FT_Bool use_various_tweaks = FALSE; -+ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; - -+ /* Force autohint if no tt instructions */ -+ /* NOTE: NEEDS TO BE RUN LATER IN CODE???? */ -+ /*if ( use_various_tweaks && -+ ttface->num_locations && -+ ttface->max_profile.maxSizeOfInstructions == 0 ) -+ load_flags |= FT_LOAD_FORCE_AUTOHINT;*/ -+#endif - if ( !face || !face->size || !face->glyph ) - return FT_THROW( Invalid_Face_Handle ); - -@@ -713,6 +749,18 @@ - { - FT_AutoHinter_Interface hinting; - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( use_various_tweaks ) -+ { -+ /* Force slight hinting over full hinting always */ -+ load_flags &= ~FT_LOAD_TARGET_LCD; -+ load_flags &= ~FT_LOAD_TARGET_LCD_V; -+ load_flags &= ~FT_LOAD_TARGET_MONO; -+ load_flags &= ~FT_LOAD_TARGET_NORMAL; -+ load_flags |= FT_LOAD_TARGET_LIGHT; -+ /*printf("%d ", load_flags);*/ -+ } -+#endif - - /* try to load embedded bitmaps first if available */ - /* */ -@@ -758,6 +806,18 @@ - if ( error ) - goto Exit; - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ infinality_cur_width = 0; -+ -+ { -+ /* fix for sdl_ttf */ -+ FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); -+ -+ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) -+ ft_glyphslot_enlarge_metrics( slot, mode ); -+ } -+#endif -+ - if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - /* check that the loaded outline is correct */ -@@ -4874,6 +4934,11 @@ - /* That's ok now */ - *alibrary = library; - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ /* get Infinality settings */ -+ ftinf_env(); -+#endif -+ - return FT_Err_Ok; - - #ifdef FT_CONFIG_OPTION_PIC -diff -ruN freetype-2.7.1-orig/src/base/ftoutln.c freetype-2.7.1/src/base/ftoutln.c ---- freetype-2.7.1-orig/src/base/ftoutln.c 2017-01-11 12:28:16.726016867 +0100 -+++ freetype-2.7.1/src/base/ftoutln.c 2017-01-11 12:28:34.886016390 +0100 -@@ -29,7 +29,9 @@ - #include FT_INTERNAL_CALC_H - #include FT_INTERNAL_DEBUG_H - #include FT_TRIGONOMETRY_H -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "ftinf.h" -+#endif - - /*************************************************************************/ - /* */ -@@ -913,7 +915,13 @@ - FT_Vector* points; - FT_Int c, first, last; - FT_Int orientation; -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ FT_Bool use_various_tweaks = FALSE; -+ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; -+ -+ if ( use_various_tweaks ) -+ ystrength = FT_PIX_FLOOR ( ystrength ); -+#endif - - if ( !outline ) - return FT_THROW( Invalid_Outline ); -diff -ruN freetype-2.7.1-orig/src/base/ftsynth.c freetype-2.7.1/src/base/ftsynth.c ---- freetype-2.7.1-orig/src/base/ftsynth.c 2017-01-11 12:28:16.726016867 +0100 -+++ freetype-2.7.1/src/base/ftsynth.c 2017-01-11 12:28:34.886016390 +0100 -@@ -22,7 +22,9 @@ - #include FT_INTERNAL_OBJECTS_H - #include FT_OUTLINE_H - #include FT_BITMAP_H -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "ftinf.h" -+#endif - - /*************************************************************************/ - /* */ -@@ -93,7 +95,10 @@ - FT_Face face; - FT_Error error; - FT_Pos xstr, ystr; -- -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ FT_Bool use_various_tweaks = FALSE; -+ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; -+#endif - - if ( !slot ) - return; -@@ -111,8 +116,16 @@ - ystr = xstr; - - if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) -+ { -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( use_various_tweaks ) -+ (void)FT_Outline_EmboldenXY( &slot->outline, -+ xstr, -+ FT_PIX_FLOOR( ystr ) ); -+ else -+#endif - FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); -- -+ } - else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ - { - /* round to full pixels */ -@@ -150,6 +163,9 @@ - - slot->metrics.width += xstr; - slot->metrics.height += ystr; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( !use_various_tweaks ) -+#endif - slot->metrics.horiAdvance += xstr; - slot->metrics.vertAdvance += ystr; - slot->metrics.horiBearingY += ystr; -diff -ruN freetype-2.7.1-orig/src/base/Jamfile freetype-2.7.1/src/base/Jamfile ---- freetype-2.7.1-orig/src/base/Jamfile 2017-01-11 12:28:16.726016867 +0100 -+++ freetype-2.7.1/src/base/Jamfile 2017-01-11 12:28:34.886016390 +0100 -@@ -56,6 +56,7 @@ - ftglyph - ftgxval - ftinit -+ ftinf - ftlcdfil - ftmm - ftotval -diff -ruN freetype-2.7.1-orig/src/base/rules.mk freetype-2.7.1/src/base/rules.mk ---- freetype-2.7.1-orig/src/base/rules.mk 2017-01-11 12:28:16.726016867 +0100 -+++ freetype-2.7.1/src/base/rules.mk 2017-01-11 12:28:34.887016390 +0100 -@@ -42,6 +42,7 @@ - $(BASE_DIR)/ftdbgmem.c \ - $(BASE_DIR)/ftgloadr.c \ - $(BASE_DIR)/fthash.c \ -+ $(BASE_DIR)/ftinf.c \ - $(BASE_DIR)/ftobjs.c \ - $(BASE_DIR)/ftoutln.c \ - $(BASE_DIR)/ftpic.c \ -diff -ruN freetype-2.7.1-orig/src/cff/cffobjs.c freetype-2.7.1/src/cff/cffobjs.c ---- freetype-2.7.1-orig/src/cff/cffobjs.c 2017-01-11 12:28:16.725016867 +0100 -+++ freetype-2.7.1/src/cff/cffobjs.c 2017-01-11 12:28:34.887016390 +0100 -@@ -34,6 +34,9 @@ - - #include "cfferrs.h" - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include "../base/ftinf.h" -+#endif - - /*************************************************************************/ - /* */ -@@ -1173,6 +1176,9 @@ - #endif - - driver->no_stem_darkening = TRUE; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if(ftinf) driver->no_stem_darkening = !ftinf->stem_darkening_cff; -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - - driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; - driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; -diff -ruN freetype-2.7.1-orig/src/smooth/ftsmooth.c freetype-2.7.1/src/smooth/ftsmooth.c ---- freetype-2.7.1-orig/src/smooth/ftsmooth.c 2017-01-11 12:28:16.725016867 +0100 -+++ freetype-2.7.1/src/smooth/ftsmooth.c 2017-01-11 12:41:51.510995480 +0100 -@@ -26,6 +26,18 @@ - - #include "ftsmerrs.h" - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+#include -+#include FT_BITMAP_H -+#include -+#include -+#include FT_OUTLINE_H -+#include "../base/ftinf.h" -+ -+#define verbose FALSE -+#define STVALUES if (verbose) \ -+ printf ( "scale:%f translate:%ld ", *scale_value, *translate_value ); -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - - /* initialize renderer -- init its raster */ - static FT_Error -@@ -93,6 +105,2219 @@ - FT_Outline_Get_CBox( &slot->outline, cbox ); - } - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ static FT_Fixed FT_FixedFromFloat(float f) -+ { -+ short value = f; -+ unsigned short fract = (f - value) * 0xFFFF; -+ -+ -+ return (FT_Fixed)((long)value << 16 | (unsigned long)fract ); -+ } -+ -+ -+ /* ChromeOS sharpening algorithm */ -+ /* soften the sub-pixel anti-aliasing and sharpen */ -+ static void -+ _ft_lcd_chromeos_sharpen( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_Byte cutoff, -+ double gamma_value ) -+ { -+ static FT_Bool initialized_gamma = FALSE; -+ static unsigned short gamma_ramp[256]; -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ int ii; -+ -+ if ( !initialized_gamma ) -+ { -+ initialized_gamma = TRUE; -+ /* linear to voltage */ -+ for ( ii = 0; ii < 256; ii++ ) -+ { -+ gamma_ramp[ii] = (unsigned char) -+ ( pow( (double)ii / 255.0, gamma_value ) * 255.0f ); -+ if ( gamma_ramp[ii] < cutoff ) -+ gamma_ramp[ii] = 0; -+ } -+ } -+ -+ /* horizontal in-place sub-pixel sharpening filter */ -+ if ( mode == FT_RENDER_MODE_LCD ) -+ { -+ FT_Byte* line = bitmap->buffer; -+ -+ -+ for ( ; height > 0; height--, line += bitmap->pitch ) -+ { -+ FT_UInt xx; -+ -+ -+ for ( xx = 0; xx < width; xx++ ) -+ line[xx] = gamma_ramp[line[xx]]; -+ } -+ } -+ } -+ -+ /* simple linear scale to handle various sliding values */ -+ float -+ sliding_scale ( int min_value, -+ int max_value, -+ float min_amount, -+ float max_amount, -+ int cur_value ) -+ { -+ -+ float m = ( min_amount - max_amount ) / (float)( min_value - max_value ); -+ float result = ( ( (float)cur_value * m) + ( max_amount - max_value * m ) ) ; -+ -+ if ( min_amount < max_amount ) -+ { -+ if ( result < min_amount ) -+ return min_amount; -+ if ( result > max_amount ) -+ return max_amount; -+ } -+ else -+ { -+ if ( result < max_amount ) -+ return max_amount; -+ if ( result > min_amount ) -+ return min_amount; -+ } -+ -+ return result; -+ } -+ -+ -+ /* brightness and contrast adjustment on the bitmap */ -+ static FT_Bool -+ _ft_bitmap_bc ( FT_Bitmap* bitmap, -+ float brightness, -+ float contrast ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* line = bitmap->buffer; -+ FT_UInt xx; -+ -+ -+ if ( brightness == 0 && contrast == 0 ) -+ return FALSE; -+ -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch ) -+ { -+ for ( xx = 0; xx < width - 1; xx += 1 ) -+ { -+ if ( line[xx] > 0) -+ { -+ float value = (float)( 255 - line[xx] ) / 256.0; -+ FT_Int result = 0; -+ -+ if ( brightness < 0.0 ) -+ value = value * ( 1.0 + brightness ); -+ else -+ value = value + ( ( 1.0 - value ) * brightness ); -+ -+ value = ( value - 0.5 ) * -+ ( tan ( ( contrast + 1.0 ) * 3.141592/4.0 ) ) + 0.5; -+ -+ result = (FT_Int)( 255.0 - value * 256.0 ); -+ -+ if ( result < 0 ) -+ result = 0; -+ if ( result > 255 ) -+ result = 255; -+ -+ line[xx] = result; -+ } -+ } -+ } -+ return TRUE; -+ } -+ -+ -+ /* Filter to mimic Windows-style sharpening */ -+ /* Determined via 100% experimentation. */ -+ static void -+ _ft_lcd_windows_sharpen( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* new_line; -+ FT_Byte* line = bitmap->buffer; -+ FT_Bitmap new_bitmap; -+ -+ -+ FT_Bitmap_New( &new_bitmap ); -+ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); -+ new_line = (&new_bitmap)->buffer; -+ -+ if (strength > 0) -+ for (height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch, new_line += bitmap->pitch ) -+ { -+ FT_UInt xx, threshold = 128; -+ FT_Byte* prevline = line - bitmap->pitch; -+ FT_Byte* nextline = line + bitmap->pitch; -+ FT_Byte* new_prevline = new_line - bitmap->pitch; -+ FT_Byte* new_nextline = new_line + bitmap->pitch; -+ -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ /* subpixel grid sp11 sp21 sp31 */ -+ /* where sp22 is sp12 sp22 sp32 */ -+ /* current subpixel. sp13 sp23 sp33 */ -+ -+ FT_Int prevtotal, nexttotal, lefttotal, righttotal, sidesdiff, -+ prevdiff, nextdiff, sp11, sp21, sp31, sp12, sp22, sp32, -+ sp13, sp23, sp33; -+ -+ sp12 = line [xx-1]; -+ sp22 = line [xx]; -+ sp32 = line [xx+1]; -+ -+ if ( height == bitmap->rows ) -+ { -+ prevtotal = sp11 = sp21 = sp31 = 0; -+ prevdiff = sp22; -+ lefttotal = sp12 + sp13; -+ righttotal = sp32 + sp33; -+ } -+ else -+ { -+ prevtotal = prevline[xx-1] + prevline[xx] + prevline[xx+1]; -+ sp11 = prevline [xx-1]; -+ sp21 = prevline [xx]; -+ sp31 = prevline [xx+1]; -+ prevdiff = sp22 - sp21; -+ lefttotal = sp11 + sp12 + sp13; -+ righttotal = sp31 + sp32 + sp33; -+ } -+ -+ if ( height == 1 ) -+ { -+ nexttotal = sp13 = sp23 = sp33 = 0; -+ nextdiff = sp22; -+ lefttotal = sp11 + sp12; -+ righttotal = sp31 + sp32; -+ } -+ else -+ { -+ nexttotal = nextline[xx-1] + nextline[xx] + nextline[xx+1]; -+ sp13 = nextline [xx-1]; -+ sp23 = nextline [xx]; -+ sp33 = nextline [xx+1]; -+ nextdiff = sp23 - sp22; -+ lefttotal = sp11 + sp12 + sp13; -+ righttotal = sp31 + sp32 + sp33; -+ } -+ -+ sidesdiff = lefttotal - righttotal; -+ -+ if ( sidesdiff < 0 ) -+ sidesdiff *= -1; -+ -+ if ( prevdiff < 0 ) -+ prevdiff *= -1; -+ -+ if ( nextdiff < 0 ) -+ nextdiff *= -1; -+ -+ /* if the current pixel is less than threshold, and greater than 0 */ -+ if ( sp22 <= threshold && sp22 > 0 ) -+ { -+ /* A pixel is horizontally isolated if: */ -+ /* 1: All upper adjecent pixels are >= threshold */ -+ if ( prevtotal >= nexttotal && -+ abs( sp11 - sp12 ) > 5 && -+ abs( sp21 - sp22 ) > 5 && -+ abs( sp31 - sp32 ) > 5 && /* not a vert stem end */ -+ sp11 >= threshold && -+ sp21 >= threshold && -+ sp31 >= threshold && -+ abs( sp23 - sp22 ) > 15 ) /* not on a vert stem */ -+ { -+ /* darken upper adjacent subpixel; lighten current */ -+ if ( height != (FT_UInt)bitmap->rows ) -+ new_prevline[xx] += ( ( 255 - new_prevline[xx] ) -+ * strength ) / 100 ; -+ -+ new_line[xx] -= ( new_line[xx] * strength ) / 100; -+ -+ if ( height != 1 && height != (FT_UInt)bitmap->rows ) -+ if ( new_nextline[xx] > 155 + ( 100 - strength ) ) -+ new_prevline[xx] = 255; -+ -+ } -+ else if ( nexttotal > prevtotal && -+ abs( sp13 - sp12 ) > 5 && -+ abs( sp23 - sp22 ) > 5 && -+ abs( sp33 - sp32 ) > 5 && -+ /* 2: All lower adjecent pixels are >= threshold */ -+ sp13 >= threshold && -+ sp23 >= threshold && -+ sp33 >= threshold && -+ abs( sp22 - sp21 ) > 15 ) -+ { -+ /* darken lower adjacent subpixel; lighten current */ -+ if ( height != 1 ) -+ new_nextline[xx] += ( 255 - new_nextline[xx] ) * strength / 100; -+ -+ new_line[xx] -= ( new_line[xx] * strength ) / 100; -+ -+ if ( height != 1 ) -+ if ( new_nextline[xx] > 155 + ( 100 - strength ) ) -+ new_nextline[xx] = 255; -+ -+ } -+ } -+ else if ( sp22 > threshold && sp22 < 255 ) -+ { -+ if ( sp11 <= threshold && -+ abs( sp13 - sp12 ) > 5 && -+ abs( sp23 - sp22 ) > 5 && -+ abs( sp33 - sp32 ) > 5 && -+ sp21 <= threshold && -+ sp31 <= threshold && -+ prevtotal <= nexttotal && -+ abs( sp22 - sp21 ) > 15 ) -+ { -+ /* bring this subpixel 1/3 of the way to 255 at 100% strength */ -+ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; -+ -+ if ( height != (FT_UInt)bitmap->rows ) -+ new_prevline[xx] -= ( new_prevline[xx] * strength ) / 300; -+ } -+ else if ( sp13 <= threshold && -+ abs( sp11 - sp12 ) > 5 && -+ abs( sp21 - sp22 ) > 5 && -+ abs( sp31 - sp32 ) > 5 && -+ sp23 <= threshold && -+ sp33 <= threshold && -+ nexttotal < prevtotal && -+ abs( sp23 - sp22 ) > 15 ) -+ { -+ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; -+ -+ if ( height != 1 ) -+ new_nextline[xx] -= ( new_nextline[xx] * strength ) / 300; -+ } -+ } -+ } -+ } -+ FT_Bitmap_Copy( library, &new_bitmap, bitmap); -+ FT_Bitmap_Done( library, &new_bitmap ); -+ } -+ -+ -+ static void -+ _ft_lcd_darken_x ( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* new_line; -+ FT_Byte* line = bitmap->buffer; -+ FT_Bitmap new_bitmap; -+ int factor1, factor2; -+ int bias = 0; -+ -+ FT_Bitmap_New( &new_bitmap ); -+ -+ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); -+ new_line = (&new_bitmap)->buffer; -+ -+ if ( strength > 0 ) -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch, new_line += bitmap->pitch ) -+ { -+ FT_UInt xx; -+ FT_Byte* prevline = line - bitmap->pitch; -+ FT_Byte* nextline = line + bitmap->pitch; -+ -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ /* subpixel grid sp11 sp21 sp31 */ -+ /* where sp22 is sp12 sp22 sp32 */ -+ /* current subpixel. sp13 sp23 sp33 */ -+ -+ FT_Int sp21, sp12, sp22, sp32, sp23; -+ -+ sp12 = line [xx-1]; -+ sp22 = line [xx]; -+ sp32 = line [xx+1]; -+ -+ if ( height == bitmap->rows ) -+ sp21 = 0; -+ else -+ sp21 = prevline [xx]; -+ -+ if ( height == 1 ) -+ sp23 = 0; -+ else -+ sp23 = nextline [xx]; -+ -+ /* darken subpixel if neighbor above and below are much less than */ -+ /* safer but less effective */ -+ factor1 = 5; -+ factor2 = 5; -+ -+ /* make matches in the middle of glyph slightly darker */ -+ /*if (height > 1 && height < (FT_UInt)bitmap->rows) bias = 1;*/ -+ -+ if ( sp22 > factor1 * sp21 && -+ sp22 > factor1 * sp23 && -+ sp22 > factor2 && -+ sp12 > 16 && -+ sp32 > 16 ) -+ if ( new_line[xx] < ( strength * 255 ) / 100 ) -+ new_line[xx] = (strength * 255 ) / 100 -+ + bias * ( 255 - ( strength * 255 ) / 100 ) / 3; -+ -+ } -+ } -+ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); -+ FT_Bitmap_Done( library, &new_bitmap ); -+ } -+ -+ -+ static void -+ _ft_lcd_darken_y ( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* new_line; -+ FT_Byte* line = bitmap->buffer; -+ FT_Bitmap new_bitmap; -+ -+ -+ FT_Bitmap_New( &new_bitmap ); -+ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); -+ new_line = (&new_bitmap)->buffer; -+ -+ if ( strength > 0 ) -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch, new_line += bitmap->pitch ) -+ { -+ FT_UInt xx; -+ -+ -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ if ( line[xx] > line[xx-1] && line[xx] > line[xx+1] ) -+ { -+ if (new_line[xx] > 0) -+ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; -+ new_line[xx-1] += ( strength * ( 255 - line[xx-1] ) ) / 100; -+ new_line[xx+1] += ( strength * ( 255 - line[xx+1] ) ) / 100; -+ } -+ } -+ } -+ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); -+ FT_Bitmap_Done( library, &new_bitmap ); -+ } -+ -+ -+ static void -+ _ft_bitmap_cap ( FT_Bitmap* bitmap, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* new_line; -+ FT_Byte* line = bitmap->buffer; -+ FT_UInt cur_value = 0; -+ FT_Bitmap new_bitmap; -+ -+ -+ FT_Bitmap_New( &new_bitmap ); -+ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); -+ new_line = (&new_bitmap)->buffer; -+ -+ if ( strength > 0 ) -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch, new_line += bitmap->pitch ) -+ { -+ FT_UInt xx; -+ -+ -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ cur_value = ( new_line[xx-1] + new_line[xx] + new_line[xx+1] ) / 3; -+ if ( cur_value > ( strength * 255 ) / 100 ) -+ { -+ FT_UInt new_factor = ( strength * 255 ) / 100; -+ new_line[xx] = ( new_line[xx] * new_factor ) / cur_value; -+ new_line[xx+1] = ( new_line[xx+1] * new_factor ) / cur_value; -+ new_line[xx-1] = ( new_line[xx-1] * new_factor ) / cur_value; -+ } -+ } -+ } -+ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); -+ FT_Bitmap_Done( library, &new_bitmap ); -+ } -+ -+ static int -+ pseudo_gamma ( int val, float value ) -+ { -+ return 256 * ( 1.0f - powf( ( 1.0f - val * (1.0f/256.0f) ), 1.0f / value ) ); -+ } -+ -+#if(0) -+ static void -+ _ft_bitmap_embolden ( FT_Bitmap* bitmap, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* new_line; -+ FT_Byte* line = bitmap->buffer; -+ FT_Bitmap new_bitmap; -+ FT_UInt xx; -+ -+ -+ FT_Bitmap_New(&new_bitmap); -+ FT_Bitmap_Copy(library, bitmap, &new_bitmap); -+ new_line = (&new_bitmap)->buffer; -+ -+ if ( strength > 0 ) -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch, new_line += bitmap->pitch ) -+ { -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ FT_Int new_value = 0; -+ -+ -+ new_value = ( strength * line [xx-1] ) / 100 -+ + pseudo_gamma( line [xx], .75 ) -+ + (strength * line [xx+1] ) / 100; -+ if ( new_value > 255 ) -+ new_value = 255; -+ -+ new_line[xx] = new_value; -+ } -+ } -+ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); -+ FT_Bitmap_Done( library, &new_bitmap ); -+ } -+ -+ -+ -+ static void -+ _ft_bitmap_gamma ( FT_Bitmap* bitmap, -+ float strength ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* line = bitmap->buffer; -+ FT_UInt xx; -+ -+ -+ if ( strength > 0 ) -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch ) -+ { -+ -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ if ( abs( line[xx-1] - line[xx] ) < 20 || -+ abs( line[xx+1] - line[xx] ) < 20 ) -+ line [xx] = pseudo_gamma( line [xx], strength ) ; -+ } -+ } -+ } -+#endif -+ -+ /* Fringe filter */ -+ static void -+ _ft_lcd_fringe_filter ( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* new_line; -+ FT_Byte* line = bitmap->buffer; -+ FT_Bitmap new_bitmap; -+ -+ -+ FT_Bitmap_New(&new_bitmap); -+ -+ line = bitmap->buffer; -+ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); -+ new_line = (&new_bitmap)->buffer; -+ -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch, new_line += bitmap->pitch ) -+ { -+ /* Threshold set to 1/2 pixel intensity */ -+ FT_UInt xx, threshold = 128; -+ -+ /* Hack to make this work when bitmap is at first or last line */ -+ FT_Int fudge = bitmap->pitch * (height == (FT_UInt)bitmap->rows); -+ -+ FT_Byte* prevline = line - bitmap->pitch + fudge; -+ FT_Byte* nextline = line + bitmap->pitch; -+ -+ -+ for ( xx = 1; xx < width - 1; xx += 1 ) -+ { -+ /* subpixel grid sp11 sp21 sp31 */ -+ /* where sp22 is sp12 sp22 sp32 */ -+ /* current subpixel. sp13 sp23 sp33 */ -+ -+ FT_Int prevtotal, nexttotal, lefttotal, righttotal, sidesdiff, -+ leftdiff, rightdiff, prevdiff, nextdiff, sp11, sp21, sp31, -+ sp12, sp22, sp32, sp13, sp23, sp33; -+ -+ sp12 = line [xx-1]; -+ sp22 = line [xx]; -+ sp32 = line [xx+1]; -+ -+ /* if at max height fake out some values */ -+ if ( height == (FT_UInt)bitmap->rows ) -+ { -+ prevtotal = sp11 = sp21 = sp31 = 0; -+ prevdiff = sp22; -+ lefttotal = sp12 + sp13; -+ righttotal = sp32 + sp33; -+ } -+ else -+ { -+ prevtotal = prevline[xx-1] + prevline[xx] + prevline[xx+1]; -+ sp11 = prevline [xx-1]; -+ sp21 = prevline [xx]; -+ sp31 = prevline [xx+1]; -+ prevdiff = sp22 - sp21; -+ lefttotal = sp11 + sp12 + sp13; -+ righttotal = sp31 + sp32 + sp33; -+ } -+ -+ /* if at min height fake out some values */ -+ if ( height == 1 ) -+ { -+ nexttotal = sp13 = sp23 = sp33 = 0; -+ nextdiff = sp22; -+ lefttotal = sp11 + sp12; -+ righttotal = sp31 + sp32; -+ } -+ else -+ { -+ nexttotal = nextline[xx-1] + nextline[xx] + nextline[xx+1]; -+ sp13 = nextline [xx-1]; -+ sp23 = nextline [xx]; -+ sp33 = nextline [xx+1]; -+ nextdiff = sp23 - sp22; -+ lefttotal = sp11 + sp12 + sp13; -+ righttotal = sp31 + sp32 + sp33; -+ } -+ -+ sidesdiff = lefttotal - righttotal; -+ leftdiff = sp22 - sp12; -+ rightdiff = sp32 - sp22; -+ -+ if ( sidesdiff < 0 ) -+ sidesdiff *= -1; -+ -+ if ( prevdiff < 0 ) -+ prevdiff *= -1; -+ -+ if ( nextdiff < 0 ) -+ nextdiff *= -1; -+ -+ if ( leftdiff < 0 ) -+ leftdiff *= -1; -+ -+ if ( rightdiff < 0 ) -+ rightdiff *= -1; -+ -+ /* if the current subpixel is less than threshold, and varies only -+ slightly to left or right, lighten it */ -+ if ( sp22 <= threshold && sp22 > 0 && -+ ( leftdiff < 10 || rightdiff < 10 ) ) -+ { -+ /* A pixel is horizontally isolated if: */ -+ /* 1: All upper adjecent subpixels are >= threshold and all lower -+ adjacent ones are essentially white */ -+ if ( prevtotal >= nexttotal && -+ sp11 >= threshold && -+ sp21 >= threshold && -+ sp31 >= threshold && -+ sp13 < 2 && -+ sp23 < 2 && -+ sp33 < 2 ) -+ -+ { -+ new_line[xx] -= ( new_line[xx] * strength ) / 100; -+ -+ if ( leftdiff < 10 ) -+ /* OPPORTUNITY FOR IMPROVEMENT - keep going left until 255? */ -+ new_line[xx-1] -= ( new_line[xx-1] * strength ) / 200; -+ -+ if ( rightdiff < 10 ) -+ /* OPPORTUNITY FOR IMPROVEMENT */ -+ new_line[xx+1] -= ( new_line[xx+1] * strength ) / 200; -+ } -+ else if ( nexttotal > prevtotal && -+ /* 2: the inverse of above */ -+ sp13 >= threshold && -+ sp23 >= threshold && -+ sp33 >= threshold && -+ sp11 < 2 && -+ sp21 < 2 && -+ sp31 < 2 ) -+ { -+ new_line[xx] -= ( new_line[xx] * strength ) / 100; -+ -+ if ( leftdiff < 10 ) -+ /* OPPORTUNITY FOR IMPROVEMENT - keep going left until 255? */ -+ new_line[xx-1] -= ( new_line[xx-1] * strength ) / 200; -+ -+ if ( rightdiff < 10 ) -+ /* OPPORTUNITY FOR IMPROVEMENT */ -+ new_line[xx+1] -= ( new_line[xx+1] * strength ) / 200; -+ } -+ } -+ /* otherwise if the current subpixel is more than threshold, and varies -+ slightly to left or right, darken it */ -+ else if ( sp22 > threshold && -+ sp22 < 255 && -+ ( leftdiff < 10 || -+ rightdiff < 10 ) ) -+ { -+ if ( sp11 <= 2 && -+ sp21 <= 2 && -+ sp31 <= 2 && -+ sp13 >= threshold && -+ sp23 >= threshold && -+ sp33 >= threshold && -+ prevtotal < nexttotal ) -+ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100; -+ -+ else if ( sp13 <= 2 && -+ sp23 <= 2 && -+ sp33 <= 2 && -+ nexttotal < prevtotal && -+ sp11 >= threshold && -+ sp21 >= threshold && -+ sp31 >= threshold ) -+ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100; -+ -+ } -+ } -+ } -+ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); -+ FT_Bitmap_Done( library, &new_bitmap ); -+ } -+ -+ -+ /* Grayscale filter */ -+ static void -+ _ft_lcd_grayscale_filter ( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_UInt strength, -+ FT_Library library ) -+ { -+ -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* line = bitmap->buffer; -+ -+ -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch ) -+ { -+ FT_UInt xx; -+ -+ -+ for ( xx = 0; xx < width - 1; xx += 3 ) -+ { -+ FT_UInt total = line [xx] + line [xx + 1] + line [xx + 2]; -+ line[xx] = ( ( 100 - strength ) * line[xx] -+ + strength * ( total / 3 ) ) / 100; -+ line[xx+1] = ( ( 100 - strength ) * line[xx+1] -+ + strength * ( total / 3 ) ) / 100; -+ line[xx+2] = ( ( 100 - strength ) * line[xx+2] -+ + strength * ( total / 3 ) ) / 100; -+ } -+ } -+ } -+ -+/* -+ These need to be in sync with params inside ftinf.c -+ (not ideal but perhaps better than making these public) -+ */ -+#define STEM_WIDTH_2_PPEM 18 -+#define MAX_PPEM 100 -+ -+ typedef struct Stem_Segment_ -+ { -+ FT_Long x1; -+ FT_Long x2; -+ FT_Int y; -+ } Stem_Segment; -+ -+ typedef struct Stem_Center_ -+ { -+ FT_Long x; -+ FT_Long y; -+ FT_Long w; -+ FT_Long x1; -+ FT_Long x2; -+ } Stem_Center; -+ -+ typedef struct Stem_ -+ { -+ FT_Long center; -+ FT_Long count; -+ FT_Long rcount; /* used to count within a range in possible stems */ -+ FT_Long width; -+ FT_Long height; -+ FT_Short zone; /* 1 2 or 3 */ -+ FT_Bool generated; -+ } Stem; -+ -+ static void -+ swap_stem ( Stem* s1, Stem* s2 ) -+ { -+ Stem s; -+ s.center = s1->center; -+ s.count = s1->count; -+ s.rcount = s1->rcount; -+ s.width = s1->width; -+ s.zone = s1->zone; -+ s.generated = s1->generated; -+ -+ s1->center = s2->center; -+ s1->count = s2->count; -+ s1->rcount = s2->rcount; -+ s1->width = s2->width; -+ s1->zone = s2->zone; -+ s1->generated = s2->generated; -+ -+ s2->center = s.center; -+ s2->count = s.count; -+ s2->rcount = s.rcount; -+ s2->width = s.width; -+ s2->zone = s.zone; -+ s2->generated = s.generated; -+ } -+ -+ /* Stem alignment for bitmaps; A hack with very nice results */ -+ /* Ideally this could be implemented on the outline, prior to -+ * rasterization. Possible future enhancement is to use the -+ * warper code to achieve this */ -+ static void -+ _lcd_stem_align ( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_GlyphSlot slot, -+ FT_Long* translate_value, -+ float* scale_value, -+ FT_UInt alignment_strength, -+ FT_UInt fitting_strength, -+ float* embolden_value -+ ) -+ { -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ -+ Stem_Segment* segments; -+ Stem_Segment* leftmost_segment; -+ Stem_Segment* rightmost_segment; -+ Stem_Segment* leftmost_segment_not_extrema; -+ Stem_Segment* rightmost_segment_not_extrema; -+ Stem* stems; -+ Stem* possible_stems; -+ Stem* leftmost_stem; -+ Stem* rightmost_stem; -+ Stem_Data* known_stem_values; -+ Stem_Center* centers; -+ FT_Long leftmost_point = width * 256; -+ FT_Long rightmost_point = 0; -+ FT_Long leftmost_point_not_extrema = width * 256; -+ FT_Long rightmost_point_not_extrema = 0; -+ FT_Long num_segments = 0; -+ FT_Long num_centers = 0; -+ FT_Long *stem_centers; -+ FT_UInt h; -+ FT_ULong valid_stems = 0, valid_possible_stems = 0; -+ FT_Long center, stem_matches, stem_matches_ledge; -+ FT_Long stem_matches_redge, next_center, last_matching_center; -+ FT_Long last_matching_ledge, last_matching_redge, this_center; -+ FT_Int max_strength; -+ FT_Byte* line = bitmap->buffer; -+ FT_UInt current_value = 0; -+ FT_UInt xx; -+ FT_Long linearHoriAdvance = slot->linearHoriAdvance >> 10; -+ -+ FT_Int m_horiBearingX = slot->metrics.horiBearingX; -+ FT_Int m_horiAdvance = slot->metrics.horiAdvance; -+ FT_Int m_width = slot->metrics.width; -+ FT_Pos one_pixel = 768; -+ FT_Pos one_third_pixel = 256; -+ FT_Int columns_per_pixel = 3; -+ /*FT_Int extra_columns = 6;*/ -+ -+ /* on / off flags for testing different features */ -+ FT_Bool strategy_translate_using_closest_stem = TRUE; -+ FT_Bool strategy_scale_to_closest_centers = FALSE; -+ FT_Bool strategy_scale_to_closest_centers_up_only = FALSE; -+ FT_Bool strategy_always_use_distance_ceiling = FALSE; -+ FT_Bool strategy_auto_change_center_offset = TRUE; -+ FT_Bool strategy_use_m_control = FALSE; -+ FT_Bool strategy_correct_out_of_bounds_outlines = FALSE; -+ FT_Bool strategy_also_use_edge_detection_for_stems = FALSE; -+ FT_Bool strategy_use_strengths = TRUE; -+ FT_Bool strategy_synthesize_stems = FALSE; -+ FT_Bool strategy_bearing_correction = TRUE; -+ FT_Bool strategy_use_d_correction = TRUE; -+ FT_Bool strategy_fit_to_width = FALSE; -+ /*FT_Bool strategy_center_glyph = FALSE;*/ -+ -+ const FT_Int MIN_PPEM = 7; -+ /*const FT_Int MAX_PPEM = 100;*/ -+ const FT_Int MAX_STEMS = 3; -+ FT_Int ppem = 0; -+ -+ Stem_Data stem_data; -+ -+ /* reset to default */ -+ *scale_value = 1.0; -+ -+ /* Simply return in odd cases where these don't seem to be set */ -+ /* Flash and some pdf viewers will crash otherwise */ -+ if ( !slot->face || -+ !slot->face->size || -+ !slot->face->size->metrics.x_ppem ) -+ return; -+ -+ if ( slot->face->size->metrics.x_ppem > MAX_PPEM ) -+ return; -+ -+ if ( slot->face->size->metrics.x_ppem < MIN_PPEM ) -+ return; -+ -+ if ( !FT_IS_SCALABLE( slot->face ) ) -+ return; -+ -+ ppem = slot->face->size->metrics.x_ppem; -+ -+ if ( ppem < 9 ) -+ return; -+ if ( ppem > 20 ) -+ strategy_use_m_control = TRUE; -+ -+ /* only perform alignment on styles we know, that aren't bold or italic */ -+ /* perhaps detection could be added on those that are not set? */ -+ /* Require certain ppems for narrow and light fonts */ -+ if( slot->face->style_name ) -+ { -+ if ( strcasestr( slot->face->style_name, "Italic" ) || -+ strcasestr( slot->face->style_name, "Oblique" ) || -+ strcasestr( slot->face->style_name, "Script" ) || -+ strcasestr( slot->face->style_name, "Handwriting" ) || -+ strcasestr( slot->face->style_name, "Bold" ) || -+ strcasestr( slot->face->style_name, "Black" ) || -+ ( ( strcasestr( slot->face->style_name, "Extra Thin" ) || -+ strcasestr( slot->face->style_name, "Extra Light" ) ) && -+ ppem < 10 ) || -+ ( strcasestr( slot->face->style_name, "Thin" ) -+ && ppem < 10 ) || -+ ( strcasestr( slot->face->style_name, "Light" ) -+ && ppem < 10 ) || -+ ( strcasestr( slot->face->style_name, "Narrow" ) -+ && ppem < 15 ) || -+ ( strcasestr( slot->face->style_name, "Condensed" ) -+ && ppem < 20 ) ) -+ return; -+ } -+ -+ if( slot->face->family_name ) -+ { -+ if ( strcasestr( slot->face->family_name, "Italic" ) || -+ strcasestr( slot->face->family_name, "Oblique" ) || -+ strcasestr( slot->face->family_name, "Script" ) || -+ strcasestr( slot->face->family_name, "Handwriting" ) || -+ strcasestr( slot->face->family_name, "Bold" ) || -+ strcasestr( slot->face->family_name, "Black" ) || -+ ( ( strcasestr( slot->face->family_name, "Extra Thin" ) || -+ strcasestr( slot->face->family_name, "Extra Light" ) ) && -+ ppem < 10 ) || -+ ( strcasestr( slot->face->family_name, "Thin" ) -+ && ppem < 10 ) || -+ ( strcasestr( slot->face->family_name, "Light" ) -+ && ppem < 10 ) || -+ ( strcasestr( slot->face->family_name, "Narrow" ) -+ && ppem < 15 ) || -+ ( strcasestr( slot->face->family_name, "Condensed" ) -+ && ppem < 20 ) ) -+ return; -+ } -+ else if ( slot->face->style_flags ) -+ { -+ if ( slot->face->style_flags & FT_STYLE_FLAG_ITALIC || -+ slot->face->style_flags & FT_STYLE_FLAG_BOLD || -+ FT_IS_TRICKY( slot->face ) ) -+ return; -+ } -+ else return; -+ -+ if ( mode != FT_RENDER_MODE_LCD ) -+ { -+ columns_per_pixel = 1; -+ one_pixel = 256; -+ one_third_pixel = 85; -+ /*extra_columns = 0;*/ -+ /* until this can be figured out just return */ -+ /* There are issues with missing glyphs */ -+ return; -+ } -+ -+ known_stem_values=&stem_data; -+ if ( ftinf && ftinf->use_known_settings_on_selected_fonts ) -+ { -+ ftinf_fill_stem_values( known_stem_values, slot->face->family_name, ppem, TRUE ); -+ /* translate value may be set for < 10 */ -+ if (known_stem_values->stem_translating_only > -1024 ) -+ { -+ *translate_value = known_stem_values->stem_translating_only; -+ return; -+ } -+ if( known_stem_values->bearing_correction == FALSE ) -+ strategy_bearing_correction = FALSE; -+ } else -+ ftinf_fill_stem_values( known_stem_values, slot->face->family_name, ppem, FALSE ); -+ -+ if ( known_stem_values->use_100 || -+ known_stem_values->m >= 0 ) -+ { -+ alignment_strength = fitting_strength = 100; -+ strategy_use_m_control = TRUE; -+ } -+ -+ if ( known_stem_values->edge_detection ) -+ strategy_also_use_edge_detection_for_stems = TRUE; -+ -+ /* Allocate */ -+ segments = NULL; -+ leftmost_segment = (Stem_Segment*) malloc( 4*sizeof ( Stem_Segment ) ); -+ leftmost_segment_not_extrema = leftmost_segment+1; -+ rightmost_segment = leftmost_segment+2; -+ rightmost_segment_not_extrema = leftmost_segment+3; -+ -+ stems = (Stem*) malloc ( (2*MAX_STEMS+2) * sizeof ( Stem ) ); -+ possible_stems = stems+MAX_STEMS; -+ leftmost_stem = possible_stems+MAX_STEMS; -+ rightmost_stem = leftmost_stem + 1; -+ centers = NULL; -+ -+ if ( verbose ) -+ printf("\n"); -+ -+ /* Initialize */ -+ stem_centers=(FT_Long*)calloc( width * 256, sizeof(stem_centers[0]) ); -+ -+ rightmost_segment->x1 = 0; -+ rightmost_segment->x2 = 0; -+ rightmost_segment->y = 0; -+ leftmost_segment->x1 = 99999999; -+ leftmost_segment->x2 = 0; -+ leftmost_segment->y = 0; -+ -+ rightmost_segment_not_extrema->x1 = 0; -+ rightmost_segment_not_extrema->x2 = 0; -+ rightmost_segment_not_extrema->y = 0; -+ leftmost_segment_not_extrema->x1 = 99999999; -+ leftmost_segment_not_extrema->x2 = 0; -+ leftmost_segment_not_extrema->y = 0; -+ -+ /* Locate stem centers for later processing */ -+ for ( h = (FT_UInt)bitmap->rows; h > 0; h--, line += bitmap->pitch ) -+ { -+ current_value = 0; -+ /* Calculate various sums and stem widths of glyph */ -+ for ( xx = 0; xx < width; xx += 1 ) -+ { -+ /* Reallocate (in blocks of 64) */ -+ if( num_segments % 64 == 0 ) -+ segments = (Stem_Segment*) realloc -+ ( segments, ( num_segments + 64 ) * sizeof ( Stem_Segment ) ); -+ -+ /* if line is white, and now has color, it's the start of a stem */ -+ if ( current_value == 0 && line[xx] > 0 ) -+ { -+ /* start of stem */ -+ segments[num_segments].x1 = 256 * xx + ( 255 - line[xx] ); -+ segments[num_segments].y = h; -+ } -+ -+ /* otherwise, if it's currently black and the new value is 0, -+ it's the end of a stem */ -+ else if ( ( current_value > 0 && line[xx] == 0 ) || -+ ( current_value > 0 && xx == width - 1 ) ) -+ { -+ FT_Long stem_center_x; -+ segments[num_segments].x2 = 256 * ( xx - 1 ) + line[xx-1]; -+ -+ if ( xx == width - 1 ) -+ segments[num_segments].x2 += line[xx]; -+ -+ /*stem center is average of start and end of stem */ -+ stem_center_x = ( segments[num_segments].x2 -+ + segments[num_segments].x1 ) / 2; -+ -+ /* Reallocate (in blocks of 32) */ -+ if( num_centers % 32 == 0 ) -+ centers = (Stem_Center*) realloc -+ ( centers, ( num_centers + 32 ) * sizeof ( Stem_Center ) ); -+ centers[num_centers].x = stem_center_x; -+ centers[num_centers].y = h; -+ centers[num_centers].x1 = segments[num_segments].x1; -+ centers[num_centers].x2 = segments[num_segments].x2; -+ -+ num_centers++; -+ -+ stem_centers[stem_center_x] += 1; -+ -+ /* Find left and rightmost points for later calculations */ -+ /* OR - Favor ones that aren't on the top or bottom if */ -+ /* possible to prevent v and w from getting caught later */ -+ if ( segments[num_segments].x1 < leftmost_segment->x1 || -+ ( segments[num_segments].y > 1 && -+ segments[num_segments].y < height && -+ segments[num_segments].x1 == leftmost_segment->x1 ) ) -+ { -+ leftmost_segment->x1 = segments[num_segments].x1; -+ leftmost_segment->x2 = segments[num_segments].x2; -+ leftmost_segment->y = h; -+ } -+ if ( segments[num_segments].x2 > rightmost_segment->x2 || -+ ( segments[num_segments].y > 1 && -+ segments[num_segments].y < height && -+ segments[num_segments].x1 == rightmost_segment->x1 ) ) -+ { -+ rightmost_segment->x1 = segments[num_segments].x1; -+ rightmost_segment->x2 = segments[num_segments].x2; -+ rightmost_segment->y = h; -+ } -+ -+ if ( segments[num_segments].x1 -+ < leftmost_segment_not_extrema->x1 || -+ ( segments[num_segments].y > 1 && -+ segments[num_segments].y < height && -+ segments[num_segments].x1 -+ == leftmost_segment_not_extrema->x1 && -+ h < (FT_UInt)bitmap->rows && h > 0 ) ) -+ { -+ leftmost_segment_not_extrema->x1 = segments[num_segments].x1; -+ leftmost_segment_not_extrema->x2 = segments[num_segments].x2; -+ leftmost_segment_not_extrema->y = h; -+ } -+ if ( segments[num_segments].x2 -+ > rightmost_segment_not_extrema->x2 || -+ ( segments[num_segments].y > 1 && -+ segments[num_segments].y < height && -+ segments[num_segments].x1 -+ == rightmost_segment_not_extrema->x1 && -+ h < (FT_UInt)bitmap->rows && h > 0 ) ) -+ { -+ rightmost_segment_not_extrema->x1 = segments[num_segments].x1; -+ rightmost_segment_not_extrema->x2 = segments[num_segments].x2; -+ rightmost_segment_not_extrema->y = h; -+ } -+ -+ if ( segments[num_segments].x1 < leftmost_point ) -+ leftmost_point = segments[num_segments].x1; -+ -+ if ( segments[num_segments].x2 > rightmost_point ) -+ rightmost_point = segments[num_segments].x2; -+ -+ if ( segments[num_segments].x1 < leftmost_point_not_extrema && -+ h < (FT_UInt)bitmap->rows && h > 0 ) -+ leftmost_point_not_extrema = segments[num_segments].x1; -+ -+ if ( segments[num_segments].x2 > rightmost_point_not_extrema && -+ h < (FT_UInt)bitmap->rows && h > 0 ) -+ rightmost_point_not_extrema = segments[num_segments].x2; -+ -+ num_segments++; -+ } -+ /* else - other conditions - need some error checking here */ -+ current_value = line[xx]; -+ } -+ } -+ -+ /* initialize */ -+ for ( xx = 0; xx < MAX_STEMS; xx +=1 ) -+ { -+ stems[xx].center = 0; -+ stems[xx].count = 0; -+ stems[xx].width = 0; -+ stems[xx].height = 0; -+ possible_stems[xx].center = 0; -+ possible_stems[xx].count = 0; -+ possible_stems[xx].width = 0; -+ possible_stems[xx].height = 0; -+ } -+ -+ valid_stems = 0; -+ valid_possible_stems = 0; -+ -+ /* Determine which centers belong to stems */ -+ center = 0; -+ -+ while ( center < num_centers ) -+ { -+ /* slope at within which to consider a point part of a stem */ -+ /*const FT_UInt slope = 1; -+ const FT_UInt topslope = (256 * 3) / 10; */ -+ -+ /* 10 to 20 with 4 matches seems good, */ -+ /* but 1 or 2 with 3 stems needs to somehow get included */ -+ FT_Int deviation1 = 5; -+ FT_Int deviation2=-1, requirement1 = 4, stem_match_requirement = 3; -+ FT_Int center_difference_in_height; -+ FT_Int center_difference_in_width, valid_center_average; -+ FT_Int smallest_width_ledge, smallest_width_redge; -+ FT_Int x1_difference_in_width, x2_difference_in_width; -+ FT_Bool no_gap_found = FALSE; -+ FT_Bool no_gap_found_ledge = FALSE; -+ FT_Bool no_gap_found_redge = FALSE; -+ FT_Bool stem_detected = FALSE; -+ FT_Int set_width_to, set_center_to; -+ -+ /* seems to not do damage */ -+ /* May not be effective */ -+ requirement1 = height / 4; -+ if ( requirement1 < 5 ) -+ requirement1 = 5; -+ deviation1 = 20; -+ deviation2 = 20; -+ -+ if ( columns_per_pixel == 1 ) -+ deviation1 = deviation2 = 10; -+ -+ if ( (FT_Int)bitmap->rows <= 6 ) -+ deviation1 = 25; -+ -+ if ( (FT_Int)bitmap->rows <= 6 ) -+ deviation2 = 25; -+ -+ if ( columns_per_pixel == 1 && -+ (FT_Int)bitmap->rows <= 6 ) -+ deviation1 = deviation2 = 12; -+ -+ valid_center_average = 0; -+ -+ no_gap_found = no_gap_found_ledge = no_gap_found_redge = FALSE; -+ stem_detected = FALSE; -+ -+ if ( ppem < 11 ) -+ requirement1 = 4; -+ -+ if ( ppem > 18 ) -+ { -+ stem_match_requirement = height / 4; -+ if ( stem_match_requirement < 3 ) -+ stem_match_requirement = 3; -+ } -+ -+ smallest_width_ledge = smallest_width_redge = width * 256; -+ stem_matches = 0; -+ stem_matches_ledge = 0; -+ stem_matches_redge = 0; -+ last_matching_center = -1; -+ last_matching_ledge = -1; -+ last_matching_redge = -1; -+ -+ /* set currently looked at center to center value */ -+ this_center = center; -+ next_center = 0; -+ -+ /* For each center, compare with all other centers to see if others */ -+ /* match the properties of this one */ -+ while ( next_center < num_centers ) -+ { -+ -+ /* calculate differences */ -+ center_difference_in_width = abs ( centers[this_center].x -+ - centers[next_center].x ); -+ center_difference_in_height = abs ( centers[this_center].y -+ - centers[next_center].y ); -+ x1_difference_in_width = abs ( centers[this_center].x1 -+ - centers[next_center].x1 ); -+ x2_difference_in_width = abs ( centers[this_center].x2 -+ - centers[next_center].x2 ); -+ -+ -+ /* property - stem center points that align */ -+ /* if the center is within range, the center is less than */ -+ /* 1/2 the height away, and at least one edge is also within range */ -+ if ( center_difference_in_width -+ < center_difference_in_height * deviation1 && -+ center_difference_in_height -+ <= (FT_Int)bitmap->rows / 2 && -+ /* prevents w from getting caught ---- but also kills m */ -+ ( x1_difference_in_width -+ < center_difference_in_height * deviation2 || -+ x2_difference_in_width -+ < center_difference_in_height * deviation2 ) ) -+ { -+ stem_matches += 1; -+ valid_center_average += centers[next_center].x; -+ -+ /* try to find where the matching centers are far apart */ -+ if ( last_matching_center >= 0 && -+ abs( centers[last_matching_center].y -+ - centers[next_center].y ) >= (FT_Int)bitmap->rows / 2 ) -+ -+ /* try to find where matching centers are next to each other */ -+ if ( last_matching_center >= 0 && -+ abs( centers[last_matching_center].y -+ - centers[next_center].y ) == 1 ) -+ no_gap_found = TRUE; -+ -+ last_matching_center = next_center; -+ } -+ -+ if ( strategy_also_use_edge_detection_for_stems ) -+ { -+ /* property - stem left edge points that align */ -+ /* if the center is within range, */ -+ /* the center is less than 1/2 the height away */ -+ if ( x1_difference_in_width -+ < center_difference_in_height * deviation1 && -+ center_difference_in_height <= (FT_Int)bitmap->rows / 2 ) -+ { -+ stem_matches_ledge += 1; -+ /* may not need for edges */ -+ /*valid_center_average += centers[next_center].x; */ -+ -+ if ( centers[next_center].x2 - centers[next_center].x1 -+ < smallest_width_ledge ) -+ smallest_width_ledge = centers[next_center].x2 -+ - centers[next_center].x1; -+ -+ /* try to find where the matching centers are far apart */ -+ if ( last_matching_ledge >= 0 && -+ abs( centers[last_matching_ledge].y -+ - centers[next_center].y) -+ >= (FT_Int)bitmap->rows / 2 ) -+ -+ /* try to find where matching centers are next to each other */ -+ if ( last_matching_ledge >= 0 && -+ abs( centers[last_matching_ledge].y -+ - centers[next_center].y ) == 1 ) -+ no_gap_found_ledge = TRUE; -+ last_matching_ledge = next_center; -+ } -+ } -+ -+ if ( strategy_also_use_edge_detection_for_stems ) -+ { -+ /* property - stem right edge points that align */ -+ /* if the center is within range, the center is less than 1/2 */ -+ /* the height away */ -+ if ( x2_difference_in_width -+ < center_difference_in_height * deviation1 && -+ center_difference_in_height -+ <= (FT_Int)bitmap->rows / 2 ) -+ { -+ stem_matches_redge += 1; -+ /* may not need for edges */ -+ /*valid_center_average += centers[next_center].x; */ -+ -+ if ( centers[next_center].x2 - centers[next_center].x1 -+ < smallest_width_redge ) -+ smallest_width_redge = centers[next_center].x2 -+ - centers[next_center].x1; -+ -+ /* try to find where the matching centers are far apart */ -+ if ( last_matching_redge >= 0 && -+ abs( centers[last_matching_redge].y -+ - centers[next_center].y ) >= (FT_Int)bitmap->rows / 2 ) -+ -+ /* try to find where matching centers are next to each other */ -+ if ( last_matching_redge >= 0 && -+ abs( centers[last_matching_redge].y -+ - centers[next_center].y ) == 1 ) -+ no_gap_found_redge = TRUE; -+ -+ last_matching_redge = next_center; -+ } -+ } -+ -+ next_center++; -+ } -+ -+ if ( stem_matches > 0 ) -+ valid_center_average /= stem_matches; -+ -+ if ( ( stem_matches >= stem_match_requirement || -+ ( ( (FT_Int)bitmap->rows <= 6 || ppem < 11 ) && -+ stem_matches >= 2 && -+ abs ( valid_center_average -+ - centers[center].x) < deviation1 /2 ) || -+ /* try to catch tightly aligned stuff where the matching centers */ -+ /* are next to each other only */ -+ ( stem_matches == 2 && -+ abs( valid_center_average -+ - centers[center].x) <= deviation1 /2 && -+ no_gap_found && -+ ppem < 18 ) ) && -+ /* catches things like times 16 u but gets a lot of w's too */ -+ /* stem width is less than 1/3 of the bitmap width, */ -+ /* or bitmap_width is small */ -+ ( centers[center].x2 - centers[center].x1 -+ < (m_horiAdvance * 12) / 2 || -+ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) ) -+ { -+ stem_detected = TRUE; -+ set_width_to = centers[center].x2 - centers[center].x1; -+ set_center_to = centers[center].x; -+ } -+ -+ /* see if edges found anything */ -+ if ( strategy_also_use_edge_detection_for_stems && !stem_detected ) -+ { -+ /* Require no gap for edges */ -+ /* stem width less than 1/3 bitmap width, or bitmap_width is small */ -+ /* The stem occurs on the left side of glyph only */ -+ if ( ( stem_matches_ledge >= stem_match_requirement && -+ no_gap_found_ledge ) && -+ ( centers[center].x2 - centers[center].x1 -+ < ( m_horiAdvance * 12 ) / 2 || -+ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) && -+ centers[center].x < ( m_horiAdvance * 12 ) / 2 ) -+ { -+ stem_detected = TRUE; -+ set_width_to = smallest_width_ledge; -+ set_center_to = centers[center].x1 + set_width_to / 2; -+ stem_matches = stem_matches_ledge; -+ } -+ /* Require no gap for edges */ -+ /* stem width is less than 1/3 bitmap width, or bitmap_width is small */ -+ /* The stem occurs on the right side of glyph only */ -+ else if ( ( stem_matches_redge >= stem_match_requirement && -+ no_gap_found_redge ) && -+ ( centers[center].x2 - centers[center].x1 -+ < ( m_horiAdvance * 12 ) / 2 || -+ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) && -+ centers[center].x > (m_horiAdvance * 12) / 2 ) -+ { -+ stem_detected = TRUE; -+ set_width_to = smallest_width_redge; -+ set_center_to = centers[center].x2 - set_width_to / 2; -+ stem_matches = stem_matches_redge; -+ } -+ } -+ -+ -+ /*store and/or replace highest occurrences with 3 or more centers */ -+ /* because this matched, it will become the top dog regardless */ -+ if ( stem_detected && (stem_matches > possible_stems[0].height) ) -+ { -+ /* if this is the first stem just go ahead */ -+ if ( valid_possible_stems == 0 ) -+ { -+ valid_possible_stems = 1; -+ possible_stems[0].center = set_center_to; -+ possible_stems[0].count = stem_matches; -+ possible_stems[0].width = set_width_to; -+ possible_stems[0].height = stem_matches; -+ } -+ -+ /* otherwise, if there is already a stem */ -+ else if ( valid_possible_stems == 1 ) -+ { -+ /* if stem is within range of existing one, replace existing one */ -+ -+ /* if the stem isn't within the range of this one swap it with */ -+ /* next one first */ -+ if ( abs ( set_center_to - possible_stems[0].center ) -+ >= one_pixel * 2 ) -+ { -+ swap_stem ( &possible_stems[0], &possible_stems[1] ); -+ valid_possible_stems = 2; -+ } -+ possible_stems[0].center = set_center_to; -+ possible_stems[0].count = stem_matches; -+ possible_stems[0].width = set_width_to; -+ possible_stems[0].height = stem_matches; -+ } -+ -+ /* otherwise if there are already 2 stems */ -+ else if ( valid_possible_stems >= 2 ) -+ { -+ /* if the stem is within the range of existing one, replace */ -+ /* existing one */ -+ if ( abs ( set_center_to - possible_stems[0].center ) -+ <= one_pixel * 2 ) -+ { -+ possible_stems[0].center = set_center_to; -+ possible_stems[0].count = stem_matches; -+ possible_stems[0].width = set_width_to; -+ possible_stems[0].height = stem_matches; -+ } -+ /* if the stem isn't within the range of this one */ -+ else -+ { -+ /* see if within range of next one and swap if so and proceed */ -+ /* overwriting it */ -+ if ( abs ( set_center_to - possible_stems[1].center ) -+ <= one_pixel * 2 ) -+ swap_stem ( &possible_stems[0], &possible_stems[1] ); -+ -+ /* otherwise see if in range of third one */ -+ else if ( abs ( set_center_to - possible_stems[2].center ) -+ <= one_pixel * 2 ) -+ swap_stem ( &possible_stems[0], &possible_stems[2] ); -+ -+ /* otherwise this is the new top dog, so demote everything */ -+ else -+ { -+ swap_stem ( &possible_stems[1], &possible_stems[2] ); -+ swap_stem ( &possible_stems[0], &possible_stems[1] ); -+ valid_possible_stems += 1; -+ } -+ possible_stems[0].center = set_center_to; -+ possible_stems[0].count = stem_matches; -+ possible_stems[0].width = set_width_to; -+ possible_stems[0].height = stem_matches; -+ } -+ } -+ } -+ -+ else if ( stem_matches > possible_stems[1].height && -+ set_center_to != 0 ) -+ { -+ -+ /* make sure it doesn't match the first stem */ -+ if ( abs ( set_center_to - possible_stems[0].center ) >= one_pixel * 2 ) -+ { -+ -+ /* if this is the second stem */ -+ if ( valid_possible_stems == 1 ) -+ valid_possible_stems = 2; -+ -+ /* otherwise if there is already a stem here */ -+ else if ( valid_possible_stems >= 2 ) -+ { -+ /* if it doesn't match the second stem, proceed to swap out */ -+ /* with the third. if it does, replace it */ -+ if ( abs ( set_center_to - possible_stems[1].center ) -+ >= one_pixel * 2 ) -+ { -+ swap_stem ( &possible_stems[1], &possible_stems[2] ); -+ valid_possible_stems +=1; -+ } -+ } -+ possible_stems[1].center = set_center_to; -+ possible_stems[1].count = stem_matches; -+ possible_stems[1].width = set_width_to; -+ possible_stems[1].height = stem_matches; -+ } -+ } -+ -+ else if ( stem_matches > possible_stems[2].height && -+ set_center_to != 0 ) -+ { -+ /* if it doesn't match the first or second one */ -+ if ( abs( set_center_to - possible_stems[0].center) >= one_pixel * 2 && -+ abs( set_center_to - possible_stems[1].center) >= one_pixel * 2 ) -+ { -+ if ( valid_possible_stems == 2 ) -+ valid_possible_stems += 1; -+ -+ possible_stems[2].center = set_center_to; -+ possible_stems[2].count = stem_matches; -+ possible_stems[2].width = set_width_to; -+ possible_stems[1].height = stem_matches; -+ } -+ } -+ -+ if ( valid_possible_stems > 3 ) -+ valid_possible_stems = 3; -+ -+ center++; -+ } -+ -+ /* promote to stem */ -+ if ( valid_possible_stems > 0 ) -+ { -+ stems[0].center = possible_stems[0].center; -+ stems[0].count = possible_stems[0].count; -+ stems[0].width = possible_stems[0].width; -+ stems[0].height = possible_stems[0].height; -+ stems[0].generated = FALSE; -+ valid_stems++; -+ } -+ -+ if ( valid_stems == 1 && -+ valid_possible_stems > 1 ) -+ { -+ stems[1].center = possible_stems[1].center; -+ stems[1].count = possible_stems[1].count; -+ stems[1].width = possible_stems[1].width; -+ stems[1].height = possible_stems[1].height; -+ stems[1].generated = FALSE; -+ valid_stems++; -+ } -+ -+ if ( valid_stems == 2 && -+ valid_possible_stems > 2 && -+ possible_stems[2].center != 0 ) -+ { -+ stems[2].center = possible_stems[2].center; -+ stems[2].count = possible_stems[2].count; -+ stems[2].width = possible_stems[2].width; -+ stems[2].height = possible_stems[2].height; -+ stems[2].generated = FALSE; -+ valid_stems++; -+ } -+ -+ /* sort stems in x direction */ -+ if ( valid_stems == 3 ) -+ { -+ if ( stems[0].center > stems[1].center ) -+ swap_stem ( &stems[0], &stems[1] ); -+ -+ if ( stems[0].center > stems[2].center ) -+ swap_stem ( &stems[1], &stems[2] ); -+ -+ if ( stems[1].center > stems[2].center ) -+ swap_stem ( &stems[1], &stems[2] ); -+ -+ if ( stems[0].center > stems[1].center ) -+ swap_stem ( &stems[0], &stems[1] ); -+ -+ /* only look at first and last stem for now */ -+ swap_stem ( &stems[1], &stems[2] ); -+ } -+ -+ /* synthesize stems - Works, but needs work */ -+ if ( ( strategy_synthesize_stems || -+ known_stem_values->synth_stems ) && -+ valid_stems == 0 && -+ ppem > 10 ) -+ { -+ /* if the leftmost segment's leftmost point is the same as the glyph's */ -+ /* leftmost point, and it is of reasonable width, and is not on the */ -+ /* top or bottom of the bitmap */ -+ if ( leftmost_segment_not_extrema->x1 -+ == leftmost_point_not_extrema && -+ abs ( leftmost_segment_not_extrema->x2 -+ - leftmost_segment_not_extrema->x1 ) -+ < ( rightmost_point_not_extrema -+ - leftmost_point_not_extrema ) / 3 && -+ leftmost_segment_not_extrema->y < height && -+ leftmost_segment_not_extrema->y > 1 ) -+ { -+ stems[valid_stems].center = ( leftmost_segment_not_extrema->x2 -+ + leftmost_segment_not_extrema->x1 ) / 2; -+ stems[valid_stems].width = leftmost_segment_not_extrema->x2 -+ - leftmost_segment_not_extrema->x1; -+ stems[valid_stems].generated = TRUE; -+ valid_stems += 1; -+ } -+ -+ -+ if ( rightmost_segment_not_extrema->x2 -+ == rightmost_point_not_extrema && -+ abs ( rightmost_segment_not_extrema->x2 -+ - rightmost_segment_not_extrema->x1 ) -+ < ( rightmost_point_not_extrema -+ - leftmost_point_not_extrema ) / 3 && -+ rightmost_segment_not_extrema->y < height && -+ rightmost_segment_not_extrema->y > 1 ) -+ { -+ stems[valid_stems].center = ( rightmost_segment_not_extrema->x2 -+ + rightmost_segment_not_extrema->x1 ) / 2; -+ stems[valid_stems].width = rightmost_segment_not_extrema->x2 -+ - rightmost_segment_not_extrema->x1; -+ stems[valid_stems].generated = TRUE; -+ valid_stems += 1; -+ } -+ -+ } -+ -+ /* sort stems in x direction */ -+ if ( valid_stems > 1 && stems[0].center > stems[1].center ) -+ swap_stem ( &stems[0], &stems[1] ); -+ -+ if ( valid_stems == 0 && known_stem_values->stem_translating != 0 ) -+ { -+ *translate_value += known_stem_values->stem_translating; -+ -+ if ( strategy_use_strengths ) -+ { -+ /* consider 1/2 pixel the max when strength is at 100%, -+ unless translate is already greater than that */ -+ FT_Int strength_cutoff = 32; -+ -+ -+ if ( abs ( *translate_value ) > strength_cutoff) -+ strength_cutoff = *translate_value; -+ -+ max_strength = ( strength_cutoff * alignment_strength ) / 100; -+ -+ if ( *translate_value < -max_strength ) -+ *translate_value = -max_strength; -+ else if ( *translate_value > max_strength ) -+ *translate_value = max_strength; -+ } -+ } -+ else -+ /* Start snapping */ -+ { -+ FT_Int center_offset; -+ FT_Int modulus; -+ FT_Int delta, delta2; -+ FT_Long stem_distance = 1, new_distance = 1; -+ FT_Int distance_floor, distance_ceiling; -+ FT_Int translate_value2 = 0; -+ FT_Int main_stem = 0; -+ FT_Int lbearing = m_horiBearingX * 12; -+ FT_Int bitmap_stem_location = stems[0].center; -+ FT_Int advance_stem_location = bitmap_stem_location -+ + lbearing - one_pixel; -+ FT_Int advance_width = m_horiAdvance * 12; -+ FT_Int original_advance_width = 12 * ( slot->linearHoriAdvance >> 10 ); -+ FT_Int glyph_width = rightmost_point - leftmost_point; -+ FT_Int stem_width = stems[0].width; -+ FT_Int advance_leftmost_location = leftmost_point -+ + lbearing - one_pixel; -+ FT_Int advance_rightmost_location = rightmost_point -+ + lbearing - one_pixel; -+ -+#define proposed_transformed_point(point) \ -+ point * (float)(new_distance) / (float)(stem_distance) \ -+ + *translate_value * 12 - ( stems[main_stem].center * (float)(new_distance) \ -+ / (float)(stem_distance) - stems[main_stem].center) -+ -+#define proposed_translated_point(point) point + *translate_value * 12 -+ -+ center_offset = one_pixel / 2; /* half pixel */ -+ modulus = one_pixel; /* whole pixel */ -+ -+ /* Determine center_offset via known values */ -+ if ( known_stem_values->stem_width >= 0 ) -+ { -+ if ( known_stem_values->stem_width % 2 == 0 ) -+ center_offset = 0; -+ else -+ center_offset = one_pixel / 2; -+ } -+ /* otherwise do intelligent guessing, if set */ -+ else if ( strategy_auto_change_center_offset && -+ ppem >= STEM_WIDTH_2_PPEM && -+ stems[0].width < one_pixel * 1.45 ) -+ center_offset = one_pixel / 2; -+ else if ( strategy_auto_change_center_offset && -+ ppem >= STEM_WIDTH_2_PPEM && -+ stems[0].width >= one_pixel * 1.45 && -+ stems[0].width < one_pixel * 2.6 ) -+ center_offset = 0; -+ else if ( strategy_auto_change_center_offset && -+ ppem >= STEM_WIDTH_2_PPEM && -+ stems[0].width >= one_pixel * 2.6 && -+ stems[0].width < one_pixel * 3.6 ) -+ center_offset = one_pixel / 2; -+ else if ( strategy_auto_change_center_offset && -+ ppem >= STEM_WIDTH_2_PPEM ) -+ center_offset = -+ ( one_pixel -+ * ( ( ( (int)( stems[0].width + one_pixel / 2 ) ) -+ / one_pixel ) % 2 ) ) / 2; -+ -+ /* Snap to closest translate and scale values by default */ -+ if ( valid_stems >= 1 ) -+ { -+ /* closest snapping point for stem 0 */ -+ delta = ( stems[0].center + center_offset ) % modulus; -+ -+ if ( delta < modulus / 2 ) -+ /* snap left */ -+ *translate_value = -delta / ( columns_per_pixel * 4 ); -+ else -+ /* snap right */ -+ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 ); -+ } -+ -+ if ( strategy_use_d_correction ) -+ { -+ /* if the only stem is in the last 1/3 of glyph width, the advance */ -+ /* is 6 pixels, the ppem 11, and doing so doesn't violate bitmap , */ -+ /* boundaries force it to snap right */ -+ if ( valid_stems == 1 && -+ advance_stem_location > (advance_width * 2) / 3 && -+ advance_width == 6 * one_pixel && -+ rightmost_point + modulus - delta -+ <= ( width - (columns_per_pixel * 2) / 3) * 256 && -+ ppem == 11 ) -+ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 ); -+ } -+ -+ if ( strategy_use_strengths ) -+ { -+ /* consider 1/2 pixel the max when strength is at 100%, -+ unless translate is already greater than that */ -+ FT_Int strength_cutoff = 32; -+ if ( abs ( *translate_value ) > strength_cutoff ) -+ strength_cutoff = *translate_value; -+ -+ max_strength = ( strength_cutoff * alignment_strength ) / 100; -+ -+ if ( *translate_value < -max_strength ) -+ *translate_value = -max_strength; -+ else if ( *translate_value > max_strength ) -+ *translate_value = max_strength; -+ } -+ -+ /* If 2 stems is detected, scale distance -+ between in order to land on pixels */ -+ if ( valid_stems >= 2 ) -+ { -+ stem_distance = abs ( stems[1].center - stems[0].center ); -+ -+ delta = stem_distance % modulus; -+ new_distance = stem_distance - delta; -+ -+ distance_floor = stem_distance - delta; -+ distance_ceiling = stem_distance + ( modulus - delta ); -+ -+ if ( delta < modulus / 2 ) -+ new_distance = distance_floor; -+ else -+ new_distance = distance_ceiling; -+ -+ if ( columns_per_pixel == 3 && -+ valid_stems == 3 && -+ strategy_use_m_control && -+ ( width - 2 * columns_per_pixel ) > 6 * columns_per_pixel && -+ ppem > 8 && -+ ( advance_stem_location - advance_leftmost_location ) -+ < stems[main_stem].width * 2 ) -+ { -+ /* Possibly use 2 only when compatible widths is on? */ -+ FT_Int mod_factor = 2; -+ -+ if ( verbose ) -+ printf ( "USING M CONTROL "); -+ -+ distance_floor = stem_distance -+ - stem_distance % ( modulus * mod_factor ) ; -+ distance_ceiling = distance_floor + modulus * mod_factor; -+ -+ new_distance = distance_ceiling; -+ -+ /* force certain ideal situations */ -+ /* these 2 are mostly safe to do */ -+ if ( distance_ceiling -+ + one_pixel * columns_per_pixel == advance_width && -+ stem_width < one_pixel * 1.25 ) -+ new_distance = distance_ceiling; -+ /* NEED TO FIGURE OUT A WAY TO DETERMINE WHETHER -+ THAT NUDGE IS UP OR DOWN */ -+ else if ( stem_distance + one_pixel * 2.6 >= advance_width && -+ stem_width < one_pixel * 1.25 ) -+ new_distance = distance_ceiling; -+ -+ if ( proposed_transformed_point ( leftmost_point ) -+ < one_third_pixel * 2 || -+ proposed_transformed_point ( rightmost_point ) -+ > ( width -2 ) * one_third_pixel ) -+ new_distance = distance_floor; -+ -+ /* NEED TO IGNORE SERIF Ms HERE */ -+ /* perhaps check bitmap boundaries instead??? */ -+ if ( strategy_bearing_correction && new_distance == distance_ceiling ) -+ { -+ /* Correct if bearings are made substantially worse -+ (more than 1/3 a pixel beyond advance) */ -+ if ( proposed_transformed_point( advance_rightmost_location ) -+ > advance_width + one_third_pixel && -+ proposed_transformed_point( advance_rightmost_location ) -+ > advance_rightmost_location && -+ -proposed_transformed_point( advance_leftmost_location ) -+ < advance_rightmost_location - advance_width ) -+ new_distance = distance_floor; -+ } -+ -+ if ( known_stem_values->m >= 0 ) -+ { -+ if ( known_stem_values->m == 0 ) -+ new_distance = distance_floor; -+ else -+ new_distance = distance_ceiling; -+ } -+ -+ if ( ( rightmost_point - leftmost_point) - -+ ( ( rightmost_point * *scale_value) -+ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 ) -+ { -+ *scale_value = 1.0; -+ *translate_value = 0; -+ goto Exit; -+ } -+ -+ } -+ else if ( columns_per_pixel == 1 && -+ valid_stems == 3 && -+ strategy_use_m_control && valid_stems == 3 && -+ width >= 6 * columns_per_pixel && -+ ppem > 8 && -+ ( advance_stem_location - advance_leftmost_location ) -+ < stems[main_stem].width * 2 ) -+ { -+ /* Possibly use 2 only when compatible widths is on? */ -+ FT_Int mod_factor = 2; -+ -+ if ( verbose ) -+ printf ("USING M CONTROL "); -+ distance_floor = stem_distance - stem_distance -+ % ( modulus * mod_factor) ; -+ distance_ceiling = distance_floor + modulus * mod_factor; -+ -+ new_distance = distance_ceiling; -+ -+ /* force certain ideal situations */ -+ /* these 2 are mostly safe to do */ -+ if ( distance_ceiling -+ + one_pixel * columns_per_pixel == advance_width && -+ stem_width < one_pixel * 1.25 ) -+ new_distance = distance_ceiling; -+ /* NEED TO FIGURE OUT A WAY TO DETERMINE WHETHER -+ THAT NUDGE IS UP OR DOWN */ -+ else if ( stem_distance + one_pixel * 2.6 >= advance_width && -+ stem_width < one_pixel * 1.25 ) -+ new_distance = distance_ceiling; -+ -+ if ( proposed_transformed_point( leftmost_point ) < 0 || -+ proposed_transformed_point( rightmost_point ) -+ > width * one_pixel - 2 * one_third_pixel ) -+ new_distance = distance_floor; -+ -+ /* NEED TO IGNORE SERIF Ms HERE */ -+ /* perhaps check bitmap boundaries instead??? */ -+ if ( strategy_bearing_correction && new_distance == distance_ceiling ) -+ { -+ /* Correct if bearings are made substantially worse -+ (more than 1/3 a pixel beyond advance) */ -+ if ( proposed_transformed_point( advance_rightmost_location ) -+ > advance_width + one_third_pixel && -+ proposed_transformed_point( advance_rightmost_location ) -+ > advance_rightmost_location && -+ -proposed_transformed_point( advance_leftmost_location ) -+ < advance_rightmost_location - advance_width ) -+ new_distance = distance_floor; -+ } -+ -+ if ( known_stem_values->m >= 0 ) -+ { -+ if ( known_stem_values->m == 0 ) -+ new_distance = distance_floor; -+ else -+ new_distance = distance_ceiling; -+ } -+ -+ -+ if ( ( rightmost_point - leftmost_point ) -+ - ( ( rightmost_point * *scale_value ) -+ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 ) -+ { -+ *scale_value = 1.0; -+ *translate_value = 0; -+ goto Exit; -+ } -+ -+ } -+ else -+ { -+ if ( strategy_fit_to_width ) -+ new_distance = advance_width - 3 * one_pixel; -+ else if ( known_stem_values->stem_scaling >= 0 ) -+ { -+ if ( known_stem_values->stem_scaling > 0 ) -+ new_distance = distance_ceiling; -+ else -+ new_distance = distance_floor; -+ -+ /* enforce advance width boundaries */ -+ /* TOO RESTRICTIVE ON SERIF FONTS */ -+ if ( proposed_transformed_point( advance_rightmost_location ) -+ >= advance_width || -+ proposed_transformed_point( advance_leftmost_location ) -+ <= 0 ) -+ new_distance = distance_floor; -+ -+ /* enforce literal bitmap boundaries if no translate room */ -+ if ( ( proposed_transformed_point(rightmost_point) >= width * 256 -+ || proposed_transformed_point(leftmost_point ) <= one_pixel ) -+ && new_distance + one_pixel * 3 > advance_width ) -+ new_distance = distance_floor; -+ -+ } -+ else if ( strategy_translate_using_closest_stem ) -+ { -+ /* closest snapping point for stem 1 */ -+ delta2 = ( stems[1].center + center_offset ) % modulus; -+ -+ if ( delta2 < modulus / 2 ) -+ /* snap left */ -+ translate_value2 = -delta2 / ( columns_per_pixel * 4 ); -+ else -+ /* snap right */ -+ translate_value2 = ( modulus - delta2 ) -+ / ( columns_per_pixel * 4 ); -+ -+ if ( abs ( translate_value2 ) < abs ( *translate_value ) ) -+ { -+ *translate_value = translate_value2; -+ main_stem = 1; -+ } -+ -+ } -+ else if ( strategy_scale_to_closest_centers ) -+ { -+ /* closest snapping point for stem 0 */ -+ delta = ( stems[0].center + center_offset ) % modulus; -+ delta2 = ( stems[1].center + center_offset ) % modulus; -+ -+ if ( delta < modulus / 2 ) -+ /* stretch left */ -+ new_distance = delta + stem_distance; -+ else -+ /* stretch right */ -+ new_distance = delta - modulus + stem_distance; -+ -+ if ( delta2 < modulus / 2 ) -+ new_distance -= delta2; /* stretch left */ -+ else -+ new_distance += modulus - delta2; /* stretch right */ -+ -+ } -+ else if ( strategy_scale_to_closest_centers_up_only ) -+ { -+ FT_Int net_change = 0; -+ -+ /* closest snapping point for stem 0 */ -+ delta = ( stems[0].center + center_offset ) % modulus; -+ delta2 = ( stems[1].center + center_offset ) % modulus; -+ -+ if ( delta < modulus / 2 ) -+ net_change = delta; /* stretch left */ -+ else -+ net_change = -( modulus - delta ); /* stretch right */ -+ -+ if ( delta2 < modulus / 2 ) -+ net_change -= delta2; /* stretch left */ -+ else -+ net_change += modulus - delta2; /* stretch right */ -+ -+ if ( net_change > 0 && -+ proposed_transformed_point( advance_rightmost_location ) -+ < advance_width && -+ proposed_transformed_point( advance_leftmost_location ) > 0 ) -+ new_distance = distance_ceiling; -+ } -+ -+ else if ( strategy_always_use_distance_ceiling ) -+ { -+ if ( proposed_transformed_point( advance_rightmost_location ) -+ < advance_width && -+ proposed_transformed_point( advance_leftmost_location ) > 0 ) -+ new_distance = distance_ceiling; -+ } -+ } -+ -+ if ( strategy_use_strengths ) -+ { -+ FT_Int strength_cutoff = center_offset; -+ -+ -+ delta2 = new_distance - stem_distance; -+ -+ if ( abs ( delta2 ) > strength_cutoff ) -+ strength_cutoff = delta2; -+ -+ max_strength = ( strength_cutoff * fitting_strength ) / 100; -+ -+ if ( delta2 < -max_strength ) -+ new_distance = stem_distance - max_strength; -+ else if ( delta2 > max_strength ) -+ new_distance = stem_distance + max_strength; -+ } -+ -+ *scale_value = (float)( new_distance ) / (float)( stem_distance ); -+ *translate_value = *translate_value -+ - ( (float)( stems[main_stem].center * (float)new_distance ) -+ / (float)stem_distance - stems[main_stem].center ) / 12; -+ -+ if ( valid_stems == 2 ) -+ *embolden_value = ( 64.0 / *scale_value - 64.0 ); -+ -+ if ( valid_stems == 3 ) -+ *embolden_value = ( 64.0 / *scale_value - 64.0 ) / 1.5; -+ } -+ -+ if ( verbose ) -+ printf ( "%lu stems:", valid_stems ); -+ -+ if ( valid_stems == 1 && verbose ) -+ printf ( "1 stem: bitmapwidth:%d glyphwidth:%f glyph_width:%f center:%f bearing:%f advance:%f lhadvance:%f stemwidth:%f %d %d", -+ (width - 6) / columns_per_pixel, -+ (float)m_width / 64.0, -+ (float)glyph_width / (float)one_pixel, -+ (float)( (float)advance_stem_location ) / (float)one_pixel, -+ (float)m_horiBearingX / 64.0, -+ (float)m_horiAdvance / 64.0, -+ (float)linearHoriAdvance / 64.0, -+ (float)stems[0].width / (float)one_pixel, -+ advance_width, original_advance_width ); -+ else if ( valid_stems >= 2 && verbose ) -+ printf ( "%lu stems: bitmapwidth:%d center1:%f center2:%f difference:%f bearing:%f advance:%f advstemloc:%f ", -+ valid_stems, -+ (width - 6) / columns_per_pixel, -+ ( (float)advance_stem_location ) / (float)one_pixel, -+ ( (float)advance_stem_location -+ + (float)abs ( stems[1].center -+ - stems[0].center) ) / (float)one_pixel, -+ ( (float)abs ( stems[1].center -+ - stems[0].center ) ) / (float)one_pixel, -+ (float)m_horiBearingX / 64.0, -+ (float)m_horiAdvance / 64.0, -+ (float)advance_stem_location / (float)one_pixel ); -+ -+ if ( strategy_bearing_correction ) -+ { -+ /* Correct if negative bearings are made substantially worse */ -+ /* (more than 1/3 a pixel) */ -+ if ( proposed_transformed_point( advance_rightmost_location ) -+ > advance_width && -+ proposed_transformed_point( advance_rightmost_location ) -+ > advance_rightmost_location && -+ -proposed_transformed_point( advance_leftmost_location ) -+ < advance_rightmost_location - advance_width && -+ *translate_value -+ > one_third_pixel / ( columns_per_pixel * 4 ) ) -+ { -+ *translate_value -=64 ; -+ if ( verbose ) -+ printf ( "TRANSLATING -64 " ); -+ } -+ } -+ goto Exit; -+ } -+ -+ Exit: -+ -+#define transformed_point( point ) point * *scale_value + *translate_value * 12 -+ -+ if ( strategy_correct_out_of_bounds_outlines ) -+ { -+ /* Correct if outside bitmap */ -+ if ( transformed_point( rightmost_point ) -+ >= width * 256 - 2 * one_third_pixel && -+ transformed_point( leftmost_point ) -+ > one_pixel + 2 * one_third_pixel ) -+ *translate_value -=64 ; -+ else if ( transformed_point( leftmost_point ) -+ <= one_pixel / 2 && -+ transformed_point( rightmost_point ) -+ <= width * 256 - ( one_pixel + one_pixel / 2 ) ) -+ *translate_value += 64; -+ } -+ -+ STVALUES -+ free ( centers ); -+ free ( segments ); -+ free ( stem_centers ); -+ free ( stems ); -+ free ( leftmost_segment ); -+ } -+ -+ -+ /* Gamma correction */ -+ static void -+ _ft_lcd_gamma_correction_correction ( FT_Bitmap* bitmap, -+ FT_Render_Mode mode, -+ FT_GlyphSlot slot, -+ float gamma_correction_lt, -+ float gamma_correction_value ) -+ { -+ if ( gamma_correction_value != 1.0 ) -+ { -+ FT_UInt width = (FT_UInt)bitmap->width; -+ FT_UInt height = (FT_UInt)bitmap->rows; -+ FT_Byte* line = bitmap->buffer; -+ float ppem = (float)slot->face->size->metrics.x_ppem; -+ -+ -+ if ( !slot->face || !slot->face->size ) return; -+ -+ if ( ppem >= 5 ) -+ for ( height = (FT_UInt)bitmap->rows; -+ height > 0; -+ height--, line += bitmap->pitch ) -+ { -+ FT_UInt xx; -+ -+ -+ for ( xx = 0; xx < width; xx += 1 ) -+ { -+ /*normal*/ -+ /*line[xx] = pseudo_gamma ( line[xx], gamma_correction_value );*/ -+ -+ /* sloped */ -+ /*line[xx] = pseudo_gamma ( line[xx], gamma_correction_value - 5 -+ * (1-gamma_correction_value)/(gamma_correction_lt -5) -+ + ((1-gamma_correction_value)/(gamma_correction_lt -5)) * ppem );*/ -+ -+ /* 1/3-sloped */ -+ line[xx] = pseudo_gamma ( line[xx], gamma_correction_value - 5 -+ * ( ( 1 - gamma_correction_value ) -+ / ( 3 * ( gamma_correction_lt -5 ) ) ) -+ + ( ( 1 - gamma_correction_value ) -+ / ( 3 * ( gamma_correction_lt -5) ) ) * ppem ); -+ } -+ } -+ } -+ } -+ -+#endif - - /* convert a slot's glyph image into a bitmap */ - static FT_Error -@@ -103,24 +2328,162 @@ - FT_Render_Mode required_mode ) - { - FT_Error error; -- FT_Outline* outline = &slot->outline; -- FT_Bitmap* bitmap = &slot->bitmap; -- FT_Memory memory = render->root.memory; -+ FT_Outline* outline = NULL; -+ FT_Outline* outline_orig = NULL; - FT_BBox cbox; -- FT_Pos x_shift = 0; -- FT_Pos y_shift = 0; -- FT_Pos x_left, y_top; -- FT_Pos width, height, pitch; -+ FT_Pos width, height, pitch, ppem; - #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - FT_Pos height_org, width_org; - #endif -+ FT_Bitmap* bitmap = &slot->bitmap; -+ FT_Memory memory = render->root.memory; - FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); - FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); -+ FT_Pos x_shift = 0; -+ FT_Pos y_shift = 0; -+ FT_Pos x_left, y_top; - - FT_Raster_Params params; - -- FT_Bool have_outline_shifted = FALSE; -- FT_Bool have_buffer = FALSE; -+ FT_Bool have_translated_origin = FALSE; -+ FT_Bool have_outline_shifted = FALSE; -+ FT_Bool have_buffer = FALSE; -+ -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ FT_Matrix scaleMat; -+ FT_Long translate_value = 0; -+ float scale_value = 1.0; -+ FT_Int align_called = 0; -+ -+ -+ int chromeos_style_sharpening_strength = 0; -+ int alignment_strength = 0; -+ int fitting_strength = 0; -+ int fringe_filter_strength = 0; -+ int grayscale_filter_strength = 0; -+ -+ int autohint_horizontal_stem_darken_strength = 0; -+ int autohint_vertical_stem_darken_strength = 0; -+ -+ int windows_style_sharpening_strength = 0; -+ float gamma_correction_value = 1; -+ float gamma_correction_lt = 0; -+ -+ FT_Int brightness_value = 0.0; -+ FT_Int contrast_value = 0.0; -+ -+ FT_Int snapping_sliding_scale_value = 0; -+ -+ FT_Int global_embolden_x_value = 0; -+ FT_Int global_embolden_y_value = 0; -+ -+ FT_Int bold_embolden_x_value = 0; -+ FT_Int bold_embolden_y_value = 0; -+ -+ FT_Byte chromeos_cutoff; -+ double chromeos_gamma_value; -+ -+ float embolden_value = 0.0; -+ FT_Bool autohinted = FALSE; -+ FT_Bool use_various_tweaks = FALSE; -+ FT_Pos cur_width = infinality_cur_width; -+ -+ const FT_Int MIN_PPEM = 1; -+ /*const FT_Int MAX_PPEM = 100; */ -+ -+ FT_Bool use_known_settings_on_selected_fonts; -+ -+ if ( slot->face && -+ slot->face->size && -+ slot->face->size->metrics.x_ppem ) -+ ppem = slot->face->size->metrics.x_ppem; -+ else -+ ppem = 0; -+ -+ if ( cur_width ) -+ { -+ autohinted = TRUE; -+ } -+ if( ftinf ){ -+ const float *f=ftinf->gamma_correction; -+ -+ use_known_settings_on_selected_fonts=ftinf->use_known_settings_on_selected_fonts; -+ use_various_tweaks=ftinf->use_various_tweaks; -+ snapping_sliding_scale_value=ftinf->stem_snapping_sliding_scale; -+ -+ alignment_strength=ftinf->stem_alignment_strength; -+ if ( snapping_sliding_scale_value != 0 ) -+ alignment_strength = sliding_scale(10, snapping_sliding_scale_value, alignment_strength, 100, ppem); -+ -+ fitting_strength=ftinf->stem_fitting_strength; -+ if ( snapping_sliding_scale_value != 0 ) -+ fitting_strength = sliding_scale(10, snapping_sliding_scale_value, fitting_strength, 100, ppem); -+ -+ chromeos_style_sharpening_strength=ftinf->chromeos_style_sharpening_strength; -+ -+ if ( ppem > 10 ) -+ chromeos_style_sharpening_strength = -+ ( chromeos_style_sharpening_strength * ppem ) / 10; -+ -+ if ( chromeos_style_sharpening_strength > 100 ) -+ chromeos_style_sharpening_strength = 100; -+ -+ brightness_value=ftinf->brightness; -+ contrast_value=ftinf->contrast; -+ -+ windows_style_sharpening_strength=ftinf->windows_style_sharpening_strength; -+ -+ /* Decrease effect slightly to have a more linear increase in sharpness */ -+ windows_style_sharpening_strength = -+ ( ( windows_style_sharpening_strength -+ * windows_style_sharpening_strength ) / 100 -+ + windows_style_sharpening_strength ) / 2; -+ -+ gamma_correction_lt = f[0]; -+ gamma_correction_value = f[1] / 100.0f; -+ -+ fringe_filter_strength=ftinf->fringe_filter_strength; -+ grayscale_filter_strength=ftinf->grayscale_filter_strength; -+ -+ autohint_horizontal_stem_darken_strength=ftinf->autohint_horizontal_stem_darken_strength; -+ autohint_vertical_stem_darken_strength=ftinf->autohint_vertical_stem_darken_strength; -+ -+ global_embolden_x_value=ftinf->global_embolden_x_value; -+ global_embolden_y_value=ftinf->global_embolden_y_value; -+ -+ bold_embolden_x_value=ftinf->bold_embolden_x_value; -+ bold_embolden_y_value=ftinf->bold_embolden_y_value; -+ } else { -+ use_known_settings_on_selected_fonts=FALSE; -+ } -+ -+ /* set gamma value to 1 if out of range */ -+ if ( slot->face && -+ slot->face->size && -+ slot->face->size->metrics.x_ppem ) -+ { -+ if ( slot->face->size->metrics.x_ppem >= gamma_correction_lt ) -+ gamma_correction_value = 1; -+ } -+ else -+ gamma_correction_value = 1; -+ -+ if( use_various_tweaks && -+ slot->face && -+ slot->face->style_name ) -+ { -+ /* needs to also check for artifical italics */ -+ if ( strcasestr(slot->face->style_name, "Italic" ) || -+ strcasestr(slot->face->style_name, "Oblique" ) ) -+ { -+ windows_style_sharpening_strength = 0; -+ chromeos_style_sharpening_strength = 0; -+ } -+ } -+ -+ /*if (fitting_strength == 100) scale_value = 1.1;*/ -+ -+#endif - - - /* check glyph image format */ -@@ -137,26 +2500,119 @@ - goto Exit; - } - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+RERENDER: -+ if ( align_called == 1 ) -+ { -+ scaleMat.xx = FT_FixedFromFloat(scale_value); -+ scaleMat.xy = 0; -+ scaleMat.yx = 0; -+ scaleMat.yy = ( 1 << 16 ); -+ -+ FT_Outline_Copy(outline_orig, outline); -+ -+ if ( scale_value != 1.0 ) -+ FT_Outline_Transform( outline, &scaleMat ); -+ -+ FT_Outline_Translate( outline, translate_value, 0 ); -+ -+ FT_Outline_EmboldenXY( outline, embolden_value, 0 ); -+ } -+ else -+ { -+#endif -+ outline = &slot->outline; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ /* Need to get this PRIOR to embolden, otherwise bad things happen */ -+ FT_Outline_Get_CBox( outline, &cbox ); -+ -+ /* Various hacks that need to be turned into a new rule set */ -+ /*if ( !autohinted -+ && use_known_settings_on_selected_fonts -+ && mode == FT_RENDER_MODE_LCD -+ && slot->face->family_name -+ && slot->face->style_name -+ && ( strcasestr(slot->face->family_name, "Courier New" ) -+ && ( strcasestr(slot->face->style_name, "Regular" ) -+ || strcasestr(slot->face->style_name, "Italic" ) ) ) ) -+ FT_Outline_Embolden( outline, 24 );*/ -+ -+ if ( slot->face ) -+ { -+ if ( !autohinted && -+ use_known_settings_on_selected_fonts && -+ mode == FT_RENDER_MODE_LCD && -+ slot->face->family_name && -+ slot->face->style_name && -+ strcasestr( slot->face->family_name, "Times New Roman" ) && -+ strcasestr( slot->face->style_name, "Italic" ) ) -+ FT_Outline_EmboldenXY( outline, 12, 0 ); -+ -+ if ( use_known_settings_on_selected_fonts && -+ autohinted && -+ mode == FT_RENDER_MODE_LCD && -+ slot->face->family_name && -+ slot->face->style_name && -+ strcasestr(slot->face->family_name, "FreeSerif" ) && -+ strcasestr(slot->face->style_name, "Italic" ) ) -+ FT_Outline_EmboldenXY( outline, 8, 0 ); -+ -+ if ( global_embolden_x_value != 0 || global_embolden_y_value != 0 ) -+ FT_Outline_EmboldenXY( outline, -+ global_embolden_x_value, -+ global_embolden_y_value ); -+ -+ if ( ( bold_embolden_x_value != 0 || bold_embolden_y_value != 0 ) && -+ ( slot->face->style_name && -+ ( strcasestr(slot->face->style_name, "Bold" ) || -+ strcasestr(slot->face->style_name, "Black" ) || -+ ( slot->face->style_flags && -+ slot->face->style_flags & FT_STYLE_FLAG_BOLD ) ) ) ) -+ FT_Outline_EmboldenXY( outline, -+ bold_embolden_x_value, -+ bold_embolden_y_value ); -+ } -+ -+ FT_Outline_Copy( outline, outline_orig ); -+ } -+ -+ /* translate the outline to the new origin if needed */ -+ if ( align_called == 0 ) -+ { -+ FT_Pos enlarge_cbox = 0; -+ -+ /* enlarge for grayscale rendering */ -+ if ( mode == FT_RENDER_MODE_NORMAL ) -+ enlarge_cbox = 64; -+ -+ if ( origin ) -+ { -+ FT_Outline_Translate( outline, origin->x, origin->y ); -+ have_translated_origin = TRUE; -+ } -+ -+ /* compute the control box, and grid fit it */ -+ /*FT_Outline_Get_CBox( outline, &cbox );*/ -+ -+ cbox.xMin = FT_PIX_FLOOR( cbox.xMin - enlarge_cbox ); -+ cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); -+ cbox.xMax = FT_PIX_CEIL( cbox.xMax + enlarge_cbox ); -+ cbox.yMax = FT_PIX_CEIL( cbox.yMax ); -+#else - if ( origin ) - { -- x_shift = origin->x; -- y_shift = origin->y; -+ FT_Outline_Translate( outline, origin->x, origin->y ); -+ have_translated_origin = TRUE; - } - - /* compute the control box, and grid fit it */ -- /* taking into account the origin shift */ - FT_Outline_Get_CBox( outline, &cbox ); - -- cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); -- cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); -- cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); -- cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift ); -- -- x_shift -= cbox.xMin; -- y_shift -= cbox.yMin; -- -- x_left = cbox.xMin >> 6; -- y_top = cbox.yMax >> 6; -+ cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); -+ cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); -+ cbox.xMax = FT_PIX_CEIL( cbox.xMax ); -+ cbox.yMax = FT_PIX_CEIL( cbox.yMax ); -+#endif - - width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; - height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; -@@ -166,16 +2622,29 @@ - height_org = height; - #endif - -+ /* release old bitmap buffer */ -+ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) -+ { -+ FT_FREE( bitmap->buffer ); -+ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; -+ } -+ -+ /* allocate new one */ - pitch = width; - if ( hmul ) - { -- width *= 3; -- pitch = FT_PAD_CEIL( width, 4 ); -+ width = width * 3; -+ pitch = FT_PAD_CEIL( width, 4 ); - } - - if ( vmul ) - height *= 3; - -+ x_shift = cbox.xMin; -+ y_shift = cbox.yMin; -+ x_left = cbox.xMin >> 6; -+ y_top = cbox.yMax >> 6; -+ - #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - if ( slot->library->lcd_filter_func ) -@@ -185,33 +2654,25 @@ - - if ( hmul ) - { -- x_shift += 64 * ( extra >> 1 ); -- x_left -= extra >> 1; -+ x_shift -= 64 * ( extra >> 1 ); - width += 3 * extra; - pitch = FT_PAD_CEIL( width, 4 ); -+ x_left -= extra >> 1; - } - - if ( vmul ) - { -- y_shift += 64 * ( extra >> 1 ); -- y_top += extra >> 1; -+ y_shift -= 64 * ( extra >> 1 ); - height += 3 * extra; -+ y_top += extra >> 1; - } - } -- - #endif -- -- /* -- * XXX: on 16bit system, we return an error for huge bitmap -- * to prevent an overflow. -- */ -- if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX || -- x_left < FT_INT_MIN || y_top < FT_INT_MIN ) -- { -- error = FT_THROW( Invalid_Pixel_Size ); -- goto Exit; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET - } - -+#endif -+ - /* Required check is (pitch * height < FT_ULONG_MAX), */ - /* but we care realistic cases only. Always pitch <= width. */ - if ( width > 0x7FFF || height > 0x7FFF ) -@@ -222,6 +2683,22 @@ - goto Exit; - } - -+ bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; -+ bitmap->num_grays = 256; -+ bitmap->width = (unsigned int)width; -+ bitmap->rows = (unsigned int)height; -+ bitmap->pitch = pitch; -+ -+ /* translate outline to render it into the bitmap */ -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( align_called == 0 ) -+ { -+#endif -+ FT_Outline_Translate( outline, -x_shift, -y_shift ); -+ have_outline_shifted = TRUE; -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ } -+#endif - /* release old bitmap buffer */ - if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) - { -@@ -229,7 +2706,6 @@ - slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; - } - -- /* allocate new one */ - if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) ) - goto Exit; - else -@@ -237,23 +2713,6 @@ - - slot->internal->flags |= FT_GLYPH_OWN_BITMAP; - -- slot->format = FT_GLYPH_FORMAT_BITMAP; -- slot->bitmap_left = (FT_Int)x_left; -- slot->bitmap_top = (FT_Int)y_top; -- -- bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; -- bitmap->num_grays = 256; -- bitmap->width = (unsigned int)width; -- bitmap->rows = (unsigned int)height; -- bitmap->pitch = pitch; -- -- /* translate outline to render it into the bitmap */ -- if ( x_shift || y_shift ) -- { -- FT_Outline_Translate( outline, x_shift, y_shift ); -- have_outline_shifted = TRUE; -- } -- - /* set up parameters */ - params.target = bitmap; - params.source = outline; -@@ -299,9 +2758,153 @@ - if ( error ) - goto Exit; - -+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET -+ if ( ppem <= MAX_PPEM && ppem >= MIN_PPEM ) -+ { -+ if ( align_called == 0 && cur_width / ppem < 10 && -+ ( alignment_strength > 0 || fitting_strength > 0 ) ) -+ _lcd_stem_align ( bitmap, -+ mode, -+ slot, -+ &translate_value, -+ &scale_value, -+ alignment_strength, -+ fitting_strength, -+ &embolden_value ); -+ -+ if ( align_called == 0 && -+ ( translate_value != 0 || scale_value != 1.0 ) ) -+ { -+ align_called = 1; -+ goto RERENDER; -+ } -+ -+ if ( mode == FT_RENDER_MODE_LCD ) -+ { -+ -+ if ( fringe_filter_strength > 0 /*&& autohinted*/ ) -+ _ft_lcd_fringe_filter( bitmap, -+ mode, -+ fringe_filter_strength, -+ slot->library ); -+ -+ /*if ( autohinted) -+ _ft_lcd_stem_end_filter( bitmap, mode, 100, slot->library );*/ -+ -+ if ( gamma_correction_lt > 0 && gamma_correction_value != 1.0 ) -+ _ft_lcd_gamma_correction_correction( bitmap, -+ mode, -+ slot, -+ gamma_correction_lt, -+ gamma_correction_value ); -+ -+ chromeos_cutoff = (FT_Byte)( 0.5 * 255.0 ) -+ * ( chromeos_style_sharpening_strength / 100.0 ); -+ chromeos_gamma_value = 1; -+ -+ if ( chromeos_style_sharpening_strength > 0 ) -+ _ft_lcd_chromeos_sharpen( bitmap, -+ mode, -+ chromeos_cutoff, -+ chromeos_gamma_value ); -+ -+ if ( ppem > 8 ) -+ if ( windows_style_sharpening_strength > 0 ) -+ _ft_lcd_windows_sharpen( bitmap, -+ mode, -+ windows_style_sharpening_strength, -+ slot->library ); -+ -+ if ( autohinted && -+ ( cur_width * 100 ) / 64 -+ > autohint_horizontal_stem_darken_strength && -+ autohint_horizontal_stem_darken_strength != 0 ) -+ autohint_horizontal_stem_darken_strength = ( cur_width * 100 ) / 64; -+ -+ if ( autohint_horizontal_stem_darken_strength > 100) -+ autohint_horizontal_stem_darken_strength = 100; -+ -+ /* only do on autohinted fonts */ -+ /* Necessary to do on some non-thin fonts, which is why it is outside */ -+ /* of the below conditional */ -+ if ( autohint_horizontal_stem_darken_strength > 0 && autohinted ) -+ _ft_lcd_darken_x ( bitmap, -+ mode, -+ autohint_horizontal_stem_darken_strength, -+ slot->library ); -+ -+ /* Enhance thin fonts */ -+ if ( autohinted ) -+ { -+ /* if forcibly set use that, otherwise make a good estimate */ -+ float contrast, brightness; -+ ftinf_get_bc( slot->face->family_name, ppem, &brightness, &contrast); -+ if ( slot->face && !_ft_bitmap_bc ( bitmap, brightness, contrast ) ) -+ { -+ FT_Bool is_fixed_name = FALSE; -+ -+ if ( slot->face->family_name && -+ strcasestr(slot->face->family_name, "Mono" ) ) -+ is_fixed_name = TRUE; -+ -+ /* Darken vertical stems */ -+ _ft_lcd_darken_y ( bitmap, -+ mode, -+ autohint_vertical_stem_darken_strength, -+ slot->library ); -+ -+ /* Adjust brightness / contrast automatically based on stem width */ -+ if ( cur_width != 0 && cur_width < 30 ) -+ cur_width = 30; -+ -+ if ( cur_width >= 30 && cur_width <= 60 ) -+ { -+ float ppem_factor = sliding_scale ( 5, 11, 0.0, 1.0, ppem ); -+ float brightness_factor = sliding_scale ( 30, 52, -.3, 0.0, -+ cur_width ); -+ float contrast_factor = sliding_scale ( 30, 52, .45, 0.0, -+ cur_width ); -+ _ft_bitmap_bc ( bitmap, -+ ppem_factor * brightness_factor, -+ ppem_factor * contrast_factor ); -+ -+ /* Only cap variable width thin-stemmed fonts */ -+ if ( !FT_IS_FIXED_WIDTH( slot->face ) && !is_fixed_name ) -+ _ft_bitmap_cap ( bitmap, -+ ( cur_width * 150 ) / 64, -+ slot->library ); -+ } -+ } -+ } -+ -+ -+ if ( slot->library->lcd_filter_func ) -+ slot->library->lcd_filter_func( bitmap, mode, slot->library ); -+ -+ if ( grayscale_filter_strength > 0 ) -+ _ft_lcd_grayscale_filter( bitmap, -+ mode, -+ grayscale_filter_strength, -+ slot->library ); -+ -+ } -+ -+ /* Global values */ -+ if ( brightness_value != 0 || contrast_value != 0 ) -+ _ft_bitmap_bc ( bitmap, -+ (float)brightness_value / 300.0, -+ (float)contrast_value / 300.0); -+ -+ FT_Outline_Done( slot->library, outline_orig ); -+ } -+ else if ( mode == FT_RENDER_MODE_LCD && -+ slot->library->lcd_filter_func ) -+ slot->library->lcd_filter_func( bitmap, mode, slot->library ); -+#else - if ( slot->library->lcd_filter_func ) - slot->library->lcd_filter_func( bitmap, mode, slot->library ); - -+#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ - #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - /* render outline into bitmap */ -@@ -359,6 +2962,20 @@ - - #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - -+ /* -+ * XXX: on 16bit system, we return an error for huge bitmap -+ * to prevent an overflow. -+ */ -+ if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX ) -+ { -+ error = FT_THROW( Invalid_Pixel_Size ); -+ goto Exit; -+ } -+ -+ slot->format = FT_GLYPH_FORMAT_BITMAP; -+ slot->bitmap_left = (FT_Int)x_left; -+ slot->bitmap_top = (FT_Int)y_top; -+ - /* everything is fine; don't deallocate buffer */ - have_buffer = FALSE; - -@@ -366,7 +2983,9 @@ - - Exit: - if ( have_outline_shifted ) -- FT_Outline_Translate( outline, -x_shift, -y_shift ); -+ FT_Outline_Translate( outline, x_shift, y_shift ); -+ if ( have_translated_origin ) -+ FT_Outline_Translate( outline, -origin->x, -origin->y ); - if ( have_buffer ) - { - FT_FREE( bitmap->buffer ); -diff -ruN freetype-2.7.1-orig/src/truetype/ttinterp.c freetype-2.7.1/src/truetype/ttinterp.c ---- freetype-2.7.1-orig/src/truetype/ttinterp.c 2017-01-11 12:28:16.728016867 +0100 -+++ freetype-2.7.1/src/truetype/ttinterp.c 2017-01-11 12:28:34.895016390 +0100 -@@ -5739,6 +5739,7 @@ - - if ( exc->ignore_x_mode && - exc->GS.freeVector.x != 0 && -+ exc->GS.freeVector.y == 0 && - !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) - control_value_cutin = 0; - } diff -Nru freetype-2.7.1/debian/patches-freetype/0002-infinality-2.8-2017.05.24.patch freetype-2.8/debian/patches-freetype/0002-infinality-2.8-2017.05.24.patch --- freetype-2.7.1/debian/patches-freetype/0002-infinality-2.8-2017.05.24.patch 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/debian/patches-freetype/0002-infinality-2.8-2017.05.24.patch 2017-10-09 07:24:27.000000000 +0000 @@ -0,0 +1,5881 @@ +From 48c2930e9b83c47457ca03f5f8e6f1b61540a8e6 Mon Sep 17 00:00:00 2001 +From: "Devin J. Pohly" +Date: Wed, 24 May 2017 15:08:52 -0500 +Subject: [PATCH] infinality 2.8 2017.05.24 + +--- + builds/freetype.mk | 1 + + configure | 2 + + devel/ftoption.h | 10 + + include/freetype/config/ftoption.h | 17 +- + src/autofit/aflatin.c | 170 ++- + src/autofit/aflatin.h | 3 + + src/autofit/afmodule.c | 7 + + src/base/Jamfile | 1 + + src/base/ftbase.c | 3 + + src/base/ftinf.c | 363 +++++ + src/base/ftinf.h | 66 + + src/base/ftinf_rh.c | 626 ++++++++ + src/base/ftinf_rh.gperf | 283 ++++ + src/base/ftinf_sh.c | 463 ++++++ + src/base/ftinf_sh.gperf | 264 ++++ + src/base/ftinit.c | 14 +- + src/base/ftlcdfil.c | 35 +- + src/base/ftobjs.c | 67 +- + src/base/ftoutln.c | 10 +- + src/base/ftsynth.c | 22 +- + src/base/rules.mk | 1 + + src/cff/cffobjs.c | 6 + + src/smooth/ftsmooth.c | 2808 ++++++++++++++++++++++++++++++++++-- + src/truetype/ttinterp.c | 1 + + 24 files changed, 5122 insertions(+), 121 deletions(-) + create mode 100644 src/base/ftinf.c + create mode 100644 src/base/ftinf.h + create mode 100644 src/base/ftinf_rh.c + create mode 100644 src/base/ftinf_rh.gperf + create mode 100644 src/base/ftinf_sh.c + create mode 100644 src/base/ftinf_sh.gperf + +diff --git a/builds/freetype.mk b/builds/freetype.mk +index f8cfd41..7e7ac5b 100644 +--- a/builds/freetype.mk ++++ b/builds/freetype.mk +@@ -161,6 +161,7 @@ FT_CFLAGS = $(CPPFLAGS) \ + $(CFLAGS) \ + $DFT2_BUILD_LIBRARY \ + $DFT_CONFIG_MODULES_H="" \ ++ $D_GNU_SOURCE \ + $(FTOPTION_FLAG) + + +diff --git a/configure b/configure +index 68dbd99..165703c 100755 +--- a/configure ++++ b/configure +@@ -13,6 +13,8 @@ + # Call the `configure' script located in `builds/unix'. + # + ++export LDFLAGS="$LDFLAGS -lm" ++ + rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk + + # respect GNUMAKE environment variable for backward compatibility +diff --git a/devel/ftoption.h b/devel/ftoption.h +index db661e7..911f411 100644 +--- a/devel/ftoption.h ++++ b/devel/ftoption.h +@@ -626,6 +626,16 @@ FT_BEGIN_HEADER + /* */ + #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + ++ /*************************************************************************/ ++ /* */ ++ /* Define FT_CONFIG_OPTION_INFINALITY_PATCHSET if you want to enable */ ++ /* all additional infinality patches, which are configured via env */ ++ /* variables. */ ++ /* */ ++ /* This option requires TT_CONFIG_OPTION_SUBPIXEL_HINTING to */ ++ /* defined. */ ++ /* */ ++#define FT_CONFIG_OPTION_INFINALITY_PATCHSET + + /*************************************************************************/ + /* */ +diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h +index 1bf6e8f..c565b36 100644 +--- a/include/freetype/config/ftoption.h ++++ b/include/freetype/config/ftoption.h +@@ -122,7 +122,7 @@ FT_BEGIN_HEADER + /* This is done to allow FreeType clients to run unmodified, forcing */ + /* them to display normal gray-level anti-aliased glyphs. */ + /* */ +-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ ++#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + + /*************************************************************************/ +@@ -626,6 +626,17 @@ FT_BEGIN_HEADER + /* */ + #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER + ++ /*************************************************************************/ ++ /* */ ++ /* Define FT_CONFIG_OPTION_INFINALITY_PATCHSET if you want to enable */ ++ /* all additional infinality patches, which are configured via env */ ++ /* variables. */ ++ /* */ ++ /* This option requires TT_CONFIG_OPTION_SUBPIXEL_HINTING to */ ++ /* defined. */ ++ /* */ ++#define FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ + + /*************************************************************************/ + /* */ +@@ -684,8 +695,8 @@ FT_BEGIN_HEADER + /* [1] http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* */ + /* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ +-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 +-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */ ++/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ ++#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) + + + /*************************************************************************/ +diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c +index 11fa523..9036fc4 100644 +--- a/src/autofit/aflatin.c ++++ b/src/autofit/aflatin.c +@@ -24,7 +24,10 @@ + #include "afpic.h" + #include "aflatin.h" + #include "aferrors.h" +- ++#include "strings.h" ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "../base/ftinf.h" ++#endif + + #ifdef AF_CONFIG_OPTION_USE_WARPER + #include "afwarp.h" +@@ -40,6 +43,10 @@ + #undef FT_COMPONENT + #define FT_COMPONENT trace_aflatin + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++FT_Pos infinality_cur_width = 0; ++#endif ++ + + /* needed for computation of round vs. flat segments */ + #define FLAT_THRESHOLD( x ) ( x / 14 ) +@@ -1121,7 +1128,10 @@ + FT_Pos delta; + AF_LatinAxis axis; + FT_UInt nn; +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Bool adjust_heights = FALSE; ++ if(ftinf) adjust_heights=ftinf->autohint_increase_glyph_heights; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + if ( dim == AF_DIMENSION_HORZ ) + { +@@ -1149,7 +1159,7 @@ + { + AF_LatinAxis Axis = &metrics->axis[AF_DIMENSION_VERT]; + AF_LatinBlue blue = NULL; +- ++ int threshold = 40; + + for ( nn = 0; nn < Axis->blue_count; nn++ ) + { +@@ -1159,7 +1169,12 @@ + break; + } + } +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( adjust_heights && ++ metrics->root.scaler.face->size->metrics.x_ppem < 15 && ++ metrics->root.scaler.face->size->metrics.x_ppem > 5 ) ++ threshold = 52; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( blue ) + { + FT_Pos scaled; +@@ -1315,7 +1330,13 @@ + + /* a blue zone is only active if it is less than 3/4 pixels tall */ + dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); ++ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Do at low ppems ( ~< 200 ), in order to prevent fringes */ ++ if ( dist <= 256 && dist >= -256 ) ++#else + if ( dist <= 48 && dist >= -48 ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + { + #if 0 + FT_Pos delta1; +@@ -1366,7 +1387,12 @@ + delta2 = -delta2; + + blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Round to prevent fringes */ ++ blue->shoot.fit = FT_PIX_ROUND( blue->ref.fit - delta2 ); ++#else + blue->shoot.fit = blue->ref.fit - delta2; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + #endif + +@@ -2504,7 +2530,10 @@ + dist = edge->fpos - blue->shoot.org; + if ( dist < 0 ) + dist = -dist; +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* round down to pixels */ ++ /*dist = FT_MulFix( dist, scale ) & ~63;*/ ++#endif + dist = FT_MulFix( dist, scale ); + if ( dist < best_dist ) + { +@@ -2680,8 +2709,17 @@ + FT_Pos dist = width; + FT_Int sign = 0; + FT_Int vertical = ( dim == AF_DIMENSION_VERT ); +- +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Int infinality_dist = 0; ++ FT_UInt autohint_snap_stem_height = 0; ++ if( ftinf ) autohint_snap_stem_height=ftinf->autohint_snap_stem_height; ++ if ( autohint_snap_stem_height > 100 ) ++ autohint_snap_stem_height = 100; ++ else if ( autohint_snap_stem_height < 0 ) ++ autohint_snap_stem_height = 0; ++ ++ if ( autohint_snap_stem_height == 0 ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || + axis->extra_light ) + return width; +@@ -2691,9 +2729,76 @@ + dist = -width; + sign = 1; + } ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Calculate snap value differently than standard freetype */ ++ if ( autohint_snap_stem_height > 0 && ++ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ++ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ) ++ { ++ infinality_dist = af_latin_snap_width( axis->widths, ++ axis->width_count, dist ); ++ ++ if ( metrics->root.scaler.face->size->metrics.x_ppem > 9 && ++ axis->width_count > 0 && ++ abs( axis->widths[0].cur - infinality_dist ) < 32 && ++ axis->widths[0].cur > 52 ) ++ { ++ const char *style_name=metrics->root.scaler.face->style_name; ++ if ( style_name!=NULL && ++ ( strstr( style_name, "Regular" ) || ++ strstr( style_name, "Book" ) || ++ strstr( style_name, "Medium" ) || ++ strcmp( style_name, "Italic" ) == 0 || ++ strcmp( style_name, "Oblique" ) == 0 ) ++ ) ++ { ++ /* regular weight */ ++ if ( axis->widths[0].cur < 64 ) ++ infinality_dist = 64; ++ else if ( axis->widths[0].cur < 88 ) ++ infinality_dist = 64; ++ else if ( axis->widths[0].cur < 160 ) ++ infinality_dist = 128; ++ else if ( axis->widths[0].cur < 240 ) ++ infinality_dist = 190; ++ else infinality_dist = ( infinality_dist ) & ~63; ++ } ++ else ++ { ++ /* bold gets a different threshold */ ++ if ( axis->widths[0].cur < 64 ) ++ infinality_dist = 64 ; ++ else if ( axis->widths[0].cur < 108 ) ++ infinality_dist = 64; ++ else if ( axis->widths[0].cur < 160 ) ++ infinality_dist = 128; ++ else if ( axis->widths[0].cur < 222 ) ++ infinality_dist = 190; ++ else if ( axis->widths[0].cur < 288 ) ++ infinality_dist = 254; ++ else infinality_dist = ( infinality_dist + 16 ) & ~63; ++ } + +- if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ++ } ++ if ( infinality_dist < 52 ) ++ { ++ if ( metrics->root.scaler.face->size->metrics.x_ppem < 9 ) ++ { ++ if ( infinality_dist < 32 ) ++ infinality_dist = 32; ++ } ++ else ++ infinality_dist = 64; ++ } ++ } ++ else if ( autohint_snap_stem_height < 100 && ++ ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ++ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ) ++#else ++ ++ if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || + ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + { + /* smooth hinting process: very lightly quantize the stem width */ + +@@ -2785,6 +2890,9 @@ + } + } + else ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( autohint_snap_stem_height < 100 ) ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + { + /* strong hinting process: snap the stem width to integer pixels */ + +@@ -2792,7 +2900,10 @@ + + + dist = af_latin_snap_width( axis->widths, axis->width_count, dist ); +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( autohint_snap_stem_height > 0 ) ++ goto Done_Width; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( vertical ) + { + /* in the case of vertical hinting, always round */ +@@ -2855,6 +2966,32 @@ + } + + Done_Width: ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( axis->widths[0].cur > 42 ) ++ /* weighted average */ ++ dist = (dist * ( 100 - autohint_snap_stem_height ) ++ + infinality_dist * autohint_snap_stem_height ) / 100; ++ ++ { ++ int factor = 100; ++ if ( axis->standard_width < 100 ) ++ factor = axis->standard_width; ++ ++ if ( metrics->root.scaler.face->size->metrics.x_ppem >= 9 && dist < 52 ) ++ dist += ( (52 - dist) * factor ) / 100; ++ if ( metrics->root.scaler.face->size->metrics.x_ppem < 9 && dist < 32 ) ++ dist += ( (32 - dist) * factor ) / 100; ++ ++ if ( axis->standard_width > 100 && ++ metrics->root.scaler.face->size->metrics.x_ppem >= 11 && ++ dist < 64 ) ++ dist = 64; ++ if ( axis->standard_width > 100 && ++ metrics->root.scaler.face->size->metrics.x_ppem >= 9 && ++ dist < 52 ) ++ dist = 52; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + if ( sign ) + dist = -dist; + +@@ -2873,6 +3010,8 @@ + FT_Pos dist, base_delta; + FT_Pos fitted_width; + ++/* if fitted_width causes stem_edge->pos to land basically on top of an existing ++ * stem_edge->pos, then add or remove 64. Need to figure out a way to do this */ + + dist = stem_edge->opos - base_edge->opos; + base_delta = base_edge->pos - base_edge->opos; +@@ -3485,8 +3624,11 @@ + int dim; + + AF_LatinAxis axis; +- +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Int emboldening_strength = 0; ++ FT_Bool use_various_tweaks = FALSE; ++ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + error = af_glyph_hints_reload( hints, outline ); + if ( error ) + goto Exit; +@@ -3556,7 +3698,11 @@ + } + + af_glyph_hints_save( hints, outline ); +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ { ++ infinality_cur_width = metrics->axis->widths[0].cur; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + Exit: + return error; + } +diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h +index d80e125..3ca779b 100644 +--- a/src/autofit/aflatin.h ++++ b/src/autofit/aflatin.h +@@ -64,6 +64,9 @@ FT_BEGIN_HEADER + + #define AF_LATIN_MAX_WIDTHS 16 + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ extern FT_Pos infinality_cur_width; ++#endif + + #define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */ + #define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */ +diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c +index 9d7ba22..abe2367 100644 +--- a/src/autofit/afmodule.c ++++ b/src/autofit/afmodule.c +@@ -22,6 +22,10 @@ + #include "aferrors.h" + #include "afpic.h" + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "../base/ftinf.h" ++#endif ++ + #ifdef FT_DEBUG_AUTOFIT + + #ifndef FT_MAKE_OPTION_SINGLE_OBJECT +@@ -477,6 +481,9 @@ + module->warping = 0; + #endif + module->no_stem_darkening = TRUE; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if(ftinf) module->no_stem_darkening = !ftinf->stem_darkening_autofit; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + module->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + module->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; +diff --git a/src/base/Jamfile b/src/base/Jamfile +index 9e9a91b..5217651 100644 +--- a/src/base/Jamfile ++++ b/src/base/Jamfile +@@ -56,6 +56,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ; + ftglyph + ftgxval + ftinit ++ ftinf + ftlcdfil + ftmm + ftotval +diff --git a/src/base/ftbase.c b/src/base/ftbase.c +index 55f7359..4d50dca 100644 +--- a/src/base/ftbase.c ++++ b/src/base/ftbase.c +@@ -34,6 +34,9 @@ + #include "ftstream.c" + #include "fttrigon.c" + #include "ftutil.c" ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "ftinf.c" ++#endif + + + /* END */ +diff --git a/src/base/ftinf.c b/src/base/ftinf.c +new file mode 100644 +index 0000000..5d6b7f6 +--- /dev/null ++++ b/src/base/ftinf.c +@@ -0,0 +1,363 @@ ++#include ++#include "ftinf.h" ++#define true 1 ++#define false 0 ++ ++#define on 1 ++#define off 0 ++#define end (-128) ++ ++#define sw2pv 18 /* STEM_WIDTH_2_PPEM */ ++#define maxp 100 /* MAX_PPEM */ ++ ++typedef signed char pv; /* ppm and values type */ ++/* the arrays start with existence flag + values */ ++typedef struct sa_rules_s { ++ const char *name; ++ pv always_use_100[1+4+1]; ++ pv brightness[1+2+1]; ++ pv contrast[1+2+1]; ++ pv edge_detection[1+4+1]; ++ pv m[1+4+1]; ++ pv bearing_correction[1+2+1]; ++ pv spacing[1+5+1]; ++ pv start[1+5+1]; ++ pv stem_scaling[1+6+1]; ++ pv stem_translating[1+2+1]; ++ pv stem_translating_only[1+10+1]; ++ pv stem_widths[1+4]; /* these end with maxp */ ++ pv synthesize_stems[1+2+1]; ++} sa_rules_t; ++ ++#pragma GCC diagnostic ignored "-Wpedantic" /* C99 struct initializer tags are needed */ ++#pragma GCC diagnostic ignored "-Wunused-function" ++ ++const ftinf_t *ftinf; ++/* final settings, updated from environment */ ++ftinf_t _env; ++ ++/* rules and hashing function */ ++#include "ftinf_rh.c" ++ ++/* rules selection */ ++void ftinf_fill_stem_values( Stem_Data *stem_values, ++ const char *family, int ppem, int use_known ){ ++ /* set the defaults */ ++ stem_values->bearing_correction = TRUE; ++ stem_values->brightness = 0.0; ++ stem_values->contrast = 0.0; ++ stem_values->edge_detection = FALSE; ++ stem_values->m = -1; ++ stem_values->stem_scaling = -1; ++ stem_values->stem_spacing = -1; ++ stem_values->stem_start = -1; ++ stem_values->stem_translating = 0; ++ stem_values->stem_translating_only = -1024; ++ stem_values->stem_width = -1; ++ stem_values->synth_stems = FALSE; ++ stem_values->use_100 = FALSE; ++ /* pick from known rules if requested and they exist for current family */ ++ if( !use_known ) ++ return; ++ else { ++ const sa_rules_t *r=ftinf_rules( family ); ++ int i; ++ if( r==NULL ) return; ++ if( r->stem_widths[0]==on ) ++ for( i=1; r->stem_widths[i]!=maxp; ++i ) ++ if( ppem < r->stem_widths[i] ){ ++ stem_values->stem_width = i-1; ++ break; ++ } ++ ++ if( r->stem_scaling[0]==on ) ++ for( i=1; r->stem_scaling[i]!=end; i+=2 ) ++ if( ppem==r->stem_scaling[i] ){ ++ stem_values->stem_scaling = r->stem_scaling[i+1]; ++ break; ++ } ++ ++ if( r->m[0]==on ) ++ for( i=1; r->m[i]!=end; i+=2 ) ++ if( ppem==r->m[i] ){ ++ stem_values->m = r->m[i+1]; ++ break; ++ } ++ ++ if( r->stem_translating_only[0]==on ) ++ for( i=1; r->stem_translating_only[i]!=end; i+=2 ) ++ if( ppem==r->stem_translating_only[i] || r->stem_translating_only[i]==0 ){ ++ stem_values->stem_translating_only = r->stem_translating_only[i+1]; ++ break; ++ } ++ ++ if( r->stem_translating[0]==on ) ++ for( i=1; r->stem_translating[i]!=end; i+=2 ) ++ if( ppem==r->stem_translating[i] || r->stem_translating[i]==0 ){ ++ stem_values->stem_translating = r->stem_translating[i+1]; ++ break; ++ } ++ ++ if( r->always_use_100[0]==on ) ++ for( i=1; r->always_use_100[i]!=end; i+=2 ) ++ if( ppem>=r->always_use_100[i] && ppem<=r->always_use_100[i+1] ){ ++ stem_values->use_100 = TRUE; ++ break; ++ } ++ ++ if( r->synthesize_stems[0]==on ) ++ for( i=1; r->synthesize_stems[i]!=end; i+=2 ) ++ if( ppem>=r->synthesize_stems[i] && ppem<=r->synthesize_stems[i+1] ){ ++ stem_values->synth_stems = TRUE; ++ break; ++ } ++ ++ if( r->edge_detection[0]==on ) ++ for( i=1; r->edge_detection[i]!=end; i+=2 ) ++ if( ppem>=r->edge_detection[i] && ppem<=r->edge_detection[i+1] ){ ++ stem_values->edge_detection = TRUE; ++ break; ++ } ++ ++ if( r->bearing_correction[0]==on ) ++ for( i=1; r->bearing_correction[i]!=end; i+=2 ) ++ if( ppem>=r->bearing_correction[i] && ppem<=r->bearing_correction[i+1] ){ ++ stem_values->bearing_correction = FALSE; ++ break; ++ } ++ ++#if(0) ++ if( r->brightness[0]==on ) ++ for( i=1; r->brightness[i]!=end; i+=2 ) ++ if( ppem==r->brightness[i]||r->brightness[i]==0 ){ ++ stem_values->brightness=r->brightness[i+1]*(1.0f/300.0f); ++ break; ++ } ++ ++ if( r->contrast[0]==on ) ++ for( i=1; r->contrast[i]!=end; i+=2 ) ++ if( ppem==r->contrast[i]||r->contrast[i]==0 ){ ++ stem_values->contrast=r->contrast[i+1]*(1.0f/300.0f); ++ break; ++ } ++ if( r->spacing[0]==on ){ ++ /* not used by original code */ ++ } ++ if( r->start[0]==on ){ ++ /* not used by original code */ ++ } ++#endif ++ } ++ return; ++} ++ ++void ftinf_get_bc( const char *family, int ppem, float *brightness, float *contrast ){ ++ const sa_rules_t *r=ftinf_rules( family ); ++ *brightness=0; ++ *contrast=0; ++ if( r ){ ++ int i; ++ if( r->brightness[0]==on ) ++ for( i=1; r->brightness[i]!=end; i+=2 ) ++ if( ppem==r->brightness[i]||r->brightness[i]==0 ){ ++ *brightness=r->brightness[i+1]*(1.0f/300.0f); ++ break; ++ } ++ ++ if( r->contrast[0]==on ) ++ for( i=1; r->contrast[i]!=end; i+=2 ) ++ if( ppem==r->contrast[i]||r->contrast[i]==0 ){ ++ *contrast=r->contrast[i+1]*(1.0f/300.0f); ++ break; ++ } ++ } ++ return; ++} ++ ++static int ++bool_val( const char *s ){ ++ if ( s != NULL ) ++ return strcasecmp(s, "true") == 0 ++ || strcasecmp(s, "1") == 0 ++ || strcasecmp(s, "on") == 0 ++ || strcasecmp(s, "yes") ==0; ++ else ++ return 0; ++} ++ ++static int ++int_val( const char *s, int min, int max ){ ++ int val; ++ sscanf ( s, "%d", &val ); ++ if ( val > max ) ++ val = max; ++ else if ( val < min ) ++ val = min; ++ return val; ++} ++ ++/* settings and hashing function */ ++#include "ftinf_sh.c" ++ ++/* ++ Get active Infinality settings ++ */ ++void ftinf_env(){ ++ const char *s; ++ ftinf=ftinf_settings( getenv( "INFINALITY_FT" ) ); ++ ++ if( ftinf==NULL ){ ++ ftinf=ftinf_settings( "ultimate3" ); ++ /* this should always succeed */ ++#if(0) ++ if( ftinf==NULL ){ ++ /* put an error here */ ++ exit(-1); ++ } ++#endif ++ } ++ _env=ftinf[0]; /* copy as defaults */ ++ ++ /* check if custom environment values are set and update with them */ ++ s=getenv( "INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS" ); ++ if( s ) _env.autohint_increase_glyph_heights=bool_val( s ); ++ s=getenv( "INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT" ); ++ if( s ) _env.autohint_snap_stem_height=int_val( s, 0, 100 ); ++ s=getenv( "INFINALITY_FT_USE_VARIOUS_TWEAKS" ); ++ if( s ) _env.use_various_tweaks=bool_val( s ); ++ s=getenv( "INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS" ); ++ if( s ) _env.use_known_settings_on_selected_fonts=bool_val(s); ++#if(0) /* not used (naming error also) */ ++ s=getenv( "INFINALITY_FT_AUTOHINT_MINIMUM_STEM_WIDTH" ); ++ if( s ) _env.autohint_minimum_stem_height=int_val( s, 0, 100 ); ++#endif ++ s=getenv( "INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE" ); ++ if( s ) sscanf( s, "%d", &_env.stem_snapping_sliding_scale ); ++ s=getenv( "INFINALITY_FT_STEM_ALIGNMENT_STRENGTH" ); ++ if( s ) sscanf( s, "%d", &_env.stem_alignment_strength ); ++ s=getenv( "INFINALITY_FT_STEM_DARKENING_AUTOFIT" ); ++ if( s ) _env.stem_darkening_autofit=bool_val( s ); ++ s=getenv( "INFINALITY_FT_STEM_DARKENING_CFF" ); ++ if( s ) _env.stem_darkening_cff=bool_val( s ); ++ s=getenv( "INFINALITY_FT_STEM_FITTING_STRENGTH" ); ++ if( s ) sscanf( s, "%d", &_env.stem_fitting_strength ); ++ s=getenv( "INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH" ); ++ if( s ) _env.chromeos_style_sharpening_strength=int_val( s, 0, 100 ); ++ s=getenv( "INFINALITY_FT_BRIGHTNESS" ); ++ if( s ) sscanf( s, "%d", &_env.brightness ); ++ s=getenv( "INFINALITY_FT_CONTRAST" ); ++ if( s ) sscanf( s, "%d", &_env.contrast ); ++ s=getenv( "INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH" ); ++ if( s ) _env.windows_style_sharpening_strength=int_val( s, 0, 100 ); ++ s=getenv( "INFINALITY_FT_GAMMA_CORRECTION" ); ++ if( s ){ ++ float *f=_env.gamma_correction; ++ sscanf ( s, "%f %f", &f[0], &f[1] ); ++ if( f[1] < 1.0f ) f[1]=1.0f; ++ } ++ s=getenv( "INFINALITY_FT_FRINGE_FILTER_STRENGTH" ); ++ if( s ) sscanf( s, "%d", &_env.fringe_filter_strength ); ++ s=getenv( "INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH" ); ++ if( s ) sscanf( s, "%d", &_env.grayscale_filter_strength ); ++ s=getenv( "INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH" ); ++ if( s ) sscanf( s, "%d", &_env.autohint_horizontal_stem_darken_strength ); ++ s=getenv( "INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH" ); ++ if( s ) sscanf( s, "%d", &_env.autohint_vertical_stem_darken_strength ); ++ s=getenv( "INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE" ); ++ if( s ) sscanf( s, "%d", &_env.global_embolden_x_value ); ++ s=getenv( "INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE" ); ++ if( s ) sscanf( s, "%d", &_env.global_embolden_y_value ); ++ s=getenv( "INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE" ); ++ if( s ) sscanf( s, "%d", &_env.bold_embolden_x_value ); ++ s=getenv( "INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE" ); ++ if( s ) sscanf( s, "%d", &_env.bold_embolden_y_value ); ++ s=getenv( "INFINALITY_FT_FILTER_PARAMS" ); ++ if( s ) { ++ int *f=_env.filter_params; ++ if( sscanf( s, "%d %d %d %d %d", f+1, f+2, f+3, f+4, f+5 )==5 ) ++ f[0]=on; ++ else ++ f[0]=off; /* FIXME: put a warning? */ ++ } ++ /* do the range verifications as in original code */ ++ if ( _env.stem_snapping_sliding_scale > maxp ) ++ _env.stem_snapping_sliding_scale = 0; ++ else if ( _env.stem_snapping_sliding_scale < 0 ) ++ _env.stem_snapping_sliding_scale = 0; ++ if (_env.stem_snapping_sliding_scale < 11 && ++ _env.stem_snapping_sliding_scale > 0 ) ++ _env.stem_snapping_sliding_scale = 11; ++ ++ if ( _env.stem_alignment_strength > 100 ) ++ _env.stem_alignment_strength = 100; ++ else if ( _env.stem_alignment_strength < 0 ) ++ _env.stem_alignment_strength = 0; ++ ++ if ( _env.stem_fitting_strength > 100 ) ++ _env.stem_fitting_strength = 100; ++ else if ( _env.stem_fitting_strength < 0 ) ++ _env.stem_fitting_strength = 0; ++ ++ if ( _env.chromeos_style_sharpening_strength > 100 ) ++ _env.chromeos_style_sharpening_strength = 100; ++ else if ( _env.chromeos_style_sharpening_strength < 0 ) ++ _env.chromeos_style_sharpening_strength = 0; ++ ++ if ( _env.brightness > 100 ) ++ _env.brightness = 100; ++ else if ( _env.brightness < -100 ) ++ _env.brightness = 0; ++ ++ if ( _env.contrast > 100 ) ++ _env.contrast = 100; ++ else if ( _env.contrast < -100 ) ++ _env.contrast = 0; ++ ++ if ( _env.windows_style_sharpening_strength > 100 ) ++ _env.windows_style_sharpening_strength = 100; ++ else if ( _env.windows_style_sharpening_strength < 0 ) ++ _env.windows_style_sharpening_strength = 0; ++ ++ if ( _env.fringe_filter_strength > 100 ) ++ _env.fringe_filter_strength = 100; ++ else if ( _env.fringe_filter_strength < 0 ) ++ _env.fringe_filter_strength = 0; ++ ++ if ( _env.grayscale_filter_strength > 100 ) ++ _env.grayscale_filter_strength = 100; ++ else if ( _env.grayscale_filter_strength < 0 ) ++ _env.grayscale_filter_strength = 0; ++ ++ if ( _env.autohint_horizontal_stem_darken_strength > 100 ) ++ _env.autohint_horizontal_stem_darken_strength = 100; ++ else if ( _env.autohint_horizontal_stem_darken_strength < 0 ) ++ _env.autohint_horizontal_stem_darken_strength = 0; ++ ++ if ( _env.autohint_vertical_stem_darken_strength > 100 ) ++ _env.autohint_vertical_stem_darken_strength = 100; ++ else if ( _env.autohint_horizontal_stem_darken_strength < 0 ) ++ _env.autohint_vertical_stem_darken_strength = 0; ++ ++ if ( _env.global_embolden_x_value > 128 ) ++ _env.global_embolden_x_value = 128; ++ else if ( _env.global_embolden_x_value < -128 ) ++ _env.global_embolden_x_value = -128; ++ ++ if ( _env.global_embolden_y_value > 128 ) ++ _env.global_embolden_y_value = 128; ++ else if ( _env.global_embolden_y_value < -128 ) ++ _env.global_embolden_y_value = -128; ++ ++ if ( _env.bold_embolden_x_value > 128 ) ++ _env.bold_embolden_x_value = 128; ++ else if (_env.bold_embolden_x_value < -128 ) ++ _env.bold_embolden_x_value = -128; ++ ++ if ( _env.bold_embolden_y_value > 128 ) ++ _env.bold_embolden_y_value = 128; ++ else if ( _env.bold_embolden_y_value < -128 ) ++ _env.bold_embolden_y_value = -128; ++ ++ /* point to the combined and checked settings */ ++ ftinf=&_env; ++} +diff --git a/src/base/ftinf.h b/src/base/ftinf.h +new file mode 100644 +index 0000000..fbe1bd1 +--- /dev/null ++++ b/src/base/ftinf.h +@@ -0,0 +1,66 @@ ++#ifndef _FTINF_H_ ++#define _FTINF_H_ ++/* ++ Stem snapping rules ++ (base freetype typedefs assumed already included) ++ */ ++typedef struct ++{ ++ FT_Int stem_width; ++ FT_Int stem_spacing; ++ FT_Int stem_start; ++ FT_Int stem_scaling; ++ FT_Int stem_translating_only; ++ FT_Int stem_translating; ++ float brightness; ++ float contrast; ++ FT_Bool use_100; ++ FT_Bool synth_stems; ++ FT_Bool edge_detection; ++ FT_Bool bearing_correction; ++ FT_Int m; ++} Stem_Data; ++ ++/* ++ Infinality settings ++ */ ++typedef struct ftinf_s { ++ const char *name; ++ int autohint_horizontal_stem_darken_strength; ++ int autohint_snap_stem_height; ++ int autohint_increase_glyph_heights; ++ int autohint_vertical_stem_darken_strength; ++ int bold_embolden_x_value; ++ int bold_embolden_y_value; ++ int brightness; ++ int chromeos_style_sharpening_strength; ++ int contrast; ++ int filter_params[6]; /* 1st one used as existence flag */ ++ int fringe_filter_strength; ++ float gamma_correction[2]; ++ int global_embolden_x_value; ++ int global_embolden_y_value; ++ int grayscale_filter_strength; ++ int stem_alignment_strength; ++ int stem_darkening_autofit; ++ int stem_darkening_cff; ++ int stem_fitting_strength; ++ int stem_snapping_sliding_scale; ++ int use_known_settings_on_selected_fonts; ++ int use_various_tweaks; ++ int windows_style_sharpening_strength; ++} ftinf_t; ++ ++extern FT_Pos infinality_cur_width; /* defined in aflatin.c */ ++ ++extern const ftinf_t *ftinf; /* active settings */ ++ ++extern void ftinf_fill_stem_values( Stem_Data *stem_values, ++ const char *family, int ppem, int use_known ); ++extern void ftinf_get_bc( const char *family, int ppem, ++ float *brightness, float *contrast ); ++ ++/* get values from environment (FIXME: maybe update with using user files) */ ++extern void ftinf_env(); ++ ++#endif +diff --git a/src/base/ftinf_rh.c b/src/base/ftinf_rh.c +new file mode 100644 +index 0000000..606b567 +--- /dev/null ++++ b/src/base/ftinf_rh.c +@@ -0,0 +1,626 @@ ++/* ANSI-C code produced by gperf version 3.1 */ ++/* Command-line: gperf --output-file=ftinf_rh.c ftinf_rh.gperf */ ++/* Computed positions: -k'1,$' */ ++ ++#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ ++ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ ++ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ ++ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ ++ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ ++ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ ++ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ ++ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ ++ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ ++ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ ++ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ ++ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ ++ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ ++ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ ++ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ ++ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ ++ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ ++ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ ++ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ ++ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ ++ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ ++ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ ++ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) ++/* The character set is not based on ISO-646. */ ++#error "gperf generated tables don't work with this execution character set. Please report a bug to ." ++#endif ++ ++#line 9 "ftinf_rh.gperf" ++ ++#include ++static const struct sa_rules_s* _rules_get( const char*str, unsigned len ); ++/* maximum key range = 82, duplicates = 0 */ ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static unsigned int ++_rules_hash (register const char *str, register unsigned int len) ++{ ++ static const unsigned char asso_values[] = ++ { ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 0, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 5, 45, 5, ++ 35, 25, 35, 35, 50, 45, 85, 85, 0, 25, ++ 40, 5, 0, 85, 50, 20, 20, 0, 10, 10, ++ 85, 10, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, ++ 85, 85, 85, 85, 85, 85 ++ }; ++ return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; ++} ++ ++#ifdef __GNUC__ ++__inline ++#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif ++#endif ++const struct sa_rules_s * ++_rules_get (register const char *str, register unsigned int len) ++{ ++ enum ++ { ++ TOTAL_KEYWORDS = 58, ++ MIN_WORD_LENGTH = 3, ++ MAX_WORD_LENGTH = 24, ++ MIN_HASH_VALUE = 3, ++ MAX_HASH_VALUE = 84 ++ }; ++ ++ static const struct sa_rules_s wordlist[] = ++ { ++#line 15 "ftinf_rh.gperf" ++{ .name="---", ++ .synthesize_stems={on, 13, 13, end} ++}, ++#line 253 "ftinf_rh.gperf" ++{ .name="ubuntu", ++ .always_use_100={on, 12, 13, 15, 15, end} ++}, ++#line 31 "ftinf_rh.gperf" ++{ .name="arial", ++ .always_use_100={on, 0, maxp, end}, ++ .edge_detection={on, 11, 11, 13, 13, end}, ++ .spacing={on, 10, 11, 23, 25, 30, end}, ++ .start={on, 11, 18, 23, 30, 30, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, 16, -24, end} ++}, ++#line 87 "ftinf_rh.gperf" ++{ .name="corbel", ++ .stem_translating_only={on, 10, 16, end}, ++ .stem_widths={on, 10, 21, maxp} ++}, ++#line 71 "ftinf_rh.gperf" ++{ .name="canwell", ++ .stem_scaling={on, 13, 0, end} ++}, ++#line 216 "ftinf_rh.gperf" ++{ .name="pragmata", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 67 "ftinf_rh.gperf" ++{ .name="cantarell", ++ .stem_translating_only={on, 11, 0, 12, 0, end}, ++ .stem_widths={on, 10, 22, maxp,} ++}, ++#line 39 "ftinf_rh.gperf" ++{ .name="arimo", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end} ++}, ++#line 207 "ftinf_rh.gperf" ++{ .name="optima", ++ .brightness={on, 0, -20, end}, ++ .contrast={on, 0, 25, end}, ++ .stem_scaling={on, 17, 1, end}, ++ .stem_translating_only={on, 10, 0, 11, 0, 12, 0, end} ++}, ++#line 63 "ftinf_rh.gperf" ++{ .name="candara", ++ .stem_scaling={on, 14, 1, 17, 1, end}, ++ .stem_translating_only={on, 10, 16, end} ++}, ++#line 77 "ftinf_rh.gperf" ++{ .name="comfortaa", ++ .stem_widths={on, 10, 19, 22, maxp}, ++ .stem_scaling={on, 11, 0, end} ++}, ++#line 161 "ftinf_rh.gperf" ++{ .name="liberation mono", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 18 "ftinf_rh.gperf" ++{ .name="andale mono", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_scaling={on, 11, 1, end}, ++ .stem_widths={on, 10, 21, maxp,} ++}, ++#line 256 "ftinf_rh.gperf" ++{ .name="verdana", ++ .always_use_100={on, 0, 14, 16, maxp, end}, ++ .stem_scaling={on, 12, 1, 15, 1, end}, ++ .stem_translating_only={on, 8, 16, 15, 16, 14, 32, 18, 32, 19, 24, end} ++}, ++#line 74 "ftinf_rh.gperf" ++{ .name="century gothic", ++ .stem_widths={on, 10, 22, maxp,} ++}, ++#line 91 "ftinf_rh.gperf" ++{ .name="courier new", ++ .always_use_100={on, 12, 12, end}, ++ .edge_detection={on, 10, 12, end}, ++ .m={on, 13, 1, 14, 1, end} ++}, ++#line 23 "ftinf_rh.gperf" ++{ .name="arial narrow", ++ .stem_widths={on, 10, 21, maxp,} ++}, ++#line 185 "ftinf_rh.gperf" ++{ .name="luxi sans", ++ .always_use_100={on, 13, 13, end}, ++ .stem_widths={on, 10, 17, sw2pv, maxp,} ++}, ++#line 225 "ftinf_rh.gperf" ++{ .name="samba", ++ .stem_scaling={on, 11, 0, end} ++}, ++#line 233 "ftinf_rh.gperf" ++{ .name="tahoma", ++ .always_use_100={on, 11, 11, 14, maxp, end}, ++ .edge_detection={on, 11, 11, end}, ++ .spacing={on, 10, 12, 18, 18, 30, end}, ++ .start={on, 14, 17, 30, 100, 100, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 7, 32, 8, 32, 9, 32, end}, ++}, ++#line 164 "ftinf_rh.gperf" ++{ .name="liberation sans narrow", ++ .stem_widths={on,10, 22, maxp,} ++}, ++#line 81 "ftinf_rh.gperf" ++{ .name="consolas", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating_only={on, 8, 32, 9, 32, end}, ++ .stem_widths={on, 10, 20, maxp,}, ++ .stem_scaling={on, 11, 1, end} ++}, ++#line 203 "ftinf_rh.gperf" ++{ .name="open sans", ++ .stem_translating_only={on, 10, 16, 9, 16, end}, ++ .stem_widths={on, 10, 20, maxp,} ++}, ++#line 167 "ftinf_rh.gperf" ++{ .name="liberation sans", ++ .edge_detection={on, 11, 11, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end}, ++ .stem_widths={on,10, 19, maxp,} ++}, ++#line 193 "ftinf_rh.gperf" ++{ .name="monaco", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 101 "ftinf_rh.gperf" ++{ .name="cousine", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 176 "ftinf_rh.gperf" ++{ .name="lucida grande", ++ .stem_scaling={on, 13, 1, end}, ++ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, ++ .stem_widths={on, 10, 16, sw2pv, maxp}, ++}, ++#line 173 "ftinf_rh.gperf" ++{ .name="lucida console", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 196 "ftinf_rh.gperf" ++{ .name="myriad pro", ++ .stem_scaling={on, 14, 1, 17, 1, end}, ++ .stem_translating_only={on, 10, 16, 11, 0, 9, 16, end} ++}, ++#line 26 "ftinf_rh.gperf" ++{ .name="arial unicode ms", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} ++}, ++#line 213 "ftinf_rh.gperf" ++{ .name="palatino linotype", ++ .edge_detection={on, 0, 100, end} ++}, ++#line 181 "ftinf_rh.gperf" ++{ .name="lucida sans unicode", ++ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, ++ .stem_widths={on,10, 16, sw2pv, maxp,} ++}, ++#line 140 "ftinf_rh.gperf" ++{ .name="futura", ++ .stem_widths={on, 10, 14, sw2pv, maxp,} ++}, ++#line 147 "ftinf_rh.gperf" ++{ .name="georgia", ++ .stem_translating_only={on, 13, 16, 14, 16, 15, 0, end} ++}, ++#line 125 "ftinf_rh.gperf" ++{ .name="freemono", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 200 "ftinf_rh.gperf" ++{ .name="nina", ++ .stem_scaling={on, 11, 0, 12, 0, 13, 0, end} ++}, ++#line 121 "ftinf_rh.gperf" ++{ .name="essential pragmatapro", ++ .always_use_100={on, 0, maxp, end}, ++ .m={on, 13, 0, 14, 0, end} ++}, ++#line 247 "ftinf_rh.gperf" ++{ .name="trebuchet ms", ++ .always_use_100={on, 13, 13, end}, ++ .stem_scaling={on, 13, 0, 17, 0, 20, 1, end}, ++ .stem_translating_only={on, 10, 16, 11, 0, 8, 32, 9, 32, end}, ++ .stem_widths={on, 10, 17, sw2pv, maxp,} ++}, ++#line 114 "ftinf_rh.gperf" ++{ .name="droid sans mono", ++ .m={on, 12, 0, end} ++}, ++#line 104 "ftinf_rh.gperf" ++{ .name="dejavu sans mono", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating_only={on, 7, 16, 8, 32, 9, 16, end} ++}, ++#line 57 "ftinf_rh.gperf" ++{ .name="calibri", ++ .always_use_100={on, 23, maxp, end}, ++ .stem_scaling={on, 15, 1, 17, 1, 18, 1, end}, ++ .stem_translating_only={on, 10, 16, 15, 0, end}, ++ .stem_widths={on, 1, 10, 19, maxp,} ++}, ++#line 156 "ftinf_rh.gperf" ++{ .name="inconsolata", ++ .stem_scaling={on, 12, 1, 15, 1, end}, ++ .stem_translating_only={on, 10, 24, 9, 32, end}, ++ .stem_widths={on, 10, 23, maxp,}, ++}, ++#line 96 "ftinf_rh.gperf" ++{ .name="courier", ++ .always_use_100={on, 0, maxp, end}, ++ .m={on, 13, 1, 14, 1, end}, ++ .stem_translating_only={on, 13, 16, 15, 0, end} ++}, ++#line 128 "ftinf_rh.gperf" ++{ .name="freesans", ++ .always_use_100={on, 0, maxp, end}, ++ .edge_detection={on, 11, 11, 13, 13, end}, ++ .spacing={on, 10, 12, 18, 18, 30, end}, ++ .start={on, 10, 18, 18, 25, 30, end}, ++ .stem_scaling={on, 16, 0, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 16, 9, 8, end} ++}, ++#line 150 "ftinf_rh.gperf" ++{ .name="gill sans", ++ .stem_widths={on, 10, 17, sw2pv, maxp,} ++}, ++#line 117 "ftinf_rh.gperf" ++{ .name="droid sans", ++ .always_use_100={on, 12, 12, 15, 15, end}, ++ .stem_translating_only={on, 8, 16, 9, 16, end} ++}, ++#line 108 "ftinf_rh.gperf" ++{ .name="dejavu sans", ++ .always_use_100={on, 10, 14, 16, 17, end}, ++ .m={on, 12, 0, end}, ++ .stem_scaling={on, 12, 1, end}, ++ .stem_translating_only={on, 8, 16, 15, -20, end} ++}, ++#line 219 "ftinf_rh.gperf" ++{ .name="raleway", ++ .stem_scaling={on, 15, 0, end} ++}, ++#line 153 "ftinf_rh.gperf" ++{ .name="helvetica cy", ++ .stem_widths={on, 10, 23, maxp,} ++}, ++#line 228 "ftinf_rh.gperf" ++{ .name="segoe ui", ++ .always_use_100={on, 11, 12, 14, 14, end}, ++ .stem_translating_only={on, 10, 0, 7, 32, 8, 16, 9, 24, end}, ++ .stem_widths={on, 10, 23, maxp,} ++}, ++#line 48 "ftinf_rh.gperf" ++{ .name="bitstream vera sans mono", ++ .always_use_100={on, 0, maxp, end} ++}, ++#line 241 "ftinf_rh.gperf" ++{ .name="times new roman", ++ .always_use_100={on, 14, 14, 16, 16, end}, ++ .bearing_correction={0, 100, end}, ++ .stem_scaling={on, 17, 1, end}, ++ .stem_translating_only={on, 17, 8, end} ++}, ++#line 222 "ftinf_rh.gperf" ++{ .name="rokkitt", ++ .stem_widths={on, 10, 21, maxp,} ++}, ++#line 143 "ftinf_rh.gperf" ++{ .name="garamond", ++ .brightness={on, 0, -20, end}, ++ .contrast={on, 0, 25, end} ++}, ++#line 137 "ftinf_rh.gperf" ++{ .name="freeserif", ++ .stem_scaling={on, 13, 1, 17, 1, end} ++}, ++#line 189 "ftinf_rh.gperf" ++{ .name="microsoft sans serif", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} ++}, ++#line 44 "ftinf_rh.gperf" ++{ .name="baskerville", ++ .brightness={on, 0, -20, end}, ++ .contrast={on, 0, 25, end} ++}, ++#line 51 "ftinf_rh.gperf" ++{ .name="bitstream vera sans", ++ .always_use_100={on, 10, 14, 16, 17, end}, ++ .m={on, 12, 0, end}, ++ .stem_scaling={on ,12, 1, end}, ++ .stem_translating_only={on, 8, 16, end} ++} ++ }; ++ ++ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) ++ { ++ register int key = _rules_hash (str, len); ++ ++ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) ++ { ++ register const struct sa_rules_s *resword; ++ ++ switch (key - 3) ++ { ++ case 0: ++ resword = &wordlist[0]; ++ goto compare; ++ case 3: ++ resword = &wordlist[1]; ++ goto compare; ++ case 7: ++ resword = &wordlist[2]; ++ goto compare; ++ case 8: ++ resword = &wordlist[3]; ++ goto compare; ++ case 9: ++ resword = &wordlist[4]; ++ goto compare; ++ case 10: ++ resword = &wordlist[5]; ++ goto compare; ++ case 11: ++ resword = &wordlist[6]; ++ goto compare; ++ case 12: ++ resword = &wordlist[7]; ++ goto compare; ++ case 13: ++ resword = &wordlist[8]; ++ goto compare; ++ case 14: ++ resword = &wordlist[9]; ++ goto compare; ++ case 16: ++ resword = &wordlist[10]; ++ goto compare; ++ case 17: ++ resword = &wordlist[11]; ++ goto compare; ++ case 18: ++ resword = &wordlist[12]; ++ goto compare; ++ case 19: ++ resword = &wordlist[13]; ++ goto compare; ++ case 21: ++ resword = &wordlist[14]; ++ goto compare; ++ case 23: ++ resword = &wordlist[15]; ++ goto compare; ++ case 24: ++ resword = &wordlist[16]; ++ goto compare; ++ case 26: ++ resword = &wordlist[17]; ++ goto compare; ++ case 27: ++ resword = &wordlist[18]; ++ goto compare; ++ case 28: ++ resword = &wordlist[19]; ++ goto compare; ++ case 29: ++ resword = &wordlist[20]; ++ goto compare; ++ case 30: ++ resword = &wordlist[21]; ++ goto compare; ++ case 31: ++ resword = &wordlist[22]; ++ goto compare; ++ case 32: ++ resword = &wordlist[23]; ++ goto compare; ++ case 33: ++ resword = &wordlist[24]; ++ goto compare; ++ case 34: ++ resword = &wordlist[25]; ++ goto compare; ++ case 35: ++ resword = &wordlist[26]; ++ goto compare; ++ case 36: ++ resword = &wordlist[27]; ++ goto compare; ++ case 37: ++ resword = &wordlist[28]; ++ goto compare; ++ case 38: ++ resword = &wordlist[29]; ++ goto compare; ++ case 39: ++ resword = &wordlist[30]; ++ goto compare; ++ case 41: ++ resword = &wordlist[31]; ++ goto compare; ++ case 43: ++ resword = &wordlist[32]; ++ goto compare; ++ case 44: ++ resword = &wordlist[33]; ++ goto compare; ++ case 45: ++ resword = &wordlist[34]; ++ goto compare; ++ case 46: ++ resword = &wordlist[35]; ++ goto compare; ++ case 48: ++ resword = &wordlist[36]; ++ goto compare; ++ case 49: ++ resword = &wordlist[37]; ++ goto compare; ++ case 52: ++ resword = &wordlist[38]; ++ goto compare; ++ case 53: ++ resword = &wordlist[39]; ++ goto compare; ++ case 54: ++ resword = &wordlist[40]; ++ goto compare; ++ case 58: ++ resword = &wordlist[41]; ++ goto compare; ++ case 59: ++ resword = &wordlist[42]; ++ goto compare; ++ case 60: ++ resword = &wordlist[43]; ++ goto compare; ++ case 61: ++ resword = &wordlist[44]; ++ goto compare; ++ case 62: ++ resword = &wordlist[45]; ++ goto compare; ++ case 63: ++ resword = &wordlist[46]; ++ goto compare; ++ case 64: ++ resword = &wordlist[47]; ++ goto compare; ++ case 69: ++ resword = &wordlist[48]; ++ goto compare; ++ case 70: ++ resword = &wordlist[49]; ++ goto compare; ++ case 71: ++ resword = &wordlist[50]; ++ goto compare; ++ case 72: ++ resword = &wordlist[51]; ++ goto compare; ++ case 74: ++ resword = &wordlist[52]; ++ goto compare; ++ case 75: ++ resword = &wordlist[53]; ++ goto compare; ++ case 76: ++ resword = &wordlist[54]; ++ goto compare; ++ case 77: ++ resword = &wordlist[55]; ++ goto compare; ++ case 78: ++ resword = &wordlist[56]; ++ goto compare; ++ case 81: ++ resword = &wordlist[57]; ++ goto compare; ++ } ++ return 0; ++ compare: ++ { ++ register const char *s = resword->name; ++ ++ if (*str == *s && !strcmp (str + 1, s + 1)) ++ return resword; ++ } ++ } ++ } ++ return 0; ++} ++#line 261 "ftinf_rh.gperf" ++ ++ ++static const sa_rules_t* ++ftinf_rules( const char *name ){ ++ if( name ){ ++ enum { ++ max_wlen=31 ++ }; ++ char buf[max_wlen+1]; ++ int len=strlen( name ); ++ if( len <= max_wlen ){ ++ int i; ++ for( i=0; i ++static const struct sa_rules_s* _rules_get( const char*str, unsigned len ); ++%} ++struct sa_rules_s; ++%% ++{ .name="---", ++ .synthesize_stems={on, 13, 13, end} ++}, ++{ .name="andale mono", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_scaling={on, 11, 1, end}, ++ .stem_widths={on, 10, 21, maxp,} ++}, ++{ .name="arial narrow", ++ .stem_widths={on, 10, 21, maxp,} ++}, ++{ .name="arial unicode ms", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} ++}, ++{ .name="arial", ++ .always_use_100={on, 0, maxp, end}, ++ .edge_detection={on, 11, 11, 13, 13, end}, ++ .spacing={on, 10, 11, 23, 25, 30, end}, ++ .start={on, 11, 18, 23, 30, 30, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, 16, -24, end} ++}, ++{ .name="arimo", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end} ++}, ++{ .name="baskerville", ++ .brightness={on, 0, -20, end}, ++ .contrast={on, 0, 25, end} ++}, ++{ .name="bitstream vera sans mono", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="bitstream vera sans", ++ .always_use_100={on, 10, 14, 16, 17, end}, ++ .m={on, 12, 0, end}, ++ .stem_scaling={on ,12, 1, end}, ++ .stem_translating_only={on, 8, 16, end} ++}, ++{ .name="calibri", ++ .always_use_100={on, 23, maxp, end}, ++ .stem_scaling={on, 15, 1, 17, 1, 18, 1, end}, ++ .stem_translating_only={on, 10, 16, 15, 0, end}, ++ .stem_widths={on, 1, 10, 19, maxp,} ++}, ++{ .name="candara", ++ .stem_scaling={on, 14, 1, 17, 1, end}, ++ .stem_translating_only={on, 10, 16, end} ++}, ++{ .name="cantarell", ++ .stem_translating_only={on, 11, 0, 12, 0, end}, ++ .stem_widths={on, 10, 22, maxp,} ++}, ++{ .name="canwell", ++ .stem_scaling={on, 13, 0, end} ++}, ++{ .name="century gothic", ++ .stem_widths={on, 10, 22, maxp,} ++}, ++{ .name="comfortaa", ++ .stem_widths={on, 10, 19, 22, maxp}, ++ .stem_scaling={on, 11, 0, end} ++}, ++{ .name="consolas", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating_only={on, 8, 32, 9, 32, end}, ++ .stem_widths={on, 10, 20, maxp,}, ++ .stem_scaling={on, 11, 1, end} ++}, ++{ .name="corbel", ++ .stem_translating_only={on, 10, 16, end}, ++ .stem_widths={on, 10, 21, maxp} ++}, ++{ .name="courier new", ++ .always_use_100={on, 12, 12, end}, ++ .edge_detection={on, 10, 12, end}, ++ .m={on, 13, 1, 14, 1, end} ++}, ++{ .name="courier", ++ .always_use_100={on, 0, maxp, end}, ++ .m={on, 13, 1, 14, 1, end}, ++ .stem_translating_only={on, 13, 16, 15, 0, end} ++}, ++{ .name="cousine", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="dejavu sans mono", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating_only={on, 7, 16, 8, 32, 9, 16, end} ++}, ++{ .name="dejavu sans", ++ .always_use_100={on, 10, 14, 16, 17, end}, ++ .m={on, 12, 0, end}, ++ .stem_scaling={on, 12, 1, end}, ++ .stem_translating_only={on, 8, 16, 15, -20, end} ++}, ++{ .name="droid sans mono", ++ .m={on, 12, 0, end} ++}, ++{ .name="droid sans", ++ .always_use_100={on, 12, 12, 15, 15, end}, ++ .stem_translating_only={on, 8, 16, 9, 16, end} ++}, ++{ .name="essential pragmatapro", ++ .always_use_100={on, 0, maxp, end}, ++ .m={on, 13, 0, 14, 0, end} ++}, ++{ .name="freemono", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="freesans", ++ .always_use_100={on, 0, maxp, end}, ++ .edge_detection={on, 11, 11, 13, 13, end}, ++ .spacing={on, 10, 12, 18, 18, 30, end}, ++ .start={on, 10, 18, 18, 25, 30, end}, ++ .stem_scaling={on, 16, 0, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 16, 9, 8, end} ++}, ++{ .name="freeserif", ++ .stem_scaling={on, 13, 1, 17, 1, end} ++}, ++{ .name="futura", ++ .stem_widths={on, 10, 14, sw2pv, maxp,} ++}, ++{ .name="garamond", ++ .brightness={on, 0, -20, end}, ++ .contrast={on, 0, 25, end} ++}, ++{ .name="georgia", ++ .stem_translating_only={on, 13, 16, 14, 16, 15, 0, end} ++}, ++{ .name="gill sans", ++ .stem_widths={on, 10, 17, sw2pv, maxp,} ++}, ++{ .name="helvetica cy", ++ .stem_widths={on, 10, 23, maxp,} ++}, ++{ .name="inconsolata", ++ .stem_scaling={on, 12, 1, 15, 1, end}, ++ .stem_translating_only={on, 10, 24, 9, 32, end}, ++ .stem_widths={on, 10, 23, maxp,}, ++}, ++{ .name="liberation mono", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="liberation sans narrow", ++ .stem_widths={on,10, 22, maxp,} ++}, ++{ .name="liberation sans", ++ .edge_detection={on, 11, 11, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 10, 8, 8, 32, 9, 32, end}, ++ .stem_widths={on,10, 19, maxp,} ++}, ++{ .name="lucida console", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="lucida grande", ++ .stem_scaling={on, 13, 1, end}, ++ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, ++ .stem_widths={on, 10, 16, sw2pv, maxp}, ++}, ++{ .name="lucida sans unicode", ++ .stem_translating_only={on, 13, 24, 14, 24, 8, 16, 9, 16, end}, ++ .stem_widths={on,10, 16, sw2pv, maxp,} ++}, ++{ .name="luxi sans", ++ .always_use_100={on, 13, 13, end}, ++ .stem_widths={on, 10, 17, sw2pv, maxp,} ++}, ++{ .name="microsoft sans serif", ++ .always_use_100={on, 0, maxp, end}, ++ .stem_translating_only={on, 10, 16, 8, 32, 9, 32, end} ++}, ++{ .name="monaco", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="myriad pro", ++ .stem_scaling={on, 14, 1, 17, 1, end}, ++ .stem_translating_only={on, 10, 16, 11, 0, 9, 16, end} ++}, ++{ .name="nina", ++ .stem_scaling={on, 11, 0, 12, 0, 13, 0, end} ++}, ++{ .name="open sans", ++ .stem_translating_only={on, 10, 16, 9, 16, end}, ++ .stem_widths={on, 10, 20, maxp,} ++}, ++{ .name="optima", ++ .brightness={on, 0, -20, end}, ++ .contrast={on, 0, 25, end}, ++ .stem_scaling={on, 17, 1, end}, ++ .stem_translating_only={on, 10, 0, 11, 0, 12, 0, end} ++}, ++{ .name="palatino linotype", ++ .edge_detection={on, 0, 100, end} ++}, ++{ .name="pragmata", ++ .always_use_100={on, 0, maxp, end} ++}, ++{ .name="raleway", ++ .stem_scaling={on, 15, 0, end} ++}, ++{ .name="rokkitt", ++ .stem_widths={on, 10, 21, maxp,} ++}, ++{ .name="samba", ++ .stem_scaling={on, 11, 0, end} ++}, ++{ .name="segoe ui", ++ .always_use_100={on, 11, 12, 14, 14, end}, ++ .stem_translating_only={on, 10, 0, 7, 32, 8, 16, 9, 24, end}, ++ .stem_widths={on, 10, 23, maxp,} ++}, ++{ .name="tahoma", ++ .always_use_100={on, 11, 11, 14, maxp, end}, ++ .edge_detection={on, 11, 11, end}, ++ .spacing={on, 10, 12, 18, 18, 30, end}, ++ .start={on, 14, 17, 30, 100, 100, end}, ++ .stem_translating={on, 11, 32, end}, ++ .stem_translating_only={on, 7, 32, 8, 32, 9, 32, end}, ++}, ++{ .name="times new roman", ++ .always_use_100={on, 14, 14, 16, 16, end}, ++ .bearing_correction={0, 100, end}, ++ .stem_scaling={on, 17, 1, end}, ++ .stem_translating_only={on, 17, 8, end} ++}, ++{ .name="trebuchet ms", ++ .always_use_100={on, 13, 13, end}, ++ .stem_scaling={on, 13, 0, 17, 0, 20, 1, end}, ++ .stem_translating_only={on, 10, 16, 11, 0, 8, 32, 9, 32, end}, ++ .stem_widths={on, 10, 17, sw2pv, maxp,} ++}, ++{ .name="ubuntu", ++ .always_use_100={on, 12, 13, 15, 15, end} ++}, ++{ .name="verdana", ++ .always_use_100={on, 0, 14, 16, maxp, end}, ++ .stem_scaling={on, 12, 1, 15, 1, end}, ++ .stem_translating_only={on, 8, 16, 15, 16, 14, 32, 18, 32, 19, 24, end} ++}, ++%% ++ ++static const sa_rules_t* ++ftinf_rules( const char *name ){ ++ if( name ){ ++ enum { ++ max_wlen=31 ++ }; ++ char buf[max_wlen+1]; ++ int len=strlen( name ); ++ if( len <= max_wlen ){ ++ int i; ++ for( i=0; i' == 62) && ('?' == 63) && ('A' == 65) \ ++ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ ++ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ ++ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ ++ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ ++ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ ++ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ ++ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ ++ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ ++ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ ++ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ ++ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ ++ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ ++ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ ++ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ ++ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) ++/* The character set is not based on ISO-646. */ ++#error "gperf generated tables don't work with this execution character set. Please report a bug to ." ++#endif ++ ++#line 9 "ftinf_sh.gperf" ++ ++#include ++static const struct ftinf_s* _settings_get( const char*str, unsigned len); ++/* maximum key range = 37, duplicates = 0 */ ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static unsigned int ++_settings_hash (register const char *str, register unsigned int len) ++{ ++ static const unsigned char asso_values[] = ++ { ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 13, ++ 8, 30, 25, 20, 40, 10, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 5, 40, 0, ++ 0, 0, 40, 40, 10, 0, 40, 40, 15, 5, ++ 10, 0, 10, 40, 40, 0, 0, 0, 0, 0, ++ 0, 0, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, ++ 40, 40, 40, 40, 40, 40 ++ }; ++ return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; ++} ++ ++#ifdef __GNUC__ ++__inline ++#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ ++__attribute__ ((__gnu_inline__)) ++#endif ++#endif ++const struct ftinf_s * ++_settings_get (register const char *str, register unsigned int len) ++{ ++ enum ++ { ++ TOTAL_KEYWORDS = 22, ++ MIN_WORD_LENGTH = 3, ++ MAX_WORD_LENGTH = 14, ++ MIN_HASH_VALUE = 3, ++ MAX_HASH_VALUE = 39 ++ }; ++ ++ static const struct ftinf_s wordlist[] = ++ { ++#line 76 "ftinf_sh.gperf" ++{ .name="osx", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_vertical_stem_darken_strength=25, ++ .bold_embolden_x_value=16, ++ .brightness=10, ++ .contrast=20, ++ .filter_params={on, 3, 32, 38, 32, 3}, ++ .gamma_correction={1000, 80}, ++ .global_embolden_y_value=8, ++ .grayscale_filter_strength=25, ++}, ++#line 37 "ftinf_sh.gperf" ++{ .name="ipad", ++ .filter_params={on, 0, 0, 100, 0, 0}, ++ .gamma_correction={1000, 80}, ++ .grayscale_filter_strength=100 ++}, ++#line 114 "ftinf_sh.gperf" ++{ .name="shove", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=100, ++ .stem_fitting_strength=100, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true ++}, ++#line 126 "ftinf_sh.gperf" ++{ .name="ubuntu", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_vertical_stem_darken_strength=25, ++ .brightness=-10, ++ .contrast=15, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={1000, 80}, ++ .use_various_tweaks=true ++}, ++#line 27 "ftinf_sh.gperf" ++{ .name="classic", ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .filter_params={on, 6, 25, 38, 25, 6}, ++ .gamma_correction={0, 100}, ++ .use_various_tweaks=true ++}, ++#line 34 "ftinf_sh.gperf" ++{ .name="disabled", ++ .gamma_correction={0, 100}, ++}, ++#line 100 "ftinf_sh.gperf" ++{ .name="sharpened", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=25, ++ .stem_fitting_strength=25, ++ .stem_snapping_sliding_scale=40, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=65 ++}, ++#line 42 "ftinf_sh.gperf" ++{ .name="infinality", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=25, ++ .stem_fitting_strength=25, ++ .stem_snapping_sliding_scale=40, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=5 ++}, ++#line 15 "ftinf_sh.gperf" ++{ .name="custom", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 8, 24, 48, 24, 8}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=75, ++ .stem_fitting_strength=50, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true ++}, ++#line 180 "ftinf_sh.gperf" ++{ .name="vanilla", ++ .filter_params={on, 6, 25, 38, 25, 6}, ++ .gamma_correction={0, 100}, ++}, ++#line 184 "ftinf_sh.gperf" ++{ .name="windows7light", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .contrast=20, ++ .filter_params={on, 20, 25, 38, 25, 05}, ++ .fringe_filter_strength=100, ++ .gamma_correction={1000, 160}, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=100 ++}, ++#line 226 "ftinf_sh.gperf" ++{ .name="windowsxplight", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .brightness=20, ++ .contrast=30, ++ .filter_params={on, 6, 25, 44, 25, 6}, ++ .fringe_filter_strength=100, ++ .gamma_correction={1000, 120}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=65 ++}, ++#line 64 "ftinf_sh.gperf" ++{ .name="nudge", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=25, ++ .stem_fitting_strength=15, ++ .stem_snapping_sliding_scale=30, ++ .use_various_tweaks=true, ++}, ++#line 144 "ftinf_sh.gperf" ++{ .name="ultimate2", ++ .filter_params={on, 6, 22, 36, 22, 6}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++#line 197 "ftinf_sh.gperf" ++{ .name="windows7", ++ .filter_params={on, 20, 25, 42, 25, 06}, ++ .fringe_filter_strength=100, ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_vertical_stem_darken_strength=25, ++ .windows_style_sharpening_strength=65, ++ .gamma_correction={1000, 120}, ++ .brightness=10, ++ .contrast=20, ++ .use_various_tweaks=true, ++ .autohint_snap_stem_height=100, ++ .use_known_settings_on_selected_fonts=true, ++}, ++#line 210 "ftinf_sh.gperf" ++{ .name="windowsxp", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .brightness=10, ++ .contrast=20, ++ .filter_params={on, 6, 25, 44, 25, 6}, ++ .fringe_filter_strength=100, ++ .gamma_correction={1000, 120}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=65 ++}, ++#line 56 "ftinf_sh.gperf" ++{ .name="linux", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 6, 25, 44, 25, 6}, ++ .gamma_correction={0, 100}, ++ .use_various_tweaks=true ++}, ++#line 135 "ftinf_sh.gperf" ++{ .name="ultimate1", ++ .filter_params={on, 4, 22, 38, 22, 4}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++#line 87 "ftinf_sh.gperf" ++{ .name="push", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=75, ++ .stem_fitting_strength=50, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true ++}, ++#line 171 "ftinf_sh.gperf" ++{ .name="ultimate5", ++ .filter_params={on, 12, 28, 42, 28, 12}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++#line 162 "ftinf_sh.gperf" ++{ .name="ultimate4", ++ .filter_params={on, 10, 25, 37, 25, 10}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++#line 153 "ftinf_sh.gperf" ++{ .name="ultimate3", ++ .filter_params={on, 8, 24, 36, 24, 8}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++} ++ }; ++ ++ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) ++ { ++ register int key = _settings_hash (str, len); ++ ++ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) ++ { ++ register const struct ftinf_s *resword; ++ ++ switch (key - 3) ++ { ++ case 0: ++ resword = &wordlist[0]; ++ goto compare; ++ case 1: ++ resword = &wordlist[1]; ++ goto compare; ++ case 2: ++ resword = &wordlist[2]; ++ goto compare; ++ case 3: ++ resword = &wordlist[3]; ++ goto compare; ++ case 4: ++ resword = &wordlist[4]; ++ goto compare; ++ case 5: ++ resword = &wordlist[5]; ++ goto compare; ++ case 6: ++ resword = &wordlist[6]; ++ goto compare; ++ case 7: ++ resword = &wordlist[7]; ++ goto compare; ++ case 8: ++ resword = &wordlist[8]; ++ goto compare; ++ case 9: ++ resword = &wordlist[9]; ++ goto compare; ++ case 10: ++ resword = &wordlist[10]; ++ goto compare; ++ case 11: ++ resword = &wordlist[11]; ++ goto compare; ++ case 12: ++ resword = &wordlist[12]; ++ goto compare; ++ case 14: ++ resword = &wordlist[13]; ++ goto compare; ++ case 15: ++ resword = &wordlist[14]; ++ goto compare; ++ case 16: ++ resword = &wordlist[15]; ++ goto compare; ++ case 17: ++ resword = &wordlist[16]; ++ goto compare; ++ case 19: ++ resword = &wordlist[17]; ++ goto compare; ++ case 21: ++ resword = &wordlist[18]; ++ goto compare; ++ case 26: ++ resword = &wordlist[19]; ++ goto compare; ++ case 31: ++ resword = &wordlist[20]; ++ goto compare; ++ case 36: ++ resword = &wordlist[21]; ++ goto compare; ++ } ++ return 0; ++ compare: ++ { ++ register const char *s = resword->name; ++ ++ if (*str == *s && !strcmp (str + 1, s + 1)) ++ return resword; ++ } ++ } ++ } ++ return 0; ++} ++#line 242 "ftinf_sh.gperf" ++ ++ ++static const ftinf_t* ++ftinf_settings( const char *name ){ ++ if( name ){ ++ enum { ++ max_wlen=31 ++ }; ++ char buf[max_wlen+1]; ++ int len=strlen( name ); ++ if( len <= max_wlen ){ ++ int i; ++ for( i=0; i ++static const struct ftinf_s* _settings_get( const char*str, unsigned len); ++%} ++struct ftinf_s; ++%% ++{ .name="custom", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 8, 24, 48, 24, 8}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=75, ++ .stem_fitting_strength=50, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true ++}, ++{ .name="classic", ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .filter_params={on, 6, 25, 38, 25, 6}, ++ .gamma_correction={0, 100}, ++ .use_various_tweaks=true ++}, ++{ .name="disabled", ++ .gamma_correction={0, 100}, ++}, ++{ .name="ipad", ++ .filter_params={on, 0, 0, 100, 0, 0}, ++ .gamma_correction={1000, 80}, ++ .grayscale_filter_strength=100 ++}, ++{ .name="infinality", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=25, ++ .stem_fitting_strength=25, ++ .stem_snapping_sliding_scale=40, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=5 ++}, ++{ .name="linux", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 6, 25, 44, 25, 6}, ++ .gamma_correction={0, 100}, ++ .use_various_tweaks=true ++}, ++{ .name="nudge", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=25, ++ .stem_fitting_strength=15, ++ .stem_snapping_sliding_scale=30, ++ .use_various_tweaks=true, ++}, ++{ .name="osx", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_vertical_stem_darken_strength=25, ++ .bold_embolden_x_value=16, ++ .brightness=10, ++ .contrast=20, ++ .filter_params={on, 3, 32, 38, 32, 3}, ++ .gamma_correction={1000, 80}, ++ .global_embolden_y_value=8, ++ .grayscale_filter_strength=25, ++}, ++{ .name="push", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=75, ++ .stem_fitting_strength=50, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true ++}, ++{ .name="sharpened", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=25, ++ .stem_fitting_strength=25, ++ .stem_snapping_sliding_scale=40, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=65 ++}, ++{ .name="shove", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_increase_glyph_heights=true, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=100, ++ .stem_fitting_strength=100, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true ++}, ++{ .name="ubuntu", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_vertical_stem_darken_strength=25, ++ .brightness=-10, ++ .contrast=15, ++ .filter_params={on, 11, 22, 38, 22, 11}, ++ .gamma_correction={1000, 80}, ++ .use_various_tweaks=true ++}, ++{ .name="ultimate1", ++ .filter_params={on, 4, 22, 38, 22, 4}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++{ .name="ultimate2", ++ .filter_params={on, 6, 22, 36, 22, 6}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++{ .name="ultimate3", ++ .filter_params={on, 8, 24, 36, 24, 8}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++{ .name="ultimate4", ++ .filter_params={on, 10, 25, 37, 25, 10}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++{ .name="ultimate5", ++ .filter_params={on, 12, 28, 42, 28, 12}, ++ .fringe_filter_strength=25, ++ .gamma_correction={0, 100}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=25 ++}, ++{ .name="vanilla", ++ .filter_params={on, 6, 25, 38, 25, 6}, ++ .gamma_correction={0, 100}, ++}, ++{ .name="windows7light", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .contrast=20, ++ .filter_params={on, 20, 25, 38, 25, 05}, ++ .fringe_filter_strength=100, ++ .gamma_correction={1000, 160}, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=100 ++}, ++{ .name="windows7", ++ .filter_params={on, 20, 25, 42, 25, 06}, ++ .fringe_filter_strength=100, ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_vertical_stem_darken_strength=25, ++ .windows_style_sharpening_strength=65, ++ .gamma_correction={1000, 120}, ++ .brightness=10, ++ .contrast=20, ++ .use_various_tweaks=true, ++ .autohint_snap_stem_height=100, ++ .use_known_settings_on_selected_fonts=true, ++}, ++{ .name="windowsxp", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .brightness=10, ++ .contrast=20, ++ .filter_params={on, 6, 25, 44, 25, 6}, ++ .fringe_filter_strength=100, ++ .gamma_correction={1000, 120}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=65 ++}, ++{ .name="windowsxplight", ++ .autohint_horizontal_stem_darken_strength=10, ++ .autohint_snap_stem_height=100, ++ .autohint_vertical_stem_darken_strength=25, ++ .brightness=20, ++ .contrast=30, ++ .filter_params={on, 6, 25, 44, 25, 6}, ++ .fringe_filter_strength=100, ++ .gamma_correction={1000, 120}, ++ .stem_alignment_strength=15, ++ .stem_fitting_strength=15, ++ .stem_snapping_sliding_scale=30, ++ .use_known_settings_on_selected_fonts=true, ++ .use_various_tweaks=true, ++ .windows_style_sharpening_strength=65 ++}, ++%% ++ ++static const ftinf_t* ++ftinf_settings( const char *name ){ ++ if( name ){ ++ enum { ++ max_wlen=31 ++ }; ++ char buf[max_wlen+1]; ++ int len=strlen( name ); ++ if( len <= max_wlen ){ ++ int i; ++ for( i=0; i ++#include ++#include ++#include "ftinf.h" + + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + +@@ -306,11 +309,37 @@ + FT_Library_SetLcdFilter( FT_Library library, + FT_LcdFilter filter ) + { +- static const FT_LcdFiveTapFilter default_weights = +- { 0x08, 0x4d, 0x56, 0x4d, 0x08 }; + static const FT_LcdFiveTapFilter light_weights = + { 0x00, 0x55, 0x56, 0x55, 0x00 }; + ++#ifndef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ static const FT_LcdFiveTapFilter default_weights = ++ { 0x08, 0x4d, 0x56, 0x4d, 0x08 }; ++#else ++ FT_LcdFiveTapFilter default_weights; ++ if( ftinf && ftinf->filter_params[0] ) ++ { ++ const int *f=ftinf->filter_params; ++ /* Assume we were given integers [0-100] get them to [0-255] */ ++ int val; /* 2611=2.55*1024 */ ++ val=(f[1]*2611+512)>>10; if( val > 255 ) val=255; ++ default_weights[0] = (FT_Byte) val; ++ val=(f[2]*2611+512)>>10; if( val > 255 ) val=255; ++ default_weights[1] = (FT_Byte) val; ++ val=(f[3]*2611+512)>>10; if( val > 255 ) val=255; ++ default_weights[2] = (FT_Byte) val; ++ val=(f[4]*2611+512)>>10; if( val > 255 ) val=255; ++ default_weights[3] = (FT_Byte) val; ++ val=(f[5]*2611+512)>>10; if( val > 255 ) val=255; ++ default_weights[4] = (FT_Byte) val; ++ } else { ++ default_weights[0]=0x08; ++ default_weights[1]=0x4d; ++ default_weights[2]=0x56; ++ default_weights[3]=0x4d; ++ default_weights[4]=0x08; ++ } ++#endif + + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); +diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c +index 539116e..c86b348 100644 +--- a/src/base/ftobjs.c ++++ b/src/base/ftobjs.c +@@ -43,7 +43,9 @@ + #ifdef FT_CONFIG_OPTION_MAC_FONTS + #include "ftbase.h" + #endif +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "ftinf.h" ++#endif + + #ifdef FT_DEBUG_LEVEL_TRACE + +@@ -81,6 +83,11 @@ + + #define GRID_FIT_METRICS + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include ++#include ++#include "../autofit/aflatin.h" ++#endif + + /* forward declaration */ + static FT_Error +@@ -567,6 +574,25 @@ + ft_lookup_glyph_renderer( FT_GlyphSlot slot ); + + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ static void ++ ft_glyphslot_enlarge_metrics( FT_GlyphSlot slot, ++ FT_Render_Mode mode ) ++ { ++ FT_Glyph_Metrics* metrics = &slot->metrics; ++ FT_Pos enlarge_cbox = 0; ++ ++ ++ /* enlarge for grayscale rendering */ ++ if ( mode == FT_RENDER_MODE_NORMAL ) ++ enlarge_cbox = 64; ++ ++ metrics->horiBearingX -= enlarge_cbox; ++ metrics->width += 2 * enlarge_cbox; ++ } ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ ++ ++ + #ifdef GRID_FIT_METRICS + static void + ft_glyphslot_grid_fit_metrics( FT_GlyphSlot slot, +@@ -625,8 +651,18 @@ + FT_Bool autohint = FALSE; + FT_Module hinter; + TT_Face ttface = (TT_Face)face; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET + ++ FT_Bool use_various_tweaks = FALSE; ++ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; + ++ /* Force autohint if no tt instructions */ ++ /* NOTE: NEEDS TO BE RUN LATER IN CODE???? */ ++ /*if ( use_various_tweaks && ++ ttface->num_locations && ++ ttface->max_profile.maxSizeOfInstructions == 0 ) ++ load_flags |= FT_LOAD_FORCE_AUTOHINT;*/ ++#endif + if ( !face || !face->size || !face->glyph ) + return FT_THROW( Invalid_Face_Handle ); + +@@ -717,6 +753,18 @@ + { + FT_AutoHinter_Interface hinting; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( use_various_tweaks ) ++ { ++ /* Force slight hinting over full hinting always */ ++ load_flags &= ~FT_LOAD_TARGET_LCD; ++ load_flags &= ~FT_LOAD_TARGET_LCD_V; ++ load_flags &= ~FT_LOAD_TARGET_MONO; ++ load_flags &= ~FT_LOAD_TARGET_NORMAL; ++ load_flags |= FT_LOAD_TARGET_LIGHT; ++ /*printf("%d ", load_flags);*/ ++ } ++#endif + + /* try to load embedded bitmaps first if available */ + /* */ +@@ -762,6 +810,18 @@ + if ( error ) + goto Exit; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ infinality_cur_width = 0; ++ ++ { ++ /* fix for sdl_ttf */ ++ FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); ++ ++ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) ++ ft_glyphslot_enlarge_metrics( slot, mode ); ++ } ++#endif ++ + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + /* check that the loaded outline is correct */ +@@ -4986,6 +5046,11 @@ + /* That's ok now */ + *alibrary = library; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* get Infinality settings */ ++ ftinf_env(); ++#endif ++ + return FT_Err_Ok; + + #ifdef FT_CONFIG_OPTION_PIC +diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c +index 464a066..d84a82a 100644 +--- a/src/base/ftoutln.c ++++ b/src/base/ftoutln.c +@@ -29,7 +29,9 @@ + #include FT_INTERNAL_CALC_H + #include FT_INTERNAL_DEBUG_H + #include FT_TRIGONOMETRY_H +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "ftinf.h" ++#endif + + /*************************************************************************/ + /* */ +@@ -913,7 +915,13 @@ + FT_Vector* points; + FT_Int c, first, last; + FT_Int orientation; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Bool use_various_tweaks = FALSE; ++ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; + ++ if ( use_various_tweaks ) ++ ystrength = FT_PIX_FLOOR ( ystrength ); ++#endif + + if ( !outline ) + return FT_THROW( Invalid_Outline ); +diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c +index 66dae60..89124f1 100644 +--- a/src/base/ftsynth.c ++++ b/src/base/ftsynth.c +@@ -22,7 +22,9 @@ + #include FT_INTERNAL_OBJECTS_H + #include FT_OUTLINE_H + #include FT_BITMAP_H +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "ftinf.h" ++#endif + + /*************************************************************************/ + /* */ +@@ -93,7 +95,10 @@ + FT_Face face; + FT_Error error; + FT_Pos xstr, ystr; +- ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Bool use_various_tweaks = FALSE; ++ if( ftinf ) use_various_tweaks=ftinf->use_various_tweaks; ++#endif + + if ( !slot ) + return; +@@ -111,8 +116,16 @@ + ystr = xstr; + + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) ++ { ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( use_various_tweaks ) ++ (void)FT_Outline_EmboldenXY( &slot->outline, ++ xstr, ++ FT_PIX_FLOOR( ystr ) ); ++ else ++#endif + FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); +- ++ } + else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ + { + /* round to full pixels */ +@@ -150,6 +163,9 @@ + + slot->metrics.width += xstr; + slot->metrics.height += ystr; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( !use_various_tweaks ) ++#endif + slot->metrics.horiAdvance += xstr; + slot->metrics.vertAdvance += ystr; + slot->metrics.horiBearingY += ystr; +diff --git a/src/base/rules.mk b/src/base/rules.mk +index 2a1e93c..1a38d49 100644 +--- a/src/base/rules.mk ++++ b/src/base/rules.mk +@@ -42,6 +42,7 @@ BASE_SRC := $(BASE_DIR)/basepic.c \ + $(BASE_DIR)/ftdbgmem.c \ + $(BASE_DIR)/ftgloadr.c \ + $(BASE_DIR)/fthash.c \ ++ $(BASE_DIR)/ftinf.c \ + $(BASE_DIR)/ftobjs.c \ + $(BASE_DIR)/ftoutln.c \ + $(BASE_DIR)/ftpic.c \ +diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c +index 6161393..8c00aa9 100644 +--- a/src/cff/cffobjs.c ++++ b/src/cff/cffobjs.c +@@ -39,6 +39,9 @@ + + #include "cfferrs.h" + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include "../base/ftinf.h" ++#endif + + /*************************************************************************/ + /* */ +@@ -1172,6 +1175,9 @@ + #endif + + driver->no_stem_darkening = TRUE; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if(ftinf) driver->no_stem_darkening = !ftinf->stem_darkening_cff; ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1; + driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1; +diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c +index 435854e..d14cd1a 100644 +--- a/src/smooth/ftsmooth.c ++++ b/src/smooth/ftsmooth.c +@@ -26,6 +26,18 @@ + + #include "ftsmerrs.h" + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++#include ++#include FT_BITMAP_H ++#include ++#include ++#include FT_OUTLINE_H ++#include "../base/ftinf.h" ++ ++#define verbose FALSE ++#define STVALUES if (verbose) \ ++ printf ( "scale:%f translate:%ld ", *scale_value, *translate_value ); ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + /* initialize renderer -- init its raster */ + static FT_Error +@@ -34,65 +46,2278 @@ + FT_Library library = FT_MODULE_LIBRARY( render ); + + +- render->clazz->raster_class->raster_reset( render->raster, +- library->raster_pool, +- library->raster_pool_size ); ++ render->clazz->raster_class->raster_reset( render->raster, ++ library->raster_pool, ++ library->raster_pool_size ); ++ ++ return 0; ++ } ++ ++ ++ /* sets render-specific mode */ ++ static FT_Error ++ ft_smooth_set_mode( FT_Renderer render, ++ FT_ULong mode_tag, ++ FT_Pointer data ) ++ { ++ /* we simply pass it to the raster */ ++ return render->clazz->raster_class->raster_set_mode( render->raster, ++ mode_tag, ++ data ); ++ } ++ ++ /* transform a given glyph image */ ++ static FT_Error ++ ft_smooth_transform( FT_Renderer render, ++ FT_GlyphSlot slot, ++ const FT_Matrix* matrix, ++ const FT_Vector* delta ) ++ { ++ FT_Error error = FT_Err_Ok; ++ ++ ++ if ( slot->format != render->glyph_format ) ++ { ++ error = FT_THROW( Invalid_Argument ); ++ goto Exit; ++ } ++ ++ if ( matrix ) ++ FT_Outline_Transform( &slot->outline, matrix ); ++ ++ if ( delta ) ++ FT_Outline_Translate( &slot->outline, delta->x, delta->y ); ++ ++ Exit: ++ return error; ++ } ++ ++ ++ /* return the glyph's control box */ ++ static void ++ ft_smooth_get_cbox( FT_Renderer render, ++ FT_GlyphSlot slot, ++ FT_BBox* cbox ) ++ { ++ FT_ZERO( cbox ); ++ ++ if ( slot->format == render->glyph_format ) ++ FT_Outline_Get_CBox( &slot->outline, cbox ); ++ } ++ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ static FT_Fixed FT_FixedFromFloat(float f) ++ { ++ short value = f; ++ unsigned short fract = (f - value) * 0xFFFF; ++ ++ ++ return (FT_Fixed)((long)value << 16 | (unsigned long)fract ); ++ } ++ ++ ++ /* ChromeOS sharpening algorithm */ ++ /* soften the sub-pixel anti-aliasing and sharpen */ ++ static void ++ _ft_lcd_chromeos_sharpen( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_Byte cutoff, ++ double gamma_value ) ++ { ++ static FT_Bool initialized_gamma = FALSE; ++ static unsigned short gamma_ramp[256]; ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ int ii; ++ ++ if ( !initialized_gamma ) ++ { ++ initialized_gamma = TRUE; ++ /* linear to voltage */ ++ for ( ii = 0; ii < 256; ii++ ) ++ { ++ gamma_ramp[ii] = (unsigned char) ++ ( pow( (double)ii / 255.0, gamma_value ) * 255.0f ); ++ if ( gamma_ramp[ii] < cutoff ) ++ gamma_ramp[ii] = 0; ++ } ++ } ++ ++ /* horizontal in-place sub-pixel sharpening filter */ ++ if ( mode == FT_RENDER_MODE_LCD ) ++ { ++ FT_Byte* line = bitmap->buffer; ++ ++ ++ for ( ; height > 0; height--, line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 0; xx < width; xx++ ) ++ line[xx] = gamma_ramp[line[xx]]; ++ } ++ } ++ } ++ ++ /* simple linear scale to handle various sliding values */ ++ float ++ sliding_scale ( int min_value, ++ int max_value, ++ float min_amount, ++ float max_amount, ++ int cur_value ) ++ { ++ ++ float m = ( min_amount - max_amount ) / (float)( min_value - max_value ); ++ float result = ( ( (float)cur_value * m) + ( max_amount - max_value * m ) ) ; ++ ++ if ( min_amount < max_amount ) ++ { ++ if ( result < min_amount ) ++ return min_amount; ++ if ( result > max_amount ) ++ return max_amount; ++ } ++ else ++ { ++ if ( result < max_amount ) ++ return max_amount; ++ if ( result > min_amount ) ++ return min_amount; ++ } ++ ++ return result; ++ } ++ ++ ++ /* brightness and contrast adjustment on the bitmap */ ++ static FT_Bool ++ _ft_bitmap_bc ( FT_Bitmap* bitmap, ++ float brightness, ++ float contrast ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt xx; ++ ++ ++ if ( brightness == 0 && contrast == 0 ) ++ return FALSE; ++ ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ for ( xx = 0; xx < width - 1; xx += 1 ) ++ { ++ if ( line[xx] > 0) ++ { ++ float value = (float)( 255 - line[xx] ) / 256.0; ++ FT_Int result = 0; ++ ++ if ( brightness < 0.0 ) ++ value = value * ( 1.0 + brightness ); ++ else ++ value = value + ( ( 1.0 - value ) * brightness ); ++ ++ value = ( value - 0.5 ) * ++ ( tan ( ( contrast + 1.0 ) * 3.141592/4.0 ) ) + 0.5; ++ ++ result = (FT_Int)( 255.0 - value * 256.0 ); ++ ++ if ( result < 0 ) ++ result = 0; ++ if ( result > 255 ) ++ result = 255; ++ ++ line[xx] = result; ++ } ++ } ++ } ++ return TRUE; ++ } ++ ++ ++ /* Filter to mimic Windows-style sharpening */ ++ /* Determined via 100% experimentation. */ ++ static void ++ _ft_lcd_windows_sharpen( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_Init( &new_bitmap ); ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if (strength > 0) ++ for (height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx, threshold = 128; ++ FT_Byte* prevline = line - bitmap->pitch; ++ FT_Byte* nextline = line + bitmap->pitch; ++ FT_Byte* new_prevline = new_line - bitmap->pitch; ++ FT_Byte* new_nextline = new_line + bitmap->pitch; ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ /* subpixel grid sp11 sp21 sp31 */ ++ /* where sp22 is sp12 sp22 sp32 */ ++ /* current subpixel. sp13 sp23 sp33 */ ++ ++ FT_Int prevtotal, nexttotal, lefttotal, righttotal, sidesdiff, ++ prevdiff, nextdiff, sp11, sp21, sp31, sp12, sp22, sp32, ++ sp13, sp23, sp33; ++ ++ sp12 = line [xx-1]; ++ sp22 = line [xx]; ++ sp32 = line [xx+1]; ++ ++ if ( height == bitmap->rows ) ++ { ++ prevtotal = sp11 = sp21 = sp31 = 0; ++ prevdiff = sp22; ++ lefttotal = sp12 + sp13; ++ righttotal = sp32 + sp33; ++ } ++ else ++ { ++ prevtotal = prevline[xx-1] + prevline[xx] + prevline[xx+1]; ++ sp11 = prevline [xx-1]; ++ sp21 = prevline [xx]; ++ sp31 = prevline [xx+1]; ++ prevdiff = sp22 - sp21; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ if ( height == 1 ) ++ { ++ nexttotal = sp13 = sp23 = sp33 = 0; ++ nextdiff = sp22; ++ lefttotal = sp11 + sp12; ++ righttotal = sp31 + sp32; ++ } ++ else ++ { ++ nexttotal = nextline[xx-1] + nextline[xx] + nextline[xx+1]; ++ sp13 = nextline [xx-1]; ++ sp23 = nextline [xx]; ++ sp33 = nextline [xx+1]; ++ nextdiff = sp23 - sp22; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ sidesdiff = lefttotal - righttotal; ++ ++ if ( sidesdiff < 0 ) ++ sidesdiff *= -1; ++ ++ if ( prevdiff < 0 ) ++ prevdiff *= -1; ++ ++ if ( nextdiff < 0 ) ++ nextdiff *= -1; ++ ++ /* if the current pixel is less than threshold, and greater than 0 */ ++ if ( sp22 <= threshold && sp22 > 0 ) ++ { ++ /* A pixel is horizontally isolated if: */ ++ /* 1: All upper adjecent pixels are >= threshold */ ++ if ( prevtotal >= nexttotal && ++ abs( sp11 - sp12 ) > 5 && ++ abs( sp21 - sp22 ) > 5 && ++ abs( sp31 - sp32 ) > 5 && /* not a vert stem end */ ++ sp11 >= threshold && ++ sp21 >= threshold && ++ sp31 >= threshold && ++ abs( sp23 - sp22 ) > 15 ) /* not on a vert stem */ ++ { ++ /* darken upper adjacent subpixel; lighten current */ ++ if ( height != (FT_UInt)bitmap->rows ) ++ new_prevline[xx] += ( ( 255 - new_prevline[xx] ) ++ * strength ) / 100 ; ++ ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( height != 1 && height != (FT_UInt)bitmap->rows ) ++ if ( new_nextline[xx] > 155 + ( 100 - strength ) ) ++ new_prevline[xx] = 255; ++ ++ } ++ else if ( nexttotal > prevtotal && ++ abs( sp13 - sp12 ) > 5 && ++ abs( sp23 - sp22 ) > 5 && ++ abs( sp33 - sp32 ) > 5 && ++ /* 2: All lower adjecent pixels are >= threshold */ ++ sp13 >= threshold && ++ sp23 >= threshold && ++ sp33 >= threshold && ++ abs( sp22 - sp21 ) > 15 ) ++ { ++ /* darken lower adjacent subpixel; lighten current */ ++ if ( height != 1 ) ++ new_nextline[xx] += ( 255 - new_nextline[xx] ) * strength / 100; ++ ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( height != 1 ) ++ if ( new_nextline[xx] > 155 + ( 100 - strength ) ) ++ new_nextline[xx] = 255; ++ ++ } ++ } ++ else if ( sp22 > threshold && sp22 < 255 ) ++ { ++ if ( sp11 <= threshold && ++ abs( sp13 - sp12 ) > 5 && ++ abs( sp23 - sp22 ) > 5 && ++ abs( sp33 - sp32 ) > 5 && ++ sp21 <= threshold && ++ sp31 <= threshold && ++ prevtotal <= nexttotal && ++ abs( sp22 - sp21 ) > 15 ) ++ { ++ /* bring this subpixel 1/3 of the way to 255 at 100% strength */ ++ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; ++ ++ if ( height != (FT_UInt)bitmap->rows ) ++ new_prevline[xx] -= ( new_prevline[xx] * strength ) / 300; ++ } ++ else if ( sp13 <= threshold && ++ abs( sp11 - sp12 ) > 5 && ++ abs( sp21 - sp22 ) > 5 && ++ abs( sp31 - sp32 ) > 5 && ++ sp23 <= threshold && ++ sp33 <= threshold && ++ nexttotal < prevtotal && ++ abs( sp23 - sp22 ) > 15 ) ++ { ++ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; ++ ++ if ( height != 1 ) ++ new_nextline[xx] -= ( new_nextline[xx] * strength ) / 300; ++ } ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ static void ++ _ft_lcd_darken_x ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ int factor1, factor2; ++ int bias = 0; ++ ++ FT_Bitmap_Init( &new_bitmap ); ++ ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ FT_Byte* prevline = line - bitmap->pitch; ++ FT_Byte* nextline = line + bitmap->pitch; ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ /* subpixel grid sp11 sp21 sp31 */ ++ /* where sp22 is sp12 sp22 sp32 */ ++ /* current subpixel. sp13 sp23 sp33 */ ++ ++ FT_Int sp21, sp12, sp22, sp32, sp23; ++ ++ sp12 = line [xx-1]; ++ sp22 = line [xx]; ++ sp32 = line [xx+1]; ++ ++ if ( height == bitmap->rows ) ++ sp21 = 0; ++ else ++ sp21 = prevline [xx]; ++ ++ if ( height == 1 ) ++ sp23 = 0; ++ else ++ sp23 = nextline [xx]; ++ ++ /* darken subpixel if neighbor above and below are much less than */ ++ /* safer but less effective */ ++ factor1 = 5; ++ factor2 = 5; ++ ++ /* make matches in the middle of glyph slightly darker */ ++ /*if (height > 1 && height < (FT_UInt)bitmap->rows) bias = 1;*/ ++ ++ if ( sp22 > factor1 * sp21 && ++ sp22 > factor1 * sp23 && ++ sp22 > factor2 && ++ sp12 > 16 && ++ sp32 > 16 ) ++ if ( new_line[xx] < ( strength * 255 ) / 100 ) ++ new_line[xx] = (strength * 255 ) / 100 ++ + bias * ( 255 - ( strength * 255 ) / 100 ) / 3; ++ ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ static void ++ _ft_lcd_darken_y ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_Init( &new_bitmap ); ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ if ( line[xx] > line[xx-1] && line[xx] > line[xx+1] ) ++ { ++ if (new_line[xx] > 0) ++ new_line[xx] += ( strength * ( 255 - new_line[xx] ) ) / 100; ++ new_line[xx-1] += ( strength * ( 255 - line[xx-1] ) ) / 100; ++ new_line[xx+1] += ( strength * ( 255 - line[xx+1] ) ) / 100; ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ static void ++ _ft_bitmap_cap ( FT_Bitmap* bitmap, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt cur_value = 0; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_Init( &new_bitmap ); ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ cur_value = ( new_line[xx-1] + new_line[xx] + new_line[xx+1] ) / 3; ++ if ( cur_value > ( strength * 255 ) / 100 ) ++ { ++ FT_UInt new_factor = ( strength * 255 ) / 100; ++ new_line[xx] = ( new_line[xx] * new_factor ) / cur_value; ++ new_line[xx+1] = ( new_line[xx+1] * new_factor ) / cur_value; ++ new_line[xx-1] = ( new_line[xx-1] * new_factor ) / cur_value; ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ static int ++ pseudo_gamma ( int val, float value ) ++ { ++ return 256 * ( 1.0f - powf( ( 1.0f - val * (1.0f/256.0f) ), 1.0f / value ) ); ++ } ++ ++#if(0) ++ static void ++ _ft_bitmap_embolden ( FT_Bitmap* bitmap, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ FT_UInt xx; ++ ++ ++ FT_Bitmap_Init(&new_bitmap); ++ FT_Bitmap_Copy(library, bitmap, &new_bitmap); ++ new_line = (&new_bitmap)->buffer; ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ FT_Int new_value = 0; ++ ++ ++ new_value = ( strength * line [xx-1] ) / 100 ++ + pseudo_gamma( line [xx], .75 ) ++ + (strength * line [xx+1] ) / 100; ++ if ( new_value > 255 ) ++ new_value = 255; ++ ++ new_line[xx] = new_value; ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ ++ static void ++ _ft_bitmap_gamma ( FT_Bitmap* bitmap, ++ float strength ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt xx; ++ ++ ++ if ( strength > 0 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ if ( abs( line[xx-1] - line[xx] ) < 20 || ++ abs( line[xx+1] - line[xx] ) < 20 ) ++ line [xx] = pseudo_gamma( line [xx], strength ) ; ++ } ++ } ++ } ++#endif ++ ++ /* Fringe filter */ ++ static void ++ _ft_lcd_fringe_filter ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* new_line; ++ FT_Byte* line = bitmap->buffer; ++ FT_Bitmap new_bitmap; ++ ++ ++ FT_Bitmap_Init(&new_bitmap); ++ ++ line = bitmap->buffer; ++ FT_Bitmap_Copy( library, bitmap, &new_bitmap ); ++ new_line = (&new_bitmap)->buffer; ++ ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch, new_line += bitmap->pitch ) ++ { ++ /* Threshold set to 1/2 pixel intensity */ ++ FT_UInt xx, threshold = 128; ++ ++ /* Hack to make this work when bitmap is at first or last line */ ++ FT_Int fudge = bitmap->pitch * (height == (FT_UInt)bitmap->rows); ++ ++ FT_Byte* prevline = line - bitmap->pitch + fudge; ++ FT_Byte* nextline = line + bitmap->pitch; ++ ++ ++ for ( xx = 1; xx < width - 1; xx += 1 ) ++ { ++ /* subpixel grid sp11 sp21 sp31 */ ++ /* where sp22 is sp12 sp22 sp32 */ ++ /* current subpixel. sp13 sp23 sp33 */ ++ ++ FT_Int prevtotal, nexttotal, lefttotal, righttotal, sidesdiff, ++ leftdiff, rightdiff, prevdiff, nextdiff, sp11, sp21, sp31, ++ sp12, sp22, sp32, sp13, sp23, sp33; ++ ++ sp12 = line [xx-1]; ++ sp22 = line [xx]; ++ sp32 = line [xx+1]; ++ ++ /* if at max height fake out some values */ ++ if ( height == (FT_UInt)bitmap->rows ) ++ { ++ prevtotal = sp11 = sp21 = sp31 = 0; ++ prevdiff = sp22; ++ lefttotal = sp12 + sp13; ++ righttotal = sp32 + sp33; ++ } ++ else ++ { ++ prevtotal = prevline[xx-1] + prevline[xx] + prevline[xx+1]; ++ sp11 = prevline [xx-1]; ++ sp21 = prevline [xx]; ++ sp31 = prevline [xx+1]; ++ prevdiff = sp22 - sp21; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ /* if at min height fake out some values */ ++ if ( height == 1 ) ++ { ++ nexttotal = sp13 = sp23 = sp33 = 0; ++ nextdiff = sp22; ++ lefttotal = sp11 + sp12; ++ righttotal = sp31 + sp32; ++ } ++ else ++ { ++ nexttotal = nextline[xx-1] + nextline[xx] + nextline[xx+1]; ++ sp13 = nextline [xx-1]; ++ sp23 = nextline [xx]; ++ sp33 = nextline [xx+1]; ++ nextdiff = sp23 - sp22; ++ lefttotal = sp11 + sp12 + sp13; ++ righttotal = sp31 + sp32 + sp33; ++ } ++ ++ sidesdiff = lefttotal - righttotal; ++ leftdiff = sp22 - sp12; ++ rightdiff = sp32 - sp22; ++ ++ if ( sidesdiff < 0 ) ++ sidesdiff *= -1; ++ ++ if ( prevdiff < 0 ) ++ prevdiff *= -1; ++ ++ if ( nextdiff < 0 ) ++ nextdiff *= -1; ++ ++ if ( leftdiff < 0 ) ++ leftdiff *= -1; ++ ++ if ( rightdiff < 0 ) ++ rightdiff *= -1; ++ ++ /* if the current subpixel is less than threshold, and varies only ++ slightly to left or right, lighten it */ ++ if ( sp22 <= threshold && sp22 > 0 && ++ ( leftdiff < 10 || rightdiff < 10 ) ) ++ { ++ /* A pixel is horizontally isolated if: */ ++ /* 1: All upper adjecent subpixels are >= threshold and all lower ++ adjacent ones are essentially white */ ++ if ( prevtotal >= nexttotal && ++ sp11 >= threshold && ++ sp21 >= threshold && ++ sp31 >= threshold && ++ sp13 < 2 && ++ sp23 < 2 && ++ sp33 < 2 ) ++ ++ { ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( leftdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT - keep going left until 255? */ ++ new_line[xx-1] -= ( new_line[xx-1] * strength ) / 200; ++ ++ if ( rightdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT */ ++ new_line[xx+1] -= ( new_line[xx+1] * strength ) / 200; ++ } ++ else if ( nexttotal > prevtotal && ++ /* 2: the inverse of above */ ++ sp13 >= threshold && ++ sp23 >= threshold && ++ sp33 >= threshold && ++ sp11 < 2 && ++ sp21 < 2 && ++ sp31 < 2 ) ++ { ++ new_line[xx] -= ( new_line[xx] * strength ) / 100; ++ ++ if ( leftdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT - keep going left until 255? */ ++ new_line[xx-1] -= ( new_line[xx-1] * strength ) / 200; ++ ++ if ( rightdiff < 10 ) ++ /* OPPORTUNITY FOR IMPROVEMENT */ ++ new_line[xx+1] -= ( new_line[xx+1] * strength ) / 200; ++ } ++ } ++ /* otherwise if the current subpixel is more than threshold, and varies ++ slightly to left or right, darken it */ ++ else if ( sp22 > threshold && ++ sp22 < 255 && ++ ( leftdiff < 10 || ++ rightdiff < 10 ) ) ++ { ++ if ( sp11 <= 2 && ++ sp21 <= 2 && ++ sp31 <= 2 && ++ sp13 >= threshold && ++ sp23 >= threshold && ++ sp33 >= threshold && ++ prevtotal < nexttotal ) ++ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100; ++ ++ else if ( sp13 <= 2 && ++ sp23 <= 2 && ++ sp33 <= 2 && ++ nexttotal < prevtotal && ++ sp11 >= threshold && ++ sp21 >= threshold && ++ sp31 >= threshold ) ++ new_line[xx] += ( ( 255 - new_line[xx] ) * strength ) / 100; ++ ++ } ++ } ++ } ++ FT_Bitmap_Copy( library, &new_bitmap, bitmap ); ++ FT_Bitmap_Done( library, &new_bitmap ); ++ } ++ ++ ++ /* Grayscale filter */ ++ static void ++ _ft_lcd_grayscale_filter ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_UInt strength, ++ FT_Library library ) ++ { ++ ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ ++ ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 0; xx < width - 1; xx += 3 ) ++ { ++ FT_UInt total = line [xx] + line [xx + 1] + line [xx + 2]; ++ line[xx] = ( ( 100 - strength ) * line[xx] ++ + strength * ( total / 3 ) ) / 100; ++ line[xx+1] = ( ( 100 - strength ) * line[xx+1] ++ + strength * ( total / 3 ) ) / 100; ++ line[xx+2] = ( ( 100 - strength ) * line[xx+2] ++ + strength * ( total / 3 ) ) / 100; ++ } ++ } ++ } ++ ++/* ++ These need to be in sync with params inside ftinf.c ++ (not ideal but perhaps better than making these public) ++ */ ++#define STEM_WIDTH_2_PPEM 18 ++#define MAX_PPEM 100 ++ ++ typedef struct Stem_Segment_ ++ { ++ FT_Long x1; ++ FT_Long x2; ++ FT_Int y; ++ } Stem_Segment; ++ ++ typedef struct Stem_Center_ ++ { ++ FT_Long x; ++ FT_Long y; ++ FT_Long w; ++ FT_Long x1; ++ FT_Long x2; ++ } Stem_Center; ++ ++ typedef struct Stem_ ++ { ++ FT_Long center; ++ FT_Long count; ++ FT_Long rcount; /* used to count within a range in possible stems */ ++ FT_Long width; ++ FT_Long height; ++ FT_Short zone; /* 1 2 or 3 */ ++ FT_Bool generated; ++ } Stem; ++ ++ static void ++ swap_stem ( Stem* s1, Stem* s2 ) ++ { ++ Stem s; ++ s.center = s1->center; ++ s.count = s1->count; ++ s.rcount = s1->rcount; ++ s.width = s1->width; ++ s.zone = s1->zone; ++ s.generated = s1->generated; ++ ++ s1->center = s2->center; ++ s1->count = s2->count; ++ s1->rcount = s2->rcount; ++ s1->width = s2->width; ++ s1->zone = s2->zone; ++ s1->generated = s2->generated; ++ ++ s2->center = s.center; ++ s2->count = s.count; ++ s2->rcount = s.rcount; ++ s2->width = s.width; ++ s2->zone = s.zone; ++ s2->generated = s.generated; ++ } ++ ++ /* Stem alignment for bitmaps; A hack with very nice results */ ++ /* Ideally this could be implemented on the outline, prior to ++ * rasterization. Possible future enhancement is to use the ++ * warper code to achieve this */ ++ static void ++ _lcd_stem_align ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_GlyphSlot slot, ++ FT_Long* translate_value, ++ float* scale_value, ++ FT_UInt alignment_strength, ++ FT_UInt fitting_strength, ++ float* embolden_value ++ ) ++ { ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ ++ Stem_Segment* segments; ++ Stem_Segment* leftmost_segment; ++ Stem_Segment* rightmost_segment; ++ Stem_Segment* leftmost_segment_not_extrema; ++ Stem_Segment* rightmost_segment_not_extrema; ++ Stem* stems; ++ Stem* possible_stems; ++ Stem* leftmost_stem; ++ Stem* rightmost_stem; ++ Stem_Data* known_stem_values; ++ Stem_Center* centers; ++ FT_Long leftmost_point = width * 256; ++ FT_Long rightmost_point = 0; ++ FT_Long leftmost_point_not_extrema = width * 256; ++ FT_Long rightmost_point_not_extrema = 0; ++ FT_Long num_segments = 0; ++ FT_Long num_centers = 0; ++ FT_Long *stem_centers; ++ FT_UInt h; ++ FT_ULong valid_stems = 0, valid_possible_stems = 0; ++ FT_Long center, stem_matches, stem_matches_ledge; ++ FT_Long stem_matches_redge, next_center, last_matching_center; ++ FT_Long last_matching_ledge, last_matching_redge, this_center; ++ FT_Int max_strength; ++ FT_Byte* line = bitmap->buffer; ++ FT_UInt current_value = 0; ++ FT_UInt xx; ++ FT_Long linearHoriAdvance = slot->linearHoriAdvance >> 10; ++ ++ FT_Int m_horiBearingX = slot->metrics.horiBearingX; ++ FT_Int m_horiAdvance = slot->metrics.horiAdvance; ++ FT_Int m_width = slot->metrics.width; ++ FT_Pos one_pixel = 768; ++ FT_Pos one_third_pixel = 256; ++ FT_Int columns_per_pixel = 3; ++ /*FT_Int extra_columns = 6;*/ ++ ++ /* on / off flags for testing different features */ ++ FT_Bool strategy_translate_using_closest_stem = TRUE; ++ FT_Bool strategy_scale_to_closest_centers = FALSE; ++ FT_Bool strategy_scale_to_closest_centers_up_only = FALSE; ++ FT_Bool strategy_always_use_distance_ceiling = FALSE; ++ FT_Bool strategy_auto_change_center_offset = TRUE; ++ FT_Bool strategy_use_m_control = FALSE; ++ FT_Bool strategy_correct_out_of_bounds_outlines = FALSE; ++ FT_Bool strategy_also_use_edge_detection_for_stems = FALSE; ++ FT_Bool strategy_use_strengths = TRUE; ++ FT_Bool strategy_synthesize_stems = FALSE; ++ FT_Bool strategy_bearing_correction = TRUE; ++ FT_Bool strategy_use_d_correction = TRUE; ++ FT_Bool strategy_fit_to_width = FALSE; ++ /*FT_Bool strategy_center_glyph = FALSE;*/ ++ ++ const FT_Int MIN_PPEM = 7; ++ /*const FT_Int MAX_PPEM = 100;*/ ++ const FT_Int MAX_STEMS = 3; ++ FT_Int ppem = 0; ++ ++ Stem_Data stem_data; ++ ++ /* reset to default */ ++ *scale_value = 1.0; ++ ++ /* Simply return in odd cases where these don't seem to be set */ ++ /* Flash and some pdf viewers will crash otherwise */ ++ if ( !slot->face || ++ !slot->face->size || ++ !slot->face->size->metrics.x_ppem ) ++ return; ++ ++ if ( slot->face->size->metrics.x_ppem > MAX_PPEM ) ++ return; ++ ++ if ( slot->face->size->metrics.x_ppem < MIN_PPEM ) ++ return; ++ ++ if ( !FT_IS_SCALABLE( slot->face ) ) ++ return; ++ ++ ppem = slot->face->size->metrics.x_ppem; ++ ++ if ( ppem < 9 ) ++ return; ++ if ( ppem > 20 ) ++ strategy_use_m_control = TRUE; ++ ++ /* only perform alignment on styles we know, that aren't bold or italic */ ++ /* perhaps detection could be added on those that are not set? */ ++ /* Require certain ppems for narrow and light fonts */ ++ if( slot->face->style_name ) ++ { ++ if ( strcasestr( slot->face->style_name, "Italic" ) || ++ strcasestr( slot->face->style_name, "Oblique" ) || ++ strcasestr( slot->face->style_name, "Script" ) || ++ strcasestr( slot->face->style_name, "Handwriting" ) || ++ strcasestr( slot->face->style_name, "Bold" ) || ++ strcasestr( slot->face->style_name, "Black" ) || ++ ( ( strcasestr( slot->face->style_name, "Extra Thin" ) || ++ strcasestr( slot->face->style_name, "Extra Light" ) ) && ++ ppem < 10 ) || ++ ( strcasestr( slot->face->style_name, "Thin" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->style_name, "Light" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->style_name, "Narrow" ) ++ && ppem < 15 ) || ++ ( strcasestr( slot->face->style_name, "Condensed" ) ++ && ppem < 20 ) ) ++ return; ++ } ++ ++ if( slot->face->family_name ) ++ { ++ if ( strcasestr( slot->face->family_name, "Italic" ) || ++ strcasestr( slot->face->family_name, "Oblique" ) || ++ strcasestr( slot->face->family_name, "Script" ) || ++ strcasestr( slot->face->family_name, "Handwriting" ) || ++ strcasestr( slot->face->family_name, "Bold" ) || ++ strcasestr( slot->face->family_name, "Black" ) || ++ ( ( strcasestr( slot->face->family_name, "Extra Thin" ) || ++ strcasestr( slot->face->family_name, "Extra Light" ) ) && ++ ppem < 10 ) || ++ ( strcasestr( slot->face->family_name, "Thin" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->family_name, "Light" ) ++ && ppem < 10 ) || ++ ( strcasestr( slot->face->family_name, "Narrow" ) ++ && ppem < 15 ) || ++ ( strcasestr( slot->face->family_name, "Condensed" ) ++ && ppem < 20 ) ) ++ return; ++ } ++ else if ( slot->face->style_flags ) ++ { ++ if ( slot->face->style_flags & FT_STYLE_FLAG_ITALIC || ++ slot->face->style_flags & FT_STYLE_FLAG_BOLD || ++ FT_IS_TRICKY( slot->face ) ) ++ return; ++ } ++ else return; ++ ++ if ( mode != FT_RENDER_MODE_LCD ) ++ { ++ columns_per_pixel = 1; ++ one_pixel = 256; ++ one_third_pixel = 85; ++ /*extra_columns = 0;*/ ++ /* until this can be figured out just return */ ++ /* There are issues with missing glyphs */ ++ return; ++ } ++ ++ known_stem_values=&stem_data; ++ if ( ftinf && ftinf->use_known_settings_on_selected_fonts ) ++ { ++ ftinf_fill_stem_values( known_stem_values, slot->face->family_name, ppem, TRUE ); ++ /* translate value may be set for < 10 */ ++ if (known_stem_values->stem_translating_only > -1024 ) ++ { ++ *translate_value = known_stem_values->stem_translating_only; ++ return; ++ } ++ if( known_stem_values->bearing_correction == FALSE ) ++ strategy_bearing_correction = FALSE; ++ } else ++ ftinf_fill_stem_values( known_stem_values, slot->face->family_name, ppem, FALSE ); ++ ++ if ( known_stem_values->use_100 || ++ known_stem_values->m >= 0 ) ++ { ++ alignment_strength = fitting_strength = 100; ++ strategy_use_m_control = TRUE; ++ } ++ ++ if ( known_stem_values->edge_detection ) ++ strategy_also_use_edge_detection_for_stems = TRUE; ++ ++ /* Allocate */ ++ segments = NULL; ++ leftmost_segment = (Stem_Segment*) malloc( 4*sizeof ( Stem_Segment ) ); ++ leftmost_segment_not_extrema = leftmost_segment+1; ++ rightmost_segment = leftmost_segment+2; ++ rightmost_segment_not_extrema = leftmost_segment+3; ++ ++ stems = (Stem*) malloc ( (2*MAX_STEMS+2) * sizeof ( Stem ) ); ++ possible_stems = stems+MAX_STEMS; ++ leftmost_stem = possible_stems+MAX_STEMS; ++ rightmost_stem = leftmost_stem + 1; ++ centers = NULL; ++ ++ if ( verbose ) ++ printf("\n"); ++ ++ /* Initialize */ ++ stem_centers=(FT_Long*)calloc( width * 256, sizeof(stem_centers[0]) ); ++ ++ rightmost_segment->x1 = 0; ++ rightmost_segment->x2 = 0; ++ rightmost_segment->y = 0; ++ leftmost_segment->x1 = 99999999; ++ leftmost_segment->x2 = 0; ++ leftmost_segment->y = 0; ++ ++ rightmost_segment_not_extrema->x1 = 0; ++ rightmost_segment_not_extrema->x2 = 0; ++ rightmost_segment_not_extrema->y = 0; ++ leftmost_segment_not_extrema->x1 = 99999999; ++ leftmost_segment_not_extrema->x2 = 0; ++ leftmost_segment_not_extrema->y = 0; ++ ++ /* Locate stem centers for later processing */ ++ for ( h = (FT_UInt)bitmap->rows; h > 0; h--, line += bitmap->pitch ) ++ { ++ current_value = 0; ++ /* Calculate various sums and stem widths of glyph */ ++ for ( xx = 0; xx < width; xx += 1 ) ++ { ++ /* Reallocate (in blocks of 64) */ ++ if( num_segments % 64 == 0 ) ++ segments = (Stem_Segment*) realloc ++ ( segments, ( num_segments + 64 ) * sizeof ( Stem_Segment ) ); ++ ++ /* if line is white, and now has color, it's the start of a stem */ ++ if ( current_value == 0 && line[xx] > 0 ) ++ { ++ /* start of stem */ ++ segments[num_segments].x1 = 256 * xx + ( 255 - line[xx] ); ++ segments[num_segments].y = h; ++ } ++ ++ /* otherwise, if it's currently black and the new value is 0, ++ it's the end of a stem */ ++ else if ( ( current_value > 0 && line[xx] == 0 ) || ++ ( current_value > 0 && xx == width - 1 ) ) ++ { ++ FT_Long stem_center_x; ++ segments[num_segments].x2 = 256 * ( xx - 1 ) + line[xx-1]; ++ ++ if ( xx == width - 1 ) ++ segments[num_segments].x2 += line[xx]; ++ ++ /*stem center is average of start and end of stem */ ++ stem_center_x = ( segments[num_segments].x2 ++ + segments[num_segments].x1 ) / 2; ++ ++ /* Reallocate (in blocks of 32) */ ++ if( num_centers % 32 == 0 ) ++ centers = (Stem_Center*) realloc ++ ( centers, ( num_centers + 32 ) * sizeof ( Stem_Center ) ); ++ centers[num_centers].x = stem_center_x; ++ centers[num_centers].y = h; ++ centers[num_centers].x1 = segments[num_segments].x1; ++ centers[num_centers].x2 = segments[num_segments].x2; ++ ++ num_centers++; ++ ++ stem_centers[stem_center_x] += 1; ++ ++ /* Find left and rightmost points for later calculations */ ++ /* OR - Favor ones that aren't on the top or bottom if */ ++ /* possible to prevent v and w from getting caught later */ ++ if ( segments[num_segments].x1 < leftmost_segment->x1 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 == leftmost_segment->x1 ) ) ++ { ++ leftmost_segment->x1 = segments[num_segments].x1; ++ leftmost_segment->x2 = segments[num_segments].x2; ++ leftmost_segment->y = h; ++ } ++ if ( segments[num_segments].x2 > rightmost_segment->x2 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 == rightmost_segment->x1 ) ) ++ { ++ rightmost_segment->x1 = segments[num_segments].x1; ++ rightmost_segment->x2 = segments[num_segments].x2; ++ rightmost_segment->y = h; ++ } ++ ++ if ( segments[num_segments].x1 ++ < leftmost_segment_not_extrema->x1 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 ++ == leftmost_segment_not_extrema->x1 && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ) ++ { ++ leftmost_segment_not_extrema->x1 = segments[num_segments].x1; ++ leftmost_segment_not_extrema->x2 = segments[num_segments].x2; ++ leftmost_segment_not_extrema->y = h; ++ } ++ if ( segments[num_segments].x2 ++ > rightmost_segment_not_extrema->x2 || ++ ( segments[num_segments].y > 1 && ++ segments[num_segments].y < height && ++ segments[num_segments].x1 ++ == rightmost_segment_not_extrema->x1 && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ) ++ { ++ rightmost_segment_not_extrema->x1 = segments[num_segments].x1; ++ rightmost_segment_not_extrema->x2 = segments[num_segments].x2; ++ rightmost_segment_not_extrema->y = h; ++ } ++ ++ if ( segments[num_segments].x1 < leftmost_point ) ++ leftmost_point = segments[num_segments].x1; ++ ++ if ( segments[num_segments].x2 > rightmost_point ) ++ rightmost_point = segments[num_segments].x2; ++ ++ if ( segments[num_segments].x1 < leftmost_point_not_extrema && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ++ leftmost_point_not_extrema = segments[num_segments].x1; ++ ++ if ( segments[num_segments].x2 > rightmost_point_not_extrema && ++ h < (FT_UInt)bitmap->rows && h > 0 ) ++ rightmost_point_not_extrema = segments[num_segments].x2; ++ ++ num_segments++; ++ } ++ /* else - other conditions - need some error checking here */ ++ current_value = line[xx]; ++ } ++ } ++ ++ /* initialize */ ++ for ( xx = 0; xx < MAX_STEMS; xx +=1 ) ++ { ++ stems[xx].center = 0; ++ stems[xx].count = 0; ++ stems[xx].width = 0; ++ stems[xx].height = 0; ++ possible_stems[xx].center = 0; ++ possible_stems[xx].count = 0; ++ possible_stems[xx].width = 0; ++ possible_stems[xx].height = 0; ++ } ++ ++ valid_stems = 0; ++ valid_possible_stems = 0; ++ ++ /* Determine which centers belong to stems */ ++ center = 0; ++ ++ while ( center < num_centers ) ++ { ++ /* slope at within which to consider a point part of a stem */ ++ /*const FT_UInt slope = 1; ++ const FT_UInt topslope = (256 * 3) / 10; */ ++ ++ /* 10 to 20 with 4 matches seems good, */ ++ /* but 1 or 2 with 3 stems needs to somehow get included */ ++ FT_Int deviation1 = 5; ++ FT_Int deviation2=-1, requirement1 = 4, stem_match_requirement = 3; ++ FT_Int center_difference_in_height; ++ FT_Int center_difference_in_width, valid_center_average; ++ FT_Int smallest_width_ledge, smallest_width_redge; ++ FT_Int x1_difference_in_width, x2_difference_in_width; ++ FT_Bool no_gap_found = FALSE; ++ FT_Bool no_gap_found_ledge = FALSE; ++ FT_Bool no_gap_found_redge = FALSE; ++ FT_Bool stem_detected = FALSE; ++ FT_Int set_width_to, set_center_to; ++ ++ /* seems to not do damage */ ++ /* May not be effective */ ++ requirement1 = height / 4; ++ if ( requirement1 < 5 ) ++ requirement1 = 5; ++ deviation1 = 20; ++ deviation2 = 20; ++ ++ if ( columns_per_pixel == 1 ) ++ deviation1 = deviation2 = 10; ++ ++ if ( (FT_Int)bitmap->rows <= 6 ) ++ deviation1 = 25; ++ ++ if ( (FT_Int)bitmap->rows <= 6 ) ++ deviation2 = 25; ++ ++ if ( columns_per_pixel == 1 && ++ (FT_Int)bitmap->rows <= 6 ) ++ deviation1 = deviation2 = 12; ++ ++ valid_center_average = 0; ++ ++ no_gap_found = no_gap_found_ledge = no_gap_found_redge = FALSE; ++ stem_detected = FALSE; ++ ++ if ( ppem < 11 ) ++ requirement1 = 4; ++ ++ if ( ppem > 18 ) ++ { ++ stem_match_requirement = height / 4; ++ if ( stem_match_requirement < 3 ) ++ stem_match_requirement = 3; ++ } ++ ++ smallest_width_ledge = smallest_width_redge = width * 256; ++ stem_matches = 0; ++ stem_matches_ledge = 0; ++ stem_matches_redge = 0; ++ last_matching_center = -1; ++ last_matching_ledge = -1; ++ last_matching_redge = -1; ++ ++ /* set currently looked at center to center value */ ++ this_center = center; ++ next_center = 0; ++ ++ /* For each center, compare with all other centers to see if others */ ++ /* match the properties of this one */ ++ while ( next_center < num_centers ) ++ { ++ ++ /* calculate differences */ ++ center_difference_in_width = abs ( centers[this_center].x ++ - centers[next_center].x ); ++ center_difference_in_height = abs ( centers[this_center].y ++ - centers[next_center].y ); ++ x1_difference_in_width = abs ( centers[this_center].x1 ++ - centers[next_center].x1 ); ++ x2_difference_in_width = abs ( centers[this_center].x2 ++ - centers[next_center].x2 ); ++ ++ ++ /* property - stem center points that align */ ++ /* if the center is within range, the center is less than */ ++ /* 1/2 the height away, and at least one edge is also within range */ ++ if ( center_difference_in_width ++ < center_difference_in_height * deviation1 && ++ center_difference_in_height ++ <= (FT_Int)bitmap->rows / 2 && ++ /* prevents w from getting caught ---- but also kills m */ ++ ( x1_difference_in_width ++ < center_difference_in_height * deviation2 || ++ x2_difference_in_width ++ < center_difference_in_height * deviation2 ) ) ++ { ++ stem_matches += 1; ++ valid_center_average += centers[next_center].x; ++ ++ /* try to find where the matching centers are far apart */ ++ if ( last_matching_center >= 0 && ++ abs( centers[last_matching_center].y ++ - centers[next_center].y ) >= (FT_Int)bitmap->rows / 2 ) ++ ++ /* try to find where matching centers are next to each other */ ++ if ( last_matching_center >= 0 && ++ abs( centers[last_matching_center].y ++ - centers[next_center].y ) == 1 ) ++ no_gap_found = TRUE; ++ ++ last_matching_center = next_center; ++ } ++ ++ if ( strategy_also_use_edge_detection_for_stems ) ++ { ++ /* property - stem left edge points that align */ ++ /* if the center is within range, */ ++ /* the center is less than 1/2 the height away */ ++ if ( x1_difference_in_width ++ < center_difference_in_height * deviation1 && ++ center_difference_in_height <= (FT_Int)bitmap->rows / 2 ) ++ { ++ stem_matches_ledge += 1; ++ /* may not need for edges */ ++ /*valid_center_average += centers[next_center].x; */ ++ ++ if ( centers[next_center].x2 - centers[next_center].x1 ++ < smallest_width_ledge ) ++ smallest_width_ledge = centers[next_center].x2 ++ - centers[next_center].x1; ++ ++ /* try to find where the matching centers are far apart */ ++ if ( last_matching_ledge >= 0 && ++ abs( centers[last_matching_ledge].y ++ - centers[next_center].y) ++ >= (FT_Int)bitmap->rows / 2 ) ++ ++ /* try to find where matching centers are next to each other */ ++ if ( last_matching_ledge >= 0 && ++ abs( centers[last_matching_ledge].y ++ - centers[next_center].y ) == 1 ) ++ no_gap_found_ledge = TRUE; ++ last_matching_ledge = next_center; ++ } ++ } ++ ++ if ( strategy_also_use_edge_detection_for_stems ) ++ { ++ /* property - stem right edge points that align */ ++ /* if the center is within range, the center is less than 1/2 */ ++ /* the height away */ ++ if ( x2_difference_in_width ++ < center_difference_in_height * deviation1 && ++ center_difference_in_height ++ <= (FT_Int)bitmap->rows / 2 ) ++ { ++ stem_matches_redge += 1; ++ /* may not need for edges */ ++ /*valid_center_average += centers[next_center].x; */ ++ ++ if ( centers[next_center].x2 - centers[next_center].x1 ++ < smallest_width_redge ) ++ smallest_width_redge = centers[next_center].x2 ++ - centers[next_center].x1; ++ ++ /* try to find where the matching centers are far apart */ ++ if ( last_matching_redge >= 0 && ++ abs( centers[last_matching_redge].y ++ - centers[next_center].y ) >= (FT_Int)bitmap->rows / 2 ) ++ ++ /* try to find where matching centers are next to each other */ ++ if ( last_matching_redge >= 0 && ++ abs( centers[last_matching_redge].y ++ - centers[next_center].y ) == 1 ) ++ no_gap_found_redge = TRUE; ++ ++ last_matching_redge = next_center; ++ } ++ } ++ ++ next_center++; ++ } ++ ++ if ( stem_matches > 0 ) ++ valid_center_average /= stem_matches; ++ ++ if ( ( stem_matches >= stem_match_requirement || ++ ( ( (FT_Int)bitmap->rows <= 6 || ppem < 11 ) && ++ stem_matches >= 2 && ++ abs ( valid_center_average ++ - centers[center].x) < deviation1 /2 ) || ++ /* try to catch tightly aligned stuff where the matching centers */ ++ /* are next to each other only */ ++ ( stem_matches == 2 && ++ abs( valid_center_average ++ - centers[center].x) <= deviation1 /2 && ++ no_gap_found && ++ ppem < 18 ) ) && ++ /* catches things like times 16 u but gets a lot of w's too */ ++ /* stem width is less than 1/3 of the bitmap width, */ ++ /* or bitmap_width is small */ ++ ( centers[center].x2 - centers[center].x1 ++ < (m_horiAdvance * 12) / 2 || ++ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) ) ++ { ++ stem_detected = TRUE; ++ set_width_to = centers[center].x2 - centers[center].x1; ++ set_center_to = centers[center].x; ++ } ++ ++ /* see if edges found anything */ ++ if ( strategy_also_use_edge_detection_for_stems && !stem_detected ) ++ { ++ /* Require no gap for edges */ ++ /* stem width less than 1/3 bitmap width, or bitmap_width is small */ ++ /* The stem occurs on the left side of glyph only */ ++ if ( ( stem_matches_ledge >= stem_match_requirement && ++ no_gap_found_ledge ) && ++ ( centers[center].x2 - centers[center].x1 ++ < ( m_horiAdvance * 12 ) / 2 || ++ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) && ++ centers[center].x < ( m_horiAdvance * 12 ) / 2 ) ++ { ++ stem_detected = TRUE; ++ set_width_to = smallest_width_ledge; ++ set_center_to = centers[center].x1 + set_width_to / 2; ++ stem_matches = stem_matches_ledge; ++ } ++ /* Require no gap for edges */ ++ /* stem width is less than 1/3 bitmap width, or bitmap_width is small */ ++ /* The stem occurs on the right side of glyph only */ ++ else if ( ( stem_matches_redge >= stem_match_requirement && ++ no_gap_found_redge ) && ++ ( centers[center].x2 - centers[center].x1 ++ < ( m_horiAdvance * 12 ) / 2 || ++ m_horiAdvance * 12 <= columns_per_pixel * one_pixel ) && ++ centers[center].x > (m_horiAdvance * 12) / 2 ) ++ { ++ stem_detected = TRUE; ++ set_width_to = smallest_width_redge; ++ set_center_to = centers[center].x2 - set_width_to / 2; ++ stem_matches = stem_matches_redge; ++ } ++ } ++ ++ ++ /*store and/or replace highest occurrences with 3 or more centers */ ++ /* because this matched, it will become the top dog regardless */ ++ if ( stem_detected && (stem_matches > possible_stems[0].height) ) ++ { ++ /* if this is the first stem just go ahead */ ++ if ( valid_possible_stems == 0 ) ++ { ++ valid_possible_stems = 1; ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ ++ /* otherwise, if there is already a stem */ ++ else if ( valid_possible_stems == 1 ) ++ { ++ /* if stem is within range of existing one, replace existing one */ ++ ++ /* if the stem isn't within the range of this one swap it with */ ++ /* next one first */ ++ if ( abs ( set_center_to - possible_stems[0].center ) ++ >= one_pixel * 2 ) ++ { ++ swap_stem ( &possible_stems[0], &possible_stems[1] ); ++ valid_possible_stems = 2; ++ } ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ ++ /* otherwise if there are already 2 stems */ ++ else if ( valid_possible_stems >= 2 ) ++ { ++ /* if the stem is within the range of existing one, replace */ ++ /* existing one */ ++ if ( abs ( set_center_to - possible_stems[0].center ) ++ <= one_pixel * 2 ) ++ { ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ /* if the stem isn't within the range of this one */ ++ else ++ { ++ /* see if within range of next one and swap if so and proceed */ ++ /* overwriting it */ ++ if ( abs ( set_center_to - possible_stems[1].center ) ++ <= one_pixel * 2 ) ++ swap_stem ( &possible_stems[0], &possible_stems[1] ); ++ ++ /* otherwise see if in range of third one */ ++ else if ( abs ( set_center_to - possible_stems[2].center ) ++ <= one_pixel * 2 ) ++ swap_stem ( &possible_stems[0], &possible_stems[2] ); ++ ++ /* otherwise this is the new top dog, so demote everything */ ++ else ++ { ++ swap_stem ( &possible_stems[1], &possible_stems[2] ); ++ swap_stem ( &possible_stems[0], &possible_stems[1] ); ++ valid_possible_stems += 1; ++ } ++ possible_stems[0].center = set_center_to; ++ possible_stems[0].count = stem_matches; ++ possible_stems[0].width = set_width_to; ++ possible_stems[0].height = stem_matches; ++ } ++ } ++ } ++ ++ else if ( stem_matches > possible_stems[1].height && ++ set_center_to != 0 ) ++ { ++ ++ /* make sure it doesn't match the first stem */ ++ if ( abs ( set_center_to - possible_stems[0].center ) >= one_pixel * 2 ) ++ { ++ ++ /* if this is the second stem */ ++ if ( valid_possible_stems == 1 ) ++ valid_possible_stems = 2; ++ ++ /* otherwise if there is already a stem here */ ++ else if ( valid_possible_stems >= 2 ) ++ { ++ /* if it doesn't match the second stem, proceed to swap out */ ++ /* with the third. if it does, replace it */ ++ if ( abs ( set_center_to - possible_stems[1].center ) ++ >= one_pixel * 2 ) ++ { ++ swap_stem ( &possible_stems[1], &possible_stems[2] ); ++ valid_possible_stems +=1; ++ } ++ } ++ possible_stems[1].center = set_center_to; ++ possible_stems[1].count = stem_matches; ++ possible_stems[1].width = set_width_to; ++ possible_stems[1].height = stem_matches; ++ } ++ } ++ ++ else if ( stem_matches > possible_stems[2].height && ++ set_center_to != 0 ) ++ { ++ /* if it doesn't match the first or second one */ ++ if ( abs( set_center_to - possible_stems[0].center) >= one_pixel * 2 && ++ abs( set_center_to - possible_stems[1].center) >= one_pixel * 2 ) ++ { ++ if ( valid_possible_stems == 2 ) ++ valid_possible_stems += 1; ++ ++ possible_stems[2].center = set_center_to; ++ possible_stems[2].count = stem_matches; ++ possible_stems[2].width = set_width_to; ++ possible_stems[1].height = stem_matches; ++ } ++ } ++ ++ if ( valid_possible_stems > 3 ) ++ valid_possible_stems = 3; ++ ++ center++; ++ } ++ ++ /* promote to stem */ ++ if ( valid_possible_stems > 0 ) ++ { ++ stems[0].center = possible_stems[0].center; ++ stems[0].count = possible_stems[0].count; ++ stems[0].width = possible_stems[0].width; ++ stems[0].height = possible_stems[0].height; ++ stems[0].generated = FALSE; ++ valid_stems++; ++ } ++ ++ if ( valid_stems == 1 && ++ valid_possible_stems > 1 ) ++ { ++ stems[1].center = possible_stems[1].center; ++ stems[1].count = possible_stems[1].count; ++ stems[1].width = possible_stems[1].width; ++ stems[1].height = possible_stems[1].height; ++ stems[1].generated = FALSE; ++ valid_stems++; ++ } ++ ++ if ( valid_stems == 2 && ++ valid_possible_stems > 2 && ++ possible_stems[2].center != 0 ) ++ { ++ stems[2].center = possible_stems[2].center; ++ stems[2].count = possible_stems[2].count; ++ stems[2].width = possible_stems[2].width; ++ stems[2].height = possible_stems[2].height; ++ stems[2].generated = FALSE; ++ valid_stems++; ++ } ++ ++ /* sort stems in x direction */ ++ if ( valid_stems == 3 ) ++ { ++ if ( stems[0].center > stems[1].center ) ++ swap_stem ( &stems[0], &stems[1] ); ++ ++ if ( stems[0].center > stems[2].center ) ++ swap_stem ( &stems[1], &stems[2] ); ++ ++ if ( stems[1].center > stems[2].center ) ++ swap_stem ( &stems[1], &stems[2] ); ++ ++ if ( stems[0].center > stems[1].center ) ++ swap_stem ( &stems[0], &stems[1] ); ++ ++ /* only look at first and last stem for now */ ++ swap_stem ( &stems[1], &stems[2] ); ++ } ++ ++ /* synthesize stems - Works, but needs work */ ++ if ( ( strategy_synthesize_stems || ++ known_stem_values->synth_stems ) && ++ valid_stems == 0 && ++ ppem > 10 ) ++ { ++ /* if the leftmost segment's leftmost point is the same as the glyph's */ ++ /* leftmost point, and it is of reasonable width, and is not on the */ ++ /* top or bottom of the bitmap */ ++ if ( leftmost_segment_not_extrema->x1 ++ == leftmost_point_not_extrema && ++ abs ( leftmost_segment_not_extrema->x2 ++ - leftmost_segment_not_extrema->x1 ) ++ < ( rightmost_point_not_extrema ++ - leftmost_point_not_extrema ) / 3 && ++ leftmost_segment_not_extrema->y < height && ++ leftmost_segment_not_extrema->y > 1 ) ++ { ++ stems[valid_stems].center = ( leftmost_segment_not_extrema->x2 ++ + leftmost_segment_not_extrema->x1 ) / 2; ++ stems[valid_stems].width = leftmost_segment_not_extrema->x2 ++ - leftmost_segment_not_extrema->x1; ++ stems[valid_stems].generated = TRUE; ++ valid_stems += 1; ++ } ++ ++ ++ if ( rightmost_segment_not_extrema->x2 ++ == rightmost_point_not_extrema && ++ abs ( rightmost_segment_not_extrema->x2 ++ - rightmost_segment_not_extrema->x1 ) ++ < ( rightmost_point_not_extrema ++ - leftmost_point_not_extrema ) / 3 && ++ rightmost_segment_not_extrema->y < height && ++ rightmost_segment_not_extrema->y > 1 ) ++ { ++ stems[valid_stems].center = ( rightmost_segment_not_extrema->x2 ++ + rightmost_segment_not_extrema->x1 ) / 2; ++ stems[valid_stems].width = rightmost_segment_not_extrema->x2 ++ - rightmost_segment_not_extrema->x1; ++ stems[valid_stems].generated = TRUE; ++ valid_stems += 1; ++ } + +- return 0; +- } ++ } + ++ /* sort stems in x direction */ ++ if ( valid_stems > 1 && stems[0].center > stems[1].center ) ++ swap_stem ( &stems[0], &stems[1] ); + +- /* sets render-specific mode */ +- static FT_Error +- ft_smooth_set_mode( FT_Renderer render, +- FT_ULong mode_tag, +- FT_Pointer data ) +- { +- /* we simply pass it to the raster */ +- return render->clazz->raster_class->raster_set_mode( render->raster, +- mode_tag, +- data ); +- } ++ if ( valid_stems == 0 && known_stem_values->stem_translating != 0 ) ++ { ++ *translate_value += known_stem_values->stem_translating; + +- /* transform a given glyph image */ +- static FT_Error +- ft_smooth_transform( FT_Renderer render, +- FT_GlyphSlot slot, +- const FT_Matrix* matrix, +- const FT_Vector* delta ) +- { +- FT_Error error = FT_Err_Ok; ++ if ( strategy_use_strengths ) ++ { ++ /* consider 1/2 pixel the max when strength is at 100%, ++ unless translate is already greater than that */ ++ FT_Int strength_cutoff = 32; + + +- if ( slot->format != render->glyph_format ) ++ if ( abs ( *translate_value ) > strength_cutoff) ++ strength_cutoff = *translate_value; ++ ++ max_strength = ( strength_cutoff * alignment_strength ) / 100; ++ ++ if ( *translate_value < -max_strength ) ++ *translate_value = -max_strength; ++ else if ( *translate_value > max_strength ) ++ *translate_value = max_strength; ++ } ++ } ++ else ++ /* Start snapping */ + { +- error = FT_THROW( Invalid_Argument ); ++ FT_Int center_offset; ++ FT_Int modulus; ++ FT_Int delta, delta2; ++ FT_Long stem_distance = 1, new_distance = 1; ++ FT_Int distance_floor, distance_ceiling; ++ FT_Int translate_value2 = 0; ++ FT_Int main_stem = 0; ++ FT_Int lbearing = m_horiBearingX * 12; ++ FT_Int bitmap_stem_location = stems[0].center; ++ FT_Int advance_stem_location = bitmap_stem_location ++ + lbearing - one_pixel; ++ FT_Int advance_width = m_horiAdvance * 12; ++ FT_Int original_advance_width = 12 * ( slot->linearHoriAdvance >> 10 ); ++ FT_Int glyph_width = rightmost_point - leftmost_point; ++ FT_Int stem_width = stems[0].width; ++ FT_Int advance_leftmost_location = leftmost_point ++ + lbearing - one_pixel; ++ FT_Int advance_rightmost_location = rightmost_point ++ + lbearing - one_pixel; ++ ++#define proposed_transformed_point(point) \ ++ point * (float)(new_distance) / (float)(stem_distance) \ ++ + *translate_value * 12 - ( stems[main_stem].center * (float)(new_distance) \ ++ / (float)(stem_distance) - stems[main_stem].center) ++ ++#define proposed_translated_point(point) point + *translate_value * 12 ++ ++ center_offset = one_pixel / 2; /* half pixel */ ++ modulus = one_pixel; /* whole pixel */ ++ ++ /* Determine center_offset via known values */ ++ if ( known_stem_values->stem_width >= 0 ) ++ { ++ if ( known_stem_values->stem_width % 2 == 0 ) ++ center_offset = 0; ++ else ++ center_offset = one_pixel / 2; ++ } ++ /* otherwise do intelligent guessing, if set */ ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM && ++ stems[0].width < one_pixel * 1.45 ) ++ center_offset = one_pixel / 2; ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM && ++ stems[0].width >= one_pixel * 1.45 && ++ stems[0].width < one_pixel * 2.6 ) ++ center_offset = 0; ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM && ++ stems[0].width >= one_pixel * 2.6 && ++ stems[0].width < one_pixel * 3.6 ) ++ center_offset = one_pixel / 2; ++ else if ( strategy_auto_change_center_offset && ++ ppem >= STEM_WIDTH_2_PPEM ) ++ center_offset = ++ ( one_pixel ++ * ( ( ( (int)( stems[0].width + one_pixel / 2 ) ) ++ / one_pixel ) % 2 ) ) / 2; ++ ++ /* Snap to closest translate and scale values by default */ ++ if ( valid_stems >= 1 ) ++ { ++ /* closest snapping point for stem 0 */ ++ delta = ( stems[0].center + center_offset ) % modulus; ++ ++ if ( delta < modulus / 2 ) ++ /* snap left */ ++ *translate_value = -delta / ( columns_per_pixel * 4 ); ++ else ++ /* snap right */ ++ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 ); ++ } ++ ++ if ( strategy_use_d_correction ) ++ { ++ /* if the only stem is in the last 1/3 of glyph width, the advance */ ++ /* is 6 pixels, the ppem 11, and doing so doesn't violate bitmap , */ ++ /* boundaries force it to snap right */ ++ if ( valid_stems == 1 && ++ advance_stem_location > (advance_width * 2) / 3 && ++ advance_width == 6 * one_pixel && ++ rightmost_point + modulus - delta ++ <= ( width - (columns_per_pixel * 2) / 3) * 256 && ++ ppem == 11 ) ++ *translate_value = ( modulus - delta ) / ( columns_per_pixel * 4 ); ++ } ++ ++ if ( strategy_use_strengths ) ++ { ++ /* consider 1/2 pixel the max when strength is at 100%, ++ unless translate is already greater than that */ ++ FT_Int strength_cutoff = 32; ++ if ( abs ( *translate_value ) > strength_cutoff ) ++ strength_cutoff = *translate_value; ++ ++ max_strength = ( strength_cutoff * alignment_strength ) / 100; ++ ++ if ( *translate_value < -max_strength ) ++ *translate_value = -max_strength; ++ else if ( *translate_value > max_strength ) ++ *translate_value = max_strength; ++ } ++ ++ /* If 2 stems is detected, scale distance ++ between in order to land on pixels */ ++ if ( valid_stems >= 2 ) ++ { ++ stem_distance = abs ( stems[1].center - stems[0].center ); ++ ++ delta = stem_distance % modulus; ++ new_distance = stem_distance - delta; ++ ++ distance_floor = stem_distance - delta; ++ distance_ceiling = stem_distance + ( modulus - delta ); ++ ++ if ( delta < modulus / 2 ) ++ new_distance = distance_floor; ++ else ++ new_distance = distance_ceiling; ++ ++ if ( columns_per_pixel == 3 && ++ valid_stems == 3 && ++ strategy_use_m_control && ++ ( width - 2 * columns_per_pixel ) > 6 * columns_per_pixel && ++ ppem > 8 && ++ ( advance_stem_location - advance_leftmost_location ) ++ < stems[main_stem].width * 2 ) ++ { ++ /* Possibly use 2 only when compatible widths is on? */ ++ FT_Int mod_factor = 2; ++ ++ if ( verbose ) ++ printf ( "USING M CONTROL "); ++ ++ distance_floor = stem_distance ++ - stem_distance % ( modulus * mod_factor ) ; ++ distance_ceiling = distance_floor + modulus * mod_factor; ++ ++ new_distance = distance_ceiling; ++ ++ /* force certain ideal situations */ ++ /* these 2 are mostly safe to do */ ++ if ( distance_ceiling ++ + one_pixel * columns_per_pixel == advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ /* NEED TO FIGURE OUT A WAY TO DETERMINE WHETHER ++ THAT NUDGE IS UP OR DOWN */ ++ else if ( stem_distance + one_pixel * 2.6 >= advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ ++ if ( proposed_transformed_point ( leftmost_point ) ++ < one_third_pixel * 2 || ++ proposed_transformed_point ( rightmost_point ) ++ > ( width -2 ) * one_third_pixel ) ++ new_distance = distance_floor; ++ ++ /* NEED TO IGNORE SERIF Ms HERE */ ++ /* perhaps check bitmap boundaries instead??? */ ++ if ( strategy_bearing_correction && new_distance == distance_ceiling ) ++ { ++ /* Correct if bearings are made substantially worse ++ (more than 1/3 a pixel beyond advance) */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ > advance_width + one_third_pixel && ++ proposed_transformed_point( advance_rightmost_location ) ++ > advance_rightmost_location && ++ -proposed_transformed_point( advance_leftmost_location ) ++ < advance_rightmost_location - advance_width ) ++ new_distance = distance_floor; ++ } ++ ++ if ( known_stem_values->m >= 0 ) ++ { ++ if ( known_stem_values->m == 0 ) ++ new_distance = distance_floor; ++ else ++ new_distance = distance_ceiling; ++ } ++ ++ if ( ( rightmost_point - leftmost_point) - ++ ( ( rightmost_point * *scale_value) ++ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 ) ++ { ++ *scale_value = 1.0; ++ *translate_value = 0; ++ goto Exit; ++ } ++ ++ } ++ else if ( columns_per_pixel == 1 && ++ valid_stems == 3 && ++ strategy_use_m_control && valid_stems == 3 && ++ width >= 6 * columns_per_pixel && ++ ppem > 8 && ++ ( advance_stem_location - advance_leftmost_location ) ++ < stems[main_stem].width * 2 ) ++ { ++ /* Possibly use 2 only when compatible widths is on? */ ++ FT_Int mod_factor = 2; ++ ++ if ( verbose ) ++ printf ("USING M CONTROL "); ++ distance_floor = stem_distance - stem_distance ++ % ( modulus * mod_factor) ; ++ distance_ceiling = distance_floor + modulus * mod_factor; ++ ++ new_distance = distance_ceiling; ++ ++ /* force certain ideal situations */ ++ /* these 2 are mostly safe to do */ ++ if ( distance_ceiling ++ + one_pixel * columns_per_pixel == advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ /* NEED TO FIGURE OUT A WAY TO DETERMINE WHETHER ++ THAT NUDGE IS UP OR DOWN */ ++ else if ( stem_distance + one_pixel * 2.6 >= advance_width && ++ stem_width < one_pixel * 1.25 ) ++ new_distance = distance_ceiling; ++ ++ if ( proposed_transformed_point( leftmost_point ) < 0 || ++ proposed_transformed_point( rightmost_point ) ++ > width * one_pixel - 2 * one_third_pixel ) ++ new_distance = distance_floor; ++ ++ /* NEED TO IGNORE SERIF Ms HERE */ ++ /* perhaps check bitmap boundaries instead??? */ ++ if ( strategy_bearing_correction && new_distance == distance_ceiling ) ++ { ++ /* Correct if bearings are made substantially worse ++ (more than 1/3 a pixel beyond advance) */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ > advance_width + one_third_pixel && ++ proposed_transformed_point( advance_rightmost_location ) ++ > advance_rightmost_location && ++ -proposed_transformed_point( advance_leftmost_location ) ++ < advance_rightmost_location - advance_width ) ++ new_distance = distance_floor; ++ } ++ ++ if ( known_stem_values->m >= 0 ) ++ { ++ if ( known_stem_values->m == 0 ) ++ new_distance = distance_floor; ++ else ++ new_distance = distance_ceiling; ++ } ++ ++ ++ if ( ( rightmost_point - leftmost_point ) ++ - ( ( rightmost_point * *scale_value ) ++ - ( leftmost_point * *scale_value ) ) >= one_pixel * 1.5 ) ++ { ++ *scale_value = 1.0; ++ *translate_value = 0; ++ goto Exit; ++ } ++ ++ } ++ else ++ { ++ if ( strategy_fit_to_width ) ++ new_distance = advance_width - 3 * one_pixel; ++ else if ( known_stem_values->stem_scaling >= 0 ) ++ { ++ if ( known_stem_values->stem_scaling > 0 ) ++ new_distance = distance_ceiling; ++ else ++ new_distance = distance_floor; ++ ++ /* enforce advance width boundaries */ ++ /* TOO RESTRICTIVE ON SERIF FONTS */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ >= advance_width || ++ proposed_transformed_point( advance_leftmost_location ) ++ <= 0 ) ++ new_distance = distance_floor; ++ ++ /* enforce literal bitmap boundaries if no translate room */ ++ if ( ( proposed_transformed_point(rightmost_point) >= width * 256 ++ || proposed_transformed_point(leftmost_point ) <= one_pixel ) ++ && new_distance + one_pixel * 3 > advance_width ) ++ new_distance = distance_floor; ++ ++ } ++ else if ( strategy_translate_using_closest_stem ) ++ { ++ /* closest snapping point for stem 1 */ ++ delta2 = ( stems[1].center + center_offset ) % modulus; ++ ++ if ( delta2 < modulus / 2 ) ++ /* snap left */ ++ translate_value2 = -delta2 / ( columns_per_pixel * 4 ); ++ else ++ /* snap right */ ++ translate_value2 = ( modulus - delta2 ) ++ / ( columns_per_pixel * 4 ); ++ ++ if ( abs ( translate_value2 ) < abs ( *translate_value ) ) ++ { ++ *translate_value = translate_value2; ++ main_stem = 1; ++ } ++ ++ } ++ else if ( strategy_scale_to_closest_centers ) ++ { ++ /* closest snapping point for stem 0 */ ++ delta = ( stems[0].center + center_offset ) % modulus; ++ delta2 = ( stems[1].center + center_offset ) % modulus; ++ ++ if ( delta < modulus / 2 ) ++ /* stretch left */ ++ new_distance = delta + stem_distance; ++ else ++ /* stretch right */ ++ new_distance = delta - modulus + stem_distance; ++ ++ if ( delta2 < modulus / 2 ) ++ new_distance -= delta2; /* stretch left */ ++ else ++ new_distance += modulus - delta2; /* stretch right */ ++ ++ } ++ else if ( strategy_scale_to_closest_centers_up_only ) ++ { ++ FT_Int net_change = 0; ++ ++ /* closest snapping point for stem 0 */ ++ delta = ( stems[0].center + center_offset ) % modulus; ++ delta2 = ( stems[1].center + center_offset ) % modulus; ++ ++ if ( delta < modulus / 2 ) ++ net_change = delta; /* stretch left */ ++ else ++ net_change = -( modulus - delta ); /* stretch right */ ++ ++ if ( delta2 < modulus / 2 ) ++ net_change -= delta2; /* stretch left */ ++ else ++ net_change += modulus - delta2; /* stretch right */ ++ ++ if ( net_change > 0 && ++ proposed_transformed_point( advance_rightmost_location ) ++ < advance_width && ++ proposed_transformed_point( advance_leftmost_location ) > 0 ) ++ new_distance = distance_ceiling; ++ } ++ ++ else if ( strategy_always_use_distance_ceiling ) ++ { ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ < advance_width && ++ proposed_transformed_point( advance_leftmost_location ) > 0 ) ++ new_distance = distance_ceiling; ++ } ++ } ++ ++ if ( strategy_use_strengths ) ++ { ++ FT_Int strength_cutoff = center_offset; ++ ++ ++ delta2 = new_distance - stem_distance; ++ ++ if ( abs ( delta2 ) > strength_cutoff ) ++ strength_cutoff = delta2; ++ ++ max_strength = ( strength_cutoff * fitting_strength ) / 100; ++ ++ if ( delta2 < -max_strength ) ++ new_distance = stem_distance - max_strength; ++ else if ( delta2 > max_strength ) ++ new_distance = stem_distance + max_strength; ++ } ++ ++ *scale_value = (float)( new_distance ) / (float)( stem_distance ); ++ *translate_value = *translate_value ++ - ( (float)( stems[main_stem].center * (float)new_distance ) ++ / (float)stem_distance - stems[main_stem].center ) / 12; ++ ++ if ( valid_stems == 2 ) ++ *embolden_value = ( 64.0 / *scale_value - 64.0 ); ++ ++ if ( valid_stems == 3 ) ++ *embolden_value = ( 64.0 / *scale_value - 64.0 ) / 1.5; ++ } ++ ++ if ( verbose ) ++ printf ( "%lu stems:", valid_stems ); ++ ++ if ( valid_stems == 1 && verbose ) ++ printf ( "1 stem: bitmapwidth:%d glyphwidth:%f glyph_width:%f center:%f bearing:%f advance:%f lhadvance:%f stemwidth:%f %d %d", ++ (width - 6) / columns_per_pixel, ++ (float)m_width / 64.0, ++ (float)glyph_width / (float)one_pixel, ++ (float)( (float)advance_stem_location ) / (float)one_pixel, ++ (float)m_horiBearingX / 64.0, ++ (float)m_horiAdvance / 64.0, ++ (float)linearHoriAdvance / 64.0, ++ (float)stems[0].width / (float)one_pixel, ++ advance_width, original_advance_width ); ++ else if ( valid_stems >= 2 && verbose ) ++ printf ( "%lu stems: bitmapwidth:%d center1:%f center2:%f difference:%f bearing:%f advance:%f advstemloc:%f ", ++ valid_stems, ++ (width - 6) / columns_per_pixel, ++ ( (float)advance_stem_location ) / (float)one_pixel, ++ ( (float)advance_stem_location ++ + (float)abs ( stems[1].center ++ - stems[0].center) ) / (float)one_pixel, ++ ( (float)abs ( stems[1].center ++ - stems[0].center ) ) / (float)one_pixel, ++ (float)m_horiBearingX / 64.0, ++ (float)m_horiAdvance / 64.0, ++ (float)advance_stem_location / (float)one_pixel ); ++ ++ if ( strategy_bearing_correction ) ++ { ++ /* Correct if negative bearings are made substantially worse */ ++ /* (more than 1/3 a pixel) */ ++ if ( proposed_transformed_point( advance_rightmost_location ) ++ > advance_width && ++ proposed_transformed_point( advance_rightmost_location ) ++ > advance_rightmost_location && ++ -proposed_transformed_point( advance_leftmost_location ) ++ < advance_rightmost_location - advance_width && ++ *translate_value ++ > one_third_pixel / ( columns_per_pixel * 4 ) ) ++ { ++ *translate_value -=64 ; ++ if ( verbose ) ++ printf ( "TRANSLATING -64 " ); ++ } ++ } + goto Exit; + } + +- if ( matrix ) +- FT_Outline_Transform( &slot->outline, matrix ); ++ Exit: + +- if ( delta ) +- FT_Outline_Translate( &slot->outline, delta->x, delta->y ); ++#define transformed_point( point ) point * *scale_value + *translate_value * 12 + +- Exit: +- return error; ++ if ( strategy_correct_out_of_bounds_outlines ) ++ { ++ /* Correct if outside bitmap */ ++ if ( transformed_point( rightmost_point ) ++ >= width * 256 - 2 * one_third_pixel && ++ transformed_point( leftmost_point ) ++ > one_pixel + 2 * one_third_pixel ) ++ *translate_value -=64 ; ++ else if ( transformed_point( leftmost_point ) ++ <= one_pixel / 2 && ++ transformed_point( rightmost_point ) ++ <= width * 256 - ( one_pixel + one_pixel / 2 ) ) ++ *translate_value += 64; ++ } ++ ++ STVALUES ++ free ( centers ); ++ free ( segments ); ++ free ( stem_centers ); ++ free ( stems ); ++ free ( leftmost_segment ); + } + + +- /* return the glyph's control box */ ++ /* Gamma correction */ + static void +- ft_smooth_get_cbox( FT_Renderer render, +- FT_GlyphSlot slot, +- FT_BBox* cbox ) ++ _ft_lcd_gamma_correction_correction ( FT_Bitmap* bitmap, ++ FT_Render_Mode mode, ++ FT_GlyphSlot slot, ++ float gamma_correction_lt, ++ float gamma_correction_value ) + { +- FT_ZERO( cbox ); ++ if ( gamma_correction_value != 1.0 ) ++ { ++ FT_UInt width = (FT_UInt)bitmap->width; ++ FT_UInt height = (FT_UInt)bitmap->rows; ++ FT_Byte* line = bitmap->buffer; ++ float ppem = (float)slot->face->size->metrics.x_ppem; + +- if ( slot->format == render->glyph_format ) +- FT_Outline_Get_CBox( &slot->outline, cbox ); ++ ++ if ( !slot->face || !slot->face->size ) return; ++ ++ if ( ppem >= 5 ) ++ for ( height = (FT_UInt)bitmap->rows; ++ height > 0; ++ height--, line += bitmap->pitch ) ++ { ++ FT_UInt xx; ++ ++ ++ for ( xx = 0; xx < width; xx += 1 ) ++ { ++ /*normal*/ ++ /*line[xx] = pseudo_gamma ( line[xx], gamma_correction_value );*/ ++ ++ /* sloped */ ++ /*line[xx] = pseudo_gamma ( line[xx], gamma_correction_value - 5 ++ * (1-gamma_correction_value)/(gamma_correction_lt -5) ++ + ((1-gamma_correction_value)/(gamma_correction_lt -5)) * ppem );*/ ++ ++ /* 1/3-sloped */ ++ line[xx] = pseudo_gamma ( line[xx], gamma_correction_value - 5 ++ * ( ( 1 - gamma_correction_value ) ++ / ( 3 * ( gamma_correction_lt -5 ) ) ) ++ + ( ( 1 - gamma_correction_value ) ++ / ( 3 * ( gamma_correction_lt -5) ) ) * ppem ); ++ } ++ } ++ } + } + ++#endif + + /* convert a slot's glyph image into a bitmap */ + static FT_Error +@@ -103,24 +2328,162 @@ + FT_Render_Mode required_mode ) + { + FT_Error error; +- FT_Outline* outline = &slot->outline; +- FT_Bitmap* bitmap = &slot->bitmap; +- FT_Memory memory = render->root.memory; ++ FT_Outline* outline = NULL; ++ FT_Outline* outline_orig = NULL; + FT_BBox cbox; +- FT_Pos x_shift = 0; +- FT_Pos y_shift = 0; +- FT_Pos x_left, y_top; +- FT_Pos width, height, pitch; ++ FT_Pos width, height, pitch, ppem; + #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + FT_Pos height_org, width_org; + #endif ++ FT_Bitmap* bitmap = &slot->bitmap; ++ FT_Memory memory = render->root.memory; + FT_Int hmul = ( mode == FT_RENDER_MODE_LCD ); + FT_Int vmul = ( mode == FT_RENDER_MODE_LCD_V ); ++ FT_Pos x_shift = 0; ++ FT_Pos y_shift = 0; ++ FT_Pos x_left, y_top; + + FT_Raster_Params params; + +- FT_Bool have_outline_shifted = FALSE; +- FT_Bool have_buffer = FALSE; ++ FT_Bool have_translated_origin = FALSE; ++ FT_Bool have_outline_shifted = FALSE; ++ FT_Bool have_buffer = FALSE; ++ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ FT_Matrix scaleMat; ++ FT_Long translate_value = 0; ++ float scale_value = 1.0; ++ FT_Int align_called = 0; ++ ++ ++ int chromeos_style_sharpening_strength = 0; ++ int alignment_strength = 0; ++ int fitting_strength = 0; ++ int fringe_filter_strength = 0; ++ int grayscale_filter_strength = 0; ++ ++ int autohint_horizontal_stem_darken_strength = 0; ++ int autohint_vertical_stem_darken_strength = 0; ++ ++ int windows_style_sharpening_strength = 0; ++ float gamma_correction_value = 1; ++ float gamma_correction_lt = 0; ++ ++ FT_Int brightness_value = 0.0; ++ FT_Int contrast_value = 0.0; ++ ++ FT_Int snapping_sliding_scale_value = 0; ++ ++ FT_Int global_embolden_x_value = 0; ++ FT_Int global_embolden_y_value = 0; ++ ++ FT_Int bold_embolden_x_value = 0; ++ FT_Int bold_embolden_y_value = 0; ++ ++ FT_Byte chromeos_cutoff; ++ double chromeos_gamma_value; ++ ++ float embolden_value = 0.0; ++ FT_Bool autohinted = FALSE; ++ FT_Bool use_various_tweaks = FALSE; ++ FT_Pos cur_width = infinality_cur_width; ++ ++ const FT_Int MIN_PPEM = 1; ++ /*const FT_Int MAX_PPEM = 100; */ ++ ++ FT_Bool use_known_settings_on_selected_fonts; ++ ++ if ( slot->face && ++ slot->face->size && ++ slot->face->size->metrics.x_ppem ) ++ ppem = slot->face->size->metrics.x_ppem; ++ else ++ ppem = 0; ++ ++ if ( cur_width ) ++ { ++ autohinted = TRUE; ++ } ++ if( ftinf ){ ++ const float *f=ftinf->gamma_correction; ++ ++ use_known_settings_on_selected_fonts=ftinf->use_known_settings_on_selected_fonts; ++ use_various_tweaks=ftinf->use_various_tweaks; ++ snapping_sliding_scale_value=ftinf->stem_snapping_sliding_scale; ++ ++ alignment_strength=ftinf->stem_alignment_strength; ++ if ( snapping_sliding_scale_value != 0 ) ++ alignment_strength = sliding_scale(10, snapping_sliding_scale_value, alignment_strength, 100, ppem); ++ ++ fitting_strength=ftinf->stem_fitting_strength; ++ if ( snapping_sliding_scale_value != 0 ) ++ fitting_strength = sliding_scale(10, snapping_sliding_scale_value, fitting_strength, 100, ppem); ++ ++ chromeos_style_sharpening_strength=ftinf->chromeos_style_sharpening_strength; ++ ++ if ( ppem > 10 ) ++ chromeos_style_sharpening_strength = ++ ( chromeos_style_sharpening_strength * ppem ) / 10; ++ ++ if ( chromeos_style_sharpening_strength > 100 ) ++ chromeos_style_sharpening_strength = 100; ++ ++ brightness_value=ftinf->brightness; ++ contrast_value=ftinf->contrast; ++ ++ windows_style_sharpening_strength=ftinf->windows_style_sharpening_strength; ++ ++ /* Decrease effect slightly to have a more linear increase in sharpness */ ++ windows_style_sharpening_strength = ++ ( ( windows_style_sharpening_strength ++ * windows_style_sharpening_strength ) / 100 ++ + windows_style_sharpening_strength ) / 2; ++ ++ gamma_correction_lt = f[0]; ++ gamma_correction_value = f[1] / 100.0f; ++ ++ fringe_filter_strength=ftinf->fringe_filter_strength; ++ grayscale_filter_strength=ftinf->grayscale_filter_strength; ++ ++ autohint_horizontal_stem_darken_strength=ftinf->autohint_horizontal_stem_darken_strength; ++ autohint_vertical_stem_darken_strength=ftinf->autohint_vertical_stem_darken_strength; ++ ++ global_embolden_x_value=ftinf->global_embolden_x_value; ++ global_embolden_y_value=ftinf->global_embolden_y_value; ++ ++ bold_embolden_x_value=ftinf->bold_embolden_x_value; ++ bold_embolden_y_value=ftinf->bold_embolden_y_value; ++ } else { ++ use_known_settings_on_selected_fonts=FALSE; ++ } ++ ++ /* set gamma value to 1 if out of range */ ++ if ( slot->face && ++ slot->face->size && ++ slot->face->size->metrics.x_ppem ) ++ { ++ if ( slot->face->size->metrics.x_ppem >= gamma_correction_lt ) ++ gamma_correction_value = 1; ++ } ++ else ++ gamma_correction_value = 1; ++ ++ if( use_various_tweaks && ++ slot->face && ++ slot->face->style_name ) ++ { ++ /* needs to also check for artifical italics */ ++ if ( strcasestr(slot->face->style_name, "Italic" ) || ++ strcasestr(slot->face->style_name, "Oblique" ) ) ++ { ++ windows_style_sharpening_strength = 0; ++ chromeos_style_sharpening_strength = 0; ++ } ++ } ++ ++ /*if (fitting_strength == 100) scale_value = 1.1;*/ ++ ++#endif + + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + +@@ -191,26 +2554,119 @@ + goto Exit; + } + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++RERENDER: ++ if ( align_called == 1 ) ++ { ++ scaleMat.xx = FT_FixedFromFloat(scale_value); ++ scaleMat.xy = 0; ++ scaleMat.yx = 0; ++ scaleMat.yy = ( 1 << 16 ); ++ ++ FT_Outline_Copy(outline_orig, outline); ++ ++ if ( scale_value != 1.0 ) ++ FT_Outline_Transform( outline, &scaleMat ); ++ ++ FT_Outline_Translate( outline, translate_value, 0 ); ++ ++ FT_Outline_EmboldenXY( outline, embolden_value, 0 ); ++ } ++ else ++ { ++#endif ++ outline = &slot->outline; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ /* Need to get this PRIOR to embolden, otherwise bad things happen */ ++ FT_Outline_Get_CBox( outline, &cbox ); ++ ++ /* Various hacks that need to be turned into a new rule set */ ++ /*if ( !autohinted ++ && use_known_settings_on_selected_fonts ++ && mode == FT_RENDER_MODE_LCD ++ && slot->face->family_name ++ && slot->face->style_name ++ && ( strcasestr(slot->face->family_name, "Courier New" ) ++ && ( strcasestr(slot->face->style_name, "Regular" ) ++ || strcasestr(slot->face->style_name, "Italic" ) ) ) ) ++ FT_Outline_Embolden( outline, 24 );*/ ++ ++ if ( slot->face ) ++ { ++ if ( !autohinted && ++ use_known_settings_on_selected_fonts && ++ mode == FT_RENDER_MODE_LCD && ++ slot->face->family_name && ++ slot->face->style_name && ++ strcasestr( slot->face->family_name, "Times New Roman" ) && ++ strcasestr( slot->face->style_name, "Italic" ) ) ++ FT_Outline_EmboldenXY( outline, 12, 0 ); ++ ++ if ( use_known_settings_on_selected_fonts && ++ autohinted && ++ mode == FT_RENDER_MODE_LCD && ++ slot->face->family_name && ++ slot->face->style_name && ++ strcasestr(slot->face->family_name, "FreeSerif" ) && ++ strcasestr(slot->face->style_name, "Italic" ) ) ++ FT_Outline_EmboldenXY( outline, 8, 0 ); ++ ++ if ( global_embolden_x_value != 0 || global_embolden_y_value != 0 ) ++ FT_Outline_EmboldenXY( outline, ++ global_embolden_x_value, ++ global_embolden_y_value ); ++ ++ if ( ( bold_embolden_x_value != 0 || bold_embolden_y_value != 0 ) && ++ ( slot->face->style_name && ++ ( strcasestr(slot->face->style_name, "Bold" ) || ++ strcasestr(slot->face->style_name, "Black" ) || ++ ( slot->face->style_flags && ++ slot->face->style_flags & FT_STYLE_FLAG_BOLD ) ) ) ) ++ FT_Outline_EmboldenXY( outline, ++ bold_embolden_x_value, ++ bold_embolden_y_value ); ++ } ++ ++ FT_Outline_Copy( outline, outline_orig ); ++ } ++ ++ /* translate the outline to the new origin if needed */ ++ if ( align_called == 0 ) ++ { ++ FT_Pos enlarge_cbox = 0; ++ ++ /* enlarge for grayscale rendering */ ++ if ( mode == FT_RENDER_MODE_NORMAL ) ++ enlarge_cbox = 64; ++ ++ if ( origin ) ++ { ++ FT_Outline_Translate( outline, origin->x, origin->y ); ++ have_translated_origin = TRUE; ++ } ++ ++ /* compute the control box, and grid fit it */ ++ /*FT_Outline_Get_CBox( outline, &cbox );*/ ++ ++ cbox.xMin = FT_PIX_FLOOR( cbox.xMin - enlarge_cbox ); ++ cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); ++ cbox.xMax = FT_PIX_CEIL( cbox.xMax + enlarge_cbox ); ++ cbox.yMax = FT_PIX_CEIL( cbox.yMax ); ++#else + if ( origin ) + { +- x_shift = origin->x; +- y_shift = origin->y; ++ FT_Outline_Translate( outline, origin->x, origin->y ); ++ have_translated_origin = TRUE; + } + + /* compute the control box, and grid fit it */ +- /* taking into account the origin shift */ + FT_Outline_Get_CBox( outline, &cbox ); + +- cbox.xMin = FT_PIX_FLOOR( cbox.xMin + x_shift ); +- cbox.yMin = FT_PIX_FLOOR( cbox.yMin + y_shift ); +- cbox.xMax = FT_PIX_CEIL( cbox.xMax + x_shift ); +- cbox.yMax = FT_PIX_CEIL( cbox.yMax + y_shift ); +- +- x_shift -= cbox.xMin; +- y_shift -= cbox.yMin; +- +- x_left = cbox.xMin >> 6; +- y_top = cbox.yMax >> 6; ++ cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); ++ cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); ++ cbox.xMax = FT_PIX_CEIL( cbox.xMax ); ++ cbox.yMax = FT_PIX_CEIL( cbox.yMax ); ++#endif + + width = (FT_ULong)( cbox.xMax - cbox.xMin ) >> 6; + height = (FT_ULong)( cbox.yMax - cbox.yMin ) >> 6; +@@ -220,22 +2676,35 @@ + height_org = height; + #endif + ++ /* release old bitmap buffer */ ++ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ++ { ++ FT_FREE( bitmap->buffer ); ++ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; ++ } ++ ++ /* allocate new one */ + pitch = width; + if ( hmul ) + { +- width *= 3; +- pitch = FT_PAD_CEIL( width, 4 ); ++ width = width * 3; ++ pitch = FT_PAD_CEIL( width, 4 ); + } + + if ( vmul ) + height *= 3; + ++ x_shift = cbox.xMin; ++ y_shift = cbox.yMin; ++ x_left = cbox.xMin >> 6; ++ y_top = cbox.yMax >> 6; ++ + #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING + if ( lcd_filter_func ) + { + if ( hmul ) + { +- x_shift += 64 * ( lcd_extra >> 1 ); ++ x_shift -= 64 * ( lcd_extra >> 1 ); + x_left -= lcd_extra >> 1; + width += 3 * lcd_extra; + pitch = FT_PAD_CEIL( width, 4 ); +@@ -243,23 +2712,16 @@ + + if ( vmul ) + { +- y_shift += 64 * ( lcd_extra >> 1 ); ++ y_shift -= 64 * ( lcd_extra >> 1 ); + y_top += lcd_extra >> 1; + height += 3 * lcd_extra; + } + } + #endif +- +- /* +- * XXX: on 16bit system, we return an error for huge bitmap +- * to prevent an overflow. +- */ +- if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX || +- x_left < FT_INT_MIN || y_top < FT_INT_MIN ) +- { +- error = FT_THROW( Invalid_Pixel_Size ); +- goto Exit; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET + } ++#endif ++ + + /* Required check is (pitch * height < FT_ULONG_MAX), */ + /* but we care realistic cases only. Always pitch <= width. */ +@@ -271,6 +2733,22 @@ + goto Exit; + } + ++ bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; ++ bitmap->num_grays = 256; ++ bitmap->width = (unsigned int)width; ++ bitmap->rows = (unsigned int)height; ++ bitmap->pitch = pitch; ++ ++ /* translate outline to render it into the bitmap */ ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( align_called == 0 ) ++ { ++#endif ++ FT_Outline_Translate( outline, -x_shift, -y_shift ); ++ have_outline_shifted = TRUE; ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ } ++#endif + /* release old bitmap buffer */ + if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + { +@@ -278,7 +2756,6 @@ + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } + +- /* allocate new one */ + if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) ) + goto Exit; + else +@@ -286,23 +2763,6 @@ + + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + +- slot->format = FT_GLYPH_FORMAT_BITMAP; +- slot->bitmap_left = (FT_Int)x_left; +- slot->bitmap_top = (FT_Int)y_top; +- +- bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; +- bitmap->num_grays = 256; +- bitmap->width = (unsigned int)width; +- bitmap->rows = (unsigned int)height; +- bitmap->pitch = pitch; +- +- /* translate outline to render it into the bitmap */ +- if ( x_shift || y_shift ) +- { +- FT_Outline_Translate( outline, x_shift, y_shift ); +- have_outline_shifted = TRUE; +- } +- + /* set up parameters */ + params.target = bitmap; + params.source = outline; +@@ -348,8 +2808,152 @@ + if ( error ) + goto Exit; + ++#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET ++ if ( ppem <= MAX_PPEM && ppem >= MIN_PPEM ) ++ { ++ if ( align_called == 0 && cur_width / ppem < 10 && ++ ( alignment_strength > 0 || fitting_strength > 0 ) ) ++ _lcd_stem_align ( bitmap, ++ mode, ++ slot, ++ &translate_value, ++ &scale_value, ++ alignment_strength, ++ fitting_strength, ++ &embolden_value ); ++ ++ if ( align_called == 0 && ++ ( translate_value != 0 || scale_value != 1.0 ) ) ++ { ++ align_called = 1; ++ goto RERENDER; ++ } ++ ++ if ( mode == FT_RENDER_MODE_LCD ) ++ { ++ ++ if ( fringe_filter_strength > 0 /*&& autohinted*/ ) ++ _ft_lcd_fringe_filter( bitmap, ++ mode, ++ fringe_filter_strength, ++ slot->library ); ++ ++ /*if ( autohinted) ++ _ft_lcd_stem_end_filter( bitmap, mode, 100, slot->library );*/ ++ ++ if ( gamma_correction_lt > 0 && gamma_correction_value != 1.0 ) ++ _ft_lcd_gamma_correction_correction( bitmap, ++ mode, ++ slot, ++ gamma_correction_lt, ++ gamma_correction_value ); ++ ++ chromeos_cutoff = (FT_Byte)( 0.5 * 255.0 ) ++ * ( chromeos_style_sharpening_strength / 100.0 ); ++ chromeos_gamma_value = 1; ++ ++ if ( chromeos_style_sharpening_strength > 0 ) ++ _ft_lcd_chromeos_sharpen( bitmap, ++ mode, ++ chromeos_cutoff, ++ chromeos_gamma_value ); ++ ++ if ( ppem > 8 ) ++ if ( windows_style_sharpening_strength > 0 ) ++ _ft_lcd_windows_sharpen( bitmap, ++ mode, ++ windows_style_sharpening_strength, ++ slot->library ); ++ ++ if ( autohinted && ++ ( cur_width * 100 ) / 64 ++ > autohint_horizontal_stem_darken_strength && ++ autohint_horizontal_stem_darken_strength != 0 ) ++ autohint_horizontal_stem_darken_strength = ( cur_width * 100 ) / 64; ++ ++ if ( autohint_horizontal_stem_darken_strength > 100) ++ autohint_horizontal_stem_darken_strength = 100; ++ ++ /* only do on autohinted fonts */ ++ /* Necessary to do on some non-thin fonts, which is why it is outside */ ++ /* of the below conditional */ ++ if ( autohint_horizontal_stem_darken_strength > 0 && autohinted ) ++ _ft_lcd_darken_x ( bitmap, ++ mode, ++ autohint_horizontal_stem_darken_strength, ++ slot->library ); ++ ++ /* Enhance thin fonts */ ++ if ( autohinted ) ++ { ++ /* if forcibly set use that, otherwise make a good estimate */ ++ float contrast, brightness; ++ ftinf_get_bc( slot->face->family_name, ppem, &brightness, &contrast); ++ if ( slot->face && !_ft_bitmap_bc ( bitmap, brightness, contrast ) ) ++ { ++ FT_Bool is_fixed_name = FALSE; ++ ++ if ( slot->face->family_name && ++ strcasestr(slot->face->family_name, "Mono" ) ) ++ is_fixed_name = TRUE; ++ ++ /* Darken vertical stems */ ++ _ft_lcd_darken_y ( bitmap, ++ mode, ++ autohint_vertical_stem_darken_strength, ++ slot->library ); ++ ++ /* Adjust brightness / contrast automatically based on stem width */ ++ if ( cur_width != 0 && cur_width < 30 ) ++ cur_width = 30; ++ ++ if ( cur_width >= 30 && cur_width <= 60 ) ++ { ++ float ppem_factor = sliding_scale ( 5, 11, 0.0, 1.0, ppem ); ++ float brightness_factor = sliding_scale ( 30, 52, -.3, 0.0, ++ cur_width ); ++ float contrast_factor = sliding_scale ( 30, 52, .45, 0.0, ++ cur_width ); ++ _ft_bitmap_bc ( bitmap, ++ ppem_factor * brightness_factor, ++ ppem_factor * contrast_factor ); ++ ++ /* Only cap variable width thin-stemmed fonts */ ++ if ( !FT_IS_FIXED_WIDTH( slot->face ) && !is_fixed_name ) ++ _ft_bitmap_cap ( bitmap, ++ ( cur_width * 150 ) / 64, ++ slot->library ); ++ } ++ } ++ } ++ ++ ++ if ( lcd_filter_func ) ++ lcd_filter_func( bitmap, mode, lcd_weights ); ++ ++ if ( grayscale_filter_strength > 0 ) ++ _ft_lcd_grayscale_filter( bitmap, ++ mode, ++ grayscale_filter_strength, ++ slot->library ); ++ ++ } ++ ++ /* Global values */ ++ if ( brightness_value != 0 || contrast_value != 0 ) ++ _ft_bitmap_bc ( bitmap, ++ (float)brightness_value / 300.0, ++ (float)contrast_value / 300.0); ++ ++ FT_Outline_Done( slot->library, outline_orig ); ++ } ++ else if ( mode == FT_RENDER_MODE_LCD && ++ lcd_filter_func ) ++ lcd_filter_func( bitmap, mode, lcd_weights ); ++#else + if ( lcd_filter_func ) + lcd_filter_func( bitmap, mode, lcd_weights ); ++#endif /* FT_CONFIG_OPTION_INFINALITY_PATCHSET */ + + #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + +@@ -408,6 +3012,20 @@ + + #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ + ++ /* ++ * XXX: on 16bit system, we return an error for huge bitmap ++ * to prevent an overflow. ++ */ ++ if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX ) ++ { ++ error = FT_THROW( Invalid_Pixel_Size ); ++ goto Exit; ++ } ++ ++ slot->format = FT_GLYPH_FORMAT_BITMAP; ++ slot->bitmap_left = (FT_Int)x_left; ++ slot->bitmap_top = (FT_Int)y_top; ++ + /* everything is fine; don't deallocate buffer */ + have_buffer = FALSE; + +@@ -415,7 +3033,9 @@ + + Exit: + if ( have_outline_shifted ) +- FT_Outline_Translate( outline, -x_shift, -y_shift ); ++ FT_Outline_Translate( outline, x_shift, y_shift ); ++ if ( have_translated_origin ) ++ FT_Outline_Translate( outline, -origin->x, -origin->y ); + if ( have_buffer ) + { + FT_FREE( bitmap->buffer ); +diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c +index af31408..6380d83 100644 +--- a/src/truetype/ttinterp.c ++++ b/src/truetype/ttinterp.c +@@ -5753,6 +5753,7 @@ + + if ( exc->ignore_x_mode && + exc->GS.freeVector.x != 0 && ++ exc->GS.freeVector.y == 0 && + !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = 0; + } +-- +2.13.0 + diff -Nru freetype-2.7.1/debian/patches-freetype/series freetype-2.8/debian/patches-freetype/series --- freetype-2.7.1/debian/patches-freetype/series 2017-10-09 07:24:26.000000000 +0000 +++ freetype-2.8/debian/patches-freetype/series 2017-10-09 07:24:27.000000000 +0000 @@ -1,7 +1,6 @@ no-uninitialized-bbox.patch verbose-libtool.patch -freetype-config.diff CVE-2016-10244.patch 0001-Enable-table-validation-modules.patch -0002-infinality-2.7.1-2017.01.11.patch +0002-infinality-2.8-2017.05.24.patch freetype-2.1.7-backwards.compat.patch -F3 -p0 Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/freetype-2.7.1.tar.bz2 and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/freetype-2.7.1.tar.bz2 differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/freetype-2.8.tar.bz2 and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/freetype-2.8.tar.bz2 differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/freetype-doc-2.7.1.tar.bz2 and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/freetype-doc-2.7.1.tar.bz2 differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/freetype-doc-2.8.tar.bz2 and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/freetype-doc-2.8.tar.bz2 differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/ft2demos-2.7.1.tar.bz2 and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/ft2demos-2.7.1.tar.bz2 differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/ft2demos-2.8.tar.bz2 and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/ft2demos-2.8.tar.bz2 differ diff -Nru freetype-2.7.1/=unpacked-tar1=/bin/README freetype-2.8/=unpacked-tar1=/bin/README --- freetype-2.7.1/=unpacked-tar1=/bin/README 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/bin/README 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -This directory contains all executables for the FreeType demo programs diff -Nru freetype-2.7.1/=unpacked-tar1=/ChangeLog freetype-2.8/=unpacked-tar1=/ChangeLog --- freetype-2.7.1/=unpacked-tar1=/ChangeLog 2016-12-30 20:31:48.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/ChangeLog 1970-01-01 00:00:00.000000000 +0000 @@ -1,6108 +0,0 @@ -2016-12-30 Werner Lemberg - - * Version 2.7.1 released. - ========================= - - - Tag sources with `VER-2-7-1'. - - * README: Updated. - * src/*.1: Updated. - * src/ftinspect.pro: Updated. - -2016-12-27 Werner Lemberg - - [ftmulti] Minor. - - * src/ftmulti.c (Process_Event, main): If MM, round design - coordinates. - -2016-12-25 Werner Lemberg - - Fixes for clang++. - - * Makefile (COMPILE): Don't add `-std=c99' if using a C++ compiler. - - * src/ftbench.c (_GNU_SOURCE): Declare only if not already defined. - - * src/ftcommon.c (_GNU_SOURCE): Declare only if not already defined. - (FTDemo_Install_Font): Use proper case for `FT_Select_Charmap'. - - * src/ftmulti.c (main): Use proper case for `FT_Select_Charmap'. - -2016-12-20 Werner Lemberg - - * src/ftmulti.c: Minor clang fixes. - -2016-12-19 Werner Lemberg - - [ftmulti] Support multiple engines. - - Similar to other programs, use the `H' key to cycle through engines - (if available). - - * src/ftmulti.c: Include FT_FONT_FORMATS_H, FT_MODULE_H, - FT_TRUETYPE_DRIVER_H, FT_CFF_DRIVER_H. - (N_CFF_HINTING_ENGINES): New macro. - (cff_hinting_engine, tt_interpreter_versions, - num_tt_interpreter_versions, tt_interpreter_version_idx, - font_format): New global variables. - (Help): Updated. - (cff_hinting_engine_change, tt_interpreter_version_change): New - functions. - (Process_Event): Handle key `H'. - (main): Set up selection of CFF and TrueType engine versions. - Display selected engine. - Force redisplay of current font if `H' key was pressed. - -2016-11-06 Werner Lemberg - - * src/ftbench.c (main): Adjust size argument for bitmap strikes. - - For bitmap-only fonts we enforce the selection of the first bitmap - strike size. - This commit also fixes the `size' value itself. - -2016-10-29 Werner Lemberg - - Minor compilation issues. - - * Makefile: Use ANSIFLAGS and select C99 for GNU-like compilers. - - * src/ftbench.c, src/ftcommon.c (_GNU_SOURCE): Define. We use - functionality not covered by ANSI. - -2016-10-29 Werner Lemberg - - Fix clang warnings. - - We now have a new `FT_ENCODING_OTHER' tag used for internal - purposes. Since it is not possible to extend an enumeration after - its definition, replace `FT_Encoding' types with `unsigned long'. - - * src/ftcommon.c (FTDemo_Make_Encoding_Tag): Updated. - * src/ftcommon.h (FTDemo_Handle): Ditto. - - * src/ftmulti.c (encoding): Use `unsigned long'. - (main): Updated. - - * src/ftstring.c (Sample): Make array of type `const char*'. - (status): Use `unsigned long' for `encoding' field. - Use `const char*' for `text' field. - - * src/ftview.c (status): Use `unsigned long' for `encoding'. - (FT_ENCODING_OTHER): Use `unsigned long'. - -2016-10-18 Alexei Podtelezhnikov - - [graph] Untested legacy 15/16-bit color fixes. - - Our tools do not use the legacy 15/16-bit color modes. This is mostly - for the sake of correctness. We might also remove the code. - - * graph/grblit.c (blit_gray{8,}_to_{555,565}): Updated. - * graph/x11/grx11.c (gr_x11_format_{bgr565,rgb555,bgr555}): Updated. - -2016-10-13 Alexei Podtelezhnikov - - * graph/grblit.c (blit_lcd28_to_24): Typo. - -2016-10-10 Alexei Podtelezhnikov - - * src/ftdump.c (Print_Charmaps): Dump format info. - -2016-10-09 Alexei Podtelezhnikov - - [ftview] Recognize other charmaps. - - * src/ftview.c (event_change_encoding): Recognize when - FT_ENCODING_NONE has special other meaning. - (write_header): Default case for `status.encoding'. - -2016-10-07 Alexei Podtelezhnikov - - [ftview] Fix charmap cycling. - - * src/ftview.c (event_change_encoding): Reimplement relying on - `cmap_index' field in TFont structure. - -2016-10-05 Alexei Podtelezhnikov - - [ftview] Implement cycling through available charmaps. - - * src/ftview.c (event_change_encoding): New function. - (Process_Event): New [Tab] event to cycle through available charmaps, - also increase index steps to 16, 256, and 4096. - (event_help): Updated. - -2016-10-03 Alexei Podtelezhnikov - - * graph/grevents.h (grKey): Typo. - -2016-10-01 İsmail Dönmez - - * src/ftinspect.pro (LIBS): Fix default value. - -2016-09-24 Alexei Podtelezhnikov - - [ftstring] Add LGC and CJK sample strings. - - * src/ftstring.c (event_text_change): New function. - (Process_Event): New [Tab] event to cycle through sample strings. - (event_help): Offer it. - (status, event_font_change, main): Updated. - -2016-09-16 Werner Lemberg - - * src/ftbench.1: Improve. - -2016-09-08 Werner Lemberg - - * Version 2.7 released. - ======================= - - - Tag sources with `VER-2-7'. - - * README: Updated. - * src/*.1: Updated. - * src/ftinspect.pro: Updated. - -2016-08-20 Alexei Podtelezhnikov - - * src/ftdump.c (Print_Programs): Use fewer casts. - -2018-08-19 Werner Lemberg - - [ftdump] Fix clang compiler warnings. - - * src/ftdump.c (Print_Bytecode): Use cast instead of printf length - modifier – we would need `hh', which only glibc offers. - (Print_Programs): Use proper casts for constant strings and 16bit - integer types. - -2018-08-19 Werner Lemberg - - [ftgamma] Fix compiler warnings. - - * src/ftgamma.c (bit1, bit2, bit): Make them static. - -2016-08-18 Alexei Podtelezhnikov - - [ftdump] Hexdump composite glyf instructions too. - - * src/ftdump.c (Print_Programs): Updated. - (Print_Bytecode): Cleaned up. - -2016-08-18 Alexei Podtelezhnikov - - [ftdump] Implement hexdump of TrueType instructions. - - This is useful when searching for interesting instructions. Pushed - values come with underscore prefix to distinguish them from actual - opcodes. - - * src/ftdump.c (Print_Bytecode, Print_Programs): Implement this. - (usage): New option `-p' described. - (main): Updated. - * src/ftdump.1: Updated. - -2016-08-06 Werner Lemberg - - Move Mark Leisher's `getopt' implementation to a separate file. - - We need this since `ftbench.c' now includes `unistd.h', which in - turn declares `getopt'. - - * src/common.c, src/common.h: Move `getopt' stuff to... - * src/mlgetopt.c, src/mlgetopt.h: ... these new files. - Update all callers. - - * src/common.c, src/common.h: Use standard C only. - Replace `CONST' with `const'. - - * Makefile (COMMON_OBJ): Add `mlgetopt'. - -2016-08-02 Alexei Podtelezhnikov - - * src/ftbench.c (get_time, benchmark): Clean up timers. - -2016-08-01 Alexei Podtelezhnikov - - [ftbench] Use POSIX timers when available. - - * src/ftbench.c (get_time): Use `clock_gettime' instead of obsolete - and less accurate `gettimeofday'. - (benchmark): Updated. - -2016-07-14 Werner Lemberg - - [ftgrid] New option `-d' to give start-up design coordinates. - - This code is similar to the one from `ftmulti'. - - * src/ftgrid.c: Include `stdlib.h'. - (GridStatusRec): Add `requested_pos' and `reqested_cnt' to hold the - design coordinate data from the command line. - (event_font_change): Handle them. - (parse_cmdline): Handle option `-d'. - (usage): Document `-d'. - (main): Don't load named instances if we have start-up design - coordinates. - - * src/ftgrid.1: Updated. - -2016-07-14 Werner Lemberg - - Prepare suppression of named instances. - - No functional change. - - * src/ftcommon.c (FTDemo_Install_Font): Add boolean parameter to - avoid loading of instances. - * src/ftcommon.h: Updated. - * src/ftgrid.c (main), src/ftstring.c (main), src/ftview.c (main): - Updated. - -2016-07-14 Werner Lemberg - - [ftgrid] Properly handle named instances. - - * src/ftgrid.c (event_font_change): Properly initialize the design - positions with the named instance's value, if appropriate. - -2016-07-12 Werner Lemberg - - * Version 2.6.5 released. - ========================= - - - Tag sources with `VER-2-6-5'. - - * README: Updated. - * src/*.1: Updated. - * src/ftinspect.pro: Updated. - -2016-07-05 Werner Lemberg - - * Version 2.6.4 released. - ========================= - - - Tag sources with `VER-2-6-4'. - - * README: Updated. - * src/*.1: Updated. - * src/ftinspect.pro: Updated. - -2016-06-26 Werner Lemberg - - [ftinspect] Fix pixel box drawing. - - This commit circumvents a problem with Qt's `QPainter::drawImage' - function; it seems that the alignment of the output becomes - imprecise at high magnification values. - - * src/ftinspect.c (GlyphBitmap::paint): Manually draw pixel boxes - with `fillRect'. - -2016-05-29 Werner Lemberg - - * src/ftbench.c (main): Add cast to remove compiler warning. - -2016-05-29 Werner Lemberg - - [ftinspect] Mark pixel centers in the grid with a cross. - - * src/ftinspect.c (Grid::paint): Implement it. - -2016-05-29 Werner Lemberg - - [ftinspect] Prepare zoom for drawing pixel center. - - This change makes the zoom use only even values larger than a given - threshold; it also implements (kind of) logarithmic zooming. - - * src/ftinspect.h (QSpinBoxx): New class, derived from `QSpinBox'. - (MainGUI): Updated. - - * src/ftinspect.cpp (MainGUI::createLayout): Updated. - (QSpinBoxx::valueFromText, QSpinBoxx::stepBy): New methods. - -2016-05-26 Werner Lemberg - - [ftbench] Add support for third TrueType interpreter version. - - Option `-H' now takes an argument to select the CFF hinting engine, - and new option `-I' selects the TT interpreter version. - - * src/ftbench.c (default_hinting_engine, - default_interpreter_version): Replaced with... - (tt_interpreter_versions, num_tt_interpreter_versions, - dflt_tt_interpreter_version, cff_hinting_engines, - num_cff_hinting_engines, dflt_cff_hinting_engine, - cff_hinting_engine_names): ... these new global variables. - (main): Expand check for alternative TrueType interpreter versions - and CFF hinting engines. - Add argument to option `-H'. - Add new option `-I'. - (usage): Updated. - - * src/ftbench.1: Updated. - -2016-05-26 Werner Lemberg - - [ttdebug] Rename option `-H' to `-I'. - - This is for consistency with a forthcoming change to `ftbench'. - - * src/ttdebug.c (main): Implement it. - (Usage): Updated. - - * src/ttdebug.1: Updated. - -2016-05-26 Werner Lemberg - - [ttdebug] Add support for third TrueType interpreter version. - - Option `-H' now takes an argument. - - * src/ttdebug.c (default_version, alternative_version): Replaced - with... - (tt_interpreter_versions, num_tt_interpreter_versions, - dflt_tt_interpreter_version): ... these new global variables. - (main): Expand check for alternative TrueType interpreter versions. - Add argument to option `-H'. - (Usage): Updated. - - * src/ttdebug.1: Updated. - -2016-05-21 Werner Lemberg - - [ftgrid] Add support for third TrueType interpreter version. - - * src/ftgrid.c (GridStatusRec): Replace `tt_interpreter_version' - with `tt_interpreter_versions' array. - Add `num_tt_interpreter_versions' and `tt_interpreter_version_idx'. - (event_tt_interpreter_version_change): Updated. - (main): Expand check for alternative TrueType interpreter versions. - -2016-05-21 Werner Lemberg - - [ftdiff] Add support for third TrueType interpreter version. - - * src/ftdiff.c (ColumnStateRec): Replace `tt_interpreter_version' - with `tt_interpreter_versions' array. - Add `num_tt_interpreter_versions' and `tt_interpreter_version_idx'. - (render_state_init): Expand check for alternative TrueType - interpreter versions. - (render_state_draw): Updated. - (process_event) <'H'>: Updated. - -2016-05-21 Werner Lemberg - - [ftview] Add support for third TrueType interpreter version. - - * src/ftview.c (status): Replace `tt_interpreter_version' with - `tt_interpreter_versions' array. - Add `num_tt_interpreter_versions' and `tt_interpreter_version_idx'. - (event_tt_interpreter_version_change, write_header): Updated. - (main): Expand check for alternative TrueType interpreter versions. - -2016-05-21 Werner Lemberg - - Make compilation work with clang++. - - Also fix some warning messages. - - * src/ftcommon.c (FTDemo_Display_Clear): Use proper cast. - (string_load): Replace shifts with multiplication. - - * src/ftgamma.c: (bit1, bit2): Complete initializer. - (do_ptrn, do_fill): Use proper casts. - (Render_Bitmap): s/bitmap/out/, s/bit/in/, to avoid shadowing global - variable `bit'. - - * src/ftgrid.c (GridStatus): Make `lcd_filter' of type - `FT_LcdFilter'. - (bitmap_scale): Use proper casts. - (grid_status_draw_outline): Fix int vs. short warnings. - (event_cff_hinting_engine_change): Add initializer. - (event_lcd_filter_change): Properly handle `status.lcd_filter'. - - * src/ftmulti.c (requested_cnt, used_num_axis): Make them `unsigned - int'. - (Process_Event, main): Updated. - - * src/ftstring.c (status): Complete initializer. - - * src/ftvalid.c (ValidatorType): Fix enum syntax. - - * src/ftview.c (event_cff_hinting_engine_change): Add initializer. - (Process_Event) <'L'>: Fix call to FT_Library_SetLcdFilter. - - * src/output.c (put_ascii_string, put_unicode_be16_string): Add - casts. - -2016-05-19 Werner Lemberg - - [ftinspect] Use bottom left as the viewport anchor for resizing. - - We store the last bottom left corner point of the viewport rectangle - and adjust the verticalScrollBar value by the delta relative to the - current bottom left corner position. - - * src/ftinspect.h (QGraphicsViewx): New class, derived from - `QGraphicsView'. - (MainGUI): Updated. - - * src/ftinspect.cpp (MainGUI::createLayout): Updated. - (QGraphicsViewx::QGraphicsViewx, QGraphicsViewx::scrollContentsBy, - QGraphicsView::resizeEvent): New methods. - -2016-05-18 Werner Lemberg - - [ftinspect] Re-implement file watching. - - * src/ftinspect.cpp (MainGUI::MainGUI): Initialize file watcher and - timer. - (MainGUI::closeFont): Updated. - (MainGUI::watchCurrentFont): New method. - (MainGUI::showFont): Handle file watching for both real files and - softlinks. - Diplsy a softlink name as italic font. - (MainGUI::createConnections): Updated. - - * src/ftinspect.h (MainGUI): Updated. - -2016-05-15 Werner Lemberg - - [ftinspect] Redesign file/face/instance navigation. - - Instead of peeking into a font with a negative argument to - `FT_Face_New', we now directly load appropriate (font, face, - instance) triplets. - - The new code also tries a bit harder to separate the font stuff in - the `Engine' class from the GUI navigation control in `MainGUI'. - - * src/ftinspect.h (Font): Removed. - (MainGUI): Make `fontList' a `QStringList'. - New members `currentNumberOfFaces' and - `currentNumberOfNamedInstances'. - Move `faceCounter' and `faceIDMap' members to... - (Engine): ...this class. - Make `faceRequester' a friend. - - * src/ftinspect.cpp (faceRequester): Check font index. - Updated. - (Engine::Engine): Updated. - (Engine::numberOfFaces, Engine::numberOfNamedInstances, - Engine::loadFont, Engine::removeFont): Rewritten. - (MainGUI::loadFonts, MainGUI::closeFont, MainGUI::showFont, - MainGUI::adjustGlyphIndex, MainGUI::checkCurrentFaceIndex, - MainGUI::checkCurrentNamedInstanceIndex): - Simplified. - (MainGUI::nextFace, MainGUI::nextNamedInstance, MainGUI::drawGlyph, - MainGUI::setDefaults): Updated. - -2016-05-15 Werner Lemberg - - [ftinspect] Minor issues. - - * src/ftinspect.cpp (Engine::loadFont): More readable code. - (MainGUI::showFont): Remove no longer needed argument. - Updated. - (MainGUI::checkCurrentFontIndex, MainGUI::checkCurrentFaceIndex, - MainGUI::checkCurrentNamedInstanceIndex): Minor generalization. - - * src/ftinspect.h (MainGUI): Updated. - -2016-05-15 Werner Lemberg - - [ftinspect] Replace face ID hash with a map. - - We need this for later changes that will rely on ordered data. - - * src/ftinspect.cpp (FaceID::operator==): Replace with... - (FaceID::operator<): ... this method. - (qHash): Removed. - (faceRequester, Engine::loadFont, Engine::removeFont, - MainGUI::closeFont, MainGUI::showFont): Updated. - - * src/ftinspect.h (FaceID): Updated. - (Main): Rename member `faceIDHash' to `faceIDMap'. - -2016-05-15 Werner Lemberg - - [ftinspect] More variable and function renamings. - - Mainly for consistency. - - * src/ftinspect.cpp (faceRequester): s/faceID/ftcFaceID/, - s/id/faceID/. - (Engine::numberOfFaces): s/result/numFaces/. - (Engine::numberOfNamedInstances): s/result/numNamedInstances/. - (Engine::loadFont): s/instanceIndex/namedInstanceIndex/. - (Engine::removeFont): s/face_id/ftcFaceID/, - s/instanceIndex/namedInstanceIndex/. - (MainGUI::showFont): s/numberOfFaces/currentNumberOfFaces/, - s/numberOfNamedInstances/currentNumberOfNamedInstances/. - Updated. - (MainGUI::checkCurrentFaceIndex): - s/numberOfFaces/currentNumberOfFaces/. - (MainGUI::checkCurrentInstanceIndex): Renamed to... - (MainGUI::checkCurrentNamedInstanceIndex): ...this. - s/numberOfNamedInstances/currentNumberOfNamedInstances/. - Updated. - (MainGUI::nextFace): s/numberOfFaces/currentNumberOfFaces/. - (MainGUI::nextInstance): Renamed to... - (MainGUI::nextNamedInstance): ... this. - s/numberOfNamedInstances/currentNumberOfNamedInstances/. - (MainGUI::previousInstance): Renamed to... - (MainGUI::previousNamedInstance): ...this. - (MainGUI::createLayout, MainGUI::createConnections, - MainGUI::setDefaults): Updated. - - * src/ftinspect.h (Engine): Updated. - (MainGUI): s/nextInstanceButton/nextNamedInstanceButton/ - s/previousInstanceButton/previousNamedInstanceButton/. - -2016-05-14 Werner Lemberg - - [ftinspect] Remove file watching. - - This approach doesn't work well. A new, improved implementation - will follow. - - * src/ftinspect.h (Engine): Remove `currentFontFileInfo', - `currentFontFileDate', `maxRetries', and `currentRetry'. - Updated. - (MainGUI): Remove `timer'. - Updated. - - * src/ftinspect.cpp (Engine::watchCurrentFont): Removed. - (Engine::loadFont, Engine::update): Updated. - (MainGUI::MainGUI): Updated. - (MainGUI::watchCurrentFont): Removed. - (MainGUI::createConnections): Updated. - -2016-05-14 Werner Lemberg - - [ftinspect] Variable renaming. - - * src/ftinspect.cpp, src/ftinspect.h (FaceID): - s/instanceIndex/namedInstanceIndex/. - -2016-05-12 Werner Lemberg - - [ftinspect] Variable renamings. - - For consistency. - - * src/ftinspect.cpp, src/ftinspect.h: s/numFaces/numberOfFaces/, - s/numNamedInstancesList/numberOfNamedInstancesList/, - s/numNamedInstances/numberOfNamedInstances/, - s/currentInstanceIndex/currentNamedInstanceIndex/. - s/currentNumGlyphs/currentNumberOfGlyphs/. - -2016-05-12 Werner Lemberg - - [ftinspect] Display more glyph and font information. - - * src/ftinspect.cpp (Engine::loadFont): Update `curFamilyName' and - `curStyleName'. - (Engine::currentFamilyName, Engine::currentStyleName, - Engine::glyphName): New methods. - - (MainGUI::closeFont, MainGUI::showFont, MainGUI::adjustGlyphIndex, - MainGUI::createLayout): Updated. - - * src/ftinspect.h (Engine): New members `curFamilyName' and - `curStyleName'. - Updated. - (MainGUI): New `fontFilenameLabel', `fontNameLabel', and - `glyphNameLabel' members. - Use `QGridLayout' for `infoRightLayout'. - -2016-05-12 Werner Lemberg - - [ftinspect] Fix logical mistakes in font navigation. - - * src/ftinspect.cpp (Engine::Engine): Initialize `ftSize'. - (MainGUI::showFont): Don't let exceed indices the number of - available index values if `preserveIndices' is active. - Always call `engine->loadFont' even for invalid fonts so that - various font-global variables are set correctly. - -2016-05-11 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.cpp, src/ftinspect.h: s/Instances/NamedInstances/. - Also display `Previous/Next Named Instance' on the buttons. - -2016-05-11 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.cpp, src/ftinspect.h: s/fonts/fontList/. - -2016-05-11 Werner Lemberg - - [ftinspect] Display glyph index. - - * src/ftinspect.cpp (MainGUI::createLayout): Add `infoLeftLayout' - and `infoRightLayout' at the top of the window; add - `glyphIndexLabel' to the right. - (MainGUI::adjustGlyphIndex): Set text for `glyphIndexLabel' - (MainGUI::setDefaults): Call `adjustGlyphIndex'. - - * src/ftinspect.h: Updated. - -2016-05-11 Werner Lemberg - - [ftinspect] Only use integer values for size if units are px. - - * src/ftinspect.cpp (MainGUI::checkUnits): Implement it. - (MainGUI::createLayout): Updated. - -2016-05-11 Werner Lemberg - - [ftinspect] Add file watching; remove watch button. - - * src/ftinspect.cpp (Engine::loadFont): Initialize file info. - (Engine::watchCurrentFont): New method. - (Engine::update): Updated. - (MainGUI::MainGUI): Set up timer. - (MainGUI::showFont): Add parameter to control updating of current - indices. - (MainGUI::watchCurrentFont): New method. - (MainGUI::createLayout): Remove watch button code. - (MainGUI::createConnections): Handle timer. - - * src/ftinspect.h (Engine): Add `currentFontFileInfo', - `currentFontDateTime', `maxRetries', and `currentRetry'. - Updated. - (MainGUI): Updated. - -2016-05-10 Werner Lemberg - - * src/ftinspect.cpp, src/ftinspect.h (MainGUI): Provide `aboutQt'. - - This removes a warning at start-up. - -2016-05-10 Werner Lemberg - - [ftinspect] Display rendered glyph bitmaps. - - * src/ftinspect.cpp (Engine::update): Updated. - (GlyphBitmap::GlyphBitmap, GlyphBitmap::~GlyphBitmap, - GlyphBitmap::boundRect, GlyphBitmap::paint): New methods - for constructing a rendered bitmap of the glyph. - (MainGUI::checkAntiAliasing): Updated. - (MainGUI::setGraphicsDefaults): Create color mapping tables for 8bit - and 1bit pixmaps as needed by Qt. - (MainGUI::drawGlyph): Honor `show bitmap' check box. - (MainGUI::createLayout, MainGUI::setDefaults): Updated. - (MainGUI::createConnections): Handle `showBitmapCheckBox'. - - * src/ftinspect.h (GlyphBitmap): New class, derived from - `QGraphicsItem'. - (MainGUI): Mew member `currentGlyphBitmapItem'. - New members `grayColorTable' and `monoColorTable'. - Updated. - (Engine): Remove unused `showBitmap' member. - -2016-05-10 Werner Lemberg - - [ftinspect] Make hinting mode selection work. - - * src/ftinspect.cpp (Engine::loadFont): Set font type. - (Engine::setCFFHintingMode, Engine::setTTInterpreterVersion): New - methods. - (MainGUI::showFont): Updated. - (MainGUI::checkHinting): Gray out hinting mode combo box items - depending on font type. - (MainGUI::checkHintingMode): Implemented. - (MainGUI::checkAutoHinting): Updated. - (MainGUI::setDefaults): Updated. - - * src/ftinspect.h: Include some internal FreeType header files. - (Engine): New member `fontType'. - New enumeration `FontType'. - Updated. - (MainGUI): New members `currentCFFHintingMode' and - `currentTTInterpreterVersion'. - - * ftinspect.pro (DEFINES): Add `FT2_BUILD_LIBRARY' to enable access - to internal FreeType headers. - -2016-05-10 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.cpp, src/ftinspect.h: Rename `point indices' to - `point numbers'. - -2016-05-10 Werner Lemberg - - [ftinspect] Display glyph point numbers. - - * src/ftinspect.cpp (GlyphPointNumbers::GlyphPointNumbers, - GlyphPointNumbers::boundRect, GlyphPointNumbers::paint): New methods - for constructing the set of glyph point numbers. - (MainGUI::drawGlyph): Honor `glyph point indices' check box. - (MainGUI::createLayout): Updated. - (MainGUI::createConnections): Handle `showPointIndicesCheckBox'. - - * src/ftinspect.h (GlyphPoints): New class, derived from - `QGraphicsItem'. - (MainGUI): Mew member `currentGlyphPointNumbersItem'. - Updated. - -2016-05-09 Werner Lemberg - - [ftinspect] Display glyph points. - - Also fix other minor issues. - - * src/ftinspect.cpp (GlyphPoints::GlyphPoints, - GlyphPoints::boundRect, GlyphPoints::paint): New methods for - constructing the set of glyph points. - (MainGUI::checkShowPoints, MainGUI::setGraphicsDefaults): Updated. - (MainGUI::drawGlyph): Honor `glyph outlines' and `glyph points' - check boxes. - (MainGUI::createLayout): Updated. - (MainGUI::createConnections): Handle `showOutlinesCheckBox'. - - (GlyphOutline::GlyphOutline): Improve computation of bounding - rectangle. - (Engine::update): Updated. - - * src/ftinspect.h (Engine): Remove unused members which are handled - in MainGUI. - (GlyphPoints): New class, derived from `QGraphicsItem'. - (MainGUI): Mew member `currentGlyphPointsItem'. - -2016-05-09 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.cpp, src/ftinspect.h: s/loadGlyph/loadOutline/. - s/Glyph/GlyphOutline/. - s/drawGlyphOutline/drawGlyph/. - -2016-05-09 Werner Lemberg - - [ftinspect] Display glyphs outlines. - - * src/ftinspect.cpp (Engine::loadGlyph): New method. - (moveTo, lineTo, conicTo, cubicTo): New wrapper functions for - `QPainterPath' methods. - (outlineFuncs): New structure, used as an interface to - `FT_Outline_Decompose'. - (Glyph::Glyph, Glyph::boundRect, Glyph::paint): New methods for - constructing a glyph object. - (MainGUI::drawGlyphOutline): New method. - (MainGUI::showFont, MainGUI::checkUnits, MainGUI::adjustGlyphIndex, - MainGUI::createLayout): Updated. - (MainGUI::createConnections): Handle `sizeDoubleSpinBox' and - `dpiSpinBox'. - - * src/ftinspect.h (Engine): Updated. - (Glyph): New class, derived from `QGraphicsItem'. - (MainGUI): New member `currentGlyphOutlineItem'. - Updated. - -2016-05-09 Werner Lemberg - - [ftinspect] Fix a bunch of glitches. - - * src/ftinspect.cpp (FaceID::FaceID): Initialize members with `-1'. - While not needed, it better indicates an invalid lookup in the hash - for debugging purposes. - (Engine::Engine): Don't call `update' here, since - `MainGUI::setDefaults' wasn't called yet. - (Engine::loadFont): Call `update'. - Return -1 for an invalid face ID. - (Engine::removeFont): Properly handle invalid face ID. - (Engine::update): Fix code reversal for pixels vs. points. - (MainGUI::MainGUI): Initialize `engine'. - (MainGUI::closeFont): First remove the font, then the face ID. - Handle invalid font also. - (MainGUI::showFont): Handle invalid font also. - (MainGUI::setGraphicsDefault): Set width of outline pen. - -2016-05-08 Werner Lemberg - - [ftinspect] Display axes. - - * src/ftinspect.cpp (Grid::Grid): Add second parameter to pass axis - pen. - (Grid::paint): Add axes. - Increase grid size. - (Grid::boundingRect):Updated. - (MainGUI::createLayout): Updated. - - * src/ftinspect.h: Updated. - -2016-05-08 Werner Lemberg - - [ftinspect] Display grid. - - The dimensions are still arbitrary, though. - - We now need Qt 4.6 or newer. - - * src/ftinspect.h (Engine): Remove `zoom' member. It doesn't belong - here. - (Grid): New class, derived from `QGraphicsItem'. We need this to - disable drawing of the grid if the zoom factor is too small. - (MainGUI): Add a `QGraphicsScene' member. - Add a `zoom' method. - - * src/ftinspect.cpp (Engine::update): Updated. - (Grid::Grid, Grid::boundingRect, Grid::paint): New methods. - (MainGUI::createLayout): Initialize `glyphView' and `glyphScene'; - add a grid object. - Change zoomSpinBox to display an integer zoom factor instead of a - percentage. This simplifies code since we don't have to bother with - scaling values < 1. - (MainGUI::createConnections, MainGUI::setDefaults): Updated. - -2016-05-08 Werner Lemberg - - [ftinspect] Provide some drawing pens. - - * src/ftinspect.h (MainGUI): Provide colored pens for axes, blue - zones, grid lines, on and off points, outlines, and segment lines. - - * src/ftinspect.cpp (MainGUI::setGraphicsDefaults): New method. - (MainGUI::MainGUI): Updated. - -2016-05-07 Werner Lemberg - - [ftinspect] Make glyph navigation work. - - * src/ftinspect.cpp (MainGUI::showFont): Don't use local variable. - (MainGUI::adjustGlyphIndex): New method. - (MainGUI::createConnections): Use `QSignalMapper' class to map all - navigation button signals to a single receiver function (namely - `adjustGlyphIndex'). - (MainGUI::setDefaults): Updated. - - * src/ftinspect.h (MainGUI): New `currentGlyphIndex' member. - Updated. - -2016-05-07 Werner Lemberg - - [ftinspect] Really load fonts. - - * src/ftinspect.cpp (Engine::loadFont, Engine::removeFont): New - methods. - (Engine::update): Set font-independent scaler values. - (MainGUI::closeFont): Remove font ID from hash and font from cache. - (MainGUI::showFOnt): Call `loadFont'. - (MainGUI::setDefaults): Set initial value of `faceCounter' to 1 to - circumvent a FreeType buglet. - - * src/ftinspect.h (Engine): New `scaler' and `ftSize' members. - Updated. - (MainGUI): New member `currentNumGlyphs'. - -2016-05-07 Werner Lemberg - - * src/ftinspect.cpp (MainGUI::showFont): Another logic fix. - -2016-05-07 Werner Lemberg - - [ftinspect] s/maxFaces/faceCounter/. - - * src/ftinspect.cpp, src/ftinspect.h: Do it. - -2016-05-07 Werner Lemberg - - [ftinspect] Another try to implement `faceRequester'. - - * src/ftinspect.h (FaceID): Extend structure to make it suitable as - key to Qt's `QHash' class. - (qHash): Also needed for `QHash'. - (MainGUI): Provide running ID number in `maxFaces'. - New `faceIDHash' to map between (font,face,instance) index triplets - and IDs. - - * src/ftinspect.cpp (FaceID::FaceID, FaceID::operator==, qHash): - Implement. - (faceRequester): Use `faceIDHash'. - (MainGUI::showFont): Fill `faceIDHash'. - (MainGUI::setDefaults): Updated. - -2016-05-06 Werner Lemberg - - * src/ftinspect.cpp (MainGUI::showFont): Fix logic. - -2016-05-06 Werner Lemberg - - [ftinspect] Simplify code. - - * src/ftinspect.cpp (MainGUI::createConnections, - MainGUI::createActions): Use `connect' variant that doesn't need - `this' parameter. - -2016-05-06 Werner Lemberg - - [ftinspect] Compute load flags for `FT_Load_Glyph'. - - * src/ftinspect.cpp (Engine::update): Compute `doHinting' and - `doAutoHinting', and `loadFlags'. - - * src/ftinspect.h (Engine): Updated. - -2016-05-06 Werner Lemberg - - [ftinspect] Add general hinting check button. - - * src/ftinspect.cpp (MainGUI::checkHinting): New method. - (MainGUI::createLayout, MainGUI::createConnections, - MainGUI::setDefaults): Updated. - (MainGUI::checkAutoHinting): Also handle `hintingModeLabel'. - - * src/ftinspect.h: Updated. - -2016-05-06 Werner Lemberg - - [ftinspect] More gamma slider settings. - - * src/ftinspect.cpp (MainGUI::createLayout): Set gamma slider tick - intervals. - - (MainGUI::setDefaults): Set default value for gamma slider. - Also move other spin box default values to this function. - -2016-05-06 Werner Lemberg - - [ftinspect] Handle LCD filter change. - - * src/ftinspect.cpp (MainGUI::checkLcdFilter): New method. - (MainGUI::setDefaults): Set up LCD filter mapping. - Call `checkLcdFilter'. - (MainGUI::createConnections): Register `checkLcdFilter'. - - * src/ftinspect.h (MainGUI): Updated. - -2016-05-06 Werner Lemberg - - [ftinspect] Indent `show point indices' check box. - - * src/ftinspect.cpp (MainGUI::createLayout): Implement it. - - * src/ftinspect.h: Updated. - -2016-05-06 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.cpp (MainGUI::checkAutoHinting): Fix logic for - warping check box. - -2016-05-06 Werner Lemberg - - [ftinspect] Add check box for auto-hinting. - - This allows easier hinting mode switch than having it in the hinting - mode combo box. - - * src/ftinspect.cpp (MainGUI::checkAutoHinting): New method, - containing almost stuff from ... - (MainGUI::checkHintingMode): Updated. - (MainGUI::createLayout): Updated; we also indent check boxes - dependent on auto-hinting. - (MainGUI::createConnections, MainGUI::setDefaults): Updated. - - * src/ftinspect.h: Updated. - (HintingModes): Remove `HintingMode_AutoHinting' enum value. - -2016-05-06 Werner Lemberg - - [ftinspect] Disable unavailable items in anti-aliasing combo box. - - * src/ftinspect.h (MainGUI): Make `setDefaults' public. - (hintingModesTrueTypeHash, hintingModesCFFHash): New maps. - (hintingModesAlwaysDisabled): New list. - - * src/ftinspect.cpp (MainGUI::setDefaults): Set up mappings between - GUI enumerations and FreeType property values. - - Use them to create `hintingModesAlwaysDisabled', a list of enum - values that gets fed to the anti-alias combo box's `setItemDisabled' - method. - (MainGUI::MainGUI): Don't call `setDefaults' - here but... - (main): ... here, after FreeType initialization. - -2016-05-05 Werner Lemberg - - [ftinspect] Handle engine properties. - - * src/ftinspect.cpp (Engine::Engine): Handle CFF's `hinting-engine', - TrueType's `interpreter-version', and the auto-hinter's `warping' - properties. - - * src/ftinspect.h (Engine): Updated. - -2016-05-05 Werner Lemberg - - [ftinspect] Start implementation of `showFont'. - - * src/ftinspect.cpp (MainGUI::loadFonts): Call `showFont'. - (MainGUI:closeFont): Fix logic and call `showFont'. - (MainGUI::showFont): New method. Doesn't display something yet, but - font navigation buttons are fully functional now. - (MainGUI::previousFont, MainGUI::nextFont, MainGUI::previousFace, - MainGUI::nextFace, MainGUI::previousInstance, - MainGUI::nextInstance): Call `showFont'. - - * src/ftinspect.h (MainGUI): Updated. - -2016-05-05 Werner Lemberg - - [ftinspect] Add methods to get number of faces and instances. - - * src/ftinspect.cpp (Engine::numFaces, Engine::numInstances): New - methods. - - * src/ftinspect.h (Engine): Updated. - -2016-05-05 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.cpp (faceRequester): Use reference. - (MainGUI::loadFonts): Simplify. - -2016-05-05 Werner Lemberg - - [ftinspect] Make `MainGUI' and `Engine' classes more symmetric. - - Also avoid `const' issues. - - * src/ftinspect.h (Engine): Add `gui' field. - Updated. - (MainGUI): Don't use `const' for `engine'. - Updated. - - * src/ftinspect.cpp (Engine::Engine, Engine::update): Updated. - (MainGUI::update, main): Updated. - -2016-05-04 Werner Lemberg - - [ftinspect] Add buttons for instances. - - * src/ftinspect.cpp (MainGUI::checkCurrentInstanceIndex, - MainGUI::previousInstance, MainGUI::nextInstance): New methods. - (MainGUI::createLayout): Updated. We now use a grid layout for the - font buttons. - (MainGUI::createConnections, MainGUI::setDefaults): Updated. - - * src/ftinspect.h: Updated. - -2016-05-04 Werner Lemberg - - [ftinspect] Redesign font handling. - - At this early stage, it's not always clear to me how to do things - correctly, so here's another try. - - * src/ftinspect.h (Font): Redesigned, using a list of - instance numbers. - (FaceID): New structure, for communication with the face requester. - (Engine): We need the `MainGUI' structure for initializing the face - requester. - (MainGUI): Make `faceRequester' a friend. - Replace string list `fontFileNames' with `fonts', which is a list of - `Font' elements. - Add `currentInstanceIndex'. - - * src/ftinspect.cpp (faceRequester): Replace dummy code with - something more serious. - (Engine::Engine, Engine::update): Updated. - (MainGUI::loadFonts, MainGUI::closeFont, - MainGUI::checkCurrentFontIndex, MainGUI::checkCurrentFaceIndex, - MainGUI::nextFont, MainGUI::nextFace): - Updated to use new `fonts' member. - (MainGUI::setDefaults, main): Updated. - -2016-05-04 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.h, src/ftinspect.cpp: - s/checkCurrentFontFileIndex/checkCurrentFontIndex/, - s/currentFontFileIndex/currentFontIndex/. - -2016-05-04 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.h (Engine): Add destructor. - (MainGUI): Use point to `engine'. - - * src/ftinspect.cpp (Engine::~Engine): Implement. - (MainGUI::update): Updated. - -2016-05-04 Werner Lemberg - - [ftinspect] Better intertwine `Engine' and `MainGUI'. - - * src/ftinspect.cpp (MainGUI::update): New method. - (main): Use it. - - * src/ftinspect.h (Engine): Make it a friend of `MainGUI'. - (MainGUI): New member `engine'. - Updated. - -2016-05-04 Werner Lemberg - - * src/ftinspect.cpp (MainGUI::loadFonts): Improve logic. - -2016-05-04 Werner Lemberg - - [ftinspect] Make `previous face' and `next face' button logic work. - - It still does nothing, though. - - * src/ftinspect.h (MainGUI): New slots `checkCurrentFaceIndex', - `previousFace, and `nextFace'. - New members `numFaces' and `currentFaceIndex'. - - * src/ftinspect.cpp - (MainGUI::checkCurrentFaceIndex, MainGUI::previousFace, - MainGUI::nextFace): New methods. - (MainGUI::createConnections): Register connections for - `previousFaceButton' and `nextFaceButton'. - (MainGUI::setDefaults): Updated. - -2016-05-04 Werner Lemberg - - * src/ftinspect.cpp (MainGUI::checkCurrentFontFileIndex): Fix logic. - -2016-05-04 Werner Lemberg - - [ftinspect] Add buttons for faces. - - * src/ftinspect.cpp (MainGUI::createLayout): New buttons for - `previous face' and `next face'; they are put into a separate row - (`fontLayout') together with the buttons for `previous font' and - `next font'. - s/fontSizeLayout/sizeLayout/. - - * src/ftinspect.h: Updated. - -2016-05-04 Werner Lemberg - - [ftinspect] Don't use size in pixels for navigation buttons. - - Instead, derive the width from the displayed text. - - * src/ftinspect.h (QPushButtonx): New class, derived from - `QPushButton'. - - * src/ftinspect.cpp (QPushButtonx::QPushButtonx): New constructor. - (MainGUI::createLayout): Use `QPushButtonx' for navigation buttons. - -2016-05-03 Werner Lemberg - - [ftinspect] Make `previous font' and `next font' button logic work. - - * src/ftinspect.h (MainGUI): New slots `checkCurrentFontFileIndex', - `previousFont, and `nextFont'. - - * src/ftinspect.cpp - (MainGUI::checkCurrentFontFileIndex, MainGUI::previousFont, - MainGUI::nextFont): New methods. - (MainGUI::createConnections): Register connections for - `previousFontButton' and `nextFontButton'. - (MainGUI::loadFonts, MainGUI::closeFont, MainGUI::setDefaults): - Updated. - -2016-05-03 Werner Lemberg - - [ftinspect] Add file dialogs. - - * src/ftinspect.h: Include some more Qt headers. - (MainGUI): Add `fontFileNames' and `currentFontFileIndex'. - Add actions to load and close font files. - - * src/ftinspect.cpp (MainGUI::loadFonts, MainGUI::closeFont): New - methods. - (MainGUI::createActions, MainGUI::createMenus, - MainGUI::setDefaults): Updated. - -2016-05-03 Werner Lemberg - - [ftinspect] Better code. - - * src/ftinspect.h (QComboBoxx): New class, derived from `QComboBox'; - we add one method `setItemEnabled' to enable (or disable) an item - with a given index. - (MainGUI): Use `QComboBoxx' for `antiAliasingComboBoxx' (was: - `antiAliasingCombBox') and `hintingModeComboBoxx' (was: - `hintingModeComboBox'). - Update all users. - - * src/ftinspect.cpp (MainGUI::checkHintingMode): Simplified. - (QComboBoxx::setItemEnabled): New method. - -2016-05-03 Werner Lemberg - - [ftinspect] Start with FreeType initialization. - - * src/ftinspect.h: Include some FreeType headers. - (Font): New structure for holding a (physical) font. - (Engine): New class for communication with FreeType library. - (MainGUI): Make `engine' a friend. - - * src/ftinspect.cpp (faceRequester): New function for FreeType's - cache manager. - (Engine::Engine, Engine::update): Some basic functions; to be - extensively revised in later commits. - (main): Updated. - - * src/ftinspect.pro: Add support for FreeType and dependent - libraries. Right now, you have to adjust paths manually. - -2016-05-02 Werner Lemberg - - [ftinspect] Minor. - - * src/ftinspect.h, src/ftinspect.cpp: - s/showBitmapsCheckBox/showBitmapCheckBox/. - -2016-05-02 Werner Lemberg - - [ftinspect] Adjust layout. - - * src/ftinspect.cpp (MainGUI::createLayout): Move size, dpi, and - zoom stuff one row down. - s/fontLayout/fontSizeLayout/. - - * src/ftinspect.h: Updated. - -2016-05-02 Werner Lemberg - - [ftinspect] Add DPI control. - - * src/ftinspect.cpp (MainGUI::createLayout): Add `unitsComboBox' to - select between px and pt. - Add `dpiLabel' and `dpiSpinBox' to select the DPI value. - (MainGUI::checkUnits): New function. - (MainGUI::createConnections, MainGUI::setDefaults): Updated. - - * src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Some more GUI initialization defaults. - - * src/ftinspect.cpp (MainGUI::setDefaults): Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Avoid parameters for signal functions. - - This makes the code a bit more elegant. - - * src/ftinspect.cpp (MainGUI::checkHintingMode, - MainGUI::checkAntiAliasing): Implement. - (MainGUI::createConnections, MainGUI::setDefaults): Updated. - - * src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Rename some enum values. - - * src/ftinspect.cpp, src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Provide dummy default values for GUI initialization. - - * src/ftinspect.cpp (MainGUI::setDefaults): Set some values. - -2016-05-01 Werner Lemberg - - [ftinspect] Add signal for showPointsCheckBox. - - * src/ftinspect.cpp (MainGUI::checkShowPoints): New function. - (MainGUI::createConnections): Add signal. - - * src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Add signal for antiAliasingComboBox. - - * src/ftinspect.cpp (MainGUI::checkAntiAliasing): New function. - (MainGUI::createConnections): Add signal. - - * src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Refine signal for hintingModeComboBox. - - * src/ftinspect.cpp (MainGUI::checkHintingMode): Grey out `slight' - hinting item in antiAliasingComboBox if not in auto-hinting mode. - Also set a different anti aliasing value for this case if `slight' - was the current value. - - * src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Add signal for hintingModeComboBox. - - Also fix typo `hortizontal' -> `horizontal'. - - * src/ftinspect.cpp (MainGUI::checkHintingMode): New function. - (MainGUI::createConnections): Add signal. - - * src/ftinspect.h: Updated. - -2016-05-01 Werner Lemberg - - [ftinspect] Improve combo box setup. - - * src/ftinspect.h (MainGUI): New enums `AntiAliasing', - `HintingModes', and `LCDFilter'. - - * src/ftinspect.cpp (MainGUI::createLayout): Use new enums to set - items in combo boxes. - Also simplify computation of maximum width. - -2016-04-30 Werner Lemberg - - * src/ftinspect.cpp (MainGUI::createLayout): Fix memory leak. - -2016-04-30 Werner Lemberg - - [ftinspect] A new Qt based variant for ftgrid. GUI draft only. - - The idea is to eventually integrate the functionality of ftview, - ftkern, and ftdiff also. - - The code compiles fine with both Qt4 and Qt5; it doesn't do anything - yet beyond showing how the GUI looks like. - - * src/ftinspect.cpp, src/ftinspect.h: New source code files. - - * src/ftinspect.pro: New qmake input file. - -2016-04-08 Werner Lemberg - - [ftview] Avoid hangs with bitmap only fonts. - - Problem reported by Hin-Tak Leung . - - * src/ftview.c (Render_Text, Render_Waterfall): Escape loop if not a - single glyph could be rendered. - -2016-03-18 Werner Lemberg - - * graph/x11/rules.mk (X11_LIB): Also append `/lib64'. - -2016-03-02 Werner Lemberg - - [ftgrid] Use colors for dot numbers. - - We now have bitmap rendering also, and black numbers on a black - background are ... not optimal. - - * src/ftgrid.c (grid_status_draw_outline): Implement it. - -2016-03-01 Werner Lemberg - - [ftgrid] Exchange movement directions of `i' and `k' keys. - - This synchronizes the actions with its descriptions in the help - screen. - - * src/ftgrid.c (Process_Event): Implement it. - -2016-03-01 Werner Lemberg - - * src/ftgrid.c (grid_status_draw_outline): Fix memory leak. - -2016-02-21 Alexei Podtelezhnikov - - [ftgrid] Touch up. - - * src/ftgrid.c (status): Initialize `header' as NULL to display font - name initially. Use bits of new field `work' to control... - (grid_status_draw_outline, main, Process_Event): Updated accordingly. - * src/ftgrid.1: Updated. - -2016-02-21 Werner Lemberg - - * src/ftgrid.c (event_grid_zoom): Make zoom up always work. - -2016-02-21 Alexei Podtelezhnikov - - [ftgrid] Enable LCD filtering. - - * src/ftgrid.c (event_lcd_filter_change): New function. - (status, main, Process_Event, event_help): Updated. - -2016-02-20 Alexei Podtelezhnikov - - [ftgrid] Improve stroked path appearance. - - * src/ftgrid.c (grid_status_draw_outline): Hint scaled outline to - follow gridlines and cover entire pixels. - -2016-02-20 Alexei Podtelezhnikov - - [ftgrid] Display monochrome and LCD bitmaps. - - * src/ftgrid.c (grid_status_draw_outline): Rework to use... - (bitmap_scale): New function that implements bitmap scaling. - -2016-02-13 Alexei Podtelezhnikov - - [graph] Actually clear cache when full. - - * graph/gblender.c (gblender_lookup, gblender_lookup_channel): - Updated. - -2016-02-12 Alexei Podtelezhnikov - - [ftgrid] Display rendered bitmap (new feature). - - * src/ftgrid.c (status): New field to control new feature. - (grid_status_draw_outline): Implement new feature here. - (Process_Event, usage): Updated. - -2016-02-10 Alexei Podtelezhnikov - - * src/ftgrid.c (grid_status_draw_outline): Use simpler line join. - -2016-02-10 Alexei Podtelezhnikov - - [ftgrid] Use fixed-point scale and integer origin. - - * src/ftgrid.c (status): Change field types. - (grid_status_init, grid_status_rescale_initial, grid_status_draw_grid, - grid_hint_draw_segment, grid_status_draw_outline): Updated. - -2016-02-07 Werner Lemberg - - * Version 2.6.3 released. - ========================= - - - Tag sources with `VER-2-6-3'. - - * README: Updated. - * src/*.1: Updated. - -2016-02-04 Alexei Podtelezhnikov - - * src/ftcommon.c (FTDemo_String_Draw): Typo. - -2016-02-02 Alexei Podtelezhnikov - - * src/ftgrid.c, src/ftview.c, src/testname.c: Remove math.h. - -2016-02-02 Alexei Podtelezhnikov - - [ftgrid] Fix dot position and shape. - - * src/ftgrid.c (circle_draw): Correct subpixel positioning. - (ft_outline_new_circle): Correct circle approximation. - -2016-02-01 Nikolaus Waxweiler - - [ftview] Fix toggling of `force auto-hinter' in light mode. - - Light mode does not imply auto-hinter anymore. - - * src/ftview.c (Process event) <'f'>: Update code. - -2016-01-17 Alexei Podtelezhnikov - - * src/ftdiff.c (render_state_init): Update default LCD filter. - -2016-01-14 Werner Lemberg - - Don't use macro names that start with `_[A-Z]' or contain `__'. - - Such macro names are reserved for both C and C++. - - * *.h: Harmonize ID macros so that file `foo.h' uses `FOO_H_'. - * *.c: s/_Translator/Translator_'. - - * graph/x11/grx11.c (gr_x11_surface_init): - s/_NET_WM_PID/NET_WM_PID/. - * src/ftdiff.c: Replace structure names `_foo' with `foo_'. - -2016-01-13 Alexei Podtelezhnikov - - [ftview] Cycle through available LCD filtering. - - * src/ftview.c (status, Process_Event): Implement cycle through - `FT_LcdFilter'. - -2016-01-11 Alexei Podtelezhnikov - - * src/ftview.c (status, Process_Event): Update default LCD filter. - -2016-01-09 Alexei Podtelezhnikov - - [ftgamma] Provide alternative pattern. - - * src/ftgamma.c (do_ptrn, GammaPtrn): Implement slightly slanted - anti-aliased lines. - (Process_Event, event_help, main): Updated. - * src/ftgamma.1: Updated. - -2016-01-04 Alexei Podtelezhnikov - - [ftgamma] Enable color. - - * src/ftgamma.c (Render_GammaGrid): Split into... - (Render_Bitmap): ... this renderer with color controls. - (GammaGrid): ... and this grayscale bitmap builder. - (event_color_change): New function. - (Process_Event, event_help, main): Updated. - * src/ftgamma.1: Updated. - -2015-12-22 Alexei Podtelezhnikov - - [ftgamma] Minor refactoring. - - * src/ftgamma.c (Render_GammaGrid): Move labels from here... - (main): ... to here. - -2015-12-20 Alexei Podtelezhnikov - - Relocate gamma grid display from [ftview] to [ftgamma]. - - * src/ftview.c (Process_Event): Remove event `G'. - (event_help): Update. - (event_gamma_grid): Move to... - * src/ftgamma.c (event_gamma_grid): ... here. - (Process_Event): New function. - (event_help): New function. - (main): Update to handle events. - -2015-12-18 Alexei Podtelezhnikov - - [ftstring, ftview] Auxiliary gamma rounding fixes. - - * src/ftstring.c (event_gamma_change): Updated. - * src/ftview.c (event_gamma_grid): Updated. - -2015-12-18 Alexei Podtelezhnikov - - * graph/gblender.c (gblender_set_gamma_table): Rounding, formatting. - -2015-12-15 Werner Lemberg - - * src/ftgamma.c (do_fill): Fix compiler warning. - -2015-12-14 Alexei Podtelezhnikov - - [ftgamma] Modernize appearance. - - * src/ftgamma.c: Major renovations. - * src/ftgamma.1: Update. - -2015-12-10 Werner Lemberg - - * src/ftcommon.c (FTDemo_Install_Font): Handle alloc/file errors. - - Problem reported by Alexei. - -2015-12-09 Alexei Podtelezhnikov - - * src/ftstring.c (event_angle_change): Wrap angle differently. - -2015-12-07 Alexei Podtelezhnikov - - [ftstring] Miscellaneous updates. - - * src/ftstring.c (event_gamma_change): Do not report gamma updates. - (write_header): Permanently display gamma. - (gamma_ramp_draw): Brighten the curve. - -2015-12-06 Alexei Podtelezhnikov - - [graph] Small improvements. - - * graph/gblender.h (GBLENDER_SHADE_INDEX): Round to nearest grid. - * graph/gblender.c (gblender_lookup, gblender_lookup_channel): Minor. - -2015-12-05 Alexei Podtelezhnikov - - [graph] Unravel blending, part 2. - - * graph/gblender.c (gblender_reset_key, gblender_reset_channel_key): - Set alpha grid values explicitly. - -2015-12-03 Alexei Podtelezhnikov - - [graph] Unravel blending. - - * graph/gblender.c (gblender_reset_key, gblender_reset_channel_key): - Entrust optimizations to modern compilers, remove unused variables. - -2015-11-30 Werner Lemberg - - [graph] Initialize local variables after checking channel change. - - This fixes a crash if foreground color == background color. - - Problem reported by Alexei. - - * graph/gblender.h (GBLENDER_VARS): Split off initialization to... - (GBLENDER_VARS_SET): ...this new macro. - (GBLENDER_CHANNEL_VARS): Split off initialization to... - (GBLENDER_CHANNEL_VARS_SET): ...this new macro. - - * graph/gblcolor.h, graph/gblhbgr.h, graph/gblhrgb.h, - graph/gblvbgr.h, graph/gblvrgb.h: Updated. - -2015-11-29 Alexei Podtelezhnikov - - * graph/gblender.c (gblender_clear): Fix typo. - -2015-11-29 Alexei Podtelezhnikov - - * src/fttimer.c (main): Remove unused variable. - -2015-11-28 Alexei Podtelezhnikov - - * src/ftcommon.c (FTDemo_Display_Clear): Speed up. - -2015-11-28 Werner Lemberg - - * Version 2.6.2 released. - ========================= - - - Tag sources with `VER-2-6-2'. - - * README: Updated. - * src/*.1: Updated. - -2015-11-25 Alexei Podtelezhnikov - - [ftstring, ftview] Small clean-ups. - - * src/ftstring.c (event_lcdmode_change): Robustify the switch. - * src/ftview.c (write_header): Ditto. - -2015-11-25 Werner Lemberg - - * src/ftstring.c: Fix compilation warnings. - -2015-11-24 Alexei Podtelezhnikov - - [ftstring] Enable sub-pixel rendering. - - * src/ftstring.c (event_lcdmode_change): New function. - (Process_Event): New event to change LCD mode. - (event_help): Offer it. - (main): Select light LCD filter. - -2015-11-22 Alexei Podtelezhnikov - - * src/ftstring.c (main): Move gamma curve in the background. - -2015-11-22 Alexei Podtelezhnikov - - [ftstring] Enable changing display color. - - * src/ftstring.c (event_color_change): New function. - (Process_Event) [grKeySpace]: New event to change color. - (event_help): Offer it. - (main): Updated. - * src/ftstring.1: Updated. - -2015-11-22 Alexei Podtelezhnikov - - [ftstring] Use shared `grSetGlyphGamma'. - - * src/ftcommon.h (FTDemo_String_Context): Remove `gamma_ramp'. - * src/ftcommon.c (apply_gamma_ramp): Remove. - (FTDemo_String_Draw): Do not apply gamma correction here. - * src/ftstring.c (event_gamma_change): Call `grSetGlyphGamma' here. - (main): Switch from gray to rgb24; update. - -2015-11-22 Alexei Podtelezhnikov - - [ftstring] Remove gamma toggle. - - * src/ftstring.c (event_help, Process_Event): Updated. - -2015-11-21 Alexei Podtelezhnikov - - Copy-paste typos. - - * src/ftstring.1: Updated. - * src/ftstring.c: Updated. - -2015-11-19 Alexei Podtelezhnikov - - Cosmetic improvements. - - * src/ftdiff.c (write_global_info): Do not display zero gamma. - * src/ftgrid.c (event_gamma_change): Ditto. - * src/ftview.c (write_header): Ditto. - -2015-11-12 Alexei Podtelezhnikov - - * graph/gblender.c (gblender_reset_key): Fix typo. - -2015-11-12 Alexei Podtelezhnikov - - Define and use GAMMA. - - * src/ftcommon.h (GAMMA): Define new macro. - * src/ftdiff.c (adisplay_init): Use it. - * src/ftgrid.c (grid_status_init): Use it. - * src/ftstring.c (status): Use it. - * src/ftview.c (status): Use it. - -2015-11-11 Alexei Podtelezhnikov - - [ftdiff,ftgrid] Default to gamma = 1.8. - - * src/ftcommon.c (FTDemo_Display_New): Do not set gamma. - * graph/grblit.c (gr_glyph_gamma): Updated. - * src/ftdiff.c (adisplay_init): Updated. - * src/ftgrid.c (grid_status_init): Updated. - -2015-11-06 Alexei Podtelezhnikov - - [graph] Minor sRGB accuracy update. - - * graph/gblender.c (gblender_set_gamma_table): Updated. - -2015-11-06 Alexei Podtelezhnikov - - [ftview,ftstring] Default to gamma = 1.8. - - * src/ftview.c (status): Updated. - * src/ftstring.c (status, main): Updated. - -2015-10-16 Werner Lemberg - - Don't use `aux' as a file name. - - This should be avoided under Windows. - Problem reported by Dave Arnold . - - * src/aux.c, src/aux.h: Renamed to... - * src/output.c, src/output.h: ... these file names. - - * Makefile, src/ftdump.c, src/ftgrid.c: Updated. - -2015-10-04 Werner Lemberg - - * Version 2.6.1 released. - ========================= - - - Tag sources with `VER-2-6-1'. - - * README: Updated. - * src/*.1: Updated. - -2015-09-13 Werner Lemberg - - * Makefile (FT_H): Updated to recent directory changes (#45954). - - The patch is taken from the anonymous Savannah bug report. - -2015-08-13 Werner Lemberg - - [ftcommon] Support named instances of GX variation fonts. - - * src/ftcommon.c (FTDemo_Install_Font): Add inner loop for named - instances. - -2015-08-05 Werner Lemberg - - [ftgrid] Avoid invalid left-shift of negative values. - - * src/ftgrid.c (grid_status_draw_outline): Don't use left-shift but - multiplication. - -2015-08-04 Werner Lemberg - - * src/ftmulti.c (main): Fix double-free in case of invalid font. - -2015-07-08 Werner Lemberg - - [ftcommon] Improve loading of font collections. - - * src/ftcommon.c (FTDemo_Install_Font): Don't exit if first face of - a font is invalid. - Don't exit if we want outline fonts only and the first face isn't. - Don't exit if there are problems with the cmap. - - In all three cases, simply skip the font face. - -2015-06-07 Werner Lemberg - - * Version 2.6 released. - ======================= - - - Tag sources with `VER-2-6'. - - * README: Updated. - * src/*.1: Updated. - - * Makefile: Omit a zero patch level in computation of `version'. - -2015-06-06 Werner Lemberg - - [ftgrid] Key `D' now toggles display of point numbers. - - * src/ftgrid.c: Include FT_TRIGONOMETRY_H. - (GridStatusRec): Add field `do_dotnumbers'. - (grid_status_init): Updated. - (grid_status_draw_outline): Implement point number display. - (event_help): Updated. - (Process_Event): Handle `D' key. - (main): Updated. - -2015-04-22 Werner Lemberg - - * src/ftdiff.c (process_event): Add missing `break' statement. - -2015-04-21 Werner Lemberg - - [ftview] Key `w' now toggles warper (if compiled-in). - - * src/ftview.c (status): Add `warping' field. - (event_help): Updated. - (event_warping_change): New function. - (Process_Event): Handle `w' key. - (write_header, main): Updated. - -2015-04-21 Werner Lemberg - - [ftgrid] Key `w' now toggles warper (if compiled-in). - - This replaces the no longer existing debugging hook with a generic - solution that uses the `warping' auto-hinter module property. - - * src/ftgrid.c (_af_debug_disable_warper): Removed. - (GridStatusRec): s/do_warp/warping/. - (grid_status_init, grid_status_draw_outline, event_help): Updated. - (event_warping_change): New function. - (Process_Event): Handle `w', not `W', and use - `event_warping_change'. - (main): Updated. - -2015-04-21 Werner Lemberg - - [ftdiff] Key `w' now toggles warper (if compiled-in). - - * src/ftdiff.c (render_mode_names): Updated. - (ColumnStateRec): Add `warping' field. - (render_state_init, render_state_draw, event_help): Updated. - (process_event): Handle `w' key. - -2015-04-19 Werner Lemberg - - [ftdiff] Correctly reload face after changing hinting engine. - - In most cases, calling `FT_Property_Set' acts globally on the - FT_Library object. - - * src/ftdiff.c (RenderStateRec): Remove `need_rescale', since we - always rescale now after reloading the face. - Update all users. - (render_state_set_face_index): New function. - (render_state_set_file): Remove `idx' argument. Instead, (re)load - font with index `state->face_index'. - (render_state_draw): Call `render_state_set_file'. - (event_change_face_index): New function. - (process_event): s/render_state_set_file/event_change_face_index/. - (main): Updated. - -2015-04-18 Werner Lemberg - - [ftgrid] Show advance width. - - * src/ftgrid.c (grid_status_draw_outline): Display vertical line at - advance width position. - -2015-04-16 Werner Lemberg - - [ftgrid] Key `W' now toggles warper (if compiled-in). - - * src/ftgrid.c [FT_DEBUG_AUTOFIT]: New extern variable - `_af_debug_disable_warper'. - (GridStatusRec): Add `do_warp' member. - (grid_status_init): Updated. - (grid_status_draw_outline): Set `_af_debug_disable_warper'. - (event_help): Updated. - (Process_Event): Handle `W' key. - -2015-04-16 Werner Lemberg - - [ftgrid] Make blue zone toggling actually work. - - * src/ftgrid.c (grid_status_draw_outline) [FT_DEBUG_AUTOFIT]: Set - `_af_debug_disable_blue_hints'. - -2015-04-16 Werner Lemberg - - * src/ftgrid.c (Process_Event) <' '>: Don't reset debugging flags. - -2015-04-16 Werner Lemberg - - [ftgrid] Cycle through AA rendering modes with F5 and F6. - - * src/ftgrid.c (event_lcd_mode_change): New function. - (Process_Event) [FT_DEBUG_AUTOFIT]: Enable debug stuff for light AA - mode also. - Handle `F5' and `F6' keys. - (event_help): Updated. - -2015-04-14 Werner Lemberg - - [ftgrid] Fix memory leak. - - * src/ftgrid.c (event_font_change): Free `status.mm' before calling - `FT_Get_MM_Var' (again). - -2015-04-14 Werner Lemberg - - [ftgrid] Show proper names for GX axes. - - * src/ftgrid.c: Include `aux.h', FT_SFNT_NAMES_H, and - FT_TRUETYPE_IDS_H. - (GridStatusRec): Add `axis_name' array. - (event_font_change): Set GX axis name if possible. - (write_header): Use `axis_name' if non-NULL. - (main): Add clean-up code for `axis_name' array. - -2015-04-14 Werner Lemberg - - [aux] Add functions for outputting strings. - - * src/aux.c (hexdigit): New static array. - (put_ascii_string, put_ascii_string_size, put_unicode_be16_string, - put_unicode_be16_string_size): New functions. - (put_ascii, put_unicode_be16): Use new functions to implement it. - - * src/aux.h: Updated. - -2015-04-14 Werner Lemberg - - Move some output functions to a separate file. - - * src/aux.c, src/aux.h: New files, holding `put_ascii' and - `put_unicode_be16' from... - * src/ftdump.c: ... this file, which now includes `aux.h'. - - * Makefile (COMMON_OBJ): Add `aux.c'. - Fix rule. - -2015-04-11 Werner Lemberg - - [ftbench] Check unscaled advance widths also. - - * src/ftbench.c (main) : Add test. - -2015-04-05 Werner Lemberg - - [ftdump] Simplify code. - - * src/ftdump.c (put_unicode_be16_as_utf8): Fold into... - (put_unicode_be16): This function, with an additional argument. - Update all callers. - -2015-04-03 Werner Lemberg - - [ftdump] Remove dead code. - - * src/ftdump.c (debug, trace_level): Remove. - (usage): Remove #ifdef'ed code. - (main): Don't handle obsolete options `-d' and `-l'. - Remove #ifdef'ed code. - -2015-04-03 Werner Lemberg - - [ftdump] Add option `-u' to emit data in UTF-8 encoding. - - * src/ftdump.c (utf8): New global variable. - (usage): Updated. - (put_unicode_be16): Only emit characters < 0x80 as-is. - (put_unicode_be_as_utf8): New function. - (Print_Sfnt_Names, Print_MM_Axes): Use it. - (main): Handle new option `-u'. - - * src/ftdump.1: Updated. - -2015-04-02 Werner Lemberg - - [ftmulti] Make the first six axes accessible. - - We now use keys F1-F6 and 1-6. F7 and F8 get its original function - back (this is, adjusting the glyph index by 10). - - * src/ftmulti.c (MAX_MM_AXES): New macro. Replaces `T1_MAX_MM_AXIS' - everywhere. - (Render_All): Adjust vertical position depending on number of axes. - (Help): Updated. - (Process_Event): Handle new keys. - (main): Use two lines for axes if we have more than three. - -2015-04-01 Werner Lemberg - - [ftgrid] Fix minor memory leak. - - * src/ftgrid.c (GridStatusRec): Add `stroker' field. - (grid_status_draw_outline): Updated. - (main): Call `FT_Stroker_Done'. - -2015-03-30 Werner Lemberg - - [ftdump] Show proper names for GX axes. - - * src/ftdump.c (Print_MM_Axes): Try to find and display English - versions of the GX axis names (stored in the `name' table) instead - of 4-letter tags. - -2015-03-29 Werner Lemberg - - [ftgrid, ftmulti]: Handle GX fonts with more than 4 axes. - - ftgrid now handles up to 32 axes, while ftmulti will ignore all axes - but the first four. - - * src/ftgrid.c (MAX_MM_AXES): New macro. - (GridStatusRec): New field `used_num_axis'. - (event_axis_change, event_font_change, Process_Event): Use it. - - * src/ftmulti.c (used_num_axis): New global variable. - (Process_Event, main): Use it. - -2015-03-29 Werner Lemberg - - [ftdump] Display info about MM axes. - - * src/ftdump.c: Include FT_MULTIPLE_MASTERS_H. - (Print_MM_Axes): New function. - (main): Use it. - -2015-03-19 Werner Lemberg - - [ftdump] Various minor improvements. - - * src/ftdump.c (name_id): Handle WWS entries also. - Return NULL for not pre-defined entries. - (put_ascii): Display characters >= 0x80 as hex escape sequence. - (Print_Sfnt_Names): Improve output. - -2015-03-11 Werner Lemberg - - Update to latest FreeType library changes. - - * src/ftcommon.c: s/FT_XFREE86_H/FT_FONT_FORMATS_H/. - (my_face_requester): s/FT_Get_X11_Font_Format/FT_Get_Font_Format/. - -2015-03-07 Werner Lemberg - - * src/ftvalid.c: Various minor compiler warning fixes. - -2015-03-07 Werner Lemberg - - * src/ftview.c: Various minor compiler warning fixes. - - * src/ftcommon.c, src/ftcommon.h (FTDemo_Draw_Index): Change type of - `gindex' to unsigned. - -2015-03-07 Werner Lemberg - - * src/ftstring.c: Various minor compiler warning fixes. - -2015-03-07 Werner Lemberg - - [ftmulti] Various minor compiler warning fixes. - - * src/ftmulti.c: Fix signedness issues. - Add `static' keyword where appropriate. - (CENTER_X, CENTER_Y, autorun, use_grays, raster_buff, FLOOR, CEIL, - TRUNC): Removed. Unused. - -2015-03-06 Werner Lemberg - - [ftgrid] Various minor compiler warning fixes. - - * src/ftgrid.c: Fix signedness issues. - (event_axis_change, event_font_change): Avoid variable shadowing. - (CEIL, X_TOO_LONG, Y_TOO_LONG): Removed. Unused. - -2015-03-06 Werner Lemberg - - * src/ftgamma.c: Various minor compiler warning fixes. - -2015-03-06 Werner Lemberg - - [ftcommon] Various minor compiler warning fixes. - - * src/ftcommon.c: Fix signedness issues. - (my_face_requester): Remove dead code. - (FTDemo_Install_Font): Protect against stream failure. - (string_render_prepare): Add `static' keyword. - * src/ftcommon.h: Updated. - -2015-03-05 Werner Lemberg - - * src/ftdiff.c: Various minor compiler warning fixes. - -2015-03-05 Werner Lemberg - - [graph] Many compiler warning fixes. - - * graph/*, graph/x11/*: Fix signedness issues. - Unified handling of unused variables. - Add `static' keyword where appropriate. - Include `foo.h' into `foo.c' where appropriate. - - * graph/grobjs.c, graph/grobjs.h (grRealloc): Removed. Unused. - -2015-03-04 Werner Lemberg - - [ttdebug] Various compiler warning fixes. - - * src/ttdebug.c: Decorate global variables/functions with `static'. - Signedness fixes. - (main): Protect various command line arguments against invalid - values. - -2015-03-04 Werner Lemberg - - * src/ftlint.c: Various minor compiler warning fixes. - -2015-03-04 Werner Lemberg - - * src/ftdump.c: Various minor compiler warning fixes. - -2015-03-04 Werner Lemberg - - [ftbench] Various compiler warning fixes. - - * src/ftbench.c: Decorate global variables/functions with `static'. - Signedness fixes. - (main): Protect various command line arguments against invalid - values. - -2015-03-03 Werner Lemberg - - [ftgrid] Add support for MM (and GX) fonts. - - F2 selects the axis, F3 and F4 change the axis value. - - The new code is adapted from `ftmulti.c'. - - * src/ftgrid.c: Include FT_MULTIPLE_MASTERS_H. - (GridStatusRec): Add `mm', `design_pos', and `current_axis' fields. - (grid_status_init): Initialize new fields. - (event_help): Updated. - (event_axis_change): New function. - (event_font_change): Handle MM data. - (Process_Event): Handle new keys. - (write_header, main): Updated. - -2015-03-03 Werner Lemberg - - [ftgrid] Less verbose header line. - - * src/ftgrid.c (BUFSIZE): New macro. - (GridStatusRec, event_help): Use it. - (write_header): Use it. - Emit more compact header line. - -2015-03-03 Werner Lemberg - - * src/ftmulti.c (main): Always display 1/100ths for axis values. - -2015-03-03 Werner Lemberg - - [ftmulti] Use F1-F8 keys to handle four axes. - - Previously, we used F1 for help and F3-F8 for three axes. - - * src/ftmulti.c (Process_Event): Implement. - (Help): Updated. - -2015-03-03 Werner Lemberg - - Recommend `?' instead of `F1' for help. - - Usually, both `F1' and `?' map to the help screen. However, not all - display managers provide the F1 key to the application. - - * src/ftdiff.c (main), src/ftgrid.c (main), src/ftmulti.c (main), - src/ftstring.c (main), src/ftview.c (main): Apply. - -2014-12-30 Werner Lemberg - - * Version 2.5.5 released. - ========================= - - - Tag sources with `VER-2-5-5'. - - * README: Updated. - * src/*.1: Updated. - - * Makefile (dist): Fix typos. - -2014-12-11 Werner Lemberg - - * Makefile (dist): Use older POSIX standard for `tar'. - - Apparently, BSD tar isn't capable yet of handling POSIX-1.2001 - (contrary to GNU tar), so force the POSIX-1.1988 format. - - Problem reported by Stephen Fisher . - -2014-12-06 Werner Lemberg - - * Version 2.5.4 released. - ========================= - - - Tag sources with `VER-2-5-4'. - - * README: Updated. - * src/*.1: Updated. - -2014-11-22 Werner Lemberg - - Show FreeType version in demo program help screens. - - * src/ftdiff.c (event_help), src/ftgrid.c (event_help), - src/ftmulti.c (Help), src/ftstring.c (event_help), src/ftview.c - (event_help): Implement it. - -2014-05-11 Werner Lemberg - - Fix Savannah bug #42182. - - * src/ttdebug.c (main): Fix typos. - -2014-03-06 Werner Lemberg - - * Version 2.5.3 released. - ========================= - - - Tag sources with `VER-2-5-3'. - - * README: Updated. - * src/*.1: Updated. - -2014-03-04 Werner Lemberg - - * Makefile (LINK_LIBS) [unixdev]: Don't use pkg-config for bzip2. - - Not all platforms have `bzip2.pc'. We also add `-lz' just for - completeness. - -2014-01-30 Werner Lemberg - - [ftbench] Allow `-s 0' for better testing of FT_LOAD_NO_SCALE. - - * src/ftbench.c (main) <'s'>: Don't alter value 0. - Don't call `FT_Set_Pixel_Sizes' for size == 0. - Don't call tests for size == 0 that need valid scaling factors. - (usage): Updated. - (benchmark): Return meaningful timer value for error-only calls. - (test_embolden): Enable test. I think there is no longer a reason - to not run it. - - * src/ftbench.1: Updated. - -2014-01-28 Werner Lemberg - - * src/ftgrid.c (grid_status_rescale_initial): Avoid NaN values. - Remove forgotten debug message. - -2014-01-28 Werner Lemberg - - * graph/grblit.c (grBlitGlyphToBitmap): Don't crash on empty glyphs. - Problem reported by Dave Arnold . - -2014-01-03 Werner Lemberg - - [ftgrid] Show (some) blue zones. - - * src/ftgrid.c (af_glyph_hints_get_segment_offset): Update - prototype. - (GridStatusRec): New member `blue_color'. - (grid_status_display): Change `on' color to red. - Set `blue' color. - (grid_hint_draw_segment): Show associated blue zones. - (event_help): Updated. - -2014-01-03 Werner Lemberg - - [ftgrid] Minor. - - * src/ftgrid.c (GridStatusRec): Rename `conic_color' to `off_color'. - Remove unused `cubic_color' member. - (grid_status_display, grid_status_draw_outline): Updated. - -2013-12-22 Werner Lemberg - - * Makefile (LINK_LIBS) [unixdev]: Use pkg-config to get link flags. - - This corresponds to a similar change in current FreeType to link - with HarfBuzz in development mode. - -2013-12-08 Werner Lemberg - - * Version 2.5.2 released. - ========================= - - - Tag sources with `VER-2-5-2'. - - * README: Updated. - * src/*.1: Updated. - -2013-11-27 Werner Lemberg - - [ftgrid] Fix compilation in non-debug mode. - - * src/ftgrid.c: Guard autofit dump functions with FT_DEBUG_AUTOFIT - clause. - Update prototypes. - (grid_hint_draw_segment): Guard with FT_DEBUG_AUTOFIT clause. - (grid_status_draw_outline): Guard call to `grid_hint_draw_segment' - with FT_DEBUG_AUTOFIT clause. - (Process_Event) <'1'>, <'2'>, <'3'>: Don't mess around with trace - levels, which should always stay internal to the FreeType library. - Update calls to dump functions. - -2013-11-25 Werner Lemberg - - * Version 2.5.1 released. - ========================= - - - Tag sources with `VER-2-5-1'. - - * README: Updated. - * src/*.1: Updated. - -2013-11-21 Werner Lemberg - - [ftgrid] Make keys `1', `2', and `3' work again. - - * src/ftgrid.c (Process_Event) <'1'>, <'2'>, <'3'>: Set - `trace_afhints' trace level to value 7 temporarily since the autofit - dumping functions use `FT_TRACE7' since 2012-07-06. - -2013-11-21 Werner Lemberg - - [ftgrid] Fix compilation with C++. - - * src/ftgrid.c (_af_debug_*): Add `extern' keyword. - -2013-11-20 Werner Lemberg - - Increase file path size. - - * src/compos.c (main), src/ftchkwd.c (main), src/ftdump.c (main), - src/ftlint.c (main), src/ftmemchk.c (main), src/ftsbit.c (main), - src/fttimer.c (main), src/fttry.c (main): Increase array size of - `filename' and `alt_filename' to 1024. - -2013-11-13 Werner Lemberg - - * Makefile (FT_H): Update to new header layout of FreeType. - -2013-11-05 Werner Lemberg - - [ttdebug] Improve display of point tags. - - * src/ttdebug.c (old_tag_to_new): Removed, no longer used. - (display_changed_points, show_points_table): Display tags with - mnemonic characters instead of ORed numbers. - (RunIns) <'h'>: Updated. - -2013-11-05 Werner Lemberg - - [ttdebug] Enable debugging of composite glyphs (again). - - This was lost while improving key handling. - - * src/ttdebug.c (RunIns): Introduce variable `really_leave' to - insert one stop before really leaving the current glyph range. - Without that, inspecting the current data right after finishing the - hinting of a subglyph wouldn't be possible. - (main): Stay in loop even if `FT_Load_Glyph' returns zero. - -2013-11-04 Werner Lemberg - - [ttdebug] Provide man page and compile program by default. - - * Makefile (EXES): Add `ttdebug'. - - * src/ttdebug.1: New file. - -2013-11-01 Werner Lemberg - - [ttdebug] Make `B' emit a function backtrace. - - This needs the today's version of the FreeType library. - - * src/ttdebug (RunIns) <'h'>: Updated. - <'B'>: Print backtrace. - -2013-11-01 Werner Lemberg - - [ttdebug] Make `p' set a breakpoint at previous position. - - * src/ttdebug.c (RunIns): Store information about last position in - `last_IP' and `last_range'. - <'h'>, <'c'>, <'f'>, <'n'>, <'s'>: Updated. - <'p'>: Set breakpoint at previous instruction. - -2013-10-31 Werner Lemberg - - [ttdebug] Minor. - - * src/ttdebug.c: Make full-sentence messages where appropriate. - (RunIns): Make help screen more compact vertically. - -2013-10-31 Werner Lemberg - - [ttdebug] Make `b' set a breakpoint. - - * src/ttdebug.c (Breakpoint): New structure. - (RunIns): Handle breakpoint. - <'h'>, <'c'>, <'f'>, <'n'>: Updated. - <'b'>: Set breakpoint. - -2013-10-31 Werner Lemberg - - [ttdebug] Improve help; add key `h' to show it. - - * src/ttdebug.c (RunIns) <'?'>: Update and redesign help screen. - <'h'>: Same as key `?'. - (main): Show version string and help info at start-up. - -2013-10-31 Werner Lemberg - - [ttdebug] Make key `R' restart the debugger. - - * src/ttdebug.c (Restart): New macro. - (RunIns) <'Q'>: Set `pedantic_hinting' flag. - <'R'>: Set error to `Restart'. - (main): Add loop. - -2013-10-30 Werner Lemberg - - [ttdebug] Make key `f' finish current function. - Change old `f' key to `F'. - - * src/ttdebug.c (RunIns) - <'f'>: Renamed to ... - <'F'>: ... this. - <'f'>: Loop until current function is finished. - <'?'>: Updated. - -2013-10-28 Werner Lemberg - - Add manual pages. - Originally contributed (but heavily modified) by Nis Martensen - . - - * src/ftbench.1, src/ftdiff.1, src/ftdump.1, src/ftgamma.1, - src/ftgrid.1, src/ftlint.1, src/ftmulti.1, src/ftstring.1, - src/ftvalid.1, src/ftview.1: New files. - -2013-10-28 Werner Lemberg - - [ftbench, ftmulti, ftvalid] Improve and correct usage output. - - This commit also changes key mappings in ftvalid ('L' -> 'l', 'v' -> - 'V'), adds option -v to display the version, and removes dead code. - - * src/ftbench.c (bench_desc): Fix typo. - - * src/ftmulti.c (usage): Do it. - - * src/ftvalid.c (validators, print_usage): Do it. - (main): Updated. - -2013-10-27 Werner Lemberg - - * src/ttdebug.c (main, RunIns): Fix memory leaks. - -2013-10-26 Werner Lemberg - - [ttdebug] Display storage are data; key 'S' shows all of them. - - * src/ttdebug.c (Storage): New structure. We need to handle storage - area data specially since we have to make a distinction between - initialized and uninitialized values. - (handle_WS): New function. Since it is not necessary for the - bytecode interpreter to trace whether a value is uninitialized or - not, we have to do it manually right before every debugging step. - (RunIns): After executing a step, storage area data different to - before is displayed. - <'?'>: Help updated. - <'S'>: Show storage area data. - <'c'>, <'s'>, <'n'>: Call `handle_WS'. - -2013-10-26 Werner Lemberg - - [ttdebug] Fix code range detection. - - * src/ttdebug.c (RunIns): The `code_range' string identifies the - code range where `RunIns' has been called, so it's best to use it - throughout the code for this purpose. - <'C'>, <'P'>, <'S'>: Updated accordingly. - (show_points_table): Updated accordingly. - -2013-10-25 Werner Lemberg - - [ttdebug] Display CVT data; key `C' shows all Control Values. - - * src/ttdebug.c (RunIns): New array `save_cvt'. - After executing a step, CVT data different to before is displayed. - <'C'>: Show CVT data. - <'?'>: Help updated. - -2013-10-25 Werner Lemberg - - [ttdebug] Change some key assignments from lowercase to uppercase. - - * src/ttdebug.c (RunIns) <'v'>: Use 'V' instead. - <'g'>: Use 'G' instead. - <'p'>: Use 'P' instead. - <'t'>: Use 'T' instead. - <'q'>: Use 'Q' instead. - <'?'>: Help updated. - -2013-10-25 Werner Lemberg - - * src/ttdebug.c (RunIns) <'n'>: Handle ranges correctly. - -2013-10-16 Werner Lemberg - - * src/ttdebug.c (RunIns): Handle `Enter' key correctly. - -2013-10-16 Werner Lemberg - - [ttdebug] Display twilight data; key `t' shows twilight point table. - - * src/ttdebug.c (display_changed_points, show_points_table): Pass - flag for twilight zone and handle it accordingly. - (RunIns): Track twilight data. - Handle key `t'. - Update help. - -2013-10-16 Werner Lemberg - - [ttdebug] Some refactorization. - - * src/ttdebug.c (display_changed_points, show_points_table): New - functions, extracted from... - (RunIns): ... this one. - -2013-10-16 Werner Lemberg - - * src/ttdebug.c: s/save/save_pts/. - -2013-10-16 Werner Lemberg - - [ttdebug] Display improvements. - - * src/ttdebug.c (exec): Removed, unused. - (RunIns): Increase size of `temp' buffer. - Display negative hex numbers. - Correctly display hex numbers with more than 4 digits. - (RunIns) <'g'>: Display interpreter version. - -2013-10-09 Werner Lemberg - - * src/ftview.c (Render_Waterfall): Avoid `%n' in `snprintf'. - - MSVC disables this by default, and compilation would fail otherwise. - -2013-09-28 Dave Arnold - - * src/ftdiff.c (Process_Event) <'H'>: Fix typo. - - If FT_DEBUG_AUTOFIT is false, then the command `H' had a side-effect - of decrementing the glyph index. - -2013-09-23 Werner Lemberg - - [ftdiff] Improve text display at small sizes. - - * src/ftdiff.c (render_state_draw): Loop over the text. This also - avoids problems if the .notdef character has zero width (for - whatever reasons). - -2013-07-21 Behdad Esfahbod - - * src/ftcommon.c (FTDemo_Index_To_Bitmap): Add BGRA support. - -2013-07-21 Werner Lemberg - - * graph/rules.mk (GRAPH_H): Add missing files. - -2013-07-21 Behdad Esfahbod - - * src/ftcommon.c (FTDemo_Index_To_Bitmap): Remove unneeded code. - -2013-07-21 Behdad Esfahbod - - [graph] Fix BGRA blending. - - * graph/gblbgra.h: Simplify and correct blending operation. - -2013-07-20 Werner Lemberg - - Fix Savannah bug #39537. - - */* s/FALSE/0/, s/TRUE/1/. - -2013-07-20 Werner Lemberg - - Improve font loading. - - In particular, avoid a crash in ftgrid for fonts without outlines. - - * src/ftcommon.c (FTDemo_Install_Font): Provide argument to load - fonts with outlines only. - * src/ftcommon.h, src/ftview.c, src/ftstring.c: Updated. - * src/ftgrid.c (main): Updated. - Emit warning message for skipped fonts. - -2013-07-05 Werner Lemberg - - [ftbench] Be more verbose in reporting results. - - * src/ftbench.c (benchmark): Indent trace output. - (usage): Minor improvement. - (main): Add some option value guards. - Print information on test setup. - -2013-07-02 Werner Lemberg - - [ftbench] Improve `usage' text. - - * src/ftbench.c (default_hinting_engine, - default_interpreter_version): New global variables. - (usage): Improve text for `-H' and `-f'. - (main): Updated. - -2013-06-26 Werner Lemberg - - [ftgrid] Implement CFF and TTF engine change support. - - Key `H' toggles this. - - * src/ftgrid.c: Include FT_MODULE_H, FT_INTERNAL_OBJECTS_H, - FT_INTERNAL_DRIVER_H, FT_CFF_DRIVER_H, and FT_TRUETYPE_DRIVER_H. - (N_CFF_HINTING_ENGINES): Define macro. - (GridStatusRec): Add `cff_hinting_engine' and - `tt_interpreter_version'. - (event_help): New layout similar to ftview. - (event_cff_hinting_engine_change, - event_tt_interpreter_version_change): New functions. - (Process_Event): Extend handling of `H' key. - (main): Get default properties of CFF and TTF drivers. - -2013-06-26 Werner Lemberg - - * src/ftview.c (event_help): Mention `q' and `ESC' keys. - -2013-06-19 Werner Lemberg - - * Version 2.5.0 released. - ========================= - - - Tag sources with `VER-2-5-0'. - - * README: Updated. - -2013-06-12 Werner Lemberg - - [ftbench] Allow arbitrary sizes. - - * src/ftbench.c (main): Remove size limit. - -2013-06-10 Werner Lemberg - - [ftview] Use key `K' for toggling small cache. - - Key `C' is already in use. - - * src/ftview.c (Process_Event) <'C'>: Replace with... - <'K'>: This key. - Add missing `break'. - (event_help): Updated. - -2013-06-09 Werner Lemberg - - [ttdebug] Add command `f' to select number format. - - * src/ttdebug.c (use_float): New global variable. - (RunIns): Add `f' key to toggle between floating and fixed point - number formats. - Update all affected print commands. - -2013-06-09 Werner Lemberg - - [ttdebug] Add command `l', improve help and output. - - * src/ttdebug.c (RunIns): Display message if entering a new code - range. - Improve output of `?' and `p' keys. - Add `l' key to show last bytecode instruction. - -2013-06-09 Werner Lemberg - - [ttdebug] Add command line option `-H' to select hinting engine. - - * src/ttdebug.c: Include FT_TRUETYPE_DRIVER_H. - (default_version, alternative_version): New global variables. - (Usage): Updated. - (main): Handle option `-H'. - -2013-06-09 Werner Lemberg - - [ftview] Fix cache handling. - - * src/ftview.c (event_cff_hinting_engine_change, - event_tt_interpreter_version_change): Reset the cache to flush the - glyph image cache. Otherwise, the cache lookup functions get - confused since info about module properties is not stored in the - glyph cache nodes. - -2013-06-03 Werner Lemberg - - [ftview, ftdiff, ftbench] Update CFF and TT property handling. - - * src/ftbench.c (main): Make option `-H' use the non-default - properties and warning if there is a problem. - - * src/ftdiff (render_state_init): At startup, use default - properties. - (process_event) <'H'>: Do nothing if non-default `hinting-engine' - property is not available. - - * src/ftview.c (event_cff_hinting_engine_change): Do nothing if - non-default `hinting-engine' property is not available. - (Process_Event) <'H'>: Updated. - (main): At startup, use default properties. - -2013-05-22 Behdad Esfahbod - - Add support for color glyphs. - - In ftview, key `c' toggles color, while use of sbits cache is now - mapped to key `C'. - - The premultiplied bgra blending is still off. - - * graph/gblany.h (_gblender_blit_bgra_): New template. - * graph/graph.h (grPixelMode): Add gr_pixel_mode_bgra. - * graph/gblblit.h (GBlenderSourceFormat): Add GBLENDER_SOURCE_BGRA. - * graph/gblblit.c (gblender_blit_init): Handle GBLENDER_SOURCE_BGRA. - * graph/grblit.c (grBlitGlyphToBitmap): Updated. - * graph/gblbgra.h: New header file. - - * src/ftcommon.h (FTDemo_Handle): New member `color'. - * src/ftcommon.c (FTDemo_New, FTDemo_Update_Current_Flags): Updated. - (FTDemo_Glyph_To_Bitmap): Handle FT_PIXEL_MODE_BGRA. - - * src/ftview.c (Process_Event) <'c'>: Handle color. - <'C'>: Handle sbits cache. - (help): Updated. - (write_header): Updated. - - * Makefile (LINK_LIBS): Add -lpng. - -2013-05-17 Werner Lemberg - - [ftview, ftdiff, ftbench] Support `interpreter-version' property. - - * src/ftbench.c: Include FT_TRUETYPE_DRIVER_H. - (usage): Updated. - (main): Update `-H' option. - - * src/ftdiff.c: Include FT_TRUETYPE_DRIVER_H. - s/hinting_engine/cff_hinting_engine/. - (ColumnStateRec): Add `tt_interpreter_version' member. - (render_state_init, render_state_draw): Updated. - (event_help): Updated. - (process_event) <'H'>: Handle new property. - - * src/ftview.c: Include FT_TRUETYPE_DRIVER_H. - s/hinting_engine/cff_hinting_engine/. - s/HINTING_ENGINES/CFF_HINTING_ENGINES/. - (status): Add `tt_interpreter_version' member. - (event_tt_interpreter_version_change): New function. - (Process_Event) <'H'>: Use it. - (write_header): Updated. - (main): Set default value for `interpreter-version'. - -2013-05-13 Sebastien Bacher - - * src/ftview.c (write_header): Fix uninitialized variables. - -2013-05-08 Werner Lemberg - - * Version 2.4.12 released. - ========================== - - - Tag sources with `VER-2-4-12'. - - * README: Updated. - - * src/x11/grx11.c: s/read/lread/, s/write/lwrite/ where appropriate - to avoid variable shadow warnings. - -2013-05-03 Werner Lemberg - - [ftbench] New command line option `-H' to select Adobe's CFF engine. - - * src/ftbench.c: Include FT_MODULE_H and FT_CFF_DRIVER_H. - (main): Handle `H' key. - (usage): Updated. - -2013-04-27 Werner Lemberg - - [ftview] Don't show encoding in `text' and `waterfall' modes. - - Those two modes always use UTF-8 (or rather, they use - FTDemo_Get_Index). - - * src/ftview.c (write_header): Implement it. - -2013-04-26 Werner Lemberg - - [ftview] Allow engine change for non-hinted modes also. - - This is useful to demonstrate the stem darkening of the Adobe's CFF - engine. - - * src/ftview.c (Process_Event) <'H'>, (write_header): Adjust - conditions. - -2013-04-23 Werner Lemberg - - [ftview] Improve waterfall and text mode. - - * src/ftview.c (status): New member `topleft'. - (Text): Convert string to UTF-8 encoding. Now the whole string is - displayed again. - (Render_Stroke, Render_Slanted, Render_Embolden, Render_All): Set - `status.topleft' to the first offset which gets really displayed. - (Render_Text, Render_Waterfall): Set `status.topleft' to the first - offset which gets really displayed. - If characters from the `Text' string have been exhausted, start - again from the beginning. - (write_header): Always assume UTF-8 encoding for displaying header - in `text' and `waterfall' modes. - -2013-04-23 Werner Lemberg - - [ftview] Rename some variables. - - * src/ftview.c (status): s/font_index/font_idx/. - s/Num/offset/. - s/Fail/num_fails/. - s/fw_index/fw_idx/. - Update all callers. - (Render_Stroke, Render_Slanted, Render_Embolden, Render_All, - Render_Text, Render_Waterfall): s/first_index/offset/. - (event_index_change): s/old_Num/old_offset/. - (write_header): s/gindex/glyph_idx/. - -2013-04-20 Werner Lemberg - - [ftdiff] New `x' key to toggle layout modes. (cbox vs. adv. width). - - Using the advance width is the new default. - - * src/ftdiff.c (ColumnStateRec): New member `use_cboxes'. - (render_state_init): Updated. - (render_state_draw): Use advance width instead of the maximum x - value of the cbox if `use_cboxes' is set to 0. - (event_help): Updated. - (process_event): Handle `x' key. - -2013-04-18 Werner Lemberg - - [ftdiff] Implement key `H' to select CFF hinting engine. - - * src/ftdiff.c: Include FT_CFF_DRIVER_H. - Include FT_MODULE_H, FT_INTERNAL_OBJECTS_H, and - FT_INTERNAL_DRIVER_H. - (HINTING_ENGINE_MAX): New macro. - (ColumnStateRec): New member `hinting_engine'. - (render_state_init): Updated. - (render_state_draw): Select hinting engine. - Display hinting engine if we have CFF font. - (event_help): Updated. - (process_event): Handle `H' key. - - * Makefile (ftdiff.$(SO)): Enable inclusion of internal header - files. - -2013-04-17 Werner Lemberg - - Support display of no anti-aliasing, no hinting. - - * src/ftcommon.c (FTDemo_Update_Current_Flags): Handle this by - setting FT_LOAD_MONOCHROME for this combination. - -2013-04-17 Werner Lemberg - - [ftview] Be more intelligent in updating the display. - - This improves readability of tracing messages. - - * src/ftview.c (event_bold_change, event_change_radius, - event_slant_change, event_size_change, event_index_change, - event_font_change): Return update status. - (Process_Event): Update display only if an event causes a change. - -2013-04-17 Werner Lemberg - - [ftview] Minor GUI improvements. - - * src/ftview.c (event_hinting_engine_change, - event_render_mode_change): Simplify. - (Process_Event): Make keys `A'-`F' work only if AA is active. - Disable keys `f' and `H' if in light hinting mode. - (write_header): Ditto for header messages. - -2013-04-17 Werner Lemberg - - [ftview] Key `H' should be active only if we have a CFF. - - * src/ftview.c (Process_Event): Do it. - -2013-04-13 Werner Lemberg - - [ftview] Add keys `A'-`F' to select LCD mode. - - * src/ftview.c (event_help): Updated and rewritten to provide a - two-column layout. - (Process_Event): Handle `A'-`F'; former key `F' is now mapped to - `L'. - -2013-04-13 Werner Lemberg - - [ftview] Key `H' switches CFF hinting engines. - - * src/ftview.c: Include FT_MODULE_H, FT_INTERNAL_OBJECTS_H, - FT_INTERNAL_DRIVER_H, and FT_CFF_DRIVER_H. - (N_HINTING_ENGINES): New macro. - (status): New member `hinting_engine'. - (event_help): Updated. - (event_hinting_engine_change): New function. - (Process_Event): Handle `H' key. - (main): Set default CFF engine. - -2013-04-21 Werner Lemberg - - [graph/x11] Set _NET_WM_PID property. - - * graph/X11/x11/grx11.c: Include `sys/types.h', `unistd.h', and - `XAtom.h'. - (gr_x11_surface_init): Get process ID and set _NET_WM_PID property. - -2013-03-27 Werner Lemberg - - Makefile (COMPILE): Add `CPPFLAGS'. - - Two reasons: - - (a) for orthogonality with freetype.mk - (b) users can pass additional stuff to the compiler - -2013-03-24 Werner Lemberg - - [ftview] Improve rendering mode switching. - - * src/ftview.c (status): Add `update' field. - (Process_Event): Set `update' to 1 only if we really have to do an - update. - (main): Updated. - -2013-03-24 Werner Lemberg - - [ftview] Use `l' and `k' keys instead of `L' and `K'. - - * src/ftview.c (event_help, Process_Event): Implement it. - -2013-03-24 Werner Lemberg - - Don't try to handle rendering precision. - - This is a non-functional remnant of FreeType 1. All font drivers - using B/W rendering activate this at ppem < 24. - - * src/ftcommon.h (FTDemo_Handle): Remove `low_prec' field. - * src/ftcommon.c (FTDemo_New): Updated. - * src/ftmulti.c (low_prec): Removed. - (Help, Process_Event): Updated. - * src/ftstring.c (event_help, Process_Event): Updated. - * src/ftview.c (event_help, Process_Event, write_header): Updated. - -2013-03-17 Werner Lemberg - - [ftview] Remove options -d and -L. - - Not documented and no longer working. This functionality is now - available via FreeType's FT2_DEBUG environment variable. - - * src/ftview.c (status): Remove `debug' and `trace_level'. - (parse_cmdline, main): Updated. - -2013-03-17 Werner Lemberg - - [ftview] Remove option -D. - - This no longer works because the used cache values are now internal. - - * src/ftview.c (status): Remove `dump_cache_stats'. - (usage, parse_cmdline, main): Updated. - -2013-02-16 Alexei Podtelezhnikov - - [ftbench] Make BBox test harder. - - Rotating an outline puts more off-points outside of its bounding box. - - * src/ftbench.c: Include FT_OUTLINE_H. - (test_get_bbox): Rotate outline by 30 degrees. - -2013-02-12 Werner Lemberg - - [ftbench] Add test for `FT_Outline_Get_BBox'. - - * src/ftbench.c: Include FT_BBOX_H. - (FT_BENCH_GET_BBOX): New enumeration value. - (bench_desc): Updated. - (test_get_bbox): New function. - (main): Handle FT_BENCH_GET_BBOX. - -2013-02-08 Werner Lemberg - - Implement `-v' to show version. - - Rename ftdump's `verbose' option to `-V'. - Beautify and harmonize usage strings. - - * src/ftbench.c (bench_desc): Improve. - (usage): Updated. - (main): Handle `-v'. - - * src/ftdiff.c (usage): Updated. - (render_state_init): Pass `library' argument. - Move FreeType initialization to... - (main): Here. - Handle `-v'. - - * src/ftdump.c (usage): Updated. - (main): Handle `-v', rename old `-v' to `-V'. - - * src/ftmulti.c (usage): Updated. - (main): Handle `-v'. - - * src/ftgrid.c, src/ftstring.c, src/ftview (usage): Updated. - (parse_cmdline): Handle `-v'. - (main): Updated. - -2013-02-08 Werner Lemberg - - [ftdiff] Simplify option handling. - - * src/ftdiff.c (get_option_arg): Removed. - (main): Use `getopt'. - -2013-02-08 Werner Lemberg - - * src/ftcommon.c, src/ftcommon.h (FTDemo_New): Take no parameter. - - * src/ftgrid.c, src/ftstring.c, src/ftview.c: Updated. - -2013-02-06 Werner Lemberg - - [ttdebug] Remove options `-n' and `d'; add `-v' to show version. - - * src/ttdebug.c: Include `common.h'. - (Panic): Renamed to... - (Abort): This to avoid name clash. - (dump_mode, non_interactive_mode): Removed. Unused. - (main): Use `getopt'. - Implement `-v' to show FreeType version. - (Usage): Updated and synchronized with other usage messages from - FreeType demo programs. - - * Makefile (ttdebug$E): Updated to use `common.c'. - -2013-02-06 Werner Lemberg - - [ttdebug] Make `q' work correctly. - - * src/ttdebug.c (Quit): New macro. - (RunIns, main): Handle `Quit'. - -2013-02-06 Werner Lemberg - - * src/ttdebug.c (RunIns): Slightly beautify output. - (Usage): Mention help key. - -2013-02-06 Werner Lemberg - - [ttdebug] Make it work again (partially). - - Since we now have lazy execution of the `prep' bytecode, the old - ttdebug code no longer could debug it. - - The new code debugs `fpgm', `prep', and the glyph's bytecode in one - run. To facilitate it, it also adds a new `c' key to continue to - the next code range. - - * src/ttdebug.c (debug_coderange): Removed. - (RunIns): Always run debugger. - Report `end of program' only after glyph program. - Update output of `?' key. - Handle `c' key to loop until end of code range is reached. - (Usage): Updated. - (main): Don't handle negative glyph indices. - -2013-02-06 Werner Lemberg - - * src/ttdebug.c: s/exc->/CUR./. - -2013-02-05 Werner Lemberg - - * src/ttdebug.c (OpStr): Oops! Add commas back. - -2013-02-05 Werner Lemberg - - [ttdebug] Fix compilation warnings. - - * src/ttdebug.c (Cur_U_Line): Use `CUR' macro. - (RunIns): Use global `error' variable. - Use a const `temp' pointer locally. - (Usage): Fix declaration. - -2013-02-05 Werner Lemberg - - * src/ttdebug.c: Formatting, improving messages. - -2013-01-28 Werner Lemberg - - [ftview] Make waterfall display -m string. - - Also make leftArrow key and friends functional. - - * src/ftview.c (Text): Make it `const char*'. - (Render_Waterfall): Add argument to pass first index. - Use -m option if given, and handle it as UTF-8. - (Render_Text, parse_cmdline, main): Updated. - -2013-01-28 Werner Lemberg - - * src/ftview.c (write_header): Show rendering mode number. - -2013-01-03 Werner Lemberg - - [ftdiff] Slightly redesign layout to display all options. - - Also some other, minor changes. - - * src/ftdiff.c: Include . - (RenderStateRec): Remove `message' and `message0'. - Update all users. - (render_state_draw): Display one more line for status information. - (write_message): Renamed to... - (write_global_info): This. - Also display family and style name; we thus no longer need to - display the number of subfonts. - Also display dpi, ppem, and gamma. - (main): Slightly improve column layout. - - (event_help): Minor improvement. - (adisplay_change_gamma): Use epsilons. - (render_state_set_file): Don't loop around the start or end of the - face list. Other FreeType demo programs don't do this either. - -2013-01-03 Werner Lemberg - - [ftdiff] Store family and style name of loaded fonts. - - To be used in a following commit. - - * src/ftdiff.c (FontFaceRec): New members `family_name' and - `style_name'. - (render_state_set_files): Fill new FontFaceRec members. - -2013-01-03 Werner Lemberg - - * src/ftdiff (event_help): Improve text. - -2013-01-03 Werner Lemberg - - [ftgrid] Make it work again. - - * src/ftgrid.c (grid_status_init): Don't initialize variables - related to `display'. Do this... - (grid_status_display): ... in this new function instead. - (main): Use new function to handle command line arguments before - initializing the display. - -2013-01-02 Werner Lemberg - - Increase line height in help texts. - - * src/ftview.c (event_help): Increase line height. - Improve text. - * src/ftdiff.c (event_help), src/ftgrid.c (event_help), - src/ftmulti.c (Help), src/ftstring.c (event_help): Increase line - height. - -2013-01-02 Werner Lemberg - - [graph] Implement adjustable line height. - - * graph/grfont.c (gr_line_height): New global variable. - (grSetLineHeight): New function. - (grWrite): Use gr_line_height. - - * graph/grfont.h: Updated. - -2013-01-02 Werner Lemberg - - * src/ftview.c (write_header): Improve displayed strings. - -2013-01-02 Werner Lemberg - - [ftview] Better input key handling. - - * src/ftview.c (Process_Event): Don't handle key events if not - in a mode where they change something visible. - -2013-01-02 Werner Lemberg - - * src/ftdiff.c (render_state_set_files): Skip non-scalable fonts. - -2013-01-02 Werner Lemberg - - * src/ftview.c (main) Remove redundant code. - -2013-01-02 Werner Lemberg - - [ftview] Redesign layout. - - It now displays all options, not only the changes, in a structured - way. - - * src/ftview.c (START_X, START_Y): New macros. - (INIT_SIZE): Use them. - (status): Remove `header' and `header_buffer' members. - (Render_Waterfall): Use START_X and START_Y. - (event_gamma_change, event_bold_change, event_radius_change, - event_slant_change, event_render_mode_change, Process_Event): Don't - set `status.header'. - (write_header): Display all options. - - (main): Updated. - -2012-12-31 Werner Lemberg - - Introduce a warn color. - - * src/ftcommon.h (FTDemo_Display): Add `warn_color' member. - - * src/ftcommon.c (FTDemo_Display_New): Initialize it. - -2012-12-31 Werner Lemberg - - * src/ftdiff.c (render_state_draw, main): Use HEADER_HEIGHT. - -2012-12-27 Werner Lemberg - - Increase header line distances. - - * src/ftgrid.c, src/ftview.c (HEADER_HEIGHT): Move to... - * src/ftcommon.h: ... this file. Set it to value 12. - -2012-12-27 Werner Lemberg - - * Makefile: Add dependencies on `ftcommon.h'. - -2012-12-26 Werner Lemberg - - Implement -w and -h options to specify window width and height. - - * src/ftcommon.c (FTDemo_Display_New): Two new parameters to pass - width and height. - (DIM_X, DIM_Y): Moved to ... - * src/ftcommon.h: ... this. - - * src/ftdiff.c (usage): Updated. - (ADisplayRec): Add `width' and `height' elements. - (adisplay_init): Two new parameters to pass width and height. - (write_message): Updated. - (main): Handle `-w' and `-h' options. - - * src/ftgamma.c (DIM_X, DIM_Y): Removed. - - * src/ftgrid.c (GridStatusRec): Add `width' and `height' elements. - (grid_status_init): Updated. - (usage): Updated. - (parse_cmdline): Handle `-w' and `-h' options. - (main): Updated. - - * src/ftmulti.c (DIM_X, DIM_Y): Use the same (new) values as in - other demo programs. - (width, height): New global variables. - (Init_Display): Updated. - (usage): Updated. - (main): Handle `-w' and `-h' options. - - * src/ftstring.c (status): Add `width' and `height' elements. - (usage): Updated. - (parse_cmdline): Handle `-w' and `-h' options. - (main): Updated. - - * src/ftview.c (status): Add `width' and `height' elements. - (usage): Updated. - (parse_cmdline): Handle `-w' and `-h' options. - (main): Updated. - -2012-12-20 Werner Lemberg - - * bin/.cvsignore: Renamed to... - * bin/.gitignore: ... this. - - * Makefile (dist): Don't include `.mailmap' and `.gitignore' - -2012-12-19 Werner Lemberg - - * Version 2.4.11 released. - ========================== - - - Tag sources with `VER-2-4-11'. - - * README: Updated. - -2012-11-27 Werner Lemberg - - * src/ftdiff.c (usage): Updated. - -2012-11-26 Werner Lemberg - - [ftdiff] Accept UTF-8 encoded input files. - - * src/ftdiff.c (default_text): Use `char*' instead of `unsigned - char*'. - (main): Ditto for `text' variable. - (RenderStateRec): Ditto for `text' member. - (render_state_draw): Ditto for `text' argument. - Use `utf8_next' to parse UTF-8 encoded text. - -2012-11-04 Werner Lemberg - - [ftdump] Improve output of cmap tables. - - * src/ftdump.c (Print_Charmaps): Indicate Unicode Variation - Sequences. - -2012-10-20 Werner Lemberg - - * src/ftdump.c: (main): Minor output formatting. - -2012-09-01 Alexei Podtelezhnikov - - [ftview] Use pixel size calculation that works for bitmap fonts too. - - * src/ftview.c (Render_Stroke, Render_Embolden): Rely on the status - point size and resolution to get the pixel size. - -2012-08-19 Alexei Podtelezhnikov - - [ftview] Implement adjustable stroker radius. - - * src/ftview.c (status): New field 'radius'. - (Render_Stroke): Updated. - (Process_Event): Add the keys `r' and `R' to handle the change. - (event_radius_change): Implement it. - (event_help): Updated. - -2012-08-18 Alexei Podtelezhnikov - - [ftview] Use more readable loop. - - * src/ftview.c (main): use do-while instead of for-break. - -2012-07-20 Alexei Podtelezhnikov - - [ftview] Clean up the code. - - * src/ftview.c (Render_Slanted): Move the shear matrix setup out of - the loop. - * src/ftview.c (Render_Embolden): Move the emboldening strength - calculation out of the loop. - -2012-07-12 Alexei Podtelezhnikov - - [ftview] Further code homogenization. - - * src/ftview.c (Render_Stroke): Stroker constructor and destructor - are moved to... - * src/ftcommon.c (FTDemo_New, FTDemo_Done): Here. - * src/ftcommon.h (FTDemo_Handle): New field `stroker'. - -2012-07-11 Werner Lemberg - - Avoid crashes in case of failure. - - * src/ftcommon.c (FTDemo_Draw_Slot), src/ftgrid.c - (grid_status_draw_outline), src/ftview.c (Render_Stroke): Only call - `FT_Done_Glyph' in case of success. - -2012-07-10 Alexei Podtelezhnikov - - [ftview] Clean up and homogenize the code. - - * src/ftview.c (Render_Stroke): Replace while-loop with for-loop. - (Render_Slanted): Ditto. - (Render_Embolden): Ditto. - (Render_All): Ditto. - (Render_Waterfall): Ditto. - (Render_Stroke): Homogenize with other similar functions. - (Render_Text): Code cleanup. - (event_gamma_grid): Ditto. - -2012-06-15 Werner Lemberg - - * Version 2.4.10 released. - ========================== - - - Tag sources with `VER-2-4-10'. - - * README: Updated. - -2012-05-28 Alexei Podtelezhnikov - - [ftview] Implement handling of FT_Outline_EmboldenXY. - - * src/ftview.c (status): Replace `bold_factor' with `xbold_factor' - and `ybold_factor'. - (Render_Embolden): Updated. - (Process_Event): Replacing handling of `e', `E' keys with `x', `X', - `y', and `Y'. - (event_bold_change): Implement it. - (event_help): Updated. - -2012-03-14 Alexei Podtelezhnikov - - [ftview] Improve spacing for bold rendering mode. - - * src/ftview.c (Render_Embolden): Fix algorithm to reduce spacing. - -2012-03-08 Werner Lemberg - - * Version 2.4.9 released. - ========================= - - - Tag sources with `VER-2-4-9' (the previous commit has this tag). - - * README: Updated. - -2012-03-03 Werner Lemberg - - [ftstring] Fix display of kern compare mode. - - * src/ftstring.c (main) : Fix scaling of - `height'. - -2012-03-03 Werner Lemberg - - Fix handling of track kerning. - - * src/ftcommon.c (string_render_prepare): Fix scaling for - `FT_Get_Track_Kerning'. - -2012-03-03 Werner Lemberg - - Remove unused function. - - * src/ftcommon.[ch] (FTDemo_Set_Current_Pointsize): Remove. - -2012-03-02 Werner Lemberg - - Fix Savannah bug #33660. - - * src/ftcommon.c: Include `FT_XFREE86_H'. - (file_suffixes): Remove. - (my_face_requester): Check whether font driver is `Type 1' instead - of relying on the file suffix. - Additionally, prefer `.afm' over `.pfm'. - (FTDemo_Install_Font): Don't try various suffixes. - Allocate more memory for `font->filepathname' as needed by - `my_face_requester'. - - * src/ftdiff.c: Include `ftcommon.h' and `common.h'. - Remove declaration of `error' everywhere. - (usage): Updated. - Add argument for binary name. - Update all callers. - (event_help): Updated. - - * src/ftgrid.c (usage): Updated. - - * src/ftstring.c (event_help, usage): Updated. - - * src/ftview.c (usage): Updated. - -2012-03-02 Werner Lemberg - - * src/ftstring.c: Remove redundant code; formatting. - -2012-03-02 Werner Lemberg - - * src/ftdiff.c: Formatting. - -2012-03-02 Werner Lemberg - - * src/ftgrid.c: Remove redundant code; formatting. - -2012-03-02 Werner Lemberg - - * src/ftcommon.c: Remove dead code; formatting. - -2012-02-13 Peter Grandi - - [ftview] Implement cycling backwards for rendering and LCD modes. - - * src/ftview.c (Process_Event): Handle keys `K' and `backspace'. - (event_help): Updated. - -2012-02-13 Werner Lemberg - - Fix X11 keyboard handling. - - * graph/grevents.h (grKey): Shift special keys to a higher range, - otherwise it can happen that they are processed twice. For example, - `grKeyBackSpace' also returns key code 8 under X11, and this was - previously mapped to `grKeyF8'. - -2011-12-07 Antoine Leca - - Fix printf specifications and parameters. - - * src/ttdebug.c (Cur_U_Line, RunIns): Use "%hu" for FT_UShort, - "&ld" for FT_Pos; drop the "h" in "%hx" for FT_Byte parameters - and cast the parameters to (unsigned) ("%hhx" is C99 only, and - often unimplemented). Noticed by clang. - -2011-12-02 suzuki toshiya - - Use $(LIBTOOL) to make graph.a, if it is defined. - - If configure script in FreeType2 library directory creates GNU - Libtool, using it is better than using raw `ar'. For example, - Mac OS X archive library is required to be processed by ranlib. - See discussion in - http://lists.gnu.org/archive/html/freetype-devel/2011-10/msg00034.html - - * graph/rules.mk: Change the object suffix $(SO) to $(O) for - the sake of GNU Libtool. If $(LIBTOOL) is defined, use it to - compile the objects and make the library. - * graph/x11/rules.mk: Ditto. - * graph/beos/rules.mk: Ditto. - - * Makefile: `clean' target erases the object, the library and - GNU Libtool related files in .libs/ directory. - -2011-11-15 Werner Lemberg - - * Version 2.4.8 released. - ========================= - - - Tag sources with `VER-2-4-8'. - - * README: Updated. - -2011-10-18 Werner Lemberg - - * Version 2.4.7 released. - ========================= - - - Tag sources with `VER-2-4-7'. - - * README: Updated. - -2011-08-14 Werner Lemberg - - Improve usage messages. - - This should fix Savannah bug #33660. - - * src/ftgrid.c, src/ftstring.c, src/ftview.c (usage): Reword and - extend. - -2011-07-29 Werner Lemberg - - * Version 2.4.6 released. - ========================= - - - Tag sources with `VER-2-4-6'. - - * README: Updated. - -2011-06-24 Werner Lemberg - - * Version 2.4.5 released. - ========================= - - - Tag sources with `VER-2-4-5'. - - * README: Updated. - -2011-06-01 Werner Lemberg - - Fix gcc 4.6 warnings. - - * graph/grblit.c (blit_gray_to_gray): Remove unused variables. - (blit_gray_to_gray_simple): Declare and set `max' conditionally. - - * src/ftcommon.c (FTDemo_Index_To_Bitmap): Remove unused variable. - * src/ftmulti.c (Render_All, Render_Text): Ditto. - * src/ftview.c (INIT_SIZE, Render_Stroke, Render_Slanted, - Render_Embolden, Render_All, Render_Text, Render_Waterfall): Ditto. - -2011-05-01 Just Fill Bugs - Werner Lemberg - - [ftgrid] Show autohinter segments. Toggle with key `s'. - - * src/ftgrid.c: Add declarations for - `af_glyph_hints_get_num_segments' and - `af_glyph_hints_get_segments_offset'. - (GridStatus): Add `segment_color' and `do_segment'. - (grid_status_init): Updated. - (grid_hint_draw_segment): New function. - (grid_status_draw_outline): Call it. - (Process_Event) <'s'>: Toggle display of segment lines. - (event_help): Updated. - -2011-04-24 Werner Lemberg - - * src/ftgrid.c (event_grid_zoom): Fix status message. - -2011-04-21 Werner Lemberg - - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH is deprecated and ignored. - - * src/ftchkwd.c (check_face): Update load flags. - * src/ftcommon.h (FTDemo_Handle): Remove `use_global_advance_width'. - * src/ftcommon.c (FTDemo_New, FTDemo_Update_Current_Flags): Updated. - * src/ftmulti.c (LoadChar): Update load flags. - - * src/ftdiff.c (ColumnStateRec): Remove `use_global_advance_width'. - (render_state_init, render_state_draw): Updated. - (process_event): No longer handle key `a'. - (event_help): Updated. - - * src/ftview.c (Process_Event): No longer handle key `A'. - (event_help): Updated. - -2011-04-20 Werner Lemberg - - [ftgrid]: Prevent incorrect output of `1', `2', and `3' keys. - - * src/ftgrid.c (Process_Event) <'1', '2', '3'>: Ensure that hinting - is active, otherwise old table data could be emitted. - -2011-04-19 Werner Lemberg - - * Makefile (FT_INCLUDES): Simplify. - -2011-04-18 Werner Lemberg - - [ftgrid]: Limit autofit control even more. - - * src/ftgrid.c (Process_Event) <'H', 'V', 'B'> [FT_DEBUG_AUTOFIT]: - Limit visibility and improve status messages. - (event_help): Updated. - -2011-04-18 Werner Lemberg - - [ftgrid] Add forced autohinting and limit autofit dumping. - - * src/ftgrid.c (_af_debug): Remove, unused. - (Process_Event) <'f'>: Toggle autohinting. - [FT_DEBUG_AUTOFIT] <'1', '2', '3'>: Limit visibility and improve - status messages. - (event_help): Updated. - (main): Updated. - -2011-04-18 Werner Lemberg - - Honor DEVEL_DIR. - - * Makefile (FT_INCLUDES) [DEVEL_DIR]: Add $DEVEL_DIR. - -2011-03-19 Werner Lemberg - - C++ compilation fixes. - - * src/ftcommon.c, src/ftdiff.c: `strrchr' returns `const char *'. - - * src/ftview.c (status): Fix initialization. - -2011-01-30 Werner Lemberg - - Add flag `A' to ftview for toggling the global advance width flag. - - * src/ftcommon.h (FTDemo_Handle): New field - `use_global_advance_width'. - * src/ftcommon.c (FTDemo_New): Set it. - (FTDemo_Update_Current_Flags): Handle it. - - * src/ftview.c (Process_Event): Handle key `A'. - (event_help): Updated. - -2010-12-31 Werner Lemberg - - * Makefile: Add -lbz2 for development builds. - -2010-11-28 Werner Lemberg - - * Version 2.4.4 released. - ========================= - - - Tag sources with `VER-2-4-4'. - - * README: Updated. - -2010-10-03 Werner Lemberg - - * Version 2.4.3 released. - ========================= - - - Tag sources with `VER-2-4-3'. - - * README: Updated. - -2010-08-29 Steve Langasek - - Make `grKey' enum comprehensive for gcc 4.5 compatibility. - - * graph/grevents.h (grKey): Avoid the situation of trying to compare - an enum variable with a value not included in that enum in a case - statement. An enum needs to be declared to include the list of all - possible values (which in the case of keypresses is quite a few), - not just the most convenient ones. - -2010-08-17 Werner Lemberg - - [ftbench] Add option `-i' to specify first used glyph index. - - * src/ftbench.c (first_index): New global variable. - (test_load, test_load_advances, test_render, test_embolden, - test_get_cbox, test_get_glyph, test_image_cache, test_sbit_cache, - get_charset): Use it. - (usage): Updated. - (main): Handle `-i'. - -2010-08-06 Werner Lemberg - - * Version 2.4.2 released. - ========================= - - - Tag sources with `VER-2-4-2'. - - * README: Updated. - -2010-07-23 Werner Lemberg - - ftmulti: Oops! Patch has been applied incorrectly. - - * src/ftmulti.c (main): Really limit axis name length. - -2010-07-19 Werner Lemberg - - * Version 2.4.1 released. - ========================== - - - Tag sources with `VER-2-4-1'. - - * README: Updated. - -2010-07-17 Werner Lemberg - - ftmulti: Fix possible buffer overflow. - Based on a patch from Marek Kašík . - - * src/ftmulti.c (main): Limit axis name length in `Header'. - -2010-07-13 suzuki toshiya - - ftdump: Show language ID for all cmap subtables. - - * src/ftdump.c (Print_Charmaps): Print the language IDs obtained by - FT_Get_CMap_Language_ID(). The language IDs is cast to FT_UInt, so - broken IDs (> 0xFFFF) will not be shown correctly. - -2010-07-12 Werner Lemberg - - * Version 2.4.0 released. - ========================== - - - Tag sources with `VER-2-4-0'. - - * README: Updated. - -2010-06-28 Werner Lemberg - - ftbench: Fix suboptions of `-b'. - - * src/ftbench.c (bench_desc): Add missing description for - FT_BENCH_LOAD_ADVANCES. - -2010-06-07 Werner Lemberg - - Fix Savannah bug #30054. - - * src/ftdiff.c, src/ftgrid.c, src/ftmulti.c, src/ftstring.c, - src/ftview.c: Use precision for `%s' where appropriate to avoid - buffer overflows. - -2010-04-14 Werner Lemberg - - ftdiff: Add support for LCD filter control. - - Key `l' cycles through the filter modes, `[' and `]' select the - custom filter weight, `-' and `+' (or `=') adjust the selected - filter weight. - - This is based on code written by Lifter - . - - * src/ftdiff.c (ColumnStateRec): Add members for LCD filter control. - (render_state_init): Updated. - (render_state_draw): Add support for custom LCD filter. - (event_help): Document new keys. - Make help screen more compact. - (process_event): Handle new keys. - -2010-04-14 Werner Lemberg - - ftview: Add support for LCD filter control. - - Key `F' toggles custom LCD filter mode, `[' and `]' select the - custom filter weight, `-' and `+' (or `=') adjust the selected - filter weight. - - This is based on code written by Lifter - . - - * src/ftview.c (INIT_SIZE, Render_Waterfall): Add space for a third - header line. - (status_): Add members for LCD filter control. - (event_help): Document new keys. - Make help screen more compact. - (Process_Event): Handle new keys. Use FTC_Manager_RemoveFaceID to - flush the bitmap caches, forcing a redraw. I'm not sure whether - this is the right thing, but it seems to work... - (write_header): Display custom filter weights. - -2010-02-11 Werner Lemberg - - * Version 2.3.12 released. - ========================== - - - Tag sources with `VER-2-3-12'. - - * README: Updated. - -2009-10-10 Werner Lemberg - - * Version 2.3.11 released. - ========================== - - - Tag sources with `VER-2-3-11'. - - * README: Updated. - -2009-10-06 Werner Lemberg - - * Version 2.3.10 released. - ========================== - - - Tag sources with `VER-2-3-10'. - - * README: Updated. - - * Makefile (major, minor, patch): Fix regexp to allow more - than a single digit. - (dist): We now use git. - -2009-07-30 Boris Letocha - - [graph] Fix rendering on Windows. - - * graph/win32/grwin32.c (gr_win32_surface_refresh_rectangle): - Handle `gr_pixel_mode_gray' correctly. - -2009-06-17 Werner Lemberg - - Reduce number of automatically compiled programs. - Many GNU/Linux distributions install those programs, and most of - them are completely useless or very specialized. - - * Makefile (LINK): Define. - (EXES): Reduce list to retain only generally useful programs. - (ftsbit): Comment out. Program doesn't compile (but may be useful). - (ttdebug.o): Make it compile again. - -2009-06-17 Werner Lemberg - - * Makefile: Handle `EXTRAFLAGS' for platform `unixdev' also. - -2009-04-30 Werner Lemberg - - ftview: Make slant and boldness controllable. - - Keys `e' and `E' adjust emboldening, keys `s' and `S' the slant. - - * src/ftview.c (status): Add `bold_factor' and `slant' members. - (Render_Slanted): Use `status.slant'. - (Render_Embolden): Copy code from `FT_GlyphSlot_Embolden' and use - `status.bold_factor'. - (event_bold_change, event_slant_change): New functions. - (Process_Event): Handle keys `s', `S', `e', and `E'. - (event_help): Updated. - -2009-04-26 Werner Lemberg - - * graph/grblit.c (blit_lcd8_to_24): Fix typo. - Reported by suyu@cooee.cn. - -2009-04-22 Werner Lemberg - - Fix crash in ftgrid. - - * src/ftgrid.c (grid_status_draw_outline): Handle return value of - FT_Load_Glyph. - -2009-03-12 Werner Lemberg - - * Version 2.3.9 released. - ========================= - - - Tag sources with `VER-2-3-9'. - - * README: Updated. - -2009-03-10 Werner Lemberg - - * src/common.c (CONST): New macro, defined depending on __STDC__. - Use it where necessary. - -2009-03-10 Werner Lemberg - - Fix C++ compilation. - - * src/ftbench.c (test_load_advances): Use cast. - * src/ftgrid.c: Protect `extern' declarations with `extern "C"'. - -2009-03-03 Werner Lemberg - - Fix signedness issues. - - * src/ftcommon.c (FTDemo_String_Set): Fix signedness. - Update callers. - Include `common.h'. - Use __STDC__ macro. - * src/ftcommon.h (FTDemo_String_Set): Fix signedness. - - * src/common.h, src/common.c: Use __STDC__ macro. - -2009-03-03 David Turner - - Add utf-8 support to ftview. Fixes Savannah BUG #18225. - - * src/common.h, src/common.c: Add `utf8_next' function. - * src/ftcommon.c (FTDemo_String_Set), src/ftview.c (Render_Text): - Use `utf8_next'. - -2009-01-14 Werner Lemberg - - - * Version 2.3.8 released. - ========================= - - - Tag sources with `VER-2-3-8'. - - * README: Updated. - -2009-01-07 Werner Lemberg - - ftdiff: Add `a' key to toggle global advance width. - - * src/ftdiff.c (ColumnStateRec): Add `use_global_advance_width' - field. - (render_state_init): Updated. - (render_state_draw): Control FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH. - Update screen output. - (event_help): Document `a' key. - Sort output. - (process_keys): Handle `a' key. - Sort entries in `case' block. - -2008-12-05 Werner Lemberg - - * src/ftbench.c: Remove #if FT_ADVANCES_H ... conditionals. - -2008-09-02 David Turner - - * src/ftbench.c: Include FT_ADVANCES_H. - (FT_BENCH_LOAD_ADVANCES): New enumeration value. - (test_load_advances): New function. - (main) : New case. - -2008-06-29 Werner Lemberg - - - * Version 2.3.7 released. - ========================= - - - Tag sources with `VER-2-3-7'. - - * README: Updated. - -2008-06-10 Werner Lemberg - - - * Version 2.3.6 released. - ========================= - - - Tag sources with `VER-2-3-6'. - - * README: Updated. - -2008-05-18 Werner Lemberg - - * src/ftdiff.c (render_mode_names): Use better strings. - -2008-05-13 Werner Lemberg - - * src/ftcommon.c (string_render_prepare): Always set extent in last - slot. - -2008-01-10 Allan Yang, Jian Hua - SH - - * graph/grfill.c: Include . - -2007-12-29 Allan Yang, Jian Hua - SH - Werner Lemberg - - * src/ftview.c: Implement slanting. - -2007-08-08 Werner Lemberg - - * src/ftvalid.c (print_usage): Add option `-f'. - -2007-08-08 George Williams - - * src/ftvalid.c (ot_table_spec): Handle `MATH' table also. - (main): Add option `-f' to select font index. - -2007-07-07 Werner Lemberg - - * src/ftview.c (parse_cmdline): Remove C++ compiler warning. - - * src/ftcommon.c (my_file_requester), src/ftgrid.c - (grid_status_draw_grid, ft_outline_draw, ft_outline_new_circle, - grid_status_draw_outline, _af_debug_hints), src/ftdiff.c - (_render_state_rescale, render_state_set_files, - render_state_set_file, adisplay_draw_glyph, adisplay_draw_text, - event_help, event_change_gamma, process_event, write_message, main): - Fix compilation with C++ compiler. - -2007-07-02 Werner Lemberg - - - * Version 2.3.5 released. - ========================= - - - Tag sources with `VER-2-3-5'. - - * README: Updated. - -2007-06-19 Werner Lemberg - - * src/ftview.c (usage): Make it more readable. - -2007-06-16 Werner Lemberg - - * src/ftpatentcheck.c: Renamed to... - * src/ftpatchk.c: This. - Minor fixes. - - * src/Jamfile (PROGRAMS), Makefile: Updated. - -2007-06-10 David Turner - - Add the new `ftpatentcheck' program; it is a simple wrapper of the - new FT_Face_CheckTrueTypePatents function. - - * src/ftpatentcheck.c: New file. - * src/Jamfile (PROGRAMS), Makefile: Updated. - -2007-06-09 Werner Lemberg - - * src/ftgrid.c (Process_Event): Assign usual actions to keys F7-F12. - (event_help): Updated. - (main): Don't expect a Unicode encoded font -- we are only working - with glyph indices currently. - -2007-06-01 Werner Lemberg - - * src/ftcommon.c (FTDemo_Index_To_Bitmap): Initialize `*x_advance'. - -2007-05-28 David Turner - - * src/ftcommon.h: fix compilation warning - - * src/ftview.c: fix size bugs in waterfall mode - -2007-05-11 David Turner - - * src/ftcommon.h, src/ftcommon.c, src/ftview.c, src/ftgrid.c, - src/ftstring.c: adapt test programs to use the new - FTC_ImageCache_LookupScaler and FTC_SBitCache_LookupScaler - functions. This allows you to specify fractional pixel/point - sizes on the command line (e.g. ftview 13.5 ~/fonts/*) - -2007-05-09 Ryan Hill - - * Makefile: Fix rules for fttimer which doesn't use graphical - output. - Fix rule for ftdump to make it work with parallel builds. - -2007-04-09 Werner Lemberg - - - * Version 2.3.4 released. - ========================= - - - Tag sources with `VER-2-3-4'. - - * README: Updated. - - * src/ftdiff.c (process_event): Handle `?' key. - -2007-04-04 Werner Lemberg - - - * Version 2.3.3 released. - ========================= - - - Tag sources with `VER-2-3-3'. - - * README: Updated. - -2007-04-03 Werner Lemberg - - * src/ftdiff.c (usage): Make message similar to other ftdemo - programs. - -2007-04-02 David Turner - - * graph/win32/grwin32.c (gr_win32_surface_init): Fix the Win32 - window size computations to properly adjust border thickness and - other extras. Fix by Sébastien Leix . - - * src/ftdiff.c (render_state_draw): Fix small bug that prevented - unhinted rendering from working as expected with embedded bitmaps. - - (adisplay_init): Fix small bug that occurred when the - call to grNewSurface() failed. Reported by Sébastien Leix - . - - (usage): Move up in file. - - (FontFaceRec): New structure. - (RenderStateRec): Integrate it. - Update all users. - - (render_state_set_files, render_state_set_file): Handle all faces in - a multi-face font file. - - (write_message): Handle multi-face font files. - -2007-04-01 Werner Lemberg - - * src/ftdiff.c: Remove compiler warnings. - Formatting. - -2007-03-30 David Turner - - Change interface keys to allow you to change settings for a single - column only. Press F1 for details. - - * src/ftdiff.c: Include FT_LCD_FILTER_H. - (DisplayMode): Add DISPLAY_MODE_LCD. - - (Display_textFunc): New function pointer. - (DisplayRec): Add it. - - (RenderMode): Replace it with... - (HintMode): This. Update all users. - - (render_mode_names): New array. - - (ColumnStateRec): New struct. - (RenderStateRec): Use it. - (render_state_init): Initialize it. - - (render_state_draw): Pass index as argument. - Use ColumnStateRec. - Implement sub-pixel positioning for unhinted mode. - Add column footers, showing current rendering state. - - (adisplay_draw_glyph): Handle DISPLAY_MODE_LCD. - (adisplay_draw_text): New function. - - (event_help): Updated. - (process_event): Add many keys to control rendering modes in more - detail. - - (main): Updated. - -2007-03-28 Werner Lemberg - - * src/ftdiff.c: Remove many compiler warnings. - Fix some typos. - Improve and fix help texts. - Formatting. - -2007-03-26 David Turner - - * src/ftdiff.c: New proofing program that displays text in three - columns: bytecode-hinted, auto-hinted with rsb/lsb delta - adjustments, and unhinted/subpixel-positioned. For comparison - purposes. - - * Makefile, Jamfile: Add ftdiff. - -2007-03-22 suzuki toshiya - - * src/ftvalid.c (print_usage): Fix a typo in the help message. - -2007-03-09 Werner Lemberg - - - * Version 2.3.2 released. - ========================= - - - Tag sources with `VER-2-3-2'. - - * README: Updated. - -2007-02-14 David Turner - - * src/ttdebug.c: another refresh of the debugger. Minor improvements - to be able to display more useful information during debugging - -2007-02-12 David Turner - - * src/ttdebug.c: refresh the TrueType debugger code - -2007-02-06 Alexei Podtelezhnikov - - * src/ftstring.c (event_render_mode_change): Fix spelling. - -2007-01-31 Werner Lemberg - - - * Version 2.3.1 released. - ========================= - - - Tag sources with `VER-2-3-1-FINAL'. - - * README: Updated. - -2007-01-17 Werner Lemberg - - - * Version 2.3.0 released. - ========================= - - - Tag sources with `VER-2-3-0-FINAL'. - -2007-01-11 Masatake YAMATO - - * src/ftvalid.c (run_ot_validator, run_gx_validator, - run_ckern_validator): Return FT_Error value instead of int value. - (main): Return value returned from validator's run method. - (report_result): Don't show `invalid' message if there is no target - table. - -2006-12-15 suzuki toshiya - - * mac/ftoldmac.c: Fix conditional macros of FSSpec/FSRef and - QuickDraw/ATS functionalities. - -2006-12-10 Werner Lemberg - - * Makefile (dist): Extract version number from freetype.h. - -2006-11-15 David Turner - - * graph/x11/rules.mk (X11_PATH): Check /usr also. - Search for `Xlib.h'. - -2006-11-03 Werner Lemberg - - * src/ftgrid.c: Fix external function declarations. - (event_help): Document `1', `2', and `3' keys. - (grid_status_init, grid_status_rescale_initial, - grid_status_draw_grid, grid_status_draw_outline, event_grid_reset): - s/status/st/, s/error/err/ where appropriate to avoid shadowed - variables. - (GridStatusRec): Add `const' to `header'. - Update all assignments. - - * Makefile: Add ftgrid. - -2006-11-02 David Turner - - Add `B' key to ftgrid for toggling blue zone hinting. - Add `1', `2', and `3' keys to dump hints for edges, segments, and - points, respectively. - - * src/ftgrid.c: Add some externs. - (_af_debug, _af_debug_disable_blue_hints, _af_debug_hints): New - global variables. - (GridStatusRec): Add `do_blue_hints' variable. - (grid_status_init): Set do_blue_hints. - (event_help): Updated. - (Process_Event): Updated. - (main): Set _af_debug. - -2006-10-23 Zhe Su - - Add a benchmark for the emboldening algorithm. - - * src/ftbench.c: Include FT_SYNTHESIS_H. - (FT_BENCH_EMBOLDEN): New enumeration value. - (bench_desc): Add `Embolden'. - (test_embolden): New function. - (main): Add it. - -2006-10-23 David Turner - - * src/ftgrid.c: Make the file compile again. - -2006-10-11 suzuki toshiya - - * mac/ftoldmac.c (print_help): Renamed to... - (print_help_and_exit): This. Update callers. - Improve the conditionals in source to separate Toolbox QuickDraw and - Carbon QuickDraw. - (reserveToolBoxQuickDrawFontName, test_face_quickdraw, - test_font_list_quickdraw_old, test_font_list_quickdraw, - test_font_list_ats): Ditto. - -2006-10-11 suzuki toshiya - - * mac/Makefile: Synchronize with the changes of top-level Makefile - on 2006-02-01. - -2006-09-27 David Turner - - Add support for LCD color filtering to ftview. - - * src/ftview.c: Include FT_LCD_FILTER_H. - (status): Initialize it completely. - (main): Call FT_Library_SetLcdFilter. - - * src/ftcommon.c (FT_Demo_Draw_Glyph): Renamed to... - (FT_Demo_Draw_Glyph_Color): This. Add an argument to pass the - colour. - (FT_Demo_Draw_Glyph): New function, calling - FT_Demo_Draw_Glyph_Color. - - * src/ftcommon.h (FT_Demo_Draw_Glyph_Color): New declaration. - - * src/ftgrid.c: New file, implementing an auto-fitter debugger. - This is a very preliminary version. It only compiles with Jam at - the moment, and you must have AF_DEBUG defined in your - `src/autofit/aftypes.h' file to be able to link it. - - * src/Jamfile (GRAPHIC_PROGRAMS): Add ftgrid. - - * graph/graph.h (grFindColor, grFillHLine, grFillVLine, grFillRect): - New declarations. - - * graph/grfill.c: New file which implements `grFillHLine', - `grFillVLine', and `grFillRect'. They are mainly used by the - auto-fitter debugger. - - * graph/grobjs.c (grFindColor): New function for the auto-fitter - debugger. - - * graph/gblender.c (gblender_set_gamma_table): Set - `gamma_ramp_inv[gmax]'. - - * graph/gblender.h (GBLENDER_STAT_HIT, GBLENDER_LOOKUP): Move them - up in source file. - - * graph/Jamfile (graph_sources), graph/rules.mk (GRAPH_OBJS): Add - `grfill'. - -2006-09-11 David Turner - - Add support for OLPC swizzle simulation (must define SWIZZLE at - compile time for this to work). - - * graph/grswizzle.c, graph/grswizzle.h: New files. - - * graph/grdevice.h (gr_swizzle_rgb24): Declare. - - * graph/Jamfile (graph_sources): Add `grswizzle'. - - * graph/win32/grwin32.c [SWIZZLE]: Include `grswizzle.h'. - (gr_win32_surface_refresh_rectangle) [SWIZZLE]: Don't call - gr_swizzle_rgb24 but gr_rect_swizzle_rgb24. - Remove unused variables. - -2006-09-01 David Turner - - Fix various bugs in the glyph blender/blitter. - - * graph/gblcolor.h, graph/gblhbgr.h, graph/gblhrgb.h, - graph/gblvbgr.h, graph/gblvrgb.h: Fix off-by-one - error. - - * graph/gblender.c (gblender_lookup): Fix computation of key->cells. - (gblender_lookup_channel): Fix computation of key->index. - - * graph/win32/grwin32.c: Fix RGB/BGR ordering -- Win32 uses BGR - ordering for its 24-bit bitmaps. - (SWIZZLE): New macro (set to undefined). - (grWin32SurfaceRec): Add `bgrBitmap'. - [SWIZZLE]: Add `swizzle_bitmap'. - (gr_win32_surface_done) [SWIZZLE]: Handle `swizzle_bitmap'. - (gr_win32_surface_refresh_rectangle): Do conversion RGB->BGR. - (gr_win32_surface_init): Initialize `bgrBitmap'. - [SWIZZLE]: Initialize `swizzle_bitmap'. - -2006-07-03 Masatake YAMATO - - * src/ftvalid.c (library): Move this global variable to main as a - local variable. - (print_usage): Introduce function static variable `library'. - Add one argument for initializing the static variable. - (main): Call print_usage with `library'. - (main, else, parse_table_specs, find_validation_flag): Call - print_usage with NULL. - -2006-06-17 Masatake YAMATO - - * src/ftvalid.c: Rearrange code. - (library): Make variable having global scope. - (OT_VALIDATOR_SYMBOL): Remove. - (GX_VALIDATOR_SYMBOL): Remove. - (CKERN_VALIDATOR_SYMBOL): Remove. - (validator_symbols): Remove. - (ValidatorType::LAST_VALIDATE): New enum element used in loop - sentinel. - (ot_table_spec): Remove const modifier. - (gx_table_spec): Remove const modifier. - (Validator): New data type. - (validators): New variable. - (print_usage): Use validators. - (report_header, report_result): Use validators. - (is_ot_validator_implemented): New function. - (is_gx_validator_implemented): New function. - (is_ckern_validator_implemented): New function. - (run_ckern_validator): Use validators. - (main): Initialize library at the beginning of main. - Use validators. - Report messages and exit if the validator specified by command line - is not implemented in libfreetype2 linked to ftvalid. Suggested by - George Williams. - -2006-06-09 Werner Lemberg - - * src/ftcommon.c (FTDemo_Install_Font): Fix index range for MS - Symbol. - -2006-06-07 Werner Lemberg - - * src/ftcommon.c (FTDemo_Display_Done, FTDemo_Done): Protect against - NULL argument. - - * src/ftview.c (Fatal): New function to finalize FreeType library. - This allows using FreeType's memory debugger in case of errors. - s/PanicZ/Fatal/. - -2006-06-04 David Turner - - * src/ftbench.c (main): fixed a subtle memory corruption bug - at program exit. Reported by . - -2006-05-21 Werner Lemberg - - * src/ftdump.c (Print_Type): Fix type for `module'. Reported by - Mark Wang. - -2006-05-17 Werner Lemberg - - * src/ftcommon.c, src/ftview.c [_WIN32]: Define `strcasecmp' and - `snprintf'. - -2006-05-17 yi luo - - * graph/win32/rules.mk: Add support for icl compiler. - - * src/ftcommon.c (strcasecmp): Define to `_stricmp' if not - available. - - * src/ftview.c (snprintf): Define to `_snprintf' if not available. - -2006-05-12 Werner Lemberg - - - * Version 2.2.1 released. - ========================= - - -2006-05-10 Werner Lemberg - - * Makefile (clean distclean) [no_config_mk]: Fix warning message. - (dist): New target to build .tar.bz2, .tar.gz, and .zip bundles. - Note that there are still many hard-coded version strings. - -2006-05-06 Werner Lemberg - - * src/ftdump.c (main): Fix compiler warning. - -2006-05-02 David Turner - - Add support for font preloading with the `-p' flag, simulating - memory-mapped file access. - - * src/ftcommon.h (TFont): New elements `file_address' and - `file_size'. - (FTDemo_Handle): New element `preload'. - (FTDemo_Set_Preload): New prototype. - - * src/ftcommon.c (my_face_requester): Use FT_New_Memory_Face for - preloaded font. - Handle PFM files also. - (FTDemo_Install_Font): Handle preloading (this is, load font into a - buffer). - (FTDemo_Set_Preload): New function. - - * src/ftview.c (status): Add `preload' field. - (parse_cmdline): Handle `-p' command line option. - (usage): Updated. - (main): - - * src/ftdump.c (main): Add glyph count dump. - -2006-04-26 David Turner - - - * Version 2.2 released. - ======================= - - -2006-04-24 Werner Lemberg - - * src/ftview.c (Render_Stroke): Update parameters in call to - FT_Stroker_New. - -2006-03-20 David Turner - - Disable cache statistics dump, since the cache - internals are not available anymore. - Rename `-l' to `-L'. - Add new command line options `-m text' and `-l render_mode'. - - * src/ftview.c (status): Add member `lcd_mode'. - (Render_Text): Compensate the additional empty pixels inserted by - Draw_Index. - Handle number of glyph indices better. - (parse_cmdline): Handle `-m' and `-l'. - Updated. - (usage): Updated. - (main): Handle `status.lcd_mode'. - Updated. - Print cache statistics only conditionally (for FreeType versions - lower than 2.2). - -2006-03-02 Chia-I Wu - - * src/ftcommon.c (string_render_prepare): Fix a possible crash. - -2006-02-28 suzuki toshiya - - * Makefile: include modules.cfg to reflect module configuration, - and ftvalid is built when required stubs (ftgxval and ftotval) - are built in libfreetype. - -2006-02-27 suzuki toshiya - - * mac/ftoldmac.m68k_far.make.txt, mac/ftoldmac.ppc_classic.make.txt: - Update to new header inclusion introduced on 2006-02-16. - -2006-02-27 Chia-I Wu - - * src/ftcommon.c (my_face_requester): Attach the AFM only for PFA - and PFB. - -2006-02-25 Werner Lemberg - - * src/ftbench.c, src/ftcommon.c, src/ftvalid.c: Add proper casts - where necessary to allow compilation with C++. - Other minor fixes to remove compiler warnings. - -2006-02-01 Werner Lemberg - - * Makefile (PLATFORM): Define to `unixdev' if PLATFORM=unix and - DEVEL_DIR is defined. - (BIN_DIR, OBJ_DIR): Replaced with... - (BIN_DIR_2, OBJ_DIR_2): New variables, set with `?='. - Update all callers. - (BIN_DIR): Set also. - (COMPILE): Add definition for FT_CONFIG_MODULES_H since we always - build with an uninstalled FreeType version. - (ftdump.$(SO), ftvalid.$(SO), ftview.$(SO)): Add -DFT2_BUILD_LIBRARY - since these programs use internal headers. - - * graph/rules.mk, graph/*/rules.mk: s/OBJ_DIR/OBJ_DIR_2/. - - * src/ftcommon.c (string_render_prepare): Fix compiler warnings. - -2006-01-16 Chia-I Wu - - Add support for track kerning and a new rendering mode for kerning - comparison to ftstring. - - * src/ftcommon.c (my_face_requester): Try to attach the file having - the same name as the font, but with suffix `.afm'. - (FTDemo_New): Updated. - (FTDemo_String_Set_Kerning, FTDemo_String_Set_Vertical): Removed. - (string_load): Rewritten. - (string_render_prepare): New function. - (FTDemo_String_Draw): Rewritten to have more flexibility. For - example, we can now draw the string twice with different kerning - modes without reloading the glyphs. - - * src/ftcommon.h (TGlyph): Add more data, mainly taken from - FTDemo_Handle structure. - (KERNING_DEGREE_XXX): New enumerations. - (FTDemo_String_Context): New structure. - (FTDemo_Handle): Updated. - (FTDemo_String_Set_Kerning, FTDemo_String_Set_Vertical): Removed. - (FTDemo_String_Draw): Updated. - - * src/ftstring.c: Updated along with many cleanups. - (CELLSTRING_HEIGHT): New macro. - (RENDER_MODE_XXX): New enumeration values. - (status): Add more fields. - (event_help, event_angle_change): Updated. - (event_render_mode_change): New function. - (Process_Event): Handle `1', `2', and `t' events. - Update handling of `g', `k', and `V' events. - (error_message): Renamed to... - (write_header): This. - Display point size and rotation angle. - (main): Handle new render mode. - -2006-01-12 suzuki toshiya - - Add `ftoldmac' commandline program to test MacOS specific feature: - font file access by FSSpec, font file search by old/new QuickDraw, - and font name or ATS font name. - - * mac/ftoldmac.c: Added. - * mac/Makefile: Unix Makefile for MacOS X. - * mac/ftoldmac.m68k_far.make.txt: MPW Makefile skeleton. - * mac/ftoldmac.ppc_carbon.make.txt: MPW Makefile skeleton. - * mac/ascii2mpw.py: Python script to generate MPW Makefile from - the skeletons. - * mac/README: Add note about ftoldmac, because ft2demos/mac was - originally for demos built by CodeWarrior. - -2005-12-08 Chia-I Wu - - * src/ftview.c (error_message): Renamed to write_header. - Also write face size, first glyph index. - Write glyph name if available. - (main): Updated to use write_header. - -2005-12-04 Chia-I Wu - - * src/ftbench.c: Update copyright date. - Use `getopt' from `common.h'. - -2005-12-04 Chia-I Wu - - * src/ftbench.c: Formatting. - Make `face' and `charset' local variables. - (btest_t): Use `const' qualifier for `title'. - (bcharset_t): Change the type of `size' to `FT_Int'. - (face_requester, benchmark): Updated because `face' is no longer - global. - (test_get_char_index, test_cmap_cache, get_charset): Updated because - `charset' is no longer global. - (main): New variables, `face' and `charset'. - Updated because `face' and `charset' are local now. - `get_charset' only when perform FT_BENCH_CMAP. - -2005-12-02 Chia-I Wu - - Overhaul `ftbench.' Now it can perform tests with arbitrary load - flags and render mode. Testing `Render' instead of `Load + Render', - for example, is also possible now. - - * src/ftbench.c: Overhauled. - -2005-11-30 Werner Lemberg - - Replace flag `-c' with `-v' to indicate verbosity. - - * src/ftdump.c (verbose): New global variable. - (usage): Updated. - (Print_Charmaps): Only take a single argument. Update caller. - Always show some charmap info. - Use `verbose'. - (main): Remove verbose_cmap. - Handle `-v' instead of `-c'. - - * src/common.c (getopt): s/illegal/invalid/. - -2005-11-30 Chia-I Wu - - * src/ftdump.c (Print_Charmaps): face->charmap might be NULL. - -2005-11-30 Chia-I Wu - - * src/ftdump.c (main): New command line option `c' to show the - contents of charmaps. - (Print_Charmaps): Take one more argument: `verbose'. - (usage): Updated. - -2005-11-21 Werner Lemberg - - * graph/grinit.c (grDoneDevices): New function. - - * graph/graph.h (grInit, grDone): Remove unused declarations. - (grDoneDevices): New declaration. - - * src/ftcommon.c (FTDemo_Display_Done): Call grDoneDevices. - (FTDemo_Done): Free `handle'. - - * src/ftmulti.c (main): Call grDoneSurface and grDoneDevices. - -2005-11-18 Werner Lemberg - - * src/ftvalid.c (run_ot_validator, run_gx_validator, - run_ckern_validator): Remove unused variable `memory'. - -2005-11-18 suzuki toshiya - - * src/ftvalid.c: Use FT_TrueTypeGX_Validate, FT_ClassicKern_Validate - and FT_OpenType_Validate instead of FT_FREE (it calls FT_Free_Debug - of libfreetype, which is not a public function). - -2005-11-16 David Turner - - * graph/graph.h: Updated. - - * graph/grdevice.c (grSurfaceDone): New function to free surface - correctly. This was commented out previously. - - * graph/x11/grx11.c (gr_x11_device_done): Call XFreeCursor. - (gr_x11_surface_done): Call XFreeGC to fix memory leak. - - * src/ftcommon.c (FTDemo_Display_Done): Call `grDoneSurface' instead - of `free' to fix memory leak. - - * src/ftbench.c (main): Add the `-c' flag to specify maximum - iteration count. Useful for repeat profiling. - (usage): Updated. - -2004-09-29 Werner Lemberg - - * src/ftcommon.c (FT_Demo_Update_Current_Flags): Fix variable - shadowing. - -2004-09-27 David Turner - - Fix gamma handling, mainly for LCD modes. - - * graph/gblgblit.c (GRGB_TO_RGB565): Protect arguments correctly. - - * graph/gblcolor.h, graph/gblhbgr.h, graph/gblhrgb.h, - graph/gblvbgr.h, graph/gblvrgb.h: Call gblender_use_channels. - - * graph/gblender.c (gblender_clear, gblender_reset): Handle blender - cache. - (gblender_use_channels): New function. - (gblender_reset_key): Improve. - (gblender_lookup, gblender_lookup_channel): Comment possible call to - gblender_reset. - Fix computation of `idx'. - (gblender_reset_channel_key): Fix computation of `a' and `r'. - - * graph/gblender.h (GBLENDER_SHADE_INDEX): Corrected definition. - (gblender_use_channels): New declaration. - - * src/Jamfile: Include ftcommon.c. - Fix oder of link libraries. - -2004-09-22 David Turner - - * src/ftcommon.c (FTDemo_Update_Current_Flags): Fix load flags - computation to mimic libXft's behaviour. - -2005-08-30 Werner Lemberg - - * graph/graph.h (grFillRectangle): Comment out -- we don't have an - implementation. - -2005-08-23 Masatake YAMATO - - * src/ftvalid.c: Add gxvalid support. - (GX_VALIDATOR_SYMBOL): New definition. - (CKERN_VALIDATOR_SYMBOL): New definition. - (ValidatorType::GX_VALIDATE): New enum member. - (ValidatorType::CKERN_VALIDATE): New enum member. - (validator_symbols): Added GX_VALIDATOR_SYMBOL and - CKERN_VALIDATOR_SYMBOL. - (gx_table_spec): New const. - (N_GX_TABLE_SPEC): New definition. - (print_usage): Write about gxvalid and ckern valid. - (run_gx_validator): New function. - (list_gx_tables): Ditto. - (run_ckern_validator): Ditto. - (list_ckern_tables): Ditto. - (main): Call new validators. - - * src/ftvalid.c: Following are misc modifications. - (report_result): Use printf instead fprintf. Fix incorrect message. - (main): Use switch/case instead of if/else - when calling per validator functions. - Call FT_Done_Face. Use a loop to set validator. - (print_usage): Insert empty line in usage strings. - (validator_symbols): Added NULL as the last - array element. - -2005-07-04 Chia I Wu - - * src/ftcommon.i: Removed. - - * src/ftgamma.c: Updated to use api provided by ftcommon.c. - - * Makefile: Make ftgamma depend on ftcommon.c. - Remove dependency of ftmulti.c on ftcommon.i. - -2005-06-17 Werner Lemberg - - * Makefile: Update rules for ftview and ftstring which no longer - depend on ftcommon.i but on ftcommon.c. - - (LINK_ITEMS, LINK_CMD, LINK_LIBS): New variables. - (GRAPH_LINK2): Removed. - (COMMON_LINK, GRAPH_LINK): Replace with... - (LINK_COMMON, LINK_GRAPH): This. Use LINK_ITEMS, LINK_CMD, and - LINK_LIBS. - Update all affected targets. - (LINK_NEW): Temporary new link command to handle executables which - use ftcommon.c. - (FTCOMMON_OBJ): New variable to handle ftcommon.c. - -2005-06-17 Chia I Wu - - * src/ftcommon.c, src/ftcommon.h: New files. - - * src/ftstring.c: Rewritten. - Make the function keys more compatible with ftview.c. - New key 'V' for vertical rendering. - - * src/ftview.c: Rewritten. - Now we can use number keys (i.e. 1, 2, ...) to select rendering mode. - -2005-06-08 Werner Lemberg - - - * Version 2.1.10 released. - ========================== - - -2005-05-26 Werner Lemberg - - * src/ftcommon.i (get_glyph_bitmap, glyph_to_bitmap): Initialize - `target->grays' even for FT_PIXEL_MODE_MONO since it is tested in - grBlitGlyphToBitmap. - - * graph/x11/grx11.c (gr_x11_surface_init): Initialize - `xswa.border_pixel'. - -2005-05-25 Chia I Wu - - * src/ftcommon.i: Include FT_SYNTHESIS_H. - Make `render_mode' an enumeration. - - * src/ftview.c (Render_Embolden): New function. - (Process_Event, main): Update to `render_mode' enumeration. - -2005-05-23 Werner Lemberg - - * src/ftvalid (main) <'v'>: Add cast to make it compile with C++. - -2005-04-24 YAMATO Masatake - - * src/ftvalid.c: New file. - - * Makefile, src/Jamfile: Add ftvalid. - -2005-03-04 Werner Lemberg - - * src/ftgamma.c (Render_GammaGrid), src/ftmulti.c - (parse_design_coords), src/ftview.c (Render_GammaGrid): Fix compiler - warnings. - -2005-02-28 David Turner - - * src/ftbench.c (preload, memory_file, memory_size): New global - variables. - (bench_open_close): Handle `preload' by using `FT_New_Memory_Face'. - (main): Remove `preload', `memory_file', and `memory_size'. - -2005-02-23 David Turner - - * src/ftbench.c (fetch_test, cbox_test): Fix memory leaks. - -2005-02-12 Werner Lemberg - - Make ft2demos support a separate build directory. - - * Makefile (have_makefile): New variable. Set if the build - directory is the same as the source directory. - (GRAPH_DIR): Give full path. - (BIN_DIR, OBJ_DIR): Updated. - (FT_INCLUDES): Include $(OBJ_BUILD). - (LINK) : Fix path to `libtool'. - - * README: Updated. - -2004-12-15 Werner Lemberg - - * src/ftcommon.i (glyph_to_bitmap): Don't convert 1bpp bitmaps. - -2004-12-14 Werner Lemberg - - * src/ftcommon.i: Include new FT_BITMAP_H. - Remove dead code. - (ft_bitmap): New global variable. - (init_freetype): Call FT_Bitmap_New. - (done_freetype): Call FT_Bitmap_Done. - (glyph_to_bitmap, get_glyph_bitmap): Handle 2bpp and 4bpp bitmaps - using FT_Bitmap_Convert. - -2004-12-12 Steve Hartwell - - * graph/grblit.c (blit_mono_to_rgb32): Advance read buffer properly. - -2004-11-26 Jouk Jansen - - * vms_make.com: Don't assume that the ft2demos package is a - subdirectory of freetype2. - Fix `ccopt'. - -2004-11-19 Werner Lemberg - - * src/ftview.c (Render_Waterfall): Handle size as points, not as - pixels. - - * src/ftstring.c (layout_glyphs), src/ftmulti.c (LoadChar), - src/ftcommon.i (set_current_image_type): Always use - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH. - -2004-11-16 Dr. Martin P.J. Zinser - - * vms_make.com: Updated to be in sync with vms_make.com from FT2. - -2004-10-18 Werner Lemberg - - * graph/gblblit.c (gblender_blit_init): Fix blit test. - -2004-09-08 Jouk Jansen - - * graph/x11/grx11.c [__VMS]: Include vms_x_fix.h. - - * vms_make.com: Updated. - -2004-08-29 Werner Lemberg - - * graph/gblender.c (gblender_lookup, gblender_lookup_channel): - s/index/idx/ to avoid compiler warnings. - -2004-08-19 Werner Lemberg - - * src/ftstring.c (prepare_text): Handle encoding = 0. - -2004-07-14 Werner Lemberg - - * src/ftcommon.i (get_glyph_bitmap): Don't accept a `missing' - character with zero or negative width. - -2004-07-13 David Turner - - * graph/x11/grx11.c (gr_x11_device_init): Fix memory leak. - - * src/ftbench.c (bench_cmap_parse): New function, assigned to - key `j'. - (usage, main): Updated. - - * src/ftcommon.i (install_font_file): Initialize `cmap_index' here. - (my_face_requester): Don't initialize `cmap_index'. - (glyph_to_bitmap): Add new argument to get glyph reference. - (get_glyph_bitmap): Updated. - - * src/ftview.c (Render_Stroke): Increase stroker limit. - Fix glyph indices. - Fix memory leaks. - -2004-06-24 David Turner - - - * Version 2.1.9 released. - ========================= - - -2004-06-24 Werner Lemberg - - * Makefile (GRAPH_LINK): Add $(MATH). - Remove $(MATH) from link rule for ftstring. - -2004-06-23 Werner Lemberg - - * src/ftbench.c: Fix compiler warnings. - (usage): Updated. - -2004-06-23 David Turner - - * src/ftbench.c (bench_open_close): New benchmark to measure face - open/close performance (controlled by the `i' flag for the `-b' - command-line option flag). - (main): Use it. - -2004-06-11 Werner Lemberg - - * src/ftstring.c (layout_glyphs): Updated to latest FreeType library - changes. - -2004-06-03 Werner Lemberg - - Add autohinting toggling (using the `f' key) to ftstring. - Handle new inter-letter spacing support for autohinting. - - * src/ftstring.c (autohint): New global variable. - (layout_glyphs): Handle `autohint' variable. - Handle new `lsb_delta' and `rsb_delta' elements of - face->glyph->metrics. - Remove some dead code. - (Help): Updated. - (Process_Event): Handle key `f'. - Extend key `k'. - -2004-05-23 Werner Lemberg - - * graph/gblender_blit.c: Renamed to... - * graph/gblblit.c: This. - Updated to use new include file names. - (gblender_blit_init): Change 11th argument to `unsigned char*' - - * graph/gblender_blit.h: Renamed to... - * graph/gblblit.h: This. - Updated. - - * graph/gblender_blit_any.h: Renamed to... - * graph/gblany.h: This. - Updated to use new include file names. - - * graph/gblender_blit_hbgr.h: Renamed to... - * graph/gblhbgr.h: This. - - * graph/gblender_blit_hrgb.h: Renamed to... - * graph/gblhrgb.h: This. - - * graph/gblender_blit_vbgr.h: Renamed to... - * graph/gblvbgr.h: This. - - * graph/gblender_blit_vrgb.h: Renamed to... - * graph/gblvrgb.h: This. - - * graph/gblender.h (GBLENDER_CHANNEL_VARS): Remove final `;'. - * graph/grblit.c: Updated to use new include file names. - - * graph/rules.mk, graph/Jamfile: Updated. - - * Makefile: Build `ftgamma'. - - * src/ftview.c (Render_GammaGrid): Fix compiler warnings. - (Help): Updated. - - * src/ftgamma.c: Fix compiler warnings. - -2004-05-20 David Turner - - Adding support for fast gamma-corrected alpha-blending. - New test program `ftgamma'. - - * graph/grblit.c: Include gblender_blit.h. - (GRAY8): New macro. - (blit_gray8_to_555, blit_gray8_to_565, blit_gray8_to_24, - blit_lcd8_to_24, blit_lcd28_to_24) [GRAY8]: New functions. - (blit_gray8_to_32): New function. - (gr_gray8_blitters) [GRAY8]: New function table. - (grSetGlyphGamma): New function. - (grBlitGlyphToBitmap): Implement blending. - * graph/graph.h (grSetGlyphGamma): New declaration. - - * graph/grfont.c, graph/grfont.h (grSetPixelMargin): New function. - - * graph/gblender.c, graph/gblender.h, graph/gblender_blit.c, - graph/gblender_blit.h, graph/gblender_blit_any.h, - gblender_blit_color.h, gblender_blit_hbgr.h, gblender_blit_hrgb.h, - gblender_blit_vbgr.h, gblender_blit_vrgb.h: New files. - - * graph/Jamfile (graph_sources): Add gblender and gblender_bnit. - * graph/rules.mk (GRAPH_H, GRAPH_OBJS): Updated. - - * src/ftcommon.i (the_gamma): New global variable. - (Init_Display): Call grSetGlyphGamma. - - * src/ftgamma.c: New demo program. - - * src/ftview.c: Include math.h. - (Render_GammaGrid): New function. - (Help): Updated. - (Process_Event): Assign increase and decrease of gamma value to - keys `g' and `G'. - Assign gamma grid rendering mode to key `K'. - (main): Updated. - - * src/Jamfile (LINKLIBS): Add -lm. - (GRAPHIC_PROGRAMS): Add ftgamma.c. - Add LINKLIBS for all GRAPHIC_PROGRAMS. - * vms_make.com: Updated. - -2004-05-19 George Williams - - * src/ftmulti.c (main): Use default axis values. - -2004-05-09 Werner Lemberg - - * src/ftdump.c (put_unicode_be16): Initialize `ch'. - -2004-04-29 Flavio Stanchina - - Parse SFNT `name' table in ftdump if new option -n is given. - - * src/ftdump.c: Include FT_SFNT_NAMES_H and FT_TRUETYPE_IDS_H. - (name_tables): New global variable. - (usage): Show -d and -i info conditionally. - Add -n info. - (platform_id, name_id, put_ascii, put_unicode_be16, - Print_Sfnt_Names): New functions. - (main): Handle -n. - -2004-04-24 George Williams - - Add GX var font support to ftmulti. - Add command line option `-d' to ftmulti to select design - coordinates. - - * src/ftmulti.c: New global variables `requested_pos' and - `requested_cnt'. - Make `multimaster' a pointer. - (parse_design_coords): New function. - (Help, usage): Updated. - (Process_Event) : Don't use fixed 20 unit steps but a - proportional granularity. - Use FT_Set_Var_Design_Coordinates instead of - FT_Set_MM_Design_Coordinates. - (main): Handle new option `-d'. - Use FT_Get_MM_Var and FT_Set_Var_Design_Coordinates instead of - FT_Get_Multi_Master and FT_Set_MM_Design_Coordinates. - -2004-04-23 Werner Lemberg - - * src/ftcommon.i (TFont): Add `cmap_index'. - (my_face_requester): Set `font->cmap_index'. - (get_glyph_index): Properly set third argument. - -2004-04-21 David Turner - - - * Version 2.1.8 released. - ========================= - - -2004-04-10 Werner Lemberg - - * src/ftbench.c (cmap_cache_test, main): Use proper cast for - `face_id'. - -2004-03-26 Ulrich - - * graph/x11/grx11.c (grX11DeviceRec): Add `visual' member. - (gr_x11_device_init): Directly manipulate `x11dev'. - Use XGetVisualInfo. - (gr_x11_surface_init): Directly use `x11dev'. - Fix other visual selection problems. - -2004-03-20 Steve Hartwell - - Updated to make it compile with newer MacOS versions. - - * graph/mac: Don't include Windows.h but MacWindows.h. - Include SIOUX.h only if __MWERKS__ is defined. - (refresh_rectangle): Updated. - (listen_event): Remove `theEventMask'. - Updated. - Make code conditional to __MWERKS__ which is related to SIOUX. - (init_surface): Handle gr_pixel_mode_rgb24. - Updated. - -2004-02-20 Werner Lemberg - - Add `light' render mode to ftview (using key `L'). - - * src/ftcommon.i (set_current_image_type): Handle - FT_LOAD_TARGET_LIGHT. - (glyph_to_bitmap, get_glyph_bitmap): Updated. - * src/ftview.c (Process_Event): Provide proper header for `light' - render mode. - (Help): Updated. - -2004-02-18 Werner Lemberg - - * src/ftcommon.i: Include FT_CACHE_MANAGER_H and FT_STROKER_H. - Don't include obsolete FT_CACHE_* macros. - (glyph_to_bitmap): Remove declaration of `error'. - - * src/ftview.c: Don't include FT_CACHE_MANAGER_H. - (Render_Stroke): Remove declaration of `error'. - Fix other compiler warnings. - (Render_Waterfall): Remove declaration of `face'. - -2004-01-29 David Turner - - * src/ftcommon.i (get_glyph_bitmap): Rewritten for new cache code. - (glyph_to_bitmap): New function. - - * src/ftview.c (Render_Stroke): New function. - (Render_Waterfall): Use FTC_Manager_LookupFace. - (Process_Event) <' '>: Provide header text for stroked text. - (main): Add Render_Stroke. - -2003-12-26 Werner Lemberg - - * src/ftcommon.i (set_current_size): Don't allow values larger than - 0xFFFF. - * src/ftview.c (main): Set `face'. - (Render_Waterfall): Don't set `face'. - use precomputed value instead. - (main): Don't use `face->' but `size->face->'. - Use `exit' in case of fatal error. - Don't test `face' but `size' for printing error messages. - Print proper error message for FT_Err_Invalid_PPem. - -2003-12-21 David Turner - - * graph/graph.h (grPixelMode): Add `gr_pixel_mode_lcd2' and - `gr_pixel_mode_lcdv2' modes. - (grBlitGlyphToBitmap): Remove `is_bgr' argument. - Updated all callers. - * graph/grblit.c (blit_mono_to_pal8): Speed up loop. - (blit_lcd_to_24, blit_lcdv_to_24): Remove `is_bgr' argument. - (blit_lcd2_to_24, blit_lcdv2_to_24): New functions. - (compute_clips): Updated. - (grBlitGlyphToBitmap): Remove `is_bgr' argument. - Use new blitter functions for the two new modes. - - * graph/win32/Jamfile: s/TOOLSET/JAM_TOOLSET/. - - * src/gbench.c, src/gbench.h: New files. - - * src/Jamfile: Handle `gbench'. - - * src/ftbench.c, src/ftcommon.i, src/ftview.c: Updated to use new - FreeType cache implementation and new blitter modes. - -2003-11-10 Werner Lemberg - - Add display of bitmap fonts to ftstring. - - * src/ftstring.c (layout_glyphs): Call FT_Vector_Transform for - scalable fonts only. - (render_string): Handle bitmap fonts. - -2003-11-07 Werner Lemberg - - - * Version 2.1.7 released. - ========================= - - -2003-11-06 David Turner - - - * Version 2.1.6 released. - ========================= - - -2003-11-01 Werner Lemberg - - * src/testname.c: Include ft2build.h. - -2003-10-22 Werner Lemberg - - * src/ftdump.c (usage): Fix typo. - -2003-10-17 Werner Lemberg - - * src/ftmulti.c (main): Call `FT_Done_Face'. - - * src/ftstring.c (main): Clean up glyph and face objects, then - finish FreeType library. - -2003-10-10 Werner Lemberg - - * src/ftmulti.c (Help): Document all keys. - (main): Call FT_Done_FreeType. - -2003-09-02 David Turner - - - * Version 2.1.5 released. - ========================= - - -2003-06-30 Werner Lemberg - - * src/ftdump.c (Print_Fixed): Print all elements of - face->available_sizes. - -2003-06-17 Werner Lemberg - - * src/*.c: s/ft_glyph_format_*/FT_GLYPH_FORMAT_*/. - s/ft_pixel_mode_*/FT_PIXEL_MODE_*/. - s/ft_glyph_bbox_*/FT_GLYPH_BBOX_*/. - -2003-06-16 YAMANO-UCHI Hidetoshi - - * graph/x11/rules.mk (GRAPH_LINK): Add run-time search path on - Unix systems. - -2003-06-16 Werner Lemberg - - * src/ftcheckfixedwidth.c: Renamed to... - * src/ftchkwd.c: This. - * src/testnames.c: Renamed to... - * src/testname.c: This. - * src/Jamfile, Makefile: Updated. - -2003-06-15 Werner Lemberg - - * *.mk: Updated and revised to latest changes in FreeType 2. - -2003-06-13 Werner Lemberg - - * src/ftdump.c (Print_Type): Don't emit bbox, ascender, descender, - and height for non-scalable fonts. - -2003-06-08 Werner Lemberg - - * graph/x11/grx11.c (gr_x11_surface_init): Add proper cast in call - to grAlloc. - - * src/ftbench.c (main): Add proper cast in call to malloc. - Use FT_ENCODING_NONE, not 0. - -2003-06-01 Werner Lemberg - - * src/ftview.c (Render_Waterfall): Handle fixed-sized fonts better. - -2003-05-27 Martin Zinser - - * vms_make.com: Handle ftbench. - -2003-05-21 Werner Lemberg - - * src/ftcommon.i (install_font_file): Initialize new elements of - reallocated `fonts' array with zero bytes. - -2003-05-20 Martin Zinser - - * descrip.mms: Removed. Now created by... - - * vms_make.com: New file. - -2003-05-19 Werner Lemberg - - * src/ftcommon.i (install_font_file): Use calloc to allocate - `fonts'. - (done_freetype): Deallocate `fonts'. - -2003-04-28 Werner Lemberg - - * src/ftcheckfixedwidth.c: Remove unused global variables; make - global variables local to `main' if possible. - Fixed compiler warnings (s/index/idx/). - -2003-04-25 Davor Buvinic - - * Makefile: Add rules to build ftcheckfixedwidth. - -2003-04-24 Anthony Fok - - * src/ftcommon.i: Replace `ft_encoding_*' with `FT_ENCODING_*'. - (file_suffixes): Add `.otf'. - (install_font_file): Set font->num_indices depending on encoding. - * src/ftmulti.c, src/ftstring.c, src/fttimer.c, src/ftview.c: - Replace `ft_encoding_*' with `FT_ENCODING_*'. - * src/testnames.c: Replace `ft_render_mode_mono' with - `FT_RENDER_MODE_MONO'. - -2003-04-09 David Turner - - * Jamfile: Set FT2_TOP. - * src/ftbench.c (main): Use `long' for `max_bytes'. - * src/ftcheckfixedwidth.c: New test program. - * src/ftstring.c: (prepare_text): Remove unused variable `codepoint'. - (apply_gamma): Fix initialization of `buffer'. - * src/ftview.c (Render_Waterfall): Print more characters. - -2003-04-08 David Turner - - - * Version 2.1.4 released. - ========================= - - -2002-12-02 Antoine Leca - - * src/ftstring.c: Use `FT_ENCODING_*' everywhere instead of - deprecated lowercase variants. - (prepare_text): 'message' for the -m option is now expected to be - encoded with UTF-8. This allows testing of Unicode chars, including - non-BMP characters. - -2002-12-01 Antoine Leca - - * graph/win32/rules.mk: Adding link rules for Borland C++. - -2002-11-18 David Turner - - - * Version 2.1.3 released. - ========================= - - -2002-11-10 David Turner - - * src/Jamfile (PROGRAMS): Add `ftcheckfixedwidth'. - -2002-09-25 David Turner - - * graph/win32/grwin32.c: Removing compiler warnings. - - * descrip.mms: Removing 'ftmemchk' and 'testnames' from the list - of programs to compile, these are now obsolete. - -2002-09-25 Anthony Fok - - * src/ftbench.c: The program did perform out-of-bound memory writes - with certain fonts containing a buggy charmap. - -2002-09-18 Werner Lemberg - - Add LCD BGR support. - - * graph/grblit.c (blit_lcd_to_24, blit_lcdv_to_24): Add parameter - `is_bgr' to assign color components in reversed order. - (grBlitGlyphToBitmap): Add parameter `is_bgr' passed on to - `blit_lcd_lcd*'. - Updated all callers. - Remove unused label. - * graph/graph.h, graph/grfont.c: Updated. - - * src/ftcommon.i (set_current_image_type), src/ftview.c (Render_All, - Render_Text, Render_Waterfall, Process_Event): Handle LCD modes - 3 and 4. - * src/ftstring.c, src/ftmulti.c: Updated. - - * graph/x11/grx11.c (gr_x11_device_init, gr_x11_surface_init): - Remove unused variables. - (gr_x11_format_rgb555): Fix typos. - -2002-09-08 David Turner - - Add support for sub-pixel rendering. - - * graph/x11/grx11.c, graph/win32/grwin32.c: Completely rewritten to - support 24-bits RGB surfaces. This is needed to test sub-pixel - rendering. - - Note that other drivers haven't been touched yet. The X11 driver - doesn't work with 8-bit displays for now, but a reduced mode will - probably be introduced in the near future. - - * graph/graph.h (grPixelMode): Add `gr_pixel_mode_lcd' and - `gr_pixel_mode_lcdv'. - * graph/grblit.c (compute_clips): Use `gr_pixel_mode_lcd' and - `gr_pixel_mode_lcdv'. - (compose_pixel_full): New macro. - (compose_pixel): Use it. - (blit_lcd_to_24, blit_lcdv_to_24): New functions. for RGB-decimated - modes (BGR not yet implemented). - (gr_color_blitters): Updated. - (grBlitGlyphToBitmap): Support new pixel modes. - - * src/Jamfile (PROGRAMS): Don't include fttimer, fttry, and - testnames. - - * src/ftbench.c: Updated to latest changes in FreeType library. - * src/ftcommon.i (Init_Display): New default mode is - `gr_pixel_mode_rgb24'. - (set_current_image_type, get_glyph_bitmap): Add support for LCD - modes (horizontal and vertical). - * src/ftview.c (Render_Waterfall): Call `set_current_size'. - (Help): Document new `L' key for cycling through the pixel modes. - (Process_Event): Handle `L' key. - -2002-08-04 Vincent Caron - - * src/ftcommon.i (Text), src/ftmulti.c (Text): s/jumped/jumps/. - * src/ftview.c (Render_Waterfall): Remove unused variable. - -2002-07-03 David Turner - - * src/ftview.c (Render_Waterfall): New function, adding a - "waterfall" rendering mode (accessible by cycling modes with the - space bar). - (Process_Event, main): Use it. - -2002-07-01 David Turner - - * src/ftbench.c: Adding the "-p" option to pre-load font files in - memory. This is a very useful thing to quantify the performance - improvements achieved by many of FreeType internal optimizations - regarding stream i/o. - - * src/ftstring.c (reset_transform): Fix Werner's incorrect fix. - -2002-06-25 Werner Lemberg - - * src/ftstring.c (reset_transform): Fix transformation matrix. - -2002-06-23 Vincent Caron - - Adding support for gamma-corrected display to ftstring (assigned to - `g', F9, and F10 keys). - - * src/ftstring.c (use_gamma, gamma_value, gamma_ramp): New global - variables. - (init_gamma, apply_gamma, draw_gamma_ramp): New functions. - (render_string): Use apply_gamma. - (Help): Updated. - (Process_Event): Handle `g', F9, and F10 keys. - (main): Call init_gamma and draw_gamma_ramp. - -2002-06-21 David Turner - - - * Version 2.1.2 released. - ========================= - - -2002-06-14 Werner Lemberg - - * Makefile, graph/rules.mk: s/TOP/TOP_DIR/, s/TOP2/TOP_DIR_2/. - -2002-06-10 Werner Lemberg - - * src/ftbench.c: s/index/idx/. - Fixed more gcc compiler warnings. - -2002-06-10 David Turner - - * src/ftbench.c: Removing compiler warnings. - - * src/ttdebug.c: Updating to latest internal changes. - -2002-06-09 David Turner - - - * Version 2.1.1 released. - ========================= - - -2002-06-07 David Turner - - Adding Vincent Caron's benchmark program. - - * src/ftbench.c: New file. - * Makefile, src/Jamfile: Updated. - Other minor fixes. - - * src/ftview.c (Render_Text): Call get_glyph_index() conditionally. - -2002-05-20 Werner Lemberg - - * src/ftcommon.i (get_glyph_bitmap): Use `sbit->num_grays'. - Handle `sbit->buffer == 0' correctly. - -2002-05-17 Michael Pfeiffer - - * graph/beos/Jamfile: New file. - -2002-05-12 Werner Lemberg - - * README: Updated. - -2002-05-12 Michael Pfeiffer - - * graph/Jamfile: Add support for BeOS. - -2002-04-28 Werner Lemberg - - * src/ftview.c (Render_Text): Don't call `get_glyph_index'. This - is done in `get_glyph_bitmap'. - - * src/ftstring.c (encoding): New global variable, initialized to - `ft_encoding_unicode'. - (render_mode): Removed. - (make_tag): New utility function (copied from ftcommon.i). - (prepare_text): Call `FT_Select_Charmap'. - (Process_Event): Don't handle ` '. - (main): Add option -e to select encoding. - (usage): Document it. - - * src/ftmulti.c (encoding): New global variable. - (make_tag): New utility function (copied from ftcommon.i). - (main): Add option -e to select encoding. - (usage): Document it. - -2002-04-28 Martin Zinser - - * descrip.mms: Add clean target. - Handle compiler options better. - -2002-04-17 David Turner - - - * Version 2.1.0 released. - ========================= - - -2002-04-01 Werner Lemberg - - * graph/x11/grx11.c: Use `c_class' instead of `class' if compiling - with C++. - * src/ftcommon.i (encoding): Use `FT_Encoding' type. Update all - using code. - (done_glyph_bitmap): Use cast. - * src/ftview.c: Updated to changes in `ftcommon.i'. - (main): Use cast for `encoding'. - -2002-03-30 Werner Lemberg - - * src/ftdump.c (Print_Type): Use `%ld' for some fields. - * src/testnames.c (main): Exit if no parameter. - -2002-03-21 David Turner - - * graph/grblit.c, graph/win32/grwin32.c, src/common.c, - src/ftcommon.i, src/ftdump.c: Getting rid of compiler warnings. - -2002-03-08 David Turner - - - * Version 2.0.9 released. - ========================= - - -2002-03-06 David Turner - - * src/ftdump.c: Added display of ascender/descender/text height. - - * Jamfile: Support the FT2_TOP environment variable to indicate - where the FreeType 2 sources are located. This is very useful for - switching between the STABLE and HEAD branches of the library. - -2002-03-05 David Turner - - * src/ftdump.c: Added the display of a font's Postscript name, - EM size and global Bbox. Now supports the debugging mode of - 2.1.x. - - * src/ftview.c: Minor change to support debugging mode of 2.1.x. - -2002-02-14 Detlef Würkner - - * src/fttimer.c (ConvertRaster): Handle embedded bitmaps properly. - * src/ftstring.c (use_sbits): Default value is no 0. - (layout_glyphs): Handle `use_sbits'. - (Process_Event): Make friendlier error messages. - -2002-02-09 David Turner - - - * Version 2.0.8 released. - ========================= - - -2002-02-02 David Turner - - - * Version 2.0.7 released. - ========================= - - -2002-01-25 Martin Zinser - - * src/common.h ([VMS]): Alias stuff specific to getopt. - * graph/grinit.c ([DEVICE_X11]): Handle VMS. - * descrip.mms: New file for compiling the demo programs with - OpenVMS. - -2002-01-07 David Turner - - - * Version 2.0.6 released. - ========================= - - -2001-12-31 Werner Lemberg - - * graph/x11/rules.mk: Fix typo (wilcard -> wildcard). - -2001-12-30 David Turner - - * README: Updated to version 2.0.6. - - * graph/x11/rules.mk: Updated X11 detection rules: "/usr/X11R6" and - "/usr/local/X11R6" are now probed as a fallback. This allows the - test programs to work automatically on Debian Linux systems (which - only use "/usr/bin/X11" in the path). - -2001-12-21 David Turner - - * src/ftcommon.i (get_glyph_bitmap): Added a missing error check. - Make the function return an error code if necessary. - * src/testnames.c (main): Fix typo. - -2001-12-15 Werner Lemberg - - * Makefile: Add `testnames' program. - * src/testnames.c (main): Remove unused variable. - First command line parameter is now used as the font to be tested - instead of a fixed string. - -2001-12-14 David Turner - - * src/ftstring.c (layout_glyphs): Fix centering bug. - -2001-12-12 David Turner - - * src/testnames.c: New test program. - -2001-12-08 David Turner - - Use new charmap cache. - - * src/ftcommon.i: Include FT_CACHE_CHARMAP_H. - (cmap_cache): New global variable. - (encoding): Change type to FT_UInt32. - (init_freetype): Initialize charmap cache. - (get_glyph_index): New function. - (get_glyph_bitmap): Use it. - Increase pixel dimensions to 48 for sbit cache. - Add ftc_image_format_outline flag if not a bitmap glyph. - * src/ftview.c: Use `get_glyph_index'. - -2001-12-06 David Turner - - An update to use the new cache manager code. - - * src/ftcommon.i: s/FTC_Image_Cache/FTC_ImageCache/. - s/FTC_SBit_Cache/FTC_SBitCache/. - s/FTC_Image_Desc/FTC_ImageDesc/. - s/image_type/type/. - (done_glyph_bitmap): New function. - (get_glyph_bitmap): Add new argument. - Use sbits cache only of pixel size <= 32. - Other fixes. - * src/ftview.c (Render_All, Render_Text): Updated to changes in - ftcommon.i. - -2001-12-05 Werner Lemberg - - * src/ftcommon.i, src/ftview.c: s/manager/cache_manager/ to avoid - compiler warnings. - -2001-12-05 Taiji Yamada - - * src/graph/x11/grx11.c (done_surface): Free and reset color map. - (init_surface): Use private colormap if there are no more shared - colormap entries. - -2001-10-27 David Turner - - * src/ftcommon.i (use_sbits_cache): Set to 1. - -2001-10-26 Leonard Rosenthol - - * mac/codewarror/carbonprefix.h: New file to define building - the demos Carbonized. - * mac/codewarror/ftview.prj: Updated for CW7 and to build a - Carbonized version. - * mac/getargv.c: Updated to build Carbonized. - * mac/ftview_m.c: Updated to build Carbonized. - -2001-10-18 David Turner - - * Jamrules: Define X11_LINKLIBS. - * README: Updated. - * graph/os2/Jamfile: Define GROS2_PATH and GRAPH_LINKLIBS. - * src/Jamfile (PROGRAMS): Add fttry. - Fix order of libraries. - * src/ftview.c (main): Update cache dump code. - * src/ftlint.c (main) [TEST_PSNAMES]: Add some debugging code. - * src/fttry.c (main) [DUMP_NAME]: Add some glyph name debugging code. - -2001-10-17 David Turner - - - * Version 2.0.5 released. - ========================= - - -2001-09-21 Eric Olson - - * graph/os2/gros2pm.c: Remove global variable `window_created'. - (LOCK): Fix typo. - (refresh_rectangle): Use LOCK() and UNLOCK(). - (init_surface): Don't use `window_created'. - Use LOCK() and UNLOCK(). - (RunPMWindow): Use LOCK() and UNLOCK(). - Fix typo. - Don't use `window_created'. - (Message_Process): Allow F9, F10, and others keys to pass through - the application. - Use LOCK() and UNLOCK(). - -2001-09-10 Werner Lemberg - - * README: Slight update. - -2001-08-25 Werner Lemberg - - Added CMap support to ftview: The new flag `-e' accepts an encoding - tag as defined in freetype.h (e.g. `unic') to select a character - map. Only fonts with a valid character map are selected. - - * src/ftcommon.i: s/num_glyphs/num_indices/. - (encoding): New global variable. - (make_tag): New function. - (install_font_file): If a cmap tag has been specified, load - functions only which have a valid cmap. - (my_face_requester): Select cmap also if `encoding' is non-zero. - (get_glyph_bitmap): Map char index to glyph if `encoding' is - non-zero. - - * src/ftview.c: s/first_glyph/first_index/. - (Help): Adjust help text. - (usage): Document -e switch. - (main): Implement -e switch. - Adjust `Header'. - - - * Version 2.0.4 released. - ========================= - - -2001-06-27 Werner Lemberg - - * src/ftmemchk.c: s/memtest/ftmemchk/. - -2001-06-27 David Turner - - * src/ftcommon.i, src/ftmemchk.c: Changes due to the modification of - the FT_CALLBACK_DEF macro definition. - -2001-06-24 David Turner - - Renamed the test program "memtest" to "ftmemchk". - - * src/memtest.c: Renamed to ... - * src/ftmemchk.c: This file. - * Makefile, src/Jamfile: Updated. - - - * Version 2.0.3 released. - ========================= - - -2001-05-28 David Turner - - * Jamfile, src/Jamfile, graph/os2/Jamfile, graph/win32/Jamfile, - graph/x11/Jamfile: Updating Jamfiles to correctly link the graphics - programs on all platforms with Jam. - - * src/ftstring.c: Removing debugging output. - -2001-04-25 David Turner - - * graph/beos/grbeos.cpp, graph/beos/grbeos.h, graph/beos/rules.mk, - graph/grinit.c: added BeOS graphics driver to MiGS. - -2001-04-04 Werner Lemberg - - * graph/allegro/gralleg.c, graph/mac/grmac.c, graph/os2/gros2pm.c, - graph/x11/grx11.c: Don't include system-specific header but - `grobjs.h'. - * graph/x11/grx11.c: Some structural reorderings. - Include `grdevice.h'. - * graph/grinit.c: Use subdirectories for #include. - * graph/rules.mk, graph/*/rules.mk (DEVICE_INCLUDE): Removed. - - * Jamrules, Jamfile, */Jamfile: Updated. It now compiles with - X11 also (no checking for X header and lib locations yet). - -2001-04-04 David Turner - - * Jamrules, Jamfile, graph/Jamfile, graph/x11/Jamfile, - graph/win32/Jamfile, graph/os2/Jamfile, src/Jamfile: Added Jamfiles - to build the FreeType 2 demos with Jam. Be careful, they probably - don't work on Unix and OS/2 yet. - -2000-03-24 David Turner - - - * Version 2.0.2 released. - ========================= - - -2001-03-23 David Turner - - * Makefile, src/*.c: Changed to new header inclusion scheme. - -2001-03-13 Werner Lemberg - - * graph/x11/grx11.c: Increase MAX_PIXEL_MODES to 100. - -2001-03-06 Werner Lemberg - - * src/memtest.c (my_memory): Add cast to remove C++ compiler error. - -2001-02-22 David Turner - - * src/memtest.c: Fixed the debug memory allocator. The constant - "my_memory" was replaced by a function that allocates a new "memory - allocator through "my_alloc()" and returns it. - -2001-02-06 James H. Cloos Jr. - - * src/ftview.c (Render_Text): Fix rendering of test string. - -2001-01-31 Werner Lemberg - - * src/ftstring.c (Help): Added `void' type. - -2000-12-09 Werner Lemberg - - * Makefile: Added $(LDFLAGS) variable for `unix' link target. - -2000-12-01 David Turner - - - * Version 2.0.1 released. - ========================= - - -2000-11-09 David Turner - - - * Version 2.0 released. - ======================= - - -Local Variables: -version-control: never -coding: utf-8 -End: diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/allegro/gralleg.c freetype-2.8/=unpacked-tar1=/graph/allegro/gralleg.c --- freetype-2.7.1/=unpacked-tar1=/graph/allegro/gralleg.c 2016-10-14 07:08:52.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/allegro/gralleg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,220 +0,0 @@ -/******************************************************************* - * - * ft2demos/graph/allegro/gralleg.c - * - * Allegro driver for MiGS (minimalist graphics subsystem). Allegro - * (Allegro Low LEvel Gaming ROutines) is a library for sound, - * graphics, timers, etc., and is available on 32-bit DOS, Windows, - * UNIX (X11, DGA, DGA2), Linux (svgalib, framebuffer) and BeOS. - * - * http://liballeg.org/ - * https://github.com/liballeg - * - ******************************************************************/ - -/* FT graphics subsystem */ -#include "grobjs.h" -#include "grdevice.h" - -/* Allegro header */ -#include - -static void set_graypalette() -{ - PALETTE pal; - int i = 0; - - for(; i < 256; i++) { - pal[i].r = i >> 2; - pal[i].g = i >> 2; - pal[i].b = i >> 2; - } - - set_palette(pal); -} - -static int almodes[] = { - 32, - 24, - 16, - 15, - 8, - 0 -}; - -static int gray[256]; - -static int init_device(void) -{ - int* almode = almodes; - - if(allegro_init()) return -1; - if(install_keyboard()) return -1; - - while(*almode) { - set_color_depth(*almode); - if(*almode == 8) set_graypalette(); - if(set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) == 0) { - int i = 0; - for(; i < 256; i++) gray[i] = makecol(i, i, i); - - clear(screen); - return 0; - } - almode++; - } - - return -1; -} - -static void done_device(void) -{ - allegro_exit(); -} - -static void alset_title(grSurface* surface, const char* title_string) -{ - set_window_title(title_string); -} - -static void alrefresh_rect(grSurface* surface, int x, int y, int width, int height) -{ - unsigned char* bufptr = surface->bitmap.buffer; - int cx = 0, cy = 0; - - switch(surface->bitmap.mode) { - case gr_pixel_mode_mono: - for(; cy < height; cy++) { - for(cx = 0; cx < width; cx++) { - putpixel(screen, cx + x, cy + y, (*bufptr++ ? gray[255] : gray[0])); - } - } - break; - - case gr_pixel_mode_gray: - for(; cy < height; cy++) { - for(cx = 0; cx < width; cx++) { - putpixel(screen, cx + x, cy + y, gray[*bufptr++]); - } - } - break; - - default: - break; - } -} - -static void aldone(grSurface* surface) -{ - grDoneBitmap(&(surface->bitmap)); -} - -static int key_translator[] = { - KEY_F1, grKeyF1, - KEY_F2, grKeyF2, - KEY_F3, grKeyF3, - KEY_F4, grKeyF4, - KEY_F5, grKeyF5, - KEY_F6, grKeyF6, - KEY_F7, grKeyF7, - KEY_F8, grKeyF8, - KEY_F9, grKeyF9, - KEY_F10, grKeyF10, - KEY_F11, grKeyF11, - KEY_F12, grKeyF12, - KEY_LEFT, grKeyLeft, - KEY_RIGHT, grKeyRight, - KEY_UP, grKeyUp, - KEY_DOWN, grKeyDown, - KEY_INSERT, grKeyIns, - KEY_DEL, grKeyDel, - KEY_HOME, grKeyHome, - KEY_END, grKeyEnd, - KEY_PGUP, grKeyPageUp, - KEY_PGDN, grKeyPageDown, - KEY_ESC, grKeyEsc, - KEY_TAB, grKeyTab, - KEY_BACKSPACE, grKeyBackSpace, - KEY_ENTER, grKeyReturn, - 0, 0 -}; - -static int translateKey(int scancode) -{ - int* trans = key_translator; - - while(*trans) { - if(scancode == *trans++) { - return *trans; - } - trans++; - } - - return 0; -} - -static int allisten_event(grSurface* surface, int event_mode, grEvent* event) -{ - int ch = 0, ascii = 0, scancode = 0, shifts = 0; - - event->type = gr_event_key; - - while(1) { - ch = readkey(); - - shifts = 0; - - if(key_shifts & KB_SHIFT_FLAG) shifts |= grKeyShift; - if(key_shifts & KB_CTRL_FLAG) shifts |= grKeyCtrl; - if(key_shifts & KB_ALT_FLAG) shifts |= grKeyAlt; - - ascii = ch & 0xFF; - scancode = ch >> 8; - - if(ascii > 31 && ascii < 127) { - event->key = ascii | shifts; - return 1; - } - - if( (ch = translateKey(scancode)) ) { - event->key = ch | shifts; - return 1; - } - } - - return 0; -} - -static int init_surface(grSurface* surface, grBitmap* bitmap) -{ - if(grNewBitmap(bitmap->mode, bitmap->grays, bitmap->width, bitmap->rows, bitmap)) return 0; - - surface->device = &gr_alleg_device; - surface->bitmap = *bitmap; - surface->refresh = 0; - surface->owner = 0; - surface->saturation = 0; - surface->blit_mono = 0; - - surface->refresh_rect = alrefresh_rect; - surface->set_title = alset_title; - surface->listen_event = allisten_event; - surface->done = aldone; - - return 1; -} - -grDevice gr_alleg_device = -{ - sizeof(grSurface), - "Allegro", - - init_device, - done_device, - - init_surface, - - 0, - 0 -}; - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/allegro/gralleg.h freetype-2.8/=unpacked-tar1=/graph/allegro/gralleg.h --- freetype-2.7.1/=unpacked-tar1=/graph/allegro/gralleg.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/allegro/gralleg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -#ifndef GRALLEG_H_ -#define GRALLEG_H_ - -#include "grobjs.h" - - extern - grDevice gr_alleg_device; - -#ifdef GR_INIT_BUILD - static - grDeviceChain gr_alleg_device_chain = - { - "Allegro", - &gr_alleg_device, - GR_INIT_DEVICE_CHAIN - }; - -#undef GR_INIT_DEVICE_CHAIN -#define GR_INIT_DEVICE_CHAIN &gr_alleg_device_chain - -#endif /* GR_INIT_BUILD */ - -#endif /* GRALLEG_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/allegro/rules.mk freetype-2.8/=unpacked-tar1=/graph/allegro/rules.mk --- freetype-2.7.1/=unpacked-tar1=/graph/allegro/rules.mk 2015-09-25 05:40:31.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/allegro/rules.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -#************************************************************************** -#* -#* Allegro driver makefile -#* -#************************************************************************** - -# test for the `ALLEGRO' environment variable. This is non-optimal. -# -ifdef ALLEGRO - - # directory of Allegro driver - # - GR_ALLEG := $(GRAPH)/allegro - - # add Allegro driver to lib objects - # - GRAPH_OBJS += $(OBJ_DIR_2)/gralleg.$O - - # add Allegro driver to list of devices - # - DEVICES += ALLEGRO - - # our compilation rule - # - $(OBJ_DIR_2)/gralleg.$O : $(GR_ALLEG)/gralleg.c $(GR_ALLEG)/gralleg.h - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_ALLEG)) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - - # we need to link with Allegro - # - GRAPH_LINK += -lalleg - -endif # test ALLEGRO - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/beos/grbeos.cpp freetype-2.8/=unpacked-tar1=/graph/beos/grbeos.cpp --- freetype-2.7.1/=unpacked-tar1=/graph/beos/grbeos.cpp 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/beos/grbeos.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ -/******************************************************************* - * - * grbeos.c graphics driver for BeOS platform. 0.1 - * - * This is the driver for displaying inside a window under BeOS, - * used by the graphics utility of the FreeType test suite. - * - * Written by Michael Pfeiffer. - * Copyright 2001 by Michael Pfeiffer - * - * 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. - * - ******************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "grbeos.h" - - -/* logging facility */ -#include - -#define DEBUG - -#ifdef DEBUG -#define LOG(x) LogMessage##x -#else -#define LOG(x) /* empty */ -#endif - -#ifdef DEBUG - static void LogMessage( const char* fmt, ... ) - { - va_list ap; - - va_start( ap, fmt ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } -#endif - - typedef struct Translator_ - { - int32 beoskey; -grKey grkey; - - } Translator; - - static - Translator key_translators[] = - { - { B_BACKSPACE, grKeyBackSpace }, - { B_TAB, grKeyTab }, - { B_ENTER, grKeyReturn }, - { B_ESCAPE, grKeyEsc }, - { B_HOME, grKeyHome }, - { B_LEFT_ARROW, grKeyLeft }, - { B_UP_ARROW, grKeyUp }, - { B_RIGHT_ARROW, grKeyRight }, - { B_DOWN_ARROW, grKeyDown }, - { B_PAGE_UP, grKeyPageUp }, - { B_PAGE_DOWN, grKeyPageDown }, - { B_END, grKeyEnd } - }; - - static - Translator fkey_translators[] = - { - { B_F1_KEY, grKeyF1 }, - { B_F2_KEY, grKeyF2 }, - { B_F3_KEY, grKeyF3 }, - { B_F4_KEY, grKeyF4 }, - { B_F5_KEY, grKeyF5 }, - { B_F6_KEY, grKeyF6 }, - { B_F7_KEY, grKeyF7 }, - { B_F8_KEY, grKeyF8 }, - { B_F9_KEY, grKeyF9 }, - { B_F10_KEY, grKeyF10 }, - { B_F11_KEY, grKeyF11 }, - { B_F12_KEY, grKeyF12 } - }; - - static Translator* find_key(int32 key, Translator t[], int size) { - for (int i = 0; i < size; i++) { - if (t[i].beoskey == key) { - return &t[i]; - } - } - return NULL; - } - -static const grPixelMode pixel_modes[] = -{ - gr_pixel_mode_mono, - gr_pixel_mode_gray -// gr_pixel_mode_rgb565, -// gr_pixel_mode_rgb32, -}; - -class Window; - -typedef struct grBeOSSurface_ -{ - grSurface root; - Window* window; -} grBeOSSurface; - -class Window : public BWindow { - private: - grBeOSSurface* _surface; - BBitmap* _offscreen; - BBitmap* _bitmap; - BMessageQueue _event_queue; - sem_id _locker; - - class View : public BView { - BBitmap* _offscreen; - BMessageQueue* _event_queue; - sem_id _locker; - - public: - View(BBitmap* offscreen, BMessageQueue* event_queue, sem_id locker, BRect r); - void Draw(BRect r); - void KeyDown(const char *bytes, int32 numBytes); - }; - View* _view; - - public: - Window(grBeOSSurface* surface, grBitmap* bitmap); - ~Window(); - - void Refresh(int x, int y, int w, int h); - int listen_event(int event_mask, grEvent* grevent); - - static grSurface* init_surface(grSurface* surface, grBitmap* bitmap); - static void done_surface(grSurface* surface); - static void refresh_rectangle(grSurface* surface, int x, int y, int w, int h); - static void set_title(grSurface* surface, const char* title); - static int listen_event(grSurface* surface, int event_mask, grEvent* grevent); -}; - -static int init_device(); -static void done_device(void); - -grDevice gr_beos_device = -{ - sizeof( grBeOSSurface ), - "beos", - - init_device, - done_device, - - (grDeviceInitSurfaceFunc) Window::init_surface, - - 0, - 0 -}; - -static int init_device() { - gr_beos_device.num_pixel_modes = 2; - gr_beos_device.pixel_modes = (grPixelMode*) pixel_modes; - new BApplication("application/x.mp.freetype.test"); - return 0; -} - -static void done_device(void) { - if (be_app) { - delete be_app; - be_app = NULL; - } -} - - -Window::View::View(BBitmap* offscreen, BMessageQueue* event_queue, sem_id locker, BRect r) : - BView(r, "", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), - _offscreen(offscreen), - _event_queue(event_queue), - _locker(locker) { - SetViewColor(B_TRANSPARENT_COLOR); -} - -void Window::View::Draw(BRect r) { - DrawBitmap(_offscreen); -} - -void Window::View::KeyDown(const char *bytes, int32 numBytes) { - BMessage* m = Window()->CurrentMessage(); - int32 key; - if (B_OK == m->FindInt32("key", &key)) { - Translator* t = NULL; - if (numBytes == 1) { - if (*bytes == B_FUNCTION_KEY) { - t = find_key(key, fkey_translators, sizeof(fkey_translators)/sizeof(Translator)); - } else { - t = find_key(*bytes, key_translators, sizeof(key_translators)/sizeof(Translator)); - } - } - if (t || numBytes == 1) { - _event_queue->Lock(); - if (_event_queue->IsEmpty()) release_sem(_locker); - _event_queue->AddMessage(new BMessage(t ? t->grkey : *bytes)); - _event_queue->Unlock(); - return; - } - } - BView::KeyDown(bytes, numBytes); -} - -int Window::listen_event(int event_mask, grEvent* grevent) { - acquire_sem(_locker); - _event_queue.Lock(); - BMessage* m = _event_queue.NextMessage(); - if (!_event_queue.IsEmpty()) release_sem(_locker); - _event_queue.Unlock(); - grevent->type = gr_key_down; - grevent->key = (grKey)m->what; - delete m; - return 0; -} - -Window::Window(grBeOSSurface* surface, grBitmap* bitmap) : - BWindow(BRect(20, 20, 100, 100), "", B_TITLED_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { - _locker = create_sem(0, "event_locker"); - _surface = surface; - surface->root.done = done_surface; - surface->root.refresh_rect = refresh_rectangle; - surface->root.set_title = set_title; - surface->root.listen_event = listen_event; - surface->window = this; - int w = bitmap->width; - int h = bitmap->rows; - BRect r(0, 0, w, h); - switch (bitmap->mode) { - case gr_pixel_mode_mono: - _bitmap = new BBitmap(r, B_GRAY1); - break; - case gr_pixel_mode_gray: - _bitmap = new BBitmap(r, B_CMAP8); - break; - case gr_pixel_mode_rgb565: - _bitmap = new BBitmap(r, B_RGB16); - break; - case gr_pixel_mode_rgb32: - _bitmap = new BBitmap(r, B_RGB32); - break; - default: - LOG(("unsupported mode")); - exit(-1); - } - - bitmap->buffer = (unsigned char*)_bitmap->Bits(); - bitmap->pitch = _bitmap->BytesPerRow(); - _surface->root.bitmap = *bitmap; - _offscreen = new BBitmap(r, B_RGB32); - - _view = new View(_offscreen, &_event_queue, _locker, r); - AddChild(_view); - _view->MakeFocus(true); - ResizeTo(w, h); - Show(); -} - -Window::~Window() { - delete_sem(_locker); - delete _offscreen; delete _bitmap; -} - -void Window::Refresh(int x, int y, int w, int h) { - int32* d = (int32*)_offscreen->Bits(); - int32* dl = d; - uint8* s = (uint8*)_bitmap->Bits(); - uint8* sl = s; - if (Lock()) { - switch(_surface->root.bitmap.mode) { - case gr_pixel_mode_mono: - for (y = 0; y < _surface->root.bitmap.rows; y++) { - sl = s; - dl = d; - for (x = 0; x < _surface->root.bitmap.width; x++) { - *dl = *sl ? -1 : 0; - sl++; dl++; - } - s += _bitmap->BytesPerRow(); - d = (int32*)(((char*)d) + _offscreen->BytesPerRow()); - } - break; - case gr_pixel_mode_gray: - for (y = 0; y < _surface->root.bitmap.rows; y++) { - sl = s; - int8* dx = (int8*)d; - for (x = 0; x < _surface->root.bitmap.width; x++) { - *dx = *sl; dx++; - *dx = *sl; dx++; - *dx = *sl; dx++; - *dx = *sl; dx++; - sl++; - } - s += _bitmap->BytesPerRow(); - d = (int32*)(((char*)d) + _offscreen->BytesPerRow()); - } - break; - default: - fprintf(stderr, "unsupported mode: %d\n", _surface->root.bitmap.mode); - break; - } - _view->Invalidate(); - Unlock(); - } -} - -grSurface* Window::init_surface( grSurface* surface, grBitmap* bitmap) { - new Window((grBeOSSurface*) surface, bitmap); - return surface; -} - -void Window::done_surface(grSurface* surface) { - Window* w = ((grBeOSSurface*)surface)->window; - if (w->Lock()) { - w->PostMessage(B_QUIT_REQUESTED); - w->Unlock(); - } -} - -void Window::refresh_rectangle(grSurface* surface, int x, int y, int w, int h) { - Window* win = ((grBeOSSurface*)surface)->window; - win->Refresh(x, y, w, h); -} - -void Window::set_title(grSurface* surface, const char* title) { - Window* win = ((grBeOSSurface*)surface)->window; - if (win->Lock()) { - win->SetTitle(title); - win->Unlock(); - } -} - -int Window::listen_event(grSurface* surface, int event_mask, grEvent* grevent) { - Window* win = ((grBeOSSurface*)surface)->window; - return win->listen_event(event_mask, grevent); -} - -/* End */ - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/beos/grbeos.h freetype-2.8/=unpacked-tar1=/graph/beos/grbeos.h --- freetype-2.7.1/=unpacked-tar1=/graph/beos/grbeos.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/beos/grbeos.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#ifndef GRBEOS_H_ -#define GRBEOS_H_ - -#include "grobjs.h" - - extern - grDevice gr_beos_device; - -#ifdef GR_INIT_BUILD - static - grDeviceChain gr_beos_device_chain = - { - "beos", - &gr_beos_device, - GR_INIT_DEVICE_CHAIN - }; - -#undef GR_INIT_DEVICE_CHAIN -#define GR_INIT_DEVICE_CHAIN &gr_beos_device_chain - -#endif /* GR_INIT_BUILD */ - -#endif /* GRBEOS_H_ */ - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/beos/Jamfile freetype-2.8/=unpacked-tar1=/graph/beos/Jamfile --- freetype-2.7.1/=unpacked-tar1=/graph/beos/Jamfile 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/beos/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# FreeType2 demos graph/beos Jamfile (c) 2002 David Turner -# - -SubDir FT2DEMO_TOP graph beos ; - -SubDirHdrs $(GRAPH_INCLUDE) ; - -GRAPH_LINKLIBS = -lbe -lstdc++.r4 ; - -Library $(GRAPH_LIB) : grbeos.cpp ; - -# end of graph/beos Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/beos/rules.mk freetype-2.8/=unpacked-tar1=/graph/beos/rules.mk --- freetype-2.7.1/=unpacked-tar1=/graph/beos/rules.mk 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/beos/rules.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#************************************************************************** -#* -#* BeOS specific rules file, used to compile the BeOS graphics driver -#* to the graphics subsystem -#* -#************************************************************************** - -ifeq ($(PLATFORM),beos) - - # directory of the BeOS graphics driver - # - GR_BEOS := $(GRAPH)/beos - - # add the BeOS driver object file to the graphics library `graph.a' - # - GRAPH_OBJS += $(OBJ_DIR_2)/grbeos.$(O) - - DEVICES += BEOS - DEVICE_INCLUDES += $(GR_BEOS) - - # the rule used to compile the graphics driver - # - $(OBJ_DIR_2)/grbeos.$(O): $(GR_BEOS)/grbeos.cpp $(GR_BEOS)/grbeos.h - ifneq ($(LIBTOOL),) - $(LIBTOOL) --mode=compile $(CC) -static $(CFLAGS) \ - $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_BEOS)) \ - $(X11_INCLUDE:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - else - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_BEOS)) \ - $(X11_INCLUDE:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - endif - - # Now update GRAPH_LINK according to the compiler used on BeOS - GRAPH_LINK += -lbe -lstdc++.r4 - -endif - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblany.h freetype-2.8/=unpacked-tar1=/graph/gblany.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblany.h 2016-01-13 11:00:32.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblany.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -/* check that all macros are correctly set - */ -#ifndef GDST_INCR -#error "GDST_INCR not defined" -#endif - -#ifndef GDST_TYPE -#error "GDST_TYPE not defined" -#endif - -#ifndef GDST_READ -#error "GDST_READ not defined" -#endif - -#ifdef GBLENDER_STORE_BYTES -# ifndef GDST_STOREB -# error "GDST_STOREB not defined" -# endif -#else -# ifndef GDST_STOREP -# error "GDST_STOREP not defined" -# endif -#endif /* !STORE_BYTES */ - -#ifndef GDST_STOREC -#error "GDST_STOREC not defined" -#endif - -#ifndef GDST_COPY -#error "GDST_COPY not defined" -#endif - -#ifndef GDST_COPY_VAR -#error "GDST_COPY_VAR not defined" -#endif - -#undef GCONCAT -#undef GCONCATX -#define GCONCAT(x,y) GCONCATX(x,y) -#define GCONCATX(x,y) x ## y - - -static void -GCONCAT( _gblender_blit_gray8_, GDST_TYPE )( GBlenderBlit blit, - GBlenderPixel color ) -{ - GBlender blender = blit->blender; - unsigned int r = (color >> 16) & 255; - unsigned int g = (color >> 8) & 255; - unsigned int b = (color) & 255; - - GDST_COPY_VAR - -#include "gblcolor.h" -} - - -static void -GCONCAT( _gblender_blit_hrgb_, GDST_TYPE )( GBlenderBlit blit, - GBlenderPixel color ) -{ - GBlender blender = blit->blender; - unsigned int r = (color >> 16) & 255; - unsigned int g = (color >> 8) & 255; - unsigned int b = (color) & 255; - - GDST_COPY_VAR - -#include "gblhrgb.h" -} - - -static void -GCONCAT( _gblender_blit_hbgr_, GDST_TYPE )( GBlenderBlit blit, - GBlenderPixel color ) -{ - GBlender blender = blit->blender; - unsigned int r = (color >> 16) & 255; - unsigned int g = (color >> 8) & 255; - unsigned int b = (color) & 255; - - GDST_COPY_VAR - -#include "gblhbgr.h" -} - - -static void -GCONCAT( _gblender_blit_vrgb_, GDST_TYPE )( GBlenderBlit blit, - GBlenderPixel color ) -{ - GBlender blender = blit->blender; - unsigned int r = (color >> 16) & 255; - unsigned int g = (color >> 8) & 255; - unsigned int b = (color) & 255; - - GDST_COPY_VAR - -#include "gblvrgb.h" -} - - -static void -GCONCAT( _gblender_blit_vbgr_, GDST_TYPE )( GBlenderBlit blit, - GBlenderPixel color ) -{ - GBlender blender = blit->blender; - unsigned int r = (color >> 16) & 255; - unsigned int g = (color >> 8) & 255; - unsigned int b = (color) & 255; - - GDST_COPY_VAR - -#include "gblvbgr.h" -} - - -static void -GCONCAT( _gblender_blit_bgra_, GDST_TYPE )( GBlenderBlit blit, - GBlenderPixel color ) -{ - GBlender blender = blit->blender; - - (void)color; /* unused */ - -#include "gblbgra.h" -} - - -/* unset the macros, to prevent accidental re-use - */ - -#undef GCONCATX -#undef GCONCAT -#undef GDST_TYPE -#undef GDST_INCR -#undef GDST_READ -#undef GDST_COPY -#undef GDST_STOREB -#undef GDST_STOREP -#undef GDST_STOREC -#undef GDST_COPY_VAR - -/* EOF */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblbgra.h freetype-2.8/=unpacked-tar1=/graph/gblbgra.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblbgra.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblbgra.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ - - int h = blit->height; - const unsigned char* src_line = blit->src_line; - unsigned char* dst_line = blit->dst_line; - - gblender_use_channels( blender, 0 ); - - do - { - const unsigned char* src = src_line + blit->src_x * 4; - unsigned char* dst = dst_line + blit->dst_x * GDST_INCR; - int w = blit->width; - - do - { - unsigned int a = GBLENDER_SHADE_INDEX(src[3]); - unsigned int ra = src[3]; - - unsigned int b = src[0]; - unsigned int g = src[1]; - unsigned int r = src[2]; - - - if ( a == 0 ) - { - /* nothing */ - } - else if ( a == 255 ) - { - dst[0] = (unsigned char)r; - dst[1] = (unsigned char)g; - dst[2] = (unsigned char)b; - } - else - { - unsigned int ba = 255 - ra; - unsigned int br = dst[0]; - unsigned int bb = dst[1]; - unsigned int bg = dst[2]; - - - dst[0] = (unsigned char)(br * ba / 255 + r); - dst[1] = (unsigned char)(bg * ba / 255 + g); - dst[2] = (unsigned char)(bb * ba / 255 + b); - } - - src += 4; - dst += GDST_INCR; - - } while ( --w > 0 ); - - src_line += blit->src_pitch; - dst_line += blit->dst_pitch; - - } while ( --h > 0 ); - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblblit.c freetype-2.8/=unpacked-tar1=/graph/gblblit.c --- freetype-2.7.1/=unpacked-tar1=/graph/gblblit.c 2015-10-09 07:14:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblblit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,328 +0,0 @@ -#include "gblblit.h" - -/* blitting gray glyphs - */ - -/* generic macros - */ -#define GRGB_PACK(r,g,b) ( ((GBlenderPixel)(r) << 16) | \ - ((GBlenderPixel)(g) << 8) | \ - (GBlenderPixel)(b) ) - -#define GDST_STORE3(d,r,g,b) (d)[0] = (unsigned char)(r); \ - (d)[1] = (unsigned char)(g); \ - (d)[2] = (unsigned char)(b) - -/* */ - -#define GRGB_TO_RGB565(r,g,b) ((unsigned short)( (((r) << 8) & 0xF800) | \ - (((g) << 3) & 0x07E0) | \ - (((b) >> 3) & 0x001F) ) ) - -#define GRGB565_TO_RGB24(p) ( ( ((p) << 8) & 0xF80000 ) | \ - ( ((p) << 3) & 0x0700F8 ) | \ - ( ((p) << 5) & 0x00FC00 ) | \ - ( ((p) >> 1) & 0x000300 ) | \ - ( ((p) >> 2) & 0x000007 ) ) - -#define GRGB24_TO_RGB565(p) ( (unsigned short)( (((p) >> 8) & 0xF800 ) | \ - (((p) >> 5) & 0x07E0 ) | \ - (((p) >> 3) & 0x001F ) ) ) - -/* */ - -#define GRGB_TO_BGR565(r,g,b) GRGB_TO_RGB565(b,g,r) - -#define GBGR565_TO_RGB24(p) ( ( ((p) << 19) & 0xF80000 ) | \ - ( ((p) << 12) & 0x070000 ) | \ - ( ((p) << 5) & 0x00FC00 ) | \ - ( ((p) >> 1) & 0x000300 ) | \ - ( ((p) >> 8) & 0x0000F8 ) | \ - ( ((p) >> 13) & 0x000007 ) ) - -#define GRGB24_TO_BGR565(p) ( (unsigned short)( (((p) << 8) & 0xF800 ) | \ - (((p) >> 5) & 0x07E0 ) | \ - (((p) >> 19) & 0x001F ) ) ) - -/* */ - -/* Rgb32 blitting routines - */ - -#define GDST_TYPE rgb32 -#define GDST_INCR 4 -#define GDST_READ(d,p) (p) = *(GBlenderPixel*)(d) & 0xFFFFFF -#define GDST_COPY(d) *(GBlenderPixel*)(d) = color -#define GDST_STOREP(d,cells,a) *(GBlenderPixel*)(d) = (cells)[(a)] -#define GDST_STOREB(d,cells,a) \ - { \ - GBlenderCell* _g = (cells) + (a)*3; \ - \ - GDST_STOREC(d,_g[0],_g[1],_g[2]); \ - } -#define GDST_STOREC(d,r,g,b) *(GBlenderPixel*)(d) = GRGB_PACK(r,g,b) -#define GDST_COPY_VAR /* nothing */ - -#include "gblany.h" - -/* Rgb24 blitting routines - */ - -#define GDST_TYPE rgb24 -#define GDST_INCR 3 -#define GDST_READ(d,p) (p) = GRGB_PACK((d)[0],(d)[1],(d)[2]) -#define GDST_COPY(d) GDST_STORE3(d,r,g,b) -#define GDST_STOREC(d,r,g,b) GDST_STORE3(d,r,g,b) - -#define GDST_STOREB(d,cells,a) \ - { \ - GBlenderCell* _g = (cells) + (a)*3; \ - \ - (d)[0] = _g[0]; \ - (d)[1] = _g[1]; \ - (d)[2] = _g[2]; \ - } - -#define GDST_STOREP(d,cells,a) \ - { \ - GBlenderPixel _pix = (cells)[(a)]; \ - \ - GDST_STORE3(d,_pix >> 16,_pix >> 8,_pix); \ - } - -#define GDST_COPY_VAR /* nothing */ - -#include "gblany.h" - -/* Rgb565 blitting routines - */ - -#define GDST_TYPE rgb565 -#define GDST_INCR 2 - -#define GDST_READ(d,p) p = (GBlenderPixel)*(unsigned short*)(d); \ - p = GRGB565_TO_RGB24(p) - -#define GDST_COPY_VAR unsigned short pix = GRGB_TO_RGB565(r,g,b); -#define GDST_COPY(d) *(unsigned short*)(d) = pix - -#define GDST_STOREB(d,cells,a) \ - { \ - GBlenderCell* _g = (cells) + (a)*3; \ - \ - *(unsigned short*)(d) = GRGB_TO_RGB565(_g[0],_g[1],_g[2]); \ - } - -#define GDST_STOREP(d,cells,a) \ - { \ - GBlenderPixel _pix = (cells)[(a)]; \ - \ - *(unsigned short*)(d) = GRGB24_TO_RGB565(_pix); \ - } - -#define GDST_STOREC(d,r,g,b) *(unsigned short*)(d) = GRGB_TO_RGB565(r,g,b) - -#include "gblany.h" - -/* Bgr565 blitting routines - */ -#define GDST_TYPE bgr565 -#define GDST_INCR 2 - -#define GDST_READ(d,p) p = (GBlenderPixel)*(unsigned short*)(d); \ - p = GBGR565_TO_RGB24(p) - -#define GDST_COPY_VAR unsigned short pix = GRGB_TO_BGR565(r,g,b); -#define GDST_COPY(d) *(d) = (unsigned char)pix - -#define GDST_STOREB(d,cells,a) \ - { \ - GBlenderCell* _g = (cells) + (a)*3; \ - \ - *(unsigned short*)(d) = GRGB_TO_BGR565(_g[0],_g[1],_g[2]); \ - } - -#define GDST_STOREP(d,cells,a) \ - { \ - GBlenderPixel _pix = (cells)[(a)]; \ - \ - *(unsigned short*)(d) = GRGB24_TO_BGR565(_pix); \ - } - -#define GDST_STOREC(d,r,g,b) *(unsigned short*)(d) = GRGB_TO_BGR565(r,g,b) - -#include "gblany.h" - -/* */ - -static void -_gblender_blit_dummy( GBlenderBlit blit, - GBlenderPixel color ) -{ - (void)blit; - (void)color; -} - - -GBLENDER_APIDEF( int ) -gblender_blit_init( GBlenderBlit blit, - GBlender blender, - int dst_x, - int dst_y, - GBlenderSourceFormat src_format, - const unsigned char* src_buffer, - int src_pitch, - int src_width, - int src_height, - GBlenderTargetFormat dst_format, - unsigned char* dst_buffer, - int dst_pitch, - int dst_width, - int dst_height ) -{ - int src_x = 0; - int src_y = 0; - int delta; - GBlenderBlitFunc blit_func = 0; - - switch ( src_format ) - { - case GBLENDER_SOURCE_GRAY8: - switch ( dst_format ) - { - case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_gray8_rgb32; break; - case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_gray8_rgb24; break; - case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_gray8_rgb565; break; - case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_gray8_bgr565; break; - default: - ; - } - break; - - case GBLENDER_SOURCE_HRGB: - switch ( dst_format ) - { - case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_hrgb_rgb32; break; - case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_hrgb_rgb24; break; - case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_hrgb_rgb565; break; - case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_hrgb_bgr565; break; - default: - ; - } - break; - - case GBLENDER_SOURCE_HBGR: - switch ( dst_format ) - { - case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_hbgr_rgb32; break; - case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_hbgr_rgb24; break; - case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_hbgr_rgb565; break; - case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_hbgr_bgr565; break; - default: - ; - } - break; - - case GBLENDER_SOURCE_VRGB: - switch ( dst_format ) - { - case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_vrgb_rgb32; break; - case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_vrgb_rgb24; break; - case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_vrgb_rgb565; break; - case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_vrgb_bgr565; break; - default: - ; - } - break; - - case GBLENDER_SOURCE_VBGR: - switch ( dst_format ) - { - case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_vbgr_rgb32; break; - case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_vbgr_rgb24; break; - case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_vbgr_rgb565; break; - case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_vbgr_bgr565; break; - default: - ; - } - break; - - case GBLENDER_SOURCE_BGRA: - switch ( dst_format ) - { - case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_bgra_rgb32; break; - case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_bgra_rgb24; break; - case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_bgra_rgb565; break; - case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_bgra_bgr565; break; - default: - ; - } - break; - - default: - ; - } - - blit->blender = blender; - blit->blit_func = blit_func; - - if ( blit_func == 0 ) - { - /* unsupported blit mode - */ - blit->blit_func = _gblender_blit_dummy; - return -2; - } - - if ( dst_x < 0 ) - { - src_width += dst_x; - src_x -= dst_x; - dst_x = 0; - } - - delta = dst_x + src_width - dst_width; - if ( delta > 0 ) - src_width -= delta; - - if ( dst_y < 0 ) - { - src_height += dst_y; - src_y -= dst_y; - dst_y = 0; - } - - delta = dst_y + src_height - dst_height; - if ( delta > 0 ) - src_height -= delta; - - /* nothing to blit - */ - if ( src_width <= 0 || src_height <= 0 ) - { - blit->blit_func = _gblender_blit_dummy; - return -1; - } - - blit->width = src_width; - blit->height = src_height; - blit->src_format = src_format; - blit->dst_format = dst_format; - - blit->src_x = src_x; - blit->src_y = src_y; - blit->src_line = src_buffer + src_pitch*src_y; - blit->src_pitch = src_pitch; - if ( src_pitch < 0 ) - blit->src_line -= (src_height-1)*src_pitch; - - blit->dst_x = dst_x; - blit->dst_y = dst_y; - blit->dst_line = dst_buffer + dst_pitch*dst_y; - blit->dst_pitch = dst_pitch; - if ( dst_pitch < 0 ) - blit->dst_line -= (dst_height-1)*dst_pitch; - - return 0; -} - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblblit.h freetype-2.8/=unpacked-tar1=/graph/gblblit.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblblit.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblblit.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -#ifndef GBLBLIT_H_ -#define GBLBLIT_H_ - -#include "gblender.h" - -/* - * blitting interface - * - */ - -typedef enum -{ - GBLENDER_SOURCE_GRAY8 = 0, - GBLENDER_SOURCE_HRGB, - GBLENDER_SOURCE_HBGR, - GBLENDER_SOURCE_VRGB, - GBLENDER_SOURCE_VBGR, - GBLENDER_SOURCE_BGRA, - - GBLENDER_SOURCE_MAX - -} GBlenderSourceFormat; - - -typedef enum -{ - GBLENDER_TARGET_GRAY8 = 0, - GBLENDER_TARGET_RGB32, - GBLENDER_TARGET_RGB24, - GBLENDER_TARGET_RGB565, - GBLENDER_TARGET_BGR565, - - GBLENDER_TARGET_MAX - -} GBlenderTargetFormat; - -typedef struct GBlenderBlitRec_* GBlenderBlit; - -typedef void (*GBlenderBlitFunc)( GBlenderBlit blit, - GBlenderPixel color ); - -typedef struct GBlenderBlitRec_ -{ - int width; - int height; - const unsigned char* src_line; - int src_pitch; - int src_x; - int src_y; - unsigned char* dst_line; - int dst_pitch; - int dst_x; - int dst_y; - GBlenderSourceFormat src_format; - GBlenderTargetFormat dst_format; - - GBlender blender; - GBlenderBlitFunc blit_func; - -} GBlenderBlitRec; - - - -GBLENDER_API( int ) -gblender_blit_init( GBlenderBlit blit, - GBlender blender, - int dst_x, - int dst_y, - GBlenderSourceFormat src_format, - const unsigned char* src_buffer, - int src_pitch, - int src_width, - int src_height, - GBlenderTargetFormat dst_format, - unsigned char* dst_buffer, - int dst_pitch, - int dst_width, - int dst_height ); - -#define gblender_blit_run(b,color) (b)->blit_func( (b), (color) ) - - -#endif /* GBLBLIT_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblcolor.h freetype-2.8/=unpacked-tar1=/graph/gblcolor.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblcolor.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblcolor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ - - GBLENDER_VARS; - - int h = blit->height; - const unsigned char* src_line = blit->src_line; - unsigned char* dst_line = blit->dst_line; - - gblender_use_channels( blender, 0 ); - - GBLENDER_VARS_SET(blender,color); - - /* make compiler happy */ - (void)(r); - (void)(g); - (void)(b); - - do - { - const unsigned char* src = src_line + (blit->src_x); - unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; - int w = blit->width; - - do - { - int a = GBLENDER_SHADE_INDEX(src[0]); - - if ( a == 0 ) - { - /* nothing */ - } - else if ( a == GBLENDER_SHADE_COUNT-1 ) - { - GDST_COPY(dst); - } - else - { - GBlenderPixel back; - - GDST_READ(dst,back); - - GBLENDER_LOOKUP( blender, back ); - -#ifdef GBLENDER_STORE_BYTES - GDST_STOREB(dst,_gcells,a); -#else - GDST_STOREP(dst,_gcells,a); -#endif - } - - src += 1; - dst += GDST_INCR; - } - while (--w > 0); - - src_line += blit->src_pitch; - dst_line += blit->dst_pitch; - } - while (--h > 0); - - GBLENDER_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblender.c freetype-2.8/=unpacked-tar1=/graph/gblender.c --- freetype-2.7.1/=unpacked-tar1=/graph/gblender.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblender.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,414 +0,0 @@ -#include "gblender.h" -#include -#include - -static void -gblender_set_gamma_table( double gamma_value, - unsigned short* gamma_ramp, - unsigned char* gamma_ramp_inv ) -{ - const int gmax = (256 << GBLENDER_GAMMA_SHIFT)-1; - - if ( gamma_value <= 0 ) /* special case for sRGB */ - { - int ii; - - for ( ii = 0; ii < 256; ii++ ) - { - double x = (double)ii / 255.0; - - if ( x <= 0.039285714 ) - x /= 12.92321; - else - x = pow( (x+0.055)/ 1.055, 2.4 ); - - gamma_ramp[ii] = (unsigned short)(gmax*x + 0.5); - } - - for ( ii = 0; ii <= gmax; ii++ ) - { - double x = (double)ii / gmax; - - if ( x <= 0.0030399346 ) - x *= 12.92321; - else - x = 1.055*pow(x,1/2.4) - 0.055; - - gamma_ramp_inv[ii] = (unsigned char)(255.*x + 0.5); - } - } - else - { - int ii; - double gamma_inv = 1. / gamma_value; - - /* voltage to linear */ - for ( ii = 0; ii < 256; ii++ ) - gamma_ramp[ii] = - (unsigned short)( gmax*pow( (double)ii/255., gamma_value ) + 0.5 ); - - /* linear to voltage */ - for ( ii = 0; ii <= gmax; ii++ ) - gamma_ramp_inv[ii] = - (unsigned char)( 255.*pow( (double)ii/gmax, gamma_inv ) + 0.5 ); - } -} - - -/* clear the cache - */ -static void -gblender_clear( GBlender blender ) -{ - int nn; - GBlenderKey keys = blender->keys; - - if ( blender->channels ) - { - GBlenderChanKey chan_keys = (GBlenderChanKey) blender->keys; - - for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ ) - chan_keys[nn].index = -1; - - blender->cache_r_back = ~0U; - blender->cache_r_fore = ~0U; - blender->cache_r_cells = NULL; - - blender->cache_g_back = ~0U; - blender->cache_g_fore = ~0U; - blender->cache_g_cells = NULL; - - blender->cache_b_back = ~0U; - blender->cache_b_fore = ~0U; - blender->cache_b_cells = NULL; - } - else - { - for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ ) - keys[nn].cells = NULL; - - blender->cache_back = ~0U; - blender->cache_fore = ~0U; - blender->cache_cells = NULL; - } -} - -GBLENDER_APIDEF( void ) -gblender_reset( GBlender blender ) -{ - gblender_clear( blender ); - - if ( blender->channels ) - { - blender->cache_r_back = 0; - blender->cache_r_fore = 0xFFFFFF; - blender->cache_r_cells = gblender_lookup_channel( blender, - blender->cache_r_back, - blender->cache_r_fore ); - blender->cache_g_back = 0; - blender->cache_g_fore = 0xFFFFFF; - blender->cache_g_cells = gblender_lookup_channel( blender, - blender->cache_g_back, - blender->cache_g_fore ); - blender->cache_b_back = 0; - blender->cache_b_fore = 0xFFFFFF; - blender->cache_b_cells = gblender_lookup_channel( blender, - blender->cache_b_back, - blender->cache_b_fore ); - } - else - { - blender->cache_back = 0; - blender->cache_fore = 0xFFFFFF; - blender->cache_cells = gblender_lookup( blender, - blender->cache_back, - blender->cache_fore ); - } - -#ifdef GBLENDER_STATS - blender->stat_hits = 0; - blender->stat_lookups = 0; - blender->stat_keys = 0; - blender->stat_clears = 0; -#endif -} - -GBLENDER_APIDEF( void ) -gblender_init( GBlender blender, - double gamma_value ) -{ - blender->channels = 0; - - gblender_set_gamma_table ( gamma_value, - blender->gamma_ramp, - blender->gamma_ramp_inv ); - - gblender_reset( blender ); -} - - -GBLENDER_API( void ) -gblender_use_channels( GBlender blender, - int channels ) -{ - channels = (channels != 0); - - if ( blender->channels != channels ) - { - blender->channels = channels; - gblender_reset( blender ); - } -} - - - -/* recompute the grade levels of a given key - */ -static void -gblender_reset_key( GBlender blender, - GBlenderKey key ) -{ - GBlenderPixel back = key->background; - GBlenderPixel fore = key->foreground; - GBlenderCell* gr = key->cells; - unsigned int nn; - - const unsigned char* gamma_ramp_inv = blender->gamma_ramp_inv; - const unsigned short* gamma_ramp = blender->gamma_ramp; - - unsigned int r1,g1,b1,r2,g2,b2; - - r1 = ( back >> 16 ) & 255; - g1 = ( back >> 8 ) & 255; - b1 = ( back ) & 255; - - r2 = ( fore >> 16 ) & 255; - g2 = ( fore >> 8 ) & 255; - b2 = ( fore ) & 255; - -#ifdef GBLENDER_STORE_BYTES - gr[0] = (unsigned char)r1; - gr[1] = (unsigned char)g1; - gr[2] = (unsigned char)b1; - gr += 3; -#else - gr[0] = back; - gr += 1; -#endif - - r1 = gamma_ramp[r1]; - g1 = gamma_ramp[g1]; - b1 = gamma_ramp[b1]; - - r2 = gamma_ramp[r2]; - g2 = gamma_ramp[g2]; - b2 = gamma_ramp[b2]; - - for ( nn = 1; nn < GBLENDER_SHADE_COUNT; nn++ ) - { - unsigned int a = 255 * nn / ( GBLENDER_SHADE_COUNT - 1 ); - unsigned int r, g, b; - - - r = ( r2 * a + r1 * ( 255 - a ) + 127 ) / 255; - g = ( g2 * a + g1 * ( 255 - a ) + 127 ) / 255; - b = ( b2 * a + b1 * ( 255 - a ) + 127 ) / 255; - - r = gamma_ramp_inv[r]; - g = gamma_ramp_inv[g]; - b = gamma_ramp_inv[b]; - -#ifdef GBLENDER_STORE_BYTES - gr[0] = (unsigned char)r; - gr[1] = (unsigned char)g; - gr[2] = (unsigned char)b; - gr += 3; -#else - gr[0] = (( r & 255 ) << 16) | - (( g & 255 ) << 8 ) | - (( b & 255 ) ) ; - gr ++; -#endif - } -} - - /* lookup the grades of a given (background,foreground) couple - */ -GBLENDER_APIDEF( GBlenderCell* ) -gblender_lookup( GBlender blender, - GBlenderPixel background, - GBlenderPixel foreground ) -{ - int idx, idx0; - GBlenderKey key; - -#ifdef GBLENDER_STATS - blender->stat_hits--; - blender->stat_lookups++; -#endif - -#if 0 - if ( blender->channels ) - { - /* set to normal mode */ - blender->channels = 0; - gblender_reset( blender ); - } -#endif - - idx0 = ( background + foreground*63 ) & (GBLENDER_KEY_COUNT-1); - idx = idx0; - do - { - key = blender->keys + idx; - - if ( key->cells == NULL ) - goto NewNode; - - if ( key->background == background && - key->foreground == foreground ) - goto Exit; - - idx = (idx+1) & (GBLENDER_KEY_COUNT-1); - } - while ( idx != idx0 ); - - /* the cache is full, clear it completely - */ -#ifdef GBLENDER_STATS - blender->stat_clears++; -#endif - gblender_clear( blender ); - -NewNode: - key->background = background; - key->foreground = foreground; - key->cells = blender->cells + - idx*(GBLENDER_SHADE_COUNT*GBLENDER_CELL_SIZE); - - gblender_reset_key( blender, key ); - -#ifdef GBLENDER_STATS - blender->stat_keys++; -#endif - -Exit: - return key->cells; -} - - -static void -gblender_reset_channel_key( GBlender blender, - GBlenderChanKey key ) -{ - unsigned int back = key->backfore & 255; - unsigned int fore = (key->backfore >> 8) & 255; - unsigned char* gr = (unsigned char*)blender->cells + key->index; - unsigned int nn; - - const unsigned char* gamma_ramp_inv = blender->gamma_ramp_inv; - const unsigned short* gamma_ramp = blender->gamma_ramp; - - unsigned int r1,r2; - - r1 = back; - r2 = fore; - - gr[0] = (unsigned char)r1; - gr++; - - r1 = gamma_ramp[r1]; - r2 = gamma_ramp[r2]; - - for ( nn = 1; nn < GBLENDER_SHADE_COUNT; nn++ ) - { - unsigned int a = 255 * nn / ( GBLENDER_SHADE_COUNT - 1 ); - unsigned int r; - - - r = ( r2 * a + r1 * ( 255 - a ) + 127 ) / 255; - - r = gamma_ramp_inv[r]; - - gr[0] = (unsigned char)r; - gr++; - } -} - - -GBLENDER_APIDEF( unsigned char* ) -gblender_lookup_channel( GBlender blender, - unsigned int background, - unsigned int foreground ) -{ - int idx, idx0; - unsigned short backfore = (unsigned short)((foreground << 8) | background); - GBlenderChanKey key; - -#ifdef GBLENDER_STATS - blender->stat_hits--; - blender->stat_lookups++; -#endif - -#if 0 - if ( !blender->channels ) - { - /* set to normal mode */ - blender->channels = 1; - gblender_reset( blender ); - } -#endif - - idx0 = ( background + foreground*17 ) & (GBLENDER_KEY_COUNT-1); - idx = idx0; - do - { - key = (GBlenderChanKey)blender->keys + idx; - - if ( key->index < 0 ) - goto NewNode; - - if ( key->backfore == backfore ) - goto Exit; - - idx = (idx+1) & (GBLENDER_KEY_COUNT-1); - } - while ( idx != idx0 ); - - /* the cache is full, clear it completely - */ -#ifdef GBLENDER_STATS - blender->stat_clears++; -#endif - gblender_clear( blender ); - -NewNode: - key->backfore = backfore; - key->index = (signed short)( idx * GBLENDER_SHADE_COUNT ); - - gblender_reset_channel_key( blender, key ); - -#ifdef GBLENDER_STATS - blender->stat_keys++; -#endif - -Exit: - return (unsigned char*)blender->cells + key->index; -} - - - -#ifdef GBLENDER_STATS -#include -GBLENDER_APIDEF( void ) -gblender_dump_stats( GBlender blender ) -{ - printf( "hits = %ld, miss1 = %ld, miss2 = %ld, rate1=%.2f%%, rate2=%.2f%%\n", - blender->stat_hits, - blender->stat_lookups, - blender->stat_keys, - (100.0*blender->stat_hits) / (double)(blender->stat_hits + blender->stat_lookups), - (100.0*blender->stat_lookups) / (double)( blender->stat_lookups + blender->stat_keys) - ); -} -#endif diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblender.h freetype-2.8/=unpacked-tar1=/graph/gblender.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblender.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblender.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,236 +0,0 @@ -/**************************************************************************** - * - * Gamma-correct alpha blending of text - * - * (C) 2004 David Turner - * - */ - -#ifndef GBLENDER_H_ -#define GBLENDER_H_ - -#ifndef GBLENDER_API -#define GBLENDER_API(x) extern x -#endif - -#ifndef GBLENDER_APIDEF -#define GBLENDER_APIDEF(x) x -#endif - -#define GBLENDER_SHADE_BITS 4 /* must be <= 7 !! */ -#define GBLENDER_SHADE_COUNT ( 1 << GBLENDER_SHADE_BITS ) -#define GBLENDER_SHADE_INDEX(n) (((n) * (GBLENDER_SHADE_COUNT-1) + 128) >> 8) -#define GBLENDER_KEY_COUNT 256 /* must be a power of 2 */ -#define GBLENDER_GAMMA_SHIFT 2 - -#define xGBLENDER_STORE_BYTES /* define this to store (R,G,B) values on 3 - * bytes, instead of a single 32-bit integer. - * surprisingly, this can speed up - * the blender on certain machines. - * Go figure what's really happening though :-) - */ - -#define xGBLENDER_STATS /* define this to collect statistics in the - * blender - */ - - typedef unsigned int GBlenderPixel; /* needs 32-bits here !! */ - -#ifdef GBLENDER_STORE_BYTES - typedef unsigned char GBlenderCell; -# define GBLENDER_CELL_SIZE 3 -#else - typedef GBlenderPixel GBlenderCell; -# define GBLENDER_CELL_SIZE 1 -#endif - - - typedef struct - { - GBlenderPixel background; - GBlenderPixel foreground; - GBlenderCell* cells; - - } GBlenderKeyRec, *GBlenderKey; - - - typedef struct - { - unsigned short backfore; /* (fore << 8) | back */ - signed short index; /* offset in (unsigned char*)cells */ - - } GBlenderChanKeyRec, *GBlenderChanKey; - - - typedef struct GBlenderRec_ - { - GBlenderKeyRec keys [ GBLENDER_KEY_COUNT ]; - GBlenderCell cells[ GBLENDER_KEY_COUNT*GBLENDER_SHADE_COUNT*GBLENDER_CELL_SIZE ]; - - /* a small cache for normal modes - */ - GBlenderPixel cache_back; - GBlenderPixel cache_fore; - GBlenderCell* cache_cells; - - /* a small cache for RGB channels modes - */ - unsigned int cache_r_back; - unsigned int cache_r_fore; - unsigned char* cache_r_cells; - - unsigned int cache_g_back; - unsigned int cache_g_fore; - unsigned char* cache_g_cells; - - unsigned int cache_b_back; - unsigned int cache_b_fore; - unsigned char* cache_b_cells; - - /* are we in color or channel mode ? - */ - int channels; - - /* the gamma table - */ - unsigned short gamma_ramp[256]; /* voltage to linear */ - unsigned char gamma_ramp_inv[256 << GBLENDER_GAMMA_SHIFT]; /* linear to voltage */ - -#ifdef GBLENDER_STATS - long stat_hits; /* number of direct hits */ - long stat_lookups; /* number of table lookups */ - long stat_keys; /* number of table key recomputation */ - long stat_clears; /* number of table clears */ -#endif - - } GBlenderRec, *GBlender; - - - /* initialize with a given gamma */ - GBLENDER_API( void ) - gblender_init( GBlender blender, - double gamma ); - - - /* clear blender, and reset stats */ - GBLENDER_API( void ) - gblender_reset( GBlender blender ); - - - GBLENDER_API( void ) - gblender_use_channels( GBlender blender, - int channels ); - - /* lookup a cell range for a given (background,foreground) pair - */ - GBLENDER_API( GBlenderCell* ) - gblender_lookup( GBlender blender, - GBlenderPixel background, - GBlenderPixel foreground ); - - GBLENDER_API( unsigned char* ) - gblender_lookup_channel( GBlender blender, - unsigned int background, - unsigned int foreground ); - -#ifdef GBLENDER_STATS - GBLENDER_API( void ) - gblender_dump_stats( GBlender blender ); -#else -# define gblender_dump_stats(b) do { } while (0); -#endif - -#ifdef GBLENDER_STATS -#define GBLENDER_STAT_HIT(gb) (gb)->stat_hits++ -#else -#define GBLENDER_STAT_HIT(gb) /* nothing */ -#endif - - - /* no final `;'! */ -#define GBLENDER_VARS \ - GBlenderPixel _gback; \ - GBlenderCell* _gcells; \ - GBlenderPixel _gfore - -#define GBLENDER_VARS_SET(_gb,_fore) \ - _gback = (_gb)->cache_back; \ - _gcells = ( (_fore) == (_gb)->cache_fore ? (_gb)->cache_cells : gblender_lookup( (_gb), _gback, _fore ) ); \ - _gfore = (_fore) - -#define GBLENDER_LOOKUP(gb,back) \ - GBLENDER_STAT_HIT(gb); \ - if ( _gback != (GBlenderPixel)(back) ) \ - { \ - _gback = (GBlenderPixel)(back); \ - _gcells = gblender_lookup( (gb), _gback, _gfore ); \ - } - -#define GBLENDER_CLOSE(_gb) \ - (_gb)->cache_back = _gback; \ - (_gb)->cache_fore = _gfore; \ - (_gb)->cache_cells = _gcells; - - - - /* no final `;'! */ -#define GBLENDER_CHANNEL_VARS \ - unsigned int _grback; \ - unsigned char* _grcells; \ - unsigned int _grfore; \ - unsigned int _ggback; \ - unsigned char* _ggcells; \ - unsigned int _ggfore; \ - unsigned int _gbback; \ - unsigned char* _gbcells; \ - unsigned int _gbfore - -#define GBLENDER_CHANNEL_VARS_SET(_gb,_rfore,_gfore,_bfore) \ - _grback = (_gb)->cache_r_back; \ - _grcells = ( (_rfore) == (_gb)->cache_r_fore ? (_gb)->cache_r_cells : gblender_lookup_channel( (_gb), _grback, _rfore )); \ - _grfore = (_rfore); \ - _ggback = (_gb)->cache_g_back; \ - _ggcells = ( (_gfore) == (_gb)->cache_g_fore ? (_gb)->cache_g_cells : gblender_lookup_channel( (_gb), _ggback, _gfore )); \ - _ggfore = (_gfore); \ - _gbback = (_gb)->cache_b_back; \ - _gbcells = ( (_bfore) == (_gb)->cache_b_fore ? (_gb)->cache_b_cells : gblender_lookup_channel( (_gb), _gbback, _bfore )); \ - _gbfore = (_bfore); - -#define GBLENDER_CHANNEL_CLOSE(_gb) \ - (_gb)->cache_r_back = _grback; \ - (_gb)->cache_r_fore = _grfore; \ - (_gb)->cache_r_cells = _grcells; \ - (_gb)->cache_g_back = _ggback; \ - (_gb)->cache_g_fore = _ggfore; \ - (_gb)->cache_g_cells = _ggcells; \ - (_gb)->cache_b_back = _gbback; \ - (_gb)->cache_b_fore = _gbfore; \ - (_gb)->cache_b_cells = _gbcells; - - -#define GBLENDER_LOOKUP_R(gb,back) \ - GBLENDER_STAT_HIT(gb); \ - if ( _grback != (back) ) \ - { \ - _grback = (GBlenderPixel)(back); \ - _grcells = gblender_lookup_channel( (gb), _grback, _grfore ); \ - } - -#define GBLENDER_LOOKUP_G(gb,back) \ - GBLENDER_STAT_HIT(gb); \ - if ( _ggback != (back) ) \ - { \ - _ggback = (GBlenderPixel)(back); \ - _ggcells = gblender_lookup_channel( (gb), _ggback, _ggfore ); \ - } - -#define GBLENDER_LOOKUP_B(gb,back) \ - GBLENDER_STAT_HIT(gb); \ - if ( _gbback != (back) ) \ - { \ - _gbback = (GBlenderPixel)(back); \ - _gbcells = gblender_lookup_channel( (gb), _gbback, _gbfore ); \ - } - - -#endif /* GBLENDER_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblhbgr.h freetype-2.8/=unpacked-tar1=/graph/gblhbgr.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblhbgr.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblhbgr.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ - - GBLENDER_CHANNEL_VARS; - - int h = blit->height; - const unsigned char* src_line = blit->src_line; - unsigned char* dst_line = blit->dst_line; - - gblender_use_channels( blender, 1 ); - - GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); - - do - { - const unsigned char* src = src_line + blit->src_x*3; - unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; - int w = blit->width; - - do - { - unsigned int ab = GBLENDER_SHADE_INDEX(src[0]); - unsigned int ag = GBLENDER_SHADE_INDEX(src[1]); - unsigned int ar = GBLENDER_SHADE_INDEX(src[2]); - unsigned int aa = (ar << 16) | (ag << 8) | ab; - - if ( aa == 0 ) - { - /* nothing */ - } - else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | - ((GBLENDER_SHADE_COUNT-1) << 8) | - (GBLENDER_SHADE_COUNT-1) ) ) - { - GDST_COPY(dst); - } - else - { - GBlenderPixel back; - int pix_r, pix_g, pix_b; - - GDST_READ(dst,back); - - { - unsigned int back_r = (back >> 16) & 255; - - GBLENDER_LOOKUP_R( blender, back_r ); - - pix_r = _grcells[ar]; - } - - { - unsigned int back_g = (back >> 8) & 255; - - GBLENDER_LOOKUP_G( blender, back_g ); - - pix_g = _ggcells[ag]; - } - - { - unsigned int back_b = (back) & 255; - - GBLENDER_LOOKUP_B( blender, back_b ); - - pix_b = _gbcells[ab]; - } - - GDST_STOREC(dst,pix_r,pix_g,pix_b); - } - - src += 3; - dst += GDST_INCR; - } - while (--w > 0); - - src_line += blit->src_pitch; - dst_line += blit->dst_pitch; - } - while (--h > 0); - - GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblhrgb.h freetype-2.8/=unpacked-tar1=/graph/gblhrgb.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblhrgb.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblhrgb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ - - GBLENDER_CHANNEL_VARS; - - int h = blit->height; - const unsigned char* src_line = blit->src_line; - unsigned char* dst_line = blit->dst_line; - - gblender_use_channels( blender, 1 ); - - GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); - - do - { - const unsigned char* src = src_line + blit->src_x*3; - unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; - int w = blit->width; - - do - { - unsigned int ar = GBLENDER_SHADE_INDEX(src[0]); - unsigned int ag = GBLENDER_SHADE_INDEX(src[1]); - unsigned int ab = GBLENDER_SHADE_INDEX(src[2]); - unsigned int aa = (ar << 16) | (ag << 8) | ab; - - if ( aa == 0 ) - { - /* nothing */ - } - else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | - ((GBLENDER_SHADE_COUNT-1) << 8) | - (GBLENDER_SHADE_COUNT-1) ) ) - { - GDST_COPY(dst); - } - else - { - GBlenderPixel back; - int pix_r, pix_g, pix_b; - - GDST_READ(dst,back); - - { - unsigned int back_r = (back >> 16) & 255; - - GBLENDER_LOOKUP_R( blender, back_r ); - - pix_r = _grcells[ar]; - } - - { - unsigned int back_g = (back >> 8) & 255; - - GBLENDER_LOOKUP_G( blender, back_g ); - - pix_g = _ggcells[ag]; - } - - { - unsigned int back_b = (back) & 255; - - GBLENDER_LOOKUP_B( blender, back_b ); - - pix_b = _gbcells[ab]; - } - - GDST_STOREC(dst,pix_r,pix_g,pix_b); - } - - src += 3; - dst += GDST_INCR; - } - while (--w > 0); - - src_line += blit->src_pitch; - dst_line += blit->dst_pitch; - } - while (--h > 0); - - GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblvbgr.h freetype-2.8/=unpacked-tar1=/graph/gblvbgr.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblvbgr.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblvbgr.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ - - GBLENDER_CHANNEL_VARS; - - int h = blit->height; - const unsigned char* src_line = blit->src_line; - int src_pitch = blit->src_pitch; - unsigned char* dst_line = blit->dst_line; - - gblender_use_channels( blender, 1 ); - - GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); - - do - { - const unsigned char* src = src_line + blit->src_x; - unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; - int w = blit->width; - - do - { - unsigned int ab = GBLENDER_SHADE_INDEX(src[0]); - unsigned int ag = GBLENDER_SHADE_INDEX(src[src_pitch]); - unsigned int ar = GBLENDER_SHADE_INDEX(src[src_pitch << 1]); - GBlenderPixel aa = ((GBlenderPixel)ar << 16) | (ag << 8) | ab; - - if ( aa == 0 ) - { - /* nothing */ - } - else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | - ((GBLENDER_SHADE_COUNT-1) << 8) | - (GBLENDER_SHADE_COUNT-1) ) ) - { - GDST_COPY(dst); - } - else - { - GBlenderPixel back; - int pix_r, pix_g, pix_b; - - GDST_READ(dst,back); - - { - unsigned int back_r = (back >> 16) & 255; - - GBLENDER_LOOKUP_R( blender, back_r ); - - pix_r = _grcells[ar]; - } - - { - unsigned int back_g = (back >> 8) & 255; - - GBLENDER_LOOKUP_G( blender, back_g ); - - pix_g = _ggcells[ag]; - } - - { - unsigned int back_b = (back) & 255; - - GBLENDER_LOOKUP_B( blender, back_b ); - - pix_b = _gbcells[ab]; - } - - GDST_STOREC(dst,pix_r,pix_g,pix_b); - } - - src += 1; - dst += GDST_INCR; - } - while (--w > 0); - - src_line += blit->src_pitch*3; - dst_line += blit->dst_pitch; - } - while (--h > 0); - - GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/gblvrgb.h freetype-2.8/=unpacked-tar1=/graph/gblvrgb.h --- freetype-2.7.1/=unpacked-tar1=/graph/gblvrgb.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/gblvrgb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ - - GBLENDER_CHANNEL_VARS; - - int h = blit->height; - const unsigned char* src_line = blit->src_line; - int src_pitch = blit->src_pitch; - unsigned char* dst_line = blit->dst_line; - - gblender_use_channels( blender, 1 ); - - GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); - - do - { - const unsigned char* src = src_line + blit->src_x; - unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; - int w = blit->width; - - do - { - unsigned int ar = GBLENDER_SHADE_INDEX(src[0]); - unsigned int ag = GBLENDER_SHADE_INDEX(src[src_pitch]); - unsigned int ab = GBLENDER_SHADE_INDEX(src[src_pitch << 1]); - GBlenderPixel aa = ((GBlenderPixel)ar << 16) | (ag << 8) | ab; - - if ( aa == 0 ) - { - /* nothing */ - } - else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | - ((GBLENDER_SHADE_COUNT-1) << 8) | - (GBLENDER_SHADE_COUNT-1) ) ) - { - GDST_COPY(dst); - } - else - { - GBlenderPixel back; - int pix_r, pix_g, pix_b; - - GDST_READ(dst,back); - - { - unsigned int back_r = (back >> 16) & 255; - - GBLENDER_LOOKUP_R( blender, back_r ); - - pix_r = _grcells[ar]; - } - - { - unsigned int back_g = (back >> 8) & 255; - - GBLENDER_LOOKUP_G( blender, back_g ); - - pix_g = _ggcells[ag]; - } - - { - unsigned int back_b = (back) & 255; - - GBLENDER_LOOKUP_B( blender, back_b ); - - pix_b = _gbcells[ab]; - } - - GDST_STOREC(dst,pix_r,pix_g,pix_b); - } - - src += 1; - dst += GDST_INCR; - } - while (--w > 0); - - src_line += blit->src_pitch*3; - dst_line += blit->dst_pitch; - } - while (--h > 0); - - GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/graph.h freetype-2.8/=unpacked-tar1=/graph/graph.h --- freetype-2.7.1/=unpacked-tar1=/graph/graph.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/graph.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,682 +0,0 @@ -/*************************************************************************** - * - * graph.h - * - * Graphics Subsystem interface - * - * Copyright 1999-2007, 2013 - * - The FreeType Development Team - www.freetype.org - * - ***************************************************************************/ - -#ifndef GRAPH_H_ -#define GRAPH_H_ - -#include "grevents.h" - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /******** ********/ - /******** GENERAL DEFINITIONS AND BLITTING ROUTINES ********/ - /******** ********/ - /******** ********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* define the global error variable */ - extern int grError; - - - /* pixel mode constants */ - typedef enum grPixelMode - { - gr_pixel_mode_none = 0, - gr_pixel_mode_mono, /* monochrome bitmaps */ - gr_pixel_mode_pal4, /* 4-bit paletted - 16 colors */ - gr_pixel_mode_pal8, /* 8-bit paletted - 256 colors */ - gr_pixel_mode_gray, /* 8-bit gray levels */ - gr_pixel_mode_rgb555, /* 15-bits mode - 32768 colors */ - gr_pixel_mode_rgb565, /* 16-bits mode - 65536 colors */ - gr_pixel_mode_rgb24, /* 24-bits mode - 16 million colors */ - gr_pixel_mode_rgb32, /* 32-bits mode - 16 million colors */ - gr_pixel_mode_lcd, /* horizontal RGB-decimated */ - gr_pixel_mode_lcdv, /* vertical RGB-decimated */ - gr_pixel_mode_lcd2, /* horizontal BGR-decimated */ - gr_pixel_mode_lcdv2, /* vertical BGR-decimated */ - gr_pixel_mode_bgra, /* premultiplied BGRA colors */ - - gr_pixel_mode_max /* don't remove */ - - } grPixelMode; - - - /* forward declaration of the surface class */ - typedef struct grSurface_ grSurface; - - - /********************************************************************* - * - * - * grBitmap - * - * - * a simple bitmap descriptor - * - * - * rows :: height in pixels - * width :: width in pixels - * pitch :: + or - the number of bytes per row - * mode :: pixel mode of bitmap buffer - * grays :: number of grays in palette for PAL8 mode. 0 otherwise - * buffer :: pointer to pixel buffer - * - * - * the 'pitch' is positive for downward flows, and negative otherwise - * Its absolute value is always the number of bytes taken by each - * bitmap row. - * - * All drawing operations will be performed within the first - * "width" pixels of each row (clipping is always performed). - * - ********************************************************************/ - - typedef struct grBitmap_ - { - int rows; - int width; - int pitch; - grPixelMode mode; - int grays; - unsigned char* buffer; - - } grBitmap; - - - - typedef long grPos; - typedef char grBool; - - typedef struct grVector_ - { - grPos x; - grPos y; - - } grVector; - - - typedef union grColor_ - { - long value; - unsigned char chroma[4]; - - } grColor; - - - - /********************************************************************** - * - * - * grNewBitmap - * - * - * creates a new bitmap - * - * - * pixel_mode :: the target surface's pixel_mode - * num_grays :: number of grays levels for PAL8 pixel mode - * width :: width in pixels - * height :: height in pixels - * - * - * bit :: descriptor of the new bitmap - * - * - * Error code. 0 means success. - * - * - * This function really allocates a pixel buffer, zero it, then - * returns a descriptor for it. - * - * Call grDoneBitmap when you're done with it.. - * - **********************************************************************/ - - extern int grNewBitmap( grPixelMode pixel_mode, - int num_grays, - int width, - int height, - grBitmap *bit ); - - - /********************************************************************** - * - * - * grBlitGlyphToBitmap - * - * - * writes a given glyph bitmap to a target surface. - * - * - * target :: handle to target bitmap - * glyph :: handle to source glyph bitmap - * x :: position of left-most pixel of glyph image in target surface - * y :: position of top-most pixel of glyph image in target surface - * color :: color to be used to draw a monochrome glyph - * - * - * Error code. 0 means success - * - * - * There are only two supported source pixel modes : monochrome - * and gray. The 8-bit images can have any number of grays between - * 2 and 128, and conversions to the target surface is handled - * _automatically_. - * - * Note however that you should avoid blitting a gray glyph to a gray - * bitmap with fewer levels of grays, as this would much probably - * give unpleasant results.. - * - * This function performs clipping - * - **********************************************************************/ - - extern int - grBlitGlyphToBitmap( grBitmap* target, - grBitmap* glyph, - grPos x, - grPos y, - grColor color ); - - - /* values must be in 0..255 range */ - extern grColor - grFindColor( grBitmap* target, - int red, - int green, - int blue, - int alpha ); - - - /********************************************************************** - * - * - * grWriteCellChar - * - * - * The graphics sub-system contains an internal CP437 8x8 font - * which can be used to display simple strings of text without - * using FreeType. - * - * This function writes a single 8x8 character on the target bitmap. - * - * - * target :: handle to target surface - * x :: x pixel position of character cell's top left corner - * y :: y pixel position of character cell's top left corner - * charcode :: Latin-1 character code - * color :: color to be used to draw the character - * - **********************************************************************/ - - extern - void grWriteCellChar( grBitmap* target, - int x, - int y, - int charcode, - grColor color ); - - - /********************************************************************** - * - * - * grWriteCellString - * - * - * The graphics sub-system contains an internal CP437 8x8 font - * which can be used to display simple strings of text without - * using FreeType. - * - * This function writes a string with the internal font - * - * - * target :: handle to target bitmap - * x :: x pixel position of string's top left corner - * y :: y pixel position of string's top left corner - * string :: Latin-1 text string - * color :: color to be used to draw the character - * - **********************************************************************/ - - extern - void grWriteCellString( grBitmap* target, - int x, - int y, - const char* string, - grColor color ); - - /********************************************************************** - * - * - * grDoneBitmap - * - * - * destroys a bitmap - * - * - * bitmap :: handle to bitmap descriptor - * - * - * This function does NOT release the bitmap descriptor, only - * the pixel buffer. - * - **********************************************************************/ - - extern void grDoneBitmap( grBitmap* bit ); - - - /********************************************************************** - * - * - * grFillRect - * - * - * this function is used to fill a given rectangle on a surface - * - * - * target :: handle to target surface - * x :: x coordinate of the top-left corner of the rectangle - * y :: y coordinate of the top-left corner of the rectangle - * width :: rectangle width in pixels - * height :: rectangle height in pixels - * color :: fill color - * - **********************************************************************/ - - extern void - grFillHLine( grBitmap* target, - int x, - int y, - int width, - grColor color ); - - extern void - grFillVLine( grBitmap* target, - int x, - int y, - int height, - grColor color ); - - extern void - grFillRect( grBitmap* target, - int x, - int y, - int width, - int height, - grColor color ); - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /******** ********/ - /******** DEVICE-SPECIFIC DEFINITIONS AND ROUTINES ********/ - /******** ********/ - /******** ********/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - - /* forward declaration - the definition of grDevice is not visible */ - /* to clients.. */ - typedef struct grDevice_ grDevice; - - - /********************************************************************** - * - * - * grDeviceChain - * - * - * a simple structure used to implement a linked list of - * graphics device descriptors. The list is called a - * "device chain" - * - * - * name :: ASCII name of the device, e.g. "x11", "os2pm", etc.. - * device :: handle to the device descriptor. - * next :: next element in chain - * - * - * the 'device' field is a blind pointer; it is thus unusable by - * client applications.. - * - **********************************************************************/ - - typedef struct grDeviceChain_ grDeviceChain; - - struct grDeviceChain_ - { - const char* name; - grDevice* device; - grDeviceChain* next; - }; - - - /********************************************************************** - * - * - * grInitDevices - * - * - * This function is in charge of initialising all system-specific - * devices. A device is responsible for creating and managing one - * or more "surfaces". A surface is either a window or a screen, - * depending on the system. - * - * - * a pointer to the first element of a device chain. The chain can - * be parsed to find the available devices on the current system - * - * - * If a device cannot be initialised correctly, it is not part of - * the device chain returned by this function. For example, if an - * X11 device was compiled in the library, it will be part of - * the returned device chain only if a connection to the display - * could be established - * - * If no driver could be initialised, this function returns NULL. - * - **********************************************************************/ - - extern - grDeviceChain* grInitDevices( void ); - - - /********************************************************************** - * - * - * grDoneDevices - * - * - * Finalize all devices activated with grInitDevices. - * - **********************************************************************/ - - extern - void grDoneDevices( void ); - - - /********************************************************************** - * - * - * grGetDeviceModes - * - * - * queries the available pixel modes for a device. - * - * - * device_name :: name of device to be used. 0 for the default - * device. For a list of available devices, see - * grInitDevices. - * - * - * num_modes :: number of available modes. 0 in case of error, - * which really is an invalid device name. - * - * pixel_modes :: array of available pixel modes for this device - * this table is internal to the device and should - * not be freed by client applications. - * - * - * error code. 0 means success. invalid device name otherwise - * - * - * All drivers are _required_ to support at least the following - * pixel formats : - * - * - gr_pixel_mode_mono : i.e. monochrome bitmaps - * - gr_pixel_mode_gray : with any number of gray levels between - * 2 and 256. - * - * the pixel modes do not provide the number of grays in the case - * of "gray" devices. You should try to create a surface with the - * maximal number (256, that is) and see the value returned in - * the bitmap descriptor. - * - **********************************************************************/ - - extern void grGetDeviceModes( const char* device_name, - int *num_modes, - grPixelMode* *pixel_modes ); - - - - /********************************************************************** - * - * - * grNewSurface - * - * - * creates a new device-specific surface. A surface is either - * a window or a screen, depending on the device. - * - * - * device :: name of the device to use. A value of NULL means - * the default device (which depends on the system). - * for a list of available devices, see grInitDevices. - * - * - * bitmap :: handle to a bitmap descriptor containing the - * requested pixel mode, number of grays and dimensions - * for the surface. the bitmap's 'pitch' and 'buffer' - * fields are ignored on input. - * - * On output, the bitmap describes the surface's image - * completely. It is possible to write directly in it - * with grBlitGlyphToBitmap, even though the use of - * grBlitGlyphToSurface is recommended. - * - * - * handle to the corresponding surface object. 0 in case of error - * - * - * All drivers are _required_ to support at least the following - * pixel formats : - * - * - gr_pixel_mode_mono : i.e. monochrome bitmaps - * - gr_pixel_mode_gray : with any number of gray levels between - * 2 and 256. - * - * This function might change the bitmap descriptor's fields. For - * example, when displaying a full-screen surface, the bitmap's - * dimensions will be set to those of the screen (e.g. 640x480 - * or 800x600); also, the bitmap's 'buffer' field might point to - * the Video Ram depending on the mode requested.. - * - * The surface contains a copy of the returned bitmap descriptor, - * you can thus discard the 'bitmap' parameter after the call. - * - **********************************************************************/ - - extern grSurface* grNewSurface( const char* device, - grBitmap* bitmap ); - - extern void grDoneSurface( grSurface* surface ); - - /********************************************************************** - * - * - * grRefreshRectangle - * - * - * this function is used to indicate that a given surface rectangle - * was modified and thus needs re-painting. It really is useful for - * windowed or gray surfaces. - * - * - * surface :: handle to target surface - * x :: x coordinate of the top-left corner of the rectangle - * y :: y coordinate of the top-left corner of the rectangle - * width :: rectangle width in pixels - * height :: rectangle height in pixels - * - **********************************************************************/ - - extern void grRefreshRectangle( grSurface* surface, - grPos x, - grPos y, - grPos width, - grPos height ); - - - /********************************************************************** - * - * - * grRefreshSurface - * - * - * a variation of grRefreshRectangle which repaints the whole surface - * to the screen. - * - * - * surface :: handle to target surface - * - **********************************************************************/ - - extern void grRefreshSurface( grSurface* surface ); - - - - /********************************************************************** - * - * - * grWriteSurfaceChar - * - * - * This function is equivalent to calling grWriteCellChar on the - * surface's bitmap, then invoking grRefreshRectangle. - * - * The graphics sub-system contains an internal CP437 8x8 font - * which can be used to display simple strings of text without - * using FreeType. - * - * This function writes a single 8x8 character on the target bitmap. - * - * - * target :: handle to target surface - * x :: x pixel position of character cell's top left corner - * y :: y pixel position of character cell's top left corner - * charcode :: Latin-1 character code - * color :: color to be used to draw the character - * - **********************************************************************/ - - extern - void grWriteSurfaceChar( grSurface* target, - int x, - int y, - int charcode, - grColor color ); - - - /********************************************************************** - * - * - * grWriteSurfaceString - * - * - * This function is equivalent to calling grWriteCellString on the - * surface's bitmap, then invoking grRefreshRectangle. - * - * The graphics sub-system contains an internal CP437 8x8 font - * which can be used to display simple strings of text without - * using FreeType. - * - * This function writes a string with the internal font - * - * - * target :: handle to target bitmap - * x :: x pixel position of string's top left corner - * y :: y pixel position of string's top left corner - * string :: Latin-1 text string - * color :: color to be used to draw the character - * - **********************************************************************/ - - extern - void grWriteSurfaceString( grSurface* target, - int x, - int y, - const char* string, - grColor color ); - - - /********************************************************************** - * - * - * grSetTitle - * - * - * set the window title of a given windowed surface. - * - * - * surface :: handle to target surface - * title_string :: the new title - * - **********************************************************************/ - - extern void grSetTitle( grSurface* surface, - const char* title_string ); - - - - - /********************************************************************** - * - * - * grListenSurface - * - * - * listen the events for a given surface - * - * - * surface :: handle to target surface - * event_mask :: the event mask (mode) - * - * - * event :: the returned event - * - * - * XXX : For now, only keypresses are supported. - * - **********************************************************************/ - - extern - int grListenSurface( grSurface* surface, - int event_mask, - grEvent *event ); - - /********************************************************************** - * - * - * grSetGlyphGamma - * - * - * set the gamma-correction coefficient. This is only used to - * blit glyphs - * - * - * gamma :: gamma value. <= 0 to select sRGB transfer function - * - **********************************************************************/ - - extern - void grSetGlyphGamma( double gamma_value ); - -/* */ - -#endif /* GRAPH_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grblit.c freetype-2.8/=unpacked-tar1=/graph/grblit.c --- freetype-2.7.1/=unpacked-tar1=/graph/grblit.c 2016-10-19 04:55:23.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grblit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2060 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2002, 2009, 2011, 2014 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* grblit.c: Support for blitting of bitmaps with various depth. */ -/* */ -/****************************************************************************/ - -#include "grblit.h" -#include "grobjs.h" - -#define GRAY8 - - static - int compute_clips( grBlitter* blit, - int x_offset, - int y_offset ) - { - int xmin, ymin, xmax, ymax, width, height, target_width; - - /* perform clipping and setup variables */ - width = blit->source.width; - height = blit->source.rows; - - switch ( blit->source.mode ) - { - case gr_pixel_mode_mono: - width = (width + 7) & -8; - break; - - case gr_pixel_mode_pal4: - width = (width + 1) & -2; - break; - - case gr_pixel_mode_lcd: - case gr_pixel_mode_lcd2: - width /= 3; - break; - - case gr_pixel_mode_lcdv: - case gr_pixel_mode_lcdv2: - height /= 3; - break; - - default: - ; - } - - xmin = x_offset; - ymin = y_offset; - xmax = xmin + width-1; - ymax = ymin + height-1; - - /* clip if necessary */ - if ( width == 0 || height == 0 || - xmax < 0 || xmin >= blit->target.width || - ymax < 0 || ymin >= blit->target.rows ) - return 1; - - /* set up clipping and cursors */ - blit->yread = 0; - if ( ymin < 0 ) - { - blit->yread -= ymin; - height += ymin; - blit->ywrite = 0; - } - else - blit->ywrite = ymin; - - if ( ymax >= blit->target.rows ) - height -= ymax - blit->target.rows + 1; - - blit->xread = 0; - if ( xmin < 0 ) - { - blit->xread -= xmin; - width += xmin; - blit->xwrite = 0; - } - else - blit->xwrite = xmin; - - target_width = blit->target.width; - - switch ( blit->target.mode ) - { - case gr_pixel_mode_mono: - target_width = (target_width + 7) & -8; - break; - case gr_pixel_mode_pal4: - target_width = (target_width + 1) & -2; - break; - - default: - ; - } - - blit->right_clip = xmax - target_width + 1; - if ( blit->right_clip > 0 ) - width -= blit->right_clip; - else - blit->right_clip = 0; - - blit->width = width; - blit->height = height; - - /* set read and write to the top-left corner of the read */ - /* and write areas before clipping. */ - - blit->read = blit->source.buffer; - blit->write = blit->target.buffer; - - blit->read_line = blit->source.pitch; - blit->write_line = blit->target.pitch; - - if ( blit->read_line < 0 ) - blit->read -= (blit->source.rows-1) * blit->read_line; - - if ( blit->write_line < 0 ) - blit->write -= (blit->target.rows-1) * blit->write_line; - - /* now go to the start line. Note that we do not move the */ - /* x position yet, as this is dependent on the pixel format */ - blit->read += blit->yread * blit->read_line; - blit->write += blit->ywrite * blit->write_line; - - return 0; - } - - -/**************************************************************************/ -/* */ -/* blit_mono_to_mono */ -/* */ -/**************************************************************************/ - - static - void blit_mono_to_mono( grBlitter* blit, - grColor color ) - { - unsigned int shift; - int left_clip, x, y; - - byte* read; - byte* write; - - (void)color; /* unused argument */ - - left_clip = ( blit->xread > 0 ); - shift = (unsigned int)( blit->xwrite - blit->xread ) & 7; - - read = blit->read + (blit->xread >> 3); - write = blit->write + (blit->xwrite >> 3); - - if ( shift == 0 ) - { - y = blit->height; - do - { - byte* _read = read; - byte* _write = write; - - x = blit->width; - - do - { - *_write++ |= *_read++; - x -= 8; - } while ( x > 0 ); - - read += blit->read_line; - write += blit->write_line; - y--; - } while ( y > 0 ); - } - else - { - int first, last, count; - - - first = blit->xwrite >> 3; - last = (blit->xwrite + blit->width-1) >> 3; - - count = last - first; - - if ( blit->right_clip ) - count++; - - y = blit->height; - - do - { - unsigned char* _read = read; - unsigned char* _write = write; - unsigned int old; - unsigned int shift2 = (8-shift); - - if ( left_clip ) - old = (unsigned int)(*_read++) << shift2; - else - old = 0; - - x = count; - while ( x > 0 ) - { - unsigned char val; - - val = *_read++; - *_write++ |= (unsigned char)( (val >> shift) | old ); - old = (unsigned int)val << shift2; - x--; - } - - if ( !blit->right_clip ) - *_write |= (unsigned char)old; - - read += blit->read_line; - write += blit->write_line; - y--; - - } while ( y > 0 ); - } - } - - -/**************************************************************************/ -/* */ -/* blit_mono_to_pal8 */ -/* */ -/**************************************************************************/ - - static - void blit_mono_to_pal8( grBlitter* blit, - grColor color ) - { - int x, y; - unsigned int shift; - unsigned char* read; - unsigned char* write; - - read = blit->read + (blit->xread >> 3); - write = blit->write + blit->xwrite; - shift = blit->xread & 7; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; - - x = blit->width; - do - { - if (val & 0x10000) - val = *_read++ | 0x100; - - if ( val & 0x80 ) - *_write = (unsigned char)color.value; - - val <<= 1; - _write++; - - } while ( --x > 0 ); - - read += blit->read_line; - write += blit->write_line; - y--; - } while ( y > 0 ); - } - - -/**************************************************************************/ -/* */ -/* blit_mono_to_pal4 */ -/* */ -/**************************************************************************/ - - static - void blit_mono_to_pal4( grBlitter* blit, - grColor color ) - { - int x, y, phase; - unsigned int shift; - unsigned char* read; - unsigned char* write; - unsigned int col; - - - col = color.value & 15; - read = blit->read + (blit->xread >> 3); - write = blit->write + (blit->xwrite >> 1); - - /* now begin blit */ - shift = blit->xread & 7; - phase = blit->xwrite & 1; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int _phase = phase; - unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; - - x = blit->width; - do - { - if (val & 0x10000) - val = *_read++ | 0x100; - - if ( val & 0x80 ) - { - if ( _phase ) - *_write = (unsigned char)((*_write & 0xF0) | col); - else - *_write = (unsigned char)((*_write & 0x0F) | (col << 4)); - } - - val <<= 1; - - _write += _phase; - _phase ^= 1; - x--; - } while ( x > 0 ); - - read += blit->read_line; - write += blit->write_line; - y--; - } while ( y > 0 ); - } - - -/**************************************************************************/ -/* */ -/* blit_mono_to_rgb16 */ -/* */ -/**************************************************************************/ - - static - void blit_mono_to_rgb16( grBlitter* blit, - grColor color ) - { - int x, y; - unsigned int shift; - unsigned char* read; - unsigned char* write; - - read = blit->read + (blit->xread >> 3); - write = blit->write + blit->xwrite*2; - shift = blit->xread & 7; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; - - x = blit->width; - do - { - if (val & 0x10000) - val = *_read++ | 0x100; - - if ( val & 0x80 ) - *(short*)_write = (short)color.value; - - val <<= 1; - _write +=2; - x--; - } while ( x > 0 ); - - read += blit->read_line; - write += blit->write_line; - y--; - } while ( y > 0 ); - } - - -/**************************************************************************/ -/* */ -/* blit_mono_to_rgb24 */ -/* */ -/**************************************************************************/ - - static - void blit_mono_to_rgb24( grBlitter* blit, - grColor color ) - { - int x, y; - unsigned int shift; - unsigned char* read; - unsigned char* write; - - read = blit->read + (blit->xread >> 3); - write = blit->write + blit->xwrite*3; - shift = blit->xread & 7; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; - - x = blit->width; - do - { - if (val & 0x10000) - val = *_read++ | 0x100; - - if ( val & 0x80 ) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - } - - val <<= 1; - _write += 3; - x--; - } while ( x > 0 ); - - read += blit->read_line; - write += blit->write_line; - y--; - } while ( y > 0 ); - } - - -/**************************************************************************/ -/* */ -/* blit_mono_to_rgb32 */ -/* */ -/**************************************************************************/ - - static - void blit_mono_to_rgb32( grBlitter* blit, - grColor color ) - { - int x, y; - unsigned int shift; - unsigned char* read; - unsigned char* write; - - read = blit->read + ( blit->xread >> 3 ); - write = blit->write + blit->xwrite*4; - shift = blit->xread & 7; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - unsigned long val = ((unsigned long)*_read++ | 0x100L ) << shift; - - x = blit->width; - do - { - if ( val & 0x10000 ) - val = *_read++ | 0x100L; - - if ( val & 0x80 ) - { - /* this could be greatly optimized as */ - /* */ - /* *(long*)_write = color.value */ - /* */ - /* but it wouldn't work on 64-bits systems... stupid C types! */ - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - _write[3] = color.chroma[3]; - } - - val <<= 1; - _write += 4; - x--; - - } while ( x > 0 ); - - read += blit->read_line; - write += blit->write_line; - y--; - - } while ( y > 0 ); - } - - - static - const grBlitterFunc gr_mono_blitters[gr_pixel_mode_max] = - { - 0, - blit_mono_to_mono, - blit_mono_to_pal4, - blit_mono_to_pal8, - blit_mono_to_pal8, - blit_mono_to_rgb16, - blit_mono_to_rgb16, - blit_mono_to_rgb24, - blit_mono_to_rgb32 - }; - - - /*******************************************************************/ - /* */ - /* Saturation tables */ - /* */ - /*******************************************************************/ - - typedef struct grSaturation_ - { - int count; - const byte* table; - - } grSaturation; - - - static - const byte gr_saturation_5[8] = { 0, 1, 2, 3, 4, 4, 4, 4 }; - - - static - const byte gr_saturation_17[32] = - { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - }; - - - static - grSaturation gr_saturations[ GR_MAX_SATURATIONS ] = - { - { 5, gr_saturation_5 }, - { 17, gr_saturation_17 } - }; - - static - int gr_num_saturations = 2; - - static - grSaturation* gr_last_saturation = gr_saturations; - - - static const byte* - grGetSaturation( int num_grays ) - { - /* first of all, scan the current saturations table */ - grSaturation* sat = gr_saturations; - grSaturation* limit = sat + gr_num_saturations; - - if ( num_grays < 2 ) - { - grError = gr_err_bad_argument; - return 0; - } - - for ( ; sat < limit; sat++ ) - { - if ( sat->count == num_grays ) - { - gr_last_saturation = sat; - return sat->table; - } - } - - /* not found, simply create a new entry if there is room */ - if (gr_num_saturations < GR_MAX_SATURATIONS) - { - int i; - const byte* table; - - table = (const byte*)grAlloc( (unsigned long)( 3 * num_grays - 1 ) * - sizeof ( byte ) ); - if (!table) return 0; - - sat->count = num_grays; - sat->table = table; - - for ( i = 0; i < num_grays; i++, table++ ) - *(unsigned char*)table = (unsigned char)i; - - for ( i = 2*num_grays-1; i > 0; i--, table++ ) - *(unsigned char*)table = (unsigned char)(num_grays-1); - - gr_num_saturations++; - gr_last_saturation = sat; - return sat->table; - } - grError = gr_err_saturation_overflow; - return 0; - } - - - - /*******************************************************************/ - /* */ - /* conversion tables */ - /* */ - /*******************************************************************/ - - typedef struct grConversion_ - { - int target_grays; - int source_grays; - const byte* table; - - } grConversion; - - - - static - const byte gr_gray5_to_gray17[5] = { 0, 4, 8, 12, 16 }; - - - static - const byte gr_gray5_to_gray128[5] = { 0, 32, 64, 96, 127 }; - - - static - const unsigned char gr_gray17_to_gray128[17] = - { - 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 127 - }; - - static - grConversion gr_conversions[ GR_MAX_CONVERSIONS ] = - { - { 17, 5, gr_gray5_to_gray17 }, - { 128, 5, gr_gray5_to_gray128 }, - { 128, 17, gr_gray17_to_gray128 } - }; - - static - int gr_num_conversions = 3; - - static - grConversion* gr_last_conversion = gr_conversions; - - - static const byte* - grGetConversion( int target_grays, - int source_grays ) - { - grConversion* conv = gr_conversions; - grConversion* limit = conv + gr_num_conversions; - - if ( target_grays < 2 || source_grays < 2 ) - { - grError = gr_err_bad_argument; - return 0; - } - - /* otherwise, scan table */ - for ( ; conv < limit; conv++ ) - { - if ( conv->target_grays == target_grays && - conv->source_grays == source_grays ) - { - gr_last_conversion = conv; - return conv->table; - } - } - - /* not found, add a new conversion to the table */ - if (gr_num_conversions < GR_MAX_CONVERSIONS) - { - const byte* table; - int n; - - table = (const byte*)grAlloc( (unsigned long)source_grays * - sizeof ( byte ) ); - if (!table) - return 0; - - conv->target_grays = target_grays; - conv->source_grays = source_grays; - conv->table = table; - - for ( n = 0; n < source_grays; n++ ) - ((unsigned char*)table)[n] = (unsigned char)(n*(target_grays-1) / - (source_grays-1)); - - gr_num_conversions++; - gr_last_conversion = conv; - return table; - } - grError = gr_err_conversion_overflow; - return 0; - } - - - - -/**************************************************************************/ -/* */ -/* blit_gray_to_gray */ -/* */ -/**************************************************************************/ - - static - void blit_gray_to_gray( grBlitter* blit, - const byte* saturation, - const byte* conversion ) - { - int y; - unsigned char* read; - unsigned char* write; - - - read = blit->read + blit->xread; - write = blit->write + blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { -#ifdef GR_CONFIG_GRAY_SKIP_WHITE - unsigned char val = *_read; - - if (val) - { - if (val == max) - *_write = max2; - else - *_write = saturation[ (int)*_write + conversion[ *_read ] ]; - } -#else - *_write = saturation[ (int)*_write + conversion[ *_read ] ]; -#endif - _write++; - _read++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - -/**************************************************************************/ -/* */ -/* blit_gray_to_gray_simple */ -/* */ -/**************************************************************************/ - - static - void blit_gray_to_gray_simple( grBlitter* blit, - const byte* saturation ) - { - int y; - unsigned char* read; - unsigned char* write; -#ifdef GR_CONFIG_GRAY_SKIP_WHITE - unsigned char max; - - - max = (unsigned char)( blit->source.grays - 1 ); -#endif - - read = blit->read + blit->xread; - write = blit->write + blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { -#ifdef GR_CONFIG_GRAY_SKIP_WHITE - unsigned char val = *_read; - - if (val) - { - if (val == max) - *_write = val; - else - *_write = saturation[ (int)*_write + *_read ]; - } -#else - *_write = saturation[ (int)*_write + *_read ]; -#endif - _write++; - _read++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - - -#define compose_pixel_full( a, b, n0, n1, n2, max ) \ - { \ - int d, half = max >> 1; \ - \ - \ - d = (int)b.chroma[0] - a.chroma[0]; \ - a.chroma[0] += (unsigned char)((n0*d + half)/max); \ - \ - d = (int)b.chroma[1] - a.chroma[1]; \ - a.chroma[1] += (unsigned char)((n1*d + half)/max); \ - \ - d = (int)b.chroma[2] - a.chroma[2]; \ - a.chroma[2] += (unsigned char)((n2*d + half)/max); \ - } - -#define compose_pixel( a, b, n, max ) \ - compose_pixel_full( a, b, n, n, n, max ) - - -#define extract555( pixel, color ) \ - color.chroma[0] = (unsigned char)((pixel >> 10) & 0x1F); \ - color.chroma[1] = (unsigned char)((pixel >> 5) & 0x1F); \ - color.chroma[2] = (unsigned char)((pixel ) & 0x1F); - - -#define extract565( pixel, color ) \ - color.chroma[0] = (unsigned char)((pixel >> 11) & 0x1F); \ - color.chroma[1] = (unsigned char)((pixel >> 5) & 0x3F); \ - color.chroma[2] = (unsigned char)((pixel ) & 0x1F); - - -#define inject555( color ) \ - ( ( (unsigned short)color.chroma[0] << 10 ) | \ - ( (unsigned short)color.chroma[1] << 5 ) | \ - color.chroma[2] ) - - -#define inject565( color ) \ - ( ( (unsigned short)color.chroma[0] << 11 ) | \ - ( (unsigned short)color.chroma[1] << 5 ) | \ - color.chroma[2] ) - - -/**************************************************************************/ -/* */ -/* blit_gray_to_555 */ -/* */ -/**************************************************************************/ - -#ifdef GRAY8 - static - void blit_gray8_to_555( grBlitter* blit, - grColor color ) - { - int y; - int sr = (color.chroma[0] << 7) & 0x7C00; - int sg = (color.chroma[1] << 2) & 0x03E0; - int sb = (color.chroma[2] >> 3) & 0x001F; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 2*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - unsigned short* pixel = (unsigned short*)_write; - - if (val >= 254 ) - *pixel = (unsigned short)( sr | sg | sb ); - else if ( val >= 2 ) - { - /* compose gray value */ - int pix = (int)*pixel; - int dr = pix & 0x7C00; - int dg = pix & 0x03E0; - int db = pix & 0x001F; - - dr += ((sr-dr)*val) >> 8; - dr &= 0x7C00; - - dg += ((sg-dg)*val) >> 8; - dg &= 0x03E0; - - db += ((sb-db)*val) >> 8; - db &= 0x001F; - - *pixel = (unsigned short)( dr | dg | db ); - } - } - _write +=2; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - - } -#endif /* GRAY8 */ - - static - void blit_gray_to_555( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 2*blit->xwrite; - - /* scale down R:G:B triplet */ - color.chroma[0] >>= 3; - color.chroma[1] >>= 3; - color.chroma[2] >>= 3; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - unsigned short* pixel = (unsigned short*)_write; - - if (val == max) - *pixel = (unsigned short)(inject555( color )); - else - { - /* compose gray value */ - unsigned short pix16 = *pixel; - grColor pix; - - extract555( pix16, pix ); - - compose_pixel( pix, color, val, max ); - *pixel = (unsigned short)(inject555( pix )); - } - } - _write += 2; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - -/**************************************************************************/ -/* */ -/* blit_gray_to_565 */ -/* */ -/**************************************************************************/ - -#ifdef GRAY8 - static - void blit_gray8_to_565( grBlitter* blit, - grColor color ) - { - int y; - int sr = (color.chroma[0] << 8) & 0xF800; - int sg = (color.chroma[1] << 3) & 0x07E0; - int sb = (color.chroma[2] >> 3) & 0x001F; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 2*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - unsigned short* pixel = (unsigned short*)_write; - - if (val >= 254 ) - *pixel = (unsigned short)( sr | sg | sb ); - else if ( val >= 2 ) - { - /* compose gray value */ - int pix = (int)*pixel; - int dr = pix & 0xF800; - int dg = pix & 0x07E0; - int db = pix & 0x001F; - - dr += ((sr-dr)*val) >> 8; - dr &= 0xF800; - - dg += ((sg-dg)*val) >> 8; - dg &= 0x07E0; - - db += ((sb-db)*val) >> 8; - db &= 0x001F; - - *pixel = (unsigned short)( dr | dg | db ); - } - } - _write +=2; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } -#endif - - static - void blit_gray_to_565( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 2*blit->xwrite; - - /* scale down R:G:B triplet */ - color.chroma[0] >>= 3; - color.chroma[1] >>= 2; - color.chroma[2] >>= 3; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - unsigned short* pixel = (unsigned short*)_write; - - if (val == max) - *pixel = (unsigned short)inject565( color ); - else - { - /* compose gray value */ - unsigned short pix16 = *pixel; - grColor pix; - - extract565( pix16, pix ); - - compose_pixel( pix, color, val, max ); - *pixel = (unsigned short)inject565( pix ); - } - } - _write +=2; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - -/**************************************************************************/ -/* */ -/* blit_gray_to_24 */ -/* */ -/**************************************************************************/ - -#ifdef GRAY8 - static void - blit_gray8_to_24( grBlitter* blit, - grColor color ) - { - int y; - int sr = color.chroma[0]; - int sg = color.chroma[1]; - int sb = color.chroma[2]; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 3*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - if (val >= 254) - { - _write[0] = (unsigned char)sr; - _write[1] = (unsigned char)sg; - _write[2] = (unsigned char)sb; - } - else if ( val >= 2 ) - { - int dr = _write[0]; - int dg = _write[1]; - int db = _write[2]; - - dr += ((sr-dr)*val) >> 8; - dg += ((sg-dg)*val) >> 8; - db += ((sb-db)*val) >> 8; - - _write[0] = (unsigned char)dr; - _write[1] = (unsigned char)dg, - _write[2] = (unsigned char)db; - } - } - _write += 3; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } -#endif /* GRAY8 */ - - - static - void blit_gray_to_24( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 3*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - if (val == max) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - } - else - { - /* compose gray value */ - grColor pix; - - pix.chroma[0] = _write[0]; - pix.chroma[1] = _write[1]; - pix.chroma[2] = _write[2]; - - compose_pixel( pix, color, val, max ); - - _write[0] = pix.chroma[0]; - _write[1] = pix.chroma[1]; - _write[2] = pix.chroma[2]; - } - } - _write += 3; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - -/**************************************************************************/ -/* */ -/* blit_gray_to_32 */ -/* */ -/**************************************************************************/ - - static - void blit_gray_to_32( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - - read = blit->read + blit->xread; - write = blit->write + 4*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val; - - val = *_read; - if (val) - { - if (val == max) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - _write[3] = color.chroma[3]; - } - else - { - /* compose gray value */ - grColor pix; - - pix.chroma[0] = _write[0]; - pix.chroma[1] = _write[1]; - pix.chroma[2] = _write[2]; - - compose_pixel( pix, color, val, max ); - - _write[0] = pix.chroma[0]; - _write[1] = pix.chroma[1]; - _write[2] = pix.chroma[2]; - } - } - _write += 4; - _read ++; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - - static - void blit_gray8_to_32( grBlitter* blit, - grColor color ) - { - blit_gray_to_32( blit, color, 255 ); - } - - -/**************************************************************************/ -/* */ -/* blit_lcd_to_24 */ -/* */ -/**************************************************************************/ - -#ifdef GRAY8 - static void - blit_lcd8_to_24( grBlitter* blit, - grColor color ) - { - int y; - int sr = color.chroma[0]; - int sg = color.chroma[1]; - int sb = color.chroma[2]; - unsigned char* read; - unsigned char* write; - - read = blit->read + 3*blit->xread; - write = blit->write + 3*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - int val0, val1, val2; - - val0 = _read[0]; - val1 = _read[1]; - val2 = _read[2]; - - if ( val0 | val1 | val2 ) - { - if ( val0 == val1 && - val0 == val2 && - val0 == 255 ) - { - _write[0] = (unsigned char)sr; - _write[1] = (unsigned char)sg; - _write[2] = (unsigned char)sb; - } - else - { - /* compose gray value */ - int dr, dg, db; - - dr = _write[0]; - dr += (sr-dr)*val0 >> 8; - - dg = _write[1]; - dg += (sg-dg)*val1 >> 8; - - db = _write[2]; - db += (sb-db)*val2 >> 8; - - _write[0] = (unsigned char)dr; - _write[1] = (unsigned char)dg; - _write[2] = (unsigned char)db; - } - } - _write += 3; - _read += 3; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } -#endif /* GRAY8 */ - - static void - blit_lcd_to_24( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - - read = blit->read + 3*blit->xread; - write = blit->write + 3*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - int val0, val1, val2; - - val0 = _read[0]; - val1 = _read[1]; - val2 = _read[2]; - - if ( val0 | val1 | val2 ) - { - if ( val0 == val1 && - val0 == val2 && - val0 == max ) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - } - else - { - /* compose gray value */ - grColor pix; - - pix.chroma[0] = _write[0]; - pix.chroma[1] = _write[1]; - pix.chroma[2] = _write[2]; - - compose_pixel_full( pix, color, val0, val1, val2, max ); - - _write[0] = pix.chroma[0]; - _write[1] = pix.chroma[1]; - _write[2] = pix.chroma[2]; - } - } - _write += 3; - _read += 3; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - -#ifdef GRAY8 - static void - blit_lcd28_to_24( grBlitter* blit, - grColor color ) - { - int y; - int sr = color.chroma[0]; - int sg = color.chroma[1]; - int sb = color.chroma[2]; - unsigned char* read; - unsigned char* write; - - read = blit->read + 3*blit->xread; - write = blit->write + 3*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - int val0, val1, val2; - - val0 = _read[2]; - val1 = _read[1]; - val2 = _read[0]; - - if ( val0 | val1 | val2 ) - { - if ( val0 == val1 && - val0 == val2 && - val0 == 255 ) - { - _write[0] = (unsigned char)sr; - _write[1] = (unsigned char)sg; - _write[2] = (unsigned char)sb; - } - else - { - /* compose gray value */ - int dr, dg, db; - - dr = _write[0]; - dr += (sr-dr)*val0 >> 8; - - dg = _write[1]; - dg += (sg-dg)*val1 >> 8; - - db = _write[2]; - db += (sb-db)*val2 >> 8; - - _write[0] = (unsigned char)dr; - _write[1] = (unsigned char)dg; - _write[2] = (unsigned char)db; - } - } - _write += 3; - _read += 3; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } -#endif /* GRAY8 */ - - static void - blit_lcd2_to_24( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - - read = blit->read + 3*blit->xread; - write = blit->write + 3*blit->xwrite; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - int val0, val1, val2; - - val0 = _read[2]; - val1 = _read[1]; - val2 = _read[0]; - - if ( val0 | val1 | val2 ) - { - if ( val0 == val1 && - val0 == val2 && - val0 == max ) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - } - else - { - /* compose gray value */ - grColor pix; - - pix.chroma[0] = _write[0]; - pix.chroma[1] = _write[1]; - pix.chroma[2] = _write[2]; - - compose_pixel_full( pix, color, val0, val1, val2, max ); - - _write[0] = pix.chroma[0]; - _write[1] = pix.chroma[1]; - _write[2] = pix.chroma[2]; - } - } - _write += 3; - _read += 3; - x--; - } - - read += blit->read_line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - -/**************************************************************************/ -/* */ -/* blit_lcdv_to_24 */ -/* */ -/**************************************************************************/ - - static void - blit_lcdv_to_24( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - long line; - - read = blit->read + blit->xread; - write = blit->write + 3*blit->xwrite; - line = blit->read_line; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val0, val1, val2; - - val0 = _read[0*line]; - val1 = _read[1*line]; - val2 = _read[2*line]; - - if ( val0 | val1 | val2 ) - { - if ( val0 == val1 && - val0 == val2 && - val0 == max ) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - } - else - { - /* compose gray value */ - grColor pix; - - pix.chroma[0] = _write[0]; - pix.chroma[1] = _write[1]; - pix.chroma[2] = _write[2]; - - compose_pixel_full( pix, color, val0, val1, val2, max ); - - _write[0] = pix.chroma[0]; - _write[1] = pix.chroma[1]; - _write[2] = pix.chroma[2]; - } - } - _write += 3; - _read += 1; - x--; - } - - read += 3*line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - - static void - blit_lcdv2_to_24( grBlitter* blit, - grColor color, - int max ) - { - int y; - unsigned char* read; - unsigned char* write; - long line; - - read = blit->read + blit->xread; - write = blit->write + 3*blit->xwrite; - line = blit->read_line; - - y = blit->height; - do - { - unsigned char* _read = read; - unsigned char* _write = write; - int x = blit->width; - - while (x > 0) - { - unsigned char val0, val1, val2; - - val0 = _read[2*line]; - val1 = _read[1*line]; - val2 = _read[0*line]; - - if ( val0 | val1 | val2 ) - { - if ( val0 == val1 && - val0 == val2 && - val0 == max ) - { - _write[0] = color.chroma[0]; - _write[1] = color.chroma[1]; - _write[2] = color.chroma[2]; - } - else - { - /* compose gray value */ - grColor pix; - - pix.chroma[0] = _write[0]; - pix.chroma[1] = _write[1]; - pix.chroma[2] = _write[2]; - - compose_pixel_full( pix, color, val0, val1, val2, max ); - - _write[0] = pix.chroma[0]; - _write[1] = pix.chroma[1]; - _write[2] = pix.chroma[2]; - } - } - _write += 3; - _read += 1; - x--; - } - - read += 3*line; - write += blit->write_line; - y--; - } - while (y > 0); - } - - - /********************************************************************** - * - * - * grBlitGlyphToBitmap - * - * - * writes a given glyph bitmap to a target surface. - * - * - * surface :: handle to target surface - * x :: position of left-most pixel of glyph image in surface - * y :: position of top-most pixel of glyph image in surface - * bitmap :: source glyph image - * - * - * Error code. 0 means success - * - **********************************************************************/ - - typedef void (*grColorGlyphBlitter)( grBlitter* blit, - grColor color, - int max_gray ); - - static - const grColorGlyphBlitter gr_color_blitters[gr_pixel_mode_max] = - { - 0, - 0, - 0, - 0, - 0, - blit_gray_to_555, - blit_gray_to_565, - blit_gray_to_24, - blit_gray_to_32 - }; - -#ifdef GRAY8 - typedef void (*grGray8GlyphBlitter)( grBlitter* blit, - grColor color ); - - static - const grGray8GlyphBlitter gr_gray8_blitters[gr_pixel_mode_max] = - { - 0, - 0, - 0, - 0, - 0, - blit_gray8_to_555, - blit_gray8_to_565, - blit_gray8_to_24, - blit_gray8_to_32 - }; -#endif - - -#include "gblblit.h" - - static double gr_glyph_gamma = 1.8; - - void grSetGlyphGamma( double gamma ) - { - gr_glyph_gamma = gamma; - } - - - int - grBlitGlyphToBitmap( grBitmap* target, - grBitmap* glyph, - grPos x, - grPos y, - grColor color ) - { - grBlitter blit; - grPixelMode mode; - - - /* check arguments */ - if ( !target || !glyph ) - { - grError = gr_err_bad_argument; - return -1; - } - - if ( !glyph->rows || !glyph->width ) - { - /* nothing to do */ - return 0; - } - - /* short cut to alpha blender for certain glyph types - */ - { - GBlenderSourceFormat src_format; - GBlenderTargetFormat dst_format; - int width, height; - GBlenderBlitRec gblit[1]; - GBlenderPixel gcolor; - static GBlenderRec gblender[1]; - static double gblender_gamma = -100.0; - - if ( glyph->grays != 256 ) - goto LegacyBlit; - - switch ( glyph->mode ) - { - case gr_pixel_mode_gray: src_format = GBLENDER_SOURCE_GRAY8; break; - case gr_pixel_mode_lcd: src_format = GBLENDER_SOURCE_HRGB; break; - case gr_pixel_mode_lcdv: src_format = GBLENDER_SOURCE_VRGB; break; - case gr_pixel_mode_lcd2: src_format = GBLENDER_SOURCE_HBGR; break; - case gr_pixel_mode_lcdv2: src_format = GBLENDER_SOURCE_VBGR; break; - case gr_pixel_mode_bgra: src_format = GBLENDER_SOURCE_BGRA; break; - - default: - goto LegacyBlit; - } - - width = glyph->width; - height = glyph->rows; - - if ( glyph->mode == gr_pixel_mode_lcd || - glyph->mode == gr_pixel_mode_lcd2 ) - width /= 3; - - if ( glyph->mode == gr_pixel_mode_lcdv || - glyph->mode == gr_pixel_mode_lcdv2 ) - height /= 3; - - switch ( target->mode ) - { - case gr_pixel_mode_rgb32: dst_format = GBLENDER_TARGET_RGB32; break; - case gr_pixel_mode_rgb24: dst_format = GBLENDER_TARGET_RGB24; break; - case gr_pixel_mode_rgb565: dst_format = GBLENDER_TARGET_RGB565; break; - default: - goto LegacyBlit; - } - - /* initialize blender when needed, i.e. when gamma changes - */ - if ( gblender_gamma != gr_glyph_gamma ) - { - gblender_gamma = gr_glyph_gamma; - gblender_init( gblender, gblender_gamma ); - } - - if ( gblender_blit_init( gblit, gblender, - x, y, - src_format, - glyph->buffer, - glyph->pitch, - width, - height, - dst_format, - target->buffer, - target->pitch, - target->width, - target->rows ) < 0 ) - { - /* nothing to do */ - return 0; - } - - gcolor = ((GBlenderPixel)color.chroma[0] << 16) | - ((GBlenderPixel)color.chroma[1] << 8 ) | - ((GBlenderPixel)color.chroma[2] ) ; - - gblender_blit_run( gblit, gcolor ); - return 1; - } - - LegacyBlit: /* no gamma correction, no caching */ - - /* set up blitter and compute clipping. Return immediately if needed */ - blit.source = *glyph; - blit.target = *target; - mode = target->mode; - - if ( compute_clips( &blit, x, y ) ) - return 0; - - switch ( glyph->mode ) - { - case gr_pixel_mode_mono: /* handle monochrome bitmap blitting */ - if ( mode <= gr_pixel_mode_none || mode >= gr_pixel_mode_max ) - { - grError = gr_err_bad_source_depth; - return -1; - } - - gr_mono_blitters[mode]( &blit, color ); - break; - - case gr_pixel_mode_gray: - if ( glyph->grays > 1 ) - { - int target_grays = target->grays; - int source_grays = glyph->grays; - const byte* saturation; - - - if ( mode == gr_pixel_mode_gray && target_grays > 1 ) - { - /* rendering into a gray target - use special composition */ - /* routines.. */ - if ( gr_last_saturation->count == target_grays ) - saturation = gr_last_saturation->table; - else - { - saturation = grGetSaturation( target_grays ); - if ( !saturation ) - return -3; - } - - if ( target_grays == source_grays ) - blit_gray_to_gray_simple( &blit, saturation ); - else - { - const byte* conversion; - - - if ( gr_last_conversion->target_grays == target_grays && - gr_last_conversion->source_grays == source_grays ) - conversion = gr_last_conversion->table; - else - { - conversion = grGetConversion( target_grays, source_grays ); - if ( !conversion ) - return -3; - } - - blit_gray_to_gray( &blit, saturation, conversion ); - } - } - else - { - /* rendering into a color target */ - if ( mode <= gr_pixel_mode_gray || - mode >= gr_pixel_mode_max ) - { - grError = gr_err_bad_target_depth; - return -1; - } - -#ifdef GRAY8 - if ( source_grays == 256 ) - gr_gray8_blitters[mode]( &blit, color ); - else -#endif /* GRAY8 */ - gr_color_blitters[mode]( &blit, color, source_grays - 1 ); - } - } - break; - - case gr_pixel_mode_lcd: - if ( mode == gr_pixel_mode_rgb24 ) - { -#ifdef GRAY8 - if ( glyph->grays == 256 ) - blit_lcd8_to_24( &blit, color ); - else -#endif - if ( glyph->grays > 1 ) - blit_lcd_to_24( &blit, color, glyph->grays-1 ); - } - break; - - - case gr_pixel_mode_lcdv: - if ( glyph->grays > 1 && mode == gr_pixel_mode_rgb24 ) - { - blit_lcdv_to_24( &blit, color, glyph->grays-1 ); - break; - } - - case gr_pixel_mode_lcd2: - if ( mode == gr_pixel_mode_rgb24 ) - { -#ifdef GRAY8 - if ( glyph->grays == 256 ) - blit_lcd28_to_24( &blit, color ); - else -#endif - if ( glyph->grays > 1 ) - blit_lcd2_to_24( &blit, color, glyph->grays-1 ); - } - break; - - case gr_pixel_mode_lcdv2: - if ( mode == gr_pixel_mode_rgb24 ) - { - if ( glyph->grays > 1 ) - blit_lcdv2_to_24( &blit, color, glyph->grays-1 ); - } - break; - - default: - /* we don't support the blitting of bitmaps of the following */ - /* types : pal4, pal8, rgb555, rgb565, rgb24, rgb32 */ - /* */ - grError = gr_err_bad_source_depth; - return -2; - } - - return 0; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grblit.h freetype-2.8/=unpacked-tar1=/graph/grblit.h --- freetype-2.7.1/=unpacked-tar1=/graph/grblit.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grblit.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-1999 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* blitter.h: Support for blitting of bitmaps with various depth. */ -/* */ -/****************************************************************************/ - -#ifndef GRBLIT_H_ -#define GRBLIT_H_ - -#include "grobjs.h" - - int grBlitMono( grBitmap* target, - grBitmap* source, - int x_offset, - int y_offset, - grColor color ); - - -#endif /* GRBLIT_H_ */ - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grconfig.h freetype-2.8/=unpacked-tar1=/graph/grconfig.h --- freetype-2.7.1/=unpacked-tar1=/graph/grconfig.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grconfig.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -#ifndef GRCONFIG_H_ -#define GRCONFIG_H_ - -#define GR_MAX_SATURATIONS 8 -#define GR_MAX_CONVERSIONS 16 - -#define GR_MAX_DEVICES 8 - -#endif /* GRCONFIG_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grdevice.c freetype-2.8/=unpacked-tar1=/graph/grdevice.c --- freetype-2.7.1/=unpacked-tar1=/graph/grdevice.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grdevice.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,362 +0,0 @@ -#include "grobjs.h" -#include "grdevice.h" -#include -#include - - grDeviceChain gr_device_chain[ GR_MAX_DEVICES ]; - int gr_num_devices = 0; - - static - grDevice* find_device( const char* device_name ) - { - int idx = 0; - - if (device_name) - { - for ( idx = gr_num_devices-1; idx > 0; idx-- ) - if ( strcmp( device_name, gr_device_chain[idx].name ) == 0 ) - break; - } - - if ( idx < 0 || gr_num_devices <= 0 || !gr_device_chain[idx].device ) - { - grError = gr_err_invalid_device; - return 0; - } - - return gr_device_chain[idx].device; - } - - - - /********************************************************************** - * - * - * grGetDeviceModes - * - * - * queries the available pixel modes for a device. - * - * - * device_name :: name of device to be used. 0 for the default - * device. For a list of available devices, see - * grInitDevices. - * - * - * num_modes :: number of available modes. 0 in case of error, - * which really is an invalid device name. - * - * pixel_modes :: array of available pixel modes for this device - * this table is internal to the device and should - * not be freed by client applications. - * - * - * error code. 0 means success. invalid device name otherwise - * - * - * All drivers are _required_ to support at least the following - * pixel formats : - * - * - gr_pixel_mode_mono : i.e. monochrome bitmaps - * - gr_pixel_mode_gray : with any number of gray levels between - * 2 and 256. - * - * the pixel modes do not provide the number of grays in the case - * of "gray" devices. You should try to create a surface with the - * maximal number (256, that is) and see the value returned in - * the bitmap descriptor. - * - **********************************************************************/ - - extern void grGetDeviceModes( const char* device_name, - int *num_modes, - grPixelMode* *pixel_modes ) - { - grDevice* device; - - *num_modes = 0; - *pixel_modes = 0; - - device = find_device( device_name ); - if (device) - { - *num_modes = device->num_pixel_modes; - *pixel_modes = device->pixel_modes; - } - } - - - /********************************************************************** - * - * - * grNewSurface - * - * - * creates a new device-specific surface. A surface is either - * a window or a screen, depending on the device. - * - * - * device :: name of the device to use. A value of NULL means - * the default device (which depends on the system). - * for a list of available devices, see grInitDevices. - * - * - * bitmap :: handle to a bitmap descriptor containing the - * requested pixel mode, number of grays and dimensions - * for the surface. the bitmap's 'pitch' and 'buffer' - * fields are ignored on input. - * - * On output, the bitmap describes the surface's image - * completely. It is possible to write directly in it - * with grBlitGlyphToBitmap, even though the use of - * grBlitGlyphToSurface is recommended. - * - * - * handle to the corresponding surface object. 0 in case of error - * - * - * All drivers are _required_ to support at least the following - * pixel formats : - * - * - gr_pixel_mode_mono : i.e. monochrome bitmaps - * - gr_pixel_mode_gray : with any number of gray levels between - * 2 and 256. - * - * This function might change the bitmap descriptor's fields. For - * example, when displaying a full-screen surface, the bitmap's - * dimensions will be set to those of the screen (e.g. 640x480 - * or 800x600); also, the bitmap's 'buffer' field might point to - * the Video Ram depending on the mode requested.. - * - * The surface contains a copy of the returned bitmap descriptor, - * you can thus discard the 'bitmap' parameter after the call. - * - **********************************************************************/ - - extern grSurface* grNewSurface( const char* device_name, - grBitmap* bitmap ) - { - grDevice* device; - grSurface* surface; - - /* Now find the device */ - device = find_device( device_name ); - if (!device) return 0; - - surface = (grSurface*)grAlloc( device->surface_objsize ); - if (!surface) return 0; - - if ( !device->init_surface( surface, bitmap ) ) - { - grFree( (void *)surface ); - surface = 0; - } - return surface; - } - - - - extern - void grDoneSurface( grSurface* surface ) - { - if (surface) - { - /* first of all, call the device-specific destructor */ - surface->done(surface); - - /* then remove the bitmap if we're owner */ - if (surface->owner) - grFree( surface->bitmap.buffer ); - - surface->owner = 0; - surface->bitmap.buffer = 0; - grFree( surface ); - } - } - - - /********************************************************************** - * - * - * grRefreshRectangle - * - * - * this function is used to indicate that a given surface rectangle - * was modified and thus needs re-painting. It really is useful for - * windowed or gray surfaces. - * - * - * surface :: handle to target surface - * x :: x coordinate of the top-left corner of the rectangle - * y :: y coordinate of the top-left corner of the rectangle - * width :: rectangle width in pixels - * height :: rectangle height in pixels - * - **********************************************************************/ - - extern void grRefreshRectangle( grSurface* surface, - grPos x, - grPos y, - grPos width, - grPos height ) - { - if (surface->refresh_rect) - surface->refresh_rect( surface, x, y, width, height ); - } - - - - /********************************************************************** - * - * - * grWriteSurfaceChar - * - * - * This function is equivalent to calling grWriteCellChar on the - * surface's bitmap, then invoking grRefreshRectangle. - * - * The graphics sub-system contains an internal CP437 8x8 font - * which can be used to display simple strings of text without - * using FreeType. - * - * This function writes a single 8x8 character on the target bitmap. - * - * - * target :: handle to target surface - * x :: x pixel position of character cell's top left corner - * y :: y pixel position of character cell's top left corner - * charcode :: Latin-1 character code - * color :: color to be used to draw the character - * - **********************************************************************/ - - extern - void grWriteSurfaceChar( grSurface* target, - int x, - int y, - int charcode, - grColor color ) - { - grWriteCellChar( &target->bitmap, x, y, charcode, color ); - if (target->refresh_rect) - target->refresh_rect( target, x, y, 8, 8 ); - } - - - /********************************************************************** - * - * - * grWriteSurfaceString - * - * - * This function is equivalent to calling grWriteCellString on the - * surface's bitmap, then invoking grRefreshRectangle. - * - * The graphics sub-system contains an internal CP437 8x8 font - * which can be used to display simple strings of text without - * using FreeType. - * - * This function writes a string with the internal font - * - * - * target :: handle to target bitmap - * x :: x pixel position of string's top left corner - * y :: y pixel position of string's top left corner - * string :: Latin-1 text string - * color :: color to be used to draw the character - * - **********************************************************************/ - - extern - void grWriteSurfaceString( grSurface* target, - int x, - int y, - const char* string, - grColor color ) - { - int len; - - len = (int)strlen(string); - grWriteCellString( &target->bitmap, x, y, string, color ); - if (target->refresh_rect) - target->refresh_rect( target, x, y, 8*len, 8 ); - } - - - /********************************************************************** - * - * - * grRefreshSurface - * - * - * a variation of grRefreshRectangle which repaints the whole surface - * to the screen. - * - * - * surface :: handle to target surface - * - **********************************************************************/ - - extern void grRefreshSurface( grSurface* surface ) - { - if (surface->refresh_rect) - surface->refresh_rect( surface, 0, 0, - surface->bitmap.width, - surface->bitmap.rows ); - } - - - - /********************************************************************** - * - * - * grSetTitle - * - * - * set the window title of a given windowed surface. - * - * - * surface :: handle to target surface - * title_string :: the new title - * - **********************************************************************/ - - extern void grSetTitle( grSurface* surface, - const char* title_string ) - { - if (surface->set_title) - surface->set_title( surface, title_string ); - } - - - - - /********************************************************************** - * - * - * grListenSurface - * - * - * listen the events for a given surface - * - * - * surface :: handle to target surface - * event_mask :: the event mask (mode) - * - * - * event :: the returned event - * - * - * XXX : For now, only keypresses are supported. - * - **********************************************************************/ - - extern - int grListenSurface( grSurface* surface, - int event_mask, - grEvent *event ) - { - return surface->listen_event( surface, event_mask, event ); - } - - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grdevice.h freetype-2.8/=unpacked-tar1=/graph/grdevice.h --- freetype-2.7.1/=unpacked-tar1=/graph/grdevice.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grdevice.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -/*************************************************************************** - * - * grdevice.h - * - * Graphics device interface - * - * Copyright 1999 - The FreeType Development Team - www.freetype.org - * - * - ***************************************************************************/ - -#ifndef GRDEVICE_H_ -#define GRDEVICE_H_ - -#include "graph.h" - - - /******************************************************************** - * - * - * grDeviceInitFunc - * - * - * Simple device initialiser function - * - * - * error code. 0 means success - * - ********************************************************************/ - - typedef int (*grDeviceInitFunc)( void ); - - - /******************************************************************** - * - * - * grDeviceDoneFunc - * - * - * Simple device finaliser function - * - * - * error code. 0 means success - * - ********************************************************************/ - - typedef void (*grDeviceDoneFunc)( void ); - - - /******************************************************************** - * - * - * grDeviceInitSurfaceFunc - * - * - * initializes a new surface for the device. This may be a window - * or a video screen, depending on the device. - * - * - * surface :: handle to target surface - * - * - * bitmap :: handle to bitmap descriptor - * - ********************************************************************/ - - typedef int (*grDeviceInitSurfaceFunc)( grSurface* surface, - grBitmap* bitmap ); - - - /******************************************************************** - * - * - * grDevice - * - * - * Simple device interface structure - * - * - * surface_objsize :: size in bytes of a single surface object for - * this device. - * - * device_name :: name of device, e.g. "x11", "os2pm", "directx" etc.. - * init :: device initialisation routine - * done :: device finalisation - * new_surface :: function used to create a new surface (screen or - * window) from the device - * - * num_pixel_modes :: the number of pixel modes supported by this - * device. This value _must_ be set to -1 - * default, unless the device provides a - * static set of pixel modes (fullscreen). - * - * pixel_modes :: an array of pixel modes supported by this - * device - * - * - * the fields "num_pixel_modes" and "pixel_modes" must be - * set by the "init" function. - * - * This allows windowed devices to "discover" at run-time the - * available pixel modes they can provide depending on the - * current screen depth. - * - ********************************************************************/ - - struct grDevice_ - { - unsigned int surface_objsize; - const char* device_name; /* name of device */ - - grDeviceInitFunc init; - grDeviceDoneFunc done; - - grDeviceInitSurfaceFunc init_surface; - - int num_pixel_modes; - grPixelMode* pixel_modes; - }; - - - extern grDevice* gr_devices[]; - extern grDeviceChain gr_device_chain[]; - extern int gr_num_devices; - extern int gr_max_devices; - - -extern void -gr_swizzle_rgb24( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int width, - int height ); - -#endif /* GRDEVICE_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grevents.h freetype-2.8/=unpacked-tar1=/graph/grevents.h --- freetype-2.7.1/=unpacked-tar1=/graph/grevents.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grevents.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,177 +0,0 @@ -#ifndef GREVENTS_H_ -#define GREVENTS_H_ - - -#define gr_event_none 0 -#define gr_event_wait 1 -#define gr_event_poll 2 -#define gr_event_flush 3 - -#define gr_mouse_down 0x04 -#define gr_mouse_move 0x08 -#define gr_mouse_up 0x10 -#define gr_mouse_drag 0x20 - -#define gr_key_down 0x40 -#define gr_key_up 0x80 - - -#define gr_event_mouse 0x3C -#define gr_event_key 0xC0 - -#define gr_event_type ( gr_event_mouse | gr_event_key ) - - - typedef enum grKey_ - { - grKeyNone = 0, - - grKeySpace = ' ', - grKey0 = '0', - grKey1 = '1', - grKey2 = '2', - grKey3 = '3', - grKey4 = '4', - grKey5 = '5', - grKey6 = '6', - grKey7 = '7', - grKey8 = '8', - grKey9 = '9', - - grKeyPlus = '+', - grKeyLess = '-', - grKeyEqual = '=', - grKeyMult = '*', - grKeyDollar = '$', - grKeySmaller = '<', - grKeyGreater = '>', - grKeyQuestion = '?', - grKeyComma = ',', - grKeyDot = '.', - grKeySemiColon = ';', - grKeyColon = ':', - grKeyDiv = '/', - grKeyExclam = '!', - grKeyPercent = '%', - grKeyLeftParen = '(', - grKeyRightParen = ')', - grKeyAt = '@', - - grKey_A = 'A', - grKey_B = 'B', - grKey_C = 'C', - grKey_D = 'D', - grKey_E = 'E', - grKey_F = 'F', - grKey_G = 'G', - grKey_H = 'H', - grKey_I = 'I', - grKey_J = 'J', - grKey_K = 'K', - grKey_L = 'L', - grKey_M = 'M', - grKey_N = 'N', - grKey_O = 'O', - grKey_P = 'P', - grKey_Q = 'Q', - grKey_R = 'R', - grKey_S = 'S', - grKey_T = 'T', - grKey_U = 'U', - grKey_V = 'V', - grKey_W = 'W', - grKey_X = 'X', - grKey_Y = 'Y', - grKey_Z = 'Z', - - grKeyLeftB = '[', - grKeyBackSlash = '\\', - grKeyRightB = ']', - grKeyCircumflex = '^', - grKeyUnder = '_', - grKeyBackTick = '`', - - grKey_a = 'a', - grKey_b = 'b', - grKey_c = 'c', - grKey_d = 'd', - grKey_e = 'e', - grKey_f = 'f', - grKey_g = 'g', - grKey_h = 'h', - grKey_i = 'i', - grKey_j = 'j', - grKey_k = 'k', - grKey_l = 'l', - grKey_m = 'm', - grKey_n = 'n', - grKey_o = 'o', - grKey_p = 'p', - grKey_q = 'q', - grKey_r = 'r', - grKey_s = 's', - grKey_t = 't', - grKey_u = 'u', - grKey_v = 'v', - grKey_w = 'w', - grKey_x = 'x', - grKey_y = 'y', - grKey_z = 'z', - - grKeyBackSpace = 0x100, - grKeyTab, - grKeyReturn, - grKeyEsc, - - grKeyIns, - grKeyDel, - grKeyHome, - grKeyEnd, - grKeyPageUp, - grKeyPageDown, - - grKeyF1, - grKeyF2, - grKeyF3, - grKeyF4, - grKeyF5, - grKeyF6, - grKeyF7, - grKeyF8, - grKeyF9, - grKeyF10, - grKeyF11, - grKeyF12, - - grKeyLeft, - grKeyRight, - grKeyUp, - grKeyDown, - - grKeyForceShort = 0x7FFF, /* this forces the grKey to be stored */ - /* on at least one short */ - grKeyMax - - } grKey; - - -#define grKEY( c ) ( (grKey)( c ) ) - /* masks - to be used as enums they would have to be included */ - /* in the grKey enum */ -#define grKeyAlt ( (grKey)0x8000 ) -#define grKeyCtrl ( (grKey)0x4000 ) -#define grKeyShift ( (grKey)0x2000 ) - -#define grKeyModifiers ( (grKey)0xE000 ) - - - typedef struct grEvent_ - { - int type; - grKey key; - int x, y; - - } grEvent; - - -#endif /* GREVENTS_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grfill.c freetype-2.8/=unpacked-tar1=/graph/grfill.c --- freetype-2.7.1/=unpacked-tar1=/graph/grfill.c 2015-10-09 07:14:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grfill.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -#include "graph.h" -#include -#include - -static void -gr_fill_hline_mono( unsigned char* line, - int x, - int width, - grColor color ) -{ - int c1 = (x >> 3); - int lmask = 0xFF >> (x & 7); - int c2 = ((x+width-1) >> 3); - int rmask = 0x7F8 >> ((x+width-1) & 7); - - if ( color.value != 0 ) - { - if ( c1 == c2 ) - line[c1] = (unsigned char)( line[c1] | (lmask & rmask)); - else - { - line[c1] = (unsigned char)(line[c1] | lmask); - for ( ++c1; c1 < c2; c1++ ) - line[c1] = 0xFF; - line[c2] = (unsigned char)(line[c2] | rmask); - } - } - else - { - if ( c1 == c2 ) - line[c1] = (unsigned char)( line[c1] & ~(lmask & rmask) ); - else - { - line[c1] = (unsigned char)(line[c1] & ~lmask); - for (++c1; c1 < c2; c1++) - line[c1] = 0; - line[c2] = (unsigned char)(line[c2] & ~rmask); - } - } -} - -static void -gr_fill_hline_4( unsigned char* line, - int x, - int width, - grColor color ) -{ - int col = color.value | (color.value << 4); - - line += (x >> 1); - if ( x & 1 ) - { - line[0] = (unsigned char)((line[0] & 0xF0) | (col & 0x0F)); - line++; - width--; - } - - for ( ; width >= 2; width -= 2 ) - { - line[0] = (unsigned char)col; - line++; - } - - if ( width > 0 ) - line[0] = (unsigned char)((line[0] & 0x0F) | (col & 0xF0)); -} - -static void -gr_fill_hline_8( unsigned char* line, - int x, - int width, - grColor color ) -{ - memset( line+x, color.value, (unsigned int)width ); -} - -static void -gr_fill_hline_16( unsigned char* _line, - int x, - int width, - grColor color ) -{ - unsigned short* line = (unsigned short*)_line + x; - - for ( ; width > 0; width-- ) - *line++ = (unsigned short)color.value; -} - -static void -gr_fill_hline_24( unsigned char* line, - int x, - int width, - grColor color ) -{ - int r = color.chroma[0]; - int g = color.chroma[1]; - int b = color.chroma[2]; - - line += 3*x; - - if (r == g && g == b) - memset( line, r, (unsigned int)(width*3) ); - else - { - for ( ; width > 0; width--, line += 3 ) - { - line[0] = (unsigned char)r; - line[1] = (unsigned char)g; - line[2] = (unsigned char)b; - } - } -} - -static void -gr_fill_hline_32( unsigned char* line, - int x, - int width, - grColor color ) -{ - line += 4*x; - - /* clearly slow */ - for (; width > 0; width--, line += 4) - { - line[0] = color.chroma[0]; - line[1] = color.chroma[1]; - line[2] = color.chroma[2]; - line[3] = color.chroma[3]; - } -} - - -typedef void (*grFillHLineFunc)( unsigned char* line, - int x, - int width, - grColor color ); - -static const grFillHLineFunc gr_fill_hline_funcs[gr_pixel_mode_max] = -{ - NULL, - gr_fill_hline_mono, - gr_fill_hline_4, - gr_fill_hline_8, - gr_fill_hline_8, - gr_fill_hline_16, - gr_fill_hline_16, - gr_fill_hline_24, - gr_fill_hline_32, - NULL, - NULL, - NULL, - NULL -}; - -extern void -grFillHLine( grBitmap* target, - int x, - int y, - int width, - grColor color ) -{ - int delta; - unsigned char* line; - grFillHLineFunc hline_func = gr_fill_hline_funcs[target->mode]; - - if ( x < 0 ) - { - width += x; - x = 0; - } - delta = x + width - target->width; - if ( delta > 0 ) - width -= x; - - if ( y < 0 || y >= target->rows || width < 0 || hline_func == NULL ) - return; - - line = target->buffer + y*target->pitch; - if ( target->pitch < 0 ) - line -= target->pitch*(target->rows-1); - - hline_func( line, x, width, color ); -} - -extern void -grFillVLine( grBitmap* target, - int x, - int y, - int height, - grColor color ) -{ - int delta; - unsigned char* line; - grFillHLineFunc hline_func; - - if ( x < 0 || x >= target->width ) - return; - - if ( y < 0 ) - { - height += y; - y = 0; - } - delta = y + height - target->rows; - if ( delta > 0 ) - height -= delta; - - if ( height <= 0 ) - return; - - hline_func = gr_fill_hline_funcs[ target->mode ]; - if ( hline_func ) - { - line = target->buffer + y*target->pitch; - if ( target->pitch < 0 ) - line -= target->pitch*(target->rows-1); - - for ( ; height > 0; height--, line += target->pitch ) - hline_func( line, x, 1, color ); - } -} - -extern void -grFillRect( grBitmap* target, - int x, - int y, - int width, - int height, - grColor color ) -{ - int delta; - unsigned char* line; - grFillHLineFunc hline_func; - - if ( x < 0 ) - { - width -= x; - x = 0; - } - delta = x + width - target->width; - if ( delta > 0 ) - width -= delta; - - if ( y < 0 ) - { - height += y; - y = 0; - } - delta = y + height - target->rows; - if ( delta > 0 ) - height -= delta; - - if ( width <= 0 || height <= 0 ) - return; - - hline_func = gr_fill_hline_funcs[ target->mode ]; - if ( hline_func ) - { - line = target->buffer + y*target->pitch; - if ( target->pitch < 0 ) - line -= target->pitch*(target->rows-1); - - for ( ; height > 0; height--, line += target->pitch ) - hline_func( line, x, width, color ); - } -} diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grfont.c freetype-2.8/=unpacked-tar1=/graph/grfont.c --- freetype-2.7.1/=unpacked-tar1=/graph/grfont.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grfont.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ -/* grfont.c */ - -#include "grfont.h" -#include - - - /* internal CP437 8x8 font characters */ - - const unsigned char font_8x8[2048] = - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E, - 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, - 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, - 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, - 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x92, 0x10, 0x7C, - 0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C, - 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, - 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, - 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, - 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, - 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, - 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, - 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0, - 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, - 0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99, - 0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00, - 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, - 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, - 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, - 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, - 0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0x86, 0xFC, - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, - 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, - 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, - 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, - 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, - 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, - 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, - 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, - 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00, - 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, - 0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00, - 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, - 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, - 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00, - 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00, - 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, - 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, - 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, - 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, - 0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00, - 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00, - 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00, - 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00, - 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, - 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00, - 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00, - 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, - 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00, - 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00, - 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, - 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00, - 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00, - 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, - 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, - 0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00, - 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00, - 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, - 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, - 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, - 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, - 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, - 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00, - 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00, - 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, - 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, - 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, - 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, - 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, - 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, - 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, - 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00, - 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00, - 0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00, - 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, - 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00, - 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, - 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00, - 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, - 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00, - 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, - 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, - 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, - 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, - 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, - 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, - 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00, - 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00, - 0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00, - 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, - 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00, - 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, - 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, - 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, - 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, - 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00, - 0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, - 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, - 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0, - 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, - 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00, - 0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00, - 0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00, - 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, - 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, - 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00, - 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, - 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, - 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00, - 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00, - 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, - 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00, - 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00, - 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x0C, 0x06, 0x7C, - 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, - 0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, - 0x7E, 0x81, 0x3C, 0x06, 0x3E, 0x66, 0x3B, 0x00, - 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, - 0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, - 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, - 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x78, 0x0C, 0x38, - 0x7E, 0x81, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, - 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, - 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, - 0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x7C, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, - 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0xC6, 0x10, 0x7C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, - 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00, - 0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00, - 0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00, - 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00, - 0x78, 0x84, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, - 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, - 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, - 0x78, 0x84, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, - 0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, - 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, - 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00, - 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00, - 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18, - 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00, - 0xCC, 0xCC, 0x78, 0x30, 0xFC, 0x30, 0xFC, 0x30, - 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC3, - 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70, - 0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, - 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, - 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, - 0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, - 0x00, 0xF8, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0x00, - 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00, - 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, - 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, - 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3C, 0x00, - 0x00, 0x00, 0x00, 0xFC, 0xC0, 0xC0, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00, - 0xC6, 0xCC, 0xD8, 0x36, 0x6B, 0xC2, 0x84, 0x0F, - 0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6D, 0xCF, 0x03, - 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00, - 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, - 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, - 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, - 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, - 0xDB, 0xF6, 0xDB, 0x6F, 0xDB, 0x7E, 0xD7, 0xED, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, - 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, - 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, - 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, - 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, - 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, - 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, - 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, - 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, - 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, - 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, - 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, - 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, - 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00, - 0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0, - 0x00, 0xFC, 0xCC, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, - 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, - 0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00, - 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00, - 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0, - 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00, - 0xFC, 0x30, 0x78, 0xCC, 0xCC, 0x78, 0x30, 0xFC, - 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00, - 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00, - 0x1C, 0x30, 0x18, 0x7C, 0xCC, 0xCC, 0x78, 0x00, - 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00, - 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0, - 0x38, 0x60, 0xC0, 0xF8, 0xC0, 0x60, 0x38, 0x00, - 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, - 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, - 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00, - 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00, - 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00, - 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70, - 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00, - 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C, - 0x58, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, - 0x70, 0x98, 0x30, 0x60, 0xF8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - - static grBitmap gr_charcell = { - 8, /* rows */ - 8, /* width */ - 1, /* pitch */ - gr_pixel_mode_mono, /* mode */ - 0, /* grays */ - 0 /* buffer */ - }; - - - void - grWriteCellChar( grBitmap* target, - int x, - int y, - int charcode, - grColor color ) - { - if ( charcode < 0 || - charcode > 255 ) - return; - - gr_charcell.buffer = (unsigned char*)font_8x8 + 8 * charcode; - grBlitGlyphToBitmap( target, &gr_charcell, x, y, color ); - } - - - void - grWriteCellString( grBitmap* target, - int x, - int y, - const char* string, - grColor color ) - { - while ( *string ) - { - gr_charcell.buffer = (unsigned char *)font_8x8 + - 8 * (int)(unsigned char) * string++; - grBlitGlyphToBitmap( target, &gr_charcell, x, y, color ); - x += 8; - } - } - - - static int gr_cursor_x = 0; - static int gr_cursor_y = 0; - static int gr_line_height = 8; - static grBitmap* gr_text_bitmap = 0; - static int gr_margin_right = 0; - static int gr_margin_top = 0; - - - void - grGotobitmap( grBitmap* bitmap ) - { - gr_text_bitmap = bitmap; - } - - - void - grSetMargin( int right, - int top ) - { - gr_margin_top = top << 3; - gr_margin_right = right << 3; - } - - - void - grSetPixelMargin( int right, - int top ) - { - gr_margin_top = top; - gr_margin_right = right; - } - - - void - grSetLineHeight( int height ) - { - gr_line_height = height; - } - - - void - grGotoxy( int x, - int y ) - { - gr_cursor_x = x; - gr_cursor_y = y; - } - - - void - grWrite( const char* string ) - { - if ( string ) - { - grColor color; - - - color.value = 127; - grWriteCellString( gr_text_bitmap, - gr_margin_right + ( gr_cursor_x << 3 ), - gr_margin_top + gr_cursor_y * gr_line_height, - string, - color ); - - gr_cursor_x += strlen( string ); - } - } - - - void - grLn( void ) - { - gr_cursor_y++; - gr_cursor_x = 0; - } - - - void - grWriteln( const char* string ) - { - grWrite( string ); - grLn(); - } - - -/* eof */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grfont.h freetype-2.8/=unpacked-tar1=/graph/grfont.h --- freetype-2.7.1/=unpacked-tar1=/graph/grfont.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grfont.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* grfont.h */ - -#ifndef GRFONT_H_ -#define GRFONT_H_ - -#include "graph.h" - - extern const unsigned char font_8x8[]; - - - void - grGotobitmap( grBitmap* bitmap ); - - void - grSetMargin( int right, - int top ); - - void - grSetPixelMargin( int right, - int top ); - - void - grSetLineHeight( int height ); - - void - grGotoxy ( int x, - int y ); - - - void - grWrite( const char* string ); - - void - grWriteln( const char* string ); - - void - grLn( void ); - -#endif /* GRFONT_H_ */ - - -/* eof */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grinit.c freetype-2.8/=unpacked-tar1=/graph/grinit.c --- freetype-2.7.1/=unpacked-tar1=/graph/grinit.c 2015-09-25 05:40:31.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grinit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -#include "grobjs.h" -#include "grdevice.h" -#include - -#define GR_INIT_DEVICE_CHAIN ((grDeviceChain*)0) -#define GR_INIT_BUILD - -#ifdef DEVICE_X11 -#ifndef VMS -#include "x11/grx11.h" -#else -#include "grx11.h" -#endif -#endif - -#ifdef DEVICE_OS2_PM -#include "os2/gros2pm.h" -#endif - -#ifdef DEVICE_WIN32 -#include "win32/grwin32.h" -#endif - -#ifdef macintosh -#include "mac/grmac.h" -#endif - -#ifdef DEVICE_ALLEGRO -#include "allegro/gralleg.h" -#endif - -#ifdef DEVICE_BEOS -#include "beos/grbeos.h" -#endif - - - /********************************************************************** - * - * - * grInitDevices - * - * - * This function is in charge of initialising all system-specific - * devices. A device is responsible for creating and managing one - * or more "surfaces". A surface is either a window or a screen, - * depending on the system. - * - * - * a pointer to the first element of a device chain. The chain can - * be parsed to find the available devices on the current system - * - * - * If a device cannot be initialised correctly, it is not part of - * the device chain returned by this function. For example, if an - * X11 device was compiled in the library, it will be part of - * the returned device chain only if a connection to the display - * could be established - * - * If no driver could be initialised, this function returns NULL. - * - **********************************************************************/ - - extern - grDeviceChain* grInitDevices( void ) - { - grDeviceChain* chain = GR_INIT_DEVICE_CHAIN; - grDeviceChain* cur = gr_device_chain; - - - while (chain) - { - /* initialize the device */ - grDevice* device; - - device = chain->device; - if ( device->init() == 0 && - gr_num_devices < GR_MAX_DEVICES ) - - { - /* successful device initialisation - add it to our chain */ - cur->next = 0; - cur->device = device; - cur->name = device->device_name; - - if (cur > gr_device_chain) - cur[-1].next = cur; - - cur++; - gr_num_devices++; - } - chain = chain->next; - } - - return (gr_num_devices > 0 ? gr_device_chain : 0 ); - } - - - extern - void grDoneDevices( void ) - { - int i; - grDeviceChain* chain = gr_device_chain; - - - for ( i = 0; i < gr_num_devices; i++ ) - { - chain->device->done(); - - chain->next = 0; - chain->device = 0; - chain->name = 0; - - chain++; - } - - gr_num_devices = 0; - } diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grobjs.c freetype-2.8/=unpacked-tar1=/graph/grobjs.c --- freetype-2.7.1/=unpacked-tar1=/graph/grobjs.c 2015-10-09 07:14:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grobjs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,230 +0,0 @@ -#include "grobjs.h" -#include -#include - - int grError = 0; - - - /* values must be in 0..255 range */ - grColor - grFindColor( grBitmap* target, - int red, - int green, - int blue, - int alpha ) - { - grColor color; - - color.value = 0; - - switch (target->mode) - { - case gr_pixel_mode_mono: - if ( (red|green|blue) ) - color.value = 1; - break; - - case gr_pixel_mode_gray: - color.value = (3*red + 6*green + blue)/10; - break; - - case gr_pixel_mode_rgb565: - color.value = ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | ((blue & 0xF8) >> 3); - break; - - case gr_pixel_mode_rgb24: - color.chroma[0] = (unsigned char)red; - color.chroma[1] = (unsigned char)green; - color.chroma[2] = (unsigned char)blue; - break; - - case gr_pixel_mode_rgb32: - color.chroma[0] = (unsigned char)red; - color.chroma[1] = (unsigned char)green; - color.chroma[2] = (unsigned char)blue; - color.chroma[3] = (unsigned char)alpha; - break; - - default: - ; - } - return color; - } - - - /******************************************************************** - * - * - * grAlloc - * - * - * Simple memory allocation. The returned block is always zero-ed - * - * - * size :: size in bytes of the requested block - * - * - * the memory block address. 0 in case of error - * - ********************************************************************/ - - unsigned char* - grAlloc( unsigned long size ) - { - unsigned char* p; - - p = (unsigned char*)malloc(size); - if (!p && size > 0) - { - grError = gr_err_memory; - } - - if (p) - memset( p, 0, size ); - - return p; - } - - - /******************************************************************** - * - * - * grFree - * - * - * Simple memory release - * - * - * block :: target block - * - ********************************************************************/ - - void grFree( const void* block ) - { - if (block) - free( (void *)block ); - } - - - - static - int check_mode( grPixelMode pixel_mode, - int num_grays ) - { - if ( pixel_mode <= gr_pixel_mode_none || - pixel_mode >= gr_pixel_mode_max ) - goto Fail; - - if ( pixel_mode != gr_pixel_mode_gray || - ( num_grays >= 2 && num_grays <= 256 ) ) - return 0; - - Fail: - grError = gr_err_bad_argument; - return grError; - } - - - /********************************************************************** - * - * - * grNewBitmap - * - * - * creates a new bitmap - * - * - * pixel_mode :: the target surface's pixel_mode - * num_grays :: number of grays levels for PAL8 pixel mode - * width :: width in pixels - * height :: height in pixels - * - * - * bit :: descriptor of the new bitmap - * - * - * Error code. 0 means success. - * - **********************************************************************/ - - extern int grNewBitmap( grPixelMode pixel_mode, - int num_grays, - int width, - int height, - grBitmap *bit ) - { - int pitch; - - /* check mode */ - if (check_mode(pixel_mode,num_grays)) - goto Fail; - - /* check dimensions */ - if (width < 0 || height < 0) - { - grError = gr_err_bad_argument; - goto Fail; - } - - bit->width = width; - bit->rows = height; - bit->mode = pixel_mode; - bit->grays = num_grays; - - pitch = width; - - switch (pixel_mode) - { - case gr_pixel_mode_mono : pitch = (width+7) >> 3; break; - case gr_pixel_mode_pal4 : pitch = (width+3) >> 2; break; - - case gr_pixel_mode_pal8 : - case gr_pixel_mode_gray : pitch = width; break; - - case gr_pixel_mode_rgb555: - case gr_pixel_mode_rgb565: pitch = width*2; break; - - case gr_pixel_mode_rgb24 : pitch = width*3; break; - - case gr_pixel_mode_rgb32 : pitch = width*4; break; - - default: - grError = gr_err_bad_target_depth; - return 0; - } - - bit->pitch = pitch; - bit->buffer = grAlloc( (unsigned long)( bit->pitch * bit->rows ) ); - if (!bit->buffer) goto Fail; - - return 0; - - Fail: - return grError; - } - - /********************************************************************** - * - * - * grDoneBitmap - * - * - * destroys a bitmap - * - * - * bitmap :: handle to bitmap descriptor - * - * - * This function does NOT release the bitmap descriptor, only - * the pixel buffer. - * - **********************************************************************/ - - extern void grDoneBitmap( grBitmap* bit ) - { - grFree( bit->buffer ); - bit->buffer = 0; - } - - - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grobjs.h freetype-2.8/=unpacked-tar1=/graph/grobjs.h --- freetype-2.7.1/=unpacked-tar1=/graph/grobjs.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grobjs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -/*************************************************************************** - * - * grobjs.h - * - * basic object classes definitions - * - * Copyright 1999 - The FreeType Development Team - www.freetype.org - * - * - * - * - ***************************************************************************/ - -#ifndef GROBJS_H_ -#define GROBJS_H_ - -#include "graph.h" -#include "grconfig.h" -#include "grtypes.h" - - - typedef struct grBiColor_ - { - grColor foreground; - grColor background; - - int num_levels; - int max_levels; - grColor* levels; - - } grBiColor; - - - - /********************************************************************** - * - * Technical note : explaining how the blitter works. - * - * The blitter is used to "draw" a given source bitmap into - * a given target bitmap. - * - * The function called 'compute_clips' is used to compute clipping - * constraints. These lead us to compute two areas : - * - * - the read area : is the rectangle, within the source bitmap, - * which will be effectively "drawn" in the - * target bitmap. - * - * - the write area : is the rectangle, within the target bitmap, - * which will effectively "receive" the pixels - * from the read area - * - * Note that both areas have the same dimensions, but are - * located in distinct surfaces. - * - * These areas are computed by 'compute_clips' which is called - * by each blitting function. - * - * Note that we use the Y-downwards convention within the blitter - * - **********************************************************************/ - - typedef struct grBlitter_ - { - int width; /* width in pixels of the areas */ - int height; /* height in pixels of the areas */ - - int xread; /* x position of start point in read area */ - int yread; /* y position of start point in read area */ - - int xwrite; /* x position of start point in write area */ - int ywrite; /* y position of start point in write area */ - - int right_clip; /* amount of right clip */ - - unsigned char* read; /* top left corner of read area in source map */ - unsigned char* write; /* top left corner of write area in target map */ - - int read_line; /* byte increment to go down one row in read area */ - int write_line; /* byte increment to go down one row in write area */ - - grBitmap source; /* source bitmap descriptor */ - grBitmap target; /* target bitmap descriptor */ - - } grBlitter; - - - - typedef void (*grBlitterFunc)( grBlitter* blitter, - grColor color ); - - typedef void (*grSetTitleFunc)( grSurface* surface, - const char* title_string ); - - typedef void (*grRefreshRectFunc)( grSurface* surface, - int x, - int y, - int width, - int height ); - - typedef void (*grDoneSurfaceFunc)( grSurface* surface ); - - typedef int (*grListenEventFunc)( grSurface* surface, - int event_mode, - grEvent *event ); - - - - struct grSurface_ - { - grDevice* device; - grBitmap bitmap; - grBool refresh; - grBool owner; - - const byte* saturation; /* used for gray surfaces only */ - grBlitterFunc blit_mono; /* 0 by default, set by grBlit.. */ - - grRefreshRectFunc refresh_rect; - grSetTitleFunc set_title; - grListenEventFunc listen_event; - grDoneSurfaceFunc done; - }; - - - - /******************************************************************** - * - * - * grAlloc - * - * - * Simple memory allocation. The returned block is always zero-ed - * - * - * size :: size in bytes of the requested block - * - * - * the memory block address. 0 in case of error - * - ********************************************************************/ - - extern unsigned char* - grAlloc( unsigned long size ); - - - /******************************************************************** - * - * - * grFree - * - * - * Simple memory release - * - * - * block :: target block - * - ********************************************************************/ - - extern void grFree( const void* block ); - - -#endif /* GROBJS_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grswizzle.c freetype-2.8/=unpacked-tar1=/graph/grswizzle.c --- freetype-2.7.1/=unpacked-tar1=/graph/grswizzle.c 2015-10-09 07:14:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grswizzle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,673 +0,0 @@ -#include - -/* Author: David Turner - * - * this filtering code is explicitly placed in the public domain !! - */ -#include -#include - -#include "grswizzle.h" - -/* technical note: - * - * the following code is used to simulate the color display of an - * OLPC screen on a traditional LCD or CRT screen. First, here's more or - * less how the laptop's hardware works: - * - * when in color mode, the screen uses the following colored pixels - * arrangement, where each pixel is square and can have its luminosity - * set between 0 and 255: - * - * R G B R G B .... - * G B R G B R - * B R G B R G - * R G B R G B - * G B R G B R - * B R G B R G - * : - * : - * - * in its normal mode of operation, the laptop's graphics chip gets its - * data from a normal frame buffer (where each pixel has three - * components: R, G and B) but only selects the red signal for the first - * pixel, the green signal for the second pixel, etc... - * - * in other words, it ignores 2/3rd of the frame buffer data ! - * - * there is also another interesting mode of operation, so-called - * "anti-aliasing mode" where the value of displayed pixel is obtained - * by performing a simple 3x3 linear filter on the frame-buffer data. - * the filter's matrix being: - * - * 0 1/8 0 - * - * 1/8 1/2 1/8 - * - * 0 1/8 0 - * - * note that this filtering is per-color, so the *displayed* intensity of - * a given red pixel corresponds to an average of the pixel's red value and - * its four neighboring pixels' red values. - * - * note that the code below uses a 3-lines work buffer, where each line - * in the buffer holds a copy of the source frame buffer. - * - * more exactly, each line has 'width+2' pixels, where the first and last - * pixels are always set to 0. this allows us to ignore edge cases in the - * filtering code. - * - * similarly, we artificially extend the source buffer with zero-ed lines - * above and below. - */ - - -/* define ANTIALIAS to perform anti-alias filtering before swizzling */ -#define ANTIALIAS - -/* define POSTPROCESS to enhance the output for traditional displays, - * otherwise, you'll get those ugly diagonals everywhere - */ -#define POSTPROCESS - -/************************************************************************/ -/************************************************************************/ -/***** *****/ -/***** G E N E R I C F I L T E R I N G *****/ -/***** *****/ -/************************************************************************/ -/************************************************************************/ - -/* the type of a line filtering function, see below for usage */ -typedef void -(*filter_func_t)( unsigned char** lines, - unsigned char* write, - int width, - int offset ); - -static void -copy_line_generic( unsigned char* from, - unsigned char* to, - int x, - int width, - int buff_width, - int pix_bytes ) -{ - if (x > 0) - { - width += 1; - from -= pix_bytes; - } - else - to += pix_bytes; - - if (x+width < buff_width) - width += 1; - - memcpy( to, from, (unsigned int)( width * pix_bytes ) ); -} - - - -/* a generic function to perform 3x3 filtering of a given rectangle, - * from a source bitmap into a destination one, the source *can* be - * equal to the destination. - * - * IMPORTANT: this will read the rectangle (x-1,y-1,width+2,height+2) - * from the source (clipping and edge cases are handled). - * - * read_buff :: first byte of source buffer - * read_pitch :: source buffer bytes per row - * write_buff :: first byte of target buffer - * write_pitch :: target buffer bytes per row - * buff_width :: width in pixels of both buffers - * buff_height :: height in pixels of both buffers - * x :: rectangle's left-most horizontal coordinate - * y :: rectangle's top-most vertical coordinate - * width :: rectangle width in pixels - * height :: rectangle height in pixels - * pix_bytes :: number of bytes per pixels in both buffer - * filter_func :: line filtering function - * temp_lines :: a work buffer of at least '3*(width+2)*pix_bytes' bytes - */ -static void -filter_rect_generic( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height, - int pix_bytes, - filter_func_t filter_func, - unsigned char* temp_lines ) -{ - unsigned char* lines[3]; - int offset = (x+y) % 3; - int delta, height2; - - /* clip rectangle, just to be sure */ - if (x < 0) - { - width += x; - x = 0; - } - delta = x+width - buff_width; - if (delta > 0) - width -= delta; - - if (y < 0) - { - height += y; - y = 0; - } - delta = y+height - buff_height; - if (delta > 0) - height -= delta; - - if (width <= 0 || height <= 0) /* nothing to do */ - return; - - /* now setup the three work lines */ - read_buff += y*read_pitch + pix_bytes*x; - write_buff += y*write_pitch + pix_bytes*x; - - memset( temp_lines, 0, (unsigned int)(3 * pix_bytes * ( width + 2 ) ) ); - - lines[0] = (unsigned char*) temp_lines; - lines[1] = lines[0] + pix_bytes*(width+2); - lines[2] = lines[1] + pix_bytes*(width+2); - - /* lines[0] correspond to the pixels of the line above - */ - if (y > 0) - copy_line_generic( read_buff - read_pitch, lines[0], - x, width, buff_width, pix_bytes ); - - /* lines[1] correspond to the pixels of the current line - */ - copy_line_generic( read_buff, lines[1], - x, width, buff_width, pix_bytes ); - - /* process all lines, except the last one */ - for ( height2 = height; height2 > 1; height2-- ) - { - unsigned char* tmp; - - /* lines[2] correspond to the pixels of the line below */ - copy_line_generic( read_buff + read_pitch, lines[2], - x, width, buff_width, pix_bytes ); - - filter_func( lines, write_buff, width, offset ); - - if (++offset == 3) - offset = 0; - - /* scroll the work lines */ - tmp = lines[0]; - lines[0] = lines[1]; - lines[1] = lines[2]; - lines[2] = tmp; - - read_buff += read_pitch; - write_buff += write_pitch; - } - - /* process last line */ - if (y+height == buff_height) - memset( lines[2], 0, (unsigned int)( ( width + 2 ) * pix_bytes ) ); - else - copy_line_generic( read_buff + read_pitch, lines[2], - x, width, buff_width, pix_bytes ); - - filter_func ( lines, write_buff, width, offset ); -} - - -/************************************************************************/ -/************************************************************************/ -/***** *****/ -/***** R G B 2 4 S U P P O R T *****/ -/***** *****/ -/************************************************************************/ -/************************************************************************/ - - -/* this function performs AA+swizzling of a given line from/to RGB24 buffers - */ -static void -swizzle_line_rgb24( unsigned char** lines, - unsigned char* write, - int width, - int offset ) -{ - unsigned char* above = lines[0] + 3; - unsigned char* current = lines[1] + 3; - unsigned char* below = lines[2] + 3; - int nn; - - width *= 3; - for ( nn = 0; nn < width; nn += 3 ) - { - unsigned int sum; - int off = nn + offset; - -#ifdef ANTIALIAS - sum = (unsigned int)current[off] << 2; - - sum += current[off-3] + - current[off+3] + - above [off] + - below [off] ; - - /* performance trick: use shifts to avoid jumps */ - sum = (sum >> 3) << (offset*8); -#else /* !ANTIALIAS */ - sum = current[off] << (offset*8); -#endif - - write[nn] = (unsigned char) sum; - write[nn+1] = (unsigned char)(sum >> 8); - write[nn+2] = (unsigned char)(sum >> 16); - - if ( ++offset == 3 ) - offset = 0; - } -} - - -/* the following function is used to post-process the result of the - * swizzling algorithm to provide a more pleasant output on normal - * (LCD and CRT) display screens. - * - * that's because the normal processing creates images that are not - * relevant to the display's true nature. For example, consider a 3x3 - * white square on the original frame buffer, after simple swizzling, this - * will generate the following picture (represented by RGB triplets): - * - * (255,0,0)(0,255,0)(0,0,255) - * (0,255,0)(0,0,255)(255,0,0) - * (0,0,255)(255,0,0)(0,255,0) - * - * the laptop's DCON chip ignores all the 0s above, and will essentially - * display a *bright* white square - * - * a traditional display will not, and this will result in an image that - * will be much darker (due to all the zeroes). - * - * moreover, on an typical LCD screen, this creates very visible - * black diagonals. On a CRT, some thinner diagonals are also visible, but - * this is mostly due to the fact that the human eye is much more sensitive - * to green than red and blue - */ - - -/* in this algorithm we steal the green and blue components from each pixel's - * neighbours. For example, for a red pixel, we compute the average of the - * green pixels on its right and below it, and the average of the blue pixels - * on its left and above it. - */ -static void -postprocess_line_rgb24( unsigned char** lines, - unsigned char* write, - int width, - int offset ) -{ - unsigned char* above = lines[0] + 3; - unsigned char* current = lines[1] + 3; - unsigned char* below = lines[2] + 3; - int nn; - - width *= 3; - for ( nn = 0; nn < width; nn += 3 ) - { - if (offset == 0) /* red */ - { - write[nn] = current[nn]; - write[nn+1] = (unsigned char)((current[nn+4] + below[nn+1]) >> 1); - write[nn+2] = (unsigned char)((current[nn-1] + above[nn+2]) >> 1); - offset = 1; - } - else if (offset == 1) /* green */ - { - write[nn] = (unsigned char)((current[nn-3] + above[nn]) >> 1); - write[nn+1] = current[nn+1]; - write[nn+2] = (unsigned char)((current[nn+5] + below[nn+2]) >> 1); - offset = 2; - } - else /* blue */ - { - write[nn] = (unsigned char)((current[nn+3] + below[nn]) >> 1); - write[nn+1] = (unsigned char)((current[nn-2] + above[nn+1]) >> 1); - write[nn+2] = current[nn+2]; - offset = 0; - } - } -} - - -/************************************************************************/ -/************************************************************************/ -/***** *****/ -/***** R G B 5 6 5 S U P P O R T *****/ -/***** *****/ -/************************************************************************/ -/************************************************************************/ - - - - -/* this function performs AA+swizzling of a given line from/to RGB565 buffers - */ -static void -swizzle_line_rgb565( unsigned char** lines, - unsigned char* _write, - int width, - int offset ) -{ - unsigned short* above = (unsigned short*) lines[0] + 1; - unsigned short* current = (unsigned short*) lines[1] + 1; - unsigned short* below = (unsigned short*) lines[2] + 1; - unsigned short* write = (unsigned short*) _write; - int nn; - - static const unsigned int masks[3] = { 0xf800, 0x07e0, 0x001f }; - - for (nn = 0; nn < width; nn++) - { - unsigned int mask = masks[offset]; -#ifdef ANTIALIAS - unsigned int sum; - - sum = ((unsigned int)current[nn] & mask) << 2; - - sum += ((unsigned int)current[nn-1] & mask) + - ((unsigned int)current[nn+1] & mask) + - ((unsigned int)above[nn] & mask) + - ((unsigned int)below[nn] & mask); - - write[nn] = (unsigned short)( (sum >> 3) & mask ); -#else - write[nn] = (unsigned short)( current[nn] & mask ); -#endif - - if (++offset == 3) - offset = 0; - } -} - - -static void -postprocess_line_rgb565( unsigned char** lines, - unsigned char* _write, - int width, - int offset ) -{ - unsigned short* above = (unsigned short*) lines[0] + 1; - unsigned short* current = (unsigned short*) lines[1] + 1; - unsigned short* below = (unsigned short*) lines[2] + 1; - unsigned short* write = (unsigned short*) _write; - int nn; - - static const unsigned int masks[5] = { 0xf800, 0x07e0, 0x001f, 0xf800, 0x07e0 }; - - unsigned int l_mask, r_mask, c_mask; - - l_mask = masks[offset]; - c_mask = masks[offset+1]; - r_mask = masks[offset+2]; - - for ( nn = 0; nn < width; nn += 1 ) - { - unsigned int left, right, center, tmp; - - center = current[nn]; - left = ((current[nn-1] & l_mask) + (above[nn] & l_mask)) >> 1; - right = ((current[nn+1] & r_mask) + (below[nn] & r_mask)) >> 1; - - write[nn] = (unsigned short)( (left & l_mask) | - (right & r_mask) | - (center & c_mask) ); - - tmp = l_mask; - l_mask = c_mask; - c_mask = r_mask; - r_mask = tmp; - } -} - - - -/************************************************************************/ -/************************************************************************/ -/***** *****/ -/***** X R G B 3 2 S U P P O R T *****/ -/***** *****/ -/************************************************************************/ -/************************************************************************/ - - -/* this function performs AA+swizzling of a given line from/to 32-bit ARGB or RGB - * buffers - */ -static void -swizzle_line_xrgb32( unsigned char** lines, - unsigned char* _write, - int width, - int offset ) -{ - unsigned int* above = (unsigned int*) lines[0] + 1; - unsigned int* current = (unsigned int*) lines[1] + 1; - unsigned int* below = (unsigned int*) lines[2] + 1; - unsigned int* write = (unsigned int*) _write; - int nn; - unsigned int mask = (0xff0000) >> (offset*8); - - for (nn = 0; nn < width; nn++) - { -#ifdef ANTIALIAS - unsigned int sum; - - sum = (current[nn] & mask) << 2; - - sum += (current[nn-1] & mask) + - (current[nn+1] & mask) + - (above[nn] & mask) + - (below[nn] & mask); - - write[nn] = (sum >> 3) & mask; /* should we set ALPHA to 0xFF ? */ -#else - write[nn] = current[nn] & mask; -#endif - - mask >>= 8; - if (mask == 0) - mask = 0x00ff0000; - } -} - - -static void -postprocess_line_xrgb32( unsigned char** lines, - unsigned char* _write, - int width, - int offset ) -{ - unsigned int* above = (unsigned int*) lines[0] + 1; - unsigned int* current = (unsigned int*) lines[1] + 1; - unsigned int* below = (unsigned int*) lines[2] + 1; - unsigned int* write = (unsigned int*) _write; - int nn; - - static const unsigned int masks[5] = - { 0xff0000, 0x00ff00, 0x0000ff, 0xff0000, 0x00ff00 }; - - unsigned int l_mask, r_mask, c_mask; - - l_mask = masks[offset]; - c_mask = masks[offset+1]; - r_mask = masks[offset+2]; - - for ( nn = 0; nn < width; nn += 1 ) - { - unsigned int left, right, center, tmp; - - center = current[nn]; - left = ((current[nn-1] & l_mask) + (above[nn] & l_mask)) >> 1; - right = ((current[nn+1] & r_mask) + (below[nn] & r_mask)) >> 1; - - write[nn] = (unsigned int)( (left & l_mask) | - (right & r_mask) | - (center & c_mask) ); - - tmp = l_mask; - l_mask = c_mask; - c_mask = r_mask; - r_mask = tmp; - } -} - - - -static void -gr_swizzle_generic( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height, - int pixbytes, - filter_func_t swizzle_func, - filter_func_t postprocess_func ) -{ - unsigned char* temp_lines; - unsigned char temp_local[ 2048 ]; - unsigned int temp_size; - - if ( height <= 0 || width <= 0 ) - return; - - if ( read_pitch < 0 ) - read_buff -= (buff_height-1)*read_pitch; - - if ( write_pitch < 0 ) - write_buff -= (buff_height-1)*write_pitch; - - /* we allocate a work buffer that will be used to hold three - * working 'lines', each of them having width+2 pixels. the first - * and last pixels being always 0 - */ - temp_size = (unsigned int)( ( width + 2 ) * 3 * pixbytes ); - if ( temp_size <= sizeof ( temp_local ) ) - { - /* try to use stack allocation, which is a lot faster than malloc */ - temp_lines = temp_local; - } - else - { - temp_lines = (unsigned char*)malloc( temp_size ); - if ( temp_lines == NULL ) - return; - } - - filter_rect_generic( read_buff, read_pitch, write_buff, write_pitch, - buff_width, buff_height, x, y, width, height, - pixbytes, swizzle_func, temp_lines ); - - -#ifdef POSTPROCESS - /* perform darkness correction */ - if ( postprocess_func ) - filter_rect_generic( write_buff, write_pitch, write_buff, write_pitch, - buff_width, buff_height, x, y, width, height, - pixbytes, postprocess_func, - temp_lines ); -#endif - - /* free work buffer if needed */ - if (temp_lines != temp_local) - free( temp_lines ); -} - - - -extern void -gr_swizzle_rect_rgb24( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height ) -{ - gr_swizzle_generic( read_buff, read_pitch, - write_buff, write_pitch, - buff_width, - buff_height, - x, y, width, height, - 3, - swizzle_line_rgb24, - postprocess_line_rgb24 ); -} - - - -extern void -gr_swizzle_rect_rgb565( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height ) -{ - gr_swizzle_generic( read_buff, read_pitch, - write_buff, write_pitch, - buff_width, - buff_height, - x, y, width, height, - 2, - swizzle_line_rgb565, - postprocess_line_rgb565 ); -} - - - -extern void -gr_swizzle_rect_xrgb32( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height ) -{ - gr_swizzle_generic( read_buff, read_pitch, - write_buff, write_pitch, - buff_width, - buff_height, - x, y, width, height, - 4, - swizzle_line_xrgb32, - postprocess_line_xrgb32 ); -} - - - - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grswizzle.h freetype-2.8/=unpacked-tar1=/graph/grswizzle.h --- freetype-2.7.1/=unpacked-tar1=/graph/grswizzle.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grswizzle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -#ifndef GRSWIZZLE_H_ -#define GRSWIZZLE_H_ - -void -gr_swizzle_rect_rgb24( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height ); - -void -gr_swizzle_rect_rgb565( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height ); - -void -gr_swizzle_rect_xrgb32( unsigned char* read_buff, - int read_pitch, - unsigned char* write_buff, - int write_pitch, - int buff_width, - int buff_height, - int x, - int y, - int width, - int height ); - -#endif /* GRSWIZZLE_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/grtypes.h freetype-2.8/=unpacked-tar1=/graph/grtypes.h --- freetype-2.7.1/=unpacked-tar1=/graph/grtypes.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/grtypes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/*************************************************************************** - * - * grtypes.h - * - * basic type definitions - * - * Copyright 1999 - The FreeType Development Team - www.freetype.org - * - * - * - * - ***************************************************************************/ - -#ifndef GRTYPES_H_ -#define GRTYPES_H_ - - typedef unsigned char byte; - -#if 0 - typedef signed char uchar; - - typedef unsigned long ulong; - typedef unsigned short ushort; - typedef unsigned int uint; -#endif - - typedef struct grDimension_ - { - int x; - int y; - - } grDimension; - -#define gr_err_ok 0 -#define gr_err_memory -1 -#define gr_err_bad_argument -2 -#define gr_err_bad_target_depth -3 -#define gr_err_bad_source_depth -4 -#define gr_err_saturation_overflow -5 -#define gr_err_conversion_overflow -6 -#define gr_err_invalid_device -7 - - -#ifdef GR_MAKE_OPTION_SINGLE_OBJECT -#define GR_LOCAL_DECL static -#define GR_LOCAL_FUNC static -#else -#define GR_LOCAL_DECL extern -#define GR_LOCAL_FUNC /* void */ -#endif - -#endif /* GRTYPES_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/Jamfile freetype-2.8/=unpacked-tar1=/graph/Jamfile --- freetype-2.7.1/=unpacked-tar1=/graph/Jamfile 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -# FreeType2 demo graph Jamfile (c) 2001 David Turner -# - -SubDir FT2DEMO_TOP graph ; - -GRAPH_INCLUDE = $(FT2DEMO_GRAPH) ; -GRAPH_LIB = $(LIBPREFIX)graph$(SUFLIB) ; - -graph_sources = grblit - grobjs - grfont - grdevice - grinit - gblender - gblblit - grfill - grswizzle - ; - -if $(OS) = BEOS -{ - DEVICE_DEFINE = -DDEVICE_BEOS ; -} -else if $(UNIX) -{ - DEVICE_DEFINE = -DDEVICE_X11 ; -} -else if $(NT) -{ - DEVICE_DEFINE = -DDEVICE_WIN32 ; -} -else if $(OS2) -{ - DEVICE_DEFINE = -DDEVICE_OS2 ; -} - -CCFLAGS on grinit$(SUFOBJ) = $(CCFLAGS) $(DEVICE_DEFINE) ; - -Library $(GRAPH_LIB) : $(graph_sources).c ; - -if $(OS) = BEOS -{ - SubInclude FT2DEMO_TOP graph beos ; -} -else if $(UNIX) -{ - SubInclude FT2DEMO_TOP graph x11 ; -} -else if $(NT) -{ - SubInclude FT2DEMO_TOP graph win32 ; -} -else if $(OS2) -{ - SubInclude FT2DEMO_TOP graph os2 ; -} - -# end of graph Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/mac/grmac.c freetype-2.8/=unpacked-tar1=/graph/mac/grmac.c --- freetype-2.7.1/=unpacked-tar1=/graph/mac/grmac.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/mac/grmac.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ -/******************************************************************* - * - * grmac.c graphics driver for MacOS platform. - * - * This is the driver for displaying inside a window under MacOS, - * used by the graphics utility of the FreeType test suite. - * - * Largely written by Just van Rossum, but derived from grwin32.c. - * Copyright 1999-2000, 2004 by Just van Rossum, Antoine Leca, - * David Turner, Robert Wilhelm, and Werner Lemberg. - * - * Borrowing liberally from the other FreeType drivers. - * - * 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. - * - ******************************************************************/ - -/* ANSI C */ -#include - -/* Mac Toolbox */ -#include - -/* FT graphics subsystem */ -#include "grobjs.h" -#include "grdevice.h" - -#ifdef __MWERKS__ -/* CodeWarrior's poor excuse for a console */ -#include -#endif - -/* Mac function key definitions. The 0x100 is a kludge, see listen_event(). */ -#define KEY_F1 (0x7A | 0x100) -#define KEY_F2 (0x78 | 0x100) -#define KEY_F3 (0x63 | 0x100) -#define KEY_F4 (0x76 | 0x100) -#define KEY_F5 (0x60 | 0x100) -#define KEY_F6 (0x61 | 0x100) -#define KEY_F7 (0x62 | 0x100) -#define KEY_F8 (0x64 | 0x100) -#define KEY_F9 (0x65 | 0x100) -#define KEY_F10 (0x6D | 0x100) -#define KEY_F11 (0x67 | 0x100) -#define KEY_F12 (0x6F | 0x100) -#define KEY_F13 (0x69 | 0x100) -#define KEY_F14 (0x6B | 0x100) -#define KEY_F15 (0x71 | 0x100) - - -/* Mac to FT key mapping */ - - typedef struct Translator_ - { - short mackey; - grKey grkey; - - } Translator; - - static - Translator key_translators[] = - { - { kBackspaceCharCode, grKeyBackSpace }, - { kTabCharCode, grKeyTab }, - { kReturnCharCode, grKeyReturn }, - { kEscapeCharCode, grKeyEsc }, - { kHomeCharCode, grKeyHome }, - { kLeftArrowCharCode, grKeyLeft }, - { kUpArrowCharCode, grKeyUp }, - { kRightArrowCharCode, grKeyRight }, - { kDownArrowCharCode, grKeyDown }, - { kPageUpCharCode, grKeyPageUp }, - { kPageDownCharCode, grKeyPageDown }, - { kEndCharCode, grKeyEnd }, - { kHelpCharCode, grKeyF1 }, /* map Help key to F1... */ - { KEY_F1, grKeyF1 }, - { KEY_F2, grKeyF2 }, - { KEY_F3, grKeyF3 }, - { KEY_F4, grKeyF4 }, - { KEY_F5, grKeyF5 }, - { KEY_F6, grKeyF6 }, - { KEY_F7, grKeyF7 }, - { KEY_F8, grKeyF8 }, - { KEY_F9, grKeyF9 }, - { KEY_F10, grKeyF10 }, - { KEY_F11, grKeyF11 }, - { KEY_F12, grKeyF12 } - }; - - - /* This is a minimalist driver, it is only able to display */ - /* a _single_ window. Moreover, only monochrome and gray */ - /* bitmaps are supported.. */ - - /* pointer to the window. */ - static WindowPtr theWindow = NULL; - - /* the pixmap */ - static PixMap thePixMap; - - - /* destroys the window */ - static - void done_window( ) - { - if ( theWindow ) - { - DisposeWindow ( theWindow ); - } - theWindow = NULL; - } - - /* destroys the surface*/ - static - void done_surface( grSurface* surface ) - { - /* ick! this never gets called... */ - done_window(); - grDoneBitmap( &surface->bitmap ); - } - - static - void refresh_rectangle( grSurface* surface, - int x, - int y, - int w, - int h ) - { - Rect bounds; - SetRect( &bounds, x, y, x+w, y+h ); - if ( theWindow ) { - GrafPtr windowPort = GetWindowPort(theWindow); - RgnHandle visRgn = GetPortVisibleRegion(windowPort, NewRgn()); - SetPort(windowPort); - CopyBits( (BitMap*)&thePixMap, GetPortBitMapForCopyBits(windowPort), - &bounds, &bounds, srcCopy, visRgn); - DisposeRgn(visRgn); - } - } - - static - void set_title( grSurface* surface, const char* title ) - { - Str255 pTitle; - strcpy( (char*)pTitle+1, title ); - pTitle[0] = strlen( title ); - if ( theWindow ) - SetWTitle( theWindow, pTitle ); - } - - static - void listen_event( grSurface* surface, - int event_mask, - grEvent* grevent ) - { - grEvent our_grevent; - EventRecord mac_event; - - our_grevent.type = gr_event_none; - our_grevent.key = grKeyNone; - - for ( ;; ) - /* The event loop. Sorry, but I'm too lazy to split the various events - to proper event handler functions. This whole app is rather ad hoc - anyway, so who cares ;-) */ - { - if ( WaitNextEvent( everyEvent, &mac_event, 10, NULL ) ) - { - switch ( mac_event.what ) - { - case autoKey: - case keyDown: - { - int count = sizeof( key_translators ) / sizeof( key_translators[0] ); - Translator* trans = key_translators; - Translator* limit = trans + count; - short char_code; - - char_code = mac_event.message & charCodeMask; - if ( char_code == kFunctionKeyCharCode ) - /* Le kluge. Add a flag to differentiate the F-keys from normal keys. */ - char_code = 0x100 | ((mac_event.message & keyCodeMask) >> 8); - - our_grevent.key = char_code; - - for ( ; trans < limit; trans++ ) - /* see if the key maps to a special "gr" key */ - if ( char_code == trans->mackey ) - { - our_grevent.key = trans->grkey; - } - our_grevent.type = gr_event_key; - } - if ( our_grevent.key == grKEY('q') || our_grevent.key == grKeyEsc ) - /* destroy the window here, since done_surface() doesn't get called */ - done_window(); - *grevent = our_grevent; - return; - case updateEvt: - if ( theWindow && (WindowPtr)mac_event.message == theWindow ) - { - SetPortWindowPort( theWindow ); - BeginUpdate( theWindow ); - refresh_rectangle( surface, - 0, 0, - thePixMap.bounds.right, thePixMap.bounds.bottom ); - EndUpdate( theWindow ); - } -#ifdef __MWERKS__ - else - { - SIOUXHandleOneEvent( &mac_event ); - } -#endif - break; - case mouseDown: - { - short part; - WindowPtr wid; - - part = FindWindow( mac_event.where, &wid ); - if ( wid == theWindow ) - { - if ( theWindow && part == inDrag) { -#if TARGET_API_MAC_CARBON -#define screenBounds NULL -#else - Rect *screenBounds = &qd.screenBits.bounds; -#endif - DragWindow( wid, mac_event.where, screenBounds); - } - else if (part == inGoAway) - { - if ( TrackGoAway( theWindow, mac_event.where ) ) - { - /* The user clicked the window away, emulate quit event */ - done_window(); - our_grevent.type = gr_event_key; - our_grevent.key = grKeyEsc; - *grevent = our_grevent; - return; - } - } - else if (part == inContent) - { - SelectWindow( theWindow ); - } - } -#ifdef __MWERKS__ - else - { - SIOUXHandleOneEvent( &mac_event ); - } -#endif - } - break; - default: - InitCursor(); - break; - } - } - } - } - - -static -grSurface* init_surface( grSurface* surface, - grBitmap* bitmap ) -{ - PixMapPtr pixMap = &thePixMap; - - Rect bounds; - SetRect(&bounds, 0, 0, bitmap->width, bitmap->rows); - - switch (bitmap->mode) - { - case gr_pixel_mode_rgb24: - bitmap->mode = gr_pixel_mode_rgb32; - break; - - default: - bitmap->mode = gr_pixel_mode_mono; - bitmap->grays = 0; - break; - } - - /* create the bitmap - under MacOS, we support all modes as the GDI */ - /* handles all conversions automatically.. */ - if ( grNewBitmap( bitmap->mode, - bitmap->grays, - bitmap->width, - bitmap->rows, - bitmap ) ) - return 0; - - surface->bitmap = *bitmap; - - /* initialize the PixMap to appropriate values */ - pixMap->baseAddr = (char*)bitmap->buffer; - pixMap->rowBytes = bitmap->pitch; - if (pixMap->rowBytes < 0) - pixMap->rowBytes = -pixMap->rowBytes; - pixMap->rowBytes |= 0x8000; /* flag indicating it's a PixMap, not a BitMap */ - pixMap->bounds = bounds; - pixMap->pmVersion = baseAddr32; /* pixmap base address is 32-bit address */ - pixMap->packType = 0; - pixMap->packSize = 0; - pixMap->hRes = 72 << 16; - pixMap->vRes = 72 << 16; - pixMap->pmTable = 0; -#if OLDPIXMAPSTRUCT - pixMap->planeBytes = 0; - pixMap->pmReserved = 0; -#else - pixMap->pixelFormat = 0; - pixMap->pmExt = 0; -#endif - - switch ( bitmap->mode ) - { - case gr_pixel_mode_mono: - case gr_pixel_mode_gray: - - pixMap->pixelType = 0; /* indexed color */ - pixMap->cmpCount = 1; - - if (bitmap->mode == gr_pixel_mode_mono) - { - pixMap->pixelSize = 1; - } - else - { - pixMap->pixelSize = 8; - pixMap->pmTable = GetCTable(256); /* color palette matching FT's idea */ - break; /* of grayscale. See ftview.rsrc */ - } - pixMap->cmpSize = pixMap->pixelSize; - break; - - case gr_pixel_mode_rgb32: - pixMap->pixelSize = 32; - pixMap->pixelType = RGBDirect; - pixMap->cmpCount = 3; - pixMap->cmpSize = 8; - pixMap->baseAddr -= 1; /*SHH: goofy hack to reinterpret bitmap's RGBx -> xRGB */ - break; - - default: - return 0; /* Unknown mode */ - } - - /* create the window */ - OffsetRect(&bounds, 10, 44); /* place it at a decent location */ - theWindow = NewCWindow(NULL, &bounds, "\p???", 1, 0, (WindowRef)-1, 1, 0); - - /* fill in surface interface */ - surface->done = (grDoneSurfaceFunc) done_surface; - surface->refresh_rect = (grRefreshRectFunc) refresh_rectangle; - surface->set_title = (grSetTitleFunc) set_title; - surface->listen_event = (grListenEventFunc) listen_event; - - return surface; -} - - - static int init_device( void ) - { - return 0; - } - - static void done_device( void ) - { - /* won't get called either :-( */ - } - - grDevice gr_mac_device = - { - sizeof( grSurface ), - "mac", - - init_device, - done_device, - - (grDeviceInitSurfaceFunc) init_surface, - - 0, - 0 - }; - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/mac/grmac.h freetype-2.8/=unpacked-tar1=/graph/mac/grmac.h --- freetype-2.7.1/=unpacked-tar1=/graph/mac/grmac.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/mac/grmac.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -#ifndef GRMAC_H_ -#define GRMAC_H_ - -#include "grobjs.h" - - extern - grDevice gr_mac_device; - -#ifdef GR_INIT_BUILD - static - grDeviceChain gr_mac_device_chain = - { - "mac", - &gr_mac_device, - GR_INIT_DEVICE_CHAIN - }; - -#undef GR_INIT_DEVICE_CHAIN -#define GR_INIT_DEVICE_CHAIN &gr_mac_device_chain - -#endif /* GR_INIT_BUILD */ - -#endif /* GRMAC_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/migs.html freetype-2.8/=unpacked-tar1=/graph/migs.html --- freetype-2.7.1/=unpacked-tar1=/graph/migs.html 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/migs.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ - - - - - - - - -
MiGS Overview -
A Minimalist Graphics Subsystem -

-


- -

-Introduction

- -
This document details the design and implementation of MiGS, -the minimalist graphics subsystem used by the FreeType 2 demonstration -programs. Its purpose is mainly to help writers of new demo programs, as -well as developers who would like port the subsystem to other platforms.
- -
-

-I - Design goals

- -
MiGS is a tiny graphics subsystem used to demo text rendering -through the FreeType library. It was mainly written to provide the abilities -to :
- -
    -
      -
    • -draw a monochrome glyph bitmap to many kinds of target surfaces (i.e. really -bitmaps/pixmaps)
    • - -
    • -draw an anti-aliased glyph bitmap, with any level of grays, to many kinds -of target surfaces
    • - -
    • -display a simple window on many systems like X11, OS/2 and Windows
    • - -
    • -accept simple events (keypresses and mouse buttons) in this window.
    • - -
    • -to be portable and present a unified API on all running systems
    • -
    - -


    MiGS uses system-specific "drivers" in order to perform display -and event handling. The blitting functions are not device-specific. MiGS -can be built and/or used with no system-specific features, like for example, -to generate simple GIF, PNG, TIFF, etc.. images without ever needing to -display them.

- -

- -

- -

-II - Surfaces, bitmaps and windows

- -
A surface in MiGS models a drawable region where glyph images -can be rendered, a surface always contains a bitmap descriptor as well -as a few other things that will be described later in this section. -

Some surfaces can be displayed, they are then either called windowed -surfaces or screen surfaces depending on the nature of the device -used to display them. Each device is implemented by a very simple -driver in the MiGS code. Here are a few example devices that are -or could be written to display surfaces : -

- an X11 device -
- a Win 32 GDI device -
- an OS/2 Presentation Manager device -
- a fullscreen SVGALib device on Linux -
- a GGI visual device -
- an OS/2 "Dive" device, or the equivalent Win32 "DirectX" device -

etc.. -

NOTE: For now, only the X11 device was written and tested.. More -devices should come later -

Before explaining how to create a surface, we need to explain how MiGS -manages bitmaps and renders glyph images to them. -

-1. Bitmaps :

- -
A bitmap in MiGS features the following things : -
    -
  • -a width in pixels
  • - -
  • -a height in pixels
  • - -
  • -a pixel mode, which indicates how the pixels are stored in -the surface's buffer
  • - -
  • -a pitch, whose absolute values is the number of bytes taken -by each surface row
  • - -
  • -a number of valid gray levels (see below)
  • - -
  • -a buffer, holding the surface's pixels
  • -
- -


MiGS uses the "Y downwards" convention, which means that -increasing -Y coordinates correspond to lower rows of the bitmap. Hence, -the coordinate (0,0) always corresponds to the bitmap's -top-left -pixel. -

The bitmap's rows can be stored either "downwards" or "upwards" -in the pixel buffer. -

In the first case (downwards), increasing memory addresses in -the pixel buffer correspond to lower rows of the bitmap(e.g. PC video modes), -and the pitch should be equal to the number of bytes -taken by each row. The first pixel buffer byte corresponds to the -upper row. -

In the second case (upwards), increasing memory addresses in -the pixel buffer correspond to upper rows of the bitmap and the pitch -should be equal to the opposite of the number of bytes -taken by each row. The first pixel buffer byte corresponds to the lower -row. -

In all cases, the pitch is the increment to be used -to go from one bitmap row to the one below it. -

The supported pixel modes are : -

    -
  • -1-bit monochrome bitmaps. With "0" as the background, and "1" as the foreground.
  • - -
  • -4-bit color bitmaps, using an arbitrary palette.
  • - -
  • -8-bit color bitmaps, using an arbitrary palette.
  • - -
  • -8-bit gray bitmaps, using a given N number of gray levels in the range -0..N-1.
  • - -
  • -15-bit color bitmaps, also known as RGB555
  • - -
  • -16-bit color bitmaps, also known as RGB565
  • - -
  • -24-bit color bitmaps, also known as RGB
  • - -
  • -32-bit color bitmaps, also known as RGBA (though the A is ignored by MiGS)
  • -
-The bitmap's number of gray levels is only relevant for 8-bit -gray bitmaps, and indicates the range of gray levels that can be -found in the bitmap. If a bitmap as N gray levels, it is said to be N-grayscales, -and the pixels within it must all have values between 0, considered as -the background color, and N-1, considered as the foreground -color. -

N-grayscale bitmaps are crucial for the rendering of anti-aliased text. -
 

- -

-2. Glyph images :

- -
The glyph images that can be drawn on bitmaps through MiGS -are bitmaps themselves, though limited to the following pixel modes : -

1-bit monochrome glyph bitmaps -

These can be drawn on any kind of bitmap. Note that only -the "lit" pixels (i.e. the bits set to 1) are effectively drawn to -the target, as opaque blitting isn't supported (remember, it's a minimalist -library !)
- -


N-grayscales glyph images (with any value of N >= 2) -

These can be drawn to all RGB bitmaps (15, 16, 24 & -32 bits/pixel), as well as any other M-grayscales bitmaps. In the latter -case, the values of N and M need not be equal, as the library is -able to perform automatic conversions on the fly. -

For example, it is possible to render a 5-grayscales glyph image into -a 128-grayscales bitmap. Moreover, it is also possible to render a 17-grayscales -glyph image into a 5-grayscales bitmap, even if this will result in a -loss of quality. This feature is crucial in order to experiment easily -with other anti-aliasing algorithms for FreeType -
 

-Note that you can only draw monochrome bitmaps to the following -pixel modes : monochrome, 4-bit color and 8-bit color.
- -

-3. Windows and Screens:

- -
In order to debug FreeType, displaying a surface in a window -or in full-screen mode, is required. MiGS thus makes a difference between -simple -surfaces, which only contain a bitmap, windowed surfaces, which -are used to display their content in a window, and screen surfaces, -which are used to display their content in a full-screen mode (SVGAlib, -DirectX, GGI or whatever). -

A few important things must be said about non-simple surfaces. -
  -

    -
  • -First, they might contain some system-specific data which is used to manage -the display in a window or on the screen. This must be completely hidden -to MiGS clients. Indeed, rendering to any kind of surface is achieved through -exactly -the same function calls.
  • -
- -
    -
  • -Second, they may contain a bitmap whose pixel mode doesn't correspond to -the screen's depth used to display it. For example, the surface might contain -an 128-grayscale bitmap, while the screen is in RGB24 mode. Some conversion -must be performed to display the surface. This can either happen in the -system-specific graphics library (e.g. on OS/2, a single Presentation Manager -call is used to blit a N-grayscale image to any kind of window) -or in the system-specific part of MiGS (e.g. the X11 MiGS driver must convert -the surface's bitmap into the appropriate X11 image each time a -repaint is requested). Again this must be completely hidden to MiGS clients
  • -
-Surfaces have also a few fields that are only used when displaying them -in Windows : -

a title string -

This is simply a text string that is displayed on the title -bar of the surface's window. It can also appear at the top or bottom of -full-screen surfaces if the MiGS driver supports it. The title string can -be changed with a call to grSetTitle, and is ignored for simple -surfaces.
- -


a refresh flag -

This boolean flag is only used for window surfaces, and some -fullscreen ones (depending on the driver implementation). When set, it -indicates that each glyph image blit must be displayed immediately. By -default, this flag is set to False, which means that demo programs must -call the grRefreshSurface(surface) function to display the whole -contents of a surface one it has been updated. -

The refresh flag can be set with grSetSurfaceRefresh(surface,flag). -Note that a single surface rectangle can be forced to be displayed with -a call to grRefreshRectangle(surface,x,y,w,h) at any time.

-
- -

-4. Devices :

- -
As said before, each device is in charge of displaying a surface -in a given window or screen. Each device is managed through a very simple -driver, described to MiGS through a very simple "grDevice" structure. -

A grDevice contains, among other things, pointers to the functions used -to: -

- refresh/display a given rectangle of the surface to the window/screen -
- listen events (key presses and mouse) and send them back to client -apps. -
- for windowed devices, update the title bar. -

As said before, this is a highly minimalist system.. -
 

-
- -
-

-III - Important implementation issues :

- -
-

-1. Display surface negotiation :

- -
A display surface is created with the function grNewScreenSurface -which takes parameters indicating which device should be used, the pixel -dimensions of the requested surface, as well as its pixel mode. -

Because of some device-specific limitations, the resulting surface's -properties might not match exactly those requested for the call. Hence, -a developer should always take care of reading a new display surface's -bitmap descriptor in order to get its real dimensions, pixel -mode and eventually number of grays. -

The function grNewSurface will create a memory surface with the corresponding -bitmap. -
The function grNewBitmapSurface will create a surface from a pre-existing -bitmap. This is useful to draw text on loaded images, for example. -

Any surface (display or not) is destroyed with grDoneSurface.

- -

-

- -

-2. Supporting 8-bit grayscale mode :

- -
It is important, for the debugging of FreeType anti-aliased -renderer(s), that _all_ devices should support the 8-bit gray mode. -The number of gray levels can be fixed or negotiated as required by implementation-specific -issues. -

As most existing devices do not provide direct support for such a mode, -each 8-bit surface must thus contain : -

- an internal N-grayscale bitmap, used as the target of all glyph drawings -
- its own device-specific "image", which matches the display depth. -

Each time the device's "refresh_rect" function is called, it should -then : -
- convert the grayscales within the bitmap's rectangle into the image's -buffer and format. -
- display the corresponding image rectangle. -

This scheme is used, for example, by the X11 device.

-
- - - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/os2/gros2pm.c freetype-2.8/=unpacked-tar1=/graph/os2/gros2pm.c --- freetype-2.7.1/=unpacked-tar1=/graph/os2/gros2pm.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/os2/gros2pm.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,753 +0,0 @@ -#include "grobjs.h" -#include "grdevice.h" - -#define INCL_DOS -#define INCL_WIN -#define INCL_GPI -#define INCL_SUB - -#include -#include -#include -#include -#include - -#define DEBUGxxx - -#ifdef DEBUG -#define LOG(x) LogMessage##x -#else -#define LOG(x) /* rien */ -#endif - -#ifdef DEBUG - static void LogMessage( const char* fmt, ... ) - { - va_list ap; - - va_start( ap, fmt ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } -#endif - - typedef struct Translator - { - ULONG os2key; - grKey grkey; - - } Translator; - - - static - Translator key_translators[] = - { - { VK_BACKSPACE, grKeyBackSpace }, - { VK_TAB, grKeyTab }, - { VK_ENTER, grKeyReturn }, - { VK_ESC, grKeyEsc }, - { VK_HOME, grKeyHome }, - { VK_LEFT, grKeyLeft }, - { VK_UP, grKeyUp }, - { VK_RIGHT, grKeyRight }, - { VK_DOWN, grKeyDown }, - { VK_PAGEUP, grKeyPageUp }, - { VK_PAGEDOWN, grKeyPageDown }, - { VK_END, grKeyEnd }, - { VK_F1, grKeyF1 }, - { VK_F2, grKeyF2 }, - { VK_F3, grKeyF3 }, - { VK_F4, grKeyF4 }, - { VK_F5, grKeyF5 }, - { VK_F6, grKeyF6 }, - { VK_F7, grKeyF7 }, - { VK_F8, grKeyF8 }, - { VK_F9, grKeyF9 }, - { VK_F10, grKeyF10 }, - { VK_F11, grKeyF11 }, - { VK_F12, grKeyF12 } - }; - - -#define MAX_PIXEL_MODES 32 - - static HAB gr_anchor; /* device anchor block */ - - typedef POINTL PMBlitPoints[4]; - - typedef struct grPMSurface_ - { - grSurface root; - grBitmap image; - - HAB anchor; /* handle to anchor block for surface's window */ - HWND frame_window; /* handle to window's frame */ - HWND client_window; /* handle to window's client */ - HWND title_window; /* handle to window's title bar */ - - HPS image_ps; /* memory presentation space used to hold */ - /* the surface's content under PM */ - HDC image_dc; /* memory device context for the image */ - - HEV event_lock; /* semaphore used in listen_surface */ - HMTX image_lock; /* a mutex used to synchronise access */ - /* to the memory presentation space */ - /* used to hold the surface */ - - TID message_thread; /* thread used to process this surface's */ - /* messages.. */ - - PBITMAPINFO2 bitmap_header;/* os/2 bitmap descriptor */ - HBITMAP os2_bitmap; /* Handle to OS/2 bitmap contained in image */ - BOOL ready; /* ??? */ - - long shades[256]; /* indices of gray levels in pixel_mode_gray */ - - POINTL surface_blit[4]; /* surface blitting table */ - POINTL magnify_blit[4]; /* magnifier blitting table */ - int magnification; /* level of magnification */ - POINTL magnify_center; - SIZEL magnify_size; - - grEvent event; - - PMBlitPoints blit_points; - - } grPMSurface; - - /* we use a static variable to pass a pointer to the PM Surface */ - /* to the client window. This is a bit ugly, but it makes things */ - /* a lot more simple.. */ - static grPMSurface* the_surface; - - static - void enable_os2_iostreams( void ) - { - PTIB thread_block; - PPIB process_block; - - /* XXX : This is a very nasty hack, it fools OS/2 and let the program */ - /* call PM functions, even though stdin/stdout/stderr are still */ - /* directed to the standard i/o streams.. */ - /* The program must be compiled with WINDOWCOMPAT */ - /* */ - /* Credits go to Michal for finding this !! */ - /* */ - DosGetInfoBlocks( &thread_block, &process_block ); - process_block->pib_ultype = 3; - } - - - - static - int init_device( void ) - { - enable_os2_iostreams(); - - /* create an anchor block. This will allow this thread (i.e. the */ - /* main one) to call Gpi functions.. */ - gr_anchor = WinInitialize(0); - if (!gr_anchor) - { - /* could not initialise Presentation Manager */ - return -1; - } - - return 0; - } - - - - static - void done_device( void ) - { - /* Indicates that we do not use the Presentation Manager, this */ - /* will also release all associated resources.. */ - WinTerminate( gr_anchor ); - } - - - - /* close a given window */ - static - void done_surface( grPMSurface* surface ) - { - LOG(( "Os2PM: done_surface(%08lx)\n", (long)surface )); - - if ( surface->frame_window ) - WinDestroyWindow( surface->frame_window ); - - WinReleasePS( surface->image_ps ); - - grDoneBitmap( &surface->image ); - grDoneBitmap( &surface->root.bitmap ); - } - - -#define LOCK(x) DosRequestMutexSem( x, SEM_INDEFINITE_WAIT ) -#define UNLOCK(x) DosReleaseMutexSem( x ) - - static - const int pixel_mode_bit_count[] = - { - 0, - 1, /* mono */ - 4, /* pal4 */ - 8, /* pal8 */ - 8, /* grays */ - 15, /* rgb15 */ - 16, /* rgb16 */ - 24, /* rgb24 */ - 32 /* rgb32 */ - }; - - - /************************************************************************ - * - * Technical note : how the OS/2 Presentation Manager driver works - * - * PM is, in my opinion, a bloated and over-engineered graphics - * sub-system, even though it has lots of nice features. Here are - * a few tidbits about it : - * - * - * - under PM, a "bitmap" is a device-specific object whose bits are - * not directly accessible to the client application. This means - * that we must use a scheme like the following to display our - * surfaces : - * - * - hold, for each surface, its own bitmap buffer where the - * rest of the graph library writes directly. - * - * - create a PM bitmap object with the same dimensions (and - * possibly format). - * - * - copy the content of each updated rectangle into the - * PM bitmap with the function 'GpiSetBitmapBits'. - * - * - finally, "blit" the PM bitmap to the screen calling - * 'GpiBlitBlt' - * - * - but there is more : you cannot directly blit a PM bitmap to the - * screen with PM. The 'GpiBlitBlt' only works with presentation - * spaces. This means that we also need to create, for each surface : - * - * - a memory presentation space, used to hold the PM bitmap - * - a "memory device context" for the presentation space - * - * The blit is then performed from the memory presentation space - * to the screen's presentation space.. - * - * - * - because each surface creates its own event-handling thread, - * we must protect the surface's presentation space from concurrent - * accesses (i.e. calls to 'GpiSetBitmapBits' when drawing to the - * surface, and calls to 'GpiBlitBlt' when drawing it on the screen - * are performed in two different threads). - * - * we use a simple mutex to do this. - * - * - * - we also use a semaphore to perform a rendez-vous between the - * main and event-handling threads (needed in "listen_event"). - * - ************************************************************************/ - - static - void RunPMWindow( grPMSurface* surface ); - - - - - static - void refresh_rectangle( grPMSurface* surface, - int x, - int y, - int w, - int h ) - { - LOG(( "Os2PM: refresh_rectangle( %08lx, %d, %d, %d, %d )\n", - (long)surface, x, y, w, h )); - - (void)x; - (void)y; - (void)w; - (void)h; - - /* - convert_rectangle( surface, x, y, w, h ); - */ - LOCK( surface->image_lock ); - GpiSetBitmapBits( surface->image_ps, - 0, - surface->root.bitmap.rows, - surface->root.bitmap.buffer, - surface->bitmap_header ); - UNLOCK( surface->image_lock ); - - WinInvalidateRect( surface->client_window, NULL, FALSE ); - WinUpdateWindow( surface->frame_window ); - } - - - static - void set_title( grPMSurface* surface, - const char* title ) - { - ULONG rc; - -#if 1 - LOG(( "Os2PM: set_title( %08lx == %08lx, %s )\n", - (long)surface, surface->client_window, title )); -#endif - LOG(( " -- frame = %08lx\n", - (long)surface->frame_window )); - LOG(( " -- client parent = %08lx\n", - (long)WinQueryWindow( surface->client_window, QW_PARENT ) )); - rc = WinSetWindowText( surface->client_window, (PSZ)title ); - LOG(( " -- returned rc = %ld\n",rc )); - } - - - - static - void listen_event( grPMSurface* surface, - int event_mask, - grEvent* grevent ) - { - ULONG ulRequestCount; - - (void) event_mask; /* ignored for now */ - - /* the listen_event function blocks until there is an event to process */ - DosWaitEventSem( surface->event_lock, SEM_INDEFINITE_WAIT ); - DosQueryEventSem( surface->event_lock, &ulRequestCount ); - *grevent = surface->event; - DosResetEventSem( surface->event_lock, &ulRequestCount ); - - return; - } - - - static - grPMSurface* init_surface( grPMSurface* surface, - grBitmap* bitmap ) - { - PBITMAPINFO2 bit; - SIZEL sizl = { 0, 0 }; - LONG palette[256]; - LOG(( "Os2PM: init_surface( %08lx, %08lx )\n", - (long)surface, (long)bitmap )); - - LOG(( " -- input bitmap =\n" )); - LOG(( " -- mode = %d\n", bitmap->mode )); - LOG(( " -- grays = %d\n", bitmap->grays )); - LOG(( " -- width = %d\n", bitmap->width )); - LOG(( " -- height = %d\n", bitmap->rows )); - - /* create the bitmap - under OS/2, we support all modes as PM */ - /* handles all conversions automatically.. */ - if ( grNewBitmap( bitmap->mode, - bitmap->grays, - bitmap->width, - bitmap->rows, - bitmap ) ) - return 0; - - LOG(( " -- output bitmap =\n" )); - LOG(( " -- mode = %d\n", bitmap->mode )); - LOG(( " -- grays = %d\n", bitmap->grays )); - LOG(( " -- width = %d\n", bitmap->width )); - LOG(( " -- height = %d\n", bitmap->rows )); - - bitmap->pitch = -bitmap->pitch; - surface->root.bitmap = *bitmap; - - /* create the image and event lock */ - DosCreateEventSem( NULL, &surface->event_lock, 0, TRUE ); - DosCreateMutexSem( NULL, &surface->image_lock, 0, FALSE ); - - /* create the image's presentation space */ - surface->image_dc = DevOpenDC( gr_anchor, - OD_MEMORY, (PSZ)"*", 0L, 0L, 0L ); - - surface->image_ps = GpiCreatePS( gr_anchor, - surface->image_dc, - &sizl, - PU_PELS | GPIT_MICRO | - GPIA_ASSOC | GPIF_DEFAULT ); - - GpiSetBackMix( surface->image_ps, BM_OVERPAINT ); - - /* create the image's PM bitmap */ - bit = (PBITMAPINFO2)grAlloc( sizeof(BITMAPINFO2) + 256*sizeof(RGB2) ); - surface->bitmap_header = bit; - - bit->cbFix = sizeof( BITMAPINFOHEADER2 ); - bit->cx = surface->root.bitmap.width; - bit->cy = surface->root.bitmap.rows; - bit->cPlanes = 1; - - bit->argbColor[0].bBlue = 255; - bit->argbColor[0].bGreen = 0; - bit->argbColor[0].bRed = 0; - - bit->argbColor[1].bBlue = 0; - bit->argbColor[1].bGreen = 255; - bit->argbColor[1].bRed = 0; - - bit->cBitCount = (bitmap->mode == gr_pixel_mode_gray ? 8 : 1 ); - - if (bitmap->mode == gr_pixel_mode_gray) - { - RGB2* color = bit->argbColor; - int x, count; - - count = bitmap->grays; - for ( x = 0; x < count; x++, color++ ) - { - color->bBlue = - color->bGreen = - color->bRed = (((count-x)*255)/count); - } - } - else - { - RGB2* color = bit->argbColor; - - color[0].bBlue = - color[0].bGreen = - color[0].bRed = 0; - - color[1].bBlue = - color[1].bGreen = - color[1].bRed = 255; - } - - surface->os2_bitmap = GpiCreateBitmap( surface->image_ps, - (PBITMAPINFOHEADER2)bit, - 0L, NULL, NULL ); - - GpiSetBitmap( surface->image_ps, surface->os2_bitmap ); - - bit->cbFix = sizeof( BITMAPINFOHEADER2 ); - GpiQueryBitmapInfoHeader( surface->os2_bitmap, - (PBITMAPINFOHEADER2)bit ); - surface->bitmap_header = bit; - - /* for gr_pixel_mode_gray, create a gray-levels logical palette */ - if ( bitmap->mode == gr_pixel_mode_gray ) - { - int x, count; - - count = bitmap->grays; - for ( x = 0; x < count; x++ ) - palette[x] = (((count-x)*255)/count) * 0x010101; - - /* create logical color table */ - GpiCreateLogColorTable( surface->image_ps, - (ULONG) LCOL_PURECOLOR, - (LONG) LCOLF_CONSECRGB, - (LONG) 0L, - (LONG) count, - (PLONG) palette ); - - /* now, copy the color indexes to surface->shades */ - for ( x = 0; x < count; x++ ) - surface->shades[x] = GpiQueryColorIndex( surface->image_ps, - 0, palette[x] ); - } - - /* set up the blit points array */ - surface->blit_points[1].x = surface->root.bitmap.width; - surface->blit_points[1].y = surface->root.bitmap.rows; - surface->blit_points[3] = surface->blit_points[1]; - - /* Finally, create the event handling thread for the surface's window */ - DosCreateThread( &surface->message_thread, - (PFNTHREAD) RunPMWindow, - (ULONG) surface, - 0UL, - 32920 ); - - /* wait for the window creation */ - LOCK(surface->image_lock); - UNLOCK(surface->image_lock); - - surface->root.done = (grDoneSurfaceFunc) done_surface; - surface->root.refresh_rect = (grRefreshRectFunc) refresh_rectangle; - surface->root.set_title = (grSetTitleFunc) set_title; - surface->root.listen_event = (grListenEventFunc) listen_event; - - /* convert_rectangle( surface, 0, 0, bitmap->width, bitmap->rows ); */ - return surface; - } - - - - MRESULT EXPENTRY Message_Process( HWND handle, - ULONG mess, - MPARAM parm1, - MPARAM parm2 ); - - - static - void RunPMWindow( grPMSurface* surface ) - { - unsigned char class_name[] = "DisplayClass"; - ULONG class_flags; - - static HMQ queue; - QMSG message; - - /* store the current surface pointer in "the_surface". It is a static */ - /* variable that is only used to retrieve the pointer in the client */ - /* window procedure the first time it is called.. */ - the_surface = surface; - - /* try to prevent the program from going on without the setup of thread 2 */ - LOCK( surface->image_lock ); - - LOG(( "Os2PM: RunPMWindow( %08lx )\n", (long)surface )); - - /* create an anchor to allow this thread to use PM */ - surface->anchor = WinInitialize(0); - if (!surface->anchor) - { - printf( "Error doing WinInitialize()\n" ); - return; - } - - /* create a message queue */ - queue = WinCreateMsgQueue( surface->anchor, 0 ); - if (!queue) - { - printf( "Error doing WinCreateMsgQueue()\n" ); - return; - } - - /* register the window class */ - if ( !WinRegisterClass( surface->anchor, - (PSZ) class_name, - (PFNWP) Message_Process, - CS_SIZEREDRAW, - 0 ) ) - { - printf( "Error doing WinRegisterClass()\n" ); - return; - } - - /* create the PM window */ - class_flags = FCF_TITLEBAR | FCF_MINBUTTON | FCF_DLGBORDER | - FCF_TASKLIST | FCF_SYSMENU; - - LOG(( "Os2PM: RunPMWindow: Creating window\n" )); - surface->frame_window = WinCreateStdWindow( - HWND_DESKTOP, - WS_VISIBLE, - &class_flags, - (PSZ) class_name, - (PSZ) "FreeType Viewer - press F1 for help", - WS_VISIBLE, - 0, 0, - &surface->client_window ); - if (!surface->frame_window) - { - printf( "Error doing WinCreateStdWindow()\n" ); - return; - } - - /* find the title window handle */ - surface->title_window = WinWindowFromID( surface->frame_window, - FID_TITLEBAR ); - LOG (( "Os2PM: RunPMWIndow: Creation succeeded\n" )); - LOG (( " -- frame = %08lx\n", surface->frame_window )); - LOG (( " -- client = %08lx\n", surface->client_window )); - - /* set Window size and position */ - WinSetWindowPos( surface->frame_window, - 0L, - (SHORT) 60, - - (SHORT) WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) - - (surface->root.bitmap.rows + 100), - - (SHORT) WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME )*2 + - surface->root.bitmap.width, - - (SHORT) WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) + - WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME )*2 + - surface->root.bitmap.rows, - - SWP_SIZE | SWP_MOVE ); - -#if 0 - /* save the handle to the current surface within the window words */ - WinSetWindowPtr( surface->client_window,QWL_USER, surface ); -#endif - - /* Announcing window_created */ - UNLOCK(surface->image_lock); - - /* run the message queue till the end */ - while ( WinGetMsg( surface->anchor, &message, (HWND)NULL, 0, 0 ) ) - { - WinDispatchMsg( surface->anchor, &message ); - } - - /* clean-up */ - WinDestroyWindow( surface->frame_window ); - surface->frame_window = 0; - - WinDestroyMsgQueue( queue ); - WinTerminate( surface->anchor ); - - /* await death... */ - while ( 1 ) - DosSleep( 100 ); - } - - - - - /* Message processing for our PM Window class */ - MRESULT EXPENTRY Message_Process( HWND handle, - ULONG mess, - MPARAM parm1, - MPARAM parm2 ) - { - static HDC screen_dc; - static HPS screen_ps; - static BOOL minimized; - - SIZEL sizl; - SWP swp; - - grPMSurface* surface; - - /* get the handle to the window's surface -- note that this */ - /* value will be null when the window is created */ - surface = (grPMSurface*)WinQueryWindowPtr( handle, QWL_USER ); - if (!surface) - { - surface = the_surface; - WinSetWindowPtr( handle, QWL_USER, surface ); - } - - switch( mess ) - { - case WM_DESTROY: - /* warn the main thread to quit if it didn't know */ - surface->event.type = gr_event_key; - surface->event.key = grKeyEsc; - DosPostEventSem( surface->event_lock ); - break; - - case WM_CREATE: - /* set original magnification */ - minimized = FALSE; - - /* create Device Context and Presentation Space for screen. */ - screen_dc = WinOpenWindowDC( handle ); - screen_ps = GpiCreatePS( surface->anchor, - screen_dc, - &sizl, - PU_PELS | GPIT_MICRO | - GPIA_ASSOC | GPIF_DEFAULT ); - /* take the input focus */ - WinFocusChange( HWND_DESKTOP, handle, 0L ); - LOG(( "screen_dc and screen_ps have been created\n" )); - - /* To permit F9, F10 and others to pass through to the application */ - if (TRUE != WinSetAccelTable (surface->anchor, 0, surface->frame_window)) - { - printf( "Error - failed to clear accel table\n"); - } - break; - - case WM_MINMAXFRAME: - /* to update minimized if changed */ - swp = *((PSWP) parm1); - if ( swp.fl & SWP_MINIMIZE ) - minimized = TRUE; - if ( swp.fl & SWP_RESTORE ) - minimized = FALSE; - return WinDefWindowProc( handle, mess, parm1, parm2 ); - break; - - case WM_ERASEBACKGROUND: - case WM_PAINT: - /* copy the memory image of the screen out to the real screen */ - LOCK( surface->image_lock ); - WinBeginPaint( handle, screen_ps, NULL ); - - /* main image and magnified picture */ - GpiBitBlt( screen_ps, - surface->image_ps, - 4L, - surface->blit_points, - ROP_SRCCOPY, BBO_AND ); - - WinEndPaint( screen_ps ); - UNLOCK( surface->image_lock ); - break; - - case WM_HELP: /* this really is a F1 Keypress !! */ - surface->event.key = grKeyF1; - goto Do_Key_Event; - - case WM_CHAR: - if ( CHARMSG( &mess )->fs & KC_KEYUP ) - break; - - /* look for a specific vkey */ - { - int count = sizeof( key_translators )/sizeof( key_translators[0] ); - Translator* trans = key_translators; - Translator* limit = trans + count; - - for ( ; trans < limit; trans++ ) - if ( CHARMSG(&mess)->vkey == trans->os2key ) - { - surface->event.key = trans->grkey; - goto Do_Key_Event; - } - } - - /* otherwise, simply record the character code */ - if ( (CHARMSG( &mess )->fs & KC_CHAR) == 0 ) - break; - - surface->event.key = CHARMSG(&mess)->chr; - - Do_Key_Event: - surface->event.type = gr_event_key; - DosPostEventSem( surface->event_lock ); - break; - - default: - return WinDefWindowProc( handle, mess, parm1, parm2 ); - } - - return (MRESULT) FALSE; - } - - - - - grDevice gr_os2pm_device = - { - sizeof( grPMSurface ), - "os2pm", - - init_device, - done_device, - - (grDeviceInitSurfaceFunc) init_surface, - - 0, - 0 - - }; - - diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/os2/gros2pm.def freetype-2.8/=unpacked-tar1=/graph/os2/gros2pm.def --- freetype-2.7.1/=unpacked-tar1=/graph/os2/gros2pm.def 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/os2/gros2pm.def 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -NAME WINDOWCOMPAT - -DESCRIPTION 'FreeType Graphics' -HEAPSIZE 8192 -STACKSIZE 40888 diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/os2/gros2pm.h freetype-2.8/=unpacked-tar1=/graph/os2/gros2pm.h --- freetype-2.7.1/=unpacked-tar1=/graph/os2/gros2pm.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/os2/gros2pm.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -#ifndef GROS2PM_H_ -#define GROS2PM_H_ - -#include "grobjs.h" - - extern - grDevice gr_os2pm_device; - -#ifdef GR_INIT_BUILD - static - grDeviceChain gr_os2pm_device_chain = - { - "os2pm", - &gr_os2pm_device, - GR_INIT_DEVICE_CHAIN - }; - -#undef GR_INIT_DEVICE_CHAIN -#define GR_INIT_DEVICE_CHAIN &gr_os2pm_device_chain - -#endif /* GR_INIT_BUILD */ - -#endif /* GROS2PM_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/os2/Jamfile freetype-2.8/=unpacked-tar1=/graph/os2/Jamfile --- freetype-2.7.1/=unpacked-tar1=/graph/os2/Jamfile 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/os2/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -# FreeType2 demos graph/os2 Jamfile (c) 2001 David Turner -# - -SubDir FT2DEMO_TOP graph os2 ; - -SubDirHdrs $(GRAPH_INCLUDE) ; - -GROS2_PATH = [ FT2_SubDir graph os2 ]; -GRAPH_LINKLIBS = $(GROS2_PATH)gros2pm.def ; - -Library $(GRAPH_LIB) : grxos2.c ; - -# end of graph/os2 Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/os2/rules.mk freetype-2.8/=unpacked-tar1=/graph/os2/rules.mk --- freetype-2.7.1/=unpacked-tar1=/graph/os2/rules.mk 2015-09-25 05:40:31.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/os2/rules.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -#************************************************************************** -#* -#* OS/2 specific rules file, used to compile the OS/2 graphics driver -#* to the graphics subsystem -#* -#************************************************************************** - -ifeq ($(PLATFORM),os2) - - GR_OS2 := $(GRAPH)/os2 - - # the GRAPH_LINK is expanded each time an executable is linked with the - # graphics library. - # - GRAPH_LINK += $(subst /,$(COMPILER_SEP),$(GR_OS2)/gros2pm.def) - - # add the OS/2 driver object file to the graphics library `graph.a' - # - GRAPH_OBJS += $(OBJ_DIR_2)/gros2pm.$O - - DEVICES += OS2_PM - - # the rule used to compile the graphics driver - # - $(OBJ_DIR_2)/gros2pm.$O: $(GR_OS2)/gros2pm.c $(GR_OS2)/gros2pm.h - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_OS2)) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - -endif - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/rules.mk freetype-2.8/=unpacked-tar1=/graph/rules.mk --- freetype-2.7.1/=unpacked-tar1=/graph/rules.mk 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/rules.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -#************************************************************************** -#* -#* FreeType demo utilities sub-Makefile -#* -#* This Makefile is to be included by `../Makefile'. Its -#* purpose is to compile MiGS (the Minimalist Graphics Subsystem). -#* -#* It is written for GNU Make. Other make utilities are not -#* supported! -#* -#************************************************************************** - - -GRAPH_INCLUDES := $(subst /,$(COMPILER_SEP),$(TOP_DIR_2)/graph) -GRAPH_LIB := $(OBJ_DIR_2)/graph.$(SA) - -GRAPH := $(TOP_DIR_2)/graph - -GRAPH_H := $(GRAPH)/gblany.h \ - $(GRAPH)/gblbgra.h \ - $(GRAPH)/gblblit.h \ - $(GRAPH)/gblcolor.h \ - $(GRAPH)/gblhbgr.h \ - $(GRAPH)/gblhrgb.h \ - $(GRAPH)/gblvbgr.h \ - $(GRAPH)/gblvrgb.h \ - $(GRAPH)/gblender.h \ - $(GRAPH)/graph.h \ - $(GRAPH)/grblit.h \ - $(GRAPH)/grconfig.h \ - $(GRAPH)/grdevice.h \ - $(GRAPH)/grevents.h \ - $(GRAPH)/grfont.h \ - $(GRAPH)/grobjs.h \ - $(GRAPH)/grswizzle.h \ - $(GRAPH)/grtypes.h - - -GRAPH_OBJS := $(OBJ_DIR_2)/gblblit.$(O) \ - $(OBJ_DIR_2)/gblender.$(O) \ - $(OBJ_DIR_2)/grblit.$(O) \ - $(OBJ_DIR_2)/grdevice.$(O) \ - $(OBJ_DIR_2)/grfill.$(O) \ - $(OBJ_DIR_2)/grfont.$(O) \ - $(OBJ_DIR_2)/grinit.$(O) \ - $(OBJ_DIR_2)/grobjs.$(O) \ - $(OBJ_DIR_2)/grswizzle.$(O) - - - -# Default value for COMPILE_GRAPH_LIB; -# this value can be modified by the system-specific graphics drivers. -# -ifneq ($(LIBTOOL),) - COMPILE_GRAPH_LIB = $(LIBTOOL) --mode=link $(CCraw) -static \ - -o $(subst /,$(COMPILER_SEP),$@ $(GRAPH_OBJS)) -else - COMPILE_GRAPH_LIB = ar -r $(subst /,$(COMPILER_SEP),$@ $(GRAPH_OBJS)) -endif - - -# Add the rules used to detect and compile graphics driver depending -# on the current platform. -# -include $(wildcard $(TOP_DIR_2)/graph/*/rules.mk) - - -######################################################################### -# -# Build the `graph' library from its objects. This should be changed -# in the future in order to support more systems. Probably something -# like a `config/' hierarchy with a system-specific rules file -# to indicate how to make a library file, but for now, I'll stick to -# unix, Win32, and OS/2-gcc. -# -# -$(GRAPH_LIB): $(GRAPH_OBJS) - $(COMPILE_GRAPH_LIB) - - -# pattern rule for normal sources -# -$(OBJ_DIR_2)/%.$(O): $(GRAPH)/%.c $(GRAPH_H) -ifneq ($(LIBTOOL),) - $(LIBTOOL) --mode=compile $(CC) -static $(CFLAGS) \ - $(GRAPH_INCLUDES:%=$I%) $T$@ $< -else - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) $T$@ $< -endif - - -# a special rule is used for 'grinit.o' as it needs the definition -# of some macros like "-DDEVICE_X11" or "-DDEVICE_OS2_PM" -# -$(OBJ_DIR_2)/grinit.$(O): $(GRAPH)/grinit.c $(GRAPH_H) -ifneq ($(LIBTOOL),) - $(LIBTOOL) --mode=compile $(CC) -static \ - $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $(DEVICES:%=$DDEVICE_%) $T$(subst /,$(COMPILER_SEP),$@ $<) -else - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $(DEVICES:%=$DDEVICE_%) $T$(subst /,$(COMPILER_SEP),$@ $<) -endif - - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/win32/grwin32.c freetype-2.8/=unpacked-tar1=/graph/win32/grwin32.c --- freetype-2.7.1/=unpacked-tar1=/graph/win32/grwin32.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/win32/grwin32.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,657 +0,0 @@ -/******************************************************************* - * - * grwin32.c graphics driver for Win32 platform - * - * This is the driver for displaying inside a window under Win32, - * used by the graphics utility of the FreeType test suite. - * - * Written by Antoine Leca. - * Copyright 1999-2000, 2001, 2002, 2007 by Antoine Leca, - * David Turner, Robert Wilhelm, and Werner Lemberg. - * - * Borrowing liberally from the other FreeType drivers. - * - * 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. - * - ******************************************************************/ - -#include -#include -#include - -/* define to activate OLPC swizzle */ -#define xxSWIZZLE - -#define WIN32_LEAN_AND_MEAN -#include - -#include -#include -#ifdef SWIZZLE -#include -#endif - -/* logging facility */ -#include - -#define DEBUGxxx - -#ifdef DEBUG -#define LOG(x) LogMessage##x -#else -#define LOG(x) /* rien */ -#endif - -#ifdef DEBUG - static void LogMessage( const char* fmt, ... ) - { - va_list ap; - - va_start( ap, fmt ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } -#endif -/*-------------------*/ - -/* Size of the window. */ -#define WIN_WIDTH 640u -#define WIN_HEIGHT 450u - -/* These values can be changed, but WIN_WIDTH should remain for now a */ -/* multiple of 32 to avoid padding issues. */ - - typedef struct Translator_ - { - ULONG winkey; - grKey grkey; - - } Translator; - - static - Translator key_translators[] = - { - { VK_BACK, grKeyBackSpace }, - { VK_TAB, grKeyTab }, - { VK_RETURN, grKeyReturn }, - { VK_ESCAPE, grKeyEsc }, - { VK_HOME, grKeyHome }, - { VK_LEFT, grKeyLeft }, - { VK_UP, grKeyUp }, - { VK_RIGHT, grKeyRight }, - { VK_DOWN, grKeyDown }, - { VK_PRIOR, grKeyPageUp }, - { VK_NEXT, grKeyPageDown }, - { VK_END, grKeyEnd }, - { VK_F1, grKeyF1 }, - { VK_F2, grKeyF2 }, - { VK_F3, grKeyF3 }, - { VK_F4, grKeyF4 }, - { VK_F5, grKeyF5 }, - { VK_F6, grKeyF6 }, - { VK_F7, grKeyF7 }, - { VK_F8, grKeyF8 }, - { VK_F9, grKeyF9 }, - { VK_F10, grKeyF10 }, - { VK_F11, grKeyF11 }, - { VK_F12, grKeyF12 } - }; - - static - Translator syskey_translators[] = - { - { VK_F1, grKeyF1 } - }; - - static ATOM ourAtom; - - typedef struct grWin32SurfaceRec_ - { - grSurface root; - HWND window; - int window_width; - int window_height; - int title_set; - const char* the_title; - LPBITMAPINFO pbmi; - char bmi[ sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD) ]; - HBITMAP hbm; - grEvent ourevent; - int eventToProcess; - grBitmap bgrBitmap; /* windows wants data in BGR format !! */ -#ifdef SWIZZLE - grBitmap swizzle_bitmap; -#endif - } grWin32Surface; - - -/* destroys the surface*/ -static void -gr_win32_surface_done( grWin32Surface* surface ) -{ - /* The graphical window has perhaps already destroyed itself */ - if ( surface->window ) - { - DestroyWindow ( surface->window ); - PostMessage( surface->window, WM_QUIT, 0, 0 ); - } -#ifdef SWIZZLE - grDoneBitmap( &surface->swizzle_bitmap ); -#endif - grDoneBitmap( &surface->bgrBitmap ); - grDoneBitmap( &surface->root.bitmap ); -} - - -static void -gr_win32_surface_refresh_rectangle( - grWin32Surface* surface, - int x, - int y, - int w, - int h ) -{ - HDC hDC; - int row_bytes, delta; - LPBITMAPINFO pbmi = surface->pbmi; - HANDLE window = surface->window; - grBitmap* bitmap = &surface->root.bitmap; - - LOG(( "gr_win32_surface_refresh_rectangle: ( %p, %d, %d, %d, %d )\n", - (long)surface, x, y, w, h )); - - /* clip update rectangle */ - - if ( x < 0 ) - { - w += x; - x = 0; - } - - delta = x + w - surface->window_width; - if ( delta > 0 ) - w -= delta; - - if ( y < 0 ) - { - h += y; - y = 0; - } - - delta = y + h - surface->window_height; - if ( delta > 0 ) - h -= delta; - - if ( w <= 0 || h <= 0 ) - return; - - /* now, perform the blit */ - row_bytes = surface->root.bitmap.pitch; - if ( row_bytes < 0 ) - row_bytes = -row_bytes; - - if ( row_bytes * 8 != pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount ) - pbmi->bmiHeader.biWidth = row_bytes * 8 / pbmi->bmiHeader.biBitCount; - -#ifdef SWIZZLE - { - grBitmap* swizzle = &surface->swizzle_bitmap; - - gr_swizzle_rect_rgb24( bitmap->buffer, bitmap->pitch, - swizzle->buffer, swizzle->pitch, - bitmap->width, - bitmap->rows, - 0, 0, bitmap->width, bitmap->rows ); - - bitmap = swizzle; - } -#endif - - /* copy to BGR buffer */ - { - unsigned char* read_line = (unsigned char*)bitmap->buffer; - int read_pitch = bitmap->pitch; - unsigned char* write_line = (unsigned char*)surface->bgrBitmap.buffer; - int write_pitch = surface->bgrBitmap.pitch; - int height = bitmap->rows; - int width = bitmap->width; - - if ( read_pitch < 0 ) - read_line -= ( height - 1 ) * read_pitch; - - if ( write_pitch < 0 ) - write_line -= ( height - 1 ) * write_pitch; - - if ( bitmap->mode == gr_pixel_mode_gray ) - { - for ( ; height > 0; height-- ) - { - unsigned char* read = read_line; - unsigned char* read_limit = read + width; - unsigned char* write = write_line; - - for ( ; read < read_limit; read++, write++ ) - *write = *read; - - read_line += read_pitch; - write_line += write_pitch; - } - } - else - { - for ( ; height > 0; height-- ) - { - unsigned char* read = read_line; - unsigned char* read_limit = read + 3 * width; - unsigned char* write = write_line; - - for ( ; read < read_limit; read += 3, write += 3 ) - { - write[0] = read[2]; - write[1] = read[1]; - write[2] = read[0]; - } - - read_line += read_pitch; - write_line += write_pitch; - } - } - } - - hDC = GetDC ( window ); - SetDIBits ( hDC, surface->hbm, - 0, - bitmap->rows, - surface->bgrBitmap.buffer, - pbmi, - DIB_RGB_COLORS ); - - ReleaseDC ( window, hDC ); - - ShowWindow( window, SW_SHOW ); - InvalidateRect ( window, NULL, FALSE ); - UpdateWindow ( window ); -} - - -static void -gr_win32_surface_set_title( grWin32Surface* surface, - const char* title ) -{ - /* the title will be set on the next listen_event, just */ - /* record it there.. */ - surface->title_set = 1; - surface->the_title = title; -} - -static void -gr_win32_surface_listen_event( grWin32Surface* surface, - int event_mask, - grEvent* grevent ) -{ - MSG msg; - HANDLE window = surface->window; - - event_mask=event_mask; /* unused parameter */ - - if ( window && !surface->title_set ) - { - SetWindowText( window, surface->the_title ); - surface->title_set = 1; - } - - surface->eventToProcess = 0; - while (GetMessage( &msg, 0, 0, 0 )) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - if (surface->eventToProcess) - break; - } - - *grevent = surface->ourevent; -} - -/* - * set graphics mode - * and create the window class and the message handling. - */ - - -static grWin32Surface* -gr_win32_surface_init( grWin32Surface* surface, - grBitmap* bitmap ) -{ - static RGBQUAD black = { 0, 0, 0, 0 }; - static RGBQUAD white = { 0xFF, 0xFF, 0xFF, 0 }; - LPBITMAPINFO pbmi; - - /* find some memory for the bitmap header */ - surface->pbmi = pbmi = (LPBITMAPINFO) surface->bmi; - - LOG(( "Win32: init_surface( %p, %p )\n", surface, bitmap )); - - LOG(( " -- input bitmap =\n" )); - LOG(( " -- mode = %d\n", bitmap->mode )); - LOG(( " -- grays = %d\n", bitmap->grays )); - LOG(( " -- width = %d\n", bitmap->width )); - LOG(( " -- height = %d\n", bitmap->rows )); - - /* create the bitmap - under Win32, we support all modes as the GDI */ - /* handles all conversions automatically.. */ - if ( grNewBitmap( bitmap->mode, - bitmap->grays, - bitmap->width, - bitmap->rows, - bitmap ) ) - return 0; - - /* allocate the BGR shadow bitmap */ - if ( grNewBitmap( bitmap->mode, - bitmap->grays, - bitmap->width, - bitmap->rows, - &surface->bgrBitmap ) ) - return 0; - - surface->bgrBitmap.pitch = -surface->bgrBitmap.pitch; - -#ifdef SWIZZLE - if ( bitmap->mode == gr_pixel_mode_rgb24 ) - { - if ( grNewBitmap( bitmap->mode, - bitmap->grays, - bitmap->width, - bitmap->rows, - &surface->swizzle_bitmap ) ) - return 0; - - surface->swizzle_bitmap.pitch = -surface->swizzle_bitmap.pitch; - } -#endif - - LOG(( " -- output bitmap =\n" )); - LOG(( " -- mode = %d\n", bitmap->mode )); - LOG(( " -- grays = %d\n", bitmap->grays )); - LOG(( " -- width = %d\n", bitmap->width )); - LOG(( " -- height = %d\n", bitmap->rows )); - - bitmap->pitch = -bitmap->pitch; - surface->root.bitmap = *bitmap; - - /* initialize the header to appropriate values */ - memset( pbmi, 0, sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 ); - - pbmi->bmiHeader.biSize = sizeof ( BITMAPINFOHEADER ); - pbmi->bmiHeader.biWidth = bitmap->width; - pbmi->bmiHeader.biHeight = bitmap->rows; - pbmi->bmiHeader.biPlanes = 1; - - switch ( bitmap->mode ) - { - case gr_pixel_mode_mono: - pbmi->bmiHeader.biBitCount = 1; - pbmi->bmiColors[0] = white; - pbmi->bmiColors[1] = black; - break; - - case gr_pixel_mode_rgb24: - pbmi->bmiHeader.biBitCount = 24; - pbmi->bmiHeader.biCompression = BI_RGB; - break; - - case gr_pixel_mode_gray: - pbmi->bmiHeader.biBitCount = 8; - pbmi->bmiHeader.biClrUsed = bitmap->grays; - { - int count = bitmap->grays; - int x; - RGBQUAD* color = pbmi->bmiColors; - - for ( x = 0; x < count; x++, color++ ) - { - color->rgbRed = - color->rgbGreen = - color->rgbBlue = (unsigned char)(((count-x)*255)/count); - color->rgbReserved = 0; - } - } - break; - - default: - return 0; /* Unknown mode */ - } - - surface->window_width = bitmap->width; - surface->window_height = bitmap->rows; - - { - RECT WndRect; - - WndRect.left = 0; - WndRect.top = 0; - WndRect.right = bitmap->width; - WndRect.bottom = bitmap->rows; - AdjustWindowRect(&WndRect, WS_SYSMENU | WS_CAPTION, FALSE); - - surface->window = CreateWindow( - /* LPCSTR lpszClassName; */ "FreeTypeTestGraphicDriver", - /* LPCSTR lpszWindowName; */ "FreeType Test Graphic Driver", - /* DWORD dwStyle; */ WS_OVERLAPPED | WS_SYSMENU, - /* int x; */ CW_USEDEFAULT, - /* int y; */ CW_USEDEFAULT, - /* int nWidth; */ WndRect.right - WndRect.left, - /* int nHeight; */ WndRect.bottom - WndRect.top, - /* HWND hwndParent; */ HWND_DESKTOP, - /* HMENU hmenu; */ 0, - /* HINSTANCE hinst; */ GetModuleHandle( NULL ), - /* void FAR* lpvParam; */ surface ); - } - - if ( surface->window == 0 ) - return 0; - - surface->root.done = (grDoneSurfaceFunc) gr_win32_surface_done; - surface->root.refresh_rect = (grRefreshRectFunc) gr_win32_surface_refresh_rectangle; - surface->root.set_title = (grSetTitleFunc) gr_win32_surface_set_title; - surface->root.listen_event = (grListenEventFunc) gr_win32_surface_listen_event; - - return surface; -} - - -/* ---- Windows-specific stuff ------------------------------------------- */ - - - /* Message processing for our Windows class */ -LRESULT CALLBACK Message_Process( HWND handle, UINT mess, - WPARAM wParam, LPARAM lParam ) - { - grWin32Surface* surface = NULL; - - if ( mess == WM_CREATE ) - { - /* WM_CREATE is the first message sent to this function, and the */ - /* surface handle is available from the 'lParam' parameter. We */ - /* save its value in a window property.. */ - /* */ - surface = ((LPCREATESTRUCT)lParam)->lpCreateParams; - - SetProp( handle, (LPCSTR)(LONG)ourAtom, surface ); - } - else - { - /* for other calls, we retrieve the surface handle from the window */ - /* property.. ugly, isn't it ?? */ - /* */ - surface = (grWin32Surface*) GetProp( handle, (LPCSTR)(LONG)ourAtom ); - } - - switch( mess ) - { - case WM_DESTROY: - /* warn the main thread to quit if it didn't know */ - surface->ourevent.type = gr_event_key; - surface->ourevent.key = grKeyEsc; - surface->eventToProcess = 1; - surface->window = 0; - PostQuitMessage ( 0 ); - DeleteObject ( surface->hbm ); - return 0; - - case WM_CREATE: - { - HDC hDC; - LPBITMAPINFO pbmi = surface->pbmi; - - hDC = GetDC ( handle ); - surface->hbm = CreateDIBitmap ( - /* HDC hdc; handle of device context */ hDC, - /* BITMAPINFOHEADER FAR* lpbmih; addr.of header*/ &pbmi->bmiHeader, - /* DWORD dwInit; CBM_INIT to initialize bitmap */ 0, - /* const void FAR* lpvBits; address of values */ NULL, - /* BITMAPINFO FAR* lpbmi; addr.of bitmap data */ pbmi, - /* UINT fnColorUse; RGB or palette indices */ DIB_RGB_COLORS); - ReleaseDC ( handle, hDC ); - break; - } - - case WM_PAINT: - { - HDC hDC, memDC; - HANDLE oldbm; - PAINTSTRUCT ps; - - hDC = BeginPaint ( handle, &ps ); - memDC = CreateCompatibleDC( hDC ); - oldbm = SelectObject( memDC, surface->hbm ); - - BitBlt ( hDC, 0, 0, surface->window_width, surface->window_height, - memDC, 0, 0, SRCCOPY); - - ReleaseDC ( handle, hDC ); - SelectObject ( memDC, oldbm ); - DeleteObject ( memDC ); - EndPaint ( handle, &ps ); - return 0; - } - - case WM_SYSKEYDOWN: - { - int count = sizeof( syskey_translators )/sizeof( syskey_translators[0] ); - Translator* trans = syskey_translators; - Translator* limit = trans + count; - for ( ; trans < limit; trans++ ) - if ( wParam == trans->winkey ) - { - surface->ourevent.key = trans->grkey; - goto Do_Key_Event; - } - return DefWindowProc( handle, mess, wParam, lParam ); - } - - - case WM_KEYDOWN: - switch ( wParam ) - { - case VK_ESCAPE: - surface->ourevent.type = gr_event_key; - surface->ourevent.key = grKeyEsc; - surface->eventToProcess = 1; - PostQuitMessage ( 0 ); - return 0; - - default: - /* lookup list of translated keys */ - { - int count = sizeof( key_translators )/sizeof( key_translators[0] ); - Translator* trans = key_translators; - Translator* limit = trans + count; - for ( ; trans < limit; trans++ ) - if ( wParam == trans->winkey ) - { - surface->ourevent.key = trans->grkey; - goto Do_Key_Event; - } - } - - /* the key isn't found, default processing */ - /* return DefWindowProc( handle, mess, wParam, lParam ); */ - return DefWindowProc( handle, mess, wParam, lParam ); - } - - case WM_CHAR: - { - surface->ourevent.key = wParam; - - Do_Key_Event: - surface->ourevent.type = gr_event_key; - surface->eventToProcess = 1; - } - break; - - default: - return DefWindowProc( handle, mess, wParam, lParam ); - } - return 0; - } - - static int - gr_win32_device_init( void ) - { - WNDCLASS ourClass = { - /* UINT style */ 0, - /* WNDPROC lpfnWndProc */ Message_Process, - /* int cbClsExtra */ 0, - /* int cbWndExtra */ 0, - /* HANDLE hInstance */ 0, - /* HICON hIcon */ 0, - /* HCURSOR hCursor */ 0, - /* HBRUSH hbrBackground*/ 0, - /* LPCTSTR lpszMenuName */ NULL, - /* LPCTSTR lpszClassName*/ "FreeTypeTestGraphicDriver" - }; - - /* register window class */ - - ourClass.hInstance = GetModuleHandle( NULL ); - ourClass.hIcon = LoadIcon(0, IDI_APPLICATION); - ourClass.hCursor = LoadCursor(0, IDC_ARROW); - ourClass.hbrBackground= GetStockObject(BLACK_BRUSH); - - if ( RegisterClass(&ourClass) == 0 ) - return -1; - - /* add global atom */ - ourAtom = GlobalAddAtom( "FreeType.Surface" ); - - return 0; - } - - static void - gr_win32_device_done( void ) - { - GlobalDeleteAtom( ourAtom ); - } - - - grDevice gr_win32_device = - { - sizeof( grWin32Surface ), - "win32", - - gr_win32_device_init, - gr_win32_device_done, - - (grDeviceInitSurfaceFunc) gr_win32_surface_init, - - 0, - 0 - }; - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/win32/grwin32.h freetype-2.8/=unpacked-tar1=/graph/win32/grwin32.h --- freetype-2.7.1/=unpacked-tar1=/graph/win32/grwin32.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/win32/grwin32.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/******************************************************************* - * - * grwin32.h graphics driver for Win32 platform (header) - * - * This is the driver for displaying inside a window under Win32, - * used by the graphics utility of the FreeType test suite. - * - * Written by Antoine Leca. - * Copyright 1999-2000, 2001, 2002 by Antoine Leca, David Turner - * David Turner, Robert Wilhelm, and Werner Lemberg. - * - * Borrowing liberally from the other FreeType drivers. - * - * 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 GRWIN32_H_ -#define GRWIN32_H_ - -#include "grobjs.h" - - extern - grDevice gr_win32_device; - -#ifdef GR_INIT_BUILD - static - grDeviceChain gr_win32_device_chain = - { - "win32", - &gr_win32_device, - GR_INIT_DEVICE_CHAIN - }; - -#undef GR_INIT_DEVICE_CHAIN -#define GR_INIT_DEVICE_CHAIN &gr_win32_device_chain - -#endif /* GR_INIT_BUILD */ - -#endif /* GRWIN32_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/win32/Jamfile freetype-2.8/=unpacked-tar1=/graph/win32/Jamfile --- freetype-2.7.1/=unpacked-tar1=/graph/win32/Jamfile 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/win32/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# FreeType2 demos graph/win32 Jamfile (c) 2001 David Turner -# - -SubDir FT2DEMO_TOP graph win32 ; - -SubDirHdrs $(GRAPH_INCLUDE) ; - -if $(JAM_TOOLSET) = MINGW -{ - GRAPH_LINKLIBS = "-luser32 -lgdi32" ; -} -else -{ - GRAPH_LINKLIBS = user32.lib gdi32.lib ; -} - -Library $(GRAPH_LIB) : grwin32.c ; - -# end of graph/win32 Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/win32/rules.mk freetype-2.8/=unpacked-tar1=/graph/win32/rules.mk --- freetype-2.7.1/=unpacked-tar1=/graph/win32/rules.mk 2015-09-25 05:43:49.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/win32/rules.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -#************************************************************************** -#* -#* Win32 specific rules file, used to compile the Win32 graphics driver -#* to the graphics subsystem -#* -#************************************************************************** - -ifeq ($(PLATFORM),win32) - - # directory of the Win32 graphics driver - # - GR_WIN32 := $(GRAPH)/win32 - - # add the Win32 driver object file to the graphics library `graph.lib' - # - GRAPH_OBJS += $(OBJ_DIR_2)/grwin32.$O - - DEVICES += WIN32 - - # the rule used to compile the graphics driver - # - $(OBJ_DIR_2)/grwin32.$O: $(GR_WIN32)/grwin32.c $(GR_WIN32)/grwin32.h - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_WIN32)) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - - # now update COMPILE_GRAPH_LIB according to the compiler used on Win32 - # - ifeq ($(firstword $(CC)),gcc) # test for GCC - GRAPH_LINK += -luser32 -lgdi32 - endif - - ifeq ($(findstring $(CC),cl icl), $(CC)) # test for Visual C++ & Intel C++ - COMPILE_GRAPH_LIB = lib /nologo /out:$(subst /,$(COMPILER_SEP),$(GRAPH_LIB) $(GRAPH_OBJS)) - LINK = cl /nologo /MD /Fe$(subst /,$(COMPILER_SEP),$@ $< $(FTLIB)) - GRAPH_LINK += user32.lib gdi32.lib - endif - - ifeq ($(CC),lcc) # test for LCC-Win32 - COMPILE_GRAPH_LIB = lcclib /out:$(subst /,$(COMPILER_SEP),$(GRAPH_LIB) $(GRAPH_OBJS)) - LINK = lcclnk -o $(subst /,$(COMPILER_SEP),$@ $< $(FTLIB)) - GRAPH_LINK += user32.lib gdi32.lib - endif - - ifeq ($(CC),bcc32) # test for Borland C++ - COMPILE_GRAPH_LIB = tlib /u $(subst /,$(COMPILER_SEP),$(GRAPH_LIB) $(GRAPH_OBJS:%=+%)) - LINK = bcc32 -e$(subst /,$(COMPILER_SEP),$@ $< $(FTLIB)) - endif -endif - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/x11/grx11.c freetype-2.8/=unpacked-tar1=/graph/x11/grx11.c --- freetype-2.7.1/=unpacked-tar1=/graph/x11/grx11.c 2016-10-19 04:55:23.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/x11/grx11.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1598 +0,0 @@ -/******************************************************************* - * - * grx11.c graphics driver for X11. - * - * This is the driver for displaying inside a window under X11, - * used by the graphics utility of the FreeType test suite. - * - * Copyright 1999-2002, 2005, 2006, 2013 by Antoine Leca, - * 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. - * - ******************************************************************/ - -#ifdef __VMS -#include -#endif - -#include -#include - -#define xxTEST - -#ifdef TEST -#include "grfont.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "grx11.h" - - -#if defined( __cplusplus ) || defined( c_plusplus ) -#define Class c_class -#else -#define Class class -#endif - - /* old trick to determine 32-bit integer type */ -#include - - /* The number of bytes in an `int' type. */ -#if UINT_MAX == 0xFFFFFFFFUL -#define GR_SIZEOF_INT 4 -#elif UINT_MAX == 0xFFFFU -#define GR_SIZEOF_INT 2 -#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU -#define GR_SIZEOF_INT 8 -#else -#error "Unsupported number of bytes in `int' type!" -#endif - - /* The number of bytes in a `long' type. */ -#if ULONG_MAX == 0xFFFFFFFFUL -#define GR_SIZEOF_LONG 4 -#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU -#define GR_SIZEOF_LONG 8 -#else -#error "Unsupported number of bytes in `long' type!" -#endif - -#if GR_SIZEOF_INT == 4 -typedef int int32; -typedef unsigned int uint32; -#elif GR_SIZEOF_LONG == 4 -typedef long int32; -typedef unsigned long uint32; -#else -#error "could not find a 32-bit integer type" -#endif - - - typedef struct Translator - { - KeySym xkey; - grKey grkey; - - } Translator; - - - static - Translator key_translators[] = - { - { XK_BackSpace, grKeyBackSpace }, - { XK_Tab, grKeyTab }, - { XK_Return, grKeyReturn }, - { XK_Escape, grKeyEsc }, - { XK_Home, grKeyHome }, - { XK_Left, grKeyLeft }, - { XK_Up, grKeyUp }, - { XK_Right, grKeyRight }, - { XK_Down, grKeyDown }, - { XK_Page_Up, grKeyPageUp }, - { XK_Page_Down, grKeyPageDown }, - { XK_End, grKeyEnd }, - { XK_Begin, grKeyHome }, - { XK_F1, grKeyF1 }, - { XK_F2, grKeyF2 }, - { XK_F3, grKeyF3 }, - { XK_F4, grKeyF4 }, - { XK_F5, grKeyF5 }, - { XK_F6, grKeyF6 }, - { XK_F7, grKeyF7 }, - { XK_F8, grKeyF8 }, - { XK_F9, grKeyF9 }, - { XK_F10, grKeyF10 }, - { XK_F11, grKeyF11 }, - { XK_F12, grKeyF12 } - }; - - typedef XPixmapFormatValues XDepth; - - -#ifdef TEST -#define grAlloc malloc -#endif - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** PIXEL BLITTING SUPPORT *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - typedef struct grX11Blitter_ - { - unsigned char* src_line; - int src_pitch; - - unsigned char* dst_line; - int dst_pitch; - - int x; - int y; - int width; - int height; - - } grX11Blitter; - - - /* setup blitter; returns 1 if no drawing happens */ - static int - gr_x11_blitter_reset( grX11Blitter* blit, - grBitmap* source, - grBitmap* target, - int x, - int y, - int width, - int height ) - { - long pitch; - int delta; - - - /* clip rectangle to source bitmap */ - if ( x < 0 ) - { - width += x; - x = 0; - } - - delta = x + width - source->width; - if ( delta > 0 ) - width -= delta; - - if ( y < 0 ) - { - height += y; - y = 0; - } - - delta = y + height - source->rows; - if ( delta > 0 ) - height -= delta; - - /* clip rectangle to target bitmap */ - delta = x + width - target->width; - if ( delta > 0 ) - width -= delta; - - delta = y + height - target->rows; - if ( delta > 0 ) - height -= delta; - - if ( width <= 0 || height <= 0 ) - return 1; - - /* now, setup the blitter */ - pitch = blit->src_pitch = source->pitch; - - blit->src_line = source->buffer + y * pitch; - if ( pitch < 0 ) - blit->src_line -= ( source->rows - 1 ) * pitch; - - pitch = blit->dst_pitch = target->pitch; - - blit->dst_line = target->buffer + y * pitch; - if ( pitch < 0 ) - blit->dst_line -= ( target->rows - 1 ) * pitch; - - blit->x = x; - blit->y = y; - blit->width = width; - blit->height = height; - - return 0; - } - - - typedef void (*grX11ConvertFunc)( grX11Blitter* blit ); - - typedef struct grX11FormatRec_ - { - int x_depth; - int x_bits_per_pixel; - unsigned long x_red_mask; - unsigned long x_green_mask; - unsigned long x_blue_mask; - - grX11ConvertFunc rgb_convert; - grX11ConvertFunc gray_convert; - - } grX11Format; - - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR RGB565 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_rgb565( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 2; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned short* lwrite = (unsigned short*)line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite++ ) - { - unsigned int r = lread[0]; - unsigned int g = lread[1]; - unsigned int b = lread[2]; - - - lwrite[0] = (unsigned short)( ( ( r << 8 ) & 0xF800U ) | - ( ( g << 3 ) & 0x07E0 ) | - ( ( b >> 3 ) & 0x001F ) ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static void - gr_x11_convert_gray_to_rgb565( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x; - unsigned char* line_write = blit->dst_line + blit->x * 2; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned short* lwrite = (unsigned short*)line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread++, lwrite++ ) - { - unsigned int p = lread[0]; - - - lwrite[0] = (unsigned short)( ( ( p << 8 ) & 0xF800U ) | - ( ( p << 3 ) & 0x07E0 ) | - ( ( p >> 3 ) & 0x001F ) ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_rgb565 = - { - 16, 16, 0xF800U, 0x07E0, 0x001F, - gr_x11_convert_rgb_to_rgb565, - gr_x11_convert_gray_to_rgb565 - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR BGR565 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_bgr565( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 2; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned short* lwrite = (unsigned short*)line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite++ ) - { - unsigned int r = lread[0]; - unsigned int g = lread[1]; - unsigned int b = lread[2]; - - - lwrite[0] = (unsigned short)( ( ( b << 8 ) & 0xF800U ) | - ( ( g << 3 ) & 0x07E0 ) | - ( ( r >> 3 ) & 0x001F ) ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_bgr565 = - { - 16, 16, 0x001F, 0x07E0, 0xF800U, - gr_x11_convert_rgb_to_bgr565, - gr_x11_convert_gray_to_rgb565 /* the same for bgr565! */ - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR RGB555 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_rgb555( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 2; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned short* lwrite = (unsigned short*)line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite++ ) - { - unsigned int r = lread[0]; - unsigned int g = lread[1]; - unsigned int b = lread[2]; - - - lwrite[0] = (unsigned short)( ( ( r << 7 ) & 0x7C00 ) | - ( ( g << 2 ) & 0x03E0 ) | - ( ( b >> 3 ) & 0x001F ) ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static void - gr_x11_convert_gray_to_rgb555( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x; - unsigned char* line_write = blit->dst_line + blit->x * 2; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned short* lwrite = (unsigned short*)line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread++, lwrite++ ) - { - unsigned int p = lread[0]; - - - lwrite[0] = (unsigned short)( ( ( p << 7 ) & 0x7C00 ) | - ( ( p << 2 ) & 0x03E0 ) | - ( ( p >> 3 ) & 0x001F ) ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_rgb555 = - { - 15, 16, 0x7C00, 0x03E0, 0x001F, - gr_x11_convert_rgb_to_rgb555, - gr_x11_convert_gray_to_rgb555 - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR BGR555 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_bgr555( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 2; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned short* lwrite = (unsigned short*)line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite++ ) - { - unsigned int r = lread[0]; - unsigned int g = lread[1]; - unsigned int b = lread[2]; - - - lwrite[0] = (unsigned short)( ( ( b << 7 ) & 0x7C00 ) | - ( ( g << 2 ) & 0x03E0 ) | - ( ( r >> 3 ) & 0x001F ) ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_bgr555 = - { - 15, 16, 0x001F, 0x03E0, 0x7C00, - gr_x11_convert_rgb_to_bgr555, - gr_x11_convert_gray_to_rgb555 /* the same for bgr555! */ - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR RGB888 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_rgb888( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 3; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - memcpy( line_write, line_read, (unsigned int)( blit->width * 3 ) ); - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static void - gr_x11_convert_gray_to_rgb888( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x; - unsigned char* line_write = blit->dst_line + blit->x * 3; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread++, lwrite += 3 ) - { - unsigned char p = lread[0]; - - - lwrite[0] = p; - lwrite[1] = p; - lwrite[2] = p; - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_rgb888 = - { - 24, 24, 0xFF0000L, 0x00FF00U, 0x0000FF, - gr_x11_convert_rgb_to_rgb888, - gr_x11_convert_gray_to_rgb888 - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR BGR888 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_bgr888( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 3; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite += 3 ) - { - lwrite[0] = lread[2]; - lwrite[1] = lread[1]; - lwrite[2] = lread[0]; - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_bgr888 = - { - 24, 24, 0x0000FF, 0x00FF00U, 0xFF0000L, - gr_x11_convert_rgb_to_bgr888, - gr_x11_convert_gray_to_rgb888 /* the same for bgr888 */ - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR RGB8880 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_rgb8880( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 4; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite += 4 ) - { - uint32 r = lread[0]; - uint32 g = lread[1]; - uint32 b = lread[2]; - - - *(uint32*)lwrite = ( r << 24 ) | - ( g << 16 ) | - ( b << 8 ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static void - gr_x11_convert_gray_to_rgb8880( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x; - unsigned char* line_write = blit->dst_line + blit->x*4; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread ++, lwrite += 4 ) - { - uint32 p = lread[0]; - - - *(uint32*)lwrite = ( p << 24 ) | - ( p << 16 ) | - ( p << 8 ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_rgb8880 = - { - 24, 32, 0xFF000000UL, 0x00FF0000L, 0x0000FF00U, - gr_x11_convert_rgb_to_rgb8880, - gr_x11_convert_gray_to_rgb8880 - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR RGB0888 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_rgb0888( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 4; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite += 4 ) - { - uint32 r = lread[0]; - uint32 g = lread[1]; - uint32 b = lread[2]; - - - *(uint32*)lwrite = ( r << 16 ) | - ( g << 8 ) | - ( b << 0 ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static void - gr_x11_convert_gray_to_rgb0888( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x; - unsigned char* line_write = blit->dst_line + blit->x * 4; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread ++, lwrite += 4 ) - { - uint32 p = lread[0]; - - - *(uint32*)lwrite = ( p << 16 ) | - ( p << 8 ) | - ( p << 0 ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_rgb0888 = - { - 24, 32, 0x00FF0000L, 0x0000FF00U, 0x000000FF, - gr_x11_convert_rgb_to_rgb0888, - gr_x11_convert_gray_to_rgb0888 - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR BGR8880 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_bgr8880( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 4; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite += 4 ) - { - uint32 r = lread[0]; - uint32 g = lread[1]; - uint32 b = lread[2]; - - - *(uint32*)lwrite = ( r << 8 ) | - ( g << 16 ) | - ( b << 24 ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_bgr8880 = - { - 24, 32, 0x0000FF00U, 0x00FF0000L, 0xFF000000UL, - gr_x11_convert_rgb_to_bgr8880, - gr_x11_convert_gray_to_rgb8880 /* the same for bgr8880 */ - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** BLITTING ROUTINES FOR BGR0888 *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static void - gr_x11_convert_rgb_to_bgr0888( grX11Blitter* blit ) - { - unsigned char* line_read = blit->src_line + blit->x * 3; - unsigned char* line_write = blit->dst_line + blit->x * 4; - int h = blit->height; - - - for ( ; h > 0; h-- ) - { - unsigned char* lread = line_read; - unsigned char* lwrite = line_write; - int x = blit->width; - - - for ( ; x > 0; x--, lread += 3, lwrite += 4 ) - { - uint32 r = lread[0]; - uint32 g = lread[1]; - uint32 b = lread[2]; - - - *(uint32*)lwrite = ( r << 0 ) | - ( g << 8 ) | - ( b << 16 ); - } - - line_read += blit->src_pitch; - line_write += blit->dst_pitch; - } - } - - - static const grX11Format gr_x11_format_bgr0888 = - { - 24, 32, 0x000000FF, 0x0000FF00U, 0x00FF0000L, - gr_x11_convert_rgb_to_bgr0888, - gr_x11_convert_gray_to_rgb0888 /* the same for bgr0888 */ - }; - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** X11 DEVICE SUPPORT *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - static const grX11Format* gr_x11_formats[] = - { - &gr_x11_format_rgb565, - &gr_x11_format_bgr565, - &gr_x11_format_rgb555, - &gr_x11_format_bgr555, - &gr_x11_format_rgb888, - &gr_x11_format_bgr888, - &gr_x11_format_rgb0888, - &gr_x11_format_bgr0888, - &gr_x11_format_rgb8880, - &gr_x11_format_bgr8880, - NULL - }; - - typedef struct grX11DeviceRec_ - { - Display* display; - Cursor idle; - Cursor busy; - const grX11Format* format; - int scanline_pad; - Visual* visual; - - } grX11Device; - - - static grX11Device x11dev; - - - static void - gr_x11_device_done( void ) - { - if ( x11dev.display ) - { - XFreeCursor( x11dev.display, x11dev.busy ); - XFreeCursor( x11dev.display, x11dev.idle ); - - XCloseDisplay( x11dev.display ); - x11dev.display = NULL; - } - } - - - static int - gr_x11_device_init( void ) - { - memset( &x11dev, 0, sizeof ( x11dev ) ); - - XrmInitialize(); - - x11dev.display = XOpenDisplay( "" ); - if ( !x11dev.display ) - { - fprintf( stderr, "cannot open X11 display\n" ); - return -1; - } - - x11dev.idle = XCreateFontCursor( x11dev.display, XC_left_ptr ); - x11dev.busy = XCreateFontCursor( x11dev.display, XC_watch ); - - { - int count; - XDepth* format; - XDepth* formats; - XVisualInfo templ; - - templ.screen = DefaultScreen( x11dev.display ); - formats = XListPixmapFormats( x11dev.display, &count ); - -#ifdef TEST - printf( "available pixmap formats\n" ); - printf( "depth pixbits scanpad\n" ); -#endif /* TEST */ - - for ( format = formats; count > 0; count--, format++ ) - { -#ifdef TEST - printf( " %3d %3d %3d\n", - format->depth, - format->bits_per_pixel, - format->scanline_pad ); -#endif /* TEST */ - - /* note, the 32-bit modes return a depth of 24, */ - /* and 32 bits per pixel */ - switch ( format->depth ) - { - case 16: - case 24: - case 32: - { - int count2; - XVisualInfo* visual; - XVisualInfo* visuals; - - templ.depth = format->depth; - visuals = XGetVisualInfo( x11dev.display, - VisualScreenMask | VisualDepthMask, - &templ, - &count2 ); - - for ( visual = visuals; count2 > 0; count2--, visual++ ) - { -#ifdef TEST - const char* visualClass; - - switch ( visual->Class ) - { - case TrueColor: - visualClass = "TrueColor"; - break; - case DirectColor: - visualClass = "DirectColor"; - break; - case PseudoColor: - visualClass = "PseudoColor"; - break; - case StaticGray: - visualClass = "StaticGray"; - break; - case StaticColor: - visualClass = "StaticColor"; - break; - case GrayScale: - visualClass = "GrayScale"; - break; - default: - visualClass = "unknown"; - } - - printf( "> RGB %04lx:%04lx:%04lx, colors %3d, bits %2d %s\n", - visual->red_mask, - visual->green_mask, - visual->blue_mask, - visual->colormap_size, - visual->bits_per_rgb, - visualClass ); -#endif /* TEST */ - - /* compare to the list of supported formats */ - { - const grX11Format** pcur_format = gr_x11_formats; - const grX11Format* cur_format; - - - for (;;) - { - cur_format = *pcur_format++; - if ( cur_format == NULL ) - break; - - if ( format->depth == cur_format->x_depth && - format->bits_per_pixel == cur_format->x_bits_per_pixel && - visual->red_mask == cur_format->x_red_mask && - visual->green_mask == cur_format->x_green_mask && - visual->blue_mask == cur_format->x_blue_mask ) - { - x11dev.format = cur_format; - x11dev.scanline_pad = format->scanline_pad; - x11dev.visual = visual->visual; - - XFree( visuals ); - XFree( formats ); - return 0; - } - } - } - } /* for visuals */ - - XFree( visuals ); - } - break; - - default: - ; - } /* switch format depth */ - } /* for formats */ - XFree( formats ); - } - - fprintf( stderr, "unsupported X11 display depth!\n" ); - - return -1; - } - - - /************************************************************************/ - /************************************************************************/ - /***** *****/ - /***** X11 SURFACE SUPPORT *****/ - /***** *****/ - /************************************************************************/ - /************************************************************************/ - - typedef struct grX11Surface_ - { - grSurface root; - Display* display; - Window win; - Visual* visual; - Colormap colormap; - GC gc; - int depth; - XImage* ximage; - grBitmap ximage_bitmap; - - const grX11Format* format; - grX11ConvertFunc convert; - - int win_org_x, win_org_y; - int win_width, win_height; - int image_width, image_height; - - char key_buffer[10]; - int key_cursor; - int key_number; - - } grX11Surface; - - - /* close a given window */ - static void - gr_x11_surface_done( grX11Surface* surface ) - { - Display* display = surface->display; - - - if ( display ) - { - XFreeGC( display, surface->gc ); - - if ( surface->ximage ) - { - XDestroyImage( surface->ximage ); - surface->ximage = 0; - } - - if ( surface->win ) - { - XUnmapWindow( display, surface->win ); - surface->win = 0; - } - } - } - - - static void - gr_x11_surface_refresh_rect( grX11Surface* surface, - int x, - int y, - int w, - int h ) - { - grX11Blitter blit; - - - if ( !gr_x11_blitter_reset( &blit, &surface->root.bitmap, - &surface->ximage_bitmap, - x, y, w, h ) ) - { - surface->convert( &blit ); - - XPutImage( surface->display, - surface->win, - surface->gc, - surface->ximage, - blit.x, blit.y, - blit.x, blit.y, - (unsigned int)blit.width, (unsigned int)blit.height ); - } - } - - - static void - gr_x11_surface_refresh( grX11Surface* surface ) - { - gr_x11_surface_refresh_rect( surface, 0, 0, - surface->root.bitmap.width, - surface->root.bitmap.rows ); - } - - - static void - gr_x11_surface_set_title( grX11Surface* surface, - const char* title ) - { - XStoreName( surface->display, surface->win, title ); - } - - - static grKey - KeySymTogrKey( KeySym key ) - { - grKey k; - int count = sizeof ( key_translators ) / - sizeof( key_translators[0] ); - Translator* trans = key_translators; - Translator* limit = trans + count; - - - k = grKeyNone; - - while ( trans < limit ) - { - if ( trans->xkey == key ) - { - k = trans->grkey; - break; - } - trans++; - } - - return k; - } - - - static void - gr_x11_surface_listen_event( grX11Surface* surface, - int event_mask, - grEvent* grevent ) - { - XEvent x_event; - KeySym key; - Display* display = surface->display; - - int bool_exit; - grKey grkey; - - XComposeStatus compose; - - /* XXX: for now, ignore the event mask, and only exit when */ - /* a key is pressed */ - (void)event_mask; - - bool_exit = surface->key_cursor < surface->key_number; - - XDefineCursor( display, surface->win, x11dev.idle ); - - while ( !bool_exit ) - { - XNextEvent( display, &x_event ); - - switch ( x_event.type ) - { - case KeyPress: - surface->key_number = XLookupString( &x_event.xkey, - surface->key_buffer, - sizeof ( surface->key_buffer ), - &key, - &compose ); - surface->key_cursor = 0; - - if ( surface->key_number == 0 || - key > 512 ) - { - /* this may be a special key like F1, F2, etc. */ - grkey = KeySymTogrKey( key ); - if ( grkey != grKeyNone ) - goto Set_Key; - } - else - bool_exit = 1; - break; - - case MappingNotify: - XRefreshKeyboardMapping( &x_event.xmapping ); - break; - - case Expose: -#if 1 - /* we don't need to convert the bits on each expose! */ - XPutImage( surface->display, - surface->win, - surface->gc, - surface->ximage, - x_event.xexpose.x, - x_event.xexpose.y, - x_event.xexpose.x, - x_event.xexpose.y, - (unsigned int)x_event.xexpose.width, - (unsigned int)x_event.xexpose.height ); -#else - gr_x11_surface_refresh_rectangle( surface, - x_event.xexpose.x, - x_event.xexpose.y, - x_event.xexpose.width, - x_event.xexpose.height ); -#endif - break; - - /* You should add more cases to handle mouse events, etc. */ - } - } - - XDefineCursor( display, surface->win, x11dev.busy ); - XFlush ( display ); - - /* now, translate the keypress to a grKey; */ - /* if this wasn't part of the simple translated keys, */ - /* simply get the charcode from the character buffer */ - grkey = grKEY( surface->key_buffer[surface->key_cursor++] ); - - Set_Key: - grevent->type = gr_key_down; - grevent->key = grkey; - } - - - static int - gr_x11_surface_init( grX11Surface* surface, - grBitmap* bitmap ) - { - Display* display; - int screen; - grBitmap* pximage = &surface->ximage_bitmap; - const grX11Format* format; - - - surface->key_number = 0; - surface->key_cursor = 0; - surface->display = display = x11dev.display; - - screen = DefaultScreen( display ); - - surface->depth = x11dev.format->x_depth; - surface->visual = x11dev.visual; - - surface->format = format = x11dev.format; - surface->root.bitmap = *bitmap; - - switch ( bitmap->mode ) - { - case gr_pixel_mode_rgb24: - surface->convert = format->rgb_convert; - break; - - case gr_pixel_mode_gray: - /* we only support 256-gray level 8-bit pixmaps */ - if ( bitmap->grays == 256 ) - { - surface->convert = format->gray_convert; - break; - } - - default: - /* we don't support other modes */ - return 0; - } - - /* allocate surface image */ - { - int bits, over; - - - bits = bitmap->width * format->x_bits_per_pixel; - over = bits % x11dev.scanline_pad; - - if ( over ) - bits += x11dev.scanline_pad - over; - - pximage->pitch = bits >> 3; - pximage->width = bitmap->width; - pximage->rows = bitmap->rows; - } - - pximage->buffer = (unsigned char*)grAlloc( - (unsigned long)( pximage->pitch * pximage->rows ) ); - if ( !pximage->buffer ) - return 0; - - /* create the bitmap */ - if ( grNewBitmap( bitmap->mode, - bitmap->grays, - bitmap->width, - bitmap->rows, - bitmap ) ) - return 0; - - surface->root.bitmap = *bitmap; - - /* Now create the surface X11 image */ - surface->ximage = XCreateImage( display, - surface->visual, - (unsigned int)format->x_depth, - ZPixmap, - 0, - (char*)pximage->buffer, - (unsigned int)pximage->width, - (unsigned int)pximage->rows, - x11dev.scanline_pad, - 0 ); - if ( !surface->ximage ) - return 0; - - { - XColor color, dummy; - XTextProperty xtp; - XSizeHints xsh; - XSetWindowAttributes xswa; - unsigned long xswa_mask = CWBackPixel | CWEventMask | CWCursor; - - pid_t pid; - Atom NET_WM_PID; - - - xswa.border_pixel = BlackPixel( display, screen ); - - if (surface->visual == DefaultVisual( display, screen ) ) - { - xswa.background_pixel = WhitePixel( display, screen ); - surface->colormap = DefaultColormap( display, screen ); - } - else - { - xswa_mask |= CWColormap | CWBorderPixel; - xswa.colormap = XCreateColormap( display, - RootWindow( display, screen ), - surface->visual, - AllocNone ); - XAllocNamedColor( display, xswa.colormap, "white", &color, &dummy ); - xswa.background_pixel = color.pixel; - surface->colormap = xswa.colormap; - } - - xswa.cursor = x11dev.busy; - - xswa.event_mask = KeyPressMask | ExposureMask; - - surface->win = XCreateWindow( display, - RootWindow( display, screen ), - 0, - 0, - (unsigned int)bitmap->width, - (unsigned int)bitmap->rows, - 10, - format->x_depth, - InputOutput, - surface->visual, - xswa_mask, - &xswa ); - - XMapWindow( display, surface->win ); - - surface->gc = XCreateGC( display, surface->win, - 0L, NULL ); - XSetForeground( display, surface->gc, xswa.border_pixel ); - XSetBackground( display, surface->gc, xswa.background_pixel ); - - /* make window manager happy :-) */ - xtp.value = (unsigned char*)"FreeType"; - xtp.encoding = 31; - xtp.format = 8; - xtp.nitems = strlen( (char*)xtp.value ); - - xsh.x = 0; - xsh.y = 0; - - xsh.width = bitmap->width; - xsh.height = bitmap->rows; - xsh.flags = PPosition | PSize; - xsh.flags = 0; - - XSetWMProperties( display, surface->win, &xtp, &xtp, - NULL, 0, &xsh, NULL, NULL ); - - pid = getpid(); - NET_WM_PID = XInternAtom( display, "_NET_WM_PID", False ); - XChangeProperty( display, surface->win, NET_WM_PID, - XA_CARDINAL, 32, PropModeReplace, - (unsigned char *)&pid, 1 ); - } - - surface->root.done = (grDoneSurfaceFunc)gr_x11_surface_done; - surface->root.refresh_rect = (grRefreshRectFunc)gr_x11_surface_refresh_rect; - surface->root.set_title = (grSetTitleFunc) gr_x11_surface_set_title; - surface->root.listen_event = (grListenEventFunc)gr_x11_surface_listen_event; - - gr_x11_surface_refresh( surface ); - - return 1; - } - - - grDevice gr_x11_device = - { - sizeof( grX11Surface ), - "x11", - - gr_x11_device_init, - gr_x11_device_done, - - (grDeviceInitSurfaceFunc) gr_x11_surface_init, - - 0, - 0 - }; - - -#ifdef TEST - - typedef struct grKeyName - { - grKey key; - const char* name; - - } grKeyName; - - - static const grKeyName key_names[] = - { - { grKeyF1, "F1" }, - { grKeyF2, "F2" }, - { grKeyF3, "F3" }, - { grKeyF4, "F4" }, - { grKeyF5, "F5" }, - { grKeyF6, "F6" }, - { grKeyF7, "F7" }, - { grKeyF8, "F8" }, - { grKeyF9, "F9" }, - { grKeyF10, "F10" }, - { grKeyF11, "F11" }, - { grKeyF12, "F12" }, - { grKeyEsc, "Esc" }, - { grKeyHome, "Home" }, - { grKeyEnd, "End" }, - - { grKeyPageUp, "Page_Up" }, - { grKeyPageDown, "Page_Down" }, - { grKeyLeft, "Left" }, - { grKeyRight, "Right" }, - { grKeyUp, "Up" }, - { grKeyDown, "Down" }, - { grKeyBackSpace, "BackSpace" }, - { grKeyReturn, "Return" } - }; - - -#if 0 - int - main( void ) - { - grSurface* surface; - int n; - - - grInit(); - surface = grNewScreenSurface( 0, gr_pixel_mode_gray, 320, 400, 128 ); - if ( !surface ) - Panic( "Could not create window\n" ); - else - { - grColor color; - grEvent event; - const char* string; - int x; - - - grSetSurfaceRefresh( surface, 1 ); - grSetTitle( surface, "X11 driver demonstration" ); - - for ( x = -10; x < 10; x++ ) - { - for ( n = 0; n < 128; n++ ) - { - color.value = ( n * 3 ) & 127; - grWriteCellChar( surface, - x + ( ( n % 60 ) << 3 ), - 80 + ( x + 10 ) * 8 * 3 + ( ( n / 60 ) << 3 ), - n, color ); - } - } - - color.value = 64; - grWriteCellString( surface, 0, 0, "just an example", color ); - - do - { - listen_event( (grXSurface*)surface, 0, &event ); - - /* return if ESC was pressed */ - if ( event.key == grKeyEsc ) - return 0; - - /* otherwise, display key name */ - color.value = ( color.value + 8 ) & 127; - { - int count = sizeof ( key_names ) / sizeof ( key_names[0] ); - grKeyName* name = key_names; - grKeyName* limit = name + count; - const char* kname = 0; - char kname_temp[16]; - - - while ( name < limit ) - { - if ( name->key == event.key ) - { - kname = name->name; - break; - } - name++; - } - - if ( !kname ) - { - sprintf( kname_temp, "char '%c'", (char)event.key ); - kname = kname_temp; - } - - grWriteCellString( surface, 30, 30, kname, color ); - grRefreshSurface( surface ); - paint_rectangle( surface, 0, 0, - surface->bitmap.width, surface->bitmap.rows ); - } - } while ( 1 ); - } - - return 0; - } -#endif /* O */ -#endif /* TEST */ - - -/* END */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/x11/grx11.h freetype-2.8/=unpacked-tar1=/graph/x11/grx11.h --- freetype-2.7.1/=unpacked-tar1=/graph/x11/grx11.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/x11/grx11.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/******************************************************************* - * - * grx11.h graphics driver for X11 (header) - * - * This is the driver for displaying inside a window under X11, - * used by the graphics utility of the FreeType test suite. - * - * Copyright 1999-2000, 2001, 2002 by Antoine Leca, David Turner - * 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 GRX11_H_ -#define GRX11_H_ - -#ifdef __cplusplus -#define class c_class -#endif - -#include "grobjs.h" -#include "grdevice.h" - - extern - grDevice gr_x11_device; - -#ifdef GR_INIT_BUILD - static - grDeviceChain gr_x11_device_chain = - { - "x11", - &gr_x11_device, - GR_INIT_DEVICE_CHAIN - }; - -#undef GR_INIT_DEVICE_CHAIN -#define GR_INIT_DEVICE_CHAIN &gr_x11_device_chain - -#endif /* GR_INIT_BUILD */ - -#endif /* GRX11_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/x11/Jamfile freetype-2.8/=unpacked-tar1=/graph/x11/Jamfile --- freetype-2.7.1/=unpacked-tar1=/graph/x11/Jamfile 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/x11/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# FreeType2 demos graph/x11 Jamfile (c) 2001 David Turner -# - -SubDir FT2DEMO_TOP graph x11 ; - -SubDirHdrs $(GRAPH_INCLUDE) ; - -GRAPH_LINKLIBS = -lX11 -L/usr/X11R6/lib ; - -Library $(GRAPH_LIB) : grx11.c ; - -# end of graph/x11 Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/x11/rules.mk freetype-2.8/=unpacked-tar1=/graph/x11/rules.mk --- freetype-2.7.1/=unpacked-tar1=/graph/x11/rules.mk 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/x11/rules.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -#************************************************************************** -#* -#* X11-specific rules files, used to compile the X11 graphics driver -#* when supported by the current platform -#* -#************************************************************************** - - -######################################################################### -# -# Try to detect an X11 setup. -# -# We try to detect the following directories (in that order) in the current -# path: -# -# X11 (usually a symlink to the current release) -# X11R6 -# X11R5 -# -# If no success, we directly check the directories -# -# /usr -# /usr/X11R6 -# /usr/local/X11R6 -# -# whether they contain `include/X11/Xlib.h'. Note that the Makefile -# silently assumes that they will also contain `lib/X11/libX11.(a|so)'. -# -# If the variable X11_PATH is set (to specify unusual locations of X11), no -# other directory is searched. More than one directory must be separated -# with spaces. Example: -# -# make X11_PATH="/usr/openwin /usr/local/X11R6" -# -FT_PATH := $(subst ;, ,$(subst :, ,$(subst $(SEP),/,$(PATH)))) - -ifndef X11_PATH - ifneq ($(findstring X11/bin,$(FT_PATH)),) - xversion := X11 - else - ifneq ($(findstring X11R6/bin,$(FT_PATH)),) - xversion := X11R6 - else - ifneq ($(findstring X11R5/bin,$(FT_PATH)),) - xversion := X11R5 - endif - endif - endif - - ifdef xversion - X11_PATH := $(filter %$(xversion)/bin,$(FT_PATH)) - X11_PATH := $(X11_PATH:%/bin=%) - else - X11_DIRS := /usr /usr/X11R6 /usr/local/X11R6 - X11_XLIB := include/X11/Xlib.h - X11_PATH := $(foreach dir,$(X11_DIRS),$(wildcard $(dir)/$(X11_XLIB))) - X11_PATH := $(X11_PATH:%/$(X11_XLIB)=%) - endif -endif - - -########################################################################## -# -# Update some variables to compile the X11 graphics module. Note that -# X11 is available on Unix, or on OS/2. However, it only compiles with -# gcc on the latter platform, which is why it is safe to use the flags -# `-L' and `-l' in GRAPH_LINK. -# -ifneq ($(X11_PATH),) - - X11_INCLUDE := $(subst /,$(COMPILER_SEP),$(X11_PATH:%=%/include)) - X11_LIB := $(subst /,$(COMPILER_SEP),$(X11_PATH:%=%/lib64) \ - $(X11_PATH:%=%/lib)) - - # The GRAPH_LINK variable is expanded each time an executable is linked - # against the graphics library. - # - ifeq ($(PLATFORM),unix) - GRAPH_LINK += $(X11_LIB:%=-R%) - endif - GRAPH_LINK += $(X11_LIB:%=-L%) -lX11 - - # Solaris needs a -lsocket in GRAPH_LINK. - # - UNAME := $(shell uname) - ifneq ($(findstring $(UNAME),SunOS Solaris),) - GRAPH_LINK += -lsocket - endif - - - # Add the X11 driver object file to the graphics library. - # - GRAPH_OBJS += $(OBJ_DIR_2)/grx11.$(O) - - GR_X11 := $(GRAPH)/x11 - - DEVICES += X11 - - # the rule used to compile the X11 driver - # - $(OBJ_DIR_2)/grx11.$(O): $(GR_X11)/grx11.c $(GR_X11)/grx11.h - ifneq ($(LIBTOOL),) - $(LIBTOOL) --mode=compile $(CC) -static $(CFLAGS) \ - $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_X11)) \ - $(X11_INCLUDE:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - else - $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ - $I$(subst /,$(COMPILER_SEP),$(GR_X11)) \ - $(X11_INCLUDE:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - endif -endif - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/graph/xtest.c freetype-2.8/=unpacked-tar1=/graph/xtest.c --- freetype-2.7.1/=unpacked-tar1=/graph/xtest.c 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/graph/xtest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -#include "graph.h" -#include "grfont.h" /* dispara^itra bientot */ -#include - - -static -void Panic( const char* message ) -{ - fprintf( stderr, "PANIC: %s\n", message ); - exit(1); -} - - -typedef struct grKeyName -{ - grKey key; - const char* name; - -} grKeyName; - - -static -const grKeyName key_names[] = -{ - { grKeyF1, "F1" }, - { grKeyF2, "F2" }, - { grKeyF3, "F3" }, - { grKeyF4, "F4" }, - { grKeyF5, "F5" }, - { grKeyF6, "F6" }, - { grKeyF7, "F7" }, - { grKeyF8, "F8" }, - { grKeyF9, "F9" }, - { grKeyF10, "F10" }, - { grKeyF11, "F11" }, - { grKeyF12, "F12" }, - { grKeyEsc, "Esc" }, - { grKeyHome, "Home" }, - { grKeyEnd, "End" }, - - { grKeyPageUp, "Page_Up" }, - { grKeyPageDown, "Page_Down" }, - { grKeyLeft, "Left" }, - { grKeyRight, "Right" }, - { grKeyUp, "Up" }, - { grKeyDown, "Down" }, - { grKeyBackSpace, "BackSpace" }, - { grKeyReturn, "Return" } -}; - -int main( void ) -{ - grSurface* surface; - int n; - - grInit(); - surface = grNewScreenSurface( 0, gr_pixel_mode_gray, 320, 400, 128 ); - if (!surface) - Panic("Could not create window\n" ); - else - { - grColor color; - grEvent event; - const char* string; - int x; - - grSetSurfaceRefresh( surface, 1 ); - grSetTitle(surface,"X11 driver demonstration" ); - - for ( x = -10; x < 10; x++ ) - { - for ( n = 0; n < 128; n++ ) - { - color.value = (n*3) & 127; - grWriteCellChar( surface, - x + ((n % 60) << 3), - 80 + (x+10)*8*3 + ((n/60) << 3), n, color ); - } - - } - color.value = 64; - grWriteCellString( surface, 0, 0, "just an example", color ); - - do - { - grListenSurface( surface, 0, &event); - - /* return if ESC was pressed */ - if ( event.key == grKeyEsc ) - return 0; - - /* otherwise, display key string */ - color.value = (color.value + 8) & 127; - { - int count = sizeof(key_names)/sizeof(key_names[0]); - grKeyName* name = (grKeyName*)key_names; - grKeyName* limit = name + count; - const char* kname = 0; - char kname_temp[16]; - - while (name < limit) - { - if ( name->key == event.key ) - { - kname = (const char*)name->name; - break; - } - name++; - } - - if (!kname) - { - sprintf( kname_temp, "char '%c'", (char)event.key ); - kname = kname_temp; - } - - grWriteCellString( surface, 30, 30, kname, color ); - grRefreshSurface(surface); - } - } while (1); - } - - return 0; -} - diff -Nru freetype-2.7.1/=unpacked-tar1=/Jamfile freetype-2.8/=unpacked-tar1=/Jamfile --- freetype-2.7.1/=unpacked-tar1=/Jamfile 2015-09-25 05:38:49.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# FreeType2 demos top Jamfile (c) 2001 David Turner -# - -if $(FT2DEMO_TOP) != $(DOT) -{ - SubDir FT2DEMO_TOP ; -} - -# compile FreeType library here! -# -FT2_TOP ?= ../freetype2 ; - -SubInclude FT2_TOP ; - -FT2DEMO_SRC = [ FT2DEMO_SubDir src ] ; -FT2DEMO_GRAPH = [ FT2DEMO_SubDir graph ] ; - -# Include Graph sub-system rules -# -SubInclude FT2DEMO_GRAPH ; - -# Include demos rules -# -SubInclude FT2DEMO_SRC ; - - -# end of top Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/Jamrules freetype-2.8/=unpacked-tar1=/Jamrules --- freetype-2.7.1/=unpacked-tar1=/Jamrules 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/Jamrules 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -# FreeType 2 Demos JamRules (c) 2001 David Turner -# -# This file contains the Jam rules needed to build the FreeType 2 Demos. -# It is shared by all Jamfiles and is included only once in the build -# process. -# - - -# Determine prefix of library file. We must use "libxxxxx" on Unix systems, -# while all other simply use the real name. -# -if $(UNIX) -{ - LIBPREFIX ?= lib ; -} -else -{ - LIBPREFIX ?= "" ; -} - - -FT2_TOP ?= [ FDirName $(DOTDOT) freetype2 ] ; - -# FT2_INCLUDE contains the location of the public FreeType 2 header files -# it is ../freetype2/include by default -# -FT2_INCLUDE ?= [ FDirName $(FT2_TOP) include ] ; - - -# FT2_LIB contains the path to the FreeType 2 library object -# -FT2_LIB ?= [ FDirName $(FT2_TOP) objs $(LIBPREFIX)freetype$(SUFLIB) ] ; - -# X11_LINKLIBS is only used when compiling the X11 graphics back-end -# this should be generated from a "configure" script on Unix -# -X11_LINKLIBS = -lX11 -L/usr/X11R6/lib ; - - -# FT2DEMO_TOP contains the location of the FreeType demos directory. -# -FT2DEMO_TOP ?= $(DOT) ; - - -# Define a new rule used to declare a sub directory of the Nirvana source -# tree. -# -rule FT2DEMO_SubDir -{ - if $(FT2DEMO_TOP) = $(DOT) - { - return [ FDirName $(<) ] ; - } - else - { - return [ FDirName $(FT2DEMO_TOP) $(<) ] ; - } -} - -# We also set ALL_LOCATE_TARGET in order to place all object and library -# files in "objs". -# -ALL_LOCATE_TARGET ?= [ FT2DEMO_SubDir objs ] ; - - -# end of Jamrules diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/ascii2mpw.py freetype-2.8/=unpacked-tar1=/mac/ascii2mpw.py --- freetype-2.7.1/=unpacked-tar1=/mac/ascii2mpw.py 2015-09-25 05:40:31.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/ascii2mpw.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#!/usr/bin/env python -import sys -import string - -if len( sys.argv ) == 1 : - for asc_line in sys.stdin.readlines(): - mpw_line = string.replace(asc_line, "\\xA5", "\245") - mpw_line = string.replace(mpw_line, "\\xB6", "\266") - mpw_line = string.replace(mpw_line, "\\xC4", "\304") - mpw_line = string.replace(mpw_line, "\\xC5", "\305") - mpw_line = string.replace(mpw_line, "\\xFF", "\377") - mpw_line = string.replace(mpw_line, "\n", "\r") - mpw_line = string.replace(mpw_line, "\\n", "\n") - sys.stdout.write(mpw_line) -elif sys.argv[1] == "-r" : - for mpw_line in sys.stdin.readlines(): - asc_line = string.replace(mpw_line, "\n", "\\n") - asc_line = string.replace(asc_line, "\r", "\n") - asc_line = string.replace(asc_line, "\245", "\\xA5") - asc_line = string.replace(asc_line, "\266", "\\xB6") - asc_line = string.replace(asc_line, "\304", "\\xC4") - asc_line = string.replace(asc_line, "\305", "\\xC5") - asc_line = string.replace(asc_line, "\377", "\\xFF") - sys.stdout.write(asc_line) diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/codewarrior/carbonprefix.h freetype-2.8/=unpacked-tar1=/mac/codewarrior/carbonprefix.h --- freetype-2.7.1/=unpacked-tar1=/mac/codewarrior/carbonprefix.h 2016-01-13 11:00:32.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/codewarrior/carbonprefix.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#define USING_CARBON - -#include "ftoption.h" \ No newline at end of file Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/=unpacked-tar1=/mac/codewarrior/ftlint.prj and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/=unpacked-tar1=/mac/codewarrior/ftlint.prj differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/=unpacked-tar1=/mac/codewarrior/ftview.prj and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/=unpacked-tar1=/mac/codewarrior/ftview.prj differ diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/ftlint_m.c freetype-2.8/=unpacked-tar1=/mac/ftlint_m.c --- freetype-2.7.1/=unpacked-tar1=/mac/ftlint_m.c 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/ftlint_m.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* minimal Mac wrapper for the ftlint.c program */ - - -int original_main( int argc, char** argv ); - -/* We rename the original main() program to original_main, - so we can provide a wrapper around it */ -#define main original_main -#include "ftlint.c" -#undef main - - -#define PPEM "24" /* hard-code the ppem size */ - - -#include -#include "getargv.h" -#include -#include -#include -#include - -static void -init_toolbox() -{ - InitGraf(&qd.thePort); - InitFonts(); - InitWindows(); - TEInit(); - InitDialogs((long)0); - InitMenus(); - InitCursor(); - SIOUXSettings.asktosaveonclose = 0; -} - -int main() -{ - int argc, i; - char** argv; - - init_toolbox(); - - /* put paths of all files dropped onto the app into argv */ - argc = FTMac_GetArgv(&argv); - if (argc < 2) - { - printf("Please drop one or more font files onto the app (but quit first!)\n"); - exit(1); - } - /* move argv[1:] to argv[2:] and fill in the ppem arg */ - for (i = argc; i > 1; i--) - { - argv[i] = argv[i-1]; - } - argc++; - argv[1] = PPEM; - /* call the original main() program */ - original_main(argc, argv); -} diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/ftoldmac.c freetype-2.8/=unpacked-tar1=/mac/ftoldmac.c --- freetype-2.7.1/=unpacked-tar1=/mac/ftoldmac.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/ftoldmac.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,934 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000, 2003, 2004, 2005, 2006 by */ -/* suzuki toshiya, D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* ftoldmac - test program for MacOS specific API in ftmac.c */ -/* */ -/* */ -/****************************************************************************/ - - -#if defined(__GNUC__) && defined(__APPLE_CC__) -# include -# include -# include -# include -#else -# include -# include -# include -#endif - -#include -#include FT_FREETYPE_H -#include FT_SFNT_NAMES_H -#include FT_TRUETYPE_IDS_H - - /* the following header shouldn't be used in normal programs */ -#include FT_INTERNAL_DEBUG_H - - /* showing driver name */ -#include FT_MODULE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DRIVER_H - - /* FSSpec functions are deprecated since Mac OS X 10.4 */ -#ifndef HAVE_FSSPEC -#if defined( __LP64__ ) && !TARGET_CPU_68K && !TARGET_CPU_PPC && !TARGET_CPU_PPC64 -#define HAVE_FSSPEC 0 -typedef void FSSpec; -#else -#define HAVE_FSSPEC 1 -#endif -#endif - - /* most FSRef functions were introduced since Mac OS 9 */ -#ifndef HAVE_FSREF -#if TARGET_API_MAC_OSX -#define HAVE_FSREF 1 -#else -#define HAVE_FSREF 0 -typedef void FSRef; -#endif -#endif - - /* QuickDraw is deprecated since Mac OS X 10.4 */ -#ifndef HAVE_QUICKDRAW_CARBON -#if defined( __LP64__ ) && !TARGET_CPU_68K && !TARGET_CPU_PPC && !TARGET_CPU_PPC64 -#define HAVE_QUICKDRAW_CARBON 0 -#define HAVE_QUICKDRAW_TOOLBOX 0 -#elif TARGET_API_MAC_CARBON || TARGET_API_MAC_OSX -#define HAVE_QUICKDRAW_CARBON 1 -#define HAVE_QUICKDRAW_TOOLBOX 1 -#elif TARGET_API_MAC_OS8 -#define HAVE_QUICKDRAW_CARBON 0 -#define HAVE_QUICKDRAW_TOOLBOX 1 -#endif -#endif - - /* AppleTypeService is available since Mac OS X */ -#ifndef HAVE_ATS -#if TARGET_API_MAC_OSX -#define HAVE_ATS 1 -#else -#define HAVE_ATS 0 -#endif -#endif - -#include FT_MAC_H - -#undef FT_GetFile_From_Mac_Name -#undef FT_GetFile_From_Mac_ATS_Name -#undef FT_New_Face_From_FSSpec - -#include -#include -#include - -typedef enum -{ - FT_OldMac_Err_Unimplemented, - FT_OldMac_Err_TooLongFileName, - FT_OldMac_Err_FileNotFound, - FT_OldMac_Err_UnresolvableFontName, - FT_OldMac_Err_PseudoFontName, - FT_OldMac_Err_UnswappableFontID, - FT_OldMac_Err_TooLargeFaceIndex, - FT_OldMac_Err_Ok = 0 -} FT_OldMac_Err; - - -/* statics of font scanning */ -int num_scanned_fonts; -int num_opened_fonts; -int num_scanned_faces; -int num_opened_faces; - -/* setting for face scanning */ -int max_face_number; -Boolean force_scan_face; -char* font_listing_api; -char* font_resolve_api; -Boolean auto_suffix; - - -void initParamBlock( CInfoPBRec*, Str255 ); -void dumpPBErr( CInfoPBRec* ); -void crawlDir( CInfoPBRec*, char* ); -void crawlFontFile( char* ); -OSErr ftmac_FSPathMakeSpec( const UInt8*, FSSpec*, Boolean ); -OSErr ftmac_FSpMakePath( const FSSpec*, UInt8*, UInt32 ); - - -OSErr -ftmac_FSpMakePath( const FSSpec* spec_p, - UInt8* path, - UInt32 maxPathSize ) -{ - OSErr err; - FSSpec spec = *spec_p; - short vRefNum; - long dirID; - Str255 parDir_name; - - - FT_MEM_SET( path, 0, maxPathSize ); - while ( 1 ) - { - int child_namelen = ft_strlen( (char *)path ); - unsigned char node_namelen = spec.name[0]; - unsigned char* node_name = spec.name + 1; - - - if ( node_namelen + child_namelen > maxPathSize ) - return errFSNameTooLong; - - FT_MEM_MOVE( path + node_namelen + 1, path, child_namelen ); - FT_MEM_COPY( path, node_name, node_namelen ); - if ( child_namelen > 0 ) - path[ node_namelen ] = ':'; - - vRefNum = spec.vRefNum; - dirID = spec.parID; - parDir_name[0] = '\0'; - err = FSMakeFSSpec( vRefNum, dirID, parDir_name, &spec ); - if ( noErr != err || dirID == spec.parID ) - break; - } - return noErr; -} - - -void -dump_face_info( FT_Face face ) -{ - printf( "\t\tface_index=%d, face_flags=0x%08x, num_glyphs=%d\n", - (int)face->face_index, - (unsigned int)(face->face_flags), - (int)face->num_glyphs ); - printf( "\t\tnum_fixed_sizes=%d, style_flags=%d%d%d%d%d%d\n", - face->num_fixed_sizes, - ( (unsigned int)(face->style_flags) >> 5 ) & 1, - ( (unsigned int)(face->style_flags) >> 4 ) & 1, - ( (unsigned int)(face->style_flags) >> 3 ) & 1, - ( (unsigned int)(face->style_flags) >> 2 ) & 1, - ( (unsigned int)(face->style_flags) >> 1 ) & 1, - ( (unsigned int)(face->style_flags) ) & 1 - ); - printf("\t\tfamily_name=[%s], style_name=[%s]\n", - face->family_name, face->style_name ); -} - - -void -crawlFontFile( char* font_file_path ) -{ - FT_Library library; - FT_Face face; - int i, j; - FSSpec spec; - - - printf( "*** check font file [%s]\n", font_file_path ); - - if ( 0 != FT_Init_FreeType( &library ) ) - { - printf( "\tError: Could not initialize FreeType\n" ); - return; - } - - if ( noErr != ftmac_FSPathMakeSpec( (unsigned char const *)font_file_path, &spec, FALSE ) ) - { - printf( "\tError: Could not open File (MacOS API)\n" ); - return; - } - - face = NULL; - num_scanned_fonts ++; - if ( 0 != FT_New_Face_From_FSSpec( library, &spec, 0, &face ) ) - { - printf( "\tError: Could not open File (FreeType API)\n" ); - return; - } - - num_opened_fonts ++; - printf( "\tFont file has %d face\n", (int)face->num_faces ); - - - j = face->num_faces + max_face_number; - for ( i = 0; i < j; i++ ) - { - num_scanned_faces ++; - printf( "\tCheck Face #%d...", i ); - if ( 0 == FT_New_Face_From_FSSpec( library, &spec, i, &face ) ) - { - num_opened_faces ++; - printf( "Ok\n" ); - dump_face_info( face ); - FT_Done_Face( face ); - } - else - { - printf( "Failed\n" ); - if ( !force_scan_face ) - goto no_more_face; - } - } -no_more_face: - FT_Done_FreeType( library ); -} - - -void -crawlDir( CInfoPBRec* ci_pb_dir, - char* dir_path ) -{ - CInfoPBRec ci_pb; - char file_full_path[1024]; - int dirname_len; - int i; - - - printf( "ioVRefNum = 0x%04x, ioDrDirID = 0x%08x, ioDrParID= 0x%08x\n", - ci_pb_dir->dirInfo.ioVRefNum, - (unsigned int) ci_pb_dir->dirInfo.ioDrParID, - (unsigned int) ci_pb_dir->dirInfo.ioDrDirID ); - printf( "files in directory: %d\n", ci_pb_dir->dirInfo.ioDrNmFls ); - - - dirname_len = strlen( dir_path ); - strcpy( file_full_path, dir_path ); - if ( 0 < dirname_len && ':' != file_full_path[ dirname_len - 1 ] ) - dirname_len ++; - - file_full_path[ dirname_len - 1 ] = ':'; - - - for ( i = 0; i <= ci_pb_dir->dirInfo.ioDrNmFls; i ++ ) - { - Str255 fileName; - - - memset( &ci_pb, 0, sizeof( CInfoPBRec ) ); - fileName[0] = 0; - ci_pb.hFileInfo.ioVRefNum = ci_pb_dir->dirInfo.ioVRefNum; - ci_pb.hFileInfo.ioDirID = ci_pb_dir->dirInfo.ioDrDirID; - ci_pb.hFileInfo.ioNamePtr = fileName; - ci_pb.hFileInfo.ioFDirIndex = i; - if ( noErr == PBGetCatInfoSync( &ci_pb ) ) - { - if ( NULL != ci_pb.hFileInfo.ioNamePtr ) - { - char file_name[256]; - - - strncpy( file_name, (char *)ci_pb.hFileInfo.ioNamePtr + 1, ci_pb.hFileInfo.ioNamePtr[0] ); - file_name[ ci_pb.hFileInfo.ioNamePtr[0] ] = '\0'; - if ( 0 == strcmp( ".DS_Store", file_name ) ) - printf( "*** known non-font filename [%s]\n", file_name ); - else if ( 0 == ( ci_pb.hFileInfo.ioFlAttrib & ioDirMask ) ) - { - file_full_path[ dirname_len ] = '\0'; - strncat( file_full_path, file_name, sizeof( file_full_path ) ); - crawlFontFile( file_full_path ); - } - } - } - } -} - - -void -initParamBlock( CInfoPBRec* paramBlock, - Str255 fileName ) -{ - paramBlock->hFileInfo.ioCompletion = 0; /* synch calls */ - paramBlock->hFileInfo.ioNamePtr = fileName; - paramBlock->hFileInfo.ioVRefNum = 0; /* alias for default */ - paramBlock->hFileInfo.ioFDirIndex = 0; /* XXX */ - paramBlock->hFileInfo.ioDirID = 0; /* alias for default */ -} - -void -dumpPBErr( CInfoPBRec* paramBlock ) -{ - printf( "[PB access returned after " ); - switch ( paramBlock->hFileInfo.ioResult ) - { - case ioErr: - printf( "I/O Error" ); - break; - case fnOpnErr: - printf( "File not Open Error" ); - break; - case nsvErr: - printf( "No such volume Error" ); - break; - case fnfErr: - printf( "File not found Error" ); - break; - case rfNumErr: - printf( "Bad reference number Error" ); - break; - default: - printf( "unexpected err=%d", paramBlock->hFileInfo.ioResult ); - break; - } - printf( "]\n" ); -} - - -OSErr -ftmac_FSPathMakeSpec( const UInt8* pathname, - FSSpec* spec_p, - Boolean isDirectory ) -{ - const char *p, *q; - short vRefNum; - long dirID; - Str255 nodeName; - OSErr err; - - - FT_UNUSED( isDirectory ); - p = q = (const char *)pathname; - dirID = 0; - vRefNum = 0; - - while ( 1 ) - { - q = p + FT_MIN( 255, ft_strlen( (char const *)p ) ); - - if ( q == p ) - return 0; - - if ( 255 < ft_strlen( (char const *)pathname ) ) - { - while ( p < q && *q != ':' ) - q--; - } - - if ( p < q ) - nodeName[0] = q - p; - else if ( ft_strlen( (char const *)p ) < 256 ) - nodeName[0] = ft_strlen( p ); - else - return errFSNameTooLong; - - strncpy( (char *)nodeName + 1, (char *)p, nodeName[0] ); - nodeName[ nodeName[0] + 1 ] = '\0'; - err = FSMakeFSSpec( vRefNum, dirID, nodeName, spec_p ); - if ( err || '\0' == *q ) - return err; - - vRefNum = spec_p->vRefNum; - dirID = spec_p->parID; - - p = q + 1; - } -} - - -void -test_font_files( int argc, - char** argv ) -{ - int i; - - - for ( i = 1; i < argc; i++ ) - { - OSErr status; - CInfoPBRec paramBlock; - Str255 fileName; - - - /* XXX: should be skipped by better argument handler */ - if ( '-' == argv[i][0] && '-' == argv[i][1] ) - continue; - - - /* XXX: restrict pathname to legacy HFS limit for simplicity */ - if ( 254 < strlen( argv[i] ) ) - continue; - - fileName[0] = strlen( argv[i] ); - memcpy( fileName + 1, argv[i], fileName[0] ); - initParamBlock( ¶mBlock, fileName ); - status = PBGetCatInfoSync( ¶mBlock ); - if ( 0 > status ) - printf( "[PB access failed] error = %d\n", status ); - - - { - FSSpec spec; - Str255 volName; - int i; - - - strncpy( (char *)volName, (char *)fileName, fileName[0] ); - printf( "given file name [%s]", fileName + 1 ); - for ( i = 1; i < fileName[0] && ':' != fileName[i + 1]; i ++ ) - ; - volName[i + 1] = ':'; - volName[i + 2] = '\0'; - volName[0] = i + 1; - printf( "-> volume name [%s]", volName + 1 ); - status = FSMakeFSSpec( 0, 0, volName, &spec); - if ( noErr != status ) - printf( "FSMakeFSSpec(%s) error %d\n", volName, status ); - else - { - printf( "FSMakeFSSpec(%s) return volID = 0x%08x\n", volName + 1, spec.vRefNum ); - paramBlock.hFileInfo.ioVRefNum = spec.vRefNum; - } - } - - - if ( 0 != paramBlock.hFileInfo.ioResult ) - dumpPBErr( ¶mBlock ); - else if ( 0 != ( paramBlock.hFileInfo.ioFlAttrib & ioDirMask ) ) - crawlDir( ¶mBlock, argv[i] ); - else - crawlFontFile( argv[i] ); - } -} - - -void -print_help_and_exit() -{ - printf("\n" ); - printf(" ftoldmac [pathname in HFS syntax]\n" ); - printf("\n" ); - printf(" e.g. \"Macintosh HD:System Folder:Fonts:\"\n" ); - printf(" quotation is required to avoid shell expansion\n" ); - printf(" scan directory and open all font files in there\n" ); - printf("\n" ); - printf(" --max-face-number=N\n" ); - printf(" scan face until N instead of face->num_faces\n" ); - printf("\n" ); - printf(" --force-scan-face\n" ); - printf(" ignore the error to open face and continue to max face number\n" ); - printf("\n" ); - printf(" ftoldmac --font-listing-api=XXX --font-resolve-api=YYY\n" ); - printf("\n" ); - printf(" --font-listing-api={quickdraw_old|quickdraw|ats}\n" ); - printf(" specify API to list system font\n" ); - printf("\n" ); - printf(" --font-resolve-api={quickdraw|ats}\n" ); - printf(" specify API to find fontfile by fontname\n" ); - printf("\n" ); - printf(" --auto-suffix\n" ); - printf(" old QuickDraw API cannot list available style suffixes,\n" ); - printf(" this option adds Bold and Italic suffixes automatically.\n" ); - printf("\n" ); - printf(" available API:" ); -#if HAVE_QUICKDRAW_TOOLBOX - printf(" quickdraw_old" ); -#endif -#if HAVE_QUICKDRAW_CARBON - printf(" quickdraw" ); -#endif -#if HAVE_ATS - printf(" ats" ); -#endif - printf("\n" ); - printf("\n" ); - exit( 0 ); -} - - -void -verifyFMOutput( FMOutput* fmout ) -{ - OSErr err; - Handle font_handle; - short rsrcID; - ResType rsrcType; - Str255 rsrcName; - - - -#ifdef VERBOSE - printf( "FMOutput.boldPixels 0x%02x\n", fmout->boldPixels ); - printf( "FMOutput.italicPixels 0x%02x\n", fmout->italicPixels ); - printf( "FMOutput.ulOffset 0x%02x\n", fmout->ulOffset ); - printf( "FMOutput.ulShadow 0x%02x\n", fmout->ulShadow ); - printf( "FMOutput.ulThick 0x%02x\n", fmout->ulThick ); - printf( "FMOutput.shadowPixels 0x%02x\n", fmout->shadowPixels ); - printf( "FMOutput.extra 0x%02x\n", fmout->extra ); - printf( "FMOutput.curStyle 0x%02x\n", fmout->curStyle ); -#else - printf( "FMOutput.widMax:%d\n", fmout->widMax ); -#endif - - font_handle = fmout->fontHandle, - GetResInfo( font_handle, &rsrcID, &rsrcType, rsrcName ); - err = ResError(); - if ( 0 != err ) - printf( "could not get resource info for handle 0x%08x, err=%d\n", - (int)(fmout->fontHandle), err ); - else - printf( "resource: ID=0x%04x, Type=%c%c%c%c, name=%s\n", - rsrcID, - (int)MAX( (rsrcType >> 24) & 0xFF, 0x20 ), - (int)MAX( (rsrcType >> 16) & 0xFF, 0x20 ), - (int)MAX( (rsrcType >> 8) & 0xFF, 0x20 ), - (int)MAX( (rsrcType >> 0) & 0xFF, 0x20 ), - rsrcName[0] > 0 ? rsrcName + 1 : '\0' ); -} - - -FT_OldMac_Err -resolveToolBoxQuickDrawFontName( const char* font_name ) -{ -#if !HAVE_QUICKDRAW_TOOLBOX - printf( "cannot check [%s] by Toolbox QuickDraw\n", font_name ); - return FT_OldMac_Err_Unimplemented; -#else - Str255 familyName; - SInt16 familyID; - FMInput lookup_inst; - FMOutput* lookup_rslt; - - - ft_strncpy( (char*)familyName + 1, (char*)font_name, 254 ); - familyName[0] = strlen( (char *)familyName + 1 ); - GetFNum( familyName, &familyID ); - if ( 0 > familyID ) - { - printf( "familyName %s is unresolvable\n", familyName + 1 ); - return FT_OldMac_Err_UnresolvableFontName; - } - else if ( 0 == familyID ) - return FT_OldMac_Err_PseudoFontName; - - printf( "familyName %s:%d -> familyID 0x%04x: -> ", - familyName + 1, familyName[0], - familyID ); - - bzero( &lookup_inst, sizeof( FMInput ) ); - lookup_inst.family = familyID; - lookup_inst.size = 14; - lookup_inst.face = 0; - lookup_inst.needBits = FALSE; - lookup_inst.device = 0; - lookup_inst.numer.v = 1; - lookup_inst.numer.h = 1; - lookup_inst.denom.v = 1; - lookup_inst.denom.h = 1; - - lookup_rslt = FMSwapFont( &lookup_inst ); - if ( NULL == lookup_rslt ) - { - printf( "FMSwapFont returns NULL (unresolved)\n" ); - return FT_OldMac_Err_UnswappableFontID; - } - else - verifyFMOutput( lookup_rslt ); - return FT_OldMac_Err_Ok; -#endif -} - - -void -test_face_quickdraw( char* face_name, - FT_Library library ) -{ -#if !HAVE_QUICKDRAW_CARBON - printf( "cannot check [%s] by Carbon QuickDraw\n", face_name ); -#else - FSSpec spec; - UInt8 font_file_path[1024]; - FT_Long face_index; - FT_Face face; - - - printf( "Lookup [%s]...", face_name ); - if ( 0 != FT_GetFile_From_Mac_Name( face_name, &spec, &face_index ) ) - { - printf( "FreeType could not find font file\n" ); - return; - } - - ftmac_FSpMakePath( &spec, font_file_path, 1024 ); - printf( "Font file found [%s], face #%d...", font_file_path, (int)face_index ); - if ( 0 != FT_New_Face_From_FSSpec( library, &spec, face_index, &face ) ) - { - printf( "FreeType could not load font file\n" ); - return; - } - printf( "Ok\n" ); - - num_opened_faces ++; - dump_face_info( face ); - FT_Done_Face( face ); -#endif -} - - -void -test_face_ats( char* face_name, - FT_Library library ) -{ -#if !HAVE_ATS - FT_UNUSED( library ); - printf( "cannot check [%s] by ATS\n", face_name ); -#else - UInt8 font_file_path[1024]; - FT_Long face_index; - FT_Face face; - FSSpec spec; - - - printf( "Lookup [%s]...", face_name ); - if ( 0 != FT_GetFile_From_Mac_ATS_Name( face_name, &spec, &face_index ) ) - { - printf( "FreeType could not find font file\n" ); - return; - } - - ftmac_FSpMakePath( &spec, font_file_path, 1024 ); - - printf( "Font file found [%s], face #%d...", font_file_path, (int)face_index ); - - if ( 0 != FT_New_Face_From_FSSpec( library, &spec, face_index, &face ) ) - { - printf( "FreeType could not load font file\n" ); - return; - } - printf( "Ok\n" ); - - num_opened_faces ++; - dump_face_info( face ); - FT_Done_Face( face ); -#endif -} - - -void -test_face( char* face_name, - FT_Library library ) -{ - num_scanned_faces ++; - if ( 0 == ft_strcmp( font_resolve_api, "quickdraw" ) ) - test_face_quickdraw( face_name, library ); - else if ( 0 == ft_strcmp( font_resolve_api, "ats" ) ) - test_face_ats( face_name, library ); - else - { - printf( "invalid api name to resolve [%s]\n", font_resolve_api ); - exit( -1 ); - } -} - - -void -test_font_list_quickdraw_old( FT_Library library ) -{ -#if !HAVE_QUICKDRAW_TOOLBOX - FT_UNUSED( library ); - printf( "FreeType2 is configured without quickdraw_old (Toolbox QuickDraw)\n" ); -#else - Str255 fmo_family_name; - char fmo_face_name[1024]; - int i; - - - for ( i = 0; i < 0x7FFF; i++ ) - { - GetFontName( i, fmo_family_name ); - if ( 0 < fmo_family_name[0] ) - { - fmo_family_name[ fmo_family_name[0] + 1 ] = '\0'; - - ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); - test_face( fmo_face_name, library ); - - if ( !auto_suffix ) - continue; - - ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); - strncat( (char *)fmo_face_name, " Bold", 1024 ); - printf( "+ " ); - test_face( fmo_face_name, library ); - - ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); - strncat( (char *)fmo_face_name, " Italic", 1024 ); - printf( "+ " ); - test_face( fmo_face_name, library ); - - ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); - strncat( (char *)fmo_face_name, " Bold Italic", 1024 ); - printf( "+ " ); - test_face( fmo_face_name, library ); - } - } -#endif -} - - -char* -make_style_suffix( char* fm_style_name, - FMFontStyle fm_style ) -{ - fm_style_name[0] = ' '; - fm_style_name[1] = '\0'; - if ( fm_style & bold ) strcat( fm_style_name, "Bold " ); - if ( fm_style & italic ) strcat( fm_style_name, "Italic " ); - if ( fm_style & underline ) strcat( fm_style_name, "Underline " ); - if ( fm_style & outline ) strcat( fm_style_name, "Outline " ); - if ( fm_style & shadow ) strcat( fm_style_name, "Shadow " ); - if ( fm_style & condense ) strcat( fm_style_name, "Condense " ); - if ( fm_style & extend ) strcat( fm_style_name, "Extend " ); - if ( ft_strlen( fm_style_name ) > 0 ) - fm_style_name[ strlen( fm_style_name) - 1 ] = '\0'; - - return fm_style_name; -} - - -void -test_font_list_quickdraw( FT_Library library ) -{ -#if !HAVE_QUICKDRAW_CARBON - FT_UNUSED( library ); - printf( "FreeType2 is configured without quickdraw (Carbon QuickDraw)\n" ); -#else - FMFontFamilyIterator fm_family_iter; - FMFontFamily fm_family; - Str255 fm_family_namestr; - char fm_family_name[1024]; - - FMFontFamilyInstanceIterator fm_font_iter; - FMFont fm_font; - FMFontStyle fm_style; - FMFontSize fm_size; - char fm_style_name[1024]; - - - - if ( 0 != FMCreateFontFamilyIterator( NULL, NULL, - kFMUseGlobalScopeOption, - &fm_family_iter ) ) - return; - -get_quickdraw_font_family: - if ( 0 == FMGetNextFontFamily( &fm_family_iter, &fm_family ) ) - { - if ( 0 == FMCreateFontFamilyInstanceIterator( fm_family, &fm_font_iter ) ) - { -get_quickdraw_font_instance: - if ( 0 == FMGetNextFontFamilyInstance( &fm_font_iter, &fm_font, &fm_style, &fm_size ) ) - { - if ( 0 == fm_size ) - { - FMGetFontFamilyName( fm_family, fm_family_namestr ); - CopyPascalStringToC( fm_family_namestr, fm_family_name ); - strcat( fm_family_name, make_style_suffix( fm_style_name, fm_style ) ); - test_face( fm_family_name, library ); - } - goto get_quickdraw_font_instance; - } - else - { - FMDisposeFontFamilyInstanceIterator( &fm_font_iter ); - goto get_quickdraw_font_family; - } - } - else - goto get_quickdraw_font_family; - } - - FMDisposeFontFamilyIterator( &fm_family_iter ); - return; -#endif -} - - -void -test_font_list_ats( FT_Library library ) -{ -#if !HAVE_ATS - FT_UNUSED( library ); - printf( "FreeType2 is configured without ats (AppleTypeService)\n" ); -#else - ATSFontIterator ats_font_iter; - ATSFontRef ats_font_ref; - CFStringRef ats_font_name; - char face_name[1024]; -#ifndef kATSOptionFlagsUnRestrictedScope -#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault -#endif - - - if ( noErr != ATSFontIteratorCreate( kATSFontContextGlobal, - NULL, NULL, - kATSOptionFlagsUnRestrictedScope, - &ats_font_iter ) ) - return; - - while ( noErr == ATSFontIteratorNext( ats_font_iter, &ats_font_ref ) ) - { - if ( 0 != ATSFontGetName( ats_font_ref, kATSOptionFlagsUnRestrictedScope, &ats_font_name ) ) - continue; - - if ( NULL == ats_font_name ) - continue; - - if ( CFStringGetCString( ats_font_name, face_name, 1024, kCFStringEncodingNonLossyASCII ) ) - test_face( (char *)face_name, library ); - } - return; -#endif -} - - -void -test_system_font_list() -{ - FT_Library library; - - - printf( "fontlist is generated by [%s]\n", font_listing_api ); - printf( "fontname is resolved by [%s]\n", font_resolve_api ); - - if ( 0 != FT_Init_FreeType( &library ) ) - return; - - if ( 0 == ft_strcmp( font_listing_api, "quickdraw_old" ) ) - test_font_list_quickdraw_old( library ); - else if ( 0 == ft_strcmp( font_listing_api, "quickdraw" ) ) - test_font_list_quickdraw( library ); - else if ( 0 == ft_strcmp( font_listing_api, "ats" ) ) - test_font_list_ats( library ); - else - { - printf( "invalid api name to list [%s]\n", font_listing_api ); - exit( -1 ); - } - - FT_Done_FreeType( library ); -} - - -int -main( int argc, - char** argv ) -{ - int i; - - - num_scanned_fonts = 0; - num_opened_fonts = 0; - num_scanned_faces = 0; - num_opened_faces = 0; - - font_listing_api = NULL; - font_resolve_api = NULL; - auto_suffix = FALSE; - max_face_number = 0; - force_scan_face = FALSE; - - if ( 1 == argc ) - print_help_and_exit(); - else - { - for ( i = 1; i < argc; i++ ) - { - if ( 0 == ft_strcmp( "--help", argv[i] ) ) - print_help_and_exit(); - else if ( 0 == ft_strncmp( "--font-listing-api=", argv[i], 19 ) ) - font_listing_api = argv[i] + 19; - else if ( 0 == ft_strncmp( "--font-resolve-api=", argv[i], 19 ) ) - font_resolve_api = argv[i] + 19; - else if ( 0 == ft_strcmp( "--auto-suffix", argv[i] ) ) - auto_suffix = TRUE; - else if ( 0 == ft_strncmp( "--max-face-number=", argv[i], 18 ) ) - max_face_number = atoi( argv[i] + 18 ); - else if ( 0 == ft_strcmp( "--force-scan-face", argv[i] ) ) - force_scan_face = TRUE; - } - } - - if ( NULL == font_listing_api && NULL == font_resolve_api ) - test_font_files( argc, argv ); - else if ( NULL != font_listing_api && NULL != font_resolve_api ) - test_system_font_list( argc, argv ); - else if ( NULL == font_listing_api ) - printf( "require --font-listing-api to specify how to list system font\n" ); - else if ( NULL == font_resolve_api ) - printf( "require --font-resolve-api to specify how to find file by fontname\n" ); - - printf( "\n" ); - printf( "---------------------------------\n" ); - printf( "Summary\n" ); - printf( "Font File opened/scanned = %d/%d\n", num_opened_fonts, num_scanned_fonts ); - printf( "Font Face opened/scanned = %d/%d\n", num_opened_faces, num_scanned_faces ); - exit( 0 ); -} diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/ftoldmac.m68k_far.make.txt freetype-2.8/=unpacked-tar1=/mac/ftoldmac.m68k_far.make.txt --- freetype-2.7.1/=unpacked-tar1=/mac/ftoldmac.m68k_far.make.txt 2015-09-25 05:41:45.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/ftoldmac.m68k_far.make.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -# File: ftoldmac.m68k_far.make -# Target: ftoldmac.m68k_far -# Created: Wednesday, November 23, 2005 04:21:20 PM - - -MAKEFILE = ftoldmac.m68k_far.make -\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -FT2Dir = ::freetype2: -ObjDir = :obj: -Includes = \xB6 - -i "{FT2Dir}include:" \xB6 - -i "{FT2Dir}src:" \xB6 - -i :src: \xB6 - -i "{FT2Dir}include:freetype:config:" - -Sym-68K = -sym off - -COptions = \xB6 - -d HAVE_FSSPEC=1 \xB6 - -d HAVE_FSREF=0 \xB6 - -d HAVE_QUICKDRAW_TOOLBOX=1 \xB6 - -d HAVE_QUICKDRAW_CARBON=0 \xB6 - -d HAVE_ATS=0 \xB6 - -d FT2_BUILD_LIBRARY \xB6 - -d FT_CONFIG_CONFIG_H="" \xB6 - -d FT_CONFIG_MODULES_H="" \xB6 - {Includes} {Sym-68K} -model far -includes unix - - -### Source Files ### - -SrcFiles = \xB6 - :mac:ftoldmac.c \xB6 - :src:common.c - - -### Object Files ### - -ObjFiles-68K = \xB6 - "{ObjDir}ftoldmac.c.o" \xB6 - "{ObjDir}common.c.o" - - -### Libraries ### - -LibFiles-68K = \xB6 - "{FT2Dir}FreeType.m68k_far.o" \xB6 - "{Libraries}Stubs.o" \xB6 - "{Libraries}MathLib.far.o" \xB6 - "{CLibraries}StdCLib.far.o" \xB6 - "{Libraries}MacRuntime.o" \xB6 - "{Libraries}IntEnv.far.o" \xB6 - "{Libraries}ToolLibs.far.o" \xB6 - "{Libraries}Interface.o" - - -### Default Rules ### - -.c.o \xC4 .c {\xA5MondoBuild\xA5} - {C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} - - -### Build Rules ### - -ftoldmac.m68k_far \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5} - ILink \xB6 - -o {Targ} \xB6 - {ObjFiles-68K} \xB6 - {LibFiles-68K} \xB6 - {Sym-68K} \xB6 - -mf -d \xB6 - -t 'MPST' \xB6 - -c 'MPS ' \xB6 - -model far \xB6 - -state rewrite \xB6 - -compact -pad 0 \xB6 - -br on - If "{Sym-68K}" =~ /-sym \xC5[nNuU]\xC5/ - ILinkToSYM {Targ}.NJ -mf -sym 3.2 -c 'sade' - End - - - -### Required Dependencies ### - -"{ObjDir}ftoldmac.c.o" \xC4 :mac:ftoldmac.c -"{ObjDir}common.c.o" \xC4 :src:common.c - - -### Optional Dependencies ### -### Build this target to generate "include file" dependencies. ### - -Dependencies \xC4 $OutOfDate - MakeDepend \xB6 - -append {MAKEFILE} \xB6 - -ignore "{CIncludes}" \xB6 - -objdir "{ObjDir}" \xB6 - -objext .o \xB6 - {Includes} \xB6 - {SrcFiles} - - diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/ftoldmac.ppc_classic.make.txt freetype-2.8/=unpacked-tar1=/mac/ftoldmac.ppc_classic.make.txt --- freetype-2.7.1/=unpacked-tar1=/mac/ftoldmac.ppc_classic.make.txt 2015-09-25 05:41:45.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/ftoldmac.ppc_classic.make.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -# File: ftoldmac.ppc_classic.make -# Target: ftoldmac.ppc_classic -# Created: Thursday, November 24, 2005 10:02:30 AM - - -MAKEFILE = ftoldmac.ppc_classic.make -\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -FT2Dir = ::freetype2: -ObjDir = :obj: -Includes = \xB6 - -i "{FT2Dir}include:" \xB6 - -i "{FT2Dir}src:" \xB6 - -i :src: \xB6 - -i "{FT2Dir}include:freetype:config:" - -Sym-PPC = -sym off - -PPCCOptions = \xB6 - -d HAVE_FSSPEC=1 \xB6 - -d HAVE_FSREF=0 \xB6 - -d HAVE_QUICKDRAW_TOOLBOX=1 \xB6 - -d HAVE_QUICKDRAW_CARBON=0 \xB6 - -d HAVE_ATS=0 \xB6 - -d FT2_BUILD_LIBRARY \xB6 - -d FT_CONFIG_CONFIG_H="" \xB6 - -d FT_CONFIG_MODULES_H="" \xB6 - {Includes} {Sym-PPC} -includes unix -ansi strict - - -### Source Files ### - -SrcFiles = \xB6 - :mac:ftoldmac.c \xB6 - :src:common.c - - -### Object Files ### - -ObjFiles-PPC = \xB6 - "{ObjDir}common.c.x" \xB6 - "{ObjDir}ftoldmac.c.x" - - -### Libraries ### - -LibFiles-PPC = \xB6 - "{FT2Dir}FreeType.ppc_classic.o" \xB6 - "{SharedLibraries}InterfaceLib" \xB6 - "{SharedLibraries}StdCLib" \xB6 - "{SharedLibraries}MathLib" \xB6 - "{PPCLibraries}StdCRuntime.o" \xB6 - "{PPCLibraries}PPCCRuntime.o" \xB6 - "{PPCLibraries}PPCToolLibs.o" - - -### Default Rules ### - -.c.x \xC4 .c {\xA5MondoBuild\xA5} - {PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions} - - -### Build Rules ### - -ftoldmac.ppc_classic \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5} - PPCLink \xB6 - -o {Targ} \xB6 - {ObjFiles-PPC} \xB6 - {LibFiles-PPC} \xB6 - {Sym-PPC} \xB6 - -mf -d \xB6 - -t 'MPST' \xB6 - -c 'MPS ' - - - -### Required Dependencies ### - -"{ObjDir}common.c.x" \xC4 :src:common.c -"{ObjDir}ftoldmac.c.x" \xC4 :mac:ftoldmac.c - - -### Optional Dependencies ### -### Build this target to generate "include file" dependencies. ### - -Dependencies \xC4 $OutOfDate - MakeDepend \xB6 - -append {MAKEFILE} \xB6 - -ignore "{CIncludes}" \xB6 - -objdir "{ObjDir}" \xB6 - -objext .x \xB6 - {Includes} \xB6 - {SrcFiles} - - diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/ftview_m.c freetype-2.8/=unpacked-tar1=/mac/ftview_m.c --- freetype-2.7.1/=unpacked-tar1=/mac/ftview_m.c 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/ftview_m.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* minimal Mac wrapper for the ftview.c program */ - - -int original_main( int argc, char** argv ); - -/* We rename the original main() program to original_main, - so we can provide a wrapper around it */ -#define main original_main -#include "ftview.c" -#undef main - - -#define PPEM "24" /* hard-code the ppem size */ - - -#include -#include "getargv.h" -#ifndef USING_CARBON -#include -#include -#include -#include -#else -#include -#endif - -static void -init_toolbox() -{ -#ifndef USING_CARBON - InitGraf(&qd.thePort); - InitFonts(); - InitWindows(); - TEInit(); - InitDialogs((long)0); - InitMenus(); - InitCursor(); -#endif - - SIOUXSettings.asktosaveonclose = 0; -} - -int main() -{ - int argc, i; - char** argv; - - init_toolbox(); - - /* put paths of all files dropped onto the app into argv */ - argc = FTMac_GetArgv(&argv); - if (argc < 2) - { - printf("Please drop one or more font files onto the app (but quit first!)\n"); - exit(1); - } - /* move argv[1:] to argv[2:] and fill in the ppem arg */ - for (i = argc; i > 1; i--) - { - argv[i] = argv[i-1]; - } - argc++; - argv[1] = PPEM; - /* call the original main() program */ - original_main(argc, argv); -} diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/getargv.c freetype-2.8/=unpacked-tar1=/mac/getargv.c --- freetype-2.7.1/=unpacked-tar1=/mac/getargv.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/getargv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,324 +0,0 @@ -/*********************************************************** -Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, -The Netherlands. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Stichting Mathematisch -Centrum or CWI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior permission. - -STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE -FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -******************************************************************/ - -/* Construct argc and argv for main() by using Apple Events */ -/* From Jack's implementation for STDWIN */ - -/* Modified for use with FreeType from MacPython's macgetargv.c - by Just van Rossum */ - -#include -#include -#include "getargv.h" - -#ifndef USING_CARBON -#include -#include -#include -#include -#include -#include -#include -#else -#include -#endif - -#if defined(GENERATINGCFM) && !defined(USING_CARBON) /* Defined to 0 or 1 in Universal headers */ -#define HAVE_UNIVERSAL_HEADERS -#endif - -#if !defined(HAVE_UNIVERSAL_HEADERS) && !defined(USING_CARBON) -#define NewAEEventHandlerProc(x) (x) -#define AEEventHandlerUPP EventHandlerProcPtr -#endif - -static int arg_count; -static char *arg_vector[256]; -static char app_name[256]; -static int app_name_inited; - - -/* Duplicate a string to the heap. */ - -static char * -strdup(char *src) -{ - char *dst = malloc(strlen(src) + 1); - if (dst) - strcpy(dst, src); - return dst; -} - - -/* Given an FSSpec, return the FSSpec of the parent folder */ - -static OSErr -get_folder_parent (FSSpec * fss, FSSpec * parent) -{ - CInfoPBRec rec; - short err; - - * parent = * fss; - rec.hFileInfo.ioNamePtr = parent->name; - rec.hFileInfo.ioVRefNum = parent->vRefNum; - rec.hFileInfo.ioDirID = parent->parID; - rec.hFileInfo.ioFDirIndex = -1; - rec.hFileInfo.ioFVersNum = 0; - if (err = PBGetCatInfoSync (& rec)) - return err; - parent->parID = rec.dirInfo.ioDrParID; -/* parent->name[0] = 0; */ - return 0; -} - - -/* Given an FSSpec return a full, colon-separated pathname */ - -static OSErr -FTMac_GetFullPath (FSSpec *fss, char *buf) -{ - short err; - FSSpec fss_parent, fss_current; - char tmpbuf[256]; - int plen; - - fss_current = *fss; - plen = fss_current.name[0]; - memcpy(buf, &fss_current.name[1], plen); - buf[plen] = 0; - /* Special case for disk names */ - if ( fss_current.parID <= 1 ) { - buf[plen++] = ':'; - buf[plen] = 0; - return 0; - } - while (fss_current.parID > 1) { - /* Get parent folder name */ - if (err = get_folder_parent(&fss_current, &fss_parent)) - return err; - fss_current = fss_parent; - /* Prepend path component just found to buf */ - plen = fss_current.name[0]; - if (strlen(buf) + plen + 1 > 256) { - /* Oops... Not enough space (shouldn't happen) */ - *buf = 0; - return -1; - } - memcpy(tmpbuf, &fss_current.name[1], plen); - tmpbuf[plen] = ':'; - strcpy(&tmpbuf[plen+1], buf); - strcpy(buf, tmpbuf); - } - return 0; -} - - -/* Initialize name of current application */ - -static OSErr -init_app_name() -{ - ProcessSerialNumber currentPSN; - ProcessInfoRec info; - OSErr err; - FSSpec appSpec; - - if ( app_name_inited ) return 0; - currentPSN.highLongOfPSN = 0; - currentPSN.lowLongOfPSN = kCurrentProcess; - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = NULL; - info.processAppSpec = &appSpec; - if ( err=GetProcessInformation(¤tPSN, &info)) - return err; - strncpy(app_name, (char*)appSpec.name + 1, appSpec.name[0]); - app_name[appSpec.name[0]] = '\0'; - app_name_inited = 1; - return 0; -} - - -/* Check that there aren't any args remaining in the event */ - -static OSErr -get_missing_params(const AppleEvent *theAppleEvent) -{ - DescType theType; - Size actualSize; - OSErr err; - - err = AEGetAttributePtr(theAppleEvent, keyMissedKeywordAttr, typeWildCard, - &theType, nil, 0, &actualSize); - if (err == errAEDescNotFound) - return noErr; - else - return errAEEventNotHandled; -} - -static int got_one; /* Flag that we can stop getting events */ - - -/* Handle the Print or Quit events (by failing) */ - -static pascal OSErr -handle_not(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) -{ - #pragma unused (reply, refCon) - got_one = 1; - return errAEEventNotHandled; -} - - -/* Handle the Open Application event (by ignoring it) */ - -static pascal OSErr -handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) -{ - #pragma unused (reply, refCon) -#if 0 - /* Test by Jack: would removing this facilitate debugging? */ - got_one = 1; -#endif - return get_missing_params(theAppleEvent); -} - - -/* Handle the Open Document event, by adding an argument */ - -static pascal OSErr -handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) -{ - #pragma unused (reply, refCon) - OSErr err; - AEDescList doclist; - AEKeyword keywd; - DescType rttype; - long i, ndocs, size; - FSSpec fss; - char path[256]; - - got_one = 1; - if (err = AEGetParamDesc(theAppleEvent, - keyDirectObject, typeAEList, &doclist)) - return err; - if (err = get_missing_params(theAppleEvent)) - return err; - if (err = AECountItems(&doclist, &ndocs)) - return err; - for(i = 1; i <= ndocs; i++) { - err = AEGetNthPtr(&doclist, i, typeFSS, - &keywd, &rttype, &fss, sizeof(fss), &size); - if (err) - break; - FTMac_GetFullPath(&fss, path); - arg_vector[arg_count++] = strdup(path); - } - return err; -} - - -/* Install standard core event handlers */ -static AEEventHandlerUPP open_doc_upp; -static AEEventHandlerUPP open_app_upp; -static AEEventHandlerUPP not_upp; - -static void -set_ae_handlers() -{ -#ifdef USING_CARBON - open_doc_upp = NewAEEventHandlerUPP(handle_open_doc); - open_app_upp = NewAEEventHandlerUPP(handle_open_app); - not_upp = NewAEEventHandlerUPP(handle_not); -#else - open_doc_upp = NewAEEventHandlerProc(handle_open_doc); - open_app_upp = NewAEEventHandlerProc(handle_open_app); - not_upp = NewAEEventHandlerProc(handle_not); -#endif - - AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, - open_app_upp, 0L, false); - AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, - open_doc_upp, 0L, false); - AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, - not_upp, 0L, false); - AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, - not_upp, 0L, false); -} - -/* Uninstall standard core event handlers */ - -static void -reset_ae_handlers() -{ - AERemoveEventHandler(kCoreEventClass, kAEOpenApplication, - open_app_upp, false); - AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, - open_doc_upp, false); - AERemoveEventHandler(kCoreEventClass, kAEPrintDocuments, - not_upp, false); - AERemoveEventHandler(kCoreEventClass, kAEQuitApplication, - not_upp, false); -} - -/* Wait for events until a core event has been handled */ - -static void -event_loop() -{ - EventRecord event; - int n; - int ok; - - got_one = 0; - for (n = 0; n < 100 && !got_one; n++) { - #ifndef USING_CARBON - SystemTask(); - #endif - ok = GetNextEvent(everyEvent, &event); - if (ok && event.what == kHighLevelEvent) { - AEProcessAppleEvent(&event); - } - } -} - -/* Get the argv vector, return argc. See macgetargv.h for more doco. */ - -int -FTMac_GetArgv(pargv) - char ***pargv; -{ - - arg_count = 0; - (void)init_app_name(); - arg_vector[arg_count++] = strdup(app_name); - - set_ae_handlers(); - event_loop(); - reset_ae_handlers(); - - arg_vector[arg_count] = NULL; - - *pargv = arg_vector; - return arg_count; -} diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/getargv.h freetype-2.8/=unpacked-tar1=/mac/getargv.h --- freetype-2.7.1/=unpacked-tar1=/mac/getargv.h 2016-01-13 11:00:32.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/getargv.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -/* - - FTMac_GetArgv - - - argc/argv emulation for the Mac. Converts files dropped - onto the application to full paths, and stuff them into - argv. - - - pargv :: a pointer to an argv array. The array doesn't need to - exist before calling this function. - - - The number of files dropped onto the app (ie. argc) -*/ - -int FTMac_GetArgv(char ***pargv); - diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/Makefile freetype-2.8/=unpacked-tar1=/mac/Makefile --- freetype-2.7.1/=unpacked-tar1=/mac/Makefile 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -################################################################## -# -# Makefile for MacOS X to build MacOS-specific API test program, -# Also targets to setup vanilla source for MPW are included. -# This should be executed in this directory, as -# "cd ft2demos ; make -C mac". -# -# most part is taken from ft2demos/Makefile, for UNIX platform. -# - -all: exes - -empty := -space := $(empty) $(empty) - -TOP_DIR ?= ../../freetype2 -OBJ_DIR ?= $(TOP_DIR)/objs -TOP_DIR_2 ?= .. -OBJ_DIR_2 ?= $(TOP_DIR_2)/obj -TOP_DIR_2_MAC ?= $(TOP_DIR_2)/mac - -ifndef CONFIG_MK - PROJECT := freetype - CONFIG_MK := $(TOP_DIR)/config.mk -endif - -ifeq ($(wildcard $(CONFIG_MK)),) - no_config_mk := 1 -endif - -ifdef no_config_mk - exes: - @echo Please compile the library before the demo programs! - clean distclean: - @echo "I need \`$(subst /,$(SEP),$(TOP_DIR)/config.mk)' to do that!" -else - include $(CONFIG_MK) - have_makefile := $(strip $(wildcard Makefile)) - TOP_DIR := $(shell cd $(TOP_DIR); pwd) - TOP_DIR_2 := $(shell cd $(TOP_DIR_2); pwd) - ifneq ($(have_makefile),) - BIN_DIR_2 ?= $(TOP_DIR_2)/bin - OBJ_DIR_2 ?= $(TOP_DIR_2)/obj - else - BIN_DIR_2 ?= .. - OBJ_DIR_2 ?= .. - endif - - GRAPH_DIR := $(TOP_DIR_2)/graph - include $(GRAPH_DIR)/rules.mk - - ifeq ($(TOP_DIR),..) - SRC_DIR := src - else - SRC_DIR := $(TOP_DIR_2)/src - endif - - FT_INCLUDES := $(OBJ_BUILD) $(BUILD_DIR) $(TOP_DIR)/include $(SRC_DIR) - INCLUDES := $(subst /,$(COMPILER_SEP),$(FT_INCLUDES)) - COMPILE = $(CC) $(CFLAGS) $(INCLUDES:%=$I%) - FTLIB := $(LIB_DIR)/$(LIBRARY).$A - ifeq ($(PLATFORM),unix) - MATH := -lm - endif - ifeq ($(PLATFORM),unixdev) - MATH := -lm - endif - LINK_ITEMS = $T$(subst /,$(COMPILER_SEP),$@ $<) - - CC = $(CCraw) - LINK_CMD = $(subst /,$(SEP),$(OBJ_BUILD)/libtool) \ - --mode=link $(CC) \ - $(subst /,$(COMPILER_SEP),$(LDFLAGS)) - ifeq ($(findstring CoreServices,$(LDFLAGS)),) - LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) $(MATH) \ - -Xlinker -framework -Xlinker CoreServices \ - -Xlinker -framework -Xlinker ApplicationServices - else - LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) $(MATH) - endif - LINK_COMMON = $(LINK_CMD) \ - $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ)) \ - $(LINK_LIBS) - - .PHONY: exes clean distclean - - E := - EXES := ftoldmac - exes: $(EXES:%=$(BIN_DIR_2)/%$E) - - $(BIN_DIR_2)/ftoldmac$E: $(OBJ_DIR_2)/ftoldmac.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(OBJ_DIR_2)/ftoldmac.$(SO): $(TOP_DIR_2_MAC)/ftoldmac.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - COMMON_OBJ := $(OBJ_DIR_2)/common.$(SO) - $(COMMON_OBJ): $(SRC_DIR)/common.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - ################################################################ - # Targets to setup MPW - # - - clean: - rm -f \ - $(TOP_DIR_2)/ftoldmac.*.make \ - $(OBJ_DIR_2)/*.NJ \ - $(OBJ_DIR_2)/*.makeout \ - $(OBJ_DIR_2)/*.o $(OBJ_DIR_2)/*.exe - - makefiles: - python $(TOP_DIR_2_MAC)/ascii2mpw.py \ - > $(TOP_DIR_2)/ftoldmac.m68k_far.make \ - < $(TOP_DIR_2_MAC)/ftoldmac.m68k_far.make.txt - python $(TOP_DIR_2_MAC)/ascii2mpw.py \ - > $(TOP_DIR_2)/ftoldmac.ppc_classic.make \ - < $(TOP_DIR_2_MAC)/ftoldmac.ppc_classic.make.txt - find $(TOP_DIR_2) -name '*.make' | \ - xargs /Developer/Tools/SetFile -a l -c "MPS " -t TEXT - - resource: - find $(SRC_DIR) $(TOP_DIR_2_MAC) -name '*.[ch]' | \ - xargs /Developer/Tools/SetFile -a l -c "MPS " -t TEXT -endif diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/README freetype-2.8/=unpacked-tar1=/mac/README --- freetype-2.7.1/=unpacked-tar1=/mac/README 2015-09-25 05:40:31.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -This folder contains supporting code and CodeWarrior Pro 4 project -files to build the FreeType demo programs ftlint and ftview for MacOS. - -Building -To build these apps, you'll first need to build the FreeType library -(see config/mac). Be sure to unpack the resource.hqx file; it contains -two resource files that are needed for ftlint and ftview. The -applications get built in the demos/bin folder. - -Notes -Since the Mac doesn't have the notion of argc/argv, we'll emulate -this: each file dropped onto the application will be translated -to a command line argument. Both ftlint and ftview take a ppem -value as their first command line argument: for the Mac version -this has been hard-coded into the source. Also: the additional -options for ftview cannot be set. - -Appendix -Makefile, ftoldmac.m68k_far.make.txt, ftoldmac.ppc_classic.make.txt -and ftoldmac.c are for commandline program "ftoldmac" to test MacOS -specific API, written by suzuki toshiya. On MacOS X, you can build -ftoldmac by "make -C mac" in the top directory of ft2demos. Also -you can generate MPW makefiles by "make -C mac makefiles", in MacOS -X commandline. - -Have fun with FreeType on the Mac! - -Just van Rossum, - -DISCLAIMER: this subdirectory is *not* being maintained by the -FreeType team, but by Just van Rossum. It's being released under -the same terms as FreeType (see LICENSE.TXT). diff -Nru freetype-2.7.1/=unpacked-tar1=/mac/resource.hqx freetype-2.8/=unpacked-tar1=/mac/resource.hqx --- freetype-2.7.1/=unpacked-tar1=/mac/resource.hqx 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/mac/resource.hqx 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -(This file must be converted with BinHex 4.0) :$(*PFfpeFQ0P,R0TG!"6594%8dP8)3%!!!!(9!!!!4kE)90*9#%!!J!!"e4b6'& e!J!!!!!@!!!0!!YQG'aTER3ZFR0bB`EK@D!!4J`+!!!!J!!!!!!'k52Z%qJ*KJ! !!!!!!!!!!!!!!!!!!!!!!!'I!!!!!2rrrrpbFh*M8P0&4!%!Y0lZjl6HlcS!!!' C!!!!!!!!!4N!!!!!Pl)!!!!!!!!!!&+E%3!)(#ae#1,@kQ-l3-r1rA-h'clY+LM H9q+m@S[Fj'KEDPD(PRRlbr3)Nck4+9)bfh$4M895H*J+"lDRd-a-6hUrB81a2k& e%)&b(ZXdrYBdI[ZdE)8F9('8dr066MF[CQTkaA%3fiT"m8l2P`!e0ENhlY2j"FL II%YbGc@ph91S4%8'Z5Xc+&ScAr+%DY2QlM5MEm[C1mhS@lHGdf@4$r)jQ+1c[Yf b16K0FP*c0Q[Vq(0e9lNT3"NeFC`c!fd61PVU13*GNpUBBBEDYdiZ2hX`9eAR44H ,BIaH('A$McIF3lH!AZ"TPCcBbG(bCcBTR0P-J9(CPq!SQh,26%f1,GX[-,2KJYL bC2[mR3Fc+V#JQ6c,1D9*!!!0!!YQG(CTCAFZFR0bB`EK@D!!4J`+!!!!J!!!!!! 'k52ZdTd*KJ!!!!!!!!!!!!!!!!!!!"B!!!!!!!!!!2rrrrpbFh*M8P0&4!%!Y0l Zjl@I*fJ!!!R0!!!!!!!!"88!!!!!G63!!!!!!!!!!0H8#eLdNFH9qjfA8IjfVYc V+,IcSPG[%r1Mef"PGRNH2bHC[@GR+aYdP+r9fR9b,hXDfQaLU$)NfG$H6Ma3l!J rb@q#cPhiF`e!5[$!i!F%P!CrjdRIiQ1U8#HUXAqC0ZNE+"#Gi-UPXm`GcPR6d1+ %j@UFd,+C*c(%&qq,LAI(q@TjQmA%0I,iR)F[aK-IRb@fBHY@VQVKj@[iNHP`l[3 r8D8HchTk%V!p1-QjjcVRES%ZEfC'F$,CbRNT829k%*Nh)ZZjkNHPN6Xb0E*fCNE %"EqJB#rq4EhN$`f-A&)XrIQFJU,$rTe68(6*#1FZS5%%1XqmqPYTB@9aET+h5Bi bPCcIjpGGAFkd#f@Z5RE'80"GFffLmqlRVPl4EB0*UP`qXXLr!m[jJH2TNIjAr2f IrFkCEHB6KGq6aiSXMc-8@6-H+E)pHUM)r[#")XH$G%A1p2X+rr[h&!(hlLTHZ(Y (NH[1E8AJl9Z+&frG915qH814jdDD)QrDGF9,ekmTAVjf9C([kK9&rLZA&DpF[U3 SF1QLiY@,&a4"&miVAMYr6[(kZE1+0mkH843mFeVajZP6LVG1R9381RP#i6TaA2( fm@1+`XH1+SSF2D*ijmKKaEZ($bQ#$ae8[(I`J+,SJIf+prI[8hb`EkqLf0ipLZ* lGLXqh,e,%E)V94'DZP04BZF1a8FlYLXqhVj0mFQfVBU5@lFS2Yfb@I(CjNf+ccG Y9(baFB2Lb`hV&DA@Ve0mY@kYS[6D0BSbDeBVbUjHTIKke8T&f-S9L[!9baAPPLp 6P&qf9&&Kk4*&a5@,&Hl&La59&Le84#aFS+LmB,kLb[ajLQrQc998R6Y(8@h1E%A Nl&Q+U&Nc&Gr16&&mPc*$8Ah'G%@0kG-80DG09G5D1N94HdUbi[[NbBSkNbFTITJ d89&hiJ6&Ma2'+hiD2dlamlLaLRTMabMUMaQYL"ip5Y&Je%K&`j%M&$%MKLXD$4q Qm!`EUQJmG)LLbC!!`BUQJ`FTQJdDU2KPi!$&V`2k+f,lpe2meUq[`YZhMb+Z6fp &mpkp&,rhkUR`pHbKL1r4AC(3[CZL4EHZLTCGZbJ5Zh4@r0'jNk*9Tik+eKdl+2l Xd&l4TRdla9rYfLVqETZNq#I*)ZNI3pZr$Hhq-V4[BqM`Tk&MDd1R9SE1IaLk*"U kYM4dDf(SRQ$S%@rSk62dqYh3ZlQK6jbKVpI3lcG$reM$J&m0!hma$'TQ'0c8-+5 *B@KM`c#2BAJM`iJB`mL'KP%0$+1M$@2U'mE@-iclf6$q*m1%(`d6kaSQr@#BA-H 3!2bpB8TY`p4DKQNe$G0V''C80k4mCjMjV@&@P'&fT'&10F2FUSCjhaMQ9c%XU'a B''&B9-Q`f'eB8Y'`Y)*K@AR$mR+'&H''P@''99mE9TFeV#PM@&[DX1iV`rT5KJe I'MCqBGMdZ@(cCiBYRaUfPM4Xqm5`r@2$MSm-1dXB8N-0Zd)-Zcmdl#PZf&[-X%p IX-ihl2lh$3H+'JkqCcJ8E$MmVZ()1iDM43c(#KZ1[fdii6+F,'3ipCEKp*Z'-`8 0Cpm`R([GF2ie`i8J`m9A$CF+'#krBVL5hh!eRq(DbiEV,aR5mKTZj$(Fc'fipD, KGU$K6Ll$h4F-p`)-prd0k6N0$h)B(QBh2-TQb-KUH*c&m-62k-[r[hh!IlZ6J*4 "Cl2AG8i+iL9VZFJ+9Cfc`Xqf#L(2YJbPBQ*E*$M[ET+HEdHHRVQHVdQ+2EYI(ZH e4%$+`06F8BPHMmrPmm6(YA"@,IRF2SqRCU[Q(PGiZ+YjJeK23S,Rrjhb!!!"!!! !!3!!!!!!!!!!(MX0)#!J)#!J)#"'9&p(E(P`D&p0CA4bD@0c+L"YCA4b$A*PFfp eFQ0PFbjcDA4jFe0jFe0jFe0jFfjcC#PdFh-#)&0*9%46593K!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!YD"h%3!!"e3!!!%HGA4XD@jPAe4bB@jcCQpbE5JJ*QGXHA" S,6jbEfpd,QpeG'aTEQ8X$5!J)#!J)#!J)#!J)#!J)#!J)#!J)#!J)#!J)#!J)#C QB@0P,6jdHA"P-5jQEfjdAfeKG(*TH#!T1`d0)#!J)#!J)#"'9&p2GA4XD@jPAdG PG&p$3Qpi+#!QC`!!!3!!!!%!!!!!!!!!!"i!!!!!!!!!!!!F!"lrrf$Z: \ No newline at end of file diff -Nru freetype-2.7.1/=unpacked-tar1=/Makefile freetype-2.8/=unpacked-tar1=/Makefile --- freetype-2.7.1/=unpacked-tar1=/Makefile 2016-12-25 05:45:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,606 +0,0 @@ -all: exes - - -#################################################################### -# -# The `space' variable is used to avoid trailing spaces in defining -# the `T' variable later. -# -empty := -space := $(empty) $(empty) - - -#################################################################### -# -# TOP_DIR is the directory where the main FreeType source is found, -# as well as the `config.mk' file. -# -# TOP_DIR_2 is the directory is the top of the demonstration -# programs directory. -# -# OBJ_DIR gives the objects directory of the FreeType library. -# -TOP_DIR ?= ../freetype2 -TOP_DIR_2 ?= . -OBJ_DIR ?= $(TOP_DIR)/objs - - -###################################################################### -# -# CONFIG_MK points to the current `config.mk' to use. It is defined -# by default as $(TOP_DIR)/config.mk. -# -ifndef CONFIG_MK - PROJECT := freetype - CONFIG_MK := $(TOP_DIR)/config.mk -endif - - -###################################################################### -# -# MODULES_CFG points to the current `modules.cfg' to use. It is defined -# by default as $(TOP_DIR)/modules.cfg. -# -MODULES_CFG ?= $(TOP_DIR)/modules.cfg - -ifeq ($(wildcard $(MODULES_CFG)),) - no_modules_cfg := 1 -endif - - -#################################################################### -# -# Check that we have a working `config.mk' in the above directory. -# If not, issue a warning message, then stop there. -# -ifeq ($(wildcard $(CONFIG_MK)),) - no_config_mk := 1 -endif - -ifdef no_config_mk - - exes: - @echo Please compile the library before the demo programs! - clean distclean: - @echo "I need a path to FreeType 2's \`config.mk' to do that!" - @echo "Set the \`TOP_DIR' variable to the correct value." - -else - - #################################################################### - # - # Good, now include `config.mk' in order to know how to build - # object files from sources, as well as other things (compiler - # flags). - # - include $(CONFIG_MK) - - ifndef no_modules_cfg - include $(MODULES_CFG) - endif - - have_makefile := $(strip $(wildcard Makefile)) - - ifeq ($(PLATFORM),unix) - ifdef DEVEL_DIR - PLATFORM := unixdev - endif - endif - - - #################################################################### - # - # Define a few important variables now. - # - ifeq ($(PLATFORM),unix) - # without absolute paths libtool fails - TOP_DIR := $(shell cd $(TOP_DIR); pwd) - TOP_DIR_2 := $(shell cd $(TOP_DIR_2); pwd) - ifneq ($(have_makefile),) - BIN_DIR_2 ?= $(TOP_DIR_2)/bin - OBJ_DIR_2 ?= $(TOP_DIR_2)/obj - else - BIN_DIR_2 ?= . - OBJ_DIR_2 ?= . - endif - else - ifneq ($(have_makefile),) - BIN_DIR_2 ?= bin - OBJ_DIR_2 ?= obj - else - BIN_DIR_2 ?= . - OBJ_DIR_2 ?= . - endif - endif - - GRAPH_DIR := $(TOP_DIR_2)/graph - - ifeq ($(TOP_DIR),..) - SRC_DIR := src - else - SRC_DIR := $(TOP_DIR_2)/src - endif - - FT_INCLUDES := $(OBJ_BUILD) \ - $(BUILD_DIR) \ - $(DEVEL_DIR) \ - $(TOP_DIR)/include \ - $(SRC_DIR) - - COMPILE = $(CC) $(CPPFLAGS) \ - $(CFLAGS) \ - $(ANSIFLAGS) \ - $(INCLUDES:%=$I%) \ - $DFT_CONFIG_MODULES_H="" - - # Enable C99 for gcc to avoid warnings. - # Note that clang++ aborts with an error if we use `-std=C99', - # so check for `++' in $(CC) also. - ifneq ($(findstring -pedantic,$(COMPILE)),) - ifeq ($(findstring ++,$(CC)),) - COMPILE += -std=c99 - endif - endif - - FTLIB := $(LIB_DIR)/$(LIBRARY).$A - - # `-lm' is required to compile on some Unix systems. - # - ifeq ($(PLATFORM),unix) - MATH := -lm - endif - - ifeq ($(PLATFORM),unixdev) - MATH := -lm - endif - - # The default variables used to link the executables. These can - # be redefined for platform-specific stuff. - # - # The first token of LINK_ITEMS must be the executable. - # - LINK_ITEMS = $T$(subst /,$(COMPILER_SEP),$@ $<) - - ifeq ($(PLATFORM),unix) - CC = $(CCraw) - LINK_CMD = $(subst /,$(SEP),$(OBJ_BUILD)/libtool) \ - --mode=link $(CC) \ - $(subst /,$(COMPILER_SEP),$(LDFLAGS)) - LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) - else - LINK_CMD = $(CC) $(subst /,$(COMPILER_SEP),$(LDFLAGS)) - ifeq ($(PLATFORM),unixdev) - LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) -lm -lrt -lz -lbz2 - LINK_LIBS += $(shell pkg-config --libs libpng harfbuzz) - else - LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) - endif - endif - - LINK = $(LINK_CMD) \ - $(LINK_ITEMS) \ - $(LINK_LIBS) - LINK_COMMON = $(LINK_CMD) \ - $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ)) \ - $(LINK_LIBS) - LINK_GRAPH = $(LINK_COMMON) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \ - $(GRAPH_LINK) $(MATH) - LINK_NEW = $(LINK_CMD) \ - $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ) \ - $(FTCOMMON_OBJ)) \ - $(LINK_LIBS) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \ - $(GRAPH_LINK) $(MATH) - - .PHONY: exes clean distclean - - - ################################################################### - # - # Include the rules needed to compile the graphics sub-system. - # This will also select which graphics driver to compile to the - # sub-system. - # - include $(GRAPH_DIR)/rules.mk - - - #################################################################### - # - # Detect DOS-like platforms, currently DOS, Win 3.1, Win32 & OS/2. - # - ifneq ($(findstring $(PLATFORM),os2 win16 win32 dos),) - DOSLIKE := 1 - endif - - - ################################################################### - # - # Clean-up rules. Because the `del' command on DOS-like platforms - # cannot take a long list of arguments, we simply erase the directory - # contents. - # - ifdef DOSLIKE - - clean_demo: - -del obj\*.$(SO) 2> nul - -del $(subst /,\,$(TOP_DIR_2)/src/*.bak) 2> nul - - distclean_demo: clean_demo - -del obj\*.lib 2> nul - -del bin\*.exe 2> nul - - else - - clean_demo: - -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/*.$(SO) $(OBJ_DIR_2)/*.$(O)) - -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/*.$(SA) $(OBJ_DIR_2)/*.$(A)) - -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/.libs/*) - -$(DELETE) $(subst /,$(SEP),$(SRC_DIR)/*.bak graph/*.bak) - -$(DELETE) $(subst /,$(SEP),$(SRC_DIR)/*~ graph/*~) - - distclean_demo: clean_demo - -$(DELETE) $(subst /,$(SEP),$(EXES:%=$(BIN_DIR_2)/%$E)) - -$(DELETE) $(subst /,$(SEP),$(GRAPH_LIB)) - ifeq ($(PLATFORM),unix) - -$(DELETE) $(BIN_DIR_2)/.libs/* - -$(DELDIR) $(BIN_DIR_2)/.libs - endif - - endif - - clean: clean_demo - distclean: distclean_demo - - - #################################################################### - # - # Compute the executable suffix to use, and put it in `E'. - # It is ".exe" on DOS-ish platforms, and nothing otherwise. - # - ifdef DOSLIKE - E := .exe - else - E := - endif - - - #################################################################### - # - # POSIX TERMIOS: Do not define if you use OLD U*ix like 4.2BSD. - # - ifeq ($(PLATFORM),unix) - EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS - endif - - ifeq ($(PLATFORM),unixdev) - EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS - endif - - - ################################################################### - # - # The list of demonstration programs to build. - # - # Note that ttdebug only works if the FreeType's `truetype' driver has - # been compiled with TT_CONFIG_OPTION_BYTECODE_INTERPRETER defined. - # - EXES := ftbench \ - ftdump \ - ftlint \ - ttdebug - - # Comment out the next line if you don't have a graphics subsystem. - EXES += ftdiff \ - ftgamma \ - ftgrid \ - ftmulti \ - ftstring \ - ftview - - # ftvalid requires ftgxval.c and ftotval.c - # - ifneq ($(findstring ftgxval.c,$(BASE_EXTENSIONS)),) - ifneq ($(findstring ftotval.c,$(BASE_EXTENSIONS)),) - EXES += ftvalid - endif - endif - - # The following programs are not compiled automatically; either comment - # out the affected line or use the program name as a Makefile target. - # - # EXES += ftchkwd - # EXES += ftmemchk - # EXES += ftpatchk - # EXES += fttimer - # EXES += testname - - exes: $(EXES:%=$(BIN_DIR_2)/%$E) - - - INCLUDES := $(subst /,$(COMPILER_SEP),$(FT_INCLUDES)) - - - # generic rule - $(OBJ_DIR_2)/%.$(SO): $(SRC_DIR)/%.c $(FTLIB) - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - - #################################################################### - # - # Rules for compiling object files for text-only demos. - # - $(OBJ_DIR_2)/common.$(SO): $(SRC_DIR)/common.c - $(OBJ_DIR_2)/output.$(SO): $(SRC_DIR)/output.c - $(OBJ_DIR_2)/mlgetopt.$(SO): $(SRC_DIR)/mlgetopt.c - COMMON_OBJ := $(OBJ_DIR_2)/common.$(SO) \ - $(OBJ_DIR_2)/output.$(SO) \ - $(OBJ_DIR_2)/mlgetopt.$(SO) - - - FTCOMMON_OBJ := $(OBJ_DIR_2)/ftcommon.$(SO) - $(FTCOMMON_OBJ): $(SRC_DIR)/ftcommon.c $(SRC_DIR)/ftcommon.h - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - - - $(OBJ_DIR_2)/ftlint.$(SO): $(SRC_DIR)/ftlint.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/ftbench.$(SO): $(SRC_DIR)/ftbench.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS) - - $(OBJ_DIR_2)/ftpatchk.$(SO): $(SRC_DIR)/ftpatchk.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS) - - $(OBJ_DIR_2)/ftchkwd.$(SO): $(SRC_DIR)/ftchkwd.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS) - - $(OBJ_DIR_2)/compos.$(SO): $(SRC_DIR)/compos.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/ftmemchk.$(SO): $(SRC_DIR)/ftmemchk.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/fttimer.$(SO): $(SRC_DIR)/fttimer.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/fttry.$(SO): $(SRC_DIR)/fttry.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/testname.$(SO): $(SRC_DIR)/testname.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - -# $(OBJ_DIR_2)/ftsbit.$(SO): $(SRC_DIR)/ftsbit.c -# $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - - # We simplify the dependencies on the graphics library by using - # $(GRAPH_LIB) directly. - - $(OBJ_DIR_2)/ftgamma.$(SO): $(SRC_DIR)/ftgamma.c \ - $(SRC_DIR)/ftcommon.h \ - $(GRAPH_LIB) - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/ftmulti.$(SO): $(SRC_DIR)/ftmulti.c \ - $(GRAPH_LIB) - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - - $(OBJ_DIR_2)/ftstring.$(SO): $(SRC_DIR)/ftstring.c \ - $(SRC_DIR)/ftcommon.h \ - $(GRAPH_LIB) - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) - - - #################################################################### - # - # Special rule to compile the `ftdump' program as it includes - # internal header files. - # - $(OBJ_DIR_2)/ftdump.$(SO): $(SRC_DIR)/ftdump.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - - #################################################################### - # - # Special rule to compile the `t1dump' program as it includes - # the Type1 source path. - # - $(OBJ_DIR_2)/t1dump.$(SO): $(SRC_DIR)/t1dump.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) - - - #################################################################### - # - # Special rule to compile the `ftvalid' program as it includes - # internal header files. - # - $(OBJ_DIR_2)/ftvalid.$(SO): $(SRC_DIR)/ftvalid.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - - #################################################################### - # - # Special rule to compile the `ftview' program as it includes - # internal header files. - # - $(OBJ_DIR_2)/ftview.$(SO): $(SRC_DIR)/ftview.c \ - $(SRC_DIR)/ftcommon.h \ - $(GRAPH_LIB) - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - - #################################################################### - # - # Special rule to compile the `ftdiff' program as it includes - # internal header files. - # - $(OBJ_DIR_2)/ftdiff.$(SO): $(SRC_DIR)/ftdiff.c \ - $(SRC_DIR)/ftcommon.h \ - $(GRAPH_LIB) - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - - #################################################################### - # - # Special rule to compile the `ftgrid' program as it includes - # internal header files. - # - $(OBJ_DIR_2)/ftgrid.$(SO): $(SRC_DIR)/ftgrid.c \ - $(SRC_DIR)/ftcommon.h \ - $(GRAPH_LIB) - $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ - $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY - - - #################################################################### - # - # Special rule to compile the `ttdebug' program as it includes - # the TrueType source path and needs extra flags for correct keyboard - # handling on Unix. - - $(OBJ_DIR_2)/ttdebug.$(SO): $(SRC_DIR)/ttdebug.c - $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) \ - $I$(subst /,$(COMPILER_SEP),$(TOP_DIR)/src/truetype) \ - $(EXTRAFLAGS) $DFT2_BUILD_LIBRARY - - - #################################################################### - # - # Rules used to link the executables. Note that they could be - # overridden by system-specific things. - # - $(BIN_DIR_2)/ftlint$E: $(OBJ_DIR_2)/ftlint.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/ftbench$E: $(OBJ_DIR_2)/ftbench.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/ftpatchk$E: $(OBJ_DIR_2)/ftpatchk.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/ftchkwd$E: $(OBJ_DIR_2)/ftchkwd.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/ftmemchk$E: $(OBJ_DIR_2)/ftmemchk.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/compos$E: $(OBJ_DIR_2)/compos.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/ftvalid$E: $(OBJ_DIR_2)/ftvalid.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/ftdump$E: $(OBJ_DIR_2)/ftdump.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/fttimer$E: $(OBJ_DIR_2)/fttimer.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/fttry$E: $(OBJ_DIR_2)/fttry.$(SO) $(FTLIB) - $(LINK) - -# $(BIN_DIR_2)/ftsbit$E: $(OBJ_DIR_2)/ftsbit.$(SO) $(FTLIB) -# $(LINK) - - $(BIN_DIR_2)/t1dump$E: $(OBJ_DIR_2)/t1dump.$(SO) $(FTLIB) - $(LINK) - - $(BIN_DIR_2)/ttdebug$E: $(OBJ_DIR_2)/ttdebug.$(SO) $(FTLIB) $(COMMON_OBJ) - $(LINK_COMMON) - - $(BIN_DIR_2)/testname$E: $(OBJ_DIR_2)/testname.$(SO) $(FTLIB) - $(LINK) - - - $(BIN_DIR_2)/ftview$E: $(OBJ_DIR_2)/ftview.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) - $(LINK_NEW) - - $(BIN_DIR_2)/ftgrid$E: $(OBJ_DIR_2)/ftgrid.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) - $(LINK_NEW) - - $(BIN_DIR_2)/ftgamma$E: $(OBJ_DIR_2)/ftgamma.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) - $(LINK_NEW) - - $(BIN_DIR_2)/ftdiff$E: $(OBJ_DIR_2)/ftdiff.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) - $(LINK_NEW) - - $(BIN_DIR_2)/ftmulti$E: $(OBJ_DIR_2)/ftmulti.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) - $(LINK_GRAPH) - - $(BIN_DIR_2)/ftstring$E: $(OBJ_DIR_2)/ftstring.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) - $(LINK_NEW) - - -endif - - -# This target builds the tarballs. -# -# Not to be run by a normal user -- there are no attempts to make it -# generic. - -# we check for `dist', not `distclean' -ifneq ($(findstring distx,$(MAKECMDGOALS)x),) - FT_H := ../freetype2/include/freetype/freetype.h - - major := $(shell sed -n 's/.*FREETYPE_MAJOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) - minor := $(shell sed -n 's/.*FREETYPE_MINOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) - patch := $(shell sed -n 's/.*FREETYPE_PATCH[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) - - ifneq ($(findstring x0x,x$(patch)x),) - version := $(major).$(minor) - winversion := $(major)$(minor) - else - version := $(major).$(minor).$(patch) - winversion := $(major)$(minor)$(patch) - endif -endif - -dist: - -rm -rf tmp - rm -f ft2demos-$(version).tar.gz - rm -f ft2demos-$(version).tar.bz2 - rm -f ftdmo$(winversion).zip - - for d in `find . -wholename '*/.git' -prune \ - -o -type f \ - -o -print` ; do \ - mkdir -p tmp/$$d ; \ - done ; - - currdir=`pwd` ; \ - for f in `find . -wholename '*/.git' -prune \ - -o -name .gitignore \ - -o -name .mailmap \ - -o -type d \ - -o -print` ; do \ - ln -s $$currdir/$$f tmp/$$f ; \ - done - - cd tmp ; \ - $(MAKE) distclean - - mv tmp ft2demos-$(version) - - tar -H ustar -chf - ft2demos-$(version) \ - | gzip -c > ft2demos-$(version).tar.gz - tar -H ustar -chf - ft2demos-$(version) \ - | bzip2 -c > ft2demos-$(version).tar.bz2 - - @# Use CR/LF for zip files. - zip -lr ftdmo$(winversion).zip ft2demos-$(version) - - rm -fr ft2demos-$(version) - -# EOF diff -Nru freetype-2.7.1/=unpacked-tar1=/obj/README freetype-2.8/=unpacked-tar1=/obj/README --- freetype-2.7.1/=unpacked-tar1=/obj/README 2009-03-14 13:58:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/obj/README 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -This directory contains all the object files generated for the demonstration programs diff -Nru freetype-2.7.1/=unpacked-tar1=/README freetype-2.8/=unpacked-tar1=/README --- freetype-2.7.1/=unpacked-tar1=/README 2016-12-30 20:32:34.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -This package contains example programs for the FreeType 2 library. - - -WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - - The Makefile and Jamfile contained in this directory assume that the - FreeType 2 library sources are located in `../freetype2'. If you - downloaded one of the stable FreeType 2 source packages from our - server, you most probably have to rename its directory, for example: - - mv freetype-2.7.1 freetype2 on Unix - rename freetype-2.7.1 freetype2 on Windows - -WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - - - First compile the FreeType 2 library, then say `make'. However, you - must rename the directory of the FreeType 2 library to `freetype2' - (or create a symlink) before doing this. - - Note that the demonstration programs include a tiny graphics - sub-system that includes `drivers' to display Windows on Win32, X11, - BeOS, Mac, and OS/2. The build system should automatically detect - which driver to use based on the current platform. - - UNIX USERS - ========== - - X11 issues - ---------- - - When building the demos, the build system tries to detect your X11 - path by looking for the patterns `X11/bin', `X11R6/bin', and - `X11R5/bin' in your current path (in this order). If no X11 path - is found, some demo programs will not be able to display graphics - and will fail. If you have X11 in an unusual place, use the - X11_PATH make variable. More than one directory, if necessary, - must be separated with spaces. Example: - - make X11_PATH="/usr/openwin /usr/local/X11R6" - - The build system then derives the X11_INCLUDE include file path - from X11_PATH by appending `/include' to all path components. It - also derives the X11_LIB library path from X11_PATH by appending - `/lib64' and `/lib' to all components (in that order). You might - override those variables similar to X11_PATH as arguments to - `make'. - - If you don't have X11 at all, fix the definition of the EXES - variable as described in the top-level Makefile. - - Recent versions of Mac OS X no longer deliver X11 by default; you - have to install XQuartz, see - - https://support.apple.com/en-us/HT201341 - - for more details. - - - Using a different build directory - --------------------------------- - - If the `configure' script of the FreeType 2 library is run from a - separate build directory, it creates a dummy Makefile which sets - some variables before including the top-level Makefile of the - source directory. This dummy Makefile can also be used for the - ft2demos package to be compiled in a different build directory: - - make FT2DEMOS=1 -f /path/to/freetype2/build-dir/Makefile - - If necessary, adapt the `TOP_DIR_2' variable to make it point to - the ft2demos source directory. - ---- end of README --- diff -Nru freetype-2.7.1/=unpacked-tar1=/src/common.c freetype-2.8/=unpacked-tar1=/src/common.c --- freetype-2.7.1/=unpacked-tar1=/src/common.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/* some utility functions */ - -#include "common.h" - -#include -#include -#include - - - char* - ft_basename( const char* name ) - { - const char* base; - const char* current; - char c; - - base = name; - current = name; - - c = *current; - - while ( c ) - { -#ifndef macintosh - if ( c == '/' || c == '\\' ) -#else - if ( c == ':' ) -#endif - base = current + 1; - - current++; - c = *current; - } - - return (char*)base; - } - - - void - Panic( const char* fmt, - ... ) - { - va_list ap; - - - va_start( ap, fmt ); - vprintf( fmt, ap ); - va_end( ap ); - - exit( 1 ); - } - - - extern int - utf8_next( const char** pcursor, - const char* end ) - { - const unsigned char* p = (const unsigned char*)*pcursor; - int ch; - - - if ( (const char*)p >= end ) /* end of stream */ - return -1; - - ch = *p++; - if ( ch >= 0x80 ) - { - int len; - - - if ( ch < 0xc0 ) /* malformed data */ - goto BAD_DATA; - else if ( ch < 0xe0 ) - { - len = 1; - ch &= 0x1f; - } - else if ( ch < 0xf0 ) - { - len = 2; - ch &= 0x0f; - } - else - { - len = 3; - ch &= 0x07; - } - - while ( len > 0 ) - { - if ( (const char*)p >= end || ( p[0] & 0xc0 ) != 0x80 ) - goto BAD_DATA; - - ch = ( ch << 6 ) | ( p[0] & 0x3f ); - p += 1; - len -= 1; - } - } - - *pcursor = (const char*)p; - - return ch; - - BAD_DATA: - return -1; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/common.h freetype-2.8/=unpacked-tar1=/src/common.h --- freetype-2.7.1/=unpacked-tar1=/src/common.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -#ifndef COMMON_H_ -#define COMMON_H_ - - -#ifdef __cplusplus - extern "C" { -#endif - - extern char* - ft_basename( const char* name ); - - /* print a message and exit */ - extern void - Panic( const char* fmt, - ... ); - - /* - * Read the next UTF-8 code from `*pcursor' and - * returns its value. `end' is the limit of the - * input string. - * - * Return -1 if the end of the input string is - * reached, or in case of malformed data. - */ - extern int - utf8_next( const char** pcursor, - const char* end ); - -#ifdef __cplusplus - } -#endif - -#endif /* COMMON_H_ */ - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/compos.c freetype-2.8/=unpacked-tar1=/src/compos.c --- freetype-2.7.1/=unpacked-tar1=/src/compos.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/compos.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-1998, 2001, 2003, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* compos: this is a very simple program used to test the flag */ -/* FT_LOAD_NO_RECURSE */ -/* */ -/* NOTE: This is just a test program that is used to show off and */ -/* debug the current engine. */ -/* */ -/****************************************************************************/ - -#include -#include FT_FREETYPE_H - -#include -#include -#include - - -#define gettext( x ) ( x ) - - FT_Error error; - - FT_Library library; - FT_Face face; - FT_Size size; - FT_GlyphSlot slot; - - unsigned int num_glyphs; - int ptsize; - - int Fail; - int Num; - - - - static void Usage( char* name ) - { - printf( "compos: test FT_LOAD_NO_RECURSE load flag - www.freetype.org\n" ); - printf( "------------------------------------------------------------\n" ); - printf( "\n" ); - printf( "Usage: %s fontname[.ttf|.ttc] [fontname2..]\n", name ); - printf( "\n" ); - - exit( 1 ); - } - - - static void Panic( const char* message ) - { - fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); - exit(1); - } - - - int main( int argc, char** argv ) - { - int i, file_index; - unsigned int id; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - char* fname; - - - execname = argv[0]; - - if ( argc < 2 ) - Usage( execname ); - - error = FT_Init_FreeType( &library ); - if (error) Panic( "Could not create library object" ); - - /* Now check all files */ - for ( file_index = 1; file_index < argc; file_index++ ) - { - fname = argv[file_index]; - i = strlen( fname ); - while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) - { - if ( fname[i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, fname, 1024 ); - strncpy( alt_filename, fname, 1024 ); - -#ifndef macintosh - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } -#endif - i = strlen( filename ); - fname = filename; - - while ( i >= 0 ) -#ifndef macintosh - if ( filename[i] == '/' || filename[i] == '\\' ) -#else - if ( filename[i] == ':' ) -#endif - { - fname = filename + i + 1; - i = -1; - } - else - i--; - - printf( "%s:\n", fname ); - - /* Load face */ - error = FT_New_Face( library, filename, 0, &face ); - if (error) - { - if (error == FT_Err_Invalid_File_Format) - printf( "unknown format\n" ); - else - printf( "could not find/open file (error: %d)\n", error ); - continue; - } - - num_glyphs = face->num_glyphs; - slot = face->glyph; - - Fail = 0; - { - for ( id = 0; id < num_glyphs; id++ ) - { - int has_scale; - - error = FT_Load_Glyph( face, id, FT_LOAD_NO_RECURSE ); - if ( !error && slot->format == FT_GLYPH_FORMAT_COMPOSITE ) - { - int n; - FT_SubGlyph* subg = slot->subglyphs; - - printf( "%4d:", id ); - for ( n = 0; n < slot->num_subglyphs; n++, subg++ ) - { - has_scale = subg->flags & ( - FT_SUBGLYPH_FLAG_SCALE | - FT_SUBGLYPH_FLAG_XY_SCALE | - FT_SUBGLYPH_FLAG_2X2 ); - - printf( " [%d%c", - subg->index, - subg->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ? '*' : ' ' ); - - if ( subg->arg1|subg->arg2 ) - { - if ( subg->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) - printf( "(%d,%d)", subg->arg1, subg->arg2 ); - else - printf( "<%d,%d>", subg->arg1, subg->arg2 ); - } - - if (has_scale) - printf( "-{%0.3f %0.3f %0.3f %0.3f}", - subg->transform.xx/65536.0, - subg->transform.xy/65536.0, - subg->transform.yx/65536.0, - subg->transform.yy/65536.0 ); - printf( "]" ); - } - printf( " adv=%ld lsb=%ld\n", - slot->metrics.horiAdvance, - slot->metrics.horiBearingX ); - } - } - } - - FT_Done_Face( face ); - } - - FT_Done_FreeType(library); - exit( 0 ); /* for safety reasons */ - - return 0; /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftbench.1 freetype-2.8/=unpacked-tar1=/src/ftbench.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftbench.1 2016-12-30 20:32:34.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftbench.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -'\" t -.TH FTVIEW 1 "December 2016" "Freetype 2.7.1" -. -. -.SH NAME -. -ftbench \- benchmark some common FreeType paths -. -. -.SH SYNOPSIS -. -.B ftbench -.RI [ options ] -.I fontname -. -. -.SH DESCRIPTION -. -The -.B ftbench -tool measures performance of some common FreeType operations. -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.B \-C -Compare with cached version if available. -. -.TP -.BI \-c \ n -Use at most -.I n -iterations for each test (0 means time limited). -. -.TP -.BI \-f \ l -Use -.B hexadecimal -(not decimal) number -.I l -as load flags (see the -.RB ` FT_LOAD_XXX ' -macros in the FreeType reference). -. -.TP -.BI "\-H " name -Using CFF hinting engine -.IR name . -Available versions are depending on compilation options of FreeType; -call -.B ftbench -without an argument to get the actual list. -. -.TP -.BI "\-I " ver -Using TT interpreter version -.IR ver . -Available versions are depending on compilation options of FreeType; -call -.B ftbench -without an argument to get the actual list. -. -.TP -.BI \-i \ idx -Start with glyph index -.I idx -(default is 0, which means to process all glyphs). -. -.TP -.BI \-m \ m -Set maximum cache size to -.I M -KiByte (default is 1024). -. -.TP -.B \-p -Preload font file in memory (this is, testing -.B FT_New_Memory_Face -instead of -.BR FT_New_Face ). -. -.TP -.BI \-r \ n -Set render mode to -.IR n : -. -.RS -.TS -tab (@); -rB l. -0@normal -1@light -2@mono -3@horizontal LCD -4@vertical LCD -.TE -.RE -. -.IP -(default is 0). -This corresponds to the values of the -.RB ` FT_RENDER_MODE_XXX ' -flags. -. -.TP -.BI \-s \ s -Use -.I s -ppem as face size (default is 10ppem). -If set to zero, don't call -.BR FT_Set_Pixel_Sizes . -Use value\ 0 with option -.RB ` "-f\ 1" ' -or something similar to load the glyphs unscaled, -otherwise errors will show up. -. -.TP -.BI \-t \ t -Use at most -.I t -seconds per test (default is 2). -. -.TP -.BI \-b \ tests -Perform chosen tests: -. -.RS -.TS -tab (@); -rB l. -a@load glyphs (FT_Load_Glyph) -b@load advance widths (FT_Get_Advances) -c@render glyphs (FT_Render_Glyph) -d@load glyphs (FT_Get_Glyph) -e@get glyph cboxes (FT_Glyph_Get_CBox) -f@get glyph indices (FT_Get_Char_Index) -g@iterate CMap (FT_Get_{First,Next}_Char) -h@open a new face (FT_New_Face or FT_New_Memory_Face) -i@embolden glyphs (FT_GlyphSlot_Embolden) -j@get glyph bboxes (FT_Outline_Get_BBox) -.TE -.RE -. -.IP -(default is -.BR abcdefghij , -this is, all tests). -. -.IP -The number of used glyphs per test (within a single iteration) is given by -option -.BR \-i . -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftbench.c freetype-2.8/=unpacked-tar1=/src/ftbench.c --- freetype-2.7.1/=unpacked-tar1=/src/ftbench.c 2016-12-25 12:36:51.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftbench.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1301 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2002-2016 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* ftbench: bench some common FreeType call paths */ -/* */ -/****************************************************************************/ - - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE /* we want to use extensions to `time.h' if available */ -#endif - -#include -#include -#include -#include -#include - -#include FT_FREETYPE_H -#include FT_GLYPH_H -#include FT_CACHE_H -#include FT_CACHE_CHARMAP_H -#include FT_CACHE_IMAGE_H -#include FT_CACHE_SMALL_BITMAPS_H -#include FT_SYNTHESIS_H -#include FT_ADVANCES_H -#include FT_OUTLINE_H -#include FT_BBOX_H -#include FT_MODULE_H -#include FT_CFF_DRIVER_H -#include FT_TRUETYPE_DRIVER_H - -#ifdef UNIX -#include -#else -#include "mlgetopt.h" -#endif - -#include "common.h" - - - typedef struct btimer_t_ { - double t0; - double total; - - } btimer_t; - - - typedef int - (*bcall_t)( btimer_t* timer, - FT_Face face, - void* user_data ); - - - typedef struct btest_t_ { - const char* title; - bcall_t bench; - int cache_first; - void* user_data; - - } btest_t; - - - typedef struct bcharset_t_ - { - FT_Int size; - FT_ULong* code; - - } bcharset_t; - - - static FT_Error - get_face( FT_Face* face ); - - - /* - * Globals - */ - -#define CACHE_SIZE 1024 -#define BENCH_TIME 2.0f -#define FACE_SIZE 10 - - - static FT_Library lib; - static FTC_Manager cache_man; - static FTC_CMapCache cmap_cache; - static FTC_ImageCache image_cache; - static FTC_SBitCache sbit_cache; - static FTC_ImageTypeRec font_type; - - - enum { - FT_BENCH_LOAD_GLYPH, - FT_BENCH_LOAD_ADVANCES, - FT_BENCH_RENDER, - FT_BENCH_GET_GLYPH, - FT_BENCH_GET_CBOX, - FT_BENCH_CMAP, - FT_BENCH_CMAP_ITER, - FT_BENCH_NEW_FACE, - FT_BENCH_EMBOLDEN, - FT_BENCH_GET_BBOX, - N_FT_BENCH - }; - - - static const char* bench_desc[] = - { - "load a glyph (FT_Load_Glyph)", - "load advance widths (FT_Get_Advances)", - "render a glyph (FT_Render_Glyph)", - "load a glyph (FT_Get_Glyph)", - "get glyph cbox (FT_Glyph_Get_CBox)", - "get glyph indices (FT_Get_Char_Index)", - "iterate CMap (FT_Get_{First,Next}_Char)", - "open a new face (FT_New_Face)", - "embolden (FT_GlyphSlot_Embolden)", - "get glyph bbox (FT_Outline_Get_BBox)", - NULL - }; - - - static int preload; - static char* filename; - - static unsigned int first_index; - - static FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL; - static FT_Int32 load_flags = FT_LOAD_DEFAULT; - - static unsigned int tt_interpreter_versions[3]; - static int num_tt_interpreter_versions; - static unsigned int dflt_tt_interpreter_version; - - static unsigned int cff_hinting_engines[2]; - static int num_cff_hinting_engines; - static unsigned int dflt_cff_hinting_engine; - - static char cff_hinting_engine_names[2][10] = { "freetype", - "adobe" }; - - - /* - * Dummy face requester (the face object is already loaded) - */ - - static FT_Error - face_requester( FTC_FaceID face_id, - FT_Library library, - FT_Pointer request_data, - FT_Face* aface ) - { - FT_UNUSED( face_id ); - FT_UNUSED( library ); - - *aface = (FT_Face)request_data; - - return FT_Err_Ok; - } - - - /* - * timer in milliseconds - */ - - static double - get_time( void ) - { -#if defined _POSIX_TIMERS && _POSIX_TIMERS > 0 - struct timespec tv; - - -#ifdef _POSIX_CPUTIME - clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &tv ); -#else - clock_gettime( CLOCK_REALTIME, &tv ); -#endif /* _POSIX_CPUTIME */ - - return 1E6 * (double)tv.tv_sec + 1E-3 * (double)tv.tv_nsec; -#else - /* clock() accuracy has improved since glibc 2.18 */ - return 1E6 * (double)clock() / (double)CLOCKS_PER_SEC; -#endif /* _POSIX_TIMERS */ - } - -#define TIMER_START( timer ) ( timer )->t0 = get_time() -#define TIMER_STOP( timer ) ( timer )->total += get_time() - ( timer )->t0 -#define TIMER_GET( timer ) ( timer )->total -#define TIMER_RESET( timer ) ( timer )->total = 0 - - - /* - * Bench code - */ - - static void - benchmark( FT_Face face, - btest_t* test, - int max_iter, - double max_time ) - { - int n, done; - btimer_t timer, elapsed; - - - if ( test->cache_first ) - { - if ( !cache_man ) - { - printf( " %-25s no cache manager\n", test->title ); - - return; - } - - TIMER_RESET( &timer ); - test->bench( &timer, face, test->user_data ); - } - - printf( " %-25s ", test->title ); - fflush( stdout ); - - TIMER_RESET( &timer ); - TIMER_RESET( &elapsed ); - - for ( n = 0, done = 0; !max_iter || n < max_iter; n++ ) - { - TIMER_START( &elapsed ); - - done += test->bench( &timer, face, test->user_data ); - - TIMER_STOP( &elapsed ); - - if ( TIMER_GET( &elapsed ) > 1E6 * max_time ) - break; - } - - if ( done ) - printf( "%5.3f us/op\n", TIMER_GET( &timer ) / (double)done ); - else - printf( "no error-free calls\n" ); - } - - - /* - * Various tests - */ - - static int - test_load( btimer_t* timer, - FT_Face face, - void* user_data ) - { - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - TIMER_START( timer ); - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( !FT_Load_Glyph( face, i, load_flags ) ) - done++; - } - - TIMER_STOP( timer ); - - return done; - } - - - static int - test_load_advances( btimer_t* timer, - FT_Face face, - void* user_data ) - { - int done = 0; - FT_Fixed* advances; - FT_ULong flags = *((FT_ULong*)user_data); - - - advances = (FT_Fixed *)calloc( sizeof ( FT_Fixed ), - (size_t)face->num_glyphs ); - - TIMER_START( timer ); - - FT_Get_Advances( face, - first_index, - (unsigned int)face->num_glyphs - first_index, - (FT_Int32)flags, - advances ); - done += face->num_glyphs - (int)first_index; - - TIMER_STOP( timer ); - - free( advances ); - - return done; - } - - - static int - test_render( btimer_t* timer, - FT_Face face, - void* user_data ) - { - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( FT_Load_Glyph( face, i, load_flags ) ) - continue; - - TIMER_START( timer ); - if ( !FT_Render_Glyph( face->glyph, render_mode ) ) - done++; - TIMER_STOP( timer ); - } - - return done; - } - - - static int - test_embolden( btimer_t* timer, - FT_Face face, - void* user_data ) - { - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( FT_Load_Glyph( face, i, load_flags ) ) - continue; - - TIMER_START( timer ); - FT_GlyphSlot_Embolden( face->glyph ); - done++; - TIMER_STOP( timer ); - } - - return done; - } - - - static int - test_get_glyph( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FT_Glyph glyph; - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( FT_Load_Glyph( face, i, load_flags ) ) - continue; - - TIMER_START( timer ); - if ( !FT_Get_Glyph( face->glyph, &glyph ) ) - { - FT_Done_Glyph( glyph ); - done++; - } - TIMER_STOP( timer ); - } - - return done; - } - - - static int - test_get_cbox( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FT_Glyph glyph; - FT_BBox bbox; - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( FT_Load_Glyph( face, i, load_flags ) ) - continue; - - if ( FT_Get_Glyph( face->glyph, &glyph ) ) - continue; - - TIMER_START( timer ); - FT_Glyph_Get_CBox( glyph, FT_GLYPH_BBOX_PIXELS, &bbox ); - TIMER_STOP( timer ); - - FT_Done_Glyph( glyph ); - done++; - } - - return done; - } - - - static int - test_get_bbox( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FT_BBox bbox; - unsigned int i; - int done = 0; - FT_Matrix rot30 = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 }; - - FT_UNUSED( user_data ); - - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - FT_Outline* outline; - - - if ( FT_Load_Glyph( face, i, load_flags ) ) - continue; - - outline = &face->glyph->outline; - - /* rotate outline by 30 degrees */ - FT_Outline_Transform( outline, &rot30 ); - - TIMER_START( timer ); - FT_Outline_Get_BBox( outline, &bbox ); - TIMER_STOP( timer ); - - done++; - } - - return done; - } - - - static int - test_get_char_index( btimer_t* timer, - FT_Face face, - void* user_data ) - { - bcharset_t* charset = (bcharset_t*)user_data; - int i, done = 0; - - - TIMER_START( timer ); - - for ( i = 0; i < charset->size; i++ ) - { - if ( FT_Get_Char_Index(face, charset->code[i]) ) - done++; - } - - TIMER_STOP( timer ); - - return done; - } - - - static int - test_cmap_cache( btimer_t* timer, - FT_Face face, - void* user_data ) - { - bcharset_t* charset = (bcharset_t*)user_data; - int i, done = 0; - - FT_UNUSED( face ); - - - if ( !cmap_cache ) - { - if ( FTC_CMapCache_New( cache_man, &cmap_cache ) ) - return 0; - } - - TIMER_START( timer ); - - for ( i = 0; i < charset->size; i++ ) - { - if ( FTC_CMapCache_Lookup( cmap_cache, - font_type.face_id, - 0, - charset->code[i] ) ) - done++; - } - - TIMER_STOP( timer ); - - return done; - } - - - static int - test_image_cache( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FT_Glyph glyph; - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - if ( !image_cache ) - { - if ( FTC_ImageCache_New( cache_man, &image_cache ) ) - return 0; - } - - TIMER_START( timer ); - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( !FTC_ImageCache_Lookup( image_cache, - &font_type, - i, - &glyph, - NULL ) ) - done++; - } - - TIMER_STOP( timer ); - - return done; - } - - - static int - test_sbit_cache( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FTC_SBit glyph; - unsigned int i; - int done = 0; - - FT_UNUSED( user_data ); - - - if ( !sbit_cache ) - { - if ( FTC_SBitCache_New( cache_man, &sbit_cache ) ) - return 0; - } - - TIMER_START( timer ); - - for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) - { - if ( !FTC_SBitCache_Lookup( sbit_cache, - &font_type, - i, - &glyph, - NULL ) ) - done++; - } - - TIMER_STOP( timer ); - - return done; - } - - - static int - test_cmap_iter( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FT_UInt idx; - FT_ULong charcode; - - FT_UNUSED( user_data ); - - - TIMER_START( timer ); - - charcode = FT_Get_First_Char( face, &idx ); - while ( idx != 0 ) - charcode = FT_Get_Next_Char( face, charcode, &idx ); - - TIMER_STOP( timer ); - - return 1; - } - - - static int - test_new_face( btimer_t* timer, - FT_Face face, - void* user_data ) - { - FT_Face bench_face; - - FT_UNUSED( face ); - FT_UNUSED( user_data ); - - - TIMER_START( timer ); - - if ( !get_face( &bench_face ) ) - FT_Done_Face( bench_face ); - - TIMER_STOP( timer ); - - return 1; - } - - - /* - * main - */ - - static void - get_charset( FT_Face face, - bcharset_t* charset ) - { - FT_ULong charcode; - FT_UInt gindex; - int i; - - - charset->code = (FT_ULong*)calloc( (size_t)face->num_glyphs, - sizeof ( FT_ULong ) ); - if ( !charset->code ) - return; - - if ( face->charmap ) - { - i = 0; - charcode = FT_Get_First_Char( face, &gindex ); - - /* certain fonts contain a broken charmap that will map character */ - /* codes to out-of-bounds glyph indices. Take care of that here. */ - /* */ - while ( gindex && i < face->num_glyphs ) - { - if ( gindex >= first_index ) - charset->code[i++] = charcode; - charcode = FT_Get_Next_Char( face, charcode, &gindex ); - } - } - else - { - unsigned int j; - - - /* no charmap, do an identity mapping */ - for ( i = 0, j = first_index; - j < (unsigned int)face->num_glyphs; - i++, j++ ) - charset->code[i] = j; - } - - charset->size = i; - } - - - static FT_Error - get_face( FT_Face* face ) - { - static unsigned char* memory_file = NULL; - static size_t memory_size; - int face_index = 0; - FT_Error error; - - - if ( preload ) - { - if ( !memory_file ) - { - FILE* file = fopen( filename, "rb" ); - - - if ( file == NULL ) - { - fprintf( stderr, "couldn't find or open `%s'\n", filename ); - - return 1; - } - - fseek( file, 0, SEEK_END ); - memory_size = (size_t)ftell( file ); - fseek( file, 0, SEEK_SET ); - - memory_file = (FT_Byte*)malloc( memory_size ); - if ( memory_file == NULL ) - { - fprintf( stderr, - "couldn't allocate memory to pre-load font file\n" ); - - return 1; - } - - if ( fread( memory_file, 1, memory_size, file ) != memory_size ) - { - fprintf( stderr, "read error\n" ); - free( memory_file ); - memory_file = NULL; - - return 1; - } - } - - error = FT_New_Memory_Face( lib, - memory_file, - (FT_Long)memory_size, - face_index, - face ); - } - else - error = FT_New_Face( lib, filename, face_index, face ); - - if ( error ) - fprintf( stderr, "couldn't load font resource\n"); - - return error; - } - - - static void - usage( void ) - { - int i; - char interpreter_versions[32]; - char hinting_engines[32]; - - - /* we expect that at least one interpreter version is available */ - if ( num_tt_interpreter_versions == 2 ) - sprintf(interpreter_versions, - "%d and %d", - tt_interpreter_versions[0], - tt_interpreter_versions[1] ); - else - sprintf(interpreter_versions, - "%d, %d, and %d", - tt_interpreter_versions[0], - tt_interpreter_versions[1], - tt_interpreter_versions[2] ); - - /* we expect that at least one hinting engine is available */ - if ( num_cff_hinting_engines == 1 ) - sprintf(hinting_engines, - "`%s'", - cff_hinting_engine_names[cff_hinting_engines[0]] ); - else - sprintf(hinting_engines, - "`%s' and `%s'", - cff_hinting_engine_names[cff_hinting_engines[0]], - cff_hinting_engine_names[cff_hinting_engines[1]] ); - - - fprintf( stderr, - "\n" - "ftbench: run FreeType benchmarks\n" - "--------------------------------\n" - "\n" - "Usage: ftbench [options] fontname\n" - "\n" - " -C Compare with cached version (if available).\n" - " -c N Use at most N iterations for each test\n" - " (0 means time limited).\n" - " -f L Use hex number L as load flags (see `FT_LOAD_XXX').\n" - " -H NAME Use CFF hinting engine NAME.\n" - " Available versions are %s; default is `%s'.\n" - " -I VER Use TT interpreter version VER.\n" - " Available versions are %s; default is version %d.\n" - " -i IDX Start with index IDX (default is 0).\n" - " -m M Set maximum cache size to M KiByte (default is %d).\n", - hinting_engines, - cff_hinting_engine_names[dflt_cff_hinting_engine], - interpreter_versions, - dflt_tt_interpreter_version, - CACHE_SIZE ); - fprintf( stderr, - " -p Preload font file in memory.\n" - " -r N Set render mode to N\n" - " 0: normal, 1: light, 2: mono, 3: LCD, 4: LCD vertical\n" - " (default is 0).\n" - " -s S Use S ppem as face size (default is %dppem).\n" - " If set to zero, don't call FT_Set_Pixel_Sizes.\n" - " Use value 0 with option `-f 1' or something similar to\n" - " load the glyphs unscaled, otherwise errors will show up.\n", - FACE_SIZE ); - fprintf( stderr, - " -t T Use at most T seconds per bench (default is %.0f).\n" - "\n" - " -b tests Perform chosen tests (default is all):\n", - BENCH_TIME ); - - for ( i = 0; i < N_FT_BENCH; i++ ) - { - if ( !bench_desc[i] ) - break; - - fprintf( stderr, - " %c %s\n", 'a' + i, bench_desc[i] ); - } - - fprintf( stderr, - "\n" - " -v Show version.\n" - "\n" ); - - exit( 1 ); - } - - -#define TEST( x ) ( !test_string || strchr( test_string, (x) ) ) - - - int - main( int argc, - char** argv ) - { - FT_Face face; - FT_Error error; - - unsigned long max_bytes = CACHE_SIZE * 1024; - char* test_string = NULL; - unsigned int size = FACE_SIZE; - int max_iter = 0; - double max_time = BENCH_TIME; - int compare_cached = 0; - size_t i; - int j; - - unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - TT_INTERPRETER_VERSION_40 }; - unsigned int engines[2] = { FT_CFF_HINTING_FREETYPE, - FT_CFF_HINTING_ADOBE }; - int version; - char *engine; - - - if ( FT_Init_FreeType( &lib ) ) - { - fprintf( stderr, "could not initialize font library\n" ); - - return 1; - } - - - /* collect all available versions, then set again the default */ - FT_Property_Get( lib, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - for ( j = 0; j < 3; j++ ) - { - error = FT_Property_Set( lib, - "truetype", - "interpreter-version", &versions[j] ); - if ( !error ) - tt_interpreter_versions[num_tt_interpreter_versions++] = versions[j]; - } - FT_Property_Set( lib, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - - FT_Property_Get( lib, - "cff", - "hinting-engine", &dflt_cff_hinting_engine ); - for ( j = 0; j < 2; j++ ) - { - error = FT_Property_Set( lib, - "cff", - "hinting-engine", &engines[j] ); - if ( !error ) - cff_hinting_engines[num_cff_hinting_engines++] = engines[j]; - } - FT_Property_Set( lib, - "cff", - "hinting-engine", &dflt_cff_hinting_engine ); - - - version = (int)dflt_tt_interpreter_version; - engine = cff_hinting_engine_names[dflt_cff_hinting_engine]; - - while ( 1 ) - { - int opt; - - - opt = getopt( argc, argv, "b:Cc:f:H:I:i:m:pr:s:t:v" ); - - if ( opt == -1 ) - break; - - switch ( opt ) - { - case 'b': - test_string = optarg; - break; - - case 'C': - compare_cached = 1; - break; - - case 'c': - max_iter = atoi( optarg ); - if ( max_iter < 0 ) - max_iter = -max_iter; - break; - - case 'f': - load_flags = strtol( optarg, NULL, 16 ); - break; - - case 'H': - engine = optarg; - - for ( j = 0; j < num_cff_hinting_engines; j++ ) - { - if ( !strcmp( engine, cff_hinting_engine_names[j] ) ) - { - FT_Property_Set( lib, - "cff", - "hinting-engine", &j ); - break; - } - } - - if ( j == num_cff_hinting_engines ) - fprintf( stderr, - "warning: couldn't set CFF hinting engine\n" ); - break; - - case 'I': - version = atoi( optarg ); - - for ( j = 0; j < num_tt_interpreter_versions; j++ ) - { - if ( version == (int)tt_interpreter_versions[j] ) - { - FT_Property_Set( lib, - "truetype", - "interpreter-version", &version ); - break; - } - } - - if ( j == num_tt_interpreter_versions ) - fprintf( stderr, - "warning: couldn't set TT interpreter version\n" ); - break; - - case 'i': - { - int fi = atoi( optarg ); - - - if ( fi > 0 ) - first_index = (unsigned int)fi; - } - break; - - case 'm': - { - int mb = atoi( optarg ); - - - if ( mb > 0 ) - max_bytes = (unsigned int)mb * 1024; - } - break; - - case 'p': - preload = 1; - break; - - case 'r': - { - int rm = atoi( optarg ); - - - if ( rm < 0 || rm >= FT_RENDER_MODE_MAX ) - render_mode = FT_RENDER_MODE_NORMAL; - else - render_mode = (FT_Render_Mode)rm; - } - break; - - case 's': - { - int sz = atoi( optarg ); - - - /* value 0 is special */ - if ( sz < 0 ) - size = 1; - else - size = (unsigned int)sz; - } - break; - - case 't': - max_time = atof( optarg ); - if ( max_time < 0 ) - max_time = -max_time; - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( lib, &major, &minor, &patch ); - - printf( "ftbench (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - default: - usage(); - break; - } - } - - argc -= optind; - argv += optind; - - if ( argc != 1 ) - usage(); - - filename = *argv; - - if ( get_face( &face ) ) - goto Exit; - - if ( size ) - { - if ( FT_IS_SCALABLE( face ) ) - { - if ( FT_Set_Pixel_Sizes( face, size, size ) ) - { - fprintf( stderr, "failed to set pixel size to %d\n", size ); - - return 1; - } - } - else - { - size = (unsigned int)face->available_sizes[0].size >> 6; - fprintf( stderr, - "using size of first bitmap strike (%dpx)\n", size ); - FT_Select_Size( face, 0 ); - } - } - - FTC_Manager_New( lib, - 0, - 0, - max_bytes, - face_requester, - face, - &cache_man ); - - font_type.face_id = (FTC_FaceID)1; - font_type.width = size; - font_type.height = size; - font_type.flags = load_flags; - - printf( "\n" - "ftbench results for font `%s'\n" - "---------------------------", - filename ); - for ( i = 0; i < strlen( filename ); i++ ) - putchar( '-' ); - putchar( '\n' ); - - printf( "\n" - "family: %s\n" - " style: %s\n" - "\n", - face->family_name, - face->style_name ); - - if ( max_iter ) - printf( "number of iterations for each test: at most %d\n", - max_iter ); - printf( "number of seconds for each test: %s%f\n", - max_iter ? "at most " : "", - max_time ); - - printf( "\n" - "starting glyph index: %d\n" - "face size: %dppem\n" - "font preloading into memory: %s\n", - first_index, - size, - preload ? "yes" : "no" ); - - printf( "\n" - "load flags: 0x%X\n" - "render mode: %d\n", - load_flags, - render_mode ); - printf( "\n" - "CFF hinting engine set to `%s'\n" - "TrueType interpreter set to version %d\n" - "maximum cache size: %ldKiByte\n", - engine, - version, - max_bytes / 1024 ); - - printf( "\n" - "executing tests:\n" ); - - for ( j = 0; j < N_FT_BENCH; j++ ) - { - btest_t test; - FT_ULong flags; - - - if ( !TEST( 'a' + j ) ) - continue; - - test.title = NULL; - test.bench = NULL; - test.cache_first = 0; - test.user_data = NULL; - - switch ( j ) - { - case FT_BENCH_LOAD_GLYPH: - test.title = "Load"; - test.bench = test_load; - benchmark( face, &test, max_iter, max_time ); - - if ( compare_cached ) - { - test.cache_first = 1; - - test.title = "Load (image cached)"; - test.bench = test_image_cache; - benchmark( face, &test, max_iter, max_time ); - - test.title = "Load (sbit cached)"; - test.bench = test_sbit_cache; - if ( size ) - benchmark( face, &test, max_iter, max_time ); - else - printf( " %-25s disabled (size = 0)\n", test.title ); - } - break; - - case FT_BENCH_LOAD_ADVANCES: - test.user_data = &flags; - - test.title = "Load_Advances (Normal)"; - test.bench = test_load_advances; - flags = FT_LOAD_DEFAULT; - benchmark( face, &test, max_iter, max_time ); - - test.title = "Load_Advances (Fast)"; - test.bench = test_load_advances; - flags = FT_LOAD_TARGET_LIGHT; - benchmark( face, &test, max_iter, max_time ); - - test.title = "Load_Advances (Unscaled)"; - test.bench = test_load_advances; - flags = FT_LOAD_NO_SCALE; - benchmark( face, &test, max_iter, max_time ); - break; - - case FT_BENCH_RENDER: - test.title = "Render"; - test.bench = test_render; - if ( size ) - benchmark( face, &test, max_iter, max_time ); - else - printf( " %-25s disabled (size = 0)\n", test.title ); - break; - - case FT_BENCH_GET_GLYPH: - test.title = "Get_Glyph"; - test.bench = test_get_glyph; - benchmark( face, &test, max_iter, max_time ); - break; - - case FT_BENCH_GET_CBOX: - test.title = "Get_CBox"; - test.bench = test_get_cbox; - benchmark( face, &test, max_iter, max_time ); - break; - - case FT_BENCH_GET_BBOX: - test.title = "Get_BBox"; - test.bench = test_get_bbox; - benchmark( face, &test, max_iter, max_time ); - break; - - case FT_BENCH_CMAP: - { - bcharset_t charset; - - - get_charset( face, &charset ); - if ( charset.code ) - { - test.user_data = (void*)&charset; - - - test.title = "Get_Char_Index"; - test.bench = test_get_char_index; - - benchmark( face, &test, max_iter, max_time ); - - if ( compare_cached ) - { - test.cache_first = 1; - - test.title = "Get_Char_Index (cached)"; - test.bench = test_cmap_cache; - benchmark( face, &test, max_iter, max_time ); - } - - free( charset.code ); - } - } - break; - - case FT_BENCH_CMAP_ITER: - test.title = "Iterate CMap"; - test.bench = test_cmap_iter; - benchmark( face, &test, max_iter, max_time ); - break; - - case FT_BENCH_NEW_FACE: - test.title = "New_Face"; - test.bench = test_new_face; - benchmark( face, &test, max_iter, max_time ); - break; - - case FT_BENCH_EMBOLDEN: - test.title = "Embolden"; - test.bench = test_embolden; - if ( size ) - benchmark( face, &test, max_iter, max_time ); - else - printf( " %-25s disabled (size = 0)\n", test.title ); - break; - } - } - - Exit: - /* The following is a bit subtle: When we call FTC_Manager_Done, this - * normally destroys all FT_Face objects that the cache might have - * created by calling the face requester. - * - * However, this little benchmark uses a tricky face requester that - * doesn't create a new FT_Face through FT_New_Face but simply passes a - * pointer to the one that was previously created. - * - * If the cache manager has been used before, the call to - * FTC_Manager_Done discards our single FT_Face. - * - * In the case where no cache manager is in place, or if no test was - * run, the call to FT_Done_FreeType releases any remaining FT_Face - * object anyway. - */ - if ( cache_man ) - FTC_Manager_Done( cache_man ); - - FT_Done_FreeType( lib ); - - return 0; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftchkwd.c freetype-2.8/=unpacked-tar1=/src/ftchkwd.c --- freetype-2.7.1/=unpacked-tar1=/src/ftchkwd.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftchkwd.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality font engine */ -/* */ -/* Copyright 2003, 2011, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* ftchkwd */ -/* */ -/* NOTE: This is just a test program that is used to show off and */ -/* debug the current engine. */ -/* */ -/****************************************************************************/ - -#include -#include FT_FREETYPE_H - -#include -#include -#include - - - FT_Error error; - - - static void - Usage( char* name ) - { - printf( "ftchkwd: test fixed font width -- part of the FreeType project\n" ); - printf( "---------------------------------------------------------------------\n" ); - printf( "\n" ); - printf( "Usage: %s fontname[.ttf|.ttc] [fontname2..]\n", name ); - printf( "\n" ); - - exit( 1 ); - } - - - static void - Panic( const char* message ) - { - fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); - exit(1); - } - - - static const char* - file_basename( const char* pathname ) - { - const char* base = pathname; - const char* p = pathname; - - - while ( *p ) - { - if ( *p == '/' || *p == '\\' ) - base = p + 1; - - p++; - } - - return base; - } - - - static void - check_face( FT_Face face, - const char* filepathname, - int idx ) - { - int face_has_fixed_flag = FT_IS_FIXED_WIDTH(face); - int face_max_advance = face->max_advance_width; - int num_proportional = 0; - int n; - - FT_UNUSED( idx ); - - - printf( "%15s : %20s : ", - file_basename( filepathname ), - face->family_name ? face->family_name : "UNKNOWN FAMILY" ); - - for ( n = 0; n < face->num_glyphs; n++ ) - { - /* load the glyph outline */ - error = FT_Load_Glyph( face, n, FT_LOAD_NO_SCALE ); - if ( error ) - continue; - - if ( face->glyph->metrics.horiAdvance != face_max_advance ) - num_proportional++; - } - - if ( num_proportional > 0 ) - { - if ( face_has_fixed_flag ) - printf( "KO! Tagged as fixed, but has %d `proportional' glyphs", - num_proportional ); - else - printf( "OK (proportional)" ); - } - else - { - if ( face_has_fixed_flag ) - printf( "OK (fixed-width)" ); - else - printf( "KO! Tagged as proportional but has fixed width" ); - } - printf( "\n" ); - } - - - int - main( int argc, - char** argv ) - { - FT_Face face; - FT_Library library; - - int i, file_index; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - char* fname; - - - execname = argv[0]; - - if ( argc < 2 ) - Usage( execname ); - - error = FT_Init_FreeType( &library ); - if ( error ) - Panic( "Could not create library object" ); - - /* Now check all files */ - for ( file_index = 1; file_index < argc; file_index++ ) - { - fname = argv[file_index]; - - /* try to open the file with no extra extension first */ - error = FT_New_Face( library, fname, 0, &face ); - if ( !error ) - goto Success; - - if ( error == FT_Err_Unknown_File_Format ) - { - fprintf( stderr, "%s: unknown format\n", fname ); - continue; - } - - /* Ok, we could not load the file. Try to add an extension to */ - /* its name if possible. */ - - i = strlen( fname ); - while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) - { - if ( fname[i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, fname, 1024 ); - strncpy( alt_filename, fname, 1024 ); - -#ifndef macintosh - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } -#endif - - /* Load face */ - error = FT_New_Face( library, filename, 0, &face ); - if ( error ) - { - if ( error == FT_Err_Unknown_File_Format ) - printf( "unknown format\n" ); - else - printf( "could not find/open file (error: %d)\n", error ); - continue; - } - - Success: - check_face( face, fname, face->face_index ); - - FT_Done_Face( face ); - } - - FT_Done_FreeType( library ); - exit( 0 ); /* for safety reasons */ - - return 0; /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftcommon.c freetype-2.8/=unpacked-tar1=/src/ftcommon.c --- freetype-2.7.1/=unpacked-tar1=/src/ftcommon.c 2016-12-25 12:36:44.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftcommon.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1413 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2005-2009, 2011-2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* ftcommon.c - common routines for the graphic FreeType demo programs. */ -/* */ -/****************************************************************************/ - - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE /* we use `strcasecmp' */ -#endif - -#include -#include FT_FREETYPE_H - -#include FT_CACHE_H -#include FT_CACHE_MANAGER_H - -#include FT_BITMAP_H -#include FT_FONT_FORMATS_H - -#include "common.h" -#include "ftcommon.h" - -#include -#include -#include -#include - - -#ifdef _WIN32 -#define strcasecmp _stricmp -#endif - - - FT_Error error; - - -#undef NODEBUG - -#ifndef NODEBUG - - void - LogMessage( const char* fmt, - ... ) - { - va_list ap; - - - va_start( ap, fmt ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } - -#endif /* NODEBUG */ - - - /* PanicZ */ - void - PanicZ( const char* message ) - { - fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); - exit( 1 ); - } - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** DISPLAY-SPECIFIC DEFINITIONS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - - FTDemo_Display* - FTDemo_Display_New( grPixelMode mode, - int width, - int height ) - { - FTDemo_Display* display; - grSurface* surface; - grBitmap bit; - - - display = (FTDemo_Display *)malloc( sizeof ( FTDemo_Display ) ); - if ( !display ) - return NULL; - - if ( mode != gr_pixel_mode_gray && - mode != gr_pixel_mode_rgb24 ) - return NULL; - - grInitDevices(); - - bit.mode = mode; - bit.width = width; - bit.rows = height; - bit.grays = 256; - - surface = grNewSurface( 0, &bit ); - - if ( !surface ) - { - free( display ); - return NULL; - } - - display->surface = surface; - display->bitmap = &surface->bitmap; - - display->fore_color = grFindColor( display->bitmap, - 0x00, 0x00, 0x00, 0xff ); - display->back_color = grFindColor( display->bitmap, - 0xff, 0xff, 0xff, 0xff ); - display->warn_color = grFindColor( display->bitmap, - 0xff, 0x00, 0x00, 0xff ); - - return display; - } - - - void - FTDemo_Display_Done( FTDemo_Display* display ) - { - if ( !display ) - return; - - grDoneBitmap( display->bitmap ); - grDoneSurface( display->surface ); - - grDoneDevices(); - - free( display ); - } - - - void - FTDemo_Display_Clear( FTDemo_Display* display ) - { - grBitmap* bit = display->bitmap; - int pitch = bit->pitch; - - - if ( pitch < 0 ) - pitch = -pitch; - - if ( bit->mode == gr_pixel_mode_gray ) - memset( bit->buffer, - display->back_color.value, - (unsigned int)( pitch * bit->rows ) ); - else - { - unsigned char* p = bit->buffer; - int i; - - - for ( i = 0; i < pitch; i += 3, p += 3 ) - { - p[0] = display->back_color.chroma[0]; - p[1] = display->back_color.chroma[1]; - p[2] = display->back_color.chroma[2]; - } - - for ( i = 1; i < bit->rows; i++, p += pitch ) - memcpy( p, p - pitch, (size_t)pitch ); - } - } - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** FREETYPE-SPECIFIC DEFINITIONS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - -#define FLOOR( x ) ( (x) & -64 ) -#define CEIL( x ) ( ( (x) + 63 ) & -64 ) -#define ROUND( x ) ( ( (x) + 32 ) & -64 ) -#define TRUNC( x ) ( (x) >> 6 ) - - - /*************************************************************************/ - /* */ - /* The face requester is a function provided by the client application */ - /* to the cache manager, whose role is to translate an `abstract' face */ - /* ID into a real FT_Face object. */ - /* */ - /* In this program, the face IDs are simply pointers to TFont objects. */ - /* */ - static FT_Error - my_face_requester( FTC_FaceID face_id, - FT_Library lib, - FT_Pointer request_data, - FT_Face* aface ) - { - PFont font = (PFont)face_id; - - FT_UNUSED( request_data ); - - - if ( font->file_address != NULL ) - error = FT_New_Memory_Face( lib, - (const FT_Byte*)font->file_address, - (FT_Long)font->file_size, - font->face_index, - aface ); - else - error = FT_New_Face( lib, - font->filepathname, - font->face_index, - aface ); - if ( !error ) - { - const char* format = FT_Get_Font_Format( *aface ); - - - if ( !strcmp( format, "Type 1" ) ) - { - char orig[5]; - char* suffix = (char*)strrchr( font->filepathname, '.' ); - int has_extension = suffix && - ( strcasecmp( suffix, ".pfa" ) == 0 || - strcasecmp( suffix, ".pfb" ) == 0 ); - - - if ( has_extension ) - memcpy( orig, suffix, 5 ); - else - /* we have already allocated four more bytes */ - suffix = (char*)font->filepathname + strlen( font->filepathname ); - - memcpy( suffix, ".afm", 5 ); - if ( FT_Attach_File( *aface, font->filepathname ) ) - { - memcpy( suffix, ".pfm", 5 ); - FT_Attach_File( *aface, font->filepathname ); - } - - if ( has_extension ) - memcpy( suffix, orig, 5 ); - } - - if ( (*aface)->charmaps ) - (*aface)->charmap = (*aface)->charmaps[font->cmap_index]; - } - - return error; - } - - - FTDemo_Handle* - FTDemo_New( void ) - { - FTDemo_Handle* handle; - - - handle = (FTDemo_Handle *)malloc( sizeof ( FTDemo_Handle ) ); - if ( !handle ) - return NULL; - - memset( handle, 0, sizeof ( FTDemo_Handle ) ); - - error = FT_Init_FreeType( &handle->library ); - if ( error ) - PanicZ( "could not initialize FreeType" ); - - error = FTC_Manager_New( handle->library, 0, 0, 0, - my_face_requester, 0, &handle->cache_manager ); - if ( error ) - PanicZ( "could not initialize cache manager" ); - - error = FTC_SBitCache_New( handle->cache_manager, &handle->sbits_cache ); - if ( error ) - PanicZ( "could not initialize small bitmaps cache" ); - - error = FTC_ImageCache_New( handle->cache_manager, &handle->image_cache ); - if ( error ) - PanicZ( "could not initialize glyph image cache" ); - - error = FTC_CMapCache_New( handle->cache_manager, &handle->cmap_cache ); - if ( error ) - PanicZ( "could not initialize charmap cache" ); - - FT_Bitmap_New( &handle->bitmap ); - - FT_Stroker_New( handle->library, &handle->stroker ); - - handle->encoding = FT_ENCODING_NONE; - - handle->hinted = 1; - handle->antialias = 1; - handle->use_sbits = 1; - handle->autohint = 0; - handle->lcd_mode = 0; - handle->color = 1; - - handle->use_sbits_cache = 1; - - /* string_init */ - memset( handle->string, 0, sizeof ( TGlyph ) * MAX_GLYPHS ); - handle->string_length = 0; - handle->string_reload = 1; - - return handle; - } - - - void - FTDemo_Done( FTDemo_Handle* handle ) - { - int i; - - - if ( !handle ) - return; - - for ( i = 0; i < handle->max_fonts; i++ ) - { - if ( handle->fonts[i] ) - { - if ( handle->fonts[i]->filepathname ) - free( (void*)handle->fonts[i]->filepathname ); - free( handle->fonts[i] ); - } - } - free( handle->fonts ); - - /* string_done */ - for ( i = 0; i < MAX_GLYPHS; i++ ) - { - PGlyph glyph = handle->string + i; - - - if ( glyph->image ) - FT_Done_Glyph( glyph->image ); - } - - FT_Stroker_Done( handle->stroker ); - FT_Bitmap_Done( handle->library, &handle->bitmap ); - FTC_Manager_Done( handle->cache_manager ); - FT_Done_FreeType( handle->library ); - - free( handle ); - } - - - FT_Error - FTDemo_Install_Font( FTDemo_Handle* handle, - const char* filepath, - FT_Bool outline_only, - FT_Bool no_instances ) - { - static char filename[1024 + 5]; - long i, num_faces; - unsigned int len; - FT_Face face; - - - len = strlen( filepath ); - if ( len > 1024 ) - len = 1024; - - strncpy( filename, filepath, len ); - filename[len] = 0; - - /* We use a conservative approach here, at the cost of calling */ - /* `FT_New_Face' quite often. The idea is that our demo programs */ - /* should be able to try all faces and named instances of a font, */ - /* expecting that some faces don't work for various reasons, e.g., */ - /* a broken subfont, or an unsupported NFNT bitmap font in a Mac */ - /* dfont resource that holds more than a single font. */ - - error = FT_New_Face( handle->library, filename, -1, &face ); - if ( error ) - return error; - num_faces = face->num_faces; - FT_Done_Face( face ); - - /* allocate new font object(s) */ - for ( i = 0; i < num_faces; i++ ) - { - PFont font; - long j, instance_count; - - - error = FT_New_Face( handle->library, filename, -( i + 1 ), &face ); - if ( error ) - continue; - instance_count = no_instances ? 0 : face->style_flags >> 16; - FT_Done_Face( face ); - - /* load face with and without named instances */ - for ( j = 0; j < instance_count + 1; j++ ) - { - error = FT_New_Face( handle->library, - filename, - ( j << 16 ) + i, - &face ); - if ( error ) - continue; - - if ( outline_only && !FT_IS_SCALABLE( face ) ) - { - FT_Done_Face( face ); - continue; - } - - if ( handle->encoding != FT_ENCODING_NONE ) - { - error = FT_Select_Charmap( face, (FT_Encoding)handle->encoding ); - if ( error ) - { - FT_Done_Face( face ); - continue; - } - } - - font = (PFont)malloc( sizeof ( *font ) ); - - /* We allocate four more bytes since we want to attach an AFM */ - /* or PFM file for Type 1 fonts (if available). Such fonts */ - /* always have the extension `.afm' or `.pfm'. */ - font->filepathname = (char*)malloc( strlen( filename ) + 4 + 1 ); - strcpy( (char*)font->filepathname, filename ); - - font->face_index = ( j << 16 ) + i; - font->cmap_index = face->charmap ? FT_Get_Charmap_Index( face->charmap ) - : 0; - - if ( handle->preload ) - { - FILE* file = fopen( filename, "rb" ); - size_t file_size; - - - if ( file == NULL ) /* shouldn't happen */ - { - free( font ); - return FT_Err_Invalid_Argument; - } - - fseek( file, 0, SEEK_END ); - file_size = (size_t)ftell( file ); - fseek( file, 0, SEEK_SET ); - - if ( file_size <= 0 ) - { - free( font ); - fclose( file ); - return FT_Err_Invalid_Stream_Operation; - } - - font->file_address = malloc( file_size ); - if ( !font->file_address ) - { - free( font ); - fclose( file ); - return FT_Err_Out_Of_Memory; - } - - if ( fread( font->file_address, 1, file_size, file ) != file_size ) - { - free( font->file_address ); - free( font ); - fclose( file ); - return FT_Err_Invalid_Stream_Read; - } - - font->file_size = file_size; - - fclose( file ); - } - else - { - font->file_address = NULL; - font->file_size = 0; - } - - switch ( handle->encoding ) - { - case FT_ENCODING_NONE: - font->num_indices = face->num_glyphs; - break; - - case FT_ENCODING_UNICODE: - font->num_indices = 0x110000L; - break; - - case FT_ENCODING_ADOBE_LATIN_1: - case FT_ENCODING_ADOBE_STANDARD: - case FT_ENCODING_ADOBE_EXPERT: - case FT_ENCODING_ADOBE_CUSTOM: - case FT_ENCODING_APPLE_ROMAN: - font->num_indices = 0x100L; - break; - - /* some fonts use range 0x00-0x100, others have 0xF000-0xF0FF */ - case FT_ENCODING_MS_SYMBOL: - font->num_indices = 0x10000L; - - default: - font->num_indices = 0x10000L; - } - - FT_Done_Face( face ); - face = NULL; - - if ( handle->max_fonts == 0 ) - { - handle->max_fonts = 16; - handle->fonts = (PFont*)calloc( (size_t)handle->max_fonts, - sizeof ( PFont ) ); - } - else if ( handle->num_fonts >= handle->max_fonts ) - { - handle->max_fonts *= 2; - handle->fonts = (PFont*)realloc( handle->fonts, - (size_t)handle->max_fonts * - sizeof ( PFont ) ); - - memset( &handle->fonts[handle->num_fonts], 0, - (size_t)( handle->max_fonts - handle->num_fonts ) * - sizeof ( PFont ) ); - } - - handle->fonts[handle->num_fonts++] = font; - } - } - - return FT_Err_Ok; - } - - - void - FTDemo_Set_Current_Font( FTDemo_Handle* handle, - PFont font ) - { - handle->current_font = font; - handle->scaler.face_id = (FTC_FaceID)font; - - handle->string_reload = 1; - } - - - void - FTDemo_Set_Current_Size( FTDemo_Handle* handle, - int pixel_size ) - { - if ( pixel_size > 0xFFFF ) - pixel_size = 0xFFFF; - - handle->scaler.width = (FT_UInt)pixel_size; - handle->scaler.height = (FT_UInt)pixel_size; - handle->scaler.pixel = 1; /* activate integer format */ - handle->scaler.x_res = 0; - handle->scaler.y_res = 0; - - handle->string_reload = 1; - } - - - void - FTDemo_Set_Current_Charsize( FTDemo_Handle* handle, - int char_size, - int resolution ) - { - /* in 26.6 format, corresponding to (almost) 0x4000ppem */ - if ( char_size > 0xFFFFF ) - char_size = 0xFFFFF; - - handle->scaler.width = (FT_UInt)char_size; - handle->scaler.height = (FT_UInt)char_size; - handle->scaler.pixel = 0; /* activate 26.6 format */ - handle->scaler.x_res = (FT_UInt)resolution; - handle->scaler.y_res = (FT_UInt)resolution; - - handle->string_reload = 1; - } - - - void - FTDemo_Set_Preload( FTDemo_Handle* handle, - int preload ) - { - handle->preload = !!preload; - } - - - void - FTDemo_Update_Current_Flags( FTDemo_Handle* handle ) - { - FT_Int32 flags, target; - - - flags = FT_LOAD_DEFAULT; /* really 0 */ - - if ( handle->autohint ) - flags |= FT_LOAD_FORCE_AUTOHINT; - - if ( !handle->use_sbits ) - flags |= FT_LOAD_NO_BITMAP; - - if ( handle->hinted ) - { - target = 0; - - if ( handle->antialias ) - { - switch ( handle->lcd_mode ) - { - case LCD_MODE_LIGHT: - target = FT_LOAD_TARGET_LIGHT; - break; - - case LCD_MODE_RGB: - case LCD_MODE_BGR: - target = FT_LOAD_TARGET_LCD; - break; - - case LCD_MODE_VRGB: - case LCD_MODE_VBGR: - target = FT_LOAD_TARGET_LCD_V; - break; - - default: - target = FT_LOAD_TARGET_NORMAL; - } - } - else - target = FT_LOAD_TARGET_MONO; - - flags |= target; - } - else - { - flags |= FT_LOAD_NO_HINTING; - - if ( !handle->antialias ) - flags |= FT_LOAD_MONOCHROME; - } - - if ( handle->color ) - flags |= FT_LOAD_COLOR; - - handle->load_flags = flags; - handle->string_reload = 1; - } - - - FT_UInt - FTDemo_Get_Index( FTDemo_Handle* handle, - FT_UInt32 charcode ) - { - FTC_FaceID face_id = handle->scaler.face_id; - PFont font = handle->current_font; - - - return FTC_CMapCache_Lookup( handle->cmap_cache, face_id, - font->cmap_index, charcode ); - } - - - FT_Error - FTDemo_Get_Size( FTDemo_Handle* handle, - FT_Size* asize ) - { - FT_Size size; - - - error = FTC_Manager_LookupSize( handle->cache_manager, - &handle->scaler, - &size ); - - if ( !error ) - *asize = size; - - return error; - } - - - FT_Error - FTDemo_Glyph_To_Bitmap( FTDemo_Handle* handle, - FT_Glyph glyf, - grBitmap* target, - int* left, - int* top, - int* x_advance, - int* y_advance, - FT_Glyph* aglyf ) - { - FT_BitmapGlyph bitmap; - FT_Bitmap* source; - - - *aglyf = NULL; - - error = FT_Err_Ok; - - if ( glyf->format == FT_GLYPH_FORMAT_OUTLINE ) - { - FT_Render_Mode render_mode = FT_RENDER_MODE_MONO; - - - if ( handle->antialias ) - { - if ( handle->lcd_mode == 0 ) - render_mode = FT_RENDER_MODE_NORMAL; - else if ( handle->lcd_mode == 1 ) - render_mode = FT_RENDER_MODE_LIGHT; - else if ( handle->lcd_mode <= 3 ) - render_mode = FT_RENDER_MODE_LCD; - else - render_mode = FT_RENDER_MODE_LCD_V; - } - - /* render the glyph to a bitmap, don't destroy original */ - error = FT_Glyph_To_Bitmap( &glyf, render_mode, NULL, 0 ); - if ( error ) - return error; - - *aglyf = glyf; - } - - if ( glyf->format != FT_GLYPH_FORMAT_BITMAP ) - PanicZ( "invalid glyph format returned!" ); - - bitmap = (FT_BitmapGlyph)glyf; - source = &bitmap->bitmap; - - target->rows = (int)source->rows; - target->width = (int)source->width; - target->pitch = source->pitch; - target->buffer = source->buffer; - target->grays = source->num_grays; - - switch ( source->pixel_mode ) - { - case FT_PIXEL_MODE_MONO: - target->mode = gr_pixel_mode_mono; - break; - - case FT_PIXEL_MODE_GRAY: - target->mode = gr_pixel_mode_gray; - target->grays = source->num_grays; - break; - - case FT_PIXEL_MODE_GRAY2: - case FT_PIXEL_MODE_GRAY4: - (void)FT_Bitmap_Convert( handle->library, source, &handle->bitmap, 1 ); - target->pitch = handle->bitmap.pitch; - target->buffer = handle->bitmap.buffer; - target->mode = gr_pixel_mode_gray; - target->grays = handle->bitmap.num_grays; - break; - - case FT_PIXEL_MODE_LCD: - target->mode = handle->lcd_mode == 2 ? gr_pixel_mode_lcd - : gr_pixel_mode_lcd2; - target->grays = source->num_grays; - break; - - case FT_PIXEL_MODE_LCD_V: - target->mode = handle->lcd_mode == 4 ? gr_pixel_mode_lcdv - : gr_pixel_mode_lcdv2; - target->grays = source->num_grays; - break; - - case FT_PIXEL_MODE_BGRA: - target->mode = gr_pixel_mode_bgra; - target->grays = source->num_grays; - break; - - default: - return FT_Err_Invalid_Glyph_Format; - } - - *left = bitmap->left; - *top = bitmap->top; - - *x_advance = ( glyf->advance.x + 0x8000 ) >> 16; - *y_advance = ( glyf->advance.y + 0x8000 ) >> 16; - - return error; - } - - - FT_Error - FTDemo_Index_To_Bitmap( FTDemo_Handle* handle, - FT_ULong Index, - grBitmap* target, - int* left, - int* top, - int* x_advance, - int* y_advance, - FT_Glyph* aglyf ) - { - unsigned int width, height; - - - *aglyf = NULL; - *x_advance = 0; - - /* use the SBits cache to store small glyph bitmaps; this is a lot */ - /* more memory-efficient */ - /* */ - - width = handle->scaler.width; - height = handle->scaler.height; - if ( handle->use_sbits_cache && !handle->scaler.pixel ) - { - width = ( ( width * handle->scaler.x_res + 36 ) / 72 ) >> 6; - height = ( ( height * handle->scaler.y_res + 36 ) / 72 ) >> 6; - } - - if ( handle->use_sbits_cache && width < 48 && height < 48 ) - { - FTC_SBit sbit; - FT_Bitmap source; - - - error = FTC_SBitCache_LookupScaler( handle->sbits_cache, - &handle->scaler, - (FT_ULong)handle->load_flags, - Index, - &sbit, - NULL ); - if ( error ) - goto Exit; - - if ( sbit->buffer ) - { - target->rows = sbit->height; - target->width = sbit->width; - target->pitch = sbit->pitch; - target->buffer = sbit->buffer; - target->grays = sbit->max_grays + 1; - - switch ( sbit->format ) - { - case FT_PIXEL_MODE_MONO: - target->mode = gr_pixel_mode_mono; - break; - - case FT_PIXEL_MODE_GRAY: - target->mode = gr_pixel_mode_gray; - break; - - case FT_PIXEL_MODE_GRAY2: - case FT_PIXEL_MODE_GRAY4: - source.rows = sbit->height; - source.width = sbit->width; - source.pitch = sbit->pitch; - source.buffer = sbit->buffer; - source.pixel_mode = sbit->format; - - (void)FT_Bitmap_Convert( handle->library, &source, - &handle->bitmap, 1 ); - - target->pitch = handle->bitmap.pitch; - target->buffer = handle->bitmap.buffer; - target->mode = gr_pixel_mode_gray; - target->grays = handle->bitmap.num_grays; - break; - - case FT_PIXEL_MODE_LCD: - target->mode = handle->lcd_mode == 2 ? gr_pixel_mode_lcd - : gr_pixel_mode_lcd2; - break; - - case FT_PIXEL_MODE_LCD_V: - target->mode = handle->lcd_mode == 4 ? gr_pixel_mode_lcdv - : gr_pixel_mode_lcdv2; - break; - - case FT_PIXEL_MODE_BGRA: - target->mode = gr_pixel_mode_bgra; - break; - - default: - return FT_Err_Invalid_Glyph_Format; - } - - *left = sbit->left; - *top = sbit->top; - *x_advance = sbit->xadvance; - *y_advance = sbit->yadvance; - - goto Exit; - } - } - - /* otherwise, use an image cache to store glyph outlines, and render */ - /* them on demand. we can thus support very large sizes easily.. */ - { - FT_Glyph glyf; - - - error = FTC_ImageCache_LookupScaler( handle->image_cache, - &handle->scaler, - (FT_ULong)handle->load_flags, - Index, - &glyf, - NULL ); - - if ( !error ) - error = FTDemo_Glyph_To_Bitmap( handle, glyf, target, left, top, - x_advance, y_advance, aglyf ); - } - - Exit: - /* don't accept a `missing' character with zero or negative width */ - if ( Index == 0 && *x_advance <= 0 ) - *x_advance = 1; - - return error; - } - - - FT_Error - FTDemo_Draw_Index( FTDemo_Handle* handle, - FTDemo_Display* display, - unsigned int gindex, - int* pen_x, - int* pen_y ) - { - int left, top, x_advance, y_advance; - grBitmap bit3; - FT_Glyph glyf; - - - error = FTDemo_Index_To_Bitmap( handle, - gindex, - &bit3, - &left, &top, - &x_advance, &y_advance, - &glyf ); - if ( error ) - return error; - - /* now render the bitmap into the display surface */ - grBlitGlyphToBitmap( display->bitmap, &bit3, *pen_x + left, - *pen_y - top, display->fore_color ); - - if ( glyf ) - FT_Done_Glyph( glyf ); - - *pen_x += x_advance + 1; - - return FT_Err_Ok; - } - - - FT_Error - FTDemo_Draw_Glyph_Color( FTDemo_Handle* handle, - FTDemo_Display* display, - FT_Glyph glyph, - int* pen_x, - int* pen_y, - grColor color ) - { - int left, top, x_advance, y_advance; - grBitmap bit3; - FT_Glyph glyf; - - - error = FTDemo_Glyph_To_Bitmap( handle, glyph, &bit3, &left, &top, - &x_advance, &y_advance, &glyf ); - if ( error ) - { - FT_Done_Glyph( glyph ); - - return error; - } - - /* now render the bitmap into the display surface */ - grBlitGlyphToBitmap( display->bitmap, &bit3, *pen_x + left, - *pen_y - top, color ); - - if ( glyf ) - FT_Done_Glyph( glyf ); - - *pen_x += x_advance + 1; - - return FT_Err_Ok; - } - - - FT_Error - FTDemo_Draw_Glyph( FTDemo_Handle* handle, - FTDemo_Display* display, - FT_Glyph glyph, - int* pen_x, - int* pen_y ) - { - return FTDemo_Draw_Glyph_Color( handle, display, - glyph, pen_x, pen_y, - display->fore_color ); - } - - - FT_Error - FTDemo_Draw_Slot( FTDemo_Handle* handle, - FTDemo_Display* display, - FT_GlyphSlot slot, - int* pen_x, - int* pen_y ) - { - FT_Glyph glyph; - - - error = FT_Get_Glyph( slot, &glyph ); - if ( error ) - return error; - - error = FTDemo_Draw_Glyph( handle, display, glyph, pen_x, pen_y ); - if ( !error ) - FT_Done_Glyph( glyph ); - - return error; - } - - - void - FTDemo_String_Set( FTDemo_Handle* handle, - const char* string ) - { - const char* p = string; - const char* end = p + strlen( string ); - unsigned long codepoint; - int ch; - int expect; - PGlyph glyph = handle->string; - - - handle->string_length = 0; - codepoint = expect = 0; - - for (;;) - { - ch = utf8_next( &p, end ); - if ( ch < 0 ) - break; - - codepoint = (unsigned long)ch; - - if ( handle->encoding != FT_ENCODING_NONE ) - glyph->glyph_index = FTDemo_Get_Index( handle, codepoint ); - else - glyph->glyph_index = codepoint; - - glyph++; - handle->string_length++; - - if ( handle->string_length >= MAX_GLYPHS ) - break; - } - - handle->string_reload = 1; - } - - - static FT_Error - string_load( FTDemo_Handle* handle ) - { - int n; - FT_Size size; - FT_Face face; - FT_Pos prev_rsb_delta = 0; - - - error = FTDemo_Get_Size( handle, &size ); - if ( error ) - return error; - - face = size->face; - - for ( n = 0; n < handle->string_length; n++ ) - { - PGlyph glyph = handle->string + n; - - - /* clear existing image if there is one */ - if ( glyph->image ) - { - FT_Done_Glyph( glyph->image ); - glyph->image = NULL; - } - - /* load the glyph and get the image */ - if ( !FT_Load_Glyph( face, glyph->glyph_index, - handle->load_flags ) && - !FT_Get_Glyph( face->glyph, &glyph->image ) ) - { - FT_Glyph_Metrics* metrics = &face->glyph->metrics; - - - /* note that in vertical layout, y-positive goes downwards */ - - glyph->vvector.x = metrics->vertBearingX - metrics->horiBearingX; - glyph->vvector.y = -metrics->vertBearingY - metrics->horiBearingY; - - glyph->vadvance.x = 0; - glyph->vadvance.y = -metrics->vertAdvance; - - if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) - glyph->delta = -1 * 64; - else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) - glyph->delta = 1 * 64; - else - glyph->delta = 0; - } - } - - return FT_Err_Ok; - } - - - static FT_Error - string_render_prepare( FTDemo_Handle* handle, - FTDemo_String_Context* sc, - FT_Vector* advances ) - { - FT_Face face; - FT_Size size; - PGlyph glyph; - FT_Pos track_kern = 0; - FT_UInt prev_index = 0; - FT_Vector* prev_advance = NULL; - FT_Vector extent = { 0, 0 }; - FT_Int i; - - - error = FTDemo_Get_Size( handle, &size ); - if ( error ) - return error; - - face = size->face; - - if ( !sc->vertical && sc->kerning_degree ) - { - /* this function needs and returns points, not pixels */ - if ( FT_Get_Track_Kerning( face, - (FT_Fixed)handle->scaler.width << 10, - -sc->kerning_degree, - &track_kern ) ) - track_kern = 0; - else - track_kern = (FT_Pos)( - ( track_kern / 1024.0 * handle->scaler.x_res ) / - 72.0 ); - } - - for ( i = 0; i < handle->string_length; i++ ) - { - glyph = handle->string + i; - - if ( !glyph->image ) - continue; - - if ( sc->vertical ) - advances[i] = glyph->vadvance; - else - { - advances[i] = glyph->image->advance; - advances[i].x >>= 10; - advances[i].y >>= 10; - - if ( prev_advance ) - { - prev_advance->x += track_kern; - - if ( sc->kerning_mode ) - { - FT_Vector kern; - - - FT_Get_Kerning( face, prev_index, glyph->glyph_index, - FT_KERNING_UNFITTED, &kern ); - - prev_advance->x += kern.x; - prev_advance->y += kern.y; - - if ( sc->kerning_mode > KERNING_MODE_NORMAL ) - prev_advance->x += glyph->delta; - } - } - } - - if ( prev_advance ) - { - if ( handle->hinted ) - { - prev_advance->x = ROUND( prev_advance->x ); - prev_advance->y = ROUND( prev_advance->y ); - } - - extent.x += prev_advance->x; - extent.y += prev_advance->y; - } - - prev_index = glyph->glyph_index; - prev_advance = advances + i; - } - - if ( prev_advance ) - { - if ( handle->hinted ) - { - prev_advance->x = ROUND( prev_advance->x ); - prev_advance->y = ROUND( prev_advance->y ); - } - - extent.x += prev_advance->x; - extent.y += prev_advance->y; - } - - /* store the extent in the last slot */ - i = handle->string_length - 1; - advances[i] = extent; - - return FT_Err_Ok; - } - - - FT_Error - FTDemo_String_Draw( FTDemo_Handle* handle, - FTDemo_Display* display, - FTDemo_String_Context* sc, - int x, - int y ) - { - int n; - FT_Vector pen, advances[MAX_GLYPHS]; - FT_Size size; - FT_Face face; - - - if ( !sc || - x < 0 || - y < 0 || - x > display->bitmap->width || - y > display->bitmap->rows ) - return FT_Err_Invalid_Argument; - - error = FTDemo_Get_Size( handle, &size ); - if ( error ) - return error; - - face = size->face; - - if ( handle->string_reload ) - { - error = string_load( handle ); - if ( error ) - return error; - - handle->string_reload = 0; - } - - error = string_render_prepare( handle, sc, advances ); - if ( error ) - return error; - - /* change to Cartesian coordinates */ - y = display->bitmap->rows - y; - - /* get the extent, which we store in the last slot */ - pen = advances[handle->string_length - 1]; - - pen.x = FT_MulFix( pen.x, sc->center ); - pen.y = FT_MulFix( pen.y, sc->center ); - - /* XXX sbits */ - /* get pen position */ - if ( sc->matrix && FT_IS_SCALABLE( face ) ) - { - FT_Vector_Transform( &pen, sc->matrix ); - - pen.x = ( x << 6 ) - pen.x; - pen.y = ( y << 6 ) - pen.y; - } - else - { - pen.x = ROUND( ( x << 6 ) - pen.x ); - pen.y = ROUND( ( y << 6 ) - pen.y ); - } - - for ( n = 0; n < handle->string_length; n++ ) - { - PGlyph glyph = handle->string + n; - FT_Glyph image; - FT_BBox bbox; - - - if ( !glyph->image ) - continue; - - /* copy image */ - error = FT_Glyph_Copy( glyph->image, &image ); - if ( error ) - continue; - - if ( image->format != FT_GLYPH_FORMAT_BITMAP ) - { - if ( sc->vertical ) - error = FT_Glyph_Transform( image, NULL, &glyph->vvector ); - - if ( !error ) - error = FT_Glyph_Transform( image, sc->matrix, &pen ); - - if ( error ) - { - FT_Done_Glyph( image ); - continue; - } - } - else - { - FT_BitmapGlyph bitmap = (FT_BitmapGlyph)image; - - - if ( sc->vertical ) - { - bitmap->left += ( glyph->vvector.x + pen.x ) >> 6; - bitmap->top += ( glyph->vvector.y + pen.y ) >> 6; - } - else - { - bitmap->left += pen.x >> 6; - bitmap->top += pen.y >> 6; - } - } - - if ( sc->matrix ) - FT_Vector_Transform( advances + n, sc->matrix ); - - pen.x += advances[n].x; - pen.y += advances[n].y; - - FT_Glyph_Get_CBox( image, FT_GLYPH_BBOX_PIXELS, &bbox ); - -#if 0 - if ( n == 0 ) - { - fprintf( stderr, "bbox = [%ld %ld %ld %ld]\n", - bbox.xMin, bbox.yMin, bbox.xMax, bbox.yMax ); - } -#endif - - /* check bounding box; if it is completely outside the */ - /* display surface, we don't need to render it */ - if ( bbox.xMax > 0 && - bbox.yMax > 0 && - bbox.xMin < display->bitmap->width && - bbox.yMin < display->bitmap->rows ) - { - int left, top, dummy1, dummy2; - grBitmap bit3; - FT_Glyph glyf; - - - error = FTDemo_Glyph_To_Bitmap( handle, image, &bit3, &left, &top, - &dummy1, &dummy2, &glyf ); - if ( !error ) - { - /* change back to the usual coordinates */ - top = display->bitmap->rows - top; - - /* now render the bitmap into the display surface */ - grBlitGlyphToBitmap( display->bitmap, &bit3, left, top, - display->fore_color ); - - if ( glyf ) - FT_Done_Glyph( glyf ); - } - } - - FT_Done_Glyph( image ); - } - - return error; - } - - - unsigned long - FTDemo_Make_Encoding_Tag( const char* s ) - { - int i; - unsigned long l = 0; - - - for ( i = 0; i < 4; i++ ) - { - if ( !s[i] ) - break; - l <<= 8; - l += (unsigned long)s[i]; - } - - return l; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftcommon.h freetype-2.8/=unpacked-tar1=/src/ftcommon.h --- freetype-2.7.1/=unpacked-tar1=/src/ftcommon.h 2016-10-28 22:12:11.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftcommon.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,344 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2005, 2006, 2009, 2011-2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* ftcommon.h - common routines for the graphic FreeType demo programs. */ -/* */ -/****************************************************************************/ - -#ifndef FT_COMMON_H_ -#define FT_COMMON_H_ - - -#include -#include FT_FREETYPE_H - -#include FT_CACHE_H -#include FT_CACHE_MANAGER_H - -#include FT_GLYPH_H -#include FT_STROKER_H -#include FT_BITMAP_H - -#include -#include - - extern FT_Error error; - - /* forward declarations */ - extern void PanicZ( const char* message ); - -#undef NODEBUG - -#ifndef NODEBUG - -#define LOG( x ) LogMessage##x - - - void - LogMessage( const char* fmt, ... ); - -#else /* !DEBUG */ - -#define LOG( x ) /* */ - -#endif - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** DISPLAY-SPECIFIC DEFINITIONS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - - /* default window dimensions */ -#define DIM_X 640 -#define DIM_Y 480 - - /* baseline distance between header lines */ -#define HEADER_HEIGHT 12 - - /* default gamma setting */ -#define GAMMA 1.8 - -#include "graph.h" -#include "grobjs.h" -#include "grfont.h" - - typedef struct - { - grSurface* surface; - grBitmap* bitmap; - grColor fore_color; - grColor back_color; - grColor warn_color; - - } FTDemo_Display; - - - FTDemo_Display* - FTDemo_Display_New( grPixelMode mode, - int width, - int height ); - - - void - FTDemo_Display_Done( FTDemo_Display* display ); - - - /* fill the bitmap with background color */ - void - FTDemo_Display_Clear( FTDemo_Display* display ); - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** FREETYPE-SPECIFIC DEFINITIONS *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - -#define MAX_GLYPHS 512 /* at most 512 glyphs in the string */ -#define MAX_GLYPH_BYTES 150000 /* 150kB for the glyph image cache */ - - - typedef struct TGlyph_ - { - FT_UInt glyph_index; - FT_Glyph image; /* the glyph image */ - - FT_Pos delta; /* delta caused by hinting */ - FT_Vector vvector; /* vert. origin => hori. origin */ - FT_Vector vadvance; /* vertical advance */ - - } TGlyph, *PGlyph; - - /* this simple record is used to model a given `installed' face */ - typedef struct TFont_ - { - const char* filepathname; - int face_index; - int cmap_index; - int num_indices; - void* file_address; /* for preloaded files */ - size_t file_size; - - } TFont, *PFont; - - enum { - LCD_MODE_AA = 0, - LCD_MODE_LIGHT, - LCD_MODE_RGB, - LCD_MODE_BGR, - LCD_MODE_VRGB, - LCD_MODE_VBGR, - N_LCD_MODES - }; - - enum { - KERNING_DEGREE_NONE = 0, - KERNING_DEGREE_LIGHT, - KERNING_DEGREE_MEDIUM, - KERNING_DEGREE_TIGHT, - N_KERNING_DEGREES - }; - - enum { - KERNING_MODE_NONE = 0, /* 0: no kerning; */ - KERNING_MODE_NORMAL, /* 1: `kern' values */ - KERNING_MODE_SMART, /* 2: `kern' + side bearing errors */ - N_KERNING_MODES - }; - - typedef struct - { - int kerning_mode; - int kerning_degree; - FT_Fixed center; /* 0..1 */ - int vertical; /* displayed vertically? */ - FT_Matrix* matrix; /* string transformation */ - - } FTDemo_String_Context; - - typedef struct - { - FT_Library library; /* the FreeType library */ - FTC_Manager cache_manager; /* the cache manager */ - FTC_ImageCache image_cache; /* the glyph image cache */ - FTC_SBitCache sbits_cache; /* the glyph small bitmaps cache */ - FTC_CMapCache cmap_cache; /* the charmap cache */ - - PFont* fonts; /* installed fonts */ - int num_fonts; - int max_fonts; - - int use_sbits_cache; /* toggle sbits cache */ - - /* use FTDemo_Set_Current_XXX to set the following two fields */ - PFont current_font; /* selected font */ - FTC_ScalerRec scaler; - FT_Int32 load_flags; - - /* call FTDemo_Update_Current_Flags after setting any of the following fields */ - int hinted; /* is glyph hinting active? */ - int antialias; /* is anti-aliasing active? */ - int use_sbits; /* do we use embedded bitmaps? */ - int autohint; /* force auto-hinting */ - int lcd_mode; - int preload; /* force font file preloading */ - int color; /* load color bitmaps */ - - /* don't touch the following fields! */ - - /* used for string rendering */ - TGlyph string[MAX_GLYPHS]; - int string_length; - int string_reload; - - unsigned long encoding; - FT_Stroker stroker; - FT_Bitmap bitmap; /* used as bitmap conversion buffer */ - - } FTDemo_Handle; - - - FTDemo_Handle* - FTDemo_New( void ); - - - void - FTDemo_Done( FTDemo_Handle* handle ); - - - /* install a font */ - FT_Error - FTDemo_Install_Font( FTDemo_Handle* handle, - const char* filepath, - FT_Bool outline_only, - FT_Bool no_instances ); - - - void - FTDemo_Set_Preload( FTDemo_Handle* handle, - int preload ); - - void - FTDemo_Set_Current_Font( FTDemo_Handle* handle, - PFont font ); - - void - FTDemo_Set_Current_Size( FTDemo_Handle* handle, - int pixel_size ); - - void - FTDemo_Set_Current_Charsize( FTDemo_Handle* handle, - int point_size, - int res ); - - void - FTDemo_Update_Current_Flags( FTDemo_Handle* handle ); - - - /* charcode => glyph index of current font */ - FT_UInt - FTDemo_Get_Index( FTDemo_Handle* handle, - FT_UInt32 charcode ); - - - /* get FT_Size of current font */ - FT_Error - FTDemo_Get_Size( FTDemo_Handle* handle, - FT_Size* asize ); - - - /* convert a FT_Glyph to a grBitmap (don't free target->buffer) */ - /* if aglyf != NULL, you should FT_Glyph_Done the aglyf */ - FT_Error - FTDemo_Glyph_To_Bitmap( FTDemo_Handle* handle, - FT_Glyph glyf, - grBitmap* target, - int* left, - int* top, - int* x_advance, - int* y_advance, - FT_Glyph* aglyf ); - - /* get a grBitmap from glyph index (don't free target->buffer) */ - /* if aglyf != NULL, you should FT_Glyph_Done the aglyf */ - FT_Error - FTDemo_Index_To_Bitmap( FTDemo_Handle* handle, - FT_ULong Index, - grBitmap* target, - int* left, - int* top, - int* x_advance, - int* y_advance, - FT_Glyph* aglyf ); - - - /* given glyph index, draw a glyph on the display */ - FT_Error - FTDemo_Draw_Index( FTDemo_Handle* handle, - FTDemo_Display* display, - unsigned int gindex, - int* pen_x, - int* pen_y); - - - /* given FT_Glyph, draw a glyph on the display */ - FT_Error - FTDemo_Draw_Glyph( FTDemo_Handle* handle, - FTDemo_Display* display, - FT_Glyph glyph, - int* pen_x, - int* pen_y); - - FT_Error - FTDemo_Draw_Glyph_Color( FTDemo_Handle* handle, - FTDemo_Display* display, - FT_Glyph glyph, - int* pen_x, - int* pen_y, - grColor color ); - - /* given FT_GlyphSlot, draw a glyph on the display */ - FT_Error - FTDemo_Draw_Slot( FTDemo_Handle* handle, - FTDemo_Display* display, - FT_GlyphSlot slot, - int* pen_x, - int* pen_y); - - - /* set the string to be drawn */ - void - FTDemo_String_Set( FTDemo_Handle* handle, - const char* string ); - - - /* draw a string centered at (center_x, center_y) -- */ - /* note that handle->use_sbits_cache is not supported */ - FT_Error - FTDemo_String_Draw( FTDemo_Handle* handle, - FTDemo_Display* display, - FTDemo_String_Context* sc, - int center_x, - int center_y ); - - - /* make a FT_Encoding tag from a string */ - unsigned long - FTDemo_Make_Encoding_Tag( const char* s ); - - -#endif /* FTCOMMON_H_ */ - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftdiff.1 freetype-2.8/=unpacked-tar1=/src/ftdiff.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftdiff.1 2016-12-30 20:32:34.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftdiff.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -.TH FTDIFF 1 "December 2016" "FreeType 2.7.1" -. -. -.SH NAME -. -ftdiff \- compare font hinting modes -. -. -.SH SYNOPSIS -. -.B ftdiff -.RI [ options ] -.IR font \ .\|.\|. -. -. -.SH DESCRIPTION -. -.B ftdiff -displays text in three columns, using the font or fonts given on the command -line, and applies different FreeType hinting modes to each column. -. -.TP -.B font -The font file(s) to display. -For Type\ 1 font files, -.B ftdiff -also tries to attach the corresponding metrics file (with extension `.afm' -or `.pfm'). -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI \-w \ w -Set the window width to -.I w -pixels (default: 640px). -. -.TP -.BI \-h \ h -Set the window height to -.I h -pixels (default: 480px). -. -.TP -.BI \-r \ r -Use resolution -.I r -dpi (default: 72dpi). -. -.TP -.BI \-s \ s -Set character size to -.I s -points (default: 16pt). -. -.TP -.BI \-f \ textfile -Change displayed text, using text in -.I textfile -(in UTF-8 encoding). -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftdiff.c freetype-2.8/=unpacked-tar1=/src/ftdiff.c --- freetype-2.7.1/=unpacked-tar1=/src/ftdiff.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftdiff.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1639 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2007-2014 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* FTDiff - a simple viewer to compare different hinting modes. */ -/* */ -/* Press ? when running this program to have a list of key-bindings. */ -/* */ -/****************************************************************************/ - - -#include "ftcommon.h" -#include "common.h" -#include "mlgetopt.h" - -#include FT_OUTLINE_H -#include FT_LCD_FILTER_H -#include FT_CFF_DRIVER_H -#include FT_TRUETYPE_DRIVER_H - - /* showing driver name -- the two internal header files */ - /* shouldn't be used in normal programs */ -#include FT_MODULE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DRIVER_H - -#include -#include -#include -#include - - - static void - usage( char* execname ) - { - fprintf( stderr, - "\n" - "ftdiff: compare font hinting modes -- part of the FreeType project\n" - "------------------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] font ...\n" - "\n", - execname ); - fprintf( stderr, - " font The font file(s) to display.\n" - " For Type 1 font files, ftdiff also tries to attach\n" - " the corresponding metrics file (with extension\n" - " `.afm' or `.pfm').\n" - "\n" ); - fprintf( stderr, - " -w W Set the window width to W pixels (default: %dpx).\n" - " -h H Set the window height to H pixels (default: %dpx).\n" - "\n", - DIM_X, DIM_Y ); - fprintf( stderr, - " -r R Use resolution R dpi (default: 72dpi).\n" - " -s S Set character size to S points (default: 16pt).\n" - " -f TEXTFILE Change displayed text, using text in TEXTFILE\n" - " (in UTF-8 encoding).\n" - "\n" - " -v Show version." - "\n" ); - - exit( 1 ); - } - - - static void - panic( const char* fmt, - ... ) - { - va_list args; - - - va_start( args, fmt ); - vfprintf( stderr, fmt, args ); - va_end( args ); - exit( 1 ); - } - - - /** DISPLAY ABSTRACTION **/ - - typedef enum DisplayMode_ - { - DISPLAY_MODE_MONO = 0, - DISPLAY_MODE_GRAY, - DISPLAY_MODE_LCD - - } DisplayMode; - - - typedef void - (*Display_drawFunc)( void* disp, - DisplayMode mode, - int x, - int y, - int width, - int height, - int pitch, - void* buffer ); - - typedef void - (*Display_textFunc)( void* disp, - int x, - int y, - const char* msg ); - - - typedef struct DisplayRec_ - { - void* disp; - Display_drawFunc disp_draw; - Display_textFunc disp_text; - - } DisplayRec, *Display; - - - static const char* default_text = - "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet" - " dui. Nam sapien. Fusce vestibulum ornare metus. Maecenas ligula orci," - " consequat vitae, dictum nec, lacinia non, elit. Aliquam iaculis" - " molestie neque. Maecenas suscipit felis ut pede convallis malesuada." - " Aliquam erat volutpat. Nunc pulvinar condimentum nunc. Donec ac sem vel" - " leo bibendum aliquam. Pellentesque habitant morbi tristique senectus et" - " netus et malesuada fames ac turpis egestas.\n" - "\n" - "Sed commodo. Nulla ut libero sit amet justo varius blandit. Mauris vitae" - " nulla eget lorem pretium ornare. Proin vulputate erat porta risus." - " Vestibulum malesuada, odio at vehicula lobortis, nisi metus hendrerit" - " est, vitae feugiat quam massa a ligula. Aenean in tellus. Praesent" - " convallis. Nullam vel lacus. Aliquam congue erat non urna mollis" - " faucibus. Morbi vitae mauris faucibus quam condimentum ornare. Quisque" - " sit amet augue. Morbi ullamcorper mattis enim. Aliquam erat volutpat." - " Morbi nec felis non enim pulvinar lobortis. Ut libero. Nullam id orci" - " quis nisl dapibus rutrum. Suspendisse consequat vulputate leo. Aenean" - " non orci non tellus iaculis vestibulum. Sed neque.\n" - "\n"; - - - /***********************************************************************/ - /***********************************************************************/ - /***** *****/ - /***** T E X T R E N D E R I N G *****/ - /***** *****/ - /***********************************************************************/ - /***********************************************************************/ - - typedef enum HintMode_ - { - HINT_MODE_UNHINTED, - HINT_MODE_AUTOHINT, - HINT_MODE_AUTOHINT_LIGHT, - HINT_MODE_BYTECODE, - HINT_MODE_MAX - - } HintMode; - - static const char* const render_mode_names[HINT_MODE_MAX] = - { - "unhinted", - "auto-hinter", - "light auto-hinter", - "native hinter" - }; - -#define HINTING_ENGINE_MAX 2 - - /** RENDER STATE **/ - - typedef struct ColumnStateRec_ - { - int use_cboxes; - int use_kerning; - int use_deltas; - int use_lcd_filter; - FT_LcdFilter lcd_filter; - HintMode hint_mode; - DisplayMode disp_mode; - - int use_custom_lcd_filter; - unsigned char filter_weights[5]; - int fw_index; - - unsigned int cff_hinting_engine; - unsigned int tt_interpreter_versions[3]; - int num_tt_interpreter_versions; - int tt_interpreter_version_idx; - FT_Bool warping; - - } ColumnStateRec, *ColumnState; - - - typedef struct FontFaceRec_ - { - const char* filepath; - char* family_name; - char* style_name; - int index; - - } FontFaceRec, *FontFace; - - - typedef struct RenderStateRec_ - { - FT_Library library; - const char* text; - unsigned int resolution; - double char_size; - int col; - ColumnStateRec columns[3]; - FontFace faces; - unsigned int num_faces; - int face_index; - const char* filepath; - const char* filename; - FT_Face face; - FT_Size size; - char** files; - DisplayRec display; - char filepath0[1024]; - - } RenderStateRec, *RenderState; - - - static void - render_state_init( RenderState state, - Display display, - FT_Library library ) - { - FT_UInt cff_hinting_engine; - FT_Bool warping; - - unsigned int tt_interpreter_versions[3] = { 0, 0, 0 }; - int num_tt_interpreter_versions = 0; - int tt_interpreter_version_idx = 0; - - unsigned int dflt_tt_interpreter_version; - int i; - unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - TT_INTERPRETER_VERSION_40 }; - - - memset( state, 0, sizeof ( *state ) ); - - state->library = library; - - state->text = default_text; - state->filepath = state->filepath0; - state->filename = ""; - state->filepath0[0] = 0; - state->resolution = 72; - state->char_size = 16; - state->display = display[0]; - - /* get the default value as compiled into FreeType */ - FT_Property_Get( library, - "cff", - "hinting-engine", &cff_hinting_engine ); - - /* collect all available versions, then set again the default */ - FT_Property_Get( library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - for ( i = 0; i < 3; i++ ) - { - error = FT_Property_Set( library, - "truetype", - "interpreter-version", &versions[i] ); - if ( !error ) - tt_interpreter_versions[num_tt_interpreter_versions++] = versions[i]; - if ( versions[i] == dflt_tt_interpreter_version ) - tt_interpreter_version_idx = i; - } - FT_Property_Set( library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - - FT_Property_Get( library, - "autofitter", - "warping", &warping ); - - state->columns[0].use_cboxes = 0; - state->columns[0].use_kerning = 1; - state->columns[0].use_deltas = 1; - state->columns[0].use_lcd_filter = 1; - state->columns[0].lcd_filter = FT_LCD_FILTER_DEFAULT; - state->columns[0].hint_mode = HINT_MODE_BYTECODE; - state->columns[0].cff_hinting_engine = cff_hinting_engine; - - state->columns[0].tt_interpreter_versions[0] = - tt_interpreter_versions[0]; - state->columns[0].tt_interpreter_versions[1] = - tt_interpreter_versions[1]; - state->columns[0].tt_interpreter_versions[2] = - tt_interpreter_versions[2]; - state->columns[0].num_tt_interpreter_versions = - num_tt_interpreter_versions; - state->columns[0].tt_interpreter_version_idx = - tt_interpreter_version_idx; - - state->columns[0].warping = warping; - state->columns[0].use_custom_lcd_filter = 0; - state->columns[0].fw_index = 2; - /* freetype default filter weights */ - memcpy( state->columns[0].filter_weights, "\x08\x4D\x56\x4D\x08", 5 ); - - state->columns[1] = state->columns[0]; - state->columns[1].hint_mode = HINT_MODE_AUTOHINT; - state->columns[1].use_custom_lcd_filter = 1; - - state->columns[2] = state->columns[0]; - state->columns[2].hint_mode = HINT_MODE_UNHINTED; - - state->col = 1; - } - - - static void - render_state_done( RenderState state ) - { - if ( state->filepath != state->filepath0 ) - { - free( (char*)state->filepath ); - state->filepath = state->filepath0; - } - state->filepath0[0] = 0; - state->filename = 0; - - if ( state->face ) - { - FT_Done_Face( state->face ); - state->face = NULL; - state->size = NULL; - } - - if ( state->library ) - { - FT_Done_FreeType( state->library ); - state->library = NULL; - } - } - - - static void - render_state_set_resolution( RenderState state, - unsigned int resolution ) - { - state->resolution = resolution; - } - - - static void - render_state_set_size( RenderState state, - double char_size ) - { - state->char_size = char_size; - } - - - static void - render_state_set_face_index( RenderState state, - int idx ) - { - state->face_index = idx; - } - - - static void - _render_state_rescale( RenderState state ) - { - if ( state->size ) - FT_Set_Char_Size( state->face, 0, - (FT_F26Dot6)( state->char_size * 64.0 ), - 0, state->resolution ); - } - - - static void - render_state_set_files( RenderState state, - char** files, - char* execname ) - { - FontFace faces = NULL; - unsigned int num_faces = 0; - unsigned int max_faces = 0; - - - state->files = files; - for ( ; files[0] != NULL; files++ ) - { - FT_Face face; - - int num_subfonts; - int count; - - - error = FT_New_Face( state->library, files[0], -1, &face ); - if ( error ) - { - fprintf( stderr, - "ftdiff: could not open font file `%s'\n", - files[0] ); - continue; - } - - num_subfonts = face->num_faces; - - FT_Done_Face( face ); - - for ( count = 0; count < num_subfonts; count++ ) - { - char* fn; - char* family_name; - char* sn; - char* style_name; - - - error = FT_New_Face( state->library, files[0], count, &face ); - if ( error ) - { - fprintf( stderr, - "ftdiff: Opening `%s' failed with code 0x%X, skipping\n", - files[0], error ); - break; - } - - if ( !FT_IS_SCALABLE( face ) ) - { - fprintf( stderr, - "ftdiff: font `%s' is not scalable, skipping\n", - files[0] ); - goto Done; - } - - if ( num_faces >= max_faces ) - { - max_faces += ( max_faces >> 1 ) + 8; - faces = (FontFace)realloc( faces, - max_faces * sizeof ( faces[0] ) ); - if ( faces == NULL ) - panic( "ftdiff: not enough memory\n" ); - } - - if ( face->family_name ) - fn = face->family_name; - else - fn = (char*)"(unknown family)"; - family_name = (char*)malloc( strlen( fn ) + 1 ); - if ( family_name == NULL ) - panic( "ftdiff: not enough memory\n" ); - strcpy( family_name, fn ); - - if ( face->style_name ) - sn = face->style_name; - else - sn = (char*)"(unknown style)"; - style_name = (char*)malloc( strlen( sn ) + 1 ); - if ( style_name == NULL ) - panic( "ftdiff: not enough memory\n" ); - strcpy( style_name, sn ); - - faces[num_faces].filepath = files[0]; - faces[num_faces].index = count; - faces[num_faces].family_name = family_name; - faces[num_faces].style_name = style_name; - num_faces++; - - Done: - FT_Done_Face( face ); - } - } - - state->faces = faces; - state->num_faces = num_faces; - - if ( num_faces == 0 ) - { - fprintf( stderr, "ftdiff: no input font files!\n" ); - usage( execname ); - } - - state->face_index = 0; - } - - - static int - render_state_set_file( RenderState state ) - { - const char* filepath; - - - filepath = state->faces[state->face_index].filepath; - - if ( state->face ) - { - FT_Done_Face( state->face ); - state->face = NULL; - state->size = NULL; - } - - if ( filepath != NULL && filepath[0] != 0 ) - { - error = FT_New_Face( state->library, - filepath, - state->faces[state->face_index].index, - &state->face ); - if ( error ) - return -1; - - { - unsigned int len = strlen( filepath ); - char* p; - - - if ( len + 1 > sizeof ( state->filepath0 ) ) - { - state->filepath = (const char*)malloc( len + 1 ); - if ( state->filepath == NULL ) - { - state->filepath = state->filepath0; - return -1; - } - } - memcpy( (char*)state->filepath, filepath, len + 1 ); - p = (char*)strrchr( state->filepath, '\\' ); - if ( p == NULL ) - p = (char*)strrchr( state->filepath, '/' ); - - state->filename = p ? p + 1 : state->filepath; - } - - state->size = state->face->size; - } - - return 0; - } - - - /** RENDERING **/ - - static void - render_state_draw( RenderState state, - const char* text, - int idx, - int x, - int y, - int width, - int height ) - { - ColumnState column = &state->columns[idx]; - const char* p = text; - const char* p_end = p + strlen( text ); - long load_flags = FT_LOAD_DEFAULT; - FT_Face face; - int left = x; - int right = x + width; - int bottom = y + height; - int line_height; - FT_UInt prev_glyph = 0; - FT_Pos prev_rsb_delta = 0; - FT_Pos x_origin = x << 6; - HintMode rmode = column->hint_mode; - FT_Bool warping = column->warping; - FT_Bool have_0x0A = 0; - FT_Bool have_0x0D = 0; - - - /* no need to check for errors: the values used here are always valid */ - FT_Property_Set( state->library, - "cff", - "hinting-engine", - &column->cff_hinting_engine ); - FT_Property_Set( state->library, - "truetype", - "interpreter-version", - &column->tt_interpreter_versions - [column->tt_interpreter_version_idx] ); - FT_Property_Set( state->library, - "autofitter", - "warping", - &column->warping ); - - /* changing a property is in most cases a global operation; */ - /* we are on the safe side if we reload the face completely */ - /* (this is something a normal program doesn't need to do) */ - render_state_set_file( state ); - _render_state_rescale( state ); - - face = state->face; - - if ( column->use_lcd_filter ) - FT_Library_SetLcdFilter( face->glyph->library, column->lcd_filter ); - - if ( column->use_custom_lcd_filter ) - FT_Library_SetLcdFilterWeights( face->glyph->library, - column->filter_weights ); - - y += state->size->metrics.ascender / 64; - line_height = state->size->metrics.height / 64; - - if ( rmode == HINT_MODE_AUTOHINT ) - load_flags = FT_LOAD_FORCE_AUTOHINT; - - if ( rmode == HINT_MODE_AUTOHINT_LIGHT ) - load_flags = FT_LOAD_TARGET_LIGHT; - - if ( rmode == HINT_MODE_UNHINTED ) - load_flags |= FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; - - while ( 1 ) - { - int ch; - FT_UInt gindex; - FT_GlyphSlot slot = face->glyph; - FT_Bitmap* map = &slot->bitmap; - FT_Long xmax; - - - ch = utf8_next( &p, p_end ); - if ( ch < 0 ) - { - p = text; - ch = utf8_next( &p, p_end ); - } - - /* handle newlines */ - if ( ch == 0x0A ) - { - if ( have_0x0D ) - { - have_0x0A = 0; - have_0x0D = 0; - } - else - { - have_0x0A = 1; - - x_origin = left << 6; - y += line_height; - prev_rsb_delta = 0; - if ( y >= bottom ) - break; - } - - continue; - } - else if ( ch == 0x0D ) - { - if ( have_0x0A ) - { - have_0x0A = 0; - have_0x0D = 0; - } - else - { - have_0x0D = 1; - - x_origin = left << 6; - y += line_height; - prev_rsb_delta = 0; - if ( y >= bottom ) - break; - } - - continue; - } - else - { - have_0x0A = 0; - have_0x0D = 0; - } - - gindex = FT_Get_Char_Index( state->face, (FT_ULong)ch ); - error = FT_Load_Glyph( face, gindex, load_flags ); - - if ( error ) - continue; - - if ( column->use_kerning && gindex != 0 && prev_glyph != 0 ) - { - FT_Vector vec; - FT_UInt kerning_mode = FT_KERNING_DEFAULT; - - - if ( rmode == HINT_MODE_UNHINTED ) - kerning_mode = FT_KERNING_UNFITTED; - - FT_Get_Kerning( face, prev_glyph, gindex, kerning_mode, &vec ); - - x_origin += vec.x; - } - - if ( column->use_deltas ) - { - if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) - x_origin -= 64; - else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) - x_origin += 64; - } - prev_rsb_delta = face->glyph->rsb_delta; - - /* implement sub-pixel positioning for un-hinted mode */ - if ( rmode == HINT_MODE_UNHINTED && - slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - FT_Pos shift = x_origin & 63; - - - FT_Outline_Translate( &slot->outline, shift, 0 ); - } - - if ( column->use_cboxes ) - { - if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - FT_BBox cbox; - - - FT_Outline_Get_CBox( &slot->outline, &cbox ); - xmax = ( x_origin + cbox.xMax + 63 ) >> 6; - } - else - xmax = ( x_origin >> 6 ) + - slot->bitmap_left + (FT_Long)slot->bitmap.width; - } - else - { - if ( rmode == HINT_MODE_UNHINTED ) - xmax = slot->linearHoriAdvance >> 10; - else - xmax = slot->advance.x; - - xmax += x_origin; - xmax >>= 6; - xmax -= 1; - } - - if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - FT_Render_Glyph( slot, - column->use_lcd_filter ? FT_RENDER_MODE_LCD - : FT_RENDER_MODE_NORMAL ); - - if ( xmax >= right ) - { - x = left; - y += line_height; - if ( y >= bottom ) - break; - - x_origin = x << 6; - prev_rsb_delta = 0; - } - - { - DisplayMode mode = DISPLAY_MODE_MONO; - - - if ( slot->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ) - mode = DISPLAY_MODE_GRAY; - else if ( slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD ) - mode = DISPLAY_MODE_LCD; - - state->display.disp_draw( state->display.disp, mode, - ( x_origin >> 6 ) + slot->bitmap_left, - y - slot->bitmap_top, - (int)map->width, (int)map->rows, - map->pitch, map->buffer ); - } - if ( rmode == HINT_MODE_UNHINTED ) - x_origin += slot->linearHoriAdvance >> 10; - else - x_origin += slot->advance.x; - - prev_glyph = gindex; - } - - /* display footer on this column */ - { - FT_Module module = &state->face->driver->root; - void* disp = state->display.disp; - - const char* extra; - const char* msg; - char temp[64]; - - - extra = ""; - if ( rmode == HINT_MODE_BYTECODE ) - { - if ( !strcmp( module->clazz->module_name, "cff" ) ) - { - switch ( column->cff_hinting_engine ) - { - case FT_CFF_HINTING_FREETYPE: - extra = " (CFF FT)"; - break; - case FT_CFF_HINTING_ADOBE: - extra = " (CFF Adobe)"; - break; - } - } - - else if ( !strcmp( module->clazz->module_name, "truetype" ) ) - { - switch ( column->tt_interpreter_versions[ - column->tt_interpreter_version_idx] ) - { - case TT_INTERPRETER_VERSION_35: - extra = " (TT v35)"; - break; - case TT_INTERPRETER_VERSION_38: - extra = " (TT v38)"; - break; - case TT_INTERPRETER_VERSION_40: - extra = " (TT v40)"; - break; - } - } - } - else if ( rmode == HINT_MODE_AUTOHINT_LIGHT ) - extra = warping ? " (+warp)" : " (-warp)"; - - sprintf( temp, "%s%s", - render_mode_names[column->hint_mode], extra ); - state->display.disp_text( disp, left, - bottom + 5, temp ); - - if ( column->use_lcd_filter ) - msg = "LCD rendering"; - else - msg = "gray rendering"; - state->display.disp_text( disp, left, - bottom + HEADER_HEIGHT + 5, msg ); - - if ( column->use_lcd_filter ) - { - if ( column->use_custom_lcd_filter ) - { - int fwi = column->fw_index; - unsigned char* fw = column->filter_weights; - - - sprintf( temp, - "%s0x%02X%s0x%02X%s0x%02X%s0x%02X%s0x%02X%s", - fwi == 0 ? "[" : " ", - fw[0], - fwi == 0 ? "]" : ( fwi == 1 ? "[" : " " ), - fw[1], - fwi == 1 ? "]" : ( fwi == 2 ? "[" : " " ), - fw[2], - fwi == 2 ? "]" : ( fwi == 3 ? "[" : " " ), - fw[3], - fwi == 3 ? "]" : ( fwi == 4 ? "[" : " " ), - fw[4], - fwi == 4 ? "]" : " " ); - state->display.disp_text( disp, left, - bottom + 2 * HEADER_HEIGHT + 5, temp ); - } - else - { - switch ( column->lcd_filter ) - { - case FT_LCD_FILTER_NONE: - msg = "LCD without filtering"; - break; - case FT_LCD_FILTER_DEFAULT: - msg = "default LCD filter"; - break; - case FT_LCD_FILTER_LIGHT: - msg = "light LCD filter"; - break; - default: - msg = "legacy LCD filter"; - } - state->display.disp_text( disp, left, - bottom + 2 * HEADER_HEIGHT + 5, msg ); - } - } - else - { - msg = ""; - state->display.disp_text( disp, left, - bottom + 2 * HEADER_HEIGHT + 5, msg ); - } - - sprintf( temp, "%s %s %s", - column->use_kerning ? "+kern" - : "-kern", - column->use_deltas ? "+delta" - : "-delta", - column->use_cboxes ? "glyph boxes" - : "adv. widths" ); - state->display.disp_text( disp, left, - bottom + 3 * HEADER_HEIGHT + 5, temp ); - - if ( state->col == idx ) - state->display.disp_text( disp, left, - bottom + 4 * HEADER_HEIGHT + 5, - "************************" ); - } - } - - - /***********************************************************************/ - /***********************************************************************/ - /***** *****/ - /***** D I S P L A Y *****/ - /***** *****/ - /***********************************************************************/ - /***********************************************************************/ - -#include "graph.h" -#include "grobjs.h" -#include "grfont.h" - - typedef struct ADisplayRec_ - { - int width; - int height; - grSurface* surface; - grBitmap* bitmap; - grColor fore_color; - grColor back_color; - double gamma; - - } ADisplayRec, *ADisplay; - - - static int - adisplay_init( ADisplay display, - grPixelMode mode, - int width, - int height ) - { - grSurface* surface; - grBitmap bit; - - - if ( mode != gr_pixel_mode_gray && - mode != gr_pixel_mode_rgb24 ) - return -1; - - grInitDevices(); - - bit.mode = mode; - bit.width = width; - bit.rows = height; - bit.grays = 256; - - surface = grNewSurface( 0, &bit ); - - if ( !surface ) - return -1; - - display->width = width; - display->height = height; - display->surface = surface; - display->bitmap = &surface->bitmap; - display->gamma = GAMMA; - - grSetGlyphGamma( display->gamma ); - - memset( &display->fore_color, 0, sizeof( grColor ) ); - memset( &display->back_color, 0xff, sizeof( grColor ) ); - - return 0; - } - - - static void - adisplay_clear( ADisplay display ) - { - grBitmap* bit = display->bitmap; - int pitch = bit->pitch; - - - if ( pitch < 0 ) - pitch = -pitch; - - if ( bit->mode == gr_pixel_mode_gray ) - memset( bit->buffer, - display->back_color.value, - (unsigned int)( pitch * bit->rows ) ); - else - { - unsigned char* p = bit->buffer; - int i, j; - - - for ( i = 0; i < bit->rows; i++ ) - { - for ( j = 0; j < bit->width; j++ ) - memcpy( p + 3 * j, display->back_color.chroma, 3 ); - - p += pitch; - } - } - } - - - static void - adisplay_done( ADisplay display ) - { - grDoneBitmap( display->bitmap ); - grDoneSurface( display->surface ); - - display->bitmap = NULL; - display->surface = NULL; - - grDoneDevices(); - } - - - static void - adisplay_draw_glyph( void* _display, - DisplayMode mode, - int x, - int y, - int width, - int height, - int pitch, - void* buffer ) - { - ADisplay display = (ADisplay)_display; - grBitmap glyph; - - - glyph.width = width; - glyph.rows = height; - glyph.pitch = pitch; - glyph.buffer = (unsigned char*)buffer; - glyph.grays = 256; - glyph.mode = gr_pixel_mode_mono; - - if ( mode == DISPLAY_MODE_GRAY ) - glyph.mode = gr_pixel_mode_gray; - else if ( mode == DISPLAY_MODE_LCD ) - glyph.mode = gr_pixel_mode_lcd; - - grBlitGlyphToBitmap( display->bitmap, &glyph, - x, y, display->fore_color ); - } - - - static void - adisplay_draw_text( void* _display, - int x, - int y, - const char* msg ) - { - ADisplay adisplay = (ADisplay)_display; - - - grWriteCellString( adisplay->bitmap, x, y, msg, - adisplay->fore_color ); - } - - - static void - adisplay_change_gamma( ADisplay display, - double delta ) - { - /* use epsilons */ - display->gamma += delta; - if ( display->gamma > 2.9999 ) - display->gamma = 3.0; - else if ( display->gamma < 0.0001 ) - display->gamma = 0.0; - - grSetGlyphGamma( display->gamma ); - } - - - static void - event_help( RenderState state ) - { - char buf[256]; - char version[64]; - - const char* format; - FT_Int major, minor, patch; - - ADisplay display = (ADisplay)state->display.disp; - grEvent dummy_event; - - - FT_Library_Version( state->library, &major, &minor, &patch ); - - format = patch ? "%d.%d.%d" : "%d.%d"; - sprintf( version, format, major, minor, patch ); - - adisplay_clear( display ); - grSetLineHeight( 10 ); - grGotoxy( 0, 0 ); - grSetMargin( 2, 1 ); - grGotobitmap( display->bitmap ); - - sprintf( buf, - "FreeType Hinting Mode Comparator - part of the FreeType %s test suite", - version ); - - grWriteln( buf ); - grLn(); - grWriteln( "This program displays text using various hinting algorithms." ); - grLn(); - grWriteln( "Use the following keys:" ); - grLn(); - grWriteln( " F1, ? display this help screen" ); - grLn(); - grWriteln( " p, n select previous/next font" ); - grLn(); - grWriteln( " global parameters:" ); - grLn(); - grWriteln( " Up, Down adjust pointsize by 0.5 unit" ); - grWriteln( " PgUp, PgDn adjust pointsize by 5 units" ); - grWriteln( " g, v adjust gamma value" ); - grLn(); - grWriteln( " 1, 2, 3 select left, middle, or right column" ); - grWriteln( " Left, Right switch between columns" ); - grLn(); - grWriteln( " per-column parameters:" ); - grLn(); - grWriteln( " d toggle lsb/rsb deltas" ); - grWriteln( " h toggle hinting mode" ); - grWriteln( " H cycle hinting engine (if CFF or TTF)" ); - grWriteln( " w toggle warping (if light auto-hinting" ); - grWriteln( " k toggle kerning (only from `kern' table)" ); - grWriteln( " r toggle rendering mode" ); - grWriteln( " x toggle layout mode" ); - grLn(); - grWriteln( " l change LCD filter type" ); - grWriteln( " [, ] select custom LCD filter weight" ); - grWriteln( " -, +(=) adjust selected custom LCD filter weight"); - grLn(); - grWriteln( "press any key to exit this help screen" ); - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, gr_event_key, &dummy_event ); - } - - - static void - event_change_gamma( RenderState state, - double delta ) - { - ADisplay display = (ADisplay)state->display.disp; - - - adisplay_change_gamma( display, delta ); - } - - - static void - event_change_size( RenderState state, - double delta ) - { - double char_size = state->char_size; - - - char_size += delta; - if ( char_size < 6.0 ) - char_size = 6.0; - else if ( char_size > 300.0 ) - char_size = 300.0; - - render_state_set_size( state, char_size ); - } - - - static void - event_change_face_index( RenderState state, - int idx ) - { - if ( idx < 0 ) - idx = 0; - - if ( idx >= (int)state->num_faces ) - idx = (int)state->num_faces - 1; - - render_state_set_face_index( state, idx ); - } - - - static int - process_event( RenderState state, - grEvent* event ) - { - int ret = 0; - ColumnState column = &state->columns[state->col]; - - - switch ( event->key ) - { - case grKeyEsc: - case grKEY( 'q' ): - ret = 1; - break; - - case grKeyF1: - case grKEY( '?' ): - event_help( state ); - break; - - case grKeyLeft: - if ( --state->col < 0 ) - state->col = 2; - break; - - case grKeyRight: - if ( ++state->col > 2 ) - state->col = 0; - break; - - case grKeyUp: - event_change_size( state, 0.5 ); - break; - - case grKeyDown: - event_change_size( state, -0.5 ); - break; - - case grKeyPageUp: - event_change_size( state, 5. ); - break; - - case grKeyPageDown: - event_change_size( state, -5. ); - break; - - case grKEY( '1' ): - state->col = 0; - break; - - case grKEY( '2' ): - state->col = 1; - break; - - case grKEY( '3' ): - state->col = 2; - break; - - case grKEY( 'd' ): - column->use_deltas = !column->use_deltas; - break; - - case grKEY( 'g' ): - event_change_gamma( state, 0.1 ); - break; - - case grKEY( 'h' ): - column->hint_mode = - (HintMode)( ( column->hint_mode + 1 ) % HINT_MODE_MAX ); - break; - - case grKEY( 'H' ): - { - FT_Module module = &state->face->driver->root; - - - if ( column->hint_mode == HINT_MODE_BYTECODE ) - { - if ( !strcmp( module->clazz->module_name, "cff" ) ) - { - FT_UInt new_cff_hinting_engine; - - - new_cff_hinting_engine = - ( column->cff_hinting_engine + 1 ) % HINTING_ENGINE_MAX; - - error = FT_Property_Set( state->library, - "cff", - "hinting-engine", - &new_cff_hinting_engine ); - if ( !error ) - column->cff_hinting_engine = new_cff_hinting_engine; - } - else if ( !strcmp( module->clazz->module_name, "truetype" ) ) - { - column->tt_interpreter_version_idx += 1; - column->tt_interpreter_version_idx %= - column->num_tt_interpreter_versions; - - FT_Property_Set( state->library, - "truetype", - "interpreter-version", - &column->tt_interpreter_versions[ - column->tt_interpreter_version_idx] ); - } - } - } - break; - - case grKEY( 'w' ): - { - FT_Bool new_warping_state = !column->warping; - - - error = FT_Property_Set( state->library, - "autofitter", - "warping", - &new_warping_state ); - if ( !error ) - column->warping = new_warping_state; - } - break; - - case grKEY( 'k' ): - column->use_kerning = !column->use_kerning; - break; - - case grKEY( 'l' ): - switch ( column->lcd_filter ) - { - case FT_LCD_FILTER_NONE: - column->lcd_filter = FT_LCD_FILTER_DEFAULT; - break; - - case FT_LCD_FILTER_DEFAULT: - if ( !column->use_custom_lcd_filter ) - column->use_custom_lcd_filter = 1; - else - { - column->use_custom_lcd_filter = 0; - column->lcd_filter = FT_LCD_FILTER_LIGHT; - } - break; - - case FT_LCD_FILTER_LIGHT: - column->lcd_filter = FT_LCD_FILTER_LEGACY; - break; - - case FT_LCD_FILTER_LEGACY: - column->lcd_filter = FT_LCD_FILTER_NONE; - break; - - default: /* to satisfy picky compilers */ - break; - } - break; - - case grKEY( 'n' ): - event_change_face_index( state, state->face_index + 1 ); - break; - - case grKEY( 'p' ): - event_change_face_index( state, state->face_index - 1 ); - break; - - case grKEY( 'r' ): - column->use_lcd_filter = !column->use_lcd_filter; - break; - - case grKEY( 'v' ): - event_change_gamma( state, -0.1 ); - break; - - case grKEY( 'x' ): - column->use_cboxes = !column->use_cboxes; - break; - - case grKEY( '[' ): - if ( !column->use_custom_lcd_filter ) - break; - - column->fw_index--; - if ( column->fw_index < 0 ) - column->fw_index = 4; - break; - - case grKEY( ']' ): - if ( !column->use_custom_lcd_filter ) - break; - - column->fw_index++; - if ( column->fw_index > 4 ) - column->fw_index = 0; - break; - - case grKEY( '-' ): - if ( !column->use_custom_lcd_filter ) - break; - - column->filter_weights[column->fw_index]--; - break; - - case grKEY( '+' ): - case grKEY( '=' ): - if ( !column->use_custom_lcd_filter ) - break; - - column->filter_weights[column->fw_index]++; - break; - - default: - break; - } - - return ret; - } - - - static void - write_global_info( RenderState state ) - { - ADisplay adisplay = (ADisplay)state->display.disp; - char gamma[] = "sRGB"; - char buf[256]; - - FontFace face = &state->faces[state->face_index]; - const char* basename; - - - basename = ft_basename( state->filename ); - sprintf( buf, "%.50s %.50s (file `%.100s')", - face->family_name, - face->style_name, - basename ); - grWriteCellString( adisplay->bitmap, 0, 5, - buf, adisplay->fore_color ); - - if ( adisplay->gamma != 0.0 ) - sprintf( gamma, "%.1f", adisplay->gamma ); - sprintf( buf, "%.1fpt (%dppem) at %ddpi, gamma: %s", - state->char_size, - (int)(state->char_size * state->resolution / 72 + 0.5), - state->resolution, - gamma ); - grWriteCellString( adisplay->bitmap, 0, 5 + HEADER_HEIGHT, - buf, adisplay->fore_color ); - - } - - - int - main( int argc, - char** argv ) - { - FT_Library library; - - ADisplayRec adisplay[1]; - RenderStateRec state[1]; - DisplayRec display[1]; - int width = DIM_X; - int height = DIM_Y; - int resolution = -1; - double size = -1; - const char* textfile = NULL; - char* text = (char*)default_text; - - char* execname; - int option; - - - execname = ft_basename( argv[0] ); - - if ( FT_Init_FreeType( &library ) != 0 ) - panic( "could not initialize FreeType\n" ); - - while ( 1 ) - { - option = getopt( argc, argv, "f:h:r:s:vw:" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'f': - textfile = optarg; - break; - - case 'h': - height = atoi( optarg ); - if ( height < 1 ) - usage( execname ); - break; - - case 'r': - resolution = atoi( optarg ); - break; - - case 's': - size = atof( optarg ); - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( library, &major, &minor, &patch ); - - printf( "ftdiff (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - case 'w': - width = atoi( optarg ); - if ( width < 1 ) - usage( execname ); - break; - - default: - usage( execname ); - break; - } - } - - argc -= optind; - argv += optind; - - if ( argc < 1 ) - usage( execname ); - - /* Read Text File, if any */ - if ( textfile != NULL ) - { - FILE* tfile = fopen( textfile, "r" ); - - - if ( tfile == NULL ) - fprintf( stderr, "could not read textfile '%s'\n", textfile ); - else - { - int tsize; - - - fseek( tfile, 0, SEEK_END ); - tsize = ftell( tfile ); - - fseek( tfile, 0, SEEK_SET ); - text = (char*)malloc( (unsigned int)( tsize + 1 ) ); - - if ( text != NULL ) - { - fread( text, (unsigned int)tsize, 1, tfile ); - text[tsize] = 0; - } - else - { - fprintf( stderr, "not enough memory to read `%s'\n", textfile ); - text = (char *)default_text; - } - - fclose( tfile ); - } - } - - /* Initialize display */ - if ( adisplay_init( adisplay, gr_pixel_mode_rgb24, - width, height ) < 0 ) - { - fprintf( stderr, "could not initialize display! Aborting.\n" ); - exit( 1 ); - } - display->disp = adisplay; - display->disp_draw = adisplay_draw_glyph; - display->disp_text = adisplay_draw_text; - - render_state_init( state, display, library ); - - if ( resolution > 0 ) - render_state_set_resolution( state, (unsigned int)resolution ); - - if ( size > 0.0 ) - render_state_set_size( state, size ); - - render_state_set_files( state, argv, execname ); - - grSetTitle( adisplay->surface, "FreeType Text Proofer, press ? for help" ); - - for (;;) - { - grEvent event; - - int border_width; - - int column_x_start[3]; - int column_y_start; - - int column_height; - int column_width; - - - adisplay_clear( adisplay ); - - /* We have this layout: */ - /* */ - /* | n ----x---- n n ----x---- n n ----x---- n | */ - /* */ - /* w = 6 * n + 3 * x */ - - border_width = 10; /* n */ - column_width = ( width - 6 * border_width ) / 3; /* x */ - - column_x_start[0] = border_width; - column_x_start[1] = 3 * border_width + column_width; - column_x_start[2] = 5 * border_width + 2 * column_width; - - column_y_start = 10 + 2 * HEADER_HEIGHT; - column_height = height - 8 * HEADER_HEIGHT - 5; - - render_state_draw( state, text, 0, - column_x_start[0], column_y_start, - column_width, column_height ); - render_state_draw( state, text, 1, - column_x_start[1], column_y_start, - column_width, column_height ); - render_state_draw( state, text, 2, - column_x_start[2], column_y_start, - column_width, column_height ); - - write_global_info( state ); - grRefreshSurface( adisplay->surface ); - grListenSurface( adisplay->surface, 0, &event ); - if ( process_event( state, &event ) ) - break; - } - - render_state_done( state ); - adisplay_done( adisplay ); - exit( 0 ); /* for safety reasons */ - - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftdump.1 freetype-2.8/=unpacked-tar1=/src/ftdump.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftdump.1 2016-12-30 20:32:34.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftdump.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -.TH FTDUMP 1 "December 2016" "FreeType 2.7.1" -. -. -.SH NAME -. -ftdump \- simple font dumper -. -. -.SH SYNOPSIS -. -.B ftdump -.RI [ options ] -.I fontname -. -. -.SH DESCRIPTION -. -.B ftdump -lists information about a font file that is relevant for FreeType. -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.B \-n -Print SFNT name tables. -. -.TP -.B \-p -Print TrueType programs. -. -.TP -.B \-u -Emit UTF-8. -. -.TP -.B \-V -Be verbose. -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftdump.c freetype-2.8/=unpacked-tar1=/src/ftdump.c --- freetype-2.7.1/=unpacked-tar1=/src/ftdump.c 2016-10-14 07:08:52.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftdump.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,882 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000, 2003-2007, 2010, 2012-2013 */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/****************************************************************************/ - - -#include -#include FT_FREETYPE_H -#include FT_SFNT_NAMES_H -#include FT_TRUETYPE_IDS_H -#include FT_TRUETYPE_TABLES_H -#include FT_TRUETYPE_TAGS_H -#include FT_MULTIPLE_MASTERS_H - - /* the following header shouldn't be used in normal programs */ -#include FT_INTERNAL_DEBUG_H - - /* showing driver name */ -#include FT_MODULE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DRIVER_H - -#include "common.h" -#include "output.h" -#include "mlgetopt.h" - -#include -#include -#include - - - static FT_Error error; - - static int comma_flag = 0; - static int verbose = 0; - static int name_tables = 0; - static int bytecode = 0; - static int utf8 = 0; - - - /* PanicZ */ - static void - PanicZ( const char* message ) - { - fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); - exit( 1 ); - } - - - static void - Print_Comma( const char* message ) - { - if ( comma_flag ) - printf( ", " ); - - printf( "%s", message ); - comma_flag = 1; - } - - - static void - usage( char* execname ) - { - fprintf( stderr, - "\n" - "ftdump: simple font dumper -- part of the FreeType project\n" - "-----------------------------------------------------------\n" - "\n" - "Usage: %s [options] fontname\n" - "\n", - execname ); - - fprintf( stderr, - " -n Print SFNT name tables.\n" - " -p Print TrueType programs.\n" - " -u Emit UTF8.\n" - " -V Be verbose.\n" - "\n" - " -v Show version.\n" - "\n" ); - - exit( 1 ); - } - - - static void - Print_Name( FT_Face face ) - { - const char* ps_name; - - - printf( "font name entries\n" ); - - /* XXX: Foundry? Copyright? Version? ... */ - - printf( " family: %s\n", face->family_name ); - printf( " style: %s\n", face->style_name ); - - ps_name = FT_Get_Postscript_Name( face ); - if ( ps_name == NULL ) - ps_name = "UNAVAILABLE"; - - printf( " postscript: %s\n", ps_name ); - } - - - static void - Print_Type( FT_Face face ) - { - FT_Module module; - - - printf( "font type entries\n" ); - - module = &face->driver->root; - printf( " FreeType driver: %s\n", module->clazz->module_name ); - - /* Is it better to dump all sfnt tag names? */ - printf( " sfnt wrapped: %s\n", - FT_IS_SFNT( face ) ? (char *)"yes" : (char *)"no" ); - - /* isScalable? */ - comma_flag = 0; - printf( " type: " ); - if ( FT_IS_SCALABLE( face ) ) - { - Print_Comma( "scalable" ); - if ( FT_HAS_MULTIPLE_MASTERS( face ) ) - Print_Comma( "multiple masters" ); - } - if ( FT_HAS_FIXED_SIZES( face ) ) - Print_Comma( "fixed size" ); - printf( "\n" ); - - /* Direction */ - comma_flag = 0; - printf( " direction: " ); - if ( FT_HAS_HORIZONTAL( face ) ) - Print_Comma( "horizontal" ); - - if ( FT_HAS_VERTICAL( face ) ) - Print_Comma( "vertical" ); - - printf( "\n" ); - - printf( " fixed width: %s\n", - FT_IS_FIXED_WIDTH( face ) ? (char *)"yes" : (char *)"no" ); - - printf( " glyph names: %s\n", - FT_HAS_GLYPH_NAMES( face ) ? (char *)"yes" : (char *)"no" ); - - if ( FT_IS_SCALABLE( face ) ) - { - printf( " EM size: %d\n", face->units_per_EM ); - printf( " global BBox: (%ld,%ld):(%ld,%ld)\n", - face->bbox.xMin, face->bbox.yMin, - face->bbox.xMax, face->bbox.yMax ); - printf( " ascent: %d\n", face->ascender ); - printf( " descent: %d\n", face->descender ); - printf( " text height: %d\n", face->height ); - } - } - - static const char* - platform_id( int id ) - { - switch ( id ) - { - case TT_PLATFORM_APPLE_UNICODE: - return "Apple (Unicode)"; - case TT_PLATFORM_MACINTOSH: - return "Macintosh"; - case TT_PLATFORM_ISO: - return "ISO (deprecated)"; - case TT_PLATFORM_MICROSOFT: - return "Microsoft"; - case TT_PLATFORM_CUSTOM: - return "custom"; - case TT_PLATFORM_ADOBE: - return "Adobe"; - - default: - return "UNKNOWN"; - } - } - - - static const char* - name_id( int id ) - { - switch ( id ) - { - case TT_NAME_ID_COPYRIGHT: - return "copyright"; - case TT_NAME_ID_FONT_FAMILY: - return "font family"; - case TT_NAME_ID_FONT_SUBFAMILY: - return "font subfamily"; - case TT_NAME_ID_UNIQUE_ID: - return "unique ID"; - case TT_NAME_ID_FULL_NAME: - return "full name"; - case TT_NAME_ID_VERSION_STRING: - return "version string"; - case TT_NAME_ID_PS_NAME: - return "PostScript name"; - case TT_NAME_ID_TRADEMARK: - return "trademark"; - - /* the following values are from the OpenType spec */ - case TT_NAME_ID_MANUFACTURER: - return "manufacturer"; - case TT_NAME_ID_DESIGNER: - return "designer"; - case TT_NAME_ID_DESCRIPTION: - return "description"; - case TT_NAME_ID_VENDOR_URL: - return "vendor URL"; - case TT_NAME_ID_DESIGNER_URL: - return "designer URL"; - case TT_NAME_ID_LICENSE: - return "license"; - case TT_NAME_ID_LICENSE_URL: - return "license URL"; - /* number 15 is reserved */ - case TT_NAME_ID_PREFERRED_FAMILY: - return "preferred family"; - case TT_NAME_ID_PREFERRED_SUBFAMILY: - return "preferred subfamily"; - case TT_NAME_ID_MAC_FULL_NAME: - return "Mac full name"; - - /* the following code is new as of 2000-01-21 */ - case TT_NAME_ID_SAMPLE_TEXT: - return "sample text"; - - /* this is new in OpenType 1.3 */ - case TT_NAME_ID_CID_FINDFONT_NAME: - return "CID `findfont' name"; - - /* this is new in OpenType 1.5 */ - case TT_NAME_ID_WWS_FAMILY: - return "WWS family name"; - case TT_NAME_ID_WWS_SUBFAMILY: - return "WWS subfamily name"; - - default: - return NULL; - } - } - - - static void - Print_Sfnt_Names( FT_Face face ) - { - FT_SfntName name; - FT_UInt num_names, i; - - - printf( "font string entries\n" ); - - num_names = FT_Get_Sfnt_Name_Count( face ); - for ( i = 0; i < num_names; i++ ) - { - error = FT_Get_Sfnt_Name( face, i, &name ); - if ( error == FT_Err_Ok ) - { - const char* NameID = name_id( name.name_id ); - const char* PlatformID = platform_id( name.platform_id ); - - - if ( NameID ) - printf( " %-15s [%s]", NameID, PlatformID ); - else - printf( " Name ID %-5d [%s]", name.name_id, PlatformID ); - - switch ( name.platform_id ) - { - case TT_PLATFORM_APPLE_UNICODE: - fputs( ":\n", stdout ); - switch ( name.encoding_id ) - { - case TT_APPLE_ID_DEFAULT: - case TT_APPLE_ID_UNICODE_1_1: - case TT_APPLE_ID_ISO_10646: - case TT_APPLE_ID_UNICODE_2_0: - put_unicode_be16( name.string, name.string_len, 6, utf8 ); - break; - - default: - printf( "{unsupported Unicode encoding %d}", name.encoding_id ); - break; - } - break; - - case TT_PLATFORM_MACINTOSH: - if ( name.language_id != TT_MAC_LANGID_ENGLISH ) - printf( " (language=%u)", name.language_id ); - fputs( ":\n", stdout ); - - switch ( name.encoding_id ) - { - case TT_MAC_ID_ROMAN: - /* FIXME: convert from MacRoman to ASCII/ISO8895-1/whatever */ - /* (MacRoman is mostly like ISO8895-1 but there are */ - /* differences) */ - put_ascii( name.string, name.string_len, 6 ); - break; - - default: - printf( " [data in encoding %d]", name.encoding_id ); - break; - } - - break; - - case TT_PLATFORM_ISO: - fputs( ":\n", stdout ); - switch ( name.encoding_id ) - { - case TT_ISO_ID_7BIT_ASCII: - case TT_ISO_ID_8859_1: - put_ascii( name.string, name.string_len, 6 ); - break; - - case TT_ISO_ID_10646: - put_unicode_be16( name.string, name.string_len, 6, utf8 ); - break; - - default: - printf( "{unsupported encoding %d}", name.encoding_id ); - break; - } - break; - - case TT_PLATFORM_MICROSOFT: - if ( name.language_id != TT_MS_LANGID_ENGLISH_UNITED_STATES ) - printf( " (language=0x%04x)", name.language_id ); - fputs( ":\n", stdout ); - - switch ( name.encoding_id ) - { - /* TT_MS_ID_SYMBOL_CS is supposed to be Unicode, according to */ - /* information from the MS font development team */ - case TT_MS_ID_SYMBOL_CS: - case TT_MS_ID_UNICODE_CS: - put_unicode_be16( name.string, name.string_len, 6, utf8 ); - break; - - default: - printf( "{unsupported encoding %d}", name.encoding_id ); - break; - } - - break; - - default: - printf( "{unsupported platform}" ); - break; - } - - printf( "\n" ); - } - } - } - - - static void - Print_Fixed( FT_Face face ) - { - int i; - - - /* num_fixed_size */ - printf( "fixed size\n" ); - - /* available size */ - for ( i = 0; i < face->num_fixed_sizes; i++ ) - { - FT_Bitmap_Size* bsize = face->available_sizes + i; - - - printf( " %3d: height %d, width %d\n", - i, bsize->height, bsize->width ); - printf( " size %.3f, x_ppem %.3f, y_ppem %.3f\n", - bsize->size / 64.0, - bsize->x_ppem / 64.0, bsize->y_ppem / 64.0 ); - } - } - - - static void - Print_Charmaps( FT_Face face ) - { - int i, active = -1; - - - if ( face->charmap ) - active = FT_Get_Charmap_Index( face->charmap ); - - /* CharMaps */ - printf( "charmaps\n" ); - - for( i = 0; i < face->num_charmaps; i++ ) - { - FT_Long format = FT_Get_CMap_Format( face->charmaps[i] ); - FT_ULong lang_id = FT_Get_CMap_Language_ID( face->charmaps[i] ); - - - printf( " %d: format %ld, platform %u, encoding %2u", - i, - format, - face->charmaps[i]->platform_id, - face->charmaps[i]->encoding_id ); - - if ( lang_id == 0xFFFFFFFFUL ) - printf( " (Unicode Variation Sequences)" ); - else - printf( " language %lu", - lang_id ); - - if ( i == active ) - printf( " (active)" ); - - printf ( "\n" ); - - if ( verbose ) - { - FT_ULong charcode; - FT_UInt gindex; - - - FT_Set_Charmap( face, face->charmaps[i] ); - - charcode = FT_Get_First_Char( face, &gindex ); - while ( gindex ) - { - printf( " 0x%04lx => %d\n", charcode, gindex ); - charcode = FT_Get_Next_Char( face, charcode, &gindex ); - } - printf( "\n" ); - } - } - } - - - static void - Print_MM_Axes( FT_Face face ) - { - FT_MM_Var* mm; - FT_Multi_Master dummy; - FT_UInt is_GX, i, num_names; - - - /* MM or GX axes */ - error = FT_Get_Multi_Master( face, &dummy ); - is_GX = error ? 1 : 0; - - printf( "%s axes\n", is_GX ? "GX" : "MM" ); - - error = FT_Get_MM_Var( face, &mm ); - if ( error ) - { - printf( " Can't access axis data (error code %d)\n", error ); - return; - } - - num_names = FT_Get_Sfnt_Name_Count( face ); - - for ( i = 0; i < mm->num_axis; i++ ) - { - FT_SfntName name; - - - name.string = NULL; - - if ( is_GX ) - { - FT_UInt strid = mm->axis[i].strid; - FT_UInt j; - - - /* iterate over all name entries */ - /* to find an English entry for `strid' */ - - for ( j = 0; j < num_names; j++ ) - { - error = FT_Get_Sfnt_Name( face, j, &name ); - if ( error ) - continue; - - if ( name.name_id == strid ) - { - /* XXX we don't have support for Apple's new `ltag' table yet, */ - /* thus we ignore TT_PLATFORM_APPLE_UNICODE */ - if ( ( name.platform_id == TT_PLATFORM_MACINTOSH && - name.language_id == TT_MAC_LANGID_ENGLISH ) || - ( name.platform_id == TT_PLATFORM_MICROSOFT && - ( name.language_id & 0xFF ) - == TT_MS_LANGID_ENGLISH_GENERAL ) ) - break; - } - } - } - - if ( name.string ) - { - if ( name.platform_id == TT_PLATFORM_MACINTOSH ) - put_ascii( name.string, name.string_len, 3 ); - else - put_unicode_be16( name.string, name.string_len, 3, utf8 ); - } - else - printf( " %s", mm->axis[i].name ); - - printf( ": [%g;%g], default %g\n", - mm->axis[i].minimum / 65536.0, - mm->axis[i].maximum / 65536.0, - mm->axis[i].def / 65536.0 ); - } - - free( mm ); - } - - - static void - Print_Bytecode( FT_Byte* buffer, - FT_UShort length, - char* tag ) - { - FT_UShort i; - int j = 0; /* status counter */ - - - for ( i = 0; i < length; i++ ) - { - if ( ( i & 15 ) == 0 ) - printf( "\n%s:%04hx ", tag, i ); - - if ( j == 0 ) - { - printf( " %02x", (FT_UInt)buffer[i] ); - - if ( buffer[i] == 0x40 ) - j = -1; - else if ( buffer[i] == 0x41 ) - j = -2; - else if ( 0xB0 <= buffer[i] && buffer[i] <= 0xB7 ) - j = buffer[i] - 0xAF; - else if ( 0xB8 <= buffer[i] && buffer[i] <= 0xBF ) - j = 2 * ( buffer[i] - 0xB7 ); - } - else - { - printf( "_%02x", (FT_UInt)buffer[i] ); - - if ( j == -1 ) - j = buffer[i]; - else if ( j == -2 ) - j = 2 * buffer[i]; - else - j--; - } - } - printf( "\n" ); - } - - - static void - Print_Programs( FT_Face face ) - { - FT_ULong length = 0; - FT_UShort i; - FT_Byte* buffer = NULL; - FT_Byte* offset = NULL; - - TT_Header* head; - TT_MaxProfile* maxp; - - - error = FT_Load_Sfnt_Table( face, TTAG_fpgm, 0, NULL, &length ); - if ( error || length == 0 ) - goto Prep; - - buffer = (FT_Byte*)malloc( length ); - if ( buffer == NULL ) - goto Exit; - - error = FT_Load_Sfnt_Table( face, TTAG_fpgm, 0, buffer, &length ); - if ( error ) - goto Exit; - - printf( "font program" ); - Print_Bytecode( buffer, (FT_UShort)length, (char*)"fpgm" ); - - Prep: - length = 0; - - error = FT_Load_Sfnt_Table( face, TTAG_prep, 0, NULL, &length ); - if ( error || length == 0 ) - goto Glyf; - - buffer = (FT_Byte*)realloc( buffer, length ); - if ( buffer == NULL ) - goto Exit; - - error = FT_Load_Sfnt_Table( face, TTAG_prep, 0, buffer, &length ); - if ( error ) - goto Exit; - - printf( "\ncontrol value program" ); - Print_Bytecode( buffer, (FT_UShort)length, (char*)"prep" ); - - Glyf: - length = 0; - - error = FT_Load_Sfnt_Table( face, TTAG_glyf, 0, NULL, &length ); - if ( error || length == 0 ) - goto Exit; - - buffer = (FT_Byte*)realloc( buffer, length ); - if ( buffer == NULL ) - goto Exit; - - error = FT_Load_Sfnt_Table( face, TTAG_glyf, 0, buffer, &length ); - if ( error ) - goto Exit; - - length = 0; - - error = FT_Load_Sfnt_Table( face, TTAG_loca, 0, NULL, &length ); - if ( error || length == 0 ) - goto Exit; - - offset = (FT_Byte*)malloc( length ); - if ( offset == NULL ) - goto Exit; - - error = FT_Load_Sfnt_Table( face, TTAG_loca, 0, offset, &length ); - if ( error ) - goto Exit; - - head = (TT_Header*)FT_Get_Sfnt_Table( face, FT_SFNT_HEAD ); - maxp = (TT_MaxProfile*)FT_Get_Sfnt_Table( face, FT_SFNT_MAXP ); - - for ( i = 0; i < maxp->numGlyphs; i++ ) - { - FT_UInt32 loc; - FT_UInt16 len; - char tag[5]; - - - if ( head->Index_To_Loc_Format ) - loc = (FT_UInt32)offset[4 * i ] << 24 | - (FT_UInt32)offset[4 * i + 1] << 16 | - (FT_UInt32)offset[4 * i + 2] << 8 | - (FT_UInt32)offset[4 * i + 3]; - else - loc = (FT_UInt32)offset[2 * i ] << 9 | - (FT_UInt32)offset[2 * i + 1] << 1; - - len = (FT_UInt16)( buffer[loc] << 8 | buffer[loc + 1] ); - - loc += 10; - - if ( (FT_Int16)len < 0 ) /* composite */ - { - FT_UShort flags; - - - do - { - flags = (FT_UInt16)( buffer[loc] << 8 | buffer[loc + 1] ); - - loc += 4; - - loc += flags & FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ? 4 : 2; - - loc += flags & FT_SUBGLYPH_FLAG_SCALE ? 2 - : flags & FT_SUBGLYPH_FLAG_XY_SCALE ? 4 - : flags & FT_SUBGLYPH_FLAG_2X2 ? 8 : 0; - } while ( flags & 0x20 ); /* more components */ - - if ( ( flags & 0x100 ) == 0 ) - continue; - } - else - loc += 2 * len; - - len = (FT_UInt16)( buffer[loc] << 8 | buffer[loc + 1] ); - - if ( len == 0 ) - continue; - - loc += 2; - - sprintf( tag, "%04hx", i ); - printf("\nglyf program %hd (%.4s)", i, tag ); - Print_Bytecode( buffer + loc, len, tag ); - } - - Exit: - free( buffer ); - free( offset ); - } - - - int - main( int argc, - char* argv[] ) - { - int i, file; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - int num_faces; - int option; - - FT_Library library; /* the FreeType library */ - FT_Face face; /* the font face */ - - - execname = ft_basename( argv[0] ); - - /* Initialize engine */ - error = FT_Init_FreeType( &library ); - if ( error ) - PanicZ( "Could not initialize FreeType library" ); - - while ( 1 ) - { - option = getopt( argc, argv, "npuvV" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'n': - name_tables = 1; - break; - - case 'p': - bytecode = 1; - break; - - case 'u': - utf8 = 1; - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( library, &major, &minor, &patch ); - - printf( "ftdump (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - case 'V': - verbose = 1; - break; - - default: - usage( execname ); - break; - } - } - - argc -= optind; - argv += optind; - - if ( argc != 1 ) - usage( execname ); - - file = 0; - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, argv[file], 1024 ); - strncpy( alt_filename, argv[file], 1024 ); - - /* try to load the file name as is, first */ - error = FT_New_Face( library, argv[file], 0, &face ); - if ( !error ) - goto Success; - -#ifndef macintosh - i = (int)strlen( argv[file] ); - while ( i > 0 && argv[file][i] != '\\' && argv[file][i] != '/' ) - { - if ( argv[file][i] == '.' ) - i = 0; - i--; - } - - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } -#endif - - /* Load face */ - error = FT_New_Face( library, filename, 0, &face ); - if ( error ) - PanicZ( "Could not open face." ); - - Success: - num_faces = face->num_faces; - FT_Done_Face( face ); - - printf( "There %s %d %s in this file.\n", - num_faces == 1 ? (char *)"is" : (char *)"are", - num_faces, - num_faces == 1 ? (char *)"face" : (char *)"faces" ); - - for ( i = 0; i < num_faces; i++ ) - { - error = FT_New_Face( library, filename, i, &face ); - if ( error ) - PanicZ( "Could not open face." ); - - printf( "\n----- Face number: %d -----\n\n", i ); - Print_Name( face ); - printf( "\n" ); - Print_Type( face ); - - printf( " glyph count: %ld\n", face->num_glyphs ); - - if ( name_tables && FT_IS_SFNT( face ) ) - { - printf( "\n" ); - Print_Sfnt_Names( face ); - } - - if ( bytecode && FT_IS_SFNT( face ) ) - { - printf( "\n" ); - Print_Programs( face ); - } - - if ( face->num_fixed_sizes ) - { - printf( "\n" ); - Print_Fixed( face ); - } - - if ( face->num_charmaps ) - { - printf( "\n" ); - Print_Charmaps( face ); - } - - if ( FT_HAS_MULTIPLE_MASTERS( face ) ) - { - printf( "\n" ); - Print_MM_Axes( face ); - } - - FT_Done_Face( face ); - } - - FT_Done_FreeType( library ); - - exit( 0 ); /* for safety reasons */ - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftgamma.1 freetype-2.8/=unpacked-tar1=/src/ftgamma.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftgamma.1 2016-12-30 20:32:34.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftgamma.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -.TH FTGAMMA 1 "December 2016" "FreeType 2.7.1" -. -. -.SH NAME -. -ftgamma \- screen gamma calibration helper -. -. -.SH SYNOPSIS -. -.B ftgamma -. -. -.SH DESCRIPTION -. -The -.B ftgamma -demo program opens a window showing series of grey stripes filled with -solid color and checkered pattern of pixels. Your monitor's gamma value -roughly corresponds to the horizontal position where the solid and checkered -stripes are equally bright when seen from some distance. Three brightness -targets are explored: 33%, 50%, and 67%. If the input-output curve of your -monitor does not follow ideal power law relationship, you might observe -slightly different gamma values at different brightness levels. It is also -possible to examine gamma values for basic colors. -. -.PP -An alternative pattern of slightly slanted anti-aliased lines is provided -to calibrate gamma for uniform perceived thickness of the lines. The gamma -value that corresponds to vanishing moiré pattern is ideal for anti-aliased -font rendering. -. -.PP -This program does not have any options. -. -.PP -This program is part of the FreeType demos package. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftgamma.c freetype-2.8/=unpacked-tar1=/src/ftgamma.c --- freetype-2.7.1/=unpacked-tar1=/src/ftgamma.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftgamma.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,406 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2004-2016 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* ftgamma - gamma matcher */ -/* */ -/****************************************************************************/ - - -#include "ftcommon.h" -#include - - - static FTDemo_Display* display; - - static grBitmap bit1 = { 300, 600, 600, gr_pixel_mode_gray, 256, NULL }; - static grBitmap bit2 = { 300, 600, 600, gr_pixel_mode_gray, 256, NULL }; - static grBitmap* bit; - - - static void - do_ptrn( grBitmap* bitmap, - int x, - int y, - int w, - int h ) - { - int pitch = bitmap->pitch; - int i, j, k; - double p[4]; - - unsigned char* line; - - for ( i = 0; i < h; i++ ) - { - for ( k = 0; k < 4; k++) - { - j = 2 * i + 1 + ( k - 4 ) * h / 2; - if ( j > h ) - j -= 2 * h; - if ( j < -h ) - j += 2 * h; - if ( j < 0 ) - j = -j; - j -= h / 4; - if ( j < 0 ) - j = 0; - if ( j > h / 2 ) - j = h / 2; - - p[k] = 2. * j / h; - } - - line = bitmap->buffer + ( y + i ) * pitch + x; - for ( j = 0, k = 0; j < w; j++ ) - { - line[j] = (unsigned char)( 0.5 + - 255. * pow ( p[k], - 1. / (1. + 2. * j / w ) ) ); - k++; - if ( k == 4 ) - k = 0; - } - } - } - - - static FT_Error - GammaPtrn( grBitmap* bitmap ) - { - int x = 0; - int y = 0; - int h = ( bitmap->rows - 2 * y ) / 3; - int w = bitmap->width - 2 * x; - - - do_ptrn( bitmap, x, y, w, h ); - do_ptrn( bitmap, x, y+=h, w, h ); - do_ptrn( bitmap, x, y+=h, w, h ); - - return 0; - } - - - static void - do_fill( grBitmap* bitmap, - int x, - int y, - int w, - int h, - int back, - int fore ) - { - int pitch = bitmap->pitch; - int i; - double b, f; - - unsigned char* line = bitmap->buffer + y*pitch + x; - - - if ( back == 0 || back == 255 ) - for ( i = 0; i < w; i++ ) - line[i + ( i & 1 ) * pitch] = (unsigned char)back; - else - for ( b = back / 255., i = 0; i < w; i++ ) - line[i + ( i & 1 ) * pitch] = - (unsigned char)( 0.5 + 255. * pow ( b, 1. / (1. + 2. * i / w ) ) ); - - if ( fore == 0 || fore == 255 ) - for ( i = 0; i < w; i++ ) - line[i + ( ~i & 1 ) * pitch] = (unsigned char)fore; - else - for ( f = fore / 255., i = 0; i < w; i++ ) - line[i + ( ~i & 1 ) * pitch] = - (unsigned char)( 0.5 + 255. * pow ( f, 1. / (1. + 2. * i / w ) ) ); - - for ( i = 2; i < h; i += 2 ) - { - memcpy( line + i * pitch, line, (size_t)w ); - memcpy( line + i * pitch + pitch, line + pitch, (size_t)w ); - } - } - - - static FT_Error - GammaGrid( grBitmap* bitmap ) - { - int x = 0; - int y = 0; - int h = ( bitmap->rows - 2 * y ) / 15; - int w = bitmap->width - 2 * x; - - - do_fill( bitmap, x, y, w, h, 85, 255 ); - do_fill( bitmap, x, y+=h, w, h, 170, 170 ); - do_fill( bitmap, x, y+=h, w, h, 85, 255 ); - do_fill( bitmap, x, y+=h, w, h, 170, 170 ); - do_fill( bitmap, x, y+=h, w, h, 85, 255 ); - - do_fill( bitmap, x, y+=h, w, h, 0, 255 ); - do_fill( bitmap, x, y+=h, w, h, 127, 127 ); - do_fill( bitmap, x, y+=h, w, h, 0, 255 ); - do_fill( bitmap, x, y+=h, w, h, 127, 127 ); - do_fill( bitmap, x, y+=h, w, h, 0, 255 ); - - do_fill( bitmap, x, y+=h, w, h, 0, 170 ); - do_fill( bitmap, x, y+=h, w, h, 85, 85 ); - do_fill( bitmap, x, y+=h, w, h, 0, 170 ); - do_fill( bitmap, x, y+=h, w, h, 85, 85 ); - do_fill( bitmap, x, y+=h, w, h, 0, 170 ); - - return 0; - } - - - static void - event_help( void ) - { - grEvent dummy_event; - - - FTDemo_Display_Clear( display ); - grSetLineHeight( 10 ); - grGotoxy( 0, 0 ); - grSetMargin( 2, 1 ); - grGotobitmap( display->bitmap ); - - - grWriteln( "FreeType Gamma Matcher" ); - grLn(); - grWriteln( "Use the following keys:" ); - grLn(); - grWriteln( "F1, ? display this help screen" ); - grLn(); - grWriteln( "space cycle through color"); - grWriteln( "tab alternate pattern"); - grWriteln( "G show gamma ramp" ); - grLn(); - grLn(); - grWriteln( "press any key to exit this help screen" ); - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, gr_event_key, &dummy_event ); - } - - - static void - event_color_change( void ) - { - static int i = 7; - unsigned char r = i & 4 ? 0xff : 0; - unsigned char g = i & 2 ? 0xff : 0; - unsigned char b = i & 1 ? 0xff : 0; - - - display->back_color = grFindColor( display->bitmap, 0, 0, 0, 0xff ); - display->fore_color = grFindColor( display->bitmap, r, g, b, 0xff ); - - i++; - if ( ( i & 0x7 ) == 0 ) - i = 1; - } - - - static void - event_gamma_grid( void ) - { - grEvent dummy_event; - int g; - int yside = 11; - int xside = 10; - int levels = 17; - int gammas = 30; - int x_0 = ( display->bitmap->width - levels * xside ) / 2; - int y_0 = ( display->bitmap->rows - gammas * ( yside + 1 ) ) / 2; - int pitch = display->bitmap->pitch; - - - FTDemo_Display_Clear( display ); - grGotobitmap( display->bitmap ); - - if ( pitch < 0 ) - pitch = -pitch; - - memset( display->bitmap->buffer, - 100, - (unsigned int)( pitch * display->bitmap->rows ) ); - - grWriteCellString( display->bitmap, 0, 0, "Gamma grid", - display->fore_color ); - - - for ( g = 1; g <= gammas; g++ ) - { - double ggamma = 0.1 * g; - char temp[6]; - int y = y_0 + ( yside + 1 ) * ( g - 1 ); - int nx, ny; - - unsigned char* line = display->bitmap->buffer + - y * display->bitmap->pitch; - - - if ( display->bitmap->pitch < 0 ) - line -= display->bitmap->pitch * ( display->bitmap->rows - 1 ); - - line += x_0 * 3; - - grSetPixelMargin( x_0 - 32, y + ( yside - 8 ) / 2 ); - grGotoxy( 0, 0 ); - - sprintf( temp, "%.1f", ggamma ); - grWrite( temp ); - - for ( ny = 0; ny < yside; ny++, line += display->bitmap->pitch ) - { - unsigned char* dst = line; - - - for ( nx = 0; nx < levels; nx++, dst += 3 * xside ) - { - double p = nx / (double)( levels - 1 ); - int gm = (int)( 255.0 * pow( p, ggamma ) + 0.5 ); - - - memset( dst, gm, (unsigned int)( xside * 3 ) ); - } - } - } - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, gr_event_key, &dummy_event ); - } - - - static void - Render_Bitmap( grBitmap* out, - grBitmap* in, - int x, - int y, - grColor color ) - { - int pitch = out->pitch; - int i, j; - - unsigned char* src; - unsigned char* dst; - - - if ( color.chroma[0] == 255 ) - for ( src = in->buffer, i = 0; i < in->rows; i++ ) - { - dst = out->buffer + ( y + i ) * pitch + 3 * x; - for ( j = 0; j < in->width; j++, src++, dst += 3 ) - *dst = *src; - } - - if ( color.chroma[1] == 255 ) - for ( src = in->buffer, i = 0; i < in->rows; i++ ) - { - dst = out->buffer + ( y + i ) * pitch + 3 * x + 1; - for ( j = 0; j < in->width; j++, src++, dst += 3 ) - *dst = *src; - } - - if ( color.chroma[2] == 255 ) - for ( src = in->buffer, i = 0; i < in->rows; i++ ) - { - dst = out->buffer + ( y + i ) * pitch + 3 * x + 2; - for ( j = 0; j < in->width; j++, src++, dst += 3 ) - *dst = *src; - } - } - - - static int - Process_Event( grEvent* event ) - { - int ret = 0; - - switch ( event->key ) - { - case grKeyEsc: - case grKEY( 'q' ): - ret = 1; - break; - - case grKeyF1: - case grKEY( '?' ): - event_help(); - break; - - case grKeySpace: - event_color_change(); - break; - - case grKeyTab: - bit = bit == &bit1 ? &bit2 - : &bit1; - break; - - case grKEY( 'G' ): - event_gamma_grid(); - break; - - default: - break; - } - - return ret; - } - - - int - main( void ) - { - grEvent event; - char buf[4]; - int i; - - display = FTDemo_Display_New( gr_pixel_mode_rgb24, DIM_X, DIM_Y ); - if ( !display ) - { - PanicZ( "could not allocate display surface" ); - } - - grSetTitle( display->surface, "FreeType Gamma Matcher - press ? for help" ); - - grNewBitmap( bit1.mode, bit1.grays, bit1.width, bit1.rows, &bit1 ); - GammaGrid( &bit1 ); - - grNewBitmap( bit2.mode, bit2.grays, bit2.width, bit2.rows, &bit2 ); - GammaPtrn( &bit2 ); - - bit = &bit1; - event_color_change(); - - do - { - FTDemo_Display_Clear( display ); - - Render_Bitmap( display->bitmap, bit, 20, 90, display->fore_color ); - - for ( i = 0; i <= 10; i++ ) - { - sprintf( buf, "%.1f", 1. + .2 * i ); - grWriteCellString( display->bitmap, 9 + i * 60, 395, buf, - display->fore_color ); - } - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, 0, &event ); - } while ( Process_Event( &event ) == 0 ); - - FTDemo_Display_Done( display ); - - exit( 0 ); /* for safety reasons */ - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftgrid.1 freetype-2.8/=unpacked-tar1=/src/ftgrid.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftgrid.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftgrid.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -.TH FTGRID 1 "December 2016" "Freetype 2.7.1" -. -. -.SH NAME -. -ftgrid \- simple glyph grid viewer -. -. -.SH SYNOPSIS -. -.B ftgrid -.RI [ options ] -.I pt font .\|.\|. -. -. -.SH DESCRIPTION -. -.B ftgrid -displays the glyphs of a font as outlines right before the conversion -from outlines to pixels take place. -It also displays the resulting bitmap. -It is possible to interactively change hinting and rendering options, -thus visualizing the applied distortions to the outlines. -. -.TP -.B pt -The point size for the given resolution. -If resolution is 72dpi, this directly gives the ppem value (pixels per EM). -. -.TP -.B font -The font file(s) to display. -For Type 1 font files, -.B ftgrid -also tries to attach the corresponding metrics file (with extension `.afm' -or `.pfm'). -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI \-w \ w -Set the window width to -.I w -pixels (default: 640px). -. -.TP -.BI \-h \ h -Set the window height to -.I h -pixels (default: 480px). -. -.TP -.BI \-r \ r -Use resolution -.I r -dpi (default: 72dpi). -. -.TP -.BI \-f \ index -Specify first index to display (default: 0). -. -.TP -.BI "\-d\ \(dq" "axis1\ axis2\ .\|.\|." \(dq -For Multiple Master or GX fonts, specify design coordinates for each axis at -start-up. -If this option is given, no named instances are shown. -Ignored for all other font formats. -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftgrid.c freetype-2.8/=unpacked-tar1=/src/ftgrid.c --- freetype-2.7.1/=unpacked-tar1=/src/ftgrid.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftgrid.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2040 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000, 2003-2007, 2009-2014 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* FTGrid - a simple viewer to show glyph outlines on a grid */ -/* */ -/* Press ? when running this program to have a list of key-bindings */ -/* */ -/****************************************************************************/ - - -#include "ftcommon.h" -#include "common.h" -#include "output.h" -#include "mlgetopt.h" -#include - - /* the following header shouldn't be used in normal programs */ -#include FT_INTERNAL_DEBUG_H - - /* showing driver name */ -#include FT_MODULE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DRIVER_H - -#include FT_STROKER_H -#include FT_SYNTHESIS_H -#include FT_LCD_FILTER_H -#include FT_CFF_DRIVER_H -#include FT_TRUETYPE_DRIVER_H -#include FT_MULTIPLE_MASTERS_H -#include FT_SFNT_NAMES_H -#include FT_TRUETYPE_IDS_H -#include FT_TRIGONOMETRY_H - -#define MAXPTSIZE 500 /* dtp */ -#define MAX_MM_AXES 32 - -#ifdef _WIN32 -#define snprintf _snprintf -#endif - -#define N_CFF_HINTING_ENGINES 2 - - -#ifdef FT_DEBUG_AUTOFIT - /* these variables, structures, and declarations are for */ - /* communication with the debugger in the autofit module; */ - /* normal programs don't need this */ - struct AF_GlyphHintsRec_; - typedef struct AF_GlyphHintsRec_* AF_GlyphHints; - - extern int _af_debug_disable_horz_hints; - extern int _af_debug_disable_vert_hints; - extern int _af_debug_disable_blue_hints; - extern AF_GlyphHints _af_debug_hints; - -#ifdef __cplusplus - extern "C" { -#endif - extern void - af_glyph_hints_dump_segments( AF_GlyphHints hints, - FT_Bool to_stdout ); - extern void - af_glyph_hints_dump_points( AF_GlyphHints hints, - FT_Bool to_stdout ); - extern void - af_glyph_hints_dump_edges( AF_GlyphHints hints, - FT_Bool to_stdout ); - extern FT_Error - af_glyph_hints_get_num_segments( AF_GlyphHints hints, - FT_Int dimension, - FT_Int* num_segments ); - extern FT_Error - af_glyph_hints_get_segment_offset( AF_GlyphHints hints, - FT_Int dimension, - FT_Int idx, - FT_Pos *offset, - FT_Bool *is_blue, - FT_Pos *blue_offset ); -#ifdef __cplusplus - } -#endif - -#endif /* FT_DEBUG_AUTOFIT */ - - -#define BUFSIZE 256 - -#define DO_BITMAP 1 -#define DO_OUTLINE 2 -#define DO_DOTS 4 -#define DO_DOTNUMBERS 8 - - typedef struct GridStatusRec_ - { - int width; - int height; - - int ptsize; - int res; - int Num; /* glyph index */ - int font_index; - - FT_F26Dot6 scale; - int x_origin; - int y_origin; - - FT_F26Dot6 scale_0; - int x_origin_0; - int y_origin_0; - - int disp_width; - int disp_height; - grBitmap* disp_bitmap; - - grColor axis_color; - grColor grid_color; - grColor outline_color; - grColor on_color; - grColor off_color; - grColor segment_color; - grColor blue_color; - - int work; - int do_horz_hints; - int do_vert_hints; - int do_blue_hints; - int do_segment; - - FT_LcdFilter lcd_filter; - double gamma; - const char* header; - char header_buffer[BUFSIZE]; - - FT_Stroker stroker; - - unsigned int cff_hinting_engine; - unsigned int tt_interpreter_versions[3]; - int num_tt_interpreter_versions; - int tt_interpreter_version_idx; - FT_Bool warping; - - FT_MM_Var* mm; - char* axis_name[MAX_MM_AXES]; - FT_Fixed design_pos[MAX_MM_AXES]; - FT_Fixed requested_pos[MAX_MM_AXES]; - FT_UInt requested_cnt; - FT_UInt current_axis; - FT_UInt used_num_axis; - - } GridStatusRec, *GridStatus; - - static GridStatusRec status; - - - static void - grid_status_init( GridStatus st ) - { - st->width = DIM_X; - st->height = DIM_Y; - - st->scale = 64; - st->x_origin = 0; - st->y_origin = 0; - - st->work = DO_BITMAP | DO_OUTLINE | DO_DOTS; - st->do_horz_hints = 1; - st->do_vert_hints = 1; - st->do_blue_hints = 1; - st->do_segment = 0; - - st->Num = 0; - st->lcd_filter = FT_LCD_FILTER_DEFAULT; - st->gamma = GAMMA; - st->header = NULL; - - st->mm = NULL; - st->current_axis = 0; - } - - - static void - grid_status_display( GridStatus st, - FTDemo_Display* display ) - { - st->disp_width = display->bitmap->width; - st->disp_height = display->bitmap->rows; - st->disp_bitmap = display->bitmap; - - st->axis_color = grFindColor( display->bitmap, 0, 0, 0, 255 ); /* black */ - st->grid_color = grFindColor( display->bitmap, 192, 192, 192, 255 ); /* gray */ - st->outline_color = grFindColor( display->bitmap, 255, 0, 0, 255 ); /* red */ - st->on_color = grFindColor( display->bitmap, 255, 0, 0, 255 ); /* red */ - st->off_color = grFindColor( display->bitmap, 0, 128, 0, 255 ); /* dark green */ - st->segment_color = grFindColor( display->bitmap, 64, 255, 128, 64 ); /* light green */ - st->blue_color = grFindColor( display->bitmap, 64, 64, 255, 64 ); /* light blue */ - } - - - static void - grid_status_rescale_initial( GridStatus st, - FTDemo_Handle* handle ) - { - FT_Size size; - FT_Error err = FTDemo_Get_Size( handle, &size ); - FT_F26Dot6 margin = 4; - - - if ( !err ) - { - FT_Face face = size->face; - - int xmin = FT_MulFix( face->bbox.xMin, size->metrics.x_scale ); - int ymin = FT_MulFix( face->bbox.yMin, size->metrics.y_scale ); - int xmax = FT_MulFix( face->bbox.xMax, size->metrics.x_scale ); - int ymax = FT_MulFix( face->bbox.yMax, size->metrics.y_scale ); - - FT_F26Dot6 x_scale, y_scale; - - - xmin &= ~63; - ymin &= ~63; - xmax = ( xmax + 63 ) & ~63; - ymax = ( ymax + 63 ) & ~63; - - if ( xmax - xmin ) - x_scale = st->disp_width * ( 64 - 2 * margin ) / ( xmax - xmin ); - else - x_scale = 64; - - if ( ymax - ymin ) - y_scale = st->disp_height * ( 64 - 2 * margin ) / ( ymax - ymin ); - else - y_scale = 64; - - if ( x_scale <= y_scale ) - st->scale = x_scale; - else - st->scale = y_scale; - - st->x_origin = st->disp_width * margin - xmin * st->scale; - st->y_origin = st->disp_height * ( 64 - margin ) + ymin * st->scale; - } - else - { - st->scale = 64; - st->x_origin = st->disp_width * margin; - st->y_origin = st->disp_height * ( 64 - margin ); - } - - st->x_origin >>= 6; - st->y_origin >>= 6; - - st->scale_0 = st->scale; - st->x_origin_0 = st->x_origin; - st->y_origin_0 = st->y_origin; - } - - - static void - grid_status_draw_grid( GridStatus st ) - { - int x_org = st->x_origin; - int y_org = st->y_origin; - FT_F26Dot6 xy_incr = st->scale; - - - if ( xy_incr >= 2 ) - { - int x2 = x_org; - int y2 = y_org; - - - for ( ; x2 < st->disp_width; x2 += xy_incr ) - grFillVLine( st->disp_bitmap, x2, 0, - st->disp_height, st->grid_color ); - - for ( x2 = x_org - xy_incr; x2 >= 0; x2 -= xy_incr ) - grFillVLine( st->disp_bitmap, x2, 0, - st->disp_height, st->grid_color ); - - for ( ; y2 < st->disp_height; y2 += xy_incr ) - grFillHLine( st->disp_bitmap, 0, y2, - st->disp_width, st->grid_color ); - - for ( y2 = y_org - xy_incr; y2 >= 0; y2 -= xy_incr ) - grFillHLine( st->disp_bitmap, 0, y2, - st->disp_width, st->grid_color ); - } - - grFillVLine( st->disp_bitmap, x_org, 0, - st->disp_height, st->axis_color ); - grFillHLine( st->disp_bitmap, 0, y_org, - st->disp_width, st->axis_color ); - } - - -#ifdef FT_DEBUG_AUTOFIT - - static void - grid_hint_draw_segment( GridStatus st, - AF_GlyphHints hints ) - { - FT_Int dimension; - int x_org = st->x_origin; - int y_org = st->y_origin; - - - for ( dimension = 1; dimension >= 0; dimension-- ) - { - FT_Int num_seg; - FT_Int count; - - - af_glyph_hints_get_num_segments( hints, dimension, &num_seg ); - - for ( count = 0; count < num_seg; count++ ) - { - int pos; - FT_Pos offset; - FT_Bool is_blue; - FT_Pos blue_offset; - - - af_glyph_hints_get_segment_offset( hints, dimension, - count, &offset, - &is_blue, &blue_offset); - - if ( dimension == 0 ) /* AF_DIMENSION_HORZ is 0 */ - { - pos = x_org + ( ( offset * st->scale ) >> 6 ); - grFillVLine( st->disp_bitmap, pos, 0, - st->disp_height, st->segment_color ); - } - else - { - pos = y_org - ( ( offset * st->scale ) >> 6 ); - - if ( is_blue ) - { - int blue_pos = y_org - ( ( blue_offset * st->scale ) >> 6 ); - - - if ( blue_pos == pos ) - grFillHLine( st->disp_bitmap, 0, blue_pos, - st->disp_width, st->blue_color ); - else - { - grFillHLine( st->disp_bitmap, 0, blue_pos, - st->disp_width, st->blue_color ); - grFillHLine( st->disp_bitmap, 0, pos, - st->disp_width, st->segment_color ); - } - } - else - grFillHLine( st->disp_bitmap, 0, pos, - st->disp_width, st->segment_color ); - } - } - } - } - -#endif /* FT_DEBUG_AUTOFIT */ - - - static void - ft_bitmap_draw( FT_Bitmap* bitmap, - int x, - int y, - FTDemo_Display* display, - grColor color ) - { - grBitmap gbit; - - - gbit.width = (int)bitmap->width; - gbit.rows = (int)bitmap->rows; - gbit.pitch = bitmap->pitch; - gbit.buffer = bitmap->buffer; - - switch ( bitmap->pixel_mode ) - { - case FT_PIXEL_MODE_GRAY: - gbit.mode = gr_pixel_mode_gray; - gbit.grays = 256; - break; - - case FT_PIXEL_MODE_MONO: - gbit.mode = gr_pixel_mode_mono; - gbit.grays = 2; - break; - - case FT_PIXEL_MODE_LCD: - gbit.mode = gr_pixel_mode_lcd; - gbit.grays = 256; - break; - - case FT_PIXEL_MODE_LCD_V: - gbit.mode = gr_pixel_mode_lcdv; - gbit.grays = 256; - break; - - default: - return; - } - - grBlitGlyphToBitmap( display->bitmap, &gbit, x, y, color ); - } - - - static void - ft_outline_draw( FT_Outline* outline, - double scale, - int pen_x, - int pen_y, - FTDemo_Handle* handle, - FTDemo_Display* display, - grColor color ) - { - FT_Outline transformed; - FT_BBox cbox; - FT_Bitmap bitm; - - - FT_Outline_New( handle->library, - (FT_UInt)outline->n_points, - outline->n_contours, - &transformed ); - - FT_Outline_Copy( outline, &transformed ); - - if ( scale != 1. ) - { - int nn; - - - for ( nn = 0; nn < transformed.n_points; nn++ ) - { - FT_Vector* vec = &transformed.points[nn]; - - - vec->x = (FT_F26Dot6)( vec->x * scale ); - vec->y = (FT_F26Dot6)( vec->y * scale ); - } - } - - FT_Outline_Get_CBox( &transformed, &cbox ); - cbox.xMin &= ~63; - cbox.yMin &= ~63; - cbox.xMax = ( cbox.xMax + 63 ) & ~63; - cbox.yMax = ( cbox.yMax + 63 ) & ~63; - - bitm.width = (unsigned int)( ( cbox.xMax - cbox.xMin ) >> 6 ); - bitm.rows = (unsigned int)( ( cbox.yMax - cbox.yMin ) >> 6 ); - bitm.pitch = (int)bitm.width; - bitm.num_grays = 256; - bitm.pixel_mode = FT_PIXEL_MODE_GRAY; - bitm.buffer = (unsigned char*)calloc( (unsigned int)bitm.pitch, - bitm.rows ); - - FT_Outline_Translate( &transformed, -cbox.xMin, -cbox.yMin ); - FT_Outline_Get_Bitmap( handle->library, &transformed, &bitm ); - - ft_bitmap_draw( &bitm, - pen_x + ( cbox.xMin >> 6 ), - pen_y - ( cbox.yMax >> 6 ), - display, - color ); - - free( bitm.buffer ); - FT_Outline_Done( handle->library, &transformed ); - } - - - static void - ft_outline_new_circle( FT_Outline* outline, - FT_F26Dot6 radius, - FTDemo_Handle* handle ) - { - char* tag; - FT_Vector* vec; - FT_F26Dot6 disp = (FT_F26Dot6)( radius * 0.5523 ); - /* so that Bézier curve touches circle at 0, 45, and 90 degrees */ - - - FT_Outline_New( handle->library, 12, 1, outline ); - outline->n_points = 12; - outline->n_contours = 1; - outline->contours[0] = outline->n_points - 1; - - vec = outline->points; - tag = outline->tags; - - vec->x = radius; vec->y = 0; vec++; *tag++ = FT_CURVE_TAG_ON; - vec->x = radius; vec->y = disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = disp; vec->y = radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = 0; vec->y = radius; vec++; *tag++ = FT_CURVE_TAG_ON; - vec->x = -disp; vec->y = radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = -radius; vec->y = disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = -radius; vec->y = 0; vec++; *tag++ = FT_CURVE_TAG_ON; - vec->x = -radius; vec->y = -disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = -disp; vec->y = -radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = 0; vec->y = -radius; vec++; *tag++ = FT_CURVE_TAG_ON; - vec->x = disp; vec->y = -radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - vec->x = radius; vec->y = -disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; - } - - - static void - circle_draw( FT_F26Dot6 center_x, - FT_F26Dot6 center_y, - FT_F26Dot6 radius, - FTDemo_Handle* handle, - FTDemo_Display* display, - grColor color ) - { - FT_Outline outline; - - - ft_outline_new_circle( &outline, radius, handle ); - /* subpixel adjustment considering downward direction of y-axis */ - FT_Outline_Translate( &outline, center_x & 63, -( center_y & 63 ) ); - - ft_outline_draw( &outline, 1., ( center_x >> 6 ), ( center_y >> 6 ), - handle, display, color ); - - FT_Outline_Done( handle->library, &outline ); - } - - - static void - bitmap_scale( grBitmap* bit, - FT_F26Dot6 scale ) - { - unsigned char* s = bit->buffer; - unsigned char* t; - unsigned char* line; - int pitch; - int i, j, k; - - pitch = bit->pitch > 0 ? bit->pitch - : -bit->pitch; - - t = (unsigned char*)malloc( (size_t)( pitch * bit->rows * - scale * scale ) ); - if ( !t ) - return; - - line = t; - - switch( bit->mode ) - { - case gr_pixel_mode_mono: - for ( i = 0; i < bit->rows; i++ ) - { - for ( j = 0; j < pitch * scale * 8; j++ ) - if ( s[i * pitch + j / scale / 8] & ( 0x80 >> ( j / scale & 7 ) ) ) - line[j / 8] |= 0x80 >> ( j & 7 ); - else - line[j / 8] &= ~( 0x80 >> ( j & 7 ) ); - - for ( k = 1; k < scale; k++, line += pitch * scale ) - memcpy( line + pitch * scale, line, (size_t)( pitch * scale ) ); - line += pitch * scale; - } - break; - - case gr_pixel_mode_gray: - for ( i = 0; i < bit->rows; i++ ) - { - for ( j = 0; j < pitch; j++ ) - memset( line + j * scale, s[i * pitch + j], (size_t)scale ); - - for ( k = 1; k < scale; k++, line += pitch * scale ) - memcpy( line + pitch * scale, line, (size_t)( pitch * scale ) ); - line += pitch * scale; - } - break; - - case gr_pixel_mode_lcd: - case gr_pixel_mode_lcd2: - for ( i = 0; i < bit->rows; i++ ) - { - for ( j = 0; j < pitch; j += 3 ) - for ( k = 0; k < scale; k++ ) - { - line[j * scale + 3 * k ] = s[i * pitch + j ]; - line[j * scale + 3 * k + 1] = s[i * pitch + j + 1]; - line[j * scale + 3 * k + 2] = s[i * pitch + j + 2]; - } - - for ( k = 1; k < scale; k++, line += pitch * scale ) - memcpy( line + pitch * scale, line, (size_t)( pitch * scale ) ); - line += pitch * scale; - } - break; - - case gr_pixel_mode_lcdv: - case gr_pixel_mode_lcdv2: - for ( i = 0; i < bit->rows; i += 3 ) - { - for ( j = 0; j < pitch; j++ ) - { - memset( line + j * scale, - s[i * pitch + j], (size_t)scale ); - memset( line + j * scale + pitch * scale, - s[i * pitch + pitch + j], (size_t)scale ); - memset( line + j * scale + 2 * pitch * scale, - s[i * pitch + 2 * pitch + j], (size_t)scale ); - } - - for ( k = 1; k < scale; k++, line += 3 * pitch * scale ) - memcpy( line + 3 * pitch * scale, - line, - (size_t)( 3 * pitch * scale ) ); - line += 3 * pitch * scale; - } - break; - - default: - return; - } - - bit->buffer = t; - bit->rows *= scale; - bit->width *= scale; - bit->pitch *= scale; - } - - - static void - grid_status_draw_outline( GridStatus st, - FTDemo_Handle* handle, - FTDemo_Display* display ) - { - FT_Size size; - FT_GlyphSlot slot; - FT_F26Dot6 scale = st->scale; - int ox = st->x_origin; - int oy = st->y_origin; - - - if ( st->stroker == NULL ) - { - FT_Stroker_New( handle->library, &st->stroker ); - - FT_Stroker_Set( st->stroker, 32, FT_STROKER_LINECAP_BUTT, - FT_STROKER_LINEJOIN_BEVEL, 0x20000 ); - } - - FTDemo_Get_Size( handle, &size ); - -#ifdef FT_DEBUG_AUTOFIT - /* Draw segment before drawing glyph. */ - if ( status.do_segment ) - { - /* Force hinting first in order to collect segment info. */ - _af_debug_disable_horz_hints = 0; - _af_debug_disable_vert_hints = 0; - - if ( !FT_Load_Glyph( size->face, (FT_UInt)st->Num, - FT_LOAD_DEFAULT | - FT_LOAD_NO_BITMAP | - FT_LOAD_FORCE_AUTOHINT | - FT_LOAD_TARGET_NORMAL ) ) - grid_hint_draw_segment( &status, _af_debug_hints ); - } - - _af_debug_disable_horz_hints = !st->do_horz_hints; - _af_debug_disable_vert_hints = !st->do_vert_hints; - _af_debug_disable_blue_hints = !st->do_blue_hints; -#endif - - if ( FT_Load_Glyph( size->face, (FT_UInt)st->Num, - handle->load_flags | FT_LOAD_NO_BITMAP ) ) - return; - - /* show advance width */ - grFillVLine( st->disp_bitmap, - st->x_origin + - ( size->face->glyph->metrics.horiAdvance * st->scale >> 6 ), - 0, - st->disp_height, - st->axis_color ); - - - slot = size->face->glyph; - if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - FT_Glyph glyph; - FT_Outline* gimage = &slot->outline; - int nn; - - - /* render scaled bitmap */ - if ( st->work & DO_BITMAP ) - { - int left, top, x_advance, y_advance; - grBitmap bitg; - FT_Glyph glyf; - - - FT_Get_Glyph( slot, &glyph ); - error = FTDemo_Glyph_To_Bitmap( handle, glyph, &bitg, &left, &top, - &x_advance, &y_advance, &glyf); - - if ( !error ) - { - bitmap_scale( &bitg, scale ); - - grBlitGlyphToBitmap( display->bitmap, &bitg, - ox + left * scale, oy - top * scale, - st->axis_color ); - - free( bitg.buffer ); - - if ( glyf ) - FT_Done_Glyph( glyf ); - } - - FT_Done_Glyph( glyph ); - } - - /* scale the outline */ - for ( nn = 0; nn < gimage->n_points; nn++ ) - { - FT_Vector* vec = &gimage->points[nn]; - - - /* half-pixel shift hints the stroked path */ - vec->x = vec->x * scale + 32; - vec->y = vec->y * scale - 32; - } - - /* stroke then draw it */ - if ( st->work & DO_OUTLINE ) - { - FT_Get_Glyph( slot, &glyph ); - FT_Glyph_Stroke( &glyph, st->stroker, 1 ); - - error = FTDemo_Draw_Glyph_Color( handle, display, glyph, &ox, &oy, - st->outline_color ); - if ( !error ) - FT_Done_Glyph( glyph ); - } - - /* draw the points... */ - if ( st->work & DO_DOTS ) - { - for ( nn = 0; nn < gimage->n_points; nn++ ) - circle_draw( - st->x_origin * 64 + gimage->points[nn].x, - st->y_origin * 64 - gimage->points[nn].y, - 128, - handle, - display, - ( gimage->tags[nn] & FT_CURVE_TAG_ON ) ? st->on_color - : st->off_color ); - } - - /* ... and point numbers */ - if ( st->work & DO_DOTNUMBERS ) - { - FT_Vector* points = gimage->points; - FT_Short* contours = gimage->contours; - char* tags = gimage->tags; - short c, n; - char number_string[10]; - size_t number_string_len = sizeof ( number_string ); - - FT_Long octant_x[8] = { 1024, 724, 0, -724, -1024, -724, 0, 724 }; - FT_Long octant_y[8] = { 0, 724, 1024, 724, 0, -724, -1024, -724 }; - - - c = 0; - n = 0; - for ( ; c < gimage->n_contours; c++ ) - { - for (;;) - { - short prev, next; - FT_Vector in, out, middle; - FT_Fixed in_len, out_len, middle_len; - int num_digits; - - - /* find previous and next point in outline */ - if ( c == 0 ) - { - if ( contours[c] == 0 ) - { - prev = 0; - next = 0; - } - else - { - prev = n > 0 ? n - 1 - : contours[c]; - next = n < contours[c] ? n + 1 - : 0; - } - } - else - { - prev = n > ( contours[c - 1] + 1 ) ? n - 1 - : contours[c]; - next = n < contours[c] ? n + 1 - : contours[c - 1] + 1; - } - - /* get vectors to previous and next point and normalize them; */ - /* we use 16.16 format to improve the computation precision */ - in.x = ( points[prev].x - points[n].x ) * 1024; - in.y = ( points[prev].y - points[n].y ) * 1024; - - out.x = ( points[next].x - points[n].x ) * 1024; - out.y = ( points[next].y - points[n].y ) * 1024; - - in_len = FT_Vector_Length( &in ); - out_len = FT_Vector_Length( &out ); - - if ( in_len ) - { - in.x = FT_DivFix( in.x, in_len ); - in.y = FT_DivFix( in.y, in_len ); - } - if ( out_len ) - { - out.x = FT_DivFix( out.x, out_len ); - out.y = FT_DivFix( out.y, out_len ); - } - - middle.x = in.x + out.x; - middle.y = in.y + out.y; - /* we use a delta of 1 << 13 (corresponding to 1/8px) */ - if ( ( middle.x < 4096 ) && ( middle.x > -4096 ) && - ( middle.y < 4096 ) && ( middle.y > -4096 ) ) - { - /* in case of vectors in almost exactly opposite directions, */ - /* use a vector orthogonal to them */ - middle.x = out.y; - middle.y = -out.x; - - if ( ( middle.x < 4096 ) && ( middle.x > -4096 ) && - ( middle.y < 4096 ) && ( middle.y > -4096 ) ) - { - /* use direction based on point index for the offset */ - /* if we still don't have a good value */ - middle.x = octant_x[n % 8]; - middle.y = octant_y[n % 8]; - } - } - - /* normalize `middle' vector (which is never zero) and */ - /* convert it back to 26.6 format, this time using a */ - /* length of 8 pixels to get some distance between the */ - /* point and the number */ - middle_len = FT_Vector_Length( &middle ); - middle.x = FT_DivFix( middle.x, middle_len ) >> 7; - middle.y = FT_DivFix( middle.y, middle_len ) >> 7; - - num_digits = snprintf( number_string, - number_string_len, - "%d", n ); - - /* we now position the point number in the opposite */ - /* direction of the `middle' vector, adding some offset */ - /* since the string drawing function expects the upper */ - /* left corner of the number string (the font size is 8x8 */ - /* pixels) */ - grWriteCellString( display->bitmap, - st->x_origin + - ( ( points[n].x - middle.x ) >> 6 ) - - ( middle.x > 0 ? ( num_digits - 1 ) * 8 + 2 - : 2 ), - st->y_origin - - ( ( ( points[n].y - middle.y ) >> 6 ) + - 8 / 2 ), - number_string, - ( tags[n] & FT_CURVE_TAG_ON ) - ? st->on_color - : st->off_color ); - - n++; - if ( n > contours[c] ) - break; - } - } - } - } - } - - - static FTDemo_Display* display; - static FTDemo_Handle* handle; - -#if 0 - static const unsigned char* Text = (unsigned char*) - "The quick brown fox jumps over the lazy dog 0123456789 " - "\342\352\356\373\364\344\353\357\366\374\377\340\371\351\350\347 " - "&#~\"\'(-`_^@)=+\260 ABCDEFGHIJKLMNOPQRSTUVWXYZ " - "$\243^\250*\265\371%!\247:/;.,?<>"; -#endif - - - static void - Fatal( const char* message ) - { - FTDemo_Display_Done( display ); - FTDemo_Done( handle ); - PanicZ( message ); - } - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** REST OF THE APPLICATION/PROGRAM *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - static void - event_help( void ) - { - char buf[BUFSIZE]; - char version[64]; - - const char* format; - FT_Int major, minor, patch; - - grEvent dummy_event; - - - FT_Library_Version( handle->library, &major, &minor, &patch ); - - format = patch ? "%d.%d.%d" : "%d.%d"; - sprintf( version, format, major, minor, patch ); - - FTDemo_Display_Clear( display ); - grSetLineHeight( 10 ); - grGotoxy( 0, 0 ); - grSetMargin( 2, 1 ); - grGotobitmap( display->bitmap ); - - sprintf( buf, - "FreeType Glyph Grid Viewer - part of the FreeType %s test suite", - version ); - - grWriteln( buf ); - grLn(); - grWriteln( "Use the following keys:" ); - grLn(); - /* |----------------------------------| |----------------------------------| */ -#ifdef FT_DEBUG_AUTOFIT - grWriteln( "F1, ? display this help screen if autohinting: " ); - grWriteln( " H toggle horiz. hinting " ); - grWriteln( "i, k move grid up/down V toggle vert. hinting " ); - grWriteln( "j, l move grid left/right B toggle blue zone hinting" ); - grWriteln( "PgUp, PgDn zoom in/out grid s toggle segment drawing " ); - grWriteln( "SPC reset zoom and position (unfitted, with blues) " ); - grWriteln( " 1 dump edge hints " ); - grWriteln( "p, n previous/next font 2 dump segment hints " ); - grWriteln( " 3 dump point hints " ); -#else - grWriteln( "F1, ? display this help screen i, k move grid up/down " ); - grWriteln( " j, l move grid left/right " ); - grWriteln( "p, n previous/next font PgUp, PgDn zoom in/out grid " ); - grWriteln( " SPC reset zoom and position " ); -#endif /* FT_DEBUG_AUTOFIT */ - grWriteln( "Up, Down adjust size by 0.5pt if not auto-hinting: " ); - grWriteln( " H cycle through hinting " ); - grWriteln( "Left, Right adjust index by 1 engines (if available) " ); - grWriteln( "F7, F8 adjust index by 10 if light auto-hinting: " ); - grWriteln( "F9, F10 adjust index by 100 w toggle warping " ); - grWriteln( "F11, F12 adjust index by 1000 (if available) " ); - grWriteln( " " ); - grWriteln( "h toggle hinting b toggle bitmap " ); - grWriteln( "f toggle forced auto- d toggle dot display " ); - grWriteln( " hinting (if hinting) o toggle outline display " ); - grWriteln( " D toggle dotnumber display" ); - grWriteln( "a toggle anti-aliasing " ); - grWriteln( "F5, F6 cycle through if Multiple Master or GX font: " ); - grWriteln( " anti-aliasing modes F2 cycle through axes " ); - grWriteln( "L cycle through LCD F3, F4 adjust current axis by " ); - grWriteln( " filters 1/50th of its range " ); - grWriteln( "g, v adjust gamma value " ); - grWriteln( " q, ESC quit ftgrid " ); - /* |----------------------------------| |----------------------------------| */ - grLn(); - grLn(); - grWriteln( "press any key to exit this help screen" ); - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, gr_event_key, &dummy_event ); - } - - - static void - event_cff_hinting_engine_change( int delta ) - { - int new_cff_hinting_engine = 0; - - - if ( delta ) - new_cff_hinting_engine = - ( (int)status.cff_hinting_engine + - delta + - N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; - - error = FT_Property_Set( handle->library, - "cff", - "hinting-engine", - &new_cff_hinting_engine ); - - if ( !error ) - { - /* Resetting the cache is perhaps a bit harsh, but I'm too */ - /* lazy to walk over all loaded fonts to check whether they */ - /* are of type CFF, then unloading them explicitly. */ - FTC_Manager_Reset( handle->cache_manager ); - status.cff_hinting_engine = (FT_UInt)new_cff_hinting_engine; - } - - sprintf( status.header_buffer, "CFF engine changed to %s", - status.cff_hinting_engine == FT_CFF_HINTING_FREETYPE - ? "FreeType" : "Adobe" ); - - status.header = (const char *)status.header_buffer; - } - - - static void - event_tt_interpreter_version_change( void ) - { - status.tt_interpreter_version_idx += 1; - status.tt_interpreter_version_idx %= status.num_tt_interpreter_versions; - - error = FT_Property_Set( handle->library, - "truetype", - "interpreter-version", - &status.tt_interpreter_versions[ - status.tt_interpreter_version_idx] ); - - if ( !error ) - { - /* Resetting the cache is perhaps a bit harsh, but I'm too */ - /* lazy to walk over all loaded fonts to check whether they */ - /* are of type TTF, then unloading them explicitly. */ - FTC_Manager_Reset( handle->cache_manager ); - } - - sprintf( status.header_buffer, - "TrueType engine changed to version %d", - status.tt_interpreter_versions[ - status.tt_interpreter_version_idx]); - - status.header = (const char *)status.header_buffer; - } - - - static void - event_warping_change( void ) - { - if ( handle->lcd_mode == LCD_MODE_LIGHT ) - { - FT_Bool new_warping_state = !status.warping; - - - error = FT_Property_Set( handle->library, - "autofitter", - "warping", - &new_warping_state ); - - if ( !error ) - { - /* Resetting the cache is perhaps a bit harsh, but I'm too */ - /* lazy to walk over all loaded fonts to check whether they */ - /* are auto-hinted, then unloading them explicitly. */ - FTC_Manager_Reset( handle->cache_manager ); - status.warping = new_warping_state; - } - - status.header = status.warping ? "warping enabled" - : "warping disabled"; - } - else - status.header = "need light anti-aliasing mode to toggle warping"; - } - - - static void - event_gamma_change( double delta ) - { - status.gamma += delta; - - if ( status.gamma > 3.0 ) - status.gamma = 3.0; - else if ( status.gamma < 0.0 ) - status.gamma = 0.0; - - grSetGlyphGamma( status.gamma ); - - if ( status.gamma == 0.0 ) - sprintf( status.header_buffer, "gamma changed to sRGB mode" ); - else - sprintf( status.header_buffer, "gamma changed to %.1f", status.gamma ); - - status.header = (const char *)status.header_buffer; - } - - - static void - event_grid_reset( GridStatus st ) - { - st->x_origin = st->x_origin_0; - st->y_origin = st->y_origin_0; - st->scale = st->scale_0; - } - - - static void - event_grid_translate( int dx, - int dy ) - { - status.x_origin += 32 * dx; - status.y_origin += 32 * dy; - } - - - static void - event_grid_zoom( double zoom ) - { - FT_F26Dot6 scale_old = status.scale; - - - status.scale *= zoom; - - /* avoid same zoom value due to truncation */ - /* to integer in above multiplication */ - if ( status.scale == scale_old && zoom > 1.0 ) - status.scale++; - - sprintf( status.header_buffer, "zoom level %.0f%%", - status.scale * 100.0 / status.scale_0 ); - - status.header = (const char *)status.header_buffer; - } - - - static void - event_lcd_mode_change( int delta ) - { - if ( handle->antialias ) - { - const char* lcd_mode = NULL; - - - handle->lcd_mode = ( handle->lcd_mode + - delta + - N_LCD_MODES ) % N_LCD_MODES; - - switch ( handle->lcd_mode ) - { - case LCD_MODE_AA: - lcd_mode = "normal AA"; - break; - case LCD_MODE_LIGHT: - lcd_mode = "light AA"; - break; - case LCD_MODE_RGB: - lcd_mode = "LCD (horiz. RGB)"; - break; - case LCD_MODE_BGR: - lcd_mode = "LCD (horiz. BGR)"; - break; - case LCD_MODE_VRGB: - lcd_mode = "LCD (vert. RGB)"; - break; - case LCD_MODE_VBGR: - lcd_mode = "LCD (vert. BGR)"; - break; - } - sprintf( status.header_buffer, "rendering mode changed to %s", - lcd_mode ); - - status.header = (const char *)status.header_buffer; - - FTDemo_Update_Current_Flags( handle ); - } - else - status.header = "need anti-aliasing to change rendering mode"; - } - - - static void - event_lcd_filter_change( void ) - { - if ( handle->antialias && handle->lcd_mode > 1 ) - { - const char* lcd_filter = NULL; - - - switch( status.lcd_filter ) - { - case FT_LCD_FILTER_DEFAULT: - status.lcd_filter = FT_LCD_FILTER_LIGHT; - break; - case FT_LCD_FILTER_LIGHT: - status.lcd_filter = FT_LCD_FILTER_LEGACY1; - break; - case FT_LCD_FILTER_LEGACY1: - status.lcd_filter = FT_LCD_FILTER_NONE; - break; - case FT_LCD_FILTER_NONE: - default: - status.lcd_filter = FT_LCD_FILTER_DEFAULT; - break; - } - - switch ( status.lcd_filter ) - { - case FT_LCD_FILTER_DEFAULT: - lcd_filter = "default"; - break; - case FT_LCD_FILTER_LIGHT: - lcd_filter = "light"; - break; - case FT_LCD_FILTER_LEGACY1: - lcd_filter = "legacy"; - break; - case FT_LCD_FILTER_NONE: - default: - lcd_filter = "none"; - break; - } - - sprintf( status.header_buffer, "LCD filter changed to %s", - lcd_filter ); - - status.header = (const char *)status.header_buffer; - - FT_Library_SetLcdFilter( handle->library, status.lcd_filter ); - } - else - status.header = "need LCD mode to change filter"; - } - - - static void - event_size_change( int delta ) - { - status.ptsize += delta; - - if ( status.ptsize < 1 * 64 ) - status.ptsize = 1 * 64; - else if ( status.ptsize > MAXPTSIZE * 64 ) - status.ptsize = MAXPTSIZE * 64; - - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - } - - - static void - event_index_change( int delta ) - { - int num_indices = handle->current_font->num_indices; - - - status.Num += delta; - - if ( status.Num < 0 ) - status.Num = 0; - else if ( status.Num >= num_indices ) - status.Num = num_indices - 1; - } - - - static void - event_axis_change( int delta ) - { - FT_Error err; - FT_Size size; - FT_Var_Axis* a; - FT_Fixed pos; - - - err = FTDemo_Get_Size( handle, &size ); - if ( err ) - return; - - if ( !status.mm ) - return; - - a = status.mm->axis + status.current_axis; - pos = status.design_pos[status.current_axis]; - - /* - * Normalize i. Changing by 20 is all very well for PostScript fonts, - * which tend to have a range of ~1000 per axis, but it's not useful - * for mac fonts, which have a range of ~3. And it's rather extreme - * for optical size even in PS. - */ - pos += FT_MulDiv( delta, a->maximum - a->minimum, 1000 ); - if ( pos < a->minimum ) - pos = a->minimum; - if ( pos > a->maximum ) - pos = a->maximum; - - status.design_pos[status.current_axis] = pos; - - (void)FT_Set_Var_Design_Coordinates( size->face, - status.used_num_axis, - status.design_pos ); - } - - - static void - event_font_change( int delta ) - { - FT_Error err; - FT_Size size; - FT_UInt n, num_names; - FT_Int instance_index; - FT_Multi_Master dummy; - int num_indices, is_GX; - - - if ( status.font_index + delta >= handle->num_fonts || - status.font_index + delta < 0 ) - return; - - status.font_index += delta; - - FTDemo_Set_Current_Font( handle, handle->fonts[status.font_index] ); - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - FTDemo_Update_Current_Flags( handle ); - - num_indices = handle->current_font->num_indices; - - if ( status.Num >= num_indices ) - status.Num = num_indices - 1; - - err = FTDemo_Get_Size( handle, &size ); - if ( err ) - return; - - free( status.mm ); - err = FT_Get_MM_Var( size->face, &status.mm ); - if ( err ) - return; - - if ( status.mm->num_axis >= MAX_MM_AXES ) - { - fprintf( stderr, "only handling first %d GX axes (of %d)\n", - MAX_MM_AXES, status.mm->num_axis ); - status.used_num_axis = MAX_MM_AXES; - } - else - status.used_num_axis = status.mm->num_axis; - - err = FT_Get_Multi_Master( size->face, &dummy ); - is_GX = err ? 1 : 0; - - num_names = FT_Get_Sfnt_Name_Count( size->face ); - - /* in `face_index', the instance index starts with value 1 */ - instance_index = ( size->face->face_index >> 16 ) - 1; - - for ( n = 0; n < MAX_MM_AXES; n++ ) - { - free( status.axis_name[n] ); - status.axis_name[n] = NULL; - } - - for ( n = 0; n < status.used_num_axis; n++ ) - { - if ( status.requested_cnt ) - { - status.design_pos[n] = n < status.requested_cnt - ? status.requested_pos[n] - : status.mm->axis[n].def; - if ( status.design_pos[n] < status.mm->axis[n].minimum ) - status.design_pos[n] = status.mm->axis[n].minimum; - else if ( status.design_pos[n] > status.mm->axis[n].maximum ) - status.design_pos[n] = status.mm->axis[n].maximum; - } - else if ( FT_IS_NAMED_INSTANCE( size->face ) ) - status.design_pos[n] = status.mm->namedstyle[instance_index]. - coords[n]; - else - status.design_pos[n] = status.mm->axis[n].def; - - if ( is_GX ) - { - FT_SfntName name; - FT_UInt strid, j; - - - name.string = NULL; - strid = status.mm->axis[n].strid; - - /* iterate over all name entries */ - /* to find an English entry for `strid' */ - - for ( j = 0; j < num_names; j++ ) - { - error = FT_Get_Sfnt_Name( size->face, j, &name ); - if ( error ) - continue; - - if ( name.name_id == strid ) - { - /* XXX we don't have support for Apple's new `ltag' table yet, */ - /* thus we ignore TT_PLATFORM_APPLE_UNICODE */ - if ( ( name.platform_id == TT_PLATFORM_MACINTOSH && - name.language_id == TT_MAC_LANGID_ENGLISH ) || - ( name.platform_id == TT_PLATFORM_MICROSOFT && - ( name.language_id & 0xFF ) - == TT_MS_LANGID_ENGLISH_GENERAL ) ) - break; - } - } - - if ( name.string ) - { - FT_UInt len; - char* s; - - - if ( name.platform_id == TT_PLATFORM_MACINTOSH ) - { - len = put_ascii_string_size( name.string, name.string_len, 0 ); - s = (char*)malloc( len ); - if ( s ) - { - put_ascii_string( s, name.string, name.string_len, 0 ); - status.axis_name[n] = s; - } - } - else - { - len = put_unicode_be16_string_size( name.string, - name.string_len, - 0, - 0 ); - s = (char*)malloc( len ); - if ( s ) - { - put_unicode_be16_string( s, - name.string, - name.string_len, - 0, - 0 ); - status.axis_name[n] = s; - } - } - } - } - } - - (void)FT_Set_Var_Design_Coordinates( size->face, - status.used_num_axis, - status.design_pos ); - } - - - static int - Process_Event( grEvent* event ) - { - int ret = 0; - - - status.header = NULL; - - switch ( event->key ) - { - case grKeyEsc: - case grKEY( 'q' ): - ret = 1; - break; - - case grKeyF1: - case grKEY( '?' ): - event_help(); - break; - - case grKEY( 'a' ): - handle->antialias = !handle->antialias; - status.header = handle->antialias ? "anti-aliasing is now on" - : "anti-aliasing is now off"; - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'f' ): - handle->autohint = !handle->autohint; - status.header = handle->autohint ? "forced auto-hinting is now on" - : "forced auto-hinting is now off"; - - FTDemo_Update_Current_Flags( handle ); - break; - -#ifdef FT_DEBUG_AUTOFIT - case grKEY( '1' ): - if ( handle->hinted && - ( handle->autohint || handle->lcd_mode == LCD_MODE_LIGHT ) ) - { - status.header = "dumping glyph edges to stdout"; - af_glyph_hints_dump_edges( _af_debug_hints, 1 ); - } - break; - - case grKEY( '2' ): - if ( handle->hinted && - ( handle->autohint || handle->lcd_mode == LCD_MODE_LIGHT ) ) - { - status.header = "dumping glyph segments to stdout"; - af_glyph_hints_dump_segments( _af_debug_hints, 1 ); - } - break; - - case grKEY( '3' ): - if ( handle->hinted && - ( handle->autohint || handle->lcd_mode == LCD_MODE_LIGHT ) ) - { - status.header = "dumping glyph points to stdout"; - af_glyph_hints_dump_points( _af_debug_hints, 1 ); - } - break; -#endif /* FT_DEBUG_AUTOFIT */ - - case grKEY( 'L' ): - event_lcd_filter_change(); - break; - - case grKEY( 'g' ): - event_gamma_change( 0.1 ); - break; - - case grKEY( 'v' ): - event_gamma_change( -0.1 ); - break; - - case grKEY( 'n' ): - event_font_change( 1 ); - break; - - case grKEY( 'h' ): - handle->hinted = !handle->hinted; - status.header = handle->hinted ? "glyph hinting is now active" - : "glyph hinting is now ignored"; - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'd' ): - status.work ^= DO_DOTS; - break; - - case grKEY( 'D' ): - status.work ^= DO_DOTNUMBERS; - break; - - case grKEY( 'o' ): - status.work ^= DO_OUTLINE; - break; - - case grKEY( 'b' ): - status.work ^= DO_BITMAP; - break; - - case grKEY( 'p' ): - event_font_change( -1 ); - break; - - case grKEY( 'H' ): - if ( !( handle->autohint || handle->lcd_mode == LCD_MODE_LIGHT ) ) - { - FT_Face face; - FT_Module module; - - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - if ( !error ) - { - module = &face->driver->root; - - if ( !strcmp( module->clazz->module_name, "cff" ) ) - event_cff_hinting_engine_change( 1 ); - else if ( !strcmp( module->clazz->module_name, "truetype" ) ) - event_tt_interpreter_version_change(); - } - } -#ifdef FT_DEBUG_AUTOFIT - else - { - status.do_horz_hints = !status.do_horz_hints; - status.header = status.do_horz_hints ? "horizontal hinting enabled" - : "horizontal hinting disabled"; - } -#endif - break; - - case grKEY( 'w' ): - event_warping_change(); - break; - -#ifdef FT_DEBUG_AUTOFIT - case grKEY( 'V' ): - if ( handle->autohint || handle->lcd_mode == LCD_MODE_LIGHT ) - { - status.do_vert_hints = !status.do_vert_hints; - status.header = status.do_vert_hints ? "vertical hinting enabled" - : "vertical hinting disabled"; - } - else - status.header = "need autofit mode to toggle vertical hinting"; - break; - - case grKEY( 'B' ): - if ( handle->autohint || handle->lcd_mode == LCD_MODE_LIGHT ) - { - status.do_blue_hints = !status.do_blue_hints; - status.header = status.do_blue_hints ? "blue zone hinting enabled" - : "blue zone hinting disabled"; - } - else - status.header = "need autofit mode to toggle blue zone hinting"; - break; - - case grKEY( 's' ): - status.do_segment = !status.do_segment; - status.header = status.do_segment ? "segment drawing enabled" - : "segment drawing disabled"; - break; -#endif /* FT_DEBUG_AUTOFIT */ - - case grKeyLeft: event_index_change( -1 ); break; - case grKeyRight: event_index_change( 1 ); break; - case grKeyF7: event_index_change( -10 ); break; - case grKeyF8: event_index_change( 10 ); break; - case grKeyF9: event_index_change( -100 ); break; - case grKeyF10: event_index_change( 100 ); break; - case grKeyF11: event_index_change( -1000 ); break; - case grKeyF12: event_index_change( 1000 ); break; - - case grKeyUp: event_size_change( 32 ); break; - case grKeyDown: event_size_change( -32 ); break; - - case grKEY( ' ' ): event_grid_reset( &status ); -#if 0 - status.do_horz_hints = 1; - status.do_vert_hints = 1; - status.do_blue_hints = 1; -#endif - break; - - case grKEY( 'i' ): event_grid_translate( 0, -1 ); break; - case grKEY( 'k' ): event_grid_translate( 0, 1 ); break; - case grKEY( 'j' ): event_grid_translate( -1, 0 ); break; - case grKEY( 'l' ): event_grid_translate( 1, 0 ); break; - - case grKeyPageUp: event_grid_zoom( 1.25 ); break; - case grKeyPageDown: event_grid_zoom( 1 / 1.25 ); break; - - case grKeyF2: if ( status.mm ) - { - status.current_axis++; - status.current_axis %= status.used_num_axis; - } - break; - - case grKeyF3: event_axis_change( -20 ); break; - case grKeyF4: event_axis_change( 20 ); break; - - case grKeyF5: event_lcd_mode_change( -1 ); break; - case grKeyF6: event_lcd_mode_change( 1 ); break; - - default: - ; - } - - return ret; - } - - - static void - write_header( FT_Error error_code ) - { - FT_Face face; - const char* basename; - const char* format; - - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - if ( error ) - Fatal( "can't access font file" ); - - if ( !status.header ) - { - basename = ft_basename( handle->current_font->filepathname ); - - switch ( error_code ) - { - case FT_Err_Ok: - sprintf( status.header_buffer, "%.50s %.50s (file `%.100s')", - face->family_name, face->style_name, basename ); - break; - - case FT_Err_Invalid_Pixel_Size: - sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", - basename ); - break; - - case FT_Err_Invalid_PPem: - sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", - basename ); - break; - - default: - sprintf( status.header_buffer, "File `%.100s': error 0x%04x", - basename, (FT_UShort)error_code ); - break; - } - - status.header = (const char *)status.header_buffer; - } - - grWriteCellString( display->bitmap, 0, 0, status.header, - display->fore_color ); - - if ( status.mm ) - { - format = " %s axis: %.02f, %gpt, glyph %d"; - snprintf( status.header_buffer, BUFSIZE, format, - status.axis_name[status.current_axis] - ? status.axis_name[status.current_axis] - : status.mm->axis[status.current_axis].name, - status.design_pos[status.current_axis] / 65536.0, - status.ptsize / 64.0, - status.Num ); - } - else - { - format = " %gpt, glyph %d"; - snprintf( status.header_buffer, BUFSIZE, format, - status.ptsize / 64.0, - status.Num ); - } - - if ( FT_HAS_GLYPH_NAMES( face ) ) - { - char* p; - unsigned int format_len, gindex, size; - - - size = strlen( status.header_buffer ); - p = status.header_buffer + size; - size = BUFSIZE - size; - - format = ": "; - format_len = strlen( format ); - - if ( size >= format_len + 2 ) - { - gindex = (unsigned int)status.Num; - - strcpy( p, format ); - if ( FT_Get_Glyph_Name( face, gindex, - p + format_len, size - format_len ) ) - *p = '\0'; - } - } - - status.header = (const char *)status.header_buffer; - grWriteCellString( display->bitmap, 0, HEADER_HEIGHT, - status.header_buffer, display->fore_color ); - - grRefreshSurface( display->surface ); - } - - - static void - usage( char* execname ) - { - fprintf( stderr, - "\n" - "ftgrid: simple glyph grid viewer -- part of the FreeType project\n" - "----------------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] pt font ...\n" - "\n", - execname ); - fprintf( stderr, - " pt The point size for the given resolution.\n" - " If resolution is 72dpi, this directly gives the\n" - " ppem value (pixels per EM).\n" ); - fprintf( stderr, - " font The font file(s) to display.\n" - " For Type 1 font files, ftgrid also tries to attach\n" - " the corresponding metrics file (with extension\n" - " `.afm' or `.pfm').\n" - "\n" ); - fprintf( stderr, - " -w W Set the window width to W pixels (default: %dpx).\n" - " -h H Set the window height to H pixels (default: %dpx).\n" - "\n", - DIM_X, DIM_Y ); - fprintf( stderr, - " -r R Use resolution R dpi (default: 72dpi).\n" - " -f index Specify first index to display (default: 0).\n" - " -d \"axis1 axis2 ...\"\n" - " Specify the design coordinates for each\n" - " Multiple Master axis at start-up.\n" - "\n" - " -v Show version." - "\n" ); - - exit( 1 ); - } - - - static void - parse_cmdline( int* argc, - char** argv[] ) - { - char* execname; - int option; - - - execname = ft_basename( (*argv)[0] ); - - while ( 1 ) - { - option = getopt( *argc, *argv, "d:f:h:r:vw:" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'd': - { - FT_UInt cnt; - FT_Fixed* pos = status.requested_pos; - char* s = optarg; - - - for ( cnt = 0; cnt < MAX_MM_AXES && *s; cnt++ ) - { - pos[cnt] = (FT_Fixed)( strtod( s, &s ) * 65536.0 ); - - while ( *s == ' ' ) - ++s; - } - - status.requested_cnt = cnt; - } - break; - - case 'f': - status.Num = atoi( optarg ); - break; - - case 'h': - status.height = atoi( optarg ); - if ( status.height < 1 ) - usage( execname ); - break; - - case 'r': - status.res = atoi( optarg ); - if ( status.res < 1 ) - usage( execname ); - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( handle->library, &major, &minor, &patch ); - - printf( "ftgrid (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - case 'w': - status.width = atoi( optarg ); - if ( status.width < 1 ) - usage( execname ); - break; - - default: - usage( execname ); - break; - } - } - - *argc -= optind; - *argv += optind; - - if ( *argc <= 1 ) - usage( execname ); - - status.ptsize = (int)( atof( *argv[0] ) * 64.0 ); - if ( status.ptsize == 0 ) - status.ptsize = 64 * 10; - - if ( status.res <= 0 ) - status.res = 72; - - (*argc)--; - (*argv)++; - } - - - int - main( int argc, - char* argv[] ) - { - grEvent event; - int n; - unsigned int dflt_tt_interpreter_version; - unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - TT_INTERPRETER_VERSION_40 }; - - - /* initialize engine */ - handle = FTDemo_New(); - - grid_status_init( &status ); - parse_cmdline( &argc, &argv ); - - /* get the default value as compiled into FreeType */ - FT_Property_Get( handle->library, - "cff", - "hinting-engine", &status.cff_hinting_engine ); - - /* collect all available versions, then set again the default */ - FT_Property_Get( handle->library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - for ( n = 0; n < 3; n++ ) - { - error = FT_Property_Set( handle->library, - "truetype", - "interpreter-version", &versions[n] ); - if ( !error ) - status.tt_interpreter_versions[ - status.num_tt_interpreter_versions++] = versions[n]; - if ( versions[n] == dflt_tt_interpreter_version ) - status.tt_interpreter_version_idx = n; - } - FT_Property_Set( handle->library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - - FT_Property_Get( handle->library, - "autofitter", - "warping", &status.warping ); - - FT_Library_SetLcdFilter( handle->library, status.lcd_filter ); - - display = FTDemo_Display_New( gr_pixel_mode_rgb24, - status.width, status.height ); - if ( !display ) - Fatal( "could not allocate display surface" ); - - grid_status_display( &status, display ); - - grSetTitle( display->surface, - "FreeType Glyph Grid Viewer - press ? for help" ); - - for ( ; argc > 0; argc--, argv++ ) - { - error = FTDemo_Install_Font( handle, argv[0], 1, - status.requested_cnt ? 1 : 0 ); - if ( error == FT_Err_Invalid_Argument ) - fprintf( stderr, "skipping font `%s' without outlines\n", - argv[0] ); - } - - if ( handle->num_fonts == 0 ) - Fatal( "could not find/open any font file" ); - - printf( "ptsize =%g\n", status.ptsize / 64.0 ); - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - FTDemo_Update_Current_Flags( handle ); - - event_font_change( 0 ); - - grid_status_rescale_initial( &status, handle ); - - for ( ;; ) - { - FTDemo_Display_Clear( display ); - - grid_status_draw_grid( &status ); - - if ( status.work ) - grid_status_draw_outline( &status, handle, display ); - - write_header( 0 ); - - grListenSurface( display->surface, 0, &event ); - if ( Process_Event( &event ) ) - break; - } - - printf( "Execution completed successfully.\n" ); - - for ( n = 0; n < MAX_MM_AXES; n++ ) - free( status.axis_name[n] ); - free( status.mm ); - - FT_Stroker_Done( status.stroker ); - FTDemo_Display_Done( display ); - FTDemo_Done( handle ); - - exit( 0 ); /* for safety reasons */ - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftinspect.cpp freetype-2.8/=unpacked-tar1=/src/ftinspect.cpp --- freetype-2.7.1/=unpacked-tar1=/src/ftinspect.cpp 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftinspect.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,2734 +0,0 @@ -// ftinspect.cpp - -// Copyright (C) 2016 by Werner Lemberg. - -#include "ftinspect.h" - - -#define VERSION "X.Y.Z" - - -///////////////////////////////////////////////////////////////////////////// -// -// FaceID -// -///////////////////////////////////////////////////////////////////////////// - -FaceID::FaceID() -: fontIndex(-1), - faceIndex(-1), - namedInstanceIndex(-1) -{ - // empty -} - - -FaceID::FaceID(int fontIdx, - int faceIdx, - int namedInstanceIdx) -: fontIndex(fontIdx), - faceIndex(faceIdx), - namedInstanceIndex(namedInstanceIdx) -{ - // empty -} - - -bool -FaceID::operator<(const FaceID& other) const -{ - bool ret = false; - - if (fontIndex < other.fontIndex) - ret = true; - else if (fontIndex == other.fontIndex) - { - if (faceIndex < other.faceIndex) - ret = true; - else if (faceIndex == other.faceIndex) - { - if (namedInstanceIndex < other.namedInstanceIndex) - ret = true; - } - } - - return ret; -} - - -// The face requester is a function provided by the client application to -// the cache manager to translate an `abstract' face ID into a real -// `FT_Face' object. -// -// We use a map: `faceID' is the value, and its associated key gives the -// font, face, and named instance indices. Getting a key from a value is -// slow, but this must be done only once, since `faceRequester' is only -// called if the font is not yet in the cache. - -FT_Error -faceRequester(FTC_FaceID ftcFaceID, - FT_Library library, - FT_Pointer requestData, - FT_Face* faceP) -{ - MainGUI* gui = static_cast(requestData); - // in C++ it's tricky to convert a void pointer back to an integer - // without warnings related to 32bit vs. 64bit pointer size - int val = static_cast((char*)ftcFaceID - (char*)0); - const FaceID& faceID = gui->engine->faceIDMap.key(val); - - // this is the only place where we have to check the validity of the font - // index; note that the validity of both the face and named instance index - // is checked by FreeType itself - if (faceID.fontIndex < 0 - || faceID.fontIndex >= gui->fontList.size()) - return FT_Err_Invalid_Argument; - - QString& font = gui->fontList[faceID.fontIndex]; - int faceIndex = faceID.faceIndex; - - if (faceID.namedInstanceIndex > 0) - faceIndex += faceID.namedInstanceIndex << 16; - - return FT_New_Face(library, - qPrintable(font), - faceIndex, - faceP); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// Engine -// -///////////////////////////////////////////////////////////////////////////// - -Engine::Engine(MainGUI* g) -{ - gui = g; - ftSize = NULL; - // we reserve value 0 for the `invalid face ID' - faceCounter = 1; - - FT_Error error; - - error = FT_Init_FreeType(&library); - if (error) - { - // XXX error handling - } - - error = FTC_Manager_New(library, 0, 0, 0, - faceRequester, gui, &cacheManager); - if (error) - { - // XXX error handling - } - - error = FTC_SBitCache_New(cacheManager, &sbitsCache); - if (error) - { - // XXX error handling - } - - error = FTC_ImageCache_New(cacheManager, &imageCache); - if (error) - { - // XXX error handling - } - - // query engines and check for alternatives - - // CFF - error = FT_Property_Get(library, - "cff", - "hinting-engine", - &cffHintingEngineDefault); - if (error) - { - // no CFF engine - cffHintingEngineDefault = -1; - cffHintingEngineOther = -1; - } - else - { - int engines[2] = - { - FT_CFF_HINTING_FREETYPE, - FT_CFF_HINTING_ADOBE - }; - - int i; - for (i = 0; i < 2; i++) - if (cffHintingEngineDefault == engines[i]) - break; - - cffHintingEngineOther = engines[(i + 1) % 2]; - - error = FT_Property_Set(library, - "cff", - "hinting-engine", - &cffHintingEngineOther); - if (error) - cffHintingEngineOther = -1; - - // reset - FT_Property_Set(library, - "cff", - "hinting-engine", - &cffHintingEngineDefault); - } - - // TrueType - error = FT_Property_Get(library, - "truetype", - "interpreter-version", - &ttInterpreterVersionDefault); - if (error) - { - // no TrueType engine - ttInterpreterVersionDefault = -1; - ttInterpreterVersionOther = -1; - ttInterpreterVersionOther1 = -1; - } - else - { - int interpreters[3] = - { - TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - 40, // TT_INTERPRETER_VERSION_40, not yet implemented - }; - - int i; - for (i = 0; i < 3; i++) - if (ttInterpreterVersionDefault == interpreters[i]) - break; - - ttInterpreterVersionOther = interpreters[(i + 1) % 3]; - - error = FT_Property_Set(library, - "truetype", - "interpreter-version", - &ttInterpreterVersionOther); - if (error) - ttInterpreterVersionOther = -1; - - ttInterpreterVersionOther1 = interpreters[(i + 2) % 3]; - - error = FT_Property_Set(library, - "truetype", - "interpreter-version", - &ttInterpreterVersionOther1); - if (error) - ttInterpreterVersionOther1 = -1; - - // reset - FT_Property_Set(library, - "truetype", - "interpreter-version", - &ttInterpreterVersionDefault); - } - - // auto-hinter - error = FT_Property_Get(library, - "autofitter", - "warping", - &doWarping); - if (error) - { - // no warping - haveWarping = 0; - doWarping = 0; - } - else - { - haveWarping = 1; - doWarping = 0; // we don't do warping by default - - FT_Property_Set(library, - "autofitter", - "warping", - &doWarping); - } -} - - -Engine::~Engine() -{ - FTC_Manager_Done(cacheManager); - FT_Done_FreeType(library); -} - - -int -Engine::numberOfFaces(int fontIndex) -{ - FT_Face face; - int numFaces = -1; - - // search triplet (fontIndex, 0, 0) - FTC_FaceID ftcFaceID = reinterpret_cast - (faceIDMap.value(FaceID(fontIndex, - 0, - 0))); - if (ftcFaceID) - { - // found - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) - numFaces = face->num_faces; - } - else - { - // not found; try to load triplet (fontIndex, 0, 0) - ftcFaceID = reinterpret_cast(faceCounter); - faceIDMap.insert(FaceID(fontIndex, 0, 0), - faceCounter++); - - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) - numFaces = face->num_faces; - else - { - faceIDMap.remove(FaceID(fontIndex, 0, 0)); - faceCounter--; - } - } - - return numFaces; -} - - -int -Engine::numberOfNamedInstances(int fontIndex, - int faceIndex) -{ - FT_Face face; - // we return `n' named instances plus one; - // instance index 0 represents a face without a named instance selected - int numNamedInstances = -1; - - // search triplet (fontIndex, faceIndex, 0) - FTC_FaceID ftcFaceID = reinterpret_cast - (faceIDMap.value(FaceID(fontIndex, - faceIndex, - 0))); - if (ftcFaceID) - { - // found - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) - numNamedInstances = (face->style_flags >> 16) + 1; - } - else - { - // not found; try to load triplet (fontIndex, faceIndex, 0) - ftcFaceID = reinterpret_cast(faceCounter); - faceIDMap.insert(FaceID(fontIndex, faceIndex, 0), - faceCounter++); - - if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) - numNamedInstances = (face->style_flags >> 16) + 1; - else - { - faceIDMap.remove(FaceID(fontIndex, faceIndex, 0)); - faceCounter--; - } - } - - return numNamedInstances; -} - - -int -Engine::loadFont(int fontIndex, - int faceIndex, - int namedInstanceIndex) -{ - int numGlyphs = -1; - fontType = FontType_Other; - - update(); - - // search triplet (fontIndex, faceIndex, namedInstanceIndex) - scaler.face_id = reinterpret_cast - (faceIDMap.value(FaceID(fontIndex, - faceIndex, - namedInstanceIndex))); - if (scaler.face_id) - { - // found - if (!FTC_Manager_LookupSize(cacheManager, &scaler, &ftSize)) - numGlyphs = ftSize->face->num_glyphs; - } - else - { - // not found; try to load triplet - // (fontIndex, faceIndex, namedInstanceIndex) - scaler.face_id = reinterpret_cast(faceCounter); - faceIDMap.insert(FaceID(fontIndex, - faceIndex, - namedInstanceIndex), - faceCounter++); - - if (!FTC_Manager_LookupSize(cacheManager, &scaler, &ftSize)) - numGlyphs = ftSize->face->num_glyphs; - else - { - faceIDMap.remove(FaceID(fontIndex, - faceIndex, - namedInstanceIndex)); - faceCounter--; - } - } - - if (numGlyphs < 0) - { - ftSize = NULL; - curFamilyName = QString(); - curStyleName = QString(); - } - else - { - curFamilyName = QString(ftSize->face->family_name); - curStyleName = QString(ftSize->face->style_name); - - FT_Module module = &ftSize->face->driver->root; - const char* moduleName = module->clazz->module_name; - - // XXX cover all available modules - if (!strcmp(moduleName, "cff")) - fontType = FontType_CFF; - else if (!strcmp(moduleName, "truetype")) - fontType = FontType_TrueType; - } - - return numGlyphs; -} - - -void -Engine::removeFont(int fontIndex) -{ - // we iterate over all triplets that contain the given font index - // and remove them - QMap::iterator iter - = faceIDMap.lowerBound(FaceID(fontIndex, 0, 0)); - - for (;;) - { - if (iter == faceIDMap.end()) - break; - - FaceID faceID = iter.key(); - if (faceID.fontIndex != fontIndex) - break; - - FTC_FaceID ftcFaceID = reinterpret_cast(iter.value()); - FTC_Manager_RemoveFaceID(cacheManager, ftcFaceID); - - iter = faceIDMap.erase(iter); - } -} - - -const QString& -Engine::currentFamilyName() -{ - return curFamilyName; -} - - -const QString& -Engine::currentStyleName() -{ - return curStyleName; -} - - -QString -Engine::glyphName(int index) -{ - QString name; - - if (ftSize && FT_HAS_GLYPH_NAMES(ftSize->face)) - { - char buffer[256]; - if (!FT_Get_Glyph_Name(ftSize->face, - index, - buffer, - sizeof(buffer))) - name = QString(buffer); - } - - return name; -} - - -FT_Outline* -Engine::loadOutline(int glyphIndex) -{ - update(); - - FT_Glyph glyph; - - // XXX handle bitmap fonts - - // the `scaler' object is set up by the - // `update' and `loadFont' methods - if (FTC_ImageCache_LookupScaler(imageCache, - &scaler, - loadFlags | FT_LOAD_NO_BITMAP, - glyphIndex, - &glyph, - NULL)) - { - // XXX error handling? - return NULL; - } - - if (glyph->format != FT_GLYPH_FORMAT_OUTLINE) - return NULL; - - FT_OutlineGlyph outlineGlyph = reinterpret_cast(glyph); - - return &outlineGlyph->outline; -} - - -void -Engine::setCFFHintingMode(int mode) -{ - int index = gui->hintingModesCFFHash.key(mode); - - FT_Error error = FT_Property_Set(library, - "cff", - "hinting-engine", - &index); - if (!error) - { - // reset the cache - FTC_Manager_Reset(cacheManager); - } -} - - -void -Engine::setTTInterpreterVersion(int mode) -{ - int index = gui->hintingModesTrueTypeHash.key(mode); - - FT_Error error = FT_Property_Set(library, - "truetype", - "interpreter-version", - &index); - if (!error) - { - // reset the cache - FTC_Manager_Reset(cacheManager); - } -} - - -void -Engine::update() -{ - dpi = gui->dpiSpinBox->value(); - - if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px) - { - pixelSize = gui->sizeDoubleSpinBox->value(); - pointSize = pixelSize * 72.0 / dpi; - } - else - { - pointSize = gui->sizeDoubleSpinBox->value(); - pixelSize = pointSize * dpi / 72.0; - } - - doHinting = gui->hintingCheckBox->isChecked(); - - doAutoHinting = gui->autoHintingCheckBox->isChecked(); - doHorizontalHinting = gui->horizontalHintingCheckBox->isChecked(); - doVerticalHinting = gui->verticalHintingCheckBox->isChecked(); - doBlueZoneHinting = gui->blueZoneHintingCheckBox->isChecked(); - showSegments = gui->segmentDrawingCheckBox->isChecked(); - doWarping = gui->warpingCheckBox->isChecked(); - - gamma = gui->gammaSlider->value(); - - loadFlags = FT_LOAD_DEFAULT; - if (doAutoHinting) - loadFlags |= FT_LOAD_FORCE_AUTOHINT; - loadFlags |= FT_LOAD_NO_BITMAP; // XXX handle bitmap fonts also - - int index = gui->antiAliasingComboBoxx->currentIndex(); - - if (doHinting) - { - int target; - - if (index == MainGUI::AntiAliasing_None) - target = FT_LOAD_TARGET_MONO; - else - { - switch (index) - { - case MainGUI::AntiAliasing_Slight: - target = FT_LOAD_TARGET_LIGHT; - break; - - case MainGUI::AntiAliasing_LCD: - case MainGUI::AntiAliasing_LCD_BGR: - target = FT_LOAD_TARGET_LCD; - break; - - case MainGUI::AntiAliasing_LCD_Vertical: - case MainGUI::AntiAliasing_LCD_Vertical_BGR: - target = FT_LOAD_TARGET_LCD_V; - break; - - default: - target = FT_LOAD_TARGET_NORMAL; - } - } - - loadFlags |= target; - } - else - { - loadFlags |= FT_LOAD_NO_HINTING; - - if (index == MainGUI::AntiAliasing_None) - loadFlags |= FT_LOAD_MONOCHROME; - } - - // XXX handle color fonts also - - scaler.pixel = 0; // use 26.6 format - - if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px) - { - scaler.width = int(pixelSize * 64.0); - scaler.height = int(pixelSize * 64.0); - scaler.x_res = 0; - scaler.y_res = 0; - } - else - { - scaler.width = int(pointSize * 64.0); - scaler.height = int(pointSize * 64.0); - scaler.x_res = dpi; - scaler.y_res = dpi; - } -} - - -///////////////////////////////////////////////////////////////////////////// -// -// Grid -// -///////////////////////////////////////////////////////////////////////////// - -Grid::Grid(const QPen& gridP, - const QPen& axisP) -: gridPen(gridP), - axisPen(axisP) -{ - // empty -} - - -QRectF -Grid::boundingRect() const -{ - // XXX fix size - - // no need to take care of pen width - return QRectF(-100, -100, - 200, 200); -} - - -// XXX call this in a `myQDraphicsView::drawBackground' derived method -// to always fill the complete viewport - -void -Grid::paint(QPainter* painter, - const QStyleOptionGraphicsItem* option, - QWidget*) -{ - const qreal lod = option->levelOfDetailFromTransform( - painter->worldTransform()); - - painter->setPen(gridPen); - - // don't mark pixel center with a cross if magnification is too small - if (lod > 20) - { - int halfLength = 1; - - // cf. QSpinBoxx - if (lod > 640) - halfLength = 6; - else if (lod > 320) - halfLength = 5; - else if (lod > 160) - halfLength = 4; - else if (lod > 80) - halfLength = 3; - else if (lod > 40) - halfLength = 2; - - for (qreal x = -100; x < 100; x++) - for (qreal y = -100; y < 100; y++) - { - painter->drawLine(QLineF(x + 0.5, y + 0.5 - halfLength / lod, - x + 0.5, y + 0.5 + halfLength / lod)); - painter->drawLine(QLineF(x + 0.5 - halfLength / lod, y + 0.5, - x + 0.5 + halfLength / lod, y + 0.5)); - } - } - - // don't draw grid if magnification is too small - if (lod >= 5) - { - // XXX fix size - for (int x = -100; x <= 100; x++) - painter->drawLine(x, -100, - x, 100); - for (int y = -100; y <= 100; y++) - painter->drawLine(-100, y, - 100, y); - } - - painter->setPen(axisPen); - - painter->drawLine(0, -100, - 0, 100); - painter->drawLine(-100, 0, - 100, 0); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// GlyphOutline -// -///////////////////////////////////////////////////////////////////////////// - -extern "C" { - -// vertical font coordinates are bottom-up, -// while Qt uses top-down - -static int -moveTo(const FT_Vector* to, - void* user) -{ - QPainterPath* path = static_cast(user); - - path->moveTo(qreal(to->x) / 64, - -qreal(to->y) / 64); - - return 0; -} - - -static int -lineTo(const FT_Vector* to, - void* user) -{ - QPainterPath* path = static_cast(user); - - path->lineTo(qreal(to->x) / 64, - -qreal(to->y) / 64); - - return 0; -} - - -static int -conicTo(const FT_Vector* control, - const FT_Vector* to, - void* user) -{ - QPainterPath* path = static_cast(user); - - path->quadTo(qreal(control->x) / 64, - -qreal(control->y) / 64, - qreal(to->x) / 64, - -qreal(to->y) / 64); - - return 0; -} - - -static int -cubicTo(const FT_Vector* control1, - const FT_Vector* control2, - const FT_Vector* to, - void* user) -{ - QPainterPath* path = static_cast(user); - - path->cubicTo(qreal(control1->x) / 64, - -qreal(control1->y) / 64, - qreal(control2->x) / 64, - -qreal(control2->y) / 64, - qreal(to->x) / 64, - -qreal(to->y) / 64); - - return 0; -} - - -static FT_Outline_Funcs outlineFuncs = -{ - moveTo, - lineTo, - conicTo, - cubicTo, - 0, // no shift - 0 // no delta -}; - -} // extern "C" - - -GlyphOutline::GlyphOutline(const QPen& outlineP, - FT_Outline* outln) -: outlinePen(outlineP), - outline(outln) -{ - FT_BBox cbox; - - qreal halfPenWidth = outlinePen.widthF(); - - FT_Outline_Get_CBox(outline, &cbox); - - bRect.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth, - -qreal(cbox.yMax) / 64 - halfPenWidth, - qreal(cbox.xMax) / 64 + halfPenWidth, - -qreal(cbox.yMin) / 64 + halfPenWidth); -} - - -QRectF -GlyphOutline::boundingRect() const -{ - return bRect; -} - - -void -GlyphOutline::paint(QPainter* painter, - const QStyleOptionGraphicsItem*, - QWidget*) -{ - painter->setPen(outlinePen); - - QPainterPath path; - FT_Outline_Decompose(outline, &outlineFuncs, &path); - - painter->drawPath(path); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// GlyphPoints -// -///////////////////////////////////////////////////////////////////////////// - -GlyphPoints::GlyphPoints(const QPen& onP, - const QPen& offP, - FT_Outline* outln) -: onPen(onP), - offPen(offP), - outline(outln) -{ - FT_BBox cbox; - - qreal halfPenWidth = qMax(onPen.widthF(), offPen.widthF()) / 2; - - FT_Outline_Get_CBox(outline, &cbox); - - bRect.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth, - -qreal(cbox.yMax) / 64 - halfPenWidth, - qreal(cbox.xMax) / 64 + halfPenWidth, - -qreal(cbox.yMin) / 64 + halfPenWidth); -} - - -QRectF -GlyphPoints::boundingRect() const -{ - return bRect; -} - - -void -GlyphPoints::paint(QPainter* painter, - const QStyleOptionGraphicsItem* option, - QWidget*) -{ - const qreal lod = option->levelOfDetailFromTransform( - painter->worldTransform()); - - // don't draw points if magnification is too small - if (lod >= 5) - { - // we want the same dot size regardless of the scaling; - // for good optical results, the pen widths should be uneven integers - - // interestingly, using `drawPoint' doesn't work as expected: - // the larger the zoom, the more horizontally stretched the dot appears -#if 0 - qreal origOnPenWidth = onPen.widthF(); - qreal origOffPenWidth = offPen.widthF(); - - onPen.setWidthF(origOnPenWidth / lod); - offPen.setWidthF(origOffPenWidth / lod); - - for (int i = 0; i < outline->n_points; i++) - { - if (outline->tags[i] & FT_CURVE_TAG_ON) - painter->setPen(onPen); - else - painter->setPen(offPen); - - painter->drawPoint(QPointF(qreal(outline->points[i].x) / 64, - -qreal(outline->points[i].y) / 64)); - } - - onPen.setWidthF(origOnPenWidth); - offPen.setWidthF(origOffPenWidth); -#else - QBrush onBrush(onPen.color()); - QBrush offBrush(offPen.color()); - - painter->setPen(Qt::NoPen); - - qreal onRadius = onPen.widthF() / lod; - qreal offRadius = offPen.widthF() / lod; - - for (int i = 0; i < outline->n_points; i++) - { - if (outline->tags[i] & FT_CURVE_TAG_ON) - { - painter->setBrush(onBrush); - painter->drawEllipse(QPointF(qreal(outline->points[i].x) / 64, - -qreal(outline->points[i].y) / 64), - onRadius, - onRadius); - } - else - { - painter->setBrush(offBrush); - painter->drawEllipse(QPointF(qreal(outline->points[i].x) / 64, - -qreal(outline->points[i].y) / 64), - offRadius, - offRadius); - } - } -#endif - } -} - - -///////////////////////////////////////////////////////////////////////////// -// -// GlyphPointNumbers -// -///////////////////////////////////////////////////////////////////////////// - -GlyphPointNumbers::GlyphPointNumbers(const QPen& onP, - const QPen& offP, - FT_Outline* outln) -: onPen(onP), - offPen(offP), - outline(outln) -{ - FT_BBox cbox; - - FT_Outline_Get_CBox(outline, &cbox); - - // XXX fix bRect size - bRect.setCoords(qreal(cbox.xMin) / 64, - -qreal(cbox.yMax) / 64, - qreal(cbox.xMax) / 64, - -qreal(cbox.yMin) / 64); -} - - -QRectF -GlyphPointNumbers::boundingRect() const -{ - return bRect; -} - - -void -GlyphPointNumbers::paint(QPainter* painter, - const QStyleOptionGraphicsItem* option, - QWidget*) -{ - const qreal lod = option->levelOfDetailFromTransform( - painter->worldTransform()); - - // don't draw point numbers if magnification is too small - if (lod >= 10) - { - QFont font = painter->font(); - - // the following doesn't work correctly with scaling; - // it seems that Qt doesn't allow arbitrarily small font sizes - // that get magnified later on -#if 0 - // we want the same text size regardless of the scaling - font.setPointSizeF(font.pointSizeF() / lod); - painter->setFont(font); -#else - font.setPointSizeF(font.pointSizeF() * 3 / 4); - painter->setFont(font); - - QBrush onBrush(onPen.color()); - QBrush offBrush(offPen.color()); - - painter->scale(1 / lod, 1 / lod); -#endif - - FT_Vector* points = outline->points; - FT_Short* contours = outline->contours; - char* tags = outline->tags; - - QVector2D octants[8] = { QVector2D(1, 0), - QVector2D(0.707, -0.707), - QVector2D(0, -1), - QVector2D(-0.707, -0.707), - QVector2D(-1, 0), - QVector2D(-0.707, 0.707), - QVector2D(0, 1), - QVector2D(0.707, 0.707) }; - - - int ptIdx = 0; - for (int contIdx = 0; contIdx < outline->n_contours; contIdx++ ) - { - for (;;) - { - short prevIdx, nextIdx; - - // find previous and next point in outline - if (contIdx == 0) - { - if (contours[contIdx] == 0) - { - prevIdx = 0; - nextIdx = 0; - } - else - { - prevIdx = ptIdx > 0 ? ptIdx - 1 - : contours[contIdx]; - nextIdx = ptIdx < contours[contIdx] ? ptIdx + 1 - : 0; - } - } - else - { - prevIdx = ptIdx > (contours[contIdx - 1] + 1) ? ptIdx - 1 - : contours[contIdx]; - nextIdx = ptIdx < contours[contIdx] ? ptIdx + 1 - : contours[contIdx - 1] + 1; - } - - // get vectors to previous and next point and normalize them; - QVector2D in(qreal(points[prevIdx].x - points[ptIdx].x) / 64, - -qreal(points[prevIdx].y - points[ptIdx].y) / 64); - QVector2D out(qreal(points[nextIdx].x - points[ptIdx].x) / 64, - -qreal(points[nextIdx].y - points[ptIdx].y) / 64); - - in = in.normalized(); - out = out.normalized(); - - QVector2D middle = in + out; - // check whether vector is very small, using a threshold of 1/8px - if (qAbs(middle.x()) < 1.0 / 8 - && qAbs(middle.y()) < 1.0 / 8) - { - // in case of vectors in almost exactly opposite directions, - // use a vector orthogonal to them - middle.setX(out.y()); - middle.setY(-out.x()); - - if (qAbs(middle.x()) < 1.0 / 8 - && qAbs(middle.y()) < 1.0 / 8) - { - // use direction based on point index for the offset - // if we still don't have a good value - middle = octants[ptIdx % 8]; - } - } - - // normalize `middle' vector (which is never zero), - // then multiply by 8 to get some distance between - // the point and the number - middle = middle.normalized() * 8; - - // we now position the point number in the opposite - // direction of the `middle' vector, - QString number = QString::number(ptIdx); - -#if 0 - // this fails, see comment above - int size = 10000; - qreal x = qreal(points[ptIdx].x) / 64 - middle.x() / lod; - qreal y = -qreal(points[ptIdx].y) / 64 - middle.y() / lod; - QPointF corner(x, y); - int flags = middle.x() > 0 ? Qt::AlignRight - : Qt::AlignLeft; - if (flags == Qt::AlignRight) - corner.rx() -= size; - QRectF posRect(corner, QSizeF(size, size)); - - if (tags[ptIdx] & FT_CURVE_TAG_ON) - painter->setPen(onPen); - else - painter->setPen(offPen); - - painter->drawText(posRect, flags, number); -#else - // convert text string to a path object - QPainterPath path; - path.addText(QPointF(0, 0), font, number); - QRectF ctrlPtRect = path.controlPointRect(); - - qreal x = qreal(points[ptIdx].x) / 64 * lod - middle.x(); - qreal y = -qreal(points[ptIdx].y) / 64 * lod - middle.y(); - - qreal heuristicOffset = 2; - if (middle.x() > 0) - path.translate(x - ctrlPtRect.width() - heuristicOffset, - y + ctrlPtRect.height() / 2); - else - path.translate(x, - y + ctrlPtRect.height() / 2); - - painter->fillPath(path, - tags[ptIdx] & FT_CURVE_TAG_ON ? onBrush - : offBrush); -#endif - - ptIdx++; - if (ptIdx > contours[contIdx]) - break; - } - } - } -} - - -///////////////////////////////////////////////////////////////////////////// -// -// GlyphBitmap -// -///////////////////////////////////////////////////////////////////////////// - -GlyphBitmap::GlyphBitmap(FT_Outline* outline, - FT_Library lib, - int pxlMode, - const QVector& monoColorTbl, - const QVector& grayColorTbl) -: library(lib), - pixelMode(pxlMode), - monoColorTable(monoColorTbl), - grayColorTable(grayColorTbl) -{ - // make a copy of the outline since we are going to manipulate it - FT_Outline_New(library, - outline->n_points, - outline->n_contours, - &transformed); - FT_Outline_Copy(outline, &transformed); - - FT_BBox cbox; - FT_Outline_Get_CBox(outline, &cbox); - - cbox.xMin &= ~63; - cbox.yMin &= ~63; - cbox.xMax = (cbox.xMax + 63) & ~63; - cbox.yMax = (cbox.yMax + 63) & ~63; - - // we shift the outline to the origin for rendering later on - FT_Outline_Translate(&transformed, -cbox.xMin, -cbox.yMin); - - bRect.setCoords(cbox.xMin / 64, -cbox.yMax / 64, - cbox.xMax / 64, -cbox.yMin / 64); -} - - -GlyphBitmap::~GlyphBitmap() -{ - FT_Outline_Done(library, &transformed); -} - - -QRectF -GlyphBitmap::boundingRect() const -{ - return bRect; -} - - -void -GlyphBitmap::paint(QPainter* painter, - const QStyleOptionGraphicsItem* option, - QWidget*) -{ - FT_Bitmap bitmap; - - int height = bRect.height(); - int width = bRect.width(); - QImage::Format format = QImage::Format_Indexed8; - - // XXX cover LCD and color - if (pixelMode == FT_PIXEL_MODE_MONO) - format = QImage::Format_Mono; - - QImage image(QSize(width, height), format); - - if (pixelMode == FT_PIXEL_MODE_MONO) - image.setColorTable(monoColorTable); - else - image.setColorTable(grayColorTable); - - image.fill(0); - - bitmap.rows = height; - bitmap.width = width; - bitmap.buffer = const_cast(image.constBits()); - bitmap.pitch = image.bytesPerLine(); - bitmap.pixel_mode = pixelMode; - - FT_Error error = FT_Outline_Get_Bitmap(library, - &transformed, - &bitmap); - if (error) - { - // XXX error handling - return; - } - - // `drawImage' doesn't work as expected: - // the larger the zoom, the more the pixel rectangle positions - // deviate from the grid lines -#if 0 - painter->drawImage(QPoint(bRect.left(), bRect.top()), - image.convertToFormat( - QImage::Format_ARGB32_Premultiplied)); -#else - const qreal lod = option->levelOfDetailFromTransform( - painter->worldTransform()); - - painter->setPen(Qt::NoPen); - - for (int x = 0; x < image.width(); x++) - for (int y = 0; y < image.height(); y++) - { - // be careful not to lose the alpha channel - QRgb p = image.pixel(x, y); - painter->fillRect(QRectF(x + bRect.left() - 1 / lod / 2, - y + bRect.top() - 1 / lod / 2, - 1 + 1 / lod, - 1 + 1 / lod), - QColor(qRed(p), - qGreen(p), - qBlue(p), - qAlpha(p))); - } -#endif -} - - -///////////////////////////////////////////////////////////////////////////// -// -// MainGUI -// -///////////////////////////////////////////////////////////////////////////// - -MainGUI::MainGUI() -{ - engine = NULL; - - fontWatcher = new QFileSystemWatcher; - // if the current input file is invalid we retry once a second to load it - timer = new QTimer; - timer->setInterval(1000); - - setGraphicsDefaults(); - createLayout(); - createConnections(); - createActions(); - createMenus(); - createStatusBar(); - - readSettings(); - - setUnifiedTitleAndToolBarOnMac(true); -} - - -MainGUI::~MainGUI() -{ - // empty -} - - -void -MainGUI::update(Engine* e) -{ - engine = e; -} - - -// overloading - -void -MainGUI::closeEvent(QCloseEvent* event) -{ - writeSettings(); - event->accept(); -} - - -void -MainGUI::about() -{ - QMessageBox::about( - this, - tr("About ftinspect"), - tr("

This is ftinspect version %1
" - " Copyright %2 2016
" - " by Werner Lemberg <wl@gnu.org>

" - "" - "

ftinspect shows how a font gets rendered" - " by FreeType, allowing control over virtually" - " all rendering parameters.

" - "" - "

License:" - " FreeType" - " License (FTL) or" - " GNU" - " GPLv2

") - .arg(VERSION) - .arg(QChar(0xA9))); -} - - -void -MainGUI::aboutQt() -{ - QApplication::aboutQt(); -} - - -void -MainGUI::loadFonts() -{ - int oldSize = fontList.size(); - - QStringList files = QFileDialog::getOpenFileNames( - this, - tr("Load one or more fonts"), - QDir::homePath(), - "", - NULL, - QFileDialog::ReadOnly); - - // XXX sort data, uniquify elements - fontList.append(files); - - // if we have new fonts, set the current index to the first new one - if (oldSize < fontList.size()) - currentFontIndex = oldSize; - - showFont(); -} - - -void -MainGUI::closeFont() -{ - if (currentFontIndex < fontList.size()) - { - engine->removeFont(currentFontIndex); - fontWatcher->removePath(fontList[currentFontIndex]); - fontList.removeAt(currentFontIndex); - } - - // show next font after deletion, i.e., retain index if possible - if (fontList.size()) - { - if (currentFontIndex >= fontList.size()) - currentFontIndex = fontList.size() - 1; - } - else - currentFontIndex = 0; - - showFont(); -} - - -void -MainGUI::watchCurrentFont() -{ - timer->stop(); - showFont(); -} - - -void -MainGUI::showFont() -{ - // we do lazy computation of FT_Face objects - - if (currentFontIndex < fontList.size()) - { - QString& font = fontList[currentFontIndex]; - QFileInfo fileInfo(font); - QString fontName = fileInfo.fileName(); - - if (fileInfo.exists()) - { - // Qt's file watcher doesn't handle symlinks; - // we thus fall back to polling - if (fileInfo.isSymLink()) - { - fontName.prepend(""); - fontName.append(""); - timer->start(); - } - else - fontWatcher->addPath(font); - } - else - { - // On Unix-like systems, the symlink's target gets opened; this - // implies that deletion of a symlink doesn't make `engine->loadFont' - // fail since it operates on a file handle pointing to the target. - // For this reason, we remove the font to enforce a reload. - engine->removeFont(currentFontIndex); - } - - fontFilenameLabel->setText(fontName); - } - else - fontFilenameLabel->clear(); - - currentNumberOfFaces - = engine->numberOfFaces(currentFontIndex); - currentNumberOfNamedInstances - = engine->numberOfNamedInstances(currentFontIndex, - currentFaceIndex); - currentNumberOfGlyphs - = engine->loadFont(currentFontIndex, - currentFaceIndex, - currentNamedInstanceIndex); - - if (currentNumberOfGlyphs < 0) - { - // there might be various reasons why the current - // (file, face, instance) triplet is invalid or missing; - // we thus start our timer to periodically test - // whether the font starts working - if (currentFontIndex < fontList.size()) - timer->start(); - } - - fontNameLabel->setText(QString("%1 %2") - .arg(engine->currentFamilyName()) - .arg(engine->currentStyleName())); - - checkCurrentFontIndex(); - checkCurrentFaceIndex(); - checkCurrentNamedInstanceIndex(); - checkHinting(); - adjustGlyphIndex(0); - - drawGlyph(); -} - - -void -MainGUI::checkHinting() -{ - if (hintingCheckBox->isChecked()) - { - if (engine->fontType == Engine::FontType_CFF) - { - for (int i = 0; i < hintingModeComboBoxx->count(); i++) - { - if (hintingModesCFFHash.key(i, -1) != -1) - hintingModeComboBoxx->setItemEnabled(i, true); - else - hintingModeComboBoxx->setItemEnabled(i, false); - } - - hintingModeComboBoxx->setCurrentIndex(currentCFFHintingMode); - } - else if (engine->fontType == Engine::FontType_TrueType) - { - for (int i = 0; i < hintingModeComboBoxx->count(); i++) - { - if (hintingModesTrueTypeHash.key(i, -1) != -1) - hintingModeComboBoxx->setItemEnabled(i, true); - else - hintingModeComboBoxx->setItemEnabled(i, false); - } - - hintingModeComboBoxx->setCurrentIndex(currentTTInterpreterVersion); - } - else - { - hintingModeLabel->setEnabled(false); - hintingModeComboBoxx->setEnabled(false); - } - - for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++) - hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i], - false); - - autoHintingCheckBox->setEnabled(true); - checkAutoHinting(); - } - else - { - hintingModeLabel->setEnabled(false); - hintingModeComboBoxx->setEnabled(false); - - autoHintingCheckBox->setEnabled(false); - horizontalHintingCheckBox->setEnabled(false); - verticalHintingCheckBox->setEnabled(false); - blueZoneHintingCheckBox->setEnabled(false); - segmentDrawingCheckBox->setEnabled(false); - warpingCheckBox->setEnabled(false); - - antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Slight, false); - } - - drawGlyph(); -} - - -void -MainGUI::checkHintingMode() -{ - int index = hintingModeComboBoxx->currentIndex(); - - if (engine->fontType == Engine::FontType_CFF) - { - engine->setCFFHintingMode(index); - currentCFFHintingMode = index; - } - else if (engine->fontType == Engine::FontType_TrueType) - { - engine->setTTInterpreterVersion(index); - currentTTInterpreterVersion = index; - } - - // this enforces reloading of the font - showFont(); -} - - -void -MainGUI::checkAutoHinting() -{ - if (autoHintingCheckBox->isChecked()) - { - hintingModeLabel->setEnabled(false); - hintingModeComboBoxx->setEnabled(false); - - horizontalHintingCheckBox->setEnabled(true); - verticalHintingCheckBox->setEnabled(true); - blueZoneHintingCheckBox->setEnabled(true); - segmentDrawingCheckBox->setEnabled(true); - if (engine->haveWarping) - warpingCheckBox->setEnabled(true); - - antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Slight, true); - } - else - { - if (engine->fontType == Engine::FontType_CFF - || engine->fontType == Engine::FontType_TrueType) - { - hintingModeLabel->setEnabled(true); - hintingModeComboBoxx->setEnabled(true); - } - - horizontalHintingCheckBox->setEnabled(false); - verticalHintingCheckBox->setEnabled(false); - blueZoneHintingCheckBox->setEnabled(false); - segmentDrawingCheckBox->setEnabled(false); - warpingCheckBox->setEnabled(false); - - antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Slight, false); - - if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_Slight) - antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal); - } - - drawGlyph(); -} - - -void -MainGUI::checkAntiAliasing() -{ - int index = antiAliasingComboBoxx->currentIndex(); - - if (index == AntiAliasing_None - || index == AntiAliasing_Normal - || index == AntiAliasing_Slight) - { - lcdFilterLabel->setEnabled(false); - lcdFilterComboBox->setEnabled(false); - } - else - { - lcdFilterLabel->setEnabled(true); - lcdFilterComboBox->setEnabled(true); - } - - drawGlyph(); -} - - -void -MainGUI::checkLcdFilter() -{ - int index = lcdFilterComboBox->currentIndex(); - FT_Library_SetLcdFilter(engine->library, lcdFilterHash.key(index)); -} - - -void -MainGUI::checkShowPoints() -{ - if (showPointsCheckBox->isChecked()) - showPointNumbersCheckBox->setEnabled(true); - else - showPointNumbersCheckBox->setEnabled(false); - - drawGlyph(); -} - - -void -MainGUI::checkUnits() -{ - int index = unitsComboBox->currentIndex(); - - if (index == Units_px) - { - dpiLabel->setEnabled(false); - dpiSpinBox->setEnabled(false); - sizeDoubleSpinBox->setSingleStep(1); - sizeDoubleSpinBox->setValue(qRound(sizeDoubleSpinBox->value())); - } - else - { - dpiLabel->setEnabled(true); - dpiSpinBox->setEnabled(true); - sizeDoubleSpinBox->setSingleStep(0.5); - } - - drawGlyph(); -} - - -void -MainGUI::adjustGlyphIndex(int delta) -{ - // only adjust current glyph index if we have a valid font - if (currentNumberOfGlyphs > 0) - { - currentGlyphIndex += delta; - currentGlyphIndex = qBound(0, - currentGlyphIndex, - currentNumberOfGlyphs - 1); - } - - QString upperHex = QString::number(currentGlyphIndex, 16).toUpper(); - glyphIndexLabel->setText(QString("%1 (0x%2)") - .arg(currentGlyphIndex) - .arg(upperHex)); - glyphNameLabel->setText(engine->glyphName(currentGlyphIndex)); - - drawGlyph(); -} - - -void -MainGUI::checkCurrentFontIndex() -{ - if (fontList.size() < 2) - { - previousFontButton->setEnabled(false); - nextFontButton->setEnabled(false); - } - else if (currentFontIndex == 0) - { - previousFontButton->setEnabled(false); - nextFontButton->setEnabled(true); - } - else if (currentFontIndex >= fontList.size() - 1) - { - previousFontButton->setEnabled(true); - nextFontButton->setEnabled(false); - } - else - { - previousFontButton->setEnabled(true); - nextFontButton->setEnabled(true); - } -} - - -void -MainGUI::checkCurrentFaceIndex() -{ - if (currentNumberOfFaces < 2) - { - previousFaceButton->setEnabled(false); - nextFaceButton->setEnabled(false); - } - else if (currentFaceIndex == 0) - { - previousFaceButton->setEnabled(false); - nextFaceButton->setEnabled(true); - } - else if (currentFaceIndex >= currentNumberOfFaces - 1) - { - previousFaceButton->setEnabled(true); - nextFaceButton->setEnabled(false); - } - else - { - previousFaceButton->setEnabled(true); - nextFaceButton->setEnabled(true); - } -} - - -void -MainGUI::checkCurrentNamedInstanceIndex() -{ - if (currentNumberOfNamedInstances < 2) - { - previousNamedInstanceButton->setEnabled(false); - nextNamedInstanceButton->setEnabled(false); - } - else if (currentNamedInstanceIndex == 0) - { - previousNamedInstanceButton->setEnabled(false); - nextNamedInstanceButton->setEnabled(true); - } - else if (currentNamedInstanceIndex >= currentNumberOfNamedInstances - 1) - { - previousNamedInstanceButton->setEnabled(true); - nextNamedInstanceButton->setEnabled(false); - } - else - { - previousNamedInstanceButton->setEnabled(true); - nextNamedInstanceButton->setEnabled(true); - } -} - - -void -MainGUI::previousFont() -{ - if (currentFontIndex > 0) - { - currentFontIndex--; - currentFaceIndex = 0; - currentNamedInstanceIndex = 0; - showFont(); - } -} - - -void -MainGUI::nextFont() -{ - if (currentFontIndex < fontList.size() - 1) - { - currentFontIndex++; - currentFaceIndex = 0; - currentNamedInstanceIndex = 0; - showFont(); - } -} - - -void -MainGUI::previousFace() -{ - if (currentFaceIndex > 0) - { - currentFaceIndex--; - currentNamedInstanceIndex = 0; - showFont(); - } -} - - -void -MainGUI::nextFace() -{ - if (currentFaceIndex < currentNumberOfFaces - 1) - { - currentFaceIndex++; - currentNamedInstanceIndex = 0; - showFont(); - } -} - - -void -MainGUI::previousNamedInstance() -{ - if (currentNamedInstanceIndex > 0) - { - currentNamedInstanceIndex--; - showFont(); - } -} - - -void -MainGUI::nextNamedInstance() -{ - if (currentNamedInstanceIndex < currentNumberOfNamedInstances - 1) - { - currentNamedInstanceIndex++; - showFont(); - } -} - - -void -MainGUI::zoom() -{ - int scale = zoomSpinBox->value(); - - QTransform transform; - transform.scale(scale, scale); - - // we want horizontal and vertical 1px lines displayed with full pixels; - // we thus have to shift the coordinate system accordingly, using a value - // that represents 0.5px (i.e., half the 1px line width) after the scaling - qreal shift = 0.5 / scale; - transform.translate(shift, shift); - - glyphView->setTransform(transform); -} - - -void -MainGUI::setGraphicsDefaults() -{ - // color tables (with suitable opacity values) for converting - // FreeType's pixmaps to something Qt understands - monoColorTable.append(0x00FFFFFF); - monoColorTable.append(0xFF000000); - - for (int i = 0xFF; i >= 0; i--) - grayColorTable.append((0xFF - i) << 24 - | i << 16 - | i << 8 - | i); - - // XXX make this user-configurable - - axisPen.setColor(QColor(0, 0, 0, 255)); // black - axisPen.setWidth(0); - blueZonePen.setColor(QColor(64, 64, 255, 64)); // light blue - blueZonePen.setWidth(0); - gridPen.setColor(QColor(192, 192, 192, 255)); // gray - gridPen.setWidth(0); - offPen.setColor(QColor(0, 128, 0, 255)); // dark green - offPen.setWidth(3); - onPen.setColor(QColor(255, 0, 0, 255)); // red - onPen.setWidth(3); - outlinePen.setColor(QColor(255, 0, 0, 255)); // red - outlinePen.setWidth(0); - segmentPen.setColor(QColor(64, 255, 128, 64)); // light green - segmentPen.setWidth(0); -} - - -void -MainGUI::drawGlyph() -{ - // the call to `engine->loadOutline' updates FreeType's load flags - - if (!engine) - return; - - if (currentGlyphBitmapItem) - { - glyphScene->removeItem(currentGlyphBitmapItem); - delete currentGlyphBitmapItem; - - currentGlyphBitmapItem = NULL; - } - - if (currentGlyphOutlineItem) - { - glyphScene->removeItem(currentGlyphOutlineItem); - delete currentGlyphOutlineItem; - - currentGlyphOutlineItem = NULL; - } - - if (currentGlyphPointsItem) - { - glyphScene->removeItem(currentGlyphPointsItem); - delete currentGlyphPointsItem; - - currentGlyphPointsItem = NULL; - } - - if (currentGlyphPointNumbersItem) - { - glyphScene->removeItem(currentGlyphPointNumbersItem); - delete currentGlyphPointNumbersItem; - - currentGlyphPointNumbersItem = NULL; - } - - FT_Outline* outline = engine->loadOutline(currentGlyphIndex); - if (outline) - { - if (showBitmapCheckBox->isChecked()) - { - // XXX support LCD - int pixelMode = FT_PIXEL_MODE_GRAY; - if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_None) - pixelMode = FT_PIXEL_MODE_MONO; - - currentGlyphBitmapItem = new GlyphBitmap(outline, - engine->library, - pixelMode, - monoColorTable, - grayColorTable); - glyphScene->addItem(currentGlyphBitmapItem); - } - - if (showOutlinesCheckBox->isChecked()) - { - currentGlyphOutlineItem = new GlyphOutline(outlinePen, outline); - glyphScene->addItem(currentGlyphOutlineItem); - } - - if (showPointsCheckBox->isChecked()) - { - currentGlyphPointsItem = new GlyphPoints(onPen, offPen, outline); - glyphScene->addItem(currentGlyphPointsItem); - - if (showPointNumbersCheckBox->isChecked()) - { - currentGlyphPointNumbersItem = new GlyphPointNumbers(onPen, - offPen, - outline); - glyphScene->addItem(currentGlyphPointNumbersItem); - } - } - } - - glyphScene->update(); -} - - -// XXX distances are specified in pixels, -// making the layout dependent on the output device resolution -void -MainGUI::createLayout() -{ - // left side - fontFilenameLabel = new QLabel; - - hintingCheckBox = new QCheckBox(tr("Hinting")); - - hintingModeLabel = new QLabel(tr("Hinting Mode")); - hintingModeLabel->setAlignment(Qt::AlignRight); - hintingModeComboBoxx = new QComboBoxx; - hintingModeComboBoxx->insertItem(HintingMode_TrueType_v35, - tr("TrueType v35")); - hintingModeComboBoxx->insertItem(HintingMode_TrueType_v38, - tr("TrueType v38")); - hintingModeComboBoxx->insertItem(HintingMode_TrueType_v40, - tr("TrueType v40")); - hintingModeComboBoxx->insertItem(HintingMode_CFF_FreeType, - tr("CFF (FreeType)")); - hintingModeComboBoxx->insertItem(HintingMode_CFF_Adobe, - tr("CFF (Adobe)")); - hintingModeLabel->setBuddy(hintingModeComboBoxx); - - autoHintingCheckBox = new QCheckBox(tr("Auto-Hinting")); - horizontalHintingCheckBox = new QCheckBox(tr("Horizontal Hinting")); - verticalHintingCheckBox = new QCheckBox(tr("Vertical Hinting")); - blueZoneHintingCheckBox = new QCheckBox(tr("Blue-Zone Hinting")); - segmentDrawingCheckBox = new QCheckBox(tr("Segment Drawing")); - warpingCheckBox = new QCheckBox(tr("Warping")); - - antiAliasingLabel = new QLabel(tr("Anti-Aliasing")); - antiAliasingLabel->setAlignment(Qt::AlignRight); - antiAliasingComboBoxx = new QComboBoxx; - antiAliasingComboBoxx->insertItem(AntiAliasing_None, - tr("None")); - antiAliasingComboBoxx->insertItem(AntiAliasing_Normal, - tr("Normal")); - antiAliasingComboBoxx->insertItem(AntiAliasing_Slight, - tr("Slight")); - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD, - tr("LCD (RGB)")); - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_BGR, - tr("LCD (BGR)")); - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical, - tr("LCD (vert. RGB)")); - antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical_BGR, - tr("LCD (vert. BGR)")); - antiAliasingLabel->setBuddy(antiAliasingComboBoxx); - - lcdFilterLabel = new QLabel(tr("LCD Filter")); - lcdFilterLabel->setAlignment(Qt::AlignRight); - lcdFilterComboBox = new QComboBox; - lcdFilterComboBox->insertItem(LCDFilter_Default, tr("Default")); - lcdFilterComboBox->insertItem(LCDFilter_Light, tr("Light")); - lcdFilterComboBox->insertItem(LCDFilter_None, tr("None")); - lcdFilterComboBox->insertItem(LCDFilter_Legacy, tr("Legacy")); - lcdFilterLabel->setBuddy(lcdFilterComboBox); - - int width; - // make all labels have the same width - width = hintingModeLabel->minimumSizeHint().width(); - width = qMax(antiAliasingLabel->minimumSizeHint().width(), width); - width = qMax(lcdFilterLabel->minimumSizeHint().width(), width); - hintingModeLabel->setMinimumWidth(width); - antiAliasingLabel->setMinimumWidth(width); - lcdFilterLabel->setMinimumWidth(width); - - // ensure that all items in combo boxes fit completely; - // also make all combo boxes have the same width - width = hintingModeComboBoxx->minimumSizeHint().width(); - width = qMax(antiAliasingComboBoxx->minimumSizeHint().width(), width); - width = qMax(lcdFilterComboBox->minimumSizeHint().width(), width); - hintingModeComboBoxx->setMinimumWidth(width); - antiAliasingComboBoxx->setMinimumWidth(width); - lcdFilterComboBox->setMinimumWidth(width); - - gammaLabel = new QLabel(tr("Gamma")); - gammaLabel->setAlignment(Qt::AlignRight); - gammaSlider = new QSlider(Qt::Horizontal); - gammaSlider->setRange(0, 30); // in 1/10th - gammaSlider->setTickPosition(QSlider::TicksBelow); - gammaSlider->setTickInterval(5); - gammaLabel->setBuddy(gammaSlider); - - showBitmapCheckBox = new QCheckBox(tr("Show Bitmap")); - showPointsCheckBox = new QCheckBox(tr("Show Points")); - showPointNumbersCheckBox = new QCheckBox(tr("Show Point Numbers")); - showOutlinesCheckBox = new QCheckBox(tr("Show Outlines")); - - infoLeftLayout = new QHBoxLayout; - infoLeftLayout->addWidget(fontFilenameLabel); - - hintingModeLayout = new QHBoxLayout; - hintingModeLayout->addWidget(hintingModeLabel); - hintingModeLayout->addWidget(hintingModeComboBoxx); - - horizontalHintingLayout = new QHBoxLayout; - horizontalHintingLayout->addSpacing(20); // XXX px - horizontalHintingLayout->addWidget(horizontalHintingCheckBox); - - verticalHintingLayout = new QHBoxLayout; - verticalHintingLayout->addSpacing(20); // XXX px - verticalHintingLayout->addWidget(verticalHintingCheckBox); - - blueZoneHintingLayout = new QHBoxLayout; - blueZoneHintingLayout->addSpacing(20); // XXX px - blueZoneHintingLayout->addWidget(blueZoneHintingCheckBox); - - segmentDrawingLayout = new QHBoxLayout; - segmentDrawingLayout->addSpacing(20); // XXX px - segmentDrawingLayout->addWidget(segmentDrawingCheckBox); - - warpingLayout = new QHBoxLayout; - warpingLayout->addSpacing(20); // XXX px - warpingLayout->addWidget(warpingCheckBox); - - antiAliasingLayout = new QHBoxLayout; - antiAliasingLayout->addWidget(antiAliasingLabel); - antiAliasingLayout->addWidget(antiAliasingComboBoxx); - - lcdFilterLayout = new QHBoxLayout; - lcdFilterLayout->addWidget(lcdFilterLabel); - lcdFilterLayout->addWidget(lcdFilterComboBox); - - gammaLayout = new QHBoxLayout; - gammaLayout->addWidget(gammaLabel); - gammaLayout->addWidget(gammaSlider); - - pointNumbersLayout = new QHBoxLayout; - pointNumbersLayout->addSpacing(20); // XXX px - pointNumbersLayout->addWidget(showPointNumbersCheckBox); - - generalTabLayout = new QVBoxLayout; - generalTabLayout->addWidget(hintingCheckBox); - generalTabLayout->addLayout(hintingModeLayout); - generalTabLayout->addWidget(autoHintingCheckBox); - generalTabLayout->addLayout(horizontalHintingLayout); - generalTabLayout->addLayout(verticalHintingLayout); - generalTabLayout->addLayout(blueZoneHintingLayout); - generalTabLayout->addLayout(segmentDrawingLayout); - generalTabLayout->addLayout(warpingLayout); - generalTabLayout->addSpacing(20); // XXX px - generalTabLayout->addStretch(1); - generalTabLayout->addLayout(antiAliasingLayout); - generalTabLayout->addLayout(lcdFilterLayout); - generalTabLayout->addSpacing(20); // XXX px - generalTabLayout->addStretch(1); - generalTabLayout->addLayout(gammaLayout); - generalTabLayout->addSpacing(20); // XXX px - generalTabLayout->addStretch(1); - generalTabLayout->addWidget(showBitmapCheckBox); - generalTabLayout->addWidget(showPointsCheckBox); - generalTabLayout->addLayout(pointNumbersLayout); - generalTabLayout->addWidget(showOutlinesCheckBox); - - generalTabWidget = new QWidget; - generalTabWidget->setLayout(generalTabLayout); - - mmgxTabWidget = new QWidget; - - tabWidget = new QTabWidget; - tabWidget->addTab(generalTabWidget, tr("General")); - tabWidget->addTab(mmgxTabWidget, tr("MM/GX")); - - leftLayout = new QVBoxLayout; - leftLayout->addLayout(infoLeftLayout); - leftLayout->addWidget(tabWidget); - - // we don't want to expand the left side horizontally; - // to change the policy we have to use a widget wrapper - leftWidget = new QWidget; - leftWidget->setLayout(leftLayout); - - QSizePolicy leftWidgetPolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); - leftWidgetPolicy.setHorizontalStretch(0); - leftWidgetPolicy.setVerticalPolicy(leftWidget->sizePolicy().verticalPolicy()); - leftWidgetPolicy.setHeightForWidth(leftWidget->sizePolicy().hasHeightForWidth()); - - leftWidget->setSizePolicy(leftWidgetPolicy); - - // right side - glyphIndexLabel = new QLabel; - glyphNameLabel = new QLabel; - fontNameLabel = new QLabel; - - glyphScene = new QGraphicsScene; - glyphScene->addItem(new Grid(gridPen, axisPen)); - - currentGlyphBitmapItem = NULL; - currentGlyphOutlineItem = NULL; - currentGlyphPointsItem = NULL; - currentGlyphPointNumbersItem = NULL; - drawGlyph(); - - glyphView = new QGraphicsViewx; - glyphView->setRenderHint(QPainter::Antialiasing, true); - glyphView->setDragMode(QGraphicsView::ScrollHandDrag); - glyphView->setOptimizationFlags(QGraphicsView::DontSavePainterState); - glyphView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); - glyphView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); - glyphView->setScene(glyphScene); - - sizeLabel = new QLabel(tr("Size ")); - sizeLabel->setAlignment(Qt::AlignRight); - sizeDoubleSpinBox = new QDoubleSpinBox; - sizeDoubleSpinBox->setAlignment(Qt::AlignRight); - sizeDoubleSpinBox->setDecimals(1); - sizeDoubleSpinBox->setRange(1, 500); - sizeLabel->setBuddy(sizeDoubleSpinBox); - - unitsComboBox = new QComboBox; - unitsComboBox->insertItem(Units_px, "px"); - unitsComboBox->insertItem(Units_pt, "pt"); - - dpiLabel = new QLabel(tr("DPI ")); - dpiLabel->setAlignment(Qt::AlignRight); - dpiSpinBox = new QSpinBox; - dpiSpinBox->setAlignment(Qt::AlignRight); - dpiSpinBox->setRange(10, 600); - dpiLabel->setBuddy(dpiSpinBox); - - toStartButtonx = new QPushButtonx("|<"); - toM1000Buttonx = new QPushButtonx("-1000"); - toM100Buttonx = new QPushButtonx("-100"); - toM10Buttonx = new QPushButtonx("-10"); - toM1Buttonx = new QPushButtonx("-1"); - toP1Buttonx = new QPushButtonx("+1"); - toP10Buttonx = new QPushButtonx("+10"); - toP100Buttonx = new QPushButtonx("+100"); - toP1000Buttonx = new QPushButtonx("+1000"); - toEndButtonx = new QPushButtonx(">|"); - - zoomLabel = new QLabel(tr("Zoom Factor")); - zoomLabel->setAlignment(Qt::AlignRight); - zoomSpinBox = new QSpinBoxx; - zoomSpinBox->setAlignment(Qt::AlignRight); - zoomSpinBox->setRange(1, 1000 - 1000 % 64); - zoomSpinBox->setKeyboardTracking(false); - zoomLabel->setBuddy(zoomSpinBox); - - previousFontButton = new QPushButton(tr("Previous Font")); - nextFontButton = new QPushButton(tr("Next Font")); - previousFaceButton = new QPushButton(tr("Previous Face")); - nextFaceButton = new QPushButton(tr("Next Face")); - previousNamedInstanceButton = new QPushButton(tr("Previous Named Instance")); - nextNamedInstanceButton = new QPushButton(tr("Next Named Instance")); - - infoRightLayout = new QGridLayout; - infoRightLayout->addWidget(glyphIndexLabel, 0, 0); - infoRightLayout->addWidget(glyphNameLabel, 0, 1); - infoRightLayout->addWidget(fontNameLabel, 0, 2); - - navigationLayout = new QHBoxLayout; - navigationLayout->setSpacing(0); - navigationLayout->addStretch(1); - navigationLayout->addWidget(toStartButtonx); - navigationLayout->addWidget(toM1000Buttonx); - navigationLayout->addWidget(toM100Buttonx); - navigationLayout->addWidget(toM10Buttonx); - navigationLayout->addWidget(toM1Buttonx); - navigationLayout->addWidget(toP1Buttonx); - navigationLayout->addWidget(toP10Buttonx); - navigationLayout->addWidget(toP100Buttonx); - navigationLayout->addWidget(toP1000Buttonx); - navigationLayout->addWidget(toEndButtonx); - navigationLayout->addStretch(1); - - sizeLayout = new QHBoxLayout; - sizeLayout->addStretch(2); - sizeLayout->addWidget(sizeLabel); - sizeLayout->addWidget(sizeDoubleSpinBox); - sizeLayout->addWidget(unitsComboBox); - sizeLayout->addStretch(1); - sizeLayout->addWidget(dpiLabel); - sizeLayout->addWidget(dpiSpinBox); - sizeLayout->addStretch(1); - sizeLayout->addWidget(zoomLabel); - sizeLayout->addWidget(zoomSpinBox); - sizeLayout->addStretch(2); - - fontLayout = new QGridLayout; - fontLayout->setColumnStretch(0, 2); - fontLayout->addWidget(nextFontButton, 0, 1); - fontLayout->addWidget(previousFontButton, 1, 1); - fontLayout->setColumnStretch(2, 1); - fontLayout->addWidget(nextFaceButton, 0, 3); - fontLayout->addWidget(previousFaceButton, 1, 3); - fontLayout->setColumnStretch(4, 1); - fontLayout->addWidget(nextNamedInstanceButton, 0, 5); - fontLayout->addWidget(previousNamedInstanceButton, 1, 5); - fontLayout->setColumnStretch(6, 2); - - rightLayout = new QVBoxLayout; - rightLayout->addLayout(infoRightLayout); - rightLayout->addWidget(glyphView); - rightLayout->addLayout(navigationLayout); - rightLayout->addSpacing(10); // XXX px - rightLayout->addLayout(sizeLayout); - rightLayout->addSpacing(10); // XXX px - rightLayout->addLayout(fontLayout); - - // for symmetry with the left side use a widget also - rightWidget = new QWidget; - rightWidget->setLayout(rightLayout); - - // the whole thing - ftinspectLayout = new QHBoxLayout; - ftinspectLayout->addWidget(leftWidget); - ftinspectLayout->addWidget(rightWidget); - - ftinspectWidget = new QWidget; - ftinspectWidget->setLayout(ftinspectLayout); - setCentralWidget(ftinspectWidget); - setWindowTitle("ftinspect"); -} - - -void -MainGUI::createConnections() -{ - connect(hintingCheckBox, SIGNAL(clicked()), - SLOT(checkHinting())); - - connect(hintingModeComboBoxx, SIGNAL(currentIndexChanged(int)), - SLOT(checkHintingMode())); - connect(antiAliasingComboBoxx, SIGNAL(currentIndexChanged(int)), - SLOT(checkAntiAliasing())); - connect(lcdFilterComboBox, SIGNAL(currentIndexChanged(int)), - SLOT(checkLcdFilter())); - - connect(autoHintingCheckBox, SIGNAL(clicked()), - SLOT(checkAutoHinting())); - connect(showBitmapCheckBox, SIGNAL(clicked()), - SLOT(drawGlyph())); - connect(showPointsCheckBox, SIGNAL(clicked()), - SLOT(checkShowPoints())); - connect(showPointNumbersCheckBox, SIGNAL(clicked()), - SLOT(drawGlyph())); - connect(showOutlinesCheckBox, SIGNAL(clicked()), - SLOT(drawGlyph())); - - connect(sizeDoubleSpinBox, SIGNAL(valueChanged(double)), - SLOT(drawGlyph())); - connect(unitsComboBox, SIGNAL(currentIndexChanged(int)), - SLOT(checkUnits())); - connect(dpiSpinBox, SIGNAL(valueChanged(int)), - SLOT(drawGlyph())); - - connect(zoomSpinBox, SIGNAL(valueChanged(int)), - SLOT(zoom())); - - connect(previousFontButton, SIGNAL(clicked()), - SLOT(previousFont())); - connect(nextFontButton, SIGNAL(clicked()), - SLOT(nextFont())); - connect(previousFaceButton, SIGNAL(clicked()), - SLOT(previousFace())); - connect(nextFaceButton, SIGNAL(clicked()), - SLOT(nextFace())); - connect(previousNamedInstanceButton, SIGNAL(clicked()), - SLOT(previousNamedInstance())); - connect(nextNamedInstanceButton, SIGNAL(clicked()), - SLOT(nextNamedInstance())); - - glyphNavigationMapper = new QSignalMapper; - connect(glyphNavigationMapper, SIGNAL(mapped(int)), - SLOT(adjustGlyphIndex(int))); - - connect(toStartButtonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toM1000Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toM100Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toM10Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toM1Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toP1Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toP10Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toP100Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toP1000Buttonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - connect(toEndButtonx, SIGNAL(clicked()), - glyphNavigationMapper, SLOT(map())); - - glyphNavigationMapper->setMapping(toStartButtonx, -0x10000); - glyphNavigationMapper->setMapping(toM1000Buttonx, -1000); - glyphNavigationMapper->setMapping(toM100Buttonx, -100); - glyphNavigationMapper->setMapping(toM10Buttonx, -10); - glyphNavigationMapper->setMapping(toM1Buttonx, -1); - glyphNavigationMapper->setMapping(toP1Buttonx, 1); - glyphNavigationMapper->setMapping(toP10Buttonx, 10); - glyphNavigationMapper->setMapping(toP100Buttonx, 100); - glyphNavigationMapper->setMapping(toP1000Buttonx, 1000); - glyphNavigationMapper->setMapping(toEndButtonx, 0x10000); - - connect(fontWatcher, SIGNAL(fileChanged(const QString&)), - SLOT(watchCurrentFont())); - connect(timer, SIGNAL(timeout()), - SLOT(watchCurrentFont())); -} - - -void -MainGUI::createActions() -{ - loadFontsAct = new QAction(tr("&Load Fonts"), this); - loadFontsAct->setShortcuts(QKeySequence::Open); - connect(loadFontsAct, SIGNAL(triggered()), SLOT(loadFonts())); - - closeFontAct = new QAction(tr("&Close Font"), this); - closeFontAct->setShortcuts(QKeySequence::Close); - connect(closeFontAct, SIGNAL(triggered()), SLOT(closeFont())); - - exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcuts(QKeySequence::Quit); - connect(exitAct, SIGNAL(triggered()), SLOT(close())); - - aboutAct = new QAction(tr("&About"), this); - connect(aboutAct, SIGNAL(triggered()), SLOT(about())); - - aboutQtAct = new QAction(tr("About &Qt"), this); - connect(aboutQtAct, SIGNAL(triggered()), SLOT(aboutQt())); -} - - -void -MainGUI::createMenus() -{ - menuFile = menuBar()->addMenu(tr("&File")); - menuFile->addAction(loadFontsAct); - menuFile->addAction(closeFontAct); - menuFile->addAction(exitAct); - - menuHelp = menuBar()->addMenu(tr("&Help")); - menuHelp->addAction(aboutAct); - menuHelp->addAction(aboutQtAct); -} - - -void -MainGUI::createStatusBar() -{ - statusBar()->showMessage(""); -} - - -void -MainGUI::clearStatusBar() -{ - statusBar()->clearMessage(); - statusBar()->setStyleSheet(""); -} - - -void -MainGUI::setDefaults() -{ - // set up mappings between property values and combo box indices - hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_35] = HintingMode_TrueType_v35; - hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_38] = HintingMode_TrueType_v38; - // TT_INTERPRETER_VERSION_40, not yet implemented - hintingModesTrueTypeHash[40] = HintingMode_TrueType_v40; - - hintingModesCFFHash[FT_CFF_HINTING_FREETYPE] = HintingMode_CFF_FreeType; - hintingModesCFFHash[FT_CFF_HINTING_ADOBE] = HintingMode_CFF_Adobe; - - lcdFilterHash[FT_LCD_FILTER_DEFAULT] = LCDFilter_Default; - lcdFilterHash[FT_LCD_FILTER_LIGHT] = LCDFilter_Light; - lcdFilterHash[FT_LCD_FILTER_NONE] = LCDFilter_None; - lcdFilterHash[FT_LCD_FILTER_LEGACY] = LCDFilter_Legacy; - - // make copies and remove existing elements... - QHash hmTTHash = hintingModesTrueTypeHash; - if (hmTTHash.contains(engine->ttInterpreterVersionDefault)) - hmTTHash.remove(engine->ttInterpreterVersionDefault); - if (hmTTHash.contains(engine->ttInterpreterVersionOther)) - hmTTHash.remove(engine->ttInterpreterVersionOther); - if (hmTTHash.contains(engine->ttInterpreterVersionOther1)) - hmTTHash.remove(engine->ttInterpreterVersionOther1); - - QHash hmCFFHash = hintingModesCFFHash; - if (hmCFFHash.contains(engine->cffHintingEngineDefault)) - hmCFFHash.remove(engine->cffHintingEngineDefault); - if (hmCFFHash.contains(engine->cffHintingEngineOther)) - hmCFFHash.remove(engine->cffHintingEngineOther); - - // ... to construct a list of always disabled hinting mode combo box items - hintingModesAlwaysDisabled = hmTTHash.values(); - hintingModesAlwaysDisabled += hmCFFHash.values(); - - for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++) - hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i], - false); - - // the next four values always non-negative - currentFontIndex = 0; - currentFaceIndex = 0; - currentNamedInstanceIndex = 0; - currentGlyphIndex = 0; - - currentCFFHintingMode - = hintingModesCFFHash[engine->cffHintingEngineDefault]; - currentTTInterpreterVersion - = hintingModesTrueTypeHash[engine->ttInterpreterVersionDefault]; - - hintingCheckBox->setChecked(true); - - antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal); - lcdFilterComboBox->setCurrentIndex(LCDFilter_Light); - - horizontalHintingCheckBox->setChecked(true); - verticalHintingCheckBox->setChecked(true); - blueZoneHintingCheckBox->setChecked(true); - - showBitmapCheckBox->setChecked(true); - showOutlinesCheckBox->setChecked(true); - - gammaSlider->setValue(18); // 1.8 - sizeDoubleSpinBox->setValue(20); - dpiSpinBox->setValue(96); - zoomSpinBox->setValue(20); - - checkHinting(); - checkHintingMode(); - checkAutoHinting(); - checkAntiAliasing(); - checkLcdFilter(); - checkShowPoints(); - checkUnits(); - checkCurrentFontIndex(); - checkCurrentFaceIndex(); - checkCurrentNamedInstanceIndex(); - adjustGlyphIndex(0); - zoom(); -} - - -void -MainGUI::readSettings() -{ - QSettings settings; -// QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); -// QSize size = settings.value("size", QSize(400, 400)).toSize(); -// resize(size); -// move(pos); -} - - -void -MainGUI::writeSettings() -{ - QSettings settings; -// settings.setValue("pos", pos()); -// settings.setValue("size", size()); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// QGraphicsViewx -// -///////////////////////////////////////////////////////////////////////////// - -QGraphicsViewx::QGraphicsViewx() -: lastBottomLeftPointInitialized(false) -{ - // empty -} - - -void -QGraphicsViewx::scrollContentsBy(int dx, - int dy) -{ - QGraphicsView::scrollContentsBy(dx, dy); - lastBottomLeftPoint = viewport()->rect().bottomLeft(); -} - - -void -QGraphicsViewx::resizeEvent(QResizeEvent* event) -{ - QGraphicsView::resizeEvent(event); - - // XXX I don't know how to properly initialize this value, - // thus the hack with the boolean - if (!lastBottomLeftPointInitialized) - { - lastBottomLeftPoint = viewport()->rect().bottomLeft(); - lastBottomLeftPointInitialized = true; - } - - QPointF currentBottomLeftPoint = viewport()->rect().bottomLeft(); - int verticalPosition = verticalScrollBar()->value(); - verticalScrollBar()->setValue(verticalPosition - - (currentBottomLeftPoint.y() - - lastBottomLeftPoint.y())); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// QSpinBoxx -// -///////////////////////////////////////////////////////////////////////////// - -// we want to mark the center of a pixel square with a single dot or a small -// cross; starting with a certain magnification we thus only use even values -// so that we can do that symmetrically - -int -QSpinBoxx::valueFromText(const QString& text) const -{ - int val = QSpinBox::valueFromText(text); - - if (val > 640) - val = val - (val % 64); - else if (val > 320) - val = val - (val % 32); - else if (val > 160) - val = val - (val % 16); - else if (val > 80) - val = val - (val % 8); - else if (val > 40) - val = val - (val % 4); - else if (val > 20) - val = val - (val % 2); - - return val; -} - - -void -QSpinBoxx::stepBy(int steps) -{ - int val = value(); - - if (steps > 0) - { - for (int i = 0; i < steps; i++) - { - if (val >= 640) - val = val + 64; - else if (val >= 320) - val = val + 32; - else if (val >= 160) - val = val + 16; - else if (val >= 80) - val = val + 8; - else if (val >= 40) - val = val + 4; - else if (val >= 20) - val = val + 2; - else - val++; - } - } - else if (steps < 0) - { - for (int i = 0; i < -steps; i++) - { - if (val > 640) - val = val - 64; - else if (val > 320) - val = val - 32; - else if (val > 160) - val = val - 16; - else if (val > 80) - val = val - 8; - else if (val > 40) - val = val - 4; - else if (val > 20) - val = val - 2; - else - val--; - } - } - - setValue(val); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// QComboBoxx -// -///////////////////////////////////////////////////////////////////////////// - -void -QComboBoxx::setItemEnabled(int index, - bool enable) -{ - const QStandardItemModel* itemModel = - qobject_cast(model()); - QStandardItem* item = itemModel->item(index); - - if (enable) - { - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - item->setData(QVariant(), - Qt::TextColorRole); - } - else - { - item->setFlags(item->flags() - & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled)); - // clear item data in order to use default color; - // this visually greys out the item - item->setData(palette().color(QPalette::Disabled, QPalette::Text), - Qt::TextColorRole); - } -} - - -///////////////////////////////////////////////////////////////////////////// -// -// QPushButtonx -// -///////////////////////////////////////////////////////////////////////////// - -// code derived from Qt 4.8.7, function `QPushButton::sizeHint', -// file `src/gui/widgets/qpushbutton.cpp' - -QPushButtonx::QPushButtonx(const QString &text, - QWidget *parent) -: QPushButton(text, parent) -{ - QStyleOptionButton opt; - opt.initFrom(this); - QString s(this->text()); - QFontMetrics fm = fontMetrics(); - QSize sz = fm.size(Qt::TextShowMnemonic, s); - opt.rect.setSize(sz); - - sz = style()->sizeFromContents(QStyle::CT_PushButton, - &opt, - sz, - this); - setFixedWidth(sz.width()); -} - - -///////////////////////////////////////////////////////////////////////////// -// -// main -// -///////////////////////////////////////////////////////////////////////////// - -int -main(int argc, - char** argv) -{ - QApplication app(argc, argv); - app.setApplicationName("ftinspect"); - app.setApplicationVersion(VERSION); - app.setOrganizationName("FreeType"); - app.setOrganizationDomain("freetype.org"); - - MainGUI gui; - Engine engine(&gui); - - gui.update(&engine); - gui.setDefaults(); - - gui.show(); - - return app.exec(); -} - - -// end of ftinspect.cpp diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftinspect.h freetype-2.8/=unpacked-tar1=/src/ftinspect.h --- freetype-2.7.1/=unpacked-tar1=/src/ftinspect.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftinspect.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,563 +0,0 @@ -// ftinspect.h - -#ifndef FTINSPECT_H_ -#define FTINSPECT_H_ - -#include -#include FT_FREETYPE_H -#include FT_CACHE_H -#include FT_CFF_DRIVER_H -#include FT_LCD_FILTER_H -#include FT_MODULE_H -#include FT_OUTLINE_H -#include FT_TRUETYPE_DRIVER_H - -// internal FreeType header files; only available in the source code bundle -#include FT_INTERNAL_DRIVER_H -#include FT_INTERNAL_OBJECTS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -class MainGUI; - - -// This structure is used to map the (font, face, instance) index triplet to -// abstract IDs (generated by a running number stored in MainGUI's -// `faceCounter' member). -// -// Qt's `QMap' class needs an implementation of the `<' operator. - -struct FaceID -{ - int fontIndex; - int faceIndex; - int namedInstanceIndex; - - FaceID(); - FaceID(int, int, int); - bool operator<(const FaceID& other) const; -}; - - -// FreeType specific data. - -class Engine -{ -public: - Engine(MainGUI*); - ~Engine(); - - const QString& currentFamilyName(); - const QString& currentStyleName(); - QString glyphName(int); - int numberOfFaces(int); - int numberOfNamedInstances(int, int); - int loadFont(int, int, int); // returns number of glyphs - FT_Outline* loadOutline(int); - void removeFont(int); - void setCFFHintingMode(int); - void setTTInterpreterVersion(int); - void update(); - - friend class MainGUI; - friend FT_Error faceRequester(FTC_FaceID, - FT_Library, - FT_Pointer, - FT_Face*); - - // XXX cover all available modules - enum FontType - { - FontType_CFF, - FontType_TrueType, - FontType_Other - }; - -private: - MainGUI* gui; - - int faceCounter; // a running number used to initialize `faceIDMap' - QMap faceIDMap; - - QString curFamilyName; - QString curStyleName; - - FT_Library library; - FTC_Manager cacheManager; - FTC_ImageCache imageCache; - FTC_SBitCache sbitsCache; - - FTC_ScalerRec scaler; - FT_Size ftSize; - - int cffHintingEngineDefault; - int cffHintingEngineOther; - - int ttInterpreterVersionDefault; - int ttInterpreterVersionOther; - int ttInterpreterVersionOther1; - - int fontType; - - int haveWarping; - - double pointSize; - double pixelSize; - int dpi; - - bool doHinting; - bool doAutoHinting; - bool doHorizontalHinting; - bool doVerticalHinting; - bool doBlueZoneHinting; - bool showSegments; - bool doWarping; - - double gamma; - - int loadFlags; -}; - - -class Grid -: public QGraphicsItem -{ -public: - Grid(const QPen&, - const QPen&); - QRectF boundingRect() const; - void paint(QPainter*, - const QStyleOptionGraphicsItem*, - QWidget*); - -private: - QPen gridPen; - QPen axisPen; -}; - - -class GlyphOutline -: public QGraphicsItem -{ -public: - GlyphOutline(const QPen&, - FT_Outline*); - QRectF boundingRect() const; - void paint(QPainter*, - const QStyleOptionGraphicsItem*, - QWidget*); - -private: - QPen outlinePen; - FT_Outline* outline; - QRectF bRect; -}; - - -class GlyphPoints -: public QGraphicsItem -{ -public: - GlyphPoints(const QPen&, - const QPen&, - FT_Outline*); - QRectF boundingRect() const; - void paint(QPainter*, - const QStyleOptionGraphicsItem*, - QWidget*); - -private: - QPen onPen; - QPen offPen; - FT_Outline* outline; - QRectF bRect; -}; - - -class GlyphPointNumbers -: public QGraphicsItem -{ -public: - GlyphPointNumbers(const QPen&, - const QPen&, - FT_Outline*); - QRectF boundingRect() const; - void paint(QPainter*, - const QStyleOptionGraphicsItem*, - QWidget*); - -private: - QPen onPen; - QPen offPen; - FT_Outline* outline; - QRectF bRect; -}; - - -class GlyphBitmap -: public QGraphicsItem -{ -public: - GlyphBitmap(FT_Outline*, - FT_Library, - int, - const QVector&, - const QVector&); - ~GlyphBitmap(); - QRectF boundingRect() const; - void paint(QPainter*, - const QStyleOptionGraphicsItem*, - QWidget*); - -private: - FT_Outline transformed; - FT_Library library; - int pixelMode; - const QVector& monoColorTable; - const QVector& grayColorTable; - QRectF bRect; -}; - - -// we want to anchor the view at the bottom left corner -// while the windows gets resized -class QGraphicsViewx -: public QGraphicsView -{ - Q_OBJECT - -public: - QGraphicsViewx(); - -protected: - void resizeEvent(QResizeEvent*); - void scrollContentsBy(int, int); - -private: - QPointF lastBottomLeftPoint; - bool lastBottomLeftPointInitialized; -}; - - -// we want to have our own `stepBy' function for the zoom spin box -class QSpinBoxx -: public QSpinBox -{ - Q_OBJECT - -public: - void stepBy(int); - int valueFromText(const QString&) const; -}; - - -// we want to grey out items in a combo box; -// since Qt doesn't provide a function for this we derive a class -class QComboBoxx -: public QComboBox -{ - Q_OBJECT - -public: - void setItemEnabled(int, bool); -}; - - -// we want buttons that are horizontally as small as possible -class QPushButtonx -: public QPushButton -{ - Q_OBJECT - -public: - QPushButtonx(const QString&, QWidget* = 0); - virtual ~QPushButtonx(){} -}; - - -class MainGUI -: public QMainWindow -{ - Q_OBJECT - -public: - MainGUI(); - ~MainGUI(); - - void setDefaults(); - void update(Engine*); - - friend class Engine; - friend FT_Error faceRequester(FTC_FaceID, - FT_Library, - FT_Pointer, - FT_Face*); - -protected: - void closeEvent(QCloseEvent*); - -private slots: - void about(); - void aboutQt(); - void adjustGlyphIndex(int); - void checkAntiAliasing(); - void checkAutoHinting(); - void checkCurrentFaceIndex(); - void checkCurrentFontIndex(); - void checkCurrentNamedInstanceIndex(); - void checkHinting(); - void checkHintingMode(); - void checkLcdFilter(); - void checkShowPoints(); - void checkUnits(); - void closeFont(); - void drawGlyph(); - void loadFonts(); - void nextFace(); - void nextFont(); - void nextNamedInstance(); - void previousFace(); - void previousFont(); - void previousNamedInstance(); - void watchCurrentFont(); - void zoom(); - -private: - Engine* engine; - - QStringList fontList; - int currentFontIndex; - - int currentNumberOfFaces; - int currentFaceIndex; - - int currentNumberOfNamedInstances; - int currentNamedInstanceIndex; - - int currentNumberOfGlyphs; - int currentGlyphIndex; - - int currentCFFHintingMode; - int currentTTInterpreterVersion; - - // layout related stuff - GlyphOutline *currentGlyphOutlineItem; - GlyphPoints *currentGlyphPointsItem; - GlyphPointNumbers *currentGlyphPointNumbersItem; - GlyphBitmap *currentGlyphBitmapItem; - - QAction *aboutAct; - QAction *aboutQtAct; - QAction *closeFontAct; - QAction *exitAct; - QAction *loadFontsAct; - - QCheckBox *autoHintingCheckBox; - QCheckBox *blueZoneHintingCheckBox; - QCheckBox *hintingCheckBox; - QCheckBox *horizontalHintingCheckBox; - QCheckBox *segmentDrawingCheckBox; - QCheckBox *showBitmapCheckBox; - QCheckBox *showOutlinesCheckBox; - QCheckBox *showPointNumbersCheckBox; - QCheckBox *showPointsCheckBox; - QCheckBox *verticalHintingCheckBox; - QCheckBox *warpingCheckBox; - - QComboBoxx *antiAliasingComboBoxx; - QComboBoxx *hintingModeComboBoxx; - QComboBox *lcdFilterComboBox; - QComboBox *unitsComboBox; - - QDoubleSpinBox *sizeDoubleSpinBox; - - QFileSystemWatcher *fontWatcher; - - QGraphicsScene *glyphScene; - QGraphicsViewx *glyphView; - - QGridLayout *fontLayout; - QGridLayout *infoRightLayout; - - QHash hintingModesTrueTypeHash; - QHash hintingModesCFFHash; - QHash lcdFilterHash; - - QHBoxLayout *antiAliasingLayout; - QHBoxLayout *blueZoneHintingLayout; - QHBoxLayout *ftinspectLayout; - QHBoxLayout *gammaLayout; - QHBoxLayout *hintingModeLayout; - QHBoxLayout *horizontalHintingLayout; - QHBoxLayout *infoLeftLayout; - QHBoxLayout *lcdFilterLayout; - QHBoxLayout *navigationLayout; - QHBoxLayout *pointNumbersLayout; - QHBoxLayout *segmentDrawingLayout; - QHBoxLayout *sizeLayout; - QHBoxLayout *verticalHintingLayout; - QHBoxLayout *warpingLayout; - - QLabel *antiAliasingLabel; - QLabel *dpiLabel; - QLabel *fontFilenameLabel; - QLabel *fontNameLabel; - QLabel *gammaLabel; - QLabel *glyphIndexLabel; - QLabel *glyphNameLabel; - QLabel *hintingModeLabel; - QLabel *lcdFilterLabel; - QLabel *sizeLabel; - QLabel *zoomLabel; - - QList hintingModesAlwaysDisabled; - - QLocale *locale; - - QMenu *menuFile; - QMenu *menuHelp; - - QPen axisPen; - QPen blueZonePen; - QPen gridPen; - QPen offPen; - QPen onPen; - QPen outlinePen; - QPen segmentPen; - - QPushButton *nextFaceButton; - QPushButton *nextFontButton; - QPushButton *nextNamedInstanceButton; - QPushButton *previousFaceButton; - QPushButton *previousFontButton; - QPushButton *previousNamedInstanceButton; - - QPushButtonx *toEndButtonx; - QPushButtonx *toM1000Buttonx; - QPushButtonx *toM100Buttonx; - QPushButtonx *toM10Buttonx; - QPushButtonx *toM1Buttonx; - QPushButtonx *toP1000Buttonx; - QPushButtonx *toP100Buttonx; - QPushButtonx *toP10Buttonx; - QPushButtonx *toP1Buttonx; - QPushButtonx *toStartButtonx; - - QSignalMapper *glyphNavigationMapper; - - QSlider *gammaSlider; - - QSpinBox *dpiSpinBox; - QSpinBoxx *zoomSpinBox; - - QTabWidget *tabWidget; - - QTimer *timer; - - QVBoxLayout *generalTabLayout; - QVBoxLayout *leftLayout; - QVBoxLayout *rightLayout; - - QVector grayColorTable; - QVector monoColorTable; - - QWidget *ftinspectWidget; - QWidget *generalTabWidget; - QWidget *leftWidget; - QWidget *rightWidget; - QWidget *mmgxTabWidget; - - enum AntiAliasing - { - AntiAliasing_None, - AntiAliasing_Normal, - AntiAliasing_Slight, - AntiAliasing_LCD, - AntiAliasing_LCD_BGR, - AntiAliasing_LCD_Vertical, - AntiAliasing_LCD_Vertical_BGR - }; - enum HintingMode - { - HintingMode_TrueType_v35, - HintingMode_TrueType_v38, - HintingMode_TrueType_v40, - HintingMode_CFF_FreeType, - HintingMode_CFF_Adobe, - }; - enum LCDFilter - { - LCDFilter_Default, - LCDFilter_Light, - LCDFilter_None, - LCDFilter_Legacy - }; - enum Units - { - Units_px, - Units_pt - }; - - void createActions(); - void createConnections(); - void createLayout(); - void createMenus(); - void clearStatusBar(); - void createStatusBar(); - void readSettings(); - void setGraphicsDefaults(); - void showFont(); - void writeSettings(); -}; - - -#endif // FTINSPECT_H_ - - -// end of ftinspect.h diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftinspect.pro freetype-2.8/=unpacked-tar1=/src/ftinspect.pro --- freetype-2.7.1/=unpacked-tar1=/src/ftinspect.pro 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftinspect.pro 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -INCLUDEPATH += ../../freetype2/include - -# To avoid conflicts with the FreeType version compiled into or used by Qt, -# we use the static library. -# -# You should adapt this to your setup. -unix|macx { - LIBS += ../../freetype2/objs/.libs/libfreetype.a - - CONFIG += link_pkgconfig - PKGCONFIG += libpng harfbuzz zlib bzip2 -} -win32 { - LIBS += ../../freetyp2/objs/vc2010/freetype271.lib - LIBS += -lpng -lharfbuzz -lz -lbz2 -lm -} - -CONFIG += qt debug - -# we need access to internal FreeType header files -DEFINES += FT2_BUILD_LIBRARY - -SOURCES += ftinspect.cpp -HEADERS += ftinspect.h - -TARGET = ftinspect - -QT += widgets diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftlint.1 freetype-2.8/=unpacked-tar1=/src/ftlint.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftlint.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftlint.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -.TH FTLINT 1 "December 2016" "Freetype 2.7.1" -. -. -.SH NAME -. -ftlint \- simple font tester -. -. -.SH SYNOPSIS -. -.B ftlint -.I ppem -.IR fontname [ .ttf | .ttc "] .\|.\|." -. -. -.SH DESCRIPTION -. -.B ftlint -opens the given font(s), loads and renders all glyphs at the given ppem -value, and reports failing glyphs if there are less than ten fails, or the -number of fails only if there are more fails. -. -.PP -This program does not have any options. -It is part of the FreeType demos package. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftlint.c freetype-2.8/=unpacked-tar1=/src/ftlint.c --- freetype-2.7.1/=unpacked-tar1=/src/ftlint.c 2015-10-09 07:14:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftlint.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality font engine */ -/* */ -/* Copyright 1996-1998, 2001, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* ftlint: a simple font tester. This program tries to load all the */ -/* glyphs of a given font. */ -/* */ -/* NOTE: This is just a test program that is used to show off and */ -/* debug the current engine. */ -/* */ -/****************************************************************************/ - -#include -#include FT_FREETYPE_H - -#include -#include -#include - - -#define xxTEST_PSNAMES - - - static FT_Error error; - - static FT_Library library; - static FT_Face face; - - static unsigned int num_glyphs; - static int ptsize; - - static int Fail; - - - static void - Usage( char* name ) - { - printf( "ftlint: simple font tester -- part of the FreeType project\n" ); - printf( "----------------------------------------------------------\n" ); - printf( "\n" ); - printf( "Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n", name ); - printf( "\n" ); - - exit( 1 ); - } - - - static void - Panic( const char* message ) - { - fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); - exit(1); - } - - - int - main( int argc, - char** argv ) - { - int i, file_index; - unsigned int id; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - char* fname; - - - execname = argv[0]; - - if ( argc < 3 ) - Usage( execname ); - - if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) - Usage( execname ); - - error = FT_Init_FreeType( &library ); - if (error) Panic( "Could not create library object" ); - - /* Now check all files */ - for ( file_index = 2; file_index < argc; file_index++ ) - { - fname = argv[file_index]; - - /* try to open the file with no extra extension first */ - error = FT_New_Face( library, fname, 0, &face ); - if (!error) - { - printf( "%s: ", fname ); - goto Success; - } - - - if ( error == FT_Err_Unknown_File_Format ) - { - printf( "unknown format\n" ); - continue; - } - - /* ok, we could not load the file, try to add an extension to */ - /* its name if possible.. */ - - i = (int)strlen( fname ); - while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) - { - if ( fname[i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, fname, 1024 ); - strncpy( alt_filename, fname, 1024 ); - -#ifndef macintosh - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } -#endif - i = (int)strlen( filename ); - fname = filename; - - while ( i >= 0 ) -#ifndef macintosh - if ( filename[i] == '/' || filename[i] == '\\' ) -#else - if ( filename[i] == ':' ) -#endif - { - fname = filename + i + 1; - i = -1; - } - else - i--; - - printf( "%s: ", fname ); - - /* Load face */ - error = FT_New_Face( library, filename, 0, &face ); - if (error) - { - if (error == FT_Err_Unknown_File_Format) - printf( "unknown format\n" ); - else - printf( "could not find/open file (error: %d)\n", error ); - continue; - } - if (error) Panic( "Could not open file" ); - - Success: - num_glyphs = (unsigned int)face->num_glyphs; - -#ifdef TEST_PSNAMES - { - const char* ps_name = FT_Get_Postscript_Name( face ); - - printf( "[%s] ", ps_name ? ps_name : "." ); - } -#endif - - error = FT_Set_Char_Size( face, ptsize << 6, ptsize << 6, 72, 72 ); - if (error) Panic( "Could not set character size" ); - - Fail = 0; - { - for ( id = 0; id < num_glyphs; id++ ) - { - error = FT_Load_Glyph( face, id, FT_LOAD_DEFAULT ); - if (error) - { - if ( Fail < 10 ) - printf( "glyph %4u: 0x%04x\n" , id, error ); - Fail++; - } - } - } - - if ( Fail == 0 ) - printf( "OK.\n" ); - else - if ( Fail == 1 ) - printf( "1 fail.\n" ); - else - printf( "%d fails.\n", Fail ); - - FT_Done_Face( face ); - } - - FT_Done_FreeType(library); - exit( 0 ); /* for safety reasons */ - - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftmemchk.c freetype-2.8/=unpacked-tar1=/src/ftmemchk.c --- freetype-2.7.1/=unpacked-tar1=/src/ftmemchk.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftmemchk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,346 +0,0 @@ -/* ftmemchk.c */ - -#include -#include FT_FREETYPE_H -#include FT_MODULE_H -#include -#include -#include - - FT_Error error; - - FT_Library library; - FT_Face face; - - unsigned int num_glyphs; - int ptsize; - - int Fail; - int Num; - - - - -/****************************************************************************/ -/****************************************************************************/ -/****************************************************************************/ -/****************************************************************************/ - -/* Our own memory allocator. To check that a single block isn't freed */ -/* several time, we simply do not call "free".. */ - -#define MAX_RECORDED_BLOCKS 1638400 -#define CHECK_DUPLICATES - -typedef struct MyBlock -{ - void* base; - long size; - -} MyBlock; - -static MyBlock my_blocks[ MAX_RECORDED_BLOCKS ]; -static int num_my_blocks = 0; - - -/* record a new block in the table, check for duplicates too */ -static -void record_my_block( void* base, long size ) -{ - if (size <= 0) - { - fprintf( stderr, "adding a block with non-positive length - should not happen \n" ); - exit(1); - } - - if ( num_my_blocks < MAX_RECORDED_BLOCKS ) - { - MyBlock* block; - -#ifdef CHECK_DUPLICATES - MyBlock* limit; - block = my_blocks; - limit = block + num_my_blocks; - for ( ; block < limit; block++ ) - { - if ( block->base == base && block->size != 0 ) - { - fprintf( stderr, "duplicate memory block at %08lx\n", (long)block->base ); - exit(1); - } - } -#endif - - block = my_blocks + num_my_blocks++; - block->base = base; - block->size = size; - } - else - { - fprintf( stderr, "Too many memory blocks -- test exited !!\n" ); - exit(1); - } -} - -/* forget a block, and check that it isn't part of our table already */ -static -void forget_my_block( void* base ) -{ - MyBlock* block = my_blocks + num_my_blocks-1; - - /* we scan in reverse, because transient blocks are always located */ - /* at the end of the table.. (it supposedly faster then..) */ - for ( ; block >= my_blocks; block-- ) - { - if ( block->base == base ) - { - if (block->size > 0) - { - block->size = 0; - return; - } - else - { - fprintf( stderr, "Block at %p released twice \n", base ); - exit(1); - } - } - } - fprintf( stderr, "Trying to release an unallocated block at %p\n", - base ); - exit(1); -} - - -FT_CALLBACK_DEF( void* ) my_alloc( FT_Memory memory, - long size ) -{ - void* p = malloc(size); - if (p) - record_my_block(p,size); - - memory=memory; - return p; -} - - -FT_CALLBACK_DEF( void ) my_free( FT_Memory memory, - void* block ) -{ - memory=memory; - forget_my_block(block); - /* free(block); WE DO NOT REALLY FREE THE BLOCK */ -} - - -FT_CALLBACK_DEF( void* ) my_realloc( FT_Memory memory, - long cur_size, - long new_size, - void* block ) -{ - void* p; - - p = my_alloc( memory, new_size ); - if (p) - { - long size; - - size = cur_size; - if (new_size < size) - size = new_size; - - memcpy( p, block, size ); - my_free( memory, block ); - } - - return p; -} - - - -static FT_Memory my_memory( void ) -{ - FT_Memory memory; - - memory = (FT_Memory)my_alloc( 0, sizeof(*memory) ); - if (!memory) - { - fprintf( stderr, "Unable to allocate debug memory manager !?!\n" ); - exit(2); - } - - memory->user = 0; - memory->alloc = my_alloc; - memory->free = my_free; - memory->realloc = my_realloc; - - return memory; -} - -static void dump_mem( void ) -{ - MyBlock* block = my_blocks + num_my_blocks-1; - int bad = 0; - - printf( "total allocated blocks = %d\n", num_my_blocks ); - - /* we scan in reverse, because transient blocks are always located */ - /* at the end of the table.. (it supposedly faster then..) */ - for ( ; block >= my_blocks; block-- ) - { - if (block->size > 0) - { - fprintf( stderr, "%p (%6ld bytes) leaked !!\n", block->base, (long)block->size ); - bad = 1; - } - } - if (!bad) - fprintf( stderr, "no leaked memory block\n\n" ); -} - -/****************************************************************************/ -/****************************************************************************/ -/****************************************************************************/ -/****************************************************************************/ - - - static void Usage( char* name ) - { - printf( "ftmemchk: simple memory tester -- part of the FreeType project\n" ); - printf( "--------------------------------------------------------------\n" ); - printf( "\n" ); - printf( "Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n", name ); - printf( "\n" ); - - exit( 1 ); - } - - - static void Panic( const char* message ) - { - fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); - exit(1); - } - - -int main( int argc, char** argv ) -{ - int i, file_index; - unsigned int id; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - char* fname; - - execname = argv[0]; - - if ( argc < 3 ) - Usage( execname ); - - if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) - Usage( execname ); - - /* Create a new library with our own memory manager */ - error = FT_New_Library( my_memory(), &library ); - if (error) Panic( "Could not create library object" ); - - /* the new library has no drivers in it, add the default ones */ - /* (implemented in ftinit.c).. */ - FT_Add_Default_Modules(library); - - - /* Now check all files */ - for ( file_index = 2; file_index < argc; file_index++ ) - { - fname = argv[file_index]; - i = strlen( fname ); - while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) - { - if ( fname[i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, fname, 1024 ); - strncpy( alt_filename, fname, 1024 ); - -#ifndef macintosh - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } -#endif - i = strlen( filename ); - fname = filename; - - while ( i >= 0 ) -#ifndef macintosh - if ( filename[i] == '/' || filename[i] == '\\' ) -#else - if ( filename[i] == ':' ) -#endif - { - fname = filename + i + 1; - i = -1; - } - else - i--; - - printf( "%s: ", fname ); - - /* Load face */ - error = FT_New_Face( library, filename, 0, &face ); - if (error) - { - if (error == FT_Err_Invalid_File_Format) - printf( "unknown format\n" ); - else - printf( "could not find/open file (error: %d)\n", error ); - continue; - } - if (error) Panic( "Could not open file" ); - - num_glyphs = face->num_glyphs; - - error = FT_Set_Char_Size( face, ptsize << 6, ptsize << 6, 72, 72 ); - if (error) Panic( "Could not set character size" ); - - Fail = 0; - { - for ( id = 0; id < num_glyphs; id++ ) - { - error = FT_Load_Glyph( face, id, FT_LOAD_RENDER ); - if (error) - { - if ( Fail < 10 ) - printf( "glyph %4u: 0x%04x\n" , id, error ); - Fail++; - } - } - } - - if ( Fail == 0 ) - printf( "OK.\n" ); - else - if ( Fail == 1 ) - printf( "1 fail.\n" ); - else - printf( "%d fails.\n", Fail ); - - FT_Done_Face( face ); - } - - FT_Done_FreeType(library); - - dump_mem(); - - exit( 0 ); /* for safety reasons */ - return 0; /* never reached */ -} - - - diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftmulti.1 freetype-2.8/=unpacked-tar1=/src/ftmulti.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftmulti.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftmulti.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -.TH FTMULTI 1 "December 2016" "Freetype 2.7.1" -. -. -.SH NAME -. -ftmulti \- multiple masters font viewer -. -. -.SH SYNOPSIS -. -.B ftmulti -.RI [ options ] -.I pt -.IR fontname \ .\|.\|. -. -. -.SH DESCRIPTION -. -.B ftmulti -is an interactive viewer for multiple masters and GX fonts. -. -.TP -.B pt -The point size for the given resolution. -If resolution is 72dpi, this directly gives the ppem value (pixels per EM). -. -.TP -.B font -The font file(s) to display. -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI \-w \ w -Set the window width to -.I w -pixels (default: 640px). -. -.TP -.BI \-h \ h -Set the window height to -.I h -pixels (default: 480px). -. -.TP -.BI \-e \ encoding -Specify encoding tag (default: no encoding). -Common values: -.B unic -(Unicode), -.B symb -(symbol), -.B ADOB -(Adobe standard), -.B ADBC -(Adobe custom). -. -.TP -.BI \-r \ r -Use resolution -.I r -dpi (default: 72 dpi). -. -.TP -.BI \-f \ index -Specify first glyph index to display. -. -.TP -.BI "\-d\ \(dq" "axis1\ axis2\ .\|.\|." \(dq -Specify the design coordinates for each Multiple Master axis at start-up. -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftmulti.c freetype-2.8/=unpacked-tar1=/src/ftmulti.c --- freetype-2.7.1/=unpacked-tar1=/src/ftmulti.c 2016-12-27 21:00:01.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftmulti.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1136 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000, 2003-2005, 2010-2014 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* FTMulti- a simple multiple masters font viewer */ -/* */ -/* Press ? when running this program to have a list of key-bindings */ -/* */ -/****************************************************************************/ - -#include -#include FT_FREETYPE_H -#include FT_FONT_FORMATS_H -#include FT_MODULE_H -#include FT_TRUETYPE_DRIVER_H -#include FT_CFF_DRIVER_H -#include FT_MULTIPLE_MASTERS_H - -#include "common.h" -#include "mlgetopt.h" - -#include -#include -#include -#include - -#include "graph.h" -#include "grfont.h" - -#define DIM_X 640 -#define DIM_Y 480 - -#define MAXPTSIZE 500 /* dtp */ -#define MAX_MM_AXES 6 - -#define N_CFF_HINTING_ENGINES 2 - - - static char Header[256]; - static char* new_header = NULL; - - static const unsigned char* Text = (unsigned char*) - "The quick brown fox jumps over the lazy dog 0123456789 " - "\342\352\356\373\364\344\353\357\366\374\377\340\371\351\350\347 " - "&#~\"\'(-`_^@)=+\260 ABCDEFGHIJKLMNOPQRSTUVWXYZ " - "$\243^\250*\265\371%!\247:/;.,?<>"; - - static FT_Library library; /* the FreeType library */ - static FT_Face face; /* the font face */ - static FT_Size size; /* the font size */ - static FT_GlyphSlot glyph; /* the glyph slot */ - - static unsigned long encoding = FT_ENCODING_NONE; - - static unsigned int cff_hinting_engine; - static unsigned int tt_interpreter_versions[3]; - static unsigned int num_tt_interpreter_versions; - static unsigned int tt_interpreter_version_idx; - - static const char* font_format; - - static FT_Error error; /* error returned by FreeType? */ - - static grSurface* surface; /* current display surface */ - static grBitmap bit; /* current display bitmap */ - - static int width = DIM_X; /* window width */ - static int height = DIM_Y; /* window height */ - - static int num_glyphs; /* number of glyphs */ - static int ptsize; /* current point size */ - - static int hinted = 1; /* is glyph hinting active? */ - static int antialias = 1; /* is anti-aliasing active? */ - static int use_sbits = 1; /* do we use embedded bitmaps? */ - static int Num; /* current first glyph index */ - - static int res = 72; - - static grColor fore_color = { 255 }; - - static int Fail; - - static int graph_init = 0; - - static int render_mode = 1; - - static FT_MM_Var *multimaster = NULL; - static FT_Fixed design_pos [MAX_MM_AXES]; - static FT_Fixed requested_pos[MAX_MM_AXES]; - static unsigned int requested_cnt = 0; - static unsigned int used_num_axis = 0; - - -#define DEBUGxxx - -#ifdef DEBUG -#define LOG( x ) LogMessage##x -#else -#define LOG( x ) /* empty */ -#endif - - -#ifdef DEBUG - static void - LogMessage( const char* fmt, ... ) - { - va_list ap; - - - va_start( ap, fmt ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); - } -#endif - - - /* PanicZ */ - static void - PanicZ( const char* message ) - { - fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); - exit( 1 ); - } - - - static unsigned long - make_tag( char *s ) - { - int i; - unsigned long l = 0; - - - for ( i = 0; i < 4; i++ ) - { - if ( !s[i] ) - break; - l <<= 8; - l += (unsigned long)s[i]; - } - - return l; - } - - - static void - parse_design_coords( char *s ) - { - for ( requested_cnt = 0; requested_cnt < MAX_MM_AXES && *s; - requested_cnt++ ) - { - requested_pos[requested_cnt] = (FT_Fixed)( strtod( s, &s ) * 65536.0 ); - - while ( *s==' ' ) - ++s; - } - } - - - /* Clears the Bit bitmap/pixmap */ - static void - Clear_Display( void ) - { - long bitmap_size = (long)bit.pitch * bit.rows; - - - if ( bitmap_size < 0 ) - bitmap_size = -bitmap_size; - memset( bit.buffer, 0, (unsigned long)bitmap_size ); - } - - - /* Initialize the display bitmap named `bit' */ - static void - Init_Display( void ) - { - grInitDevices(); - - bit.mode = gr_pixel_mode_gray; - bit.width = width; - bit.rows = height; - bit.grays = 256; - - surface = grNewSurface( 0, &bit ); - if ( !surface ) - PanicZ( "could not allocate display surface\n" ); - - graph_init = 1; - } - - - /* Render a single glyph with the `grays' component */ - static FT_Error - Render_Glyph( int x_offset, - int y_offset ) - { - grBitmap bit3; - FT_Pos x_top, y_top; - - - /* first, render the glyph image into a bitmap */ - if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) - { - error = FT_Render_Glyph( glyph, antialias ? FT_RENDER_MODE_NORMAL - : FT_RENDER_MODE_MONO ); - if ( error ) - return error; - } - - /* now blit it to our display screen */ - bit3.rows = (int)glyph->bitmap.rows; - bit3.width = (int)glyph->bitmap.width; - bit3.pitch = glyph->bitmap.pitch; - bit3.buffer = glyph->bitmap.buffer; - - switch ( glyph->bitmap.pixel_mode ) - { - case FT_PIXEL_MODE_MONO: - bit3.mode = gr_pixel_mode_mono; - bit3.grays = 0; - break; - - case FT_PIXEL_MODE_GRAY: - bit3.mode = gr_pixel_mode_gray; - bit3.grays = glyph->bitmap.num_grays; - } - - /* Then, blit the image to the target surface */ - x_top = x_offset + glyph->bitmap_left; - y_top = y_offset - glyph->bitmap_top; - - grBlitGlyphToBitmap( &bit, &bit3, x_top, y_top, fore_color ); - - return 0; - } - - - static void - Reset_Scale( int pointSize ) - { - (void)FT_Set_Char_Size( face, - pointSize << 6, pointSize << 6, - (FT_UInt)res, (FT_UInt)res ); - } - - - static FT_Error - LoadChar( unsigned int idx, - int hint ) - { - int flags; - - - flags = FT_LOAD_DEFAULT; - - if ( !hint ) - flags |= FT_LOAD_NO_HINTING; - - if ( !use_sbits ) - flags |= FT_LOAD_NO_BITMAP; - - return FT_Load_Glyph( face, idx, flags ); - } - - - static FT_Error - Render_All( unsigned int first_glyph, - int pt_size ) - { - FT_F26Dot6 start_x, start_y, step_y, x, y; - unsigned int i; - - - start_x = 4; - start_y = pt_size + ( used_num_axis > MAX_MM_AXES / 2 ? 44 : 36 ); - - step_y = size->metrics.y_ppem + 10; - - x = start_x; - y = start_y; - - i = first_glyph; - -#if 0 - while ( i < first_glyph + 1 ) -#else - while ( i < (unsigned int)num_glyphs ) -#endif - { - if ( !( error = LoadChar( i, hinted ) ) ) - { -#ifdef DEBUG - if ( i <= first_glyph + 6 ) - { - LOG(( "metrics[%02d] = [%x %x]\n", - i, - glyph->metrics.horiBearingX, - glyph->metrics.horiAdvance )); - - if ( i == first_glyph + 6 ) - LOG(( "-------------------------\n" )); - } -#endif - - Render_Glyph( x, y ); - - x += ( glyph->metrics.horiAdvance >> 6 ) + 1; - - if ( x + size->metrics.x_ppem > bit.width ) - { - x = start_x; - y += step_y; - - if ( y >= bit.rows ) - return FT_Err_Ok; - } - } - else - Fail++; - - i++; - } - - return FT_Err_Ok; - } - - - static FT_Error - Render_Text( unsigned int first_glyph ) - { - FT_F26Dot6 start_x, start_y, step_y, x, y; - unsigned int i; - - const unsigned char* p; - - - start_x = 4; - start_y = 32 + size->metrics.y_ppem; - - step_y = size->metrics.y_ppem + 10; - - x = start_x; - y = start_y; - - i = first_glyph; - p = Text; - while ( i > 0 && *p ) - { - p++; - i--; - } - - while ( *p ) - { - if ( !( error = LoadChar( FT_Get_Char_Index( face, - (unsigned char)*p ), - hinted ) ) ) - { -#ifdef DEBUG - if ( i <= first_glyph + 6 ) - { - LOG(( "metrics[%02d] = [%x %x]\n", - i, - glyph->metrics.horiBearingX, - glyph->metrics.horiAdvance )); - - if ( i == first_glyph + 6 ) - LOG(( "-------------------------\n" )); - } -#endif - - Render_Glyph( x, y ); - - x += ( glyph->metrics.horiAdvance >> 6 ) + 1; - - if ( x + size->metrics.x_ppem > bit.width ) - { - x = start_x; - y += step_y; - - if ( y >= bit.rows ) - return FT_Err_Ok; - } - } - else - Fail++; - - i++; - p++; - } - - return FT_Err_Ok; - } - - - static void - Help( void ) - { - char buf[256]; - char version[64]; - - const char* format; - FT_Int major, minor, patch; - - grEvent dummy_event; - - - FT_Library_Version( library, &major, &minor, &patch ); - - format = patch ? "%d.%d.%d" : "%d.%d"; - sprintf( version, format, major, minor, patch ); - - Clear_Display(); - grSetLineHeight( 10 ); - grGotoxy( 0, 0 ); - grSetMargin( 2, 1 ); - grGotobitmap( &bit ); - - sprintf( buf, - "FreeType MM Glyph Viewer - part of the FreeType %s test suite", - version ); - - grWriteln( buf ); - grLn(); - grWriteln( "This program displays all glyphs from one or several" ); - grWriteln( "Multiple Masters or GX font files, with the FreeType library." ); - grLn(); - grWriteln( "Use the following keys:"); - grLn(); - grWriteln( "? display this help screen" ); - grWriteln( "a toggle anti-aliasing" ); - grWriteln( "h toggle outline hinting" ); - grWriteln( "b toggle embedded bitmaps" ); - grWriteln( "space toggle rendering mode" ); - grLn(); - grWriteln( "p, n previous/next font" ); - grLn(); - grWriteln( "H cycle through hinting engines (if available)" ); - grLn(); - grWriteln( "Up, Down change pointsize by 1 unit" ); - grWriteln( "PgUp, PgDn change pointsize by 10 units" ); - grLn(); - grWriteln( "Left, Right adjust index by 1" ); - grWriteln( "F7, F8 adjust index by 10" ); - grWriteln( "F9, F10 adjust index by 100" ); - grWriteln( "F11, F12 adjust index by 1000" ); - grLn(); - grWriteln( "F1, F2 adjust first axis by 1/50th of its range" ); - grWriteln( "F3, F4 adjust second axis by 1/50th of its range" ); - grWriteln( "F5, F6 adjust third axis by 1/50th of its range" ); - grWriteln( "1, 2 adjust fourth axis by 1/50th of its range" ); - grWriteln( "3, 4 adjust fifth axis by 1/50th of its range" ); - grWriteln( "5, 6 adjust sixth axis by 1/50th of its range" ); - grLn(); - grLn(); - grWriteln( "press any key to exit this help screen" ); - - grRefreshSurface( surface ); - grListenSurface( surface, gr_event_key, &dummy_event ); - } - - - static void - cff_hinting_engine_change( int delta ) - { - int new_cff_hinting_engine = 0; - - - if ( delta ) - new_cff_hinting_engine = - ( (int)cff_hinting_engine + - delta + - N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; - - error = FT_Property_Set( library, - "cff", - "hinting-engine", - &new_cff_hinting_engine ); - if ( !error ) - cff_hinting_engine = (FT_UInt)new_cff_hinting_engine; - } - - - static void - tt_interpreter_version_change( void ) - { - tt_interpreter_version_idx += 1; - tt_interpreter_version_idx %= num_tt_interpreter_versions; - - FT_Property_Set( library, - "truetype", - "interpreter-version", - &tt_interpreter_versions[tt_interpreter_version_idx] ); - } - - - static int - Process_Event( grEvent* event ) - { - int i; - unsigned int axis; - - - switch ( event->key ) - { - case grKeyEsc: /* ESC or q */ - case grKEY( 'q' ): - return 0; - - case grKEY( '?' ): - Help(); - return 1; - - /* mode keys */ - - case grKEY( 'a' ): - antialias = !antialias; - new_header = antialias ? (char *)"anti-aliasing is now on" - : (char *)"anti-aliasing is now off"; - return 1; - - case grKEY( 'b' ): - use_sbits = !use_sbits; - new_header = use_sbits - ? (char *)"embedded bitmaps are now used if available" - : (char *)"embedded bitmaps are now ignored"; - return 1; - - case grKEY( 'n' ): - case grKEY( 'p' ): - return (int)event->key; - - case grKEY( 'h' ): - hinted = !hinted; - new_header = hinted ? (char *)"glyph hinting is now active" - : (char *)"glyph hinting is now ignored"; - break; - - case grKEY( ' ' ): - render_mode ^= 1; - new_header = render_mode ? (char *)"rendering all glyphs in font" - : (char *)"rendering test text string"; - break; - - case grKEY( 'H' ): - if ( !strcmp( font_format, "CFF" ) ) - cff_hinting_engine_change( 1 ); - else if ( !strcmp( font_format, "TrueType" ) ) - tt_interpreter_version_change(); - break; - - /* MM related keys */ - - case grKeyF1: - i = -20; - axis = 0; - goto Do_Axis; - - case grKeyF2: - i = 20; - axis = 0; - goto Do_Axis; - - case grKeyF3: - i = -20; - axis = 1; - goto Do_Axis; - - case grKeyF4: - i = 20; - axis = 1; - goto Do_Axis; - - case grKeyF5: - i = -20; - axis = 2; - goto Do_Axis; - - case grKeyF6: - i = 20; - axis = 2; - goto Do_Axis; - - case grKEY( '1' ): - i = -20; - axis = 3; - goto Do_Axis; - - case grKEY( '2' ): - i = 20; - axis = 3; - goto Do_Axis; - - case grKEY( '3' ): - i = -20; - axis = 4; - goto Do_Axis; - - case grKEY( '4' ): - i = 20; - axis = 4; - goto Do_Axis; - - case grKEY( '5' ): - i = -20; - axis = 5; - goto Do_Axis; - - case grKEY( '6' ): - i = 20; - axis = 5; - goto Do_Axis; - - /* scaling related keys */ - - case grKeyPageUp: - i = 10; - goto Do_Scale; - - case grKeyPageDown: - i = -10; - goto Do_Scale; - - case grKeyUp: - i = 1; - goto Do_Scale; - - case grKeyDown: - i = -1; - goto Do_Scale; - - /* glyph index related keys */ - - case grKeyLeft: - i = -1; - goto Do_Glyph; - - case grKeyRight: - i = 1; - goto Do_Glyph; - - case grKeyF7: - i = -10; - goto Do_Glyph; - - case grKeyF8: - i = 10; - goto Do_Glyph; - - case grKeyF9: - i = -100; - goto Do_Glyph; - - case grKeyF10: - i = 100; - goto Do_Glyph; - - case grKeyF11: - i = -1000; - goto Do_Glyph; - - case grKeyF12: - i = 1000; - goto Do_Glyph; - - default: - ; - } - return 1; - - Do_Axis: - if ( axis < used_num_axis ) - { - FT_Var_Axis* a = multimaster->axis + axis; - FT_Fixed pos = design_pos[axis]; - - - /* - * Normalize i. Changing by 20 is all very well for PostScript fonts, - * which tend to have a range of ~1000 per axis, but it's not useful - * for mac fonts, which have a range of ~3. And it's rather extreme - * for optical size even in PS. - */ - pos += FT_MulDiv( i, a->maximum - a->minimum, 1000 ); - if ( pos < a->minimum ) - pos = a->minimum; - if ( pos > a->maximum ) - pos = a->maximum; - - design_pos[axis] = pos; - - /* for MM fonts, round the design coordinates to integers */ - if ( !FT_IS_SFNT( face ) ) - design_pos[axis] &= (FT_Fixed)0xFFFF0000L; - - FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos ); - } - return 1; - - Do_Scale: - ptsize += i; - if ( ptsize < 1 ) - ptsize = 1; - if ( ptsize > MAXPTSIZE ) - ptsize = MAXPTSIZE; - return 1; - - Do_Glyph: - Num += i; - if ( Num < 0 ) - Num = 0; - if ( Num >= num_glyphs ) - Num = num_glyphs - 1; - return 1; - } - - - static void - usage( char* execname ) - { - fprintf( stderr, - "\n" - "ftmulti: multiple masters font viewer - part of FreeType\n" - "--------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] pt font ...\n" - "\n", - execname ); - fprintf( stderr, - " pt The point size for the given resolution.\n" - " If resolution is 72dpi, this directly gives the\n" - " ppem value (pixels per EM).\n" ); - fprintf( stderr, - " font The font file(s) to display.\n" - "\n" ); - fprintf( stderr, - " -w W Set window width to W pixels (default: %dpx).\n" - " -h H Set window height to H pixels (default: %dpx).\n" - "\n", - DIM_X, DIM_Y ); - fprintf( stderr, - " -e encoding Specify encoding tag (default: no encoding).\n" - " Common values: `unic' (Unicode), `symb' (symbol),\n" - " `ADOB' (Adobe standard), `ADBC' (Adobe custom).\n" - " -r R Use resolution R dpi (default: 72dpi).\n" - " -f index Specify first glyph index to display.\n" - " -d \"axis1 axis2 ...\"\n" - " Specify the design coordinates for each\n" - " Multiple Master axis at start-up.\n" - "\n" - " -v Show version." - "\n" ); - - exit( 1 ); - } - - - int - main( int argc, - char* argv[] ) - { - int old_ptsize, orig_ptsize, file; - int first_glyph = 0; - int XisSetup = 0; - char* execname; - int option; - int file_loaded; - - unsigned int n; - - grEvent event; - - unsigned int dflt_tt_interpreter_version; - unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - TT_INTERPRETER_VERSION_40 }; - - - execname = ft_basename( argv[0] ); - - /* Initialize engine */ - error = FT_Init_FreeType( &library ); - if ( error ) - PanicZ( "Could not initialize FreeType library" ); - - /* get the default value as compiled into FreeType */ - FT_Property_Get( library, - "cff", - "hinting-engine", &cff_hinting_engine ); - - /* collect all available versions, then set again the default */ - FT_Property_Get( library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - for ( n = 0; n < 3; n++ ) - { - error = FT_Property_Set( library, - "truetype", - "interpreter-version", &versions[n] ); - if ( !error ) - tt_interpreter_versions[ - num_tt_interpreter_versions++] = versions[n]; - if ( versions[n] == dflt_tt_interpreter_version ) - tt_interpreter_version_idx = n; - } - FT_Property_Set( library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - - while ( 1 ) - { - option = getopt( argc, argv, "d:e:f:h:r:vw:" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'd': - parse_design_coords( optarg ); - break; - - case 'e': - encoding = make_tag( optarg ); - break; - - case 'f': - first_glyph = atoi( optarg ); - break; - - case 'h': - height = atoi( optarg ); - if ( height < 1 ) - usage( execname ); - break; - - case 'r': - res = atoi( optarg ); - if ( res < 1 ) - usage( execname ); - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( library, &major, &minor, &patch ); - - printf( "ftmulti (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - case 'w': - width = atoi( optarg ); - if ( width < 1 ) - usage( execname ); - break; - - default: - usage( execname ); - break; - } - } - - argc -= optind; - argv += optind; - - if ( argc <= 1 ) - usage( execname ); - - if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 ) - orig_ptsize = 64; - - file = 1; - - NewFile: - ptsize = orig_ptsize; - hinted = 1; - file_loaded = 0; - - /* Load face */ - error = FT_New_Face( library, argv[file], 0, &face ); - if ( error ) - { - face = NULL; - goto Display_Font; - } - - font_format = FT_Get_Font_Format( face ); - - if ( encoding != FT_ENCODING_NONE ) - { - error = FT_Select_Charmap( face, (FT_Encoding)encoding ); - if ( error ) - goto Display_Font; - } - - /* retrieve multiple master information */ - error = FT_Get_MM_Var( face, &multimaster ); - if ( error ) - { - multimaster = NULL; - goto Display_Font; - } - - /* if the user specified a position, use it, otherwise */ - /* set the current position to the median of each axis */ - if ( multimaster->num_axis > MAX_MM_AXES ) - { - fprintf( stderr, "only handling first %d GX axes (of %d)\n", - MAX_MM_AXES, multimaster->num_axis ); - used_num_axis = MAX_MM_AXES; - } - else - used_num_axis = multimaster->num_axis; - - for ( n = 0; n < used_num_axis; n++ ) - { - design_pos[n] = n < requested_cnt ? requested_pos[n] - : multimaster->axis[n].def; - if ( design_pos[n] < multimaster->axis[n].minimum ) - design_pos[n] = multimaster->axis[n].minimum; - else if ( design_pos[n] > multimaster->axis[n].maximum ) - design_pos[n] = multimaster->axis[n].maximum; - - /* for MM fonts, round the design coordinates to integers */ - if ( !FT_IS_SFNT( face ) ) - design_pos[n] &= (FT_Fixed)0xFFFF0000L; - } - - error = FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos ); - if ( error ) - goto Display_Font; - - file_loaded++; - - Reset_Scale( ptsize ); - - num_glyphs = face->num_glyphs; - glyph = face->glyph; - size = face->size; - - Display_Font: - /* initialize graphics if needed */ - if ( !XisSetup ) - { - XisSetup = 1; - Init_Display(); - } - - grSetTitle( surface, "FreeType Glyph Viewer - press ? for help" ); - old_ptsize = ptsize; - - if ( file_loaded >= 1 ) - { - Fail = 0; - Num = first_glyph; - - if ( Num >= num_glyphs ) - Num = num_glyphs - 1; - - if ( Num < 0 ) - Num = 0; - } - - for ( ;; ) - { - int key; - - - Clear_Display(); - - if ( file_loaded >= 1 ) - { - switch ( render_mode ) - { - case 0: - Render_Text( (unsigned int)Num ); - break; - - default: - Render_All( (unsigned int)Num, ptsize ); - } - - sprintf( Header, "%.50s %.50s (file %.100s)", - face->family_name, - face->style_name, - ft_basename( argv[file] ) ); - - if ( !new_header ) - new_header = Header; - - grWriteCellString( &bit, 0, 0, new_header, fore_color ); - new_header = NULL; - - sprintf( Header, "axes:" ); - { - unsigned int limit = used_num_axis > MAX_MM_AXES / 2 - ? MAX_MM_AXES / 2 - : used_num_axis; - - - for ( n = 0; n < limit; n++ ) - { - char temp[100]; - - - sprintf( temp, " %.50s: %.02f", - multimaster->axis[n].name, - design_pos[n] / 65536.0 ); - strncat( Header, temp, - sizeof ( Header ) - strlen( Header ) - 1 ); - } - } - grWriteCellString( &bit, 0, 16, Header, fore_color ); - - if ( used_num_axis > MAX_MM_AXES / 2 ) - { - unsigned int limit = used_num_axis; - - - sprintf( Header, " " ); - - for ( n = MAX_MM_AXES / 2; n < limit; n++ ) - { - char temp[100]; - - - sprintf( temp, " %.50s: %.02f", - multimaster->axis[n].name, - design_pos[n] / 65536.0 ); - strncat( Header, temp, - sizeof ( Header ) - strlen( Header ) - 1 ); - } - - grWriteCellString( &bit, 0, 24, Header, fore_color ); - } - - { - unsigned int tt_ver = tt_interpreter_versions[ - tt_interpreter_version_idx]; - - - sprintf( Header, "at %d points, first glyph = %d, format = %s", - ptsize, - Num, - strcmp( font_format, "CFF" ) - ? ( tt_ver == TT_INTERPRETER_VERSION_35 - ? "TrueType (v35)" - : ( tt_ver == TT_INTERPRETER_VERSION_38 - ? "TrueType (v38)" - : "TrueType (v40)" ) ) - : ( cff_hinting_engine == FT_CFF_HINTING_FREETYPE - ? "CFF (FreeType)" - : "CFF (Adobe)" ) ); - } - } - else - { - sprintf( Header, "%.100s: not an MM font file, or could not be opened", - ft_basename( argv[file] ) ); - } - - grWriteCellString( &bit, 0, 8, Header, fore_color ); - grRefreshSurface( surface ); - - grListenSurface( surface, 0, &event ); - if ( !( key = Process_Event( &event ) ) ) - goto End; - - if ( key == 'n' ) - { - if ( file_loaded >= 1 ) - FT_Done_Face( face ); - - if ( file < argc - 1 ) - file++; - - goto NewFile; - } - - if ( key == 'p' ) - { - if ( file_loaded >= 1 ) - FT_Done_Face( face ); - - if ( file > 1 ) - file--; - - goto NewFile; - } - - if ( key == 'H' ) - { - /* enforce reloading */ - if ( file_loaded >= 1 ) - FT_Done_Face( face ); - - goto NewFile; - } - - if ( ptsize != old_ptsize ) - { - Reset_Scale( ptsize ); - - old_ptsize = ptsize; - } - } - - End: - grDoneSurface( surface ); - grDoneDevices(); - - free ( multimaster ); - FT_Done_Face ( face ); - FT_Done_FreeType( library ); - - printf( "Execution completed successfully.\n" ); - printf( "Fails = %d\n", Fail ); - - exit( 0 ); /* for safety reasons */ - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftpatchk.c freetype-2.8/=unpacked-tar1=/src/ftpatchk.c --- freetype-2.7.1/=unpacked-tar1=/src/ftpatchk.c 2015-10-09 07:14:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftpatchk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2007 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* FTpatchk - a simple program that tests whether patented hinting is */ -/* necessary. */ -/* */ -/****************************************************************************/ - - -#include -#include - -#include -#include FT_FREETYPE_H - - - int - main( int argc, - char* argv[] ) - { - FT_Error error; - FT_Library library; - - - error = FT_Init_FreeType( &library ); - if ( error ) - { - fprintf( stderr, "could not create FreeType instance\n" ); - exit( 1 ); - } - - for ( ; argc > 1; argc--, argv++ ) - { - FT_Face face; - - - error = FT_New_Face( library, argv[1], 0, &face ); - if ( error ) - { - fprintf( stderr, "could not open as a valid font: `%s'\n", argv[1] ); - continue; - } - printf( "%-50s %s\n", argv[1], - FT_Face_CheckTrueTypePatents( face ) - ? "uses patented opcodes" - : "doesn't use patented opcodes" ); - } - - exit( 0 ); - return 0; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftsbit.c freetype-2.8/=unpacked-tar1=/src/ftsbit.c --- freetype-2.7.1/=unpacked-tar1=/src/ftsbit.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftsbit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,314 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-1998, 2001, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* ftsbit: a _very_ simple embedded bitmap dumper for FreeType 1.x. */ -/* */ -/* NOTE: This is just a test program that is used to show off and */ -/* debug the current engine. */ -/* */ -/****************************************************************************/ - - -#include -#include -#include - -#include -#include FT_FREETYPE_H - - -#ifdef HAVE_LIBINTL_H - -#ifdef HAVE_LOCALE_H -#include -#endif - -#include -#include "ftxerr18.h" - -#else /* !HAVE_LIBINTL */ - -#define gettext( x ) ( x ) - - /* We ignore error message strings with this function */ - - static char* TT_ErrToString18( FT_Error error ) - { - static char temp[32]; - - sprintf( temp, "0x%04lx", error ); - return temp; - } - -#endif /* !HAVE_LIBINTL */ - - - FT_Error error; - FT_Library engine; - FT_Resource resource; - - FT_Face face; - FT_Size instance; - FT_GlyphSlot glyph; - - unsigned int num_glyphs; - int ptsize; - - int Fail; - int Num; - - - - static void Usage( char* name ) - { - printf( gettext( "ftsbit: simple TrueType 'sbit' dumper -- part of the FreeType project\n" ) ); - printf( "---------------------------------------------------------------------\n" ); - printf( "\n" ); - printf( gettext( "Usage: %s ppem fontname (index)* (index1-index2)*\n\n" ), name ); - printf( gettext( " or %s -a ppem fontname (dumps all glyphs)\n" ), name ); - printf( "\n" ); - - exit( EXIT_FAILURE ); - } - - - - static - void dump_bitmap( FT_GlyphSlot glyph, int glyph_index ) - { - /* Dump the resulting bitmap */ - { - int y; - unsigned char* line = (unsigned char*)glyph->bitmap.buffer; - - printf( "glyph index %d = %dx%d pixels, ", - glyph_index, glyph->bitmap.rows, glyph->bitmap.width ); - - printf( "advance = %d, minBearing = [%d,%d]\n", - glyph->metrics.horiAdvance >> 6, - glyph->metrics.horiBearingX >> 6, - glyph->metrics.horiBearingY >> 6 ); - - for ( y = 0; y < glyph->bitmap.rows; y++, line += glyph->bitmap.cols ) - { - unsigned char* ptr = line; - int x; - unsigned char mask = 0x80; - - for ( x = 0; x < glyph->bitmap.width; x++ ) - { - printf( "%c", (ptr[0] & mask) ? '*' : '.' ); - mask >>= 1; - if (mask == 0) - { - mask = 0x80; - ptr++; - } - } - - printf( "\n" ); - } - } - } - - - - static - void dump_range( FT_GlyphSlot glyph, - int first_glyph, - int last_glyph ) - { - int i; - - for ( i = first_glyph; i <= last_glyph; i++ ) - { - error = FT_Load_Glyph( glyph, - instance, - (unsigned short)i, - FT_LOAD_NO_OUTLINE, - 0 ); - if (error) - { - printf( " no bitmap for glyph %d\n", i ); - printf( gettext( "FreeType error message: %s\n" ), - TT_ErrToString18( error ) ); - continue; - } - - dump_bitmap(glyph,i); - } - } - - - - - int main( int argc, char** argv ) - { - int i; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - char* fname; - int dump_all = 0; - - -#ifdef HAVE_LIBINTL_H - setlocale( LC_ALL, "" ); - bindtextdomain( "freetype", LOCALEDIR ); - textdomain( "freetype" ); -#endif - - execname = argv[0]; - - if ( argc < 3 ) - Usage( execname ); - - if ( argv[1][0] == '-' && - argv[1][1] == 'a' ) - { - argv++; - argc--; - dump_all = 1; - } - - if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) - Usage( execname ); - - /* Initialize engine */ - if ( (error = FT_Init_FreeType( &engine )) ) - { - fprintf( stderr, gettext( "Error while initializing engine\n" ) ); - goto Failure; - } - - /* Now check all files */ - fname = argv[2]; - i = strlen( fname ); - while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) - { - if ( fname[i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, fname, 1024 ); - strncpy( alt_filename, fname, 1024 ); - - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } - - /* Load face */ - error = FT_New_Resource( engine, filename, &resource ); - if (error) - { - strcpy( filename, alt_filename ); - error = FT_New_Resource( engine, alt_filename, &resource ); - } - - i = strlen( filename ); - fname = filename; - - while ( i >= 0 ) - if ( filename[i] == '/' || filename[i] == '\\' ) - { - fname = filename + i + 1; - i = -1; - } - else - i--; - - if ( error ) - { - printf( gettext( "Could not find or open file.\n" ) ); - goto Failure; - } - - error = FT_New_Face( resource, 0, &face ); - if (error) - { - printf( gettext( "Could not create face object.\n " ) ); - goto Failure; - } - - /* get face properties */ - num_glyphs = face->num_glyphs; - - /* create instance */ - error = FT_New_Size( face, &instance ); - if ( error ) - { - printf( gettext( "Could not create instance.\n" ) ); - goto Failure; - } - - error = FT_Set_Pixel_Sizes( instance, ptsize, ptsize ); - if (error) - { - printf( gettext( "Could not set character size.\n" ) ); - goto Failure; - } - - glyph = face->slot; - - if (dump_all) - dump_range( glyph, 0, num_glyphs-1 ); - else - { - for ( i = 3; i < argc; i++ ) - { - /* check for range in argument string */ - int range_check = 0; - char* base = argv[i]; - char* cur = base; - int first, last; - - while (*cur) - { - if (*cur == '-') - { - range_check = 1; - break; - } - cur++; - } - - if (range_check) - { - if ( sscanf( argv[i], "%d-%d", &first, &last ) != 2 ) - Usage( execname ); - - dump_range( glyph, first, last ); - } - else - { - if ( sscanf( argv[i], "%d", &first ) != 1 ) - Usage( execname ); - - dump_range( glyph, first, first ); - } - } - } - - FT_Done_FreeType( engine ); - exit( EXIT_SUCCESS ); /* for safety reasons */ - - return 0; /* never reached */ - - Failure: - printf( gettext( "FreeType error message: %s\n" ), - TT_ErrToString18( error ) ); - exit( EXIT_FAILURE ); - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftstring.1 freetype-2.8/=unpacked-tar1=/src/ftstring.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftstring.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftstring.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -.TH FTSTRING 1 "December 2016" "Freetype 2.7.1" -. -. -.SH NAME -. -ftstring \- string viewer -. -. -.SH SYNOPSIS -. -.B ftstring -.RI [ options ] -.I pt font .\|.\|. -. -. -.SH DESCRIPTION -. -.B ftstring -displays a text string with the given font, allowing to change -various rendering and display options interactively. -. -.TP -.B pt -The point size for the given resolution. -If resolution is 72dpi, this directly gives the ppem value (pixels per EM). -. -.TP -.B font -The font file(s) to display. -For Type 1 font files, -.B ftstring -also tries to attach the corresponding metrics file (with extension `.afm' -or `.pfm'). -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI \-w \ w -Set the window width to -.I w -pixels (default: 640px). -. -.TP -.BI \-h \ h -Set the window height to -.I h -pixels (default: 480px). -. -.TP -.BI \-r \ r -Use resolution -.I r -dpi (default: 72dpi). -. -.TP -.BI \-e \ enc -Specify encoding tag (default: no encoding). -Common values: -.B unic -(Unicode), -.B symb -(symbol), -.B ADOB -(Adobe standard), -.B ADBC -(Adobe custom). -. -.TP -.BI \-m \ text -Use -.I text -for rendering. -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftstring.c freetype-2.8/=unpacked-tar1=/src/ftstring.c --- freetype-2.7.1/=unpacked-tar1=/src/ftstring.c 2016-10-28 22:13:50.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftstring.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,842 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2007, 2009-2016 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* ftstring.c - simple text string display */ -/* */ -/****************************************************************************/ - - -#include "ftcommon.h" -#include "common.h" -#include "mlgetopt.h" - -#include -#include -#include -#include -#include - -#include FT_LCD_FILTER_H - -#define CELLSTRING_HEIGHT 8 -#define MAXPTSIZE 500 /* dtp */ - - - static const char* Sample[] = - { - "The quick brown fox jumps over the lazy dog", - - /* Luís argüia à Júlia que «brações, fé, chá, óxido, pôr, zângão» */ - /* eram palavras do português */ - "Lu\u00EDs arg\u00FCia \u00E0 J\u00FAlia que \u00ABbra\u00E7\u00F5es, " - "f\u00E9, ch\u00E1, \u00F3xido, p\u00F4r, z\u00E2ng\u00E3o\u00BB eram " - "palavras do portugu\u00EAs", - - /* Ο καλÏμνιος σφουγγαÏάς ψιθÏÏισε πως θα βουτήξει χωÏίς να διστάζει */ - "\u039F \u03BA\u03B1\u03BB\u03CD\u03BC\u03BD\u03B9\u03BF\u03C2 \u03C3" - "\u03C6\u03BF\u03C5\u03B3\u03B3\u03B1\u03C1\u03AC\u03C2 \u03C8\u03B9" - "\u03B8\u03CD\u03C1\u03B9\u03C3\u03B5 \u03C0\u03C9\u03C2 \u03B8\u03B1 " - "\u03B2\u03BF\u03C5\u03C4\u03AE\u03BE\u03B5\u03B9 \u03C7\u03C9\u03C1" - "\u03AF\u03C2 \u03BD\u03B1 \u03B4\u03B9\u03C3\u03C4\u03AC\u03B6\u03B5" - "\u03B9", - - /* Съешь ещё Ñтих мÑгких французÑких булок да выпей же чаю */ - "\u0421\u044A\u0435\u0448\u044C \u0435\u0449\u0451 \u044D\u0442\u0438" - "\u0445 \u043C\u044F\u0433\u043A\u0438\u0445 \u0444\u0440\u0430\u043D" - "\u0446\u0443\u0437\u0441\u043A\u0438\u0445 \u0431\u0443\u043B\u043E" - "\u043A \u0434\u0430 \u0432\u044B\u043F\u0435\u0439 \u0436\u0435 " - "\u0447\u0430\u044E", - - /* 天地玄黃,宇宙洪è’。日月盈昃,辰宿列張。寒來暑往,秋收冬è—。*/ - "\u5929\u5730\u7384\u9EC3\uFF0C\u5B87\u5B99\u6D2A\u8352\u3002\u65E5" - "\u6708\u76C8\u6603\uFF0C\u8FB0\u5BBF\u5217\u5F35\u3002\u5BD2\u4F86" - "\u6691\u5F80\uFF0C\u79CB\u6536\u51AC\u85CF\u3002", - - /* ã„ã‚ã¯ã«ã»ã¸ã¨ ã¡ã‚Šã¬ã‚‹ã‚’ ã‚ã‹ã‚ˆãŸã‚Œã ã¤ã­ãªã‚‰ã‚€ */ - /* ã†ã‚ã®ãŠãã‚„ã¾ ã‘ãµã“ãˆã¦ ã‚ã•ãゆã‚ã¿ã— ã‚‘ã²ã‚‚ã›ã™ */ - "\u3044\u308D\u306F\u306B\u307B\u3078\u3068 \u3061\u308A\u306C\u308B" - "\u3092 \u308F\u304B\u3088\u305F\u308C\u305D \u3064\u306D\u306A\u3089" - "\u3080 \u3046\u3090\u306E\u304A\u304F\u3084\u307E \u3051\u3075\u3053" - "\u3048\u3066 \u3042\u3055\u304D\u3086\u3081\u307F\u3057 \u3091\u3072" - "\u3082\u305B\u3059", - - /* í‚¤ìŠ¤ì˜ ê³ ìœ ì¡°ê±´ì€ ìž…ìˆ ë¼ë¦¬ 만나야 하고 특별한 ê¸°ìˆ ì€ í•„ìš”ì¹˜ 않다 */ - "\uD0A4\uC2A4\uC758 \uACE0\uC720\uC870\uAC74\uC740 \uC785\uC220\uB07C" - "\uB9AC \uB9CC\uB098\uC57C \uD558\uACE0 \uD2B9\uBCC4\uD55C \uAE30" - "\uC220\uC740 \uD544\uC694\uCE58 \uC54A\uB2E4" - }; - - enum - { - RENDER_MODE_STRING, - RENDER_MODE_KERNCMP, - N_RENDER_MODES - }; - - static struct status_ - { - int width; - int height; - - int render_mode; - unsigned long encoding; - int res; - int ptsize; /* current point size */ - double gamma; - int angle; - const char* text; - - FTDemo_String_Context sc; - - FT_Byte gamma_ramp[256]; /* for show only */ - FT_Matrix trans_matrix; - int font_index; - char* header; - char header_buffer[256]; - - } status = { DIM_X, DIM_Y, - RENDER_MODE_STRING, FT_ENCODING_UNICODE, 72, 48, GAMMA, 0, NULL, - { 0, 0, 0, 0, NULL }, - { 0 }, { 0, 0, 0, 0 }, 0, NULL, { 0 } }; - - static FTDemo_Display* display; - static FTDemo_Handle* handle; - - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** E V E N T H A N D L I N G ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - static void - event_help( void ) - { - char buf[256]; - char version[64]; - - const char* format; - FT_Int major, minor, patch; - - grEvent dummy_event; - - - FT_Library_Version( handle->library, &major, &minor, &patch ); - - format = patch ? "%d.%d.%d" : "%d.%d"; - sprintf( version, format, major, minor, patch ); - - FTDemo_Display_Clear( display ); - grSetLineHeight( 10 ); - grGotoxy( 0, 0 ); - grSetMargin( 2, 1 ); - grGotobitmap( display->bitmap ); - - sprintf( buf, - "FreeType String Viewer - part of the FreeType %s test suite", - version ); - - grWriteln( buf ); - grLn(); - grWriteln( "This program is used to display a string of text using" ); - grWriteln( "the new convenience API of the FreeType 2 library." ); - grLn(); - grWriteln( "Use the following keys :" ); - grLn(); - grWriteln( " F1 or ? : display this help screen" ); - grLn(); - grWriteln( " a : toggle anti-aliasing" ); - grWriteln( " b : toggle embedded bitmaps (and disable rotation)" ); - grWriteln( " f : toggle forced auto-hinting" ); - grWriteln( " h : toggle outline hinting" ); - grLn(); - grWriteln( " 1-2 : select rendering mode" ); - grWriteln( " l : cycle through LCD modes" ); - grWriteln( " k : cycle through kerning modes" ); - grWriteln( " t : cycle through kerning degrees" ); - grWriteln( " Space : cycle through color" ); - grWriteln( " Tab : cycle through sample strings" ); - grWriteln( " V : toggle vertical rendering" ); - grLn(); - grWriteln( " g : increase gamma by 0.1" ); - grWriteln( " v : decrease gamma by 0.1" ); - grLn(); - grWriteln( " n : next font" ); - grWriteln( " p : previous font" ); - grLn(); - grWriteln( " Up : increase pointsize by 1 unit" ); - grWriteln( " Down : decrease pointsize by 1 unit" ); - grWriteln( " Page Up : increase pointsize by 10 units" ); - grWriteln( " Page Down : decrease pointsize by 10 units" ); - grLn(); - grWriteln( " Right : rotate counter-clockwise" ); - grWriteln( " Left : rotate clockwise" ); - grWriteln( " F7 : big rotate counter-clockwise" ); - grWriteln( " F8 : big rotate clockwise" ); - grLn(); - grWriteln( "press any key to exit this help screen" ); - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, gr_event_key, &dummy_event ); - } - - - static void - event_font_change( int delta ) - { - if ( status.font_index + delta >= handle->num_fonts || - status.font_index + delta < 0 ) - return; - - status.font_index += delta; - - FTDemo_Set_Current_Font( handle, handle->fonts[status.font_index] ); - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - FTDemo_Update_Current_Flags( handle ); - - FTDemo_String_Set( handle, status.text ); - } - - - static void - event_angle_change( int delta ) - { - double radian; - FT_Fixed cosinus; - FT_Fixed sinus; - - - status.angle += delta; - - if ( status.angle <= -180 ) - status.angle += 360; - if ( status.angle > 180 ) - status.angle -= 360; - - if ( status.angle == 0 ) - { - status.sc.matrix = NULL; - - return; - } - - status.sc.matrix = &status.trans_matrix; - - radian = status.angle * 3.14159265 / 180.0; - cosinus = (FT_Fixed)( cos( radian ) * 65536.0 ); - sinus = (FT_Fixed)( sin( radian ) * 65536.0 ); - - status.trans_matrix.xx = cosinus; - status.trans_matrix.yx = sinus; - status.trans_matrix.xy = -sinus; - status.trans_matrix.yy = cosinus; - } - - - static void - event_lcdmode_change( void ) - { - const char *lcd_mode; - - - handle->lcd_mode++; - - switch ( handle->lcd_mode ) - { - case LCD_MODE_LIGHT: - lcd_mode = " light AA"; - break; - case LCD_MODE_RGB: - lcd_mode = " LCD (horiz. RGB)"; - break; - case LCD_MODE_BGR: - lcd_mode = " LCD (horiz. BGR)"; - break; - case LCD_MODE_VRGB: - lcd_mode = " LCD (vert. RGB)"; - break; - case LCD_MODE_VBGR: - lcd_mode = " LCD (vert. BGR)"; - break; - default: - handle->lcd_mode = 0; - lcd_mode = " normal AA"; - } - - sprintf( status.header_buffer, "mode changed to %s", lcd_mode ); - status.header = status.header_buffer; - } - - - static void - event_color_change( void ) - { - static int i = 0; - unsigned char r = i & 4 ? 0xff : 0; - unsigned char g = i & 2 ? 0xff : 0; - unsigned char b = i & 1 ? 0xff : 0; - - - display->back_color = grFindColor( display->bitmap, r, g, b, 0xff ); - display->fore_color = grFindColor( display->bitmap, ~r, ~g, ~b, 0xff ); - - i++; - } - - - static void - event_text_change( void ) - { - static int i = 0; - - status.text = Sample[i]; - - i++; - if ( i >= (int)( sizeof( Sample ) / sizeof( Sample[0] ) ) ) - i = 0; - } - - static void - event_gamma_change( double delta ) - { - int i; - double gamma_inv; - - - status.gamma += delta; - - if ( status.gamma > 3.0 ) - status.gamma = 3.0; - else if ( status.gamma < 0.1 ) - status.gamma = 0.1; - - grSetGlyphGamma( status.gamma ); - - gamma_inv = 1. / status.gamma; - - for ( i = 0; i < 256; i++ ) - status.gamma_ramp[i] = (FT_Byte)( pow( (double)i / 255., gamma_inv ) - * 255. + 0.5 ); - } - - - static void - event_size_change( int delta ) - { - status.ptsize += delta; - - if ( status.ptsize < 1 * 64 ) - status.ptsize = 1 * 64; - else if ( status.ptsize > MAXPTSIZE * 64 ) - status.ptsize = MAXPTSIZE * 64; - - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - } - - - static void - event_render_mode_change( int delta ) - { - if ( delta ) - { - status.render_mode = ( status.render_mode + delta ) % N_RENDER_MODES; - - if ( status.render_mode < 0 ) - status.render_mode += N_RENDER_MODES; - } - - switch ( status.render_mode ) - { - case RENDER_MODE_STRING: - status.header = NULL; - break; - - case RENDER_MODE_KERNCMP: - status.header = (char *)"Kerning comparison"; - break; - } - } - - - static int - Process_Event( grEvent* event ) - { - FTDemo_String_Context* sc = &status.sc; - int ret = 0; - - - if ( event->key >= '1' && event->key < '1' + N_RENDER_MODES ) - { - status.render_mode = event->key - '1'; - event_render_mode_change( 0 ); - - return ret; - } - - switch ( event->key ) - { - case grKeyEsc: - case grKEY( 'q' ): - ret = 1; - break; - - case grKeyF1: - case grKEY( '?' ): - event_help(); - break; - - case grKEY( 'a' ): - handle->antialias = !handle->antialias; - status.header = handle->antialias - ? (char *)"anti-aliasing is now on" - : (char *)"anti-aliasing is now off"; - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'b' ): - handle->use_sbits = !handle->use_sbits; - status.header = handle->use_sbits - ? (char *)"embedded bitmaps are now used when available" - : (char *)"embedded bitmaps are now ignored"; - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'f' ): - handle->autohint = !handle->autohint; - status.header = handle->autohint - ? (char *)"forced auto-hinting is now on" - : (char *)"forced auto-hinting is now off"; - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'h' ): - handle->hinted = !handle->hinted; - status.header = handle->hinted - ? (char *)"glyph hinting is now active" - : (char *)"glyph hinting is now ignored"; - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'l' ): - event_lcdmode_change(); - - FTDemo_Update_Current_Flags( handle ); - break; - - case grKEY( 'k' ): - sc->kerning_mode = ( sc->kerning_mode + 1 ) % N_KERNING_MODES; - status.header = - sc->kerning_mode == KERNING_MODE_SMART - ? (char *)"pair kerning and side bearing correction is now active" - : sc->kerning_mode == KERNING_MODE_NORMAL - ? (char *)"pair kerning is now active" - : (char *)"pair kerning is now ignored"; - break; - - case grKEY( 't' ): - sc->kerning_degree = ( sc->kerning_degree + 1 ) % N_KERNING_DEGREES; - status.header = - sc->kerning_degree == KERNING_DEGREE_NONE - ? (char *)"no track kerning" - : sc->kerning_degree == KERNING_DEGREE_LIGHT - ? (char *)"light track kerning active" - : sc->kerning_degree == KERNING_DEGREE_MEDIUM - ? (char *)"medium track kerning active" - : (char *)"tight track kerning active"; - break; - - case grKeySpace: - event_color_change(); - break; - - case grKeyTab: - event_text_change(); - FTDemo_String_Set( handle, status.text ); - break; - - case grKEY( 'V' ): - sc->vertical = !sc->vertical; - status.header = sc->vertical - ? (char *)"using vertical layout" - : (char *)"using horizontal layout"; - break; - - case grKEY( 'g' ): - event_gamma_change( 0.1 ); - break; - - case grKEY( 'v' ): - event_gamma_change( -0.1 ); - break; - - case grKEY( 'n' ): - event_font_change( 1 ); - break; - - case grKEY( 'p' ): - event_font_change( -1 ); - break; - - case grKeyUp: event_size_change( 64 ); break; - case grKeyDown: event_size_change( -64 ); break; - case grKeyPageUp: event_size_change( 640 ); break; - case grKeyPageDown: event_size_change( -640 ); break; - - case grKeyLeft: event_angle_change( -3 ); break; - case grKeyRight: event_angle_change( 3 ); break; - case grKeyF7: event_angle_change( -30 ); break; - case grKeyF8: event_angle_change( 30 ); break; - - default: - break; - } - - return ret; - } - - - static void - gamma_ramp_draw( FT_Byte gamma_ramp[256], - grBitmap* bitmap ) - { - int i, x, y; - int bpp = bitmap->pitch / bitmap->width; - FT_Byte* p = (FT_Byte*)bitmap->buffer; - - - if ( bitmap->pitch < 0 ) - p += -bitmap->pitch * ( bitmap->rows - 1 ); - - x = ( bitmap->width - 256 ) / 2; - y = ( bitmap->rows + 256 ) / 2; - - for (i = 0; i < 256; i++) - p[bitmap->pitch * ( y - gamma_ramp[i] ) + bpp * ( x + i )] ^= 0xFF; - } - - - static void - write_header( FT_Error error_code ) - { - FT_Face face; - const char* basename; - - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - if ( error ) - PanicZ( "can't access font file" ); - - if ( !status.header ) - { - basename = ft_basename( handle->current_font->filepathname ); - - switch ( error_code ) - { - case FT_Err_Ok: - sprintf( status.header_buffer, - "%.50s %.50s (file `%.100s')", face->family_name, - face->style_name, basename ); - break; - - case FT_Err_Invalid_Pixel_Size: - sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", - basename ); - break; - - case FT_Err_Invalid_PPem: - sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", - basename ); - break; - - default: - sprintf( status.header_buffer, "File `%.100s': error 0x%04x", basename, - (FT_UShort)error_code ); - break; - } - - status.header = status.header_buffer; - } - - grWriteCellString( display->bitmap, 0, 0, - status.header, display->fore_color ); - - sprintf( status.header_buffer, "at %g points, angle = %d, gamma = %g", - status.ptsize / 64.0, status.angle, status.gamma ); - grWriteCellString( display->bitmap, 0, CELLSTRING_HEIGHT, - status.header_buffer, display->fore_color ); - - grRefreshSurface( display->surface ); - } - - - static void - usage( char* execname ) - { - fprintf( stderr, - "\n" - "ftstring: string viewer -- part of the FreeType project\n" - "-------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] pt font ...\n" - "\n", - execname ); - fprintf( stderr, - " pt The point size for the given resolution.\n" - " If resolution is 72dpi, this directly gives the\n" - " ppem value (pixels per EM).\n" ); - fprintf( stderr, - " font The font file(s) to display.\n" - " For Type 1 font files, ftstring also tries to attach\n" - " the corresponding metrics file (with extension\n" - " `.afm' or `.pfm').\n" - "\n" ); - fprintf( stderr, - " -w W Set the window width to W pixels (default: %dpx).\n" - " -h H Set the window height to H pixels (default: %dpx).\n" - "\n", - DIM_X, DIM_Y ); - fprintf( stderr, - " -r R Use resolution R dpi (default: 72dpi).\n" - " -e enc Specify encoding tag (default: no encoding).\n" - " Common values: `unic' (Unicode), `symb' (symbol),\n" - " `ADOB' (Adobe standard), `ADBC' (Adobe custom).\n" - " -m text Use `text' for rendering.\n" - "\n" - " -v Show version.\n" - "\n" ); - - exit( 1 ); - } - - - static void - parse_cmdline( int* argc, - char*** argv ) - { - char* execname; - int option; - - - execname = ft_basename( (*argv)[0] ); - - while ( 1 ) - { - option = getopt( *argc, *argv, "e:h:m:r:vw:" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'e': - status.encoding = FTDemo_Make_Encoding_Tag( optarg ); - break; - - case 'h': - status.height = atoi( optarg ); - if ( status.height < 1 ) - usage( execname ); - break; - - case 'm': - if ( *argc < 3 ) - usage( execname ); - status.text = optarg; - break; - - case 'r': - status.res = atoi( optarg ); - if ( status.res < 1 ) - usage( execname ); - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( handle->library, &major, &minor, &patch ); - - printf( "ftstring (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - case 'w': - status.width = atoi( optarg ); - if ( status.width < 1 ) - usage( execname ); - break; - - default: - usage( execname ); - break; - } - } - - *argc -= optind; - *argv += optind; - - if ( *argc <= 1 ) - usage( execname ); - - status.ptsize = (int)( atof( *argv[0] ) * 64.0 ); - if ( status.ptsize == 0 ) - status.ptsize = 64; - - (*argc)--; - (*argv)++; - } - - - int - main( int argc, - char** argv ) - { - grEvent event; - - - /* Initialize engine */ - handle = FTDemo_New(); - - parse_cmdline( &argc, &argv ); - - FT_Library_SetLcdFilter( handle->library, FT_LCD_FILTER_LIGHT ); - - handle->encoding = status.encoding; - handle->use_sbits = 0; - FTDemo_Update_Current_Flags( handle ); - - for ( ; argc > 0; argc--, argv++ ) - { - error = FTDemo_Install_Font( handle, argv[0], 0, 0 ); - - if ( error ) - { - fprintf( stderr, "failed to install %s", argv[0] ); - if ( error == FT_Err_Invalid_CharMap_Handle ) - fprintf( stderr, ": missing valid charmap\n" ); - else - fprintf( stderr, "\n" ); - } - } - - if ( handle->num_fonts == 0 ) - PanicZ( "could not open any font file" ); - - display = FTDemo_Display_New( gr_pixel_mode_rgb24, - status.width, status.height ); - - if ( !display ) - PanicZ( "could not allocate display surface" ); - - grSetTitle( display->surface, - "FreeType String Viewer - press ? for help" ); - - status.header = NULL; - - if ( !status.text ) - event_text_change(); - - event_color_change(); - event_gamma_change( 0 ); - event_font_change( 0 ); - - do - { - FTDemo_Display_Clear( display ); - - gamma_ramp_draw( status.gamma_ramp, display->bitmap ); - - switch ( status.render_mode ) - { - case RENDER_MODE_STRING: - status.sc.center = 1L << 15; - error = FTDemo_String_Draw( handle, display, - &status.sc, - display->bitmap->width / 2, - display->bitmap->rows / 2 ); - break; - - case RENDER_MODE_KERNCMP: - { - FTDemo_String_Context sc = status.sc; - FT_Int x, y; - FT_Int height; - - - x = 55; - - height = ( status.ptsize * status.res / 72 + 32 ) >> 6; - if ( height < CELLSTRING_HEIGHT ) - height = CELLSTRING_HEIGHT; - - /* First line: none */ - sc.center = 0; - sc.kerning_mode = 0; - sc.kerning_degree = 0; - sc.vertical = 0; - sc.matrix = NULL; - - y = CELLSTRING_HEIGHT * 2 + display->bitmap->rows / 4 + height; - grWriteCellString( display->bitmap, 5, - y - ( height + CELLSTRING_HEIGHT ) / 2, - "none", display->fore_color ); - error = FTDemo_String_Draw( handle, display, &sc, x, y ); - - /* Second line: track kern only */ - sc.kerning_degree = status.sc.kerning_degree; - - y += height; - grWriteCellString( display->bitmap, 5, - y - ( height + CELLSTRING_HEIGHT ) / 2, - "track", display->fore_color ); - error = FTDemo_String_Draw( handle, display, &sc, x, y ); - - /* Third line: track kern + pair kern */ - sc.kerning_mode = status.sc.kerning_mode; - - y += height; - grWriteCellString( display->bitmap, 5, - y - ( height + CELLSTRING_HEIGHT ) / 2, - "both", display->fore_color ); - error = FTDemo_String_Draw( handle, display, &sc, x, y ); - } - break; - } - - write_header( error ); - - status.header = 0; - grListenSurface( display->surface, 0, &event ); - } while ( !Process_Event( &event ) ); - - printf( "Execution completed successfully.\n" ); - - FTDemo_Display_Done( display ); - FTDemo_Done( handle ); - exit( 0 ); /* for safety reasons */ - - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/fttimer.c freetype-2.8/=unpacked-tar1=/src/fttimer.c --- freetype-2.7.1/=unpacked-tar1=/src/fttimer.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/fttimer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,351 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project - a Free and Portable Quality TrueType Renderer. */ -/* */ -/* Copyright 1996-1998, 2003, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* fttimer: A simple performance benchmark. Now with graylevel rendering */ -/* with the '-g' option. */ -/* */ -/* Be aware that the timer program benchmarks different things */ -/* in each release of the FreeType library. Thus, performance */ -/* should only be compared between similar release numbers. */ -/* */ -/* */ -/* NOTE: This is just a test program that is used to show off and */ -/* debug the current engine. In no way does it shows the final */ -/* high-level interface that client applications will use. */ -/* */ -/****************************************************************************/ - -#include -#include FT_FREETYPE_H -#include FT_GLYPH_H - -#include -#include -#include -#include /* for clock() */ - - /* SunOS 4.1.* does not define CLOCKS_PER_SEC, so include */ - /* to get the HZ macro which is the equivalent. */ -#if defined( __sun__ ) && !defined( SVR4 ) && !defined( __SVR4 ) -#include -#define CLOCKS_PER_SEC HZ -#endif - -#define CHARSIZE 400 /* character point size */ -#define MAX_GLYPHS 512 /* Maximum number of glyphs rendered at one time */ - - char Header[128]; - - FT_Error error; - FT_Library library; - - FT_Face face; - - int num_glyphs; - FT_Glyph glyphs[MAX_GLYPHS]; - - int tab_glyphs; - int cur_glyph; - - int pixel_size = CHARSIZE; - int repeat_count = 1; - - int Fail; - int Num; - - short antialias = 1; /* smooth fonts with gray levels */ - short force_low; - - - static void - Panic( const char* message ) - { - fprintf( stderr, "%s\n", message ); - exit( 1 ); - } - - - /*******************************************************************/ - /* */ - /* Get_Time: */ - /* */ - /* Returns the current time in milliseconds. */ - /* */ - /*******************************************************************/ - - static long - Get_Time( void ) - { - return clock() * 10000 / CLOCKS_PER_SEC; - } - - - /*******************************************************************/ - /* */ - /* LoadChar: */ - /* */ - /* Loads a glyph into memory. */ - /* */ - /*******************************************************************/ - - static FT_Error - LoadChar( int idx ) - { - FT_Glyph glyph; - - - /* load the glyph in the glyph slot */ - error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || - FT_Get_Glyph ( face->glyph, &glyph ); - if ( !error ) - glyphs[cur_glyph++] = glyph; - - return error; - } - - - /*******************************************************************/ - /* */ - /* ConvertRaster: */ - /* */ - /* Performs scan conversion. */ - /* */ - /*******************************************************************/ - - static FT_Error - ConvertRaster( int idx ) - { - FT_Glyph bitmap; - - - bitmap = glyphs[idx]; - if ( bitmap->format == FT_GLYPH_FORMAT_BITMAP ) - error = 0; /* we already have a (embedded) bitmap */ - else - { - error = FT_Glyph_To_Bitmap( &bitmap, - antialias ? FT_RENDER_MODE_NORMAL - : FT_RENDER_MODE_MONO, - 0, - 0 ); - if ( !error ) - FT_Done_Glyph( bitmap ); - } - - return error; - } - - - static void - Usage( void ) - { - fprintf( stderr, "fttimer: simple performance timer -- part of the FreeType project\n" ); - fprintf( stderr, "-----------------------------------------------------------------\n\n" ); - fprintf( stderr, "Usage: fttimer [options] fontname[.ttf|.ttc]\n\n" ); - fprintf( stderr, "options:\n"); - fprintf( stderr, " -r : repeat count to be used (default is 1)\n" ); - fprintf( stderr, " -s : character pixel size (default is 600)\n" ); - fprintf( stderr, " -m : render monochrome glyphs (default is anti-aliased)\n" ); - fprintf( stderr, " -a : use smooth anti-aliaser\n" ); - fprintf( stderr, " -l : force low quality even at small sizes\n" ); - - exit( 1 ); - } - - - int - main( int argc, - char** argv ) - { - int i, total, base, rendered_glyphs; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - - long t, t0, tz0; - - - antialias = 1; - force_low = 0; - - while ( argc > 1 && argv[1][0] == '-' ) - { - switch ( argv[1][1] ) - { - case 'm': - antialias = 0; - break; - - case 'l': - force_low = 1; - break; - - case 's': - argc--; - argv++; - if ( argc < 2 || - sscanf( argv[1], "%d", &pixel_size ) != 1 ) - Usage(); - break; - - case 'r': - argc--; - argv++; - if ( argc < 2 || - sscanf( argv[1], "%d", &repeat_count ) != 1 ) - Usage(); - if ( repeat_count < 1 ) - repeat_count = 1; - break; - - default: - fprintf( stderr, "Unknown argument `%s'\n", argv[1] ); - Usage(); - break; - } - - argc--; - argv++; - } - - if ( argc != 2 ) - Usage(); - - i = strlen( argv[1] ); - while ( i > 0 && argv[1][i] != '\\' ) - { - if ( argv[1][i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, argv[1], 1024 ); - strncpy( alt_filename, argv[1], 1024 ); - - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } - - /* Initialize engine */ - - if ( ( error = FT_Init_FreeType( &library ) ) != 0 ) - Panic( "Error while initializing engine" ); - - /* Load face */ - - error = FT_New_Face( library, filename, 0, &face ); - if ( error == FT_Err_Cannot_Open_Stream ) - Panic( "Could not find/open font resource" ); - else if ( error ) - Panic( "Error while opening font resource" ); - - /* get face properties and allocate preload arrays */ - - num_glyphs = face->num_glyphs; - - tab_glyphs = MAX_GLYPHS; - if ( tab_glyphs > num_glyphs ) - tab_glyphs = num_glyphs; - - /* create size */ - - error = FT_Set_Pixel_Sizes( face, pixel_size, pixel_size ); - if ( error ) - Panic( "Could not reset instance" ); - - Num = 0; - Fail = 0; - - total = num_glyphs; - base = 0; - - rendered_glyphs = 0; - - t0 = 0; /* Initial time */ - - tz0 = Get_Time(); - - while ( total > 0 ) - { - int repeat; - - - /* First, preload 'tab_glyphs' in memory */ - cur_glyph = 0; - - printf( "loading %d glyphs", tab_glyphs ); - - for ( Num = 0; Num < tab_glyphs; Num++ ) - { - error = LoadChar( base + Num ); - if ( error ) - Fail++; - - total--; - } - - base += tab_glyphs; - - if ( tab_glyphs > total ) - tab_glyphs = total; - - printf( ", rendering... " ); - - /* Now, render the loaded glyphs */ - - t = Get_Time(); - - for ( repeat = 0; repeat < repeat_count; repeat++ ) - { - for ( Num = 0; Num < cur_glyph; Num++ ) - { - if ( ( error = ConvertRaster( Num ) ) != 0 ) - Fail++; - else - rendered_glyphs++; - } - } - - t = Get_Time() - t; - if ( t < 0 ) - t += 1000 * 60 * 60; - - printf( " = %f s\n", (double)t / 10000 ); - t0 += t; - - /* Now free all loaded outlines */ - for ( Num = 0; Num < cur_glyph; Num++ ) - FT_Done_Glyph( glyphs[Num] ); - } - - tz0 = Get_Time() - tz0; - - FT_Done_Face( face ); - - printf( "\n" ); - printf( "rendered glyphs = %d\n", rendered_glyphs ); - printf( "render time = %f s\n", (double)t0 / 10000 ); - printf( "fails = %d\n", Fail ); - printf( "average glyphs/s = %f\n", - (double)rendered_glyphs / t0 * 10000 ); - - printf( "total timing = %f s\n", (double)tz0 / 10000 ); - printf( "Fails = %d\n", Fail ); - - FT_Done_FreeType( library ); - - exit( 0 ); /* for safety reasons */ - - return 0; /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/fttry.c freetype-2.8/=unpacked-tar1=/src/fttry.c --- freetype-2.7.1/=unpacked-tar1=/src/fttry.c 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/fttry.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,180 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-1998, 2001, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* ftlint: a simple TrueType instruction tester. */ -/* */ -/* NOTE: This is just a test program that is used to show off and */ -/* debug the current engine. */ -/* */ -/****************************************************************************/ - - -#include -#include FT_FREETYPE_H - -#include -#include -#include - - -#define DUMP_NAME - -#define gettext( x ) ( x ) - - - FT_Error error; - - FT_Library library; - FT_Face face; - - unsigned int num_glyphs; - int ptsize; - - int Fail; - int Num; - - - static void - Usage( char* name ) - { - printf( "fttry: simple TrueType instruction tester -- part of the FreeType project\n" ); - printf( "--------------------------------------------------------------------------\n" ); - printf( "\n" ); - printf( "Usage: %s ppem glyph fontname [fontname2..]\n\n", name ); - printf( " or %s -u glyph fontname [fontname2..]\n", name ); - printf( " to load an unscaled glyph\n\n" ); - - exit( 1 ); - } - - - static void - Panic( const char* message ) - { - fprintf( stderr, - "%s\n error code = 0x%04x\n", message, error ); - exit( 1 ); - } - - - int - main( int argc, - char** argv ) - { - int i, file_index, glyph_index; - char filename[1024 + 4]; - char alt_filename[1024 + 4]; - char* execname; - char* fname; - int load_unscaled = 0; - - - execname = argv[0]; - - if ( argc < 3 ) - Usage( execname ); - - if ( argv[1][0] == '-' && - argv[1][1] == 'u' ) - load_unscaled = 1; - else - { - if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) - Usage( execname ); - } - argc--; - argv++; - - if ( sscanf( argv[1], "%d", &glyph_index ) != 1 ) - Usage( execname ); - - error = FT_Init_FreeType( &library ); - if ( error ) - Panic( "Could not create library object" ); - - /* Now check all files */ - for ( file_index = 2; file_index < argc; file_index++ ) - { - fname = argv[file_index]; - i = strlen( fname ); - while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) - { - if ( fname[i] == '.' ) - i = 0; - i--; - } - - filename[1024] = '\0'; - alt_filename[1024] = '\0'; - - strncpy( filename, fname, 1024 ); - strncpy( alt_filename, fname, 1024 ); - - if ( i >= 0 ) - { - strncpy( filename + strlen( filename ), ".ttf", 4 ); - strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); - } - - i = strlen( filename ); - fname = filename; - - while ( i >= 0 ) - if ( filename[i] == '/' || filename[i] == '\\' ) - { - fname = filename + i + 1; - i = -1; - } - else - i--; - - printf( "%s: ", fname ); - - /* Load face */ - error = FT_New_Face( library, filename, 0, &face ); - if ( error ) - Panic( "Could not create face object" ); - - num_glyphs = face->num_glyphs; - - error = FT_Set_Char_Size( face, ptsize << 6, 0, 0, 0 ); - if ( error ) - Panic( "Could not set character size" ); - -#ifdef DUMP_NAME - { - char name[1024]; - - error = FT_Get_Glyph_Name( face, glyph_index, name, 1024 ); - if ( error ) - printf( "no glyph name available\n" ); - else - printf( "glyph name = '%s'\n", name ); - } - -#endif - - error = FT_Load_Glyph( face, - glyph_index, - load_unscaled ? FT_LOAD_NO_SCALE - : FT_LOAD_DEFAULT ); - if ( error == 0 ) - printf( "OK.\n" ); - else - printf( "Fail with error 0x%04x\n", error ); - - FT_Done_Face( face ); - } - - FT_Done_FreeType(library); - exit( 0 ); /* for safety reasons */ - - return 0; /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftvalid.1 freetype-2.8/=unpacked-tar1=/src/ftvalid.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftvalid.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftvalid.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -.TH FTVALID 1 "December 2016" "FreeType 2.7.1" -. -. -.SH NAME -. -ftvalid \- font layout table validator -. -. -.SH SYNOPSIS -. -.B ftvalid -.RI [ options ] -.I fontfile -. -. -.SH DESCRIPTION -. -.B ftvalid -is an OpenType layout table validator. -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI \-f \ index -Select font index (default: 0). -. -.TP -.BI \-t \ validator -Select validator. -Available validators are -.BR ot , -.BR gx , -and -.BR ckern . -. -.IP -Note that the availability of validators depends on -compile-time options of FreeType (this is, whether the modules -`otvalid' and `gxvalid' are compiled into the library). -. -.TP -.BI \-T \ tbls -[ot, gx] Select sfnt table name tags to be validated. -Use `:' to separate tags. -. -.IP -Supported tables in ot validator are -.BR BASE , -.BR GDEF , -.BR GPOS , -.BR GSUB , -.BR JSTF , -and -.BR MATH . -. -.IP -Supported tables in gx validator are -.BR feat , -.BR mort , -.BR morx , -.BR bsln , -.BR just , -.BR kern , -.BR opbd , -.BR trak , -.BR prop , -and -.BR lcar . -. -.IP -Example: -.B \-T \(dqfeat:morx\(dq -. -.TP -.BI \-T \ dialect -[ckern] Select classic kern dialect for validation. -Use `:' to separate dialect names. -If more than one dialect is specified, all dialects are accepted when -validating. -. -.IP -Supported dialects in ckern validator are -.B ms -and -.BR apple . -. -.TP -.BI \-l -List the layout-related SFNT tables available in the font file. -The selected validator (with option -.BR \-t ) -affects the list. -. -.IP -ckern is applicable to `kern' table only. -Option -.B \-L -lists dialects supported in ckern validator only if `kern' table is -available in the font file. -. -.TP -.BI \-V \ level -Validation level. -Possible values are -.B 0 -(default), -.B 1 -(tight), and -.B 2 -(paranoid). -. -.TP -.B \-v -Show version. -. -. -.SH ENVIRONMENT VARIABLES -. -.TP -.B FT2_DEBUG -You can specify -.RI ` component : level ' -pairs for tracing. -.I level -must be in the range [1,7]. -. -.IP -Available components for ot validator are -.BR otvmodule , -.BR otvcommon , -.BR otvbase , -.BR otvgdef , -.BR otvgpos , -.BR otvgsub , -and -.BR otvjstf . -. -.IP -Available components for gx validator are -.BR gxvmodule , -.BR gxvcommon , -.BR gxvfeat , -.BR gxvmort , -.BR gxvmorx , -.BR gxvbsln , -.BR gxvjust , -.BR gxvkern , -.BR gxvopbd , -.BR gxvtrak , -.BR gxvprop , -and -.BR gxvlcar . -.IP -Available component for ckern validator is -.B gxvkern -only. -. -.IP -Example: -.B FT2_DEBUG=\(dqotvcommon:5 gxvkern:7\(dq -. -.IP -.B FT2_DEBUG -only works if tracing support is compiled into FreeType. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftvalid.c freetype-2.8/=unpacked-tar1=/src/ftvalid.c --- freetype-2.7.1/=unpacked-tar1=/src/ftvalid.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftvalid.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,899 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality font engine */ -/* */ -/* Copyright 2005-2007, 2013 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* ftvalid: Validates layout related tables of OpenType and */ -/* TrueTypeGX/AAT. This program calls `FT_OpenType_Validate', */ -/* `FT_TrueTypeGX_Validate' or `FT_ClassicKern_Validate' on a */ -/* given file, and reports the validation result. */ -/* */ -/* */ -/* written by YAMATO Masatake and SUZUKI Toshiya. */ -/* */ -/****************************************************************************/ - - -#include - -#include FT_FREETYPE_H -#include FT_TRUETYPE_TABLES_H -#include FT_TRUETYPE_TAGS_H - -#include FT_OPENTYPE_VALIDATE_H -#include FT_GX_VALIDATE_H - - /* the following four header files shouldn't be used in normal programs */ -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_VALIDATE_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_OBJECTS_H - -#include "common.h" -#include "mlgetopt.h" - - -#include -#include -#include - - - static char* execname; - - typedef enum - { - OT_VALIDATE = 0, - GX_VALIDATE, - CKERN_VALIDATE, - - LAST_VALIDATE - - } ValidatorType; - static ValidatorType validator; - - - typedef struct TableSpecRec_ - { - FT_UInt tag; - FT_UInt validation_flag; - - } TableSpecRec, *TableSpec; - -#define MAKE_TABLE_SPEC( x ) { TTAG_##x, FT_VALIDATE_##x } - - static TableSpecRec ot_table_spec[] = - { - MAKE_TABLE_SPEC( BASE ), - MAKE_TABLE_SPEC( GDEF ), - MAKE_TABLE_SPEC( GPOS ), - MAKE_TABLE_SPEC( GSUB ), - MAKE_TABLE_SPEC( JSTF ), - MAKE_TABLE_SPEC( MATH ), - }; -#define N_OT_TABLE_SPEC ( sizeof ( ot_table_spec ) / sizeof ( TableSpecRec ) ) - - static TableSpecRec gx_table_spec[] = - { - MAKE_TABLE_SPEC( feat ), - MAKE_TABLE_SPEC( mort ), - MAKE_TABLE_SPEC( morx ), - MAKE_TABLE_SPEC( bsln ), - MAKE_TABLE_SPEC( just ), - MAKE_TABLE_SPEC( kern ), - MAKE_TABLE_SPEC( opbd ), - MAKE_TABLE_SPEC( trak ), - MAKE_TABLE_SPEC( prop ), - MAKE_TABLE_SPEC( lcar ), - }; -#define N_GX_TABLE_SPEC ( sizeof ( gx_table_spec ) / sizeof ( TableSpecRec ) ) - - - typedef struct ValidatorRec_ - { - ValidatorType type; - const char* symbol; - - const char* unimplemented_message; - int (* is_implemented)( FT_Library library ); - - FT_Error (* run) ( FT_Face face, - const char* tables, - int validation_level ); - int (* list_tables) ( FT_Face face ); - - TableSpec table_spec; - unsigned int n_table_spec; - - } ValidatorRec, *Validator; - - static int is_ot_validator_implemented ( FT_Library library ); - static int is_gx_validator_implemented ( FT_Library library ); - static int is_ckern_validator_implemented ( FT_Library library ); - - static FT_Error run_ot_validator ( FT_Face face, - const char* tables, - int validation_level ); - static FT_Error run_gx_validator ( FT_Face face, - const char* tables, - int validation_level ); - static FT_Error run_ckern_validator ( FT_Face face, - const char* dialect_request, - int validation_level ); - - static int list_ot_tables ( FT_Face face ); - static int list_gx_tables ( FT_Face face ); - static int list_ckern_tables ( FT_Face face ); - - - static ValidatorRec validators[] = - { - { - OT_VALIDATE, - "ot", - ( "FT_OpenType_Validate" - " is disabled! Recompile FreeType 2 with " - "otvalid" - " module enabled.\n" ), - is_ot_validator_implemented, - run_ot_validator, - list_ot_tables, - ot_table_spec, - N_OT_TABLE_SPEC, - }, - { - GX_VALIDATE, - "gx", - ( "FT_TrueTypeGX_Validate" - " is disabled! Recompile FreeType 2 with " - "gxvalid" - " module enabled.\n" ), - is_gx_validator_implemented, - run_gx_validator, - list_gx_tables, - gx_table_spec, - N_GX_TABLE_SPEC, - }, - { - CKERN_VALIDATE, - "ckern", - ( "FT_ClassicKern_Validate" - " is disabled! Recompile FreeType 2 with " - "gxvalid" /* NOTE: classic kern validator is in gxvalid. */ - " module enabled.\n" ), - is_ckern_validator_implemented, - run_ckern_validator, - list_ckern_tables, - NULL, - 0, - }, - }; - - - static void - panic( int error, - const char* message ) - { - fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); - exit( 1 ); - } - - - static char* - make_tag_chararray ( char chararray[4], - FT_UInt tag ) - { - chararray[0] = (char)( ( tag >> 24 ) & 0xFF ); - chararray[1] = (char)( ( tag >> 16 ) & 0xFF ); - chararray[2] = (char)( ( tag >> 8 ) & 0xFF ); - chararray[3] = (char)( ( tag >> 0 ) & 0xFF ); - return chararray; - } - - - static void - print_tag ( FILE* stream, - FT_UInt tag ) - { - char buffer[5]; - - - buffer[4] = '\0'; - fprintf( stream, "%s", make_tag_chararray( buffer, tag ) ); - } - - - /* To initialize the internal variable, call this - function with FT_Library variable. Then call - with NULL. The print messages is printed if - call with NULL. */ - static void - print_usage( FT_Library library_initializer ) - { - unsigned int i, j; - Validator v; - static FT_Library library; - - if (library_initializer) - { - library = library_initializer; - return ; - } - - fprintf( stderr, - "\n" - "ftvalid: layout table validator -- part of the FreeType project\n" - "---------------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] fontfile\n" - "\n", - execname ); - - fprintf( stderr, - "Options:\n" - "\n" ); - - fprintf( stderr, - " -f index Select font index (default: 0).\n" - "\n" ); - - fprintf( stderr, - " -t validator Select validator.\n" - " Available validators:\n" - " " ); - for ( i = 0; i < LAST_VALIDATE; i++ ) - { - v = &validators[i]; - fprintf( stderr, " %s%s", - v->symbol, - v->is_implemented( library ) ? "" - : " (NOT COMPILED IN)" ); - } - fprintf( stderr, - "\n" - "\n" ); - - fprintf( stderr, - " -T tbls [ot, gx] Select sfnt table name tags to be validated.\n" - " Use `:' to separate tags.\n" - "\n" ); - for ( i = 0; i < LAST_VALIDATE; i++ ) - { - v = &validators[i]; - - if ( v->n_table_spec == 0 ) - continue; - - fprintf( stderr, - " Supported tables in %s validator:\n" - " ", - v->symbol ); - for ( j = 0; j < v->n_table_spec; j++ ) - { - fprintf( stderr, " " ); - print_tag( stderr, v->table_spec[j].tag ); - } - fprintf( stderr, - "\n" - "\n" ); - } - fprintf( stderr, - " Example: -T \"feat:morx\"\n" - "\n" ); - - fprintf( stderr, - " -T dialect [ckern] Select classic kern dialect for validation.\n" - " Use `:' to separate dialect names.\n" - " If more than one dialect is specified,\n" - " all dialects are accepted when validating.\n" - "\n" - " Supported dialects in ckern validator:\n" - " ms apple\n" - "\n" ); - - fprintf( stderr, - " -l List the layout-related SFNT tables\n" - " available in the font file.\n" - " The selected validator (with option `-t')\n" - " affects the list.\n" - "\n" - " ckern is applicable to `kern' table only.\n" - " Option `-l' lists dialects supported in ckern validator\n" - " only if `kern' table is available in the font file.\n" - "\n" ); - - fprintf( stderr, - " -V level Validation level. Possible values:\n" - " 0 (default), 1 (tight), 2 (paranoid)\n" - "\n" ); - - fprintf( stderr, - " -v Show version." - "\n" ); - - fprintf( stderr, - "-------------------------------------------------------------------\n" - "\n" ); - - fprintf( stderr, - "`FT2_DEBUG' environment variable:\n" - "\n" - " You can specify `component:level' pairs for tracing.\n" - " `level' must be in the range [1,7].\n" - " Available components for ot validator:\n" - " otvmodule otvcommon otvbase otvgdef otvgpos otvgsub otvjstf\n" - " Available components for gx validator:\n" - " gxvmodule gxvcommon gxvfeat gxvmort gxvmorx gxvbsln gxvjust\n" - " gxvkern gxvopbd gxvtrak gxvprop gxvlcar\n" - " Available components for ckern validator:\n" - " gxvkern\n" - "\n" - " Example:\n" - "\n" - " FT2_DEBUG=\"otvcommon:5 gxvkern:7\"\n" - "\n" - "FT2_DEBUG only works if tracing support is compiled into FreeType 2\n" - "\n" ); - - exit( 1 ); - } - - - static FT_Error - try_load( FT_Face face, - FT_ULong tag ) - { - FT_ULong length; - - - length = 0; - return FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); - } - - - static FT_UInt - find_validation_flag( FT_UInt tag, - const TableSpecRec spec[], - int spec_count ) - { - int i; - - - for ( i = 0; i < spec_count; i++ ) - { - if ( tag == spec[i].tag ) - return spec[i].validation_flag; - } - - fprintf( stderr, "*** Wrong table name: " ); - print_tag( stderr, tag ); - fprintf( stderr, "\n" ); - - print_usage( NULL ); - - return 0; - } - - - static FT_UInt - parse_table_specs( const char* tables, - const TableSpecRec spec[], - int spec_count ) - { - FT_UInt validation_flags; - size_t len; - - unsigned int i; - char tag[4]; - - - validation_flags = 0; - - len = strlen( tables ); - if (( len % 5 ) != 4 ) - { - fprintf( stderr, "*** Wrong length of table names\n" ); - print_usage( NULL ); - } - - for ( i = 0; i < len; i++ ) - { - if ( ( ( i % 5 ) == 4 ) ) - { - if ( tables[i] != ':' ) - { - fprintf( stderr, "*** Wrong table separator: %c\n", tables[i] ); - print_usage( NULL ); - } - i++; - } - - tag[i % 5] = tables[i]; - if ( ( i % 5 ) == 3 ) - validation_flags |= find_validation_flag( FT_MAKE_TAG( tag[0], - tag[1], - tag[2], - tag[3] ), - spec, - spec_count ); - } - - return validation_flags; - } - - - static FT_UInt - list_face_tables( FT_Face face, - const TableSpecRec spec[], - int spec_count ) - { - FT_Error error; - - FT_UInt validation_flags; - int i; - FT_UInt tag; - - - validation_flags = 0; - - for ( i = 0; i < spec_count; i++ ) - { - tag = spec[i].tag; - error = try_load( face, tag ); - if ( error == 0 ) - validation_flags |= spec[i].validation_flag; - } - return validation_flags; - } - - - static FT_UInt - make_table_specs( FT_Face face, - const char* request, - const TableSpecRec spec[], - int spec_count ) - { - if ( request == NULL || request[0] == '\0' ) - return list_face_tables ( face, spec, spec_count ); - else - return parse_table_specs ( request, spec, spec_count ); - } - - - static int - print_tables( FILE* stream, - FT_UInt validation_flags, - const TableSpecRec spec[], - int spec_count ) - { - int i; - int n_print; - - - for ( i = 0, n_print = 0; i < spec_count; i++ ) - { - if ( spec[i].validation_flag & validation_flags ) - { - if ( n_print != 0 ) - fprintf( stream, "%c", ':' ); - print_tag( stream, spec[i].tag ); - n_print++; - } - } - - fprintf( stream, "\n" ); - - return !n_print; - } - - - static void - report_header( FT_UInt validation_flags, - const TableSpecRec spec[], - int spec_count ) - { - printf( "[%s:%s] validation targets: ", - execname, validators[validator].symbol ); - print_tables( stdout, validation_flags, spec, spec_count ); - printf( "-------------------------------------------------------------------\n" ); - } - - - static void - report_result( FT_Bytes data[], - FT_UInt validation_flags, - const TableSpecRec spec[], - int spec_count ) - { - int i; - int n_passes; - int n_targets; - - - for ( i = 0, n_passes = 0, n_targets = 0; i < spec_count; i++ ) - { - if ( spec[i].validation_flag & validation_flags ) - { - n_targets++; - - if ( data[i] != NULL ) - { - printf( "[%s:%s] ", execname, validators[validator].symbol ); - print_tag( stdout, spec[i].tag ); - printf( "%s", "...pass\n" ); - n_passes++; - } - } - } - - if ( n_passes == 0 && n_targets != 0 ) - { - printf( "[%s:%s] layout tables are invalid.\n", - execname, validators[validator].symbol ); - printf( "[%s:%s] set FT2_DEBUG environment variable to\n", - execname, validators[validator].symbol ); - printf( "[%s:%s] know the validation detail.\n", - execname, validators[validator].symbol ); - } - } - - - /* - * OpenType related functions - */ - static int - is_ot_validator_implemented( FT_Library library ) - { - FT_Module mod; - - mod = FT_Get_Module( library, "otvalid" ); - return mod? 1: 0; - } - - static FT_Error - run_ot_validator( FT_Face face, - const char* tables, - int validation_level ) - { - FT_UInt validation_flags; - FT_Error error; - FT_Bytes data[N_OT_TABLE_SPEC]; - unsigned int i; - - - validation_flags = (FT_UInt)validation_level; - validation_flags |= make_table_specs( face, tables, ot_table_spec, - N_OT_TABLE_SPEC ); - - for ( i = 0; i < N_OT_TABLE_SPEC; i++ ) - data[i] = NULL; - - report_header( validation_flags, ot_table_spec, N_OT_TABLE_SPEC ); - - error = FT_OpenType_Validate( - face, - validation_flags, - &data[0], &data[1], &data[2], &data[3], &data[4] ); - - report_result( data, validation_flags, ot_table_spec, N_OT_TABLE_SPEC ); - - for ( i = 0; i < N_OT_TABLE_SPEC; i++ ) - FT_OpenType_Free( face, data[i] ); - - return error; - } - - - static int - list_ot_tables( FT_Face face ) - { - FT_UInt validation_flags; - - - validation_flags = list_face_tables( face, ot_table_spec, - N_OT_TABLE_SPEC ); - return print_tables( stdout, validation_flags, ot_table_spec, - N_OT_TABLE_SPEC ); - } - - - /* - * TrueTypeGX related functions - */ - static int - is_gx_validator_implemented( FT_Library library ) - { - FT_Module mod; - - mod = FT_Get_Module( library, "gxvalid" ); - return mod? 1: 0; - } - - static FT_Error - run_gx_validator( FT_Face face, - const char* tables, - int validation_level ) - { - FT_UInt validation_flags; - FT_Error error; - FT_Bytes data[N_GX_TABLE_SPEC]; - unsigned int i; - - - validation_flags = (FT_UInt)validation_level; - validation_flags |= make_table_specs( face, tables, gx_table_spec, - N_GX_TABLE_SPEC ); - - for ( i = 0; i < N_GX_TABLE_SPEC; i++ ) - data[i] = NULL; - - report_header( validation_flags, gx_table_spec, N_GX_TABLE_SPEC ); - - error = FT_TrueTypeGX_Validate( - face, - validation_flags, - data, - N_GX_TABLE_SPEC ); - - report_result( data, validation_flags, gx_table_spec, N_GX_TABLE_SPEC ); - - for ( i = 0; i < N_GX_TABLE_SPEC; i++ ) - FT_TrueTypeGX_Free( face, data[i] ); - - return error; - } - - - static int - list_gx_tables ( FT_Face face ) - { - FT_UInt validation_flags; - - validation_flags = list_face_tables( face, gx_table_spec, - N_GX_TABLE_SPEC ); - return print_tables( stdout, validation_flags, gx_table_spec, - N_GX_TABLE_SPEC ); - } - - - /* - * Classic kern related functions - */ - static int - is_ckern_validator_implemented( FT_Library library ) - { - FT_Module mod; - - mod = FT_Get_Module( library, "gxvalid" ); - return mod? 1: 0; - } - - - static FT_Error - run_ckern_validator( FT_Face face, - const char* dialect_request, - int validation_level ) - { - FT_UInt validation_flags; - FT_Error error; - FT_Bytes data; - - - if ( dialect_request == NULL ) - dialect_request = "ms:apple"; - - - validation_flags = (FT_UInt)validation_level; - - if ( strcmp( dialect_request, "ms:apple" ) == 0 || - strcmp( dialect_request, "apple:ms" ) == 0 ) - validation_flags |= FT_VALIDATE_MS | FT_VALIDATE_APPLE; - else if ( strcmp( dialect_request, "ms" ) == 0 ) - validation_flags |= FT_VALIDATE_MS; - else if ( strcmp( dialect_request, "apple" ) == 0 ) - validation_flags |= FT_VALIDATE_APPLE; - else - { - fprintf( stderr, "Wrong classic kern dialect: %s\n", dialect_request ); - print_usage( NULL ); - } - - printf( "[%s:%s] validation targets: %s...", - execname, validators[validator].symbol, dialect_request ); - - - error = FT_ClassicKern_Validate( - face, - validation_flags, - &data ); - - - if ( data ) - printf( "pass\n" ); - else if ( data == NULL && error ) - printf( "fail\n" ); - else - printf( "no kern\n" ); - - FT_ClassicKern_Free( face, data ); - - return error; - } - - static int - list_ckern_tables ( FT_Face face ) - { - FT_Error error; - - error = try_load( face, TTAG_kern ); - if ( error == 0 ) - printf( "ms:apple\n" ); - return 0; - } - - /* - * Main driver - */ - - int - main( int argc, - char** argv ) - { - FT_Library library; - FT_Error error; - - char* fontfile; - int option; - - - char* tables; - int dump_table_list; - - int validation_level; - - int font_index = 0; - - - execname = ft_basename( argv[0] ); - - error = FT_Init_FreeType( &library ); - if ( error ) - panic ( error, "Could not initialize FreeType library" ); - - /* Initialize print_usage internal variable */ - print_usage( library ); - - - /* - * Parsing options - */ - validator = OT_VALIDATE; - tables = NULL; - dump_table_list = 0; - validation_level = FT_VALIDATE_DEFAULT; - - while ( 1 ) - { - option = getopt( argc, argv, "f:lt:T:vV:" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 't': - { - int i; - - validator = LAST_VALIDATE; - for ( i = 0; i < LAST_VALIDATE; i++ ) - { - if ( strcmp( optarg, validators[i].symbol ) == 0 ) - { - validator = (ValidatorType)i; - break; - } - } - if ( validator == LAST_VALIDATE ) - { - fprintf( stderr, "*** Unknown validator name: %s\n", optarg ); - print_usage( NULL ); - } - } - break; - - case 'T': - tables = optarg; - break; - - case 'l': - dump_table_list = 1; - break; - - case 'V': - validation_level = atoi( optarg ); - if ( validation_level < 0 || - validation_level > FT_VALIDATE_PARANOID ) - { - fprintf( stderr, "*** Validation level is out of range: %d\n", - validation_level ); - print_usage( NULL ); - } - break; - - case 'f': - font_index = atoi( optarg ); - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( library, &major, &minor, &patch ); - - printf( "ftvalid (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - default: - print_usage( NULL ); - break; - } - } - - argc -= optind; - argv += optind; - - if ( argc == 0 ) - { - fprintf(stderr, "*** Font file is not specified.\n"); - print_usage( NULL ); - } - else if ( argc > 1 ) - { - fprintf(stderr, "*** Too many font files.\n"); - print_usage( NULL ); - } - - fontfile = argv[0]; - - /* - * Run a validator - */ - { - FT_Face face; - FT_Error status; - - status = 0; - - if ( !validators[validator].is_implemented( library ) ) - panic( FT_Err_Unimplemented_Feature, - validators[validator].unimplemented_message ); - - - /* TODO: Multiple faces in a font file? */ - error = FT_New_Face( library, fontfile, font_index, &face ); - if ( error ) - panic( error, "Could not open face." ); - - if ( dump_table_list ) - validators[validator].list_tables( face ); - else - status = validators[validator].run( face, tables, validation_level ); - - FT_Done_Face( face ); - FT_Done_FreeType( library ); - - return (int)status; - } - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftview.1 freetype-2.8/=unpacked-tar1=/src/ftview.1 --- freetype-2.7.1/=unpacked-tar1=/src/ftview.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftview.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -.TH FTVIEW 1 "December 2016" "FreeType 2.7.1" -. -. -.SH NAME -. -ftview \- simple glyph viewer -. -. -.SH SYNOPSIS -. -.B ftview -.RI [ options ] -.I pt font -. -. -.SH DESCRIPTION -. -.B ftview -displays all glyphs of a font, allowing changes of various rendering -and hinting parameters interactively. -. -.TP -.B pt -The point size for the given resolution. -If resolution is 72dpi, this directly gives the ppem value (pixels per EM). -. -.TP -.B font -The font file(s) to display. -For Type 1 font files, ftview also tries to attach the corresponding metrics -file (with extension `.afm' or `.pfm'). -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI \-w \ w -Set the window width to -.I w -pixels (default: 640px). -. -.TP -.BI \-h \ h -Set the window height to -.I h -pixels (default: 480px). -. -.TP -.BI \-r \ r -Use resolution -.I r -dpi (default: 72dpi). -. -.TP -.BI \-f \ index -Specify first index to display (default: 0). -. -.TP -.BI \-e \ enc -Specify encoding tag (default: no encoding). -Common values: -.B unic -(Unicode), -.B symb -(symbol), -.B ADOB -(Adobe standard), -.B ADBC -(Adobe custom). -. -.TP -.BI \-m \ text -Use -.I text -for rendering. -. -.TP -.BI \-l \ mode -Set start-up rendering mode (0 <= -.I mode -<= 6). -. -.TP -.B \-p -Preload file in memory to simulate memory-mapping. -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ftview.c freetype-2.8/=unpacked-tar1=/src/ftview.c --- freetype-2.7.1/=unpacked-tar1=/src/ftview.c 2016-10-28 22:11:51.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ftview.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2118 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2000, 2003-2007, 2009-2014 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* FTView - a simple font viewer. */ -/* */ -/* This is a new version using the MiGS graphics subsystem for */ -/* blitting and display. */ -/* */ -/* Press ? when running this program to have a list of key-bindings. */ -/* */ -/****************************************************************************/ - - -#include "ftcommon.h" -#include "common.h" -#include "mlgetopt.h" -#include - - /* the following header shouldn't be used in normal programs */ -#include FT_INTERNAL_DEBUG_H - - /* showing driver name */ -#include FT_MODULE_H -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DRIVER_H - -#include FT_STROKER_H -#include FT_SYNTHESIS_H -#include FT_LCD_FILTER_H -#include FT_CFF_DRIVER_H -#include FT_TRUETYPE_DRIVER_H - - -#define MAXPTSIZE 500 /* dtp */ - -#ifdef CEIL -#undef CEIL -#endif -#define CEIL( x ) ( ( (x) + 63 ) >> 6 ) - -#define START_X 19 * 8 -#define START_Y 4 * HEADER_HEIGHT - -#define INIT_SIZE( size, start_x, start_y, step_y, x, y ) \ - do { \ - start_x = START_X; \ - start_y = CEIL( size->metrics.height ) + START_Y; \ - step_y = CEIL( size->metrics.height ) + 4; \ - \ - x = start_x; \ - y = start_y; \ - } while ( 0 ) - -#define X_TOO_LONG( x, size, display ) \ - ( (x) + ( (size)->metrics.max_advance >> 6 ) > \ - (display)->bitmap->width ) -#define Y_TOO_LONG( y, size, display ) \ - ( (y) >= (display)->bitmap->rows ) - -#ifdef _WIN32 -#define snprintf _snprintf -#endif - - -#define N_CFF_HINTING_ENGINES 2 - - - enum - { - RENDER_MODE_ALL = 0, - RENDER_MODE_EMBOLDEN, - RENDER_MODE_SLANTED, - RENDER_MODE_STROKE, - RENDER_MODE_TEXT, - RENDER_MODE_WATERFALL, - N_RENDER_MODES - }; - - static struct status_ - { - int update; - - int width; - int height; - int render_mode; - unsigned long encoding; - - int res; - int ptsize; /* current point size, 26.6 format */ - int lcd_mode; - double gamma; - double xbold_factor; - double ybold_factor; - double radius; - double slant; - - unsigned int cff_hinting_engine; - unsigned int tt_interpreter_versions[3]; - int num_tt_interpreter_versions; - int tt_interpreter_version_idx; - FT_Bool warping; - - int font_idx; - int offset; /* as selected by the user */ - int topleft; /* as displayed by ftview */ - int num_fails; - int preload; - - int lcd_filter; - unsigned char filter_weights[5]; - int fw_idx; - - } status = { 1, - DIM_X, DIM_Y, RENDER_MODE_ALL, FT_ENCODING_NONE, - 72, 48, -1, GAMMA, 0.04, 0.04, 0.02, 0.22, - 0, { 0 }, 0, 0, 0, /* default values are set at runtime */ - 0, 0, 0, 0, 0, - FT_LCD_FILTER_DEFAULT, { 0x08, 0x4D, 0x56, 0x4D, 0x08 }, 2 }; - - - static FTDemo_Display* display; - static FTDemo_Handle* handle; - - static unsigned long FT_ENC_TAG( FT_ENCODING_OTHER, 'o', 't', 'h', 'e' ); - - - /* - In UTF-8 encoding: - - The quick brown fox jumps over the lazy dog - 0123456789 - âêîûôäëïöüÿàùéèç - &#~"'(-`_^@)=+° - ABCDEFGHIJKLMNOPQRSTUVWXYZ - $£^¨*µù%!§:/;.,?<> - - The trailing space is for `looping' in case `Text' gets displayed more - than once. - */ - static const char* Text = - "The quick brown fox jumps over the lazy dog" - " 0123456789" - " \303\242\303\252\303\256\303\273\303\264" - "\303\244\303\253\303\257\303\266\303\274\303\277" - "\303\240\303\271\303\251\303\250\303\247" - " &#~\"\'(-`_^@)=+\302\260" - " ABCDEFGHIJKLMNOPQRSTUVWXYZ" - " $\302\243^\302\250*\302\265\303\271%!\302\247:/;.,?<> "; - - - static void - Fatal( const char* message ) - { - FTDemo_Display_Done( display ); - FTDemo_Done( handle ); - PanicZ( message ); - } - - - static FT_Error - Render_Stroke( int num_indices, - int offset ) - { - int start_x, start_y, step_y, x, y; - int i, have_topleft; - FT_Size size; - FT_Face face; - FT_GlyphSlot slot; - - FT_Fixed radius; - - - error = FTDemo_Get_Size( handle, &size ); - - if ( error ) - { - /* probably a non-existent bitmap font size */ - return error; - } - - INIT_SIZE( size, start_x, start_y, step_y, x, y ); - face = size->face; - slot = face->glyph; - - radius = (FT_Fixed)( - status.radius * ( status.ptsize * status.res / 72 ) ); - - FT_Stroker_Set( handle->stroker, radius, - FT_STROKER_LINECAP_ROUND, - FT_STROKER_LINEJOIN_ROUND, - 0 ); - - have_topleft = 0; - - for ( i = offset; i < num_indices; i++ ) - { - FT_UInt glyph_idx; - - - if ( status.encoding == FT_ENCODING_NONE ) - glyph_idx = (FT_UInt)i; - else - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); - - error = FT_Load_Glyph( face, glyph_idx, - handle->load_flags | FT_LOAD_NO_BITMAP ); - - if ( !error && slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - FT_Glyph glyph; - - - error = FT_Get_Glyph( slot, &glyph ); - if ( error ) - goto Next; - - error = FT_Glyph_Stroke( &glyph, handle->stroker, 1 ); - if ( error ) - { - FT_Done_Glyph( glyph ); - goto Next; - } - - error = FTDemo_Draw_Glyph( handle, display, glyph, &x, &y ); - - if ( !error ) - { - FT_Done_Glyph( glyph ); - - if ( !have_topleft ) - { - have_topleft = 1; - status.topleft = i; - } - } - - if ( error ) - goto Next; - else if ( X_TOO_LONG( x, size, display ) ) - { - x = start_x; - y += step_y; - - if ( Y_TOO_LONG( y, size, display ) ) - break; - } - } - else - Next: - status.num_fails++; - } - - return error; - } - - - static FT_Error - Render_Slanted( int num_indices, - int offset ) - { - int start_x, start_y, step_y, x, y; - int i, have_topleft; - FT_Size size; - FT_Face face; - FT_GlyphSlot slot; - - FT_Matrix shear; - - - error = FTDemo_Get_Size( handle, &size ); - - if ( error ) - { - /* probably a non-existent bitmap font size */ - return error; - } - - INIT_SIZE( size, start_x, start_y, step_y, x, y ); - face = size->face; - slot = face->glyph; - - /***************************************************************/ - /* */ - /* 2*2 affine transformation matrix, 16.16 fixed float format */ - /* */ - /* Shear matrix: */ - /* */ - /* | x' | | 1 k | | x | x' = x + ky */ - /* | | = | | * | | <==> */ - /* | y' | | 0 1 | | y | y' = y */ - /* */ - /* outline' shear outline */ - /* */ - /***************************************************************/ - - shear.xx = 1 << 16; - shear.xy = (FT_Fixed)( status.slant * ( 1 << 16 ) ); - shear.yx = 0; - shear.yy = 1 << 16; - - have_topleft = 0; - - for ( i = offset; i < num_indices; i++ ) - { - FT_UInt glyph_idx; - - - if ( status.encoding == FT_ENCODING_NONE ) - glyph_idx = (FT_UInt)i; - else - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); - - error = FT_Load_Glyph( face, glyph_idx, handle->load_flags ); - if ( !error ) - { - FT_Outline_Transform( &slot->outline, &shear ); - - error = FTDemo_Draw_Slot( handle, display, slot, &x, &y ); - - if ( !error ) - { - if ( !have_topleft ) - { - have_topleft = 1; - status.topleft = i; - } - } - - if ( error ) - goto Next; - else if ( X_TOO_LONG( x, size, display ) ) - { - x = start_x; - y += step_y; - - if ( Y_TOO_LONG( y, size, display ) ) - break; - } - } - else - Next: - status.num_fails++; - } - - return error; - } - - - static FT_Error - Render_Embolden( int num_indices, - int offset ) - { - int start_x, start_y, step_y, x, y; - int i, have_topleft; - FT_Size size; - FT_Face face; - FT_GlyphSlot slot; - - FT_Pos xstr, ystr; - - - error = FTDemo_Get_Size( handle, &size ); - - if ( error ) - { - /* probably a non-existent bitmap font size */ - return error; - } - - INIT_SIZE( size, start_x, start_y, step_y, x, y ); - face = size->face; - slot = face->glyph; - - ystr = status.ptsize * status.res / 72; - xstr = (FT_Pos)( status.xbold_factor * ystr ); - ystr = (FT_Pos)( status.ybold_factor * ystr ); - - have_topleft = 0; - - for ( i = offset; i < num_indices; i++ ) - { - FT_UInt glyph_idx; - - - if ( status.encoding == FT_ENCODING_NONE ) - glyph_idx = (FT_UInt)i; - else - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); - - error = FT_Load_Glyph( face, glyph_idx, handle->load_flags ); - if ( !error ) - { - /* this is essentially the code of function */ - /* `FT_GlyphSlot_Embolden' */ - - if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) - { - error = FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); - /* ignore error */ - } - else if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) - { - /* round to full pixels */ - xstr &= ~63; - ystr &= ~63; - - error = FT_GlyphSlot_Own_Bitmap( slot ); - if ( error ) - goto Next; - - error = FT_Bitmap_Embolden( slot->library, &slot->bitmap, - xstr, ystr ); - if ( error ) - goto Next; - } else - goto Next; - - if ( slot->advance.x ) - slot->advance.x += xstr; - - if ( slot->advance.y ) - slot->advance.y += ystr; - - slot->metrics.width += xstr; - slot->metrics.height += ystr; - slot->metrics.horiAdvance += xstr; - slot->metrics.vertAdvance += ystr; - - if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) - slot->bitmap_top += ystr >> 6; - - error = FTDemo_Draw_Slot( handle, display, slot, &x, &y ); - - if ( !error ) - { - if ( !have_topleft ) - { - have_topleft = 1; - status.topleft = i; - } - } - - if ( error ) - goto Next; - else if ( X_TOO_LONG( x, size, display ) ) - { - x = start_x; - y += step_y; - - if ( Y_TOO_LONG( y, size, display ) ) - break; - } - } - else - Next: - status.num_fails++; - } - - return error; - } - - - static FT_Error - Render_All( int num_indices, - int offset ) - { - int start_x, start_y, step_y, x, y; - int i, have_topleft; - FT_Size size; - - - error = FTDemo_Get_Size( handle, &size ); - - if ( error ) - { - /* probably a non-existent bitmap font size */ - return error; - } - - INIT_SIZE( size, start_x, start_y, step_y, x, y ); - - have_topleft = 0; - - for ( i = offset; i < num_indices; i++ ) - { - FT_UInt glyph_idx; - - - if ( status.encoding == FT_ENCODING_NONE ) - glyph_idx = (FT_UInt)i; - else - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); - - error = FTDemo_Draw_Index( handle, display, glyph_idx, &x, &y ); - - if ( !error ) - { - if ( !have_topleft ) - { - have_topleft = 1; - status.topleft = i; - } - } - - if ( error ) - status.num_fails++; - else if ( X_TOO_LONG( x, size, display ) ) - { - x = start_x; - y += step_y; - - if ( Y_TOO_LONG( y, size, display ) ) - break; - } - } - - return FT_Err_Ok; - } - - - static FT_Error - Render_Text( int num_indices, - int offset ) - { - int start_x, start_y, step_y, x, y; - FT_Size size; - int have_topleft; - - const char* p; - const char* pEnd; - int ch; - - - error = FTDemo_Get_Size( handle, &size ); - if ( error ) - { - /* probably a non-existent bitmap font size */ - return error; - } - - INIT_SIZE( size, start_x, start_y, step_y, x, y ); - - p = Text; - pEnd = p + strlen( Text ); - - while ( offset-- ) - { - ch = utf8_next( &p, pEnd ); - if ( ch < 0 ) - { - p = Text; - ch = utf8_next( &p, pEnd ); - } - } - - have_topleft = 0; - - while ( num_indices-- ) - { - FT_UInt glyph_idx; - - - ch = utf8_next( &p, pEnd ); - if ( ch < 0 ) - { - p = Text; - ch = utf8_next( &p, pEnd ); - - /* not a single character of the text string could be displayed */ - if ( !have_topleft ) - return error; - } - - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)ch ); - - error = FTDemo_Draw_Index( handle, display, glyph_idx, &x, &y ); - - if ( !error ) - { - if ( !have_topleft ) - { - have_topleft = 1; - status.topleft = ch; - } - } - - if ( error ) - status.num_fails++; - else - { - /* Draw_Index adds one pixel space */ - x--; - - if ( X_TOO_LONG( x, size, display ) ) - { - x = start_x; - y += step_y; - - if ( Y_TOO_LONG( y, size, display ) ) - break; - } - } - } - - return FT_Err_Ok; - } - - - static FT_Error - Render_Waterfall( int first_size, - int offset ) - { - int start_x, start_y, step_y, x, y; - int pt_size, max_size = 100000; - FT_Size size; - FT_Face face; - int have_topleft, start; - - char text[256]; - const char* p; - const char* pEnd; - - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - if ( error ) - { - /* can't access the font file: do not render anything */ - fprintf( stderr, "can't access font file %p\n", - (void*)handle->scaler.face_id ); - return 0; - } - - if ( !FT_IS_SCALABLE( face ) ) - { - int i; - - - max_size = 0; - for ( i = 0; i < face->num_fixed_sizes; i++ ) - if ( face->available_sizes[i].height >= max_size / 64 ) - max_size = face->available_sizes[i].height * 64; - } - - start_x = START_X; - start_y = START_Y; - - have_topleft = 0; - - for ( pt_size = first_size; pt_size < max_size; pt_size += 64 ) - { - int first = offset; - int ch; - - - FTDemo_Set_Current_Charsize( handle, pt_size, status.res ); - - error = FTDemo_Get_Size( handle, &size ); - if ( error ) - { - /* probably a non-existent bitmap font size */ - continue; - } - - step_y = ( size->metrics.height >> 6 ) + 1; - - x = start_x; - y = start_y + ( size->metrics.ascender >> 6 ); - - start_y += step_y; - - if ( y >= display->bitmap->rows ) - break; - - p = Text; - pEnd = p + strlen( Text ); - - while ( first-- ) - { - ch = utf8_next( &p, pEnd ); - if ( ch < 0 ) - { - p = Text; - ch = utf8_next( &p, pEnd ); - } - } - - start = snprintf( text, 256, "%g: ", pt_size / 64.0 ); - snprintf( text + start, (unsigned int)( 256 - start ), "%s", p ); - - p = text; - pEnd = p + strlen( text ); - - while ( 1 ) - { - FT_UInt glyph_idx; - const char* oldp; - - - oldp = p; - ch = utf8_next( &p, pEnd ); - if ( ch < 0 ) - { - p = Text; - oldp = p; - ch = utf8_next( &p, pEnd ); - - /* not a single character of the text string could be displayed */ - if ( !have_topleft ) - return error; - } - - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)ch ); - - error = FTDemo_Draw_Index( handle, display, glyph_idx, &x, &y ); - - if ( !error ) - { - /* `topleft' should be the first character after the size string */ - if ( oldp - text == start && !have_topleft ) - { - have_topleft = 1; - status.topleft = ch; - } - } - - if ( error ) - status.num_fails++; - else - { - /* Draw_Index adds one pixel space */ - x--; - - if ( X_TOO_LONG( x, size, display ) ) - break; - } - } - } - - FTDemo_Set_Current_Charsize( handle, first_size, status.res ); - - return FT_Err_Ok; - } - - - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** REST OF THE APPLICATION/PROGRAM *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - static void - event_help( void ) - { - char buf[256]; - char version[64]; - - const char* format; - FT_Int major, minor, patch; - - grEvent dummy_event; - - - FT_Library_Version( handle->library, &major, &minor, &patch ); - - format = patch ? "%d.%d.%d" : "%d.%d"; - sprintf( version, format, major, minor, patch ); - - FTDemo_Display_Clear( display ); - grSetLineHeight( 10 ); - grGotoxy( 0, 0 ); - grSetMargin( 2, 1 ); - grGotobitmap( display->bitmap ); - - sprintf( buf, - "FreeType Glyph Viewer - part of the FreeType %s test suite", - version ); - - grWriteln( buf ); - grLn(); - grWriteln( "Use the following keys:" ); - grLn(); - /* |----------------------------------| |----------------------------------| */ - grWriteln( "F1, ? display this help screen " ); - grWriteln( " " ); - grWriteln( "render modes: anti-aliasing modes: " ); - grWriteln( " 1 all glyphs A normal " ); - grWriteln( " 2 all glyphs emboldened B light " ); - grWriteln( " 3 all glyphs slanted C horizontal RGB (LCD) " ); - grWriteln( " 4 all glyphs stroked D horizontal BGR (LCD) " ); - grWriteln( " 5 text string E vertical RGB (LCD) " ); - grWriteln( " 6 waterfall F vertical BGR (LCD) " ); - grWriteln( " space cycle forwards k cycle forwards " ); - grWriteln( " backspace cycle backwards l cycle backwards " ); - grWriteln( " " ); - grWriteln( "b toggle embedded bitmaps x, X adjust horizontal " ); - grWriteln( "c toggle color glyphs emboldening (in mode 2)" ); - grWriteln( "K toggle cache modes y, Y adjust vertical " ); - grWriteln( " emboldening (in mode 2)" ); - grWriteln( "p, n previous/next font s, S adjust slanting " ); - grWriteln( " (in mode 3) " ); - grWriteln( "Up, Down adjust size by 1 unit r, R adjust stroking radius " ); - grWriteln( "PgUp, PgDn adjust size by 10 units (in mode 4) " ); - grWriteln( " " ); - grWriteln( "Left, Right adjust index by 1 L cycle through " ); - grWriteln( "F7, F8 adjust index by 16 LCD filtering " ); - grWriteln( "F9, F10 adjust index by 256 [, ] select custom LCD " ); - grWriteln( "F11, F12 adjust index by 4096 filter weight " ); - grWriteln( " (if custom filtering) " ); - grWriteln( "h toggle hinting -, +(=) adjust selected custom " ); - grWriteln( "H cycle through hinting LCD filter weight " ); - grWriteln( " engines (if available) " ); - grWriteln( "f toggle forced auto- g, v adjust gamma value " ); - grWriteln( " hinting (if hinting) " ); - grWriteln( "w toggle warping (in light Tab cycle through charmaps " ); - grWriteln( " AA mode, if available) " ); - grWriteln( " " ); - grWriteln( "a toggle anti-aliasing q, ESC quit ftview " ); - /* |----------------------------------| |----------------------------------| */ - grLn(); - grLn(); - grWriteln( "press any key to exit this help screen" ); - - grRefreshSurface( display->surface ); - grListenSurface( display->surface, gr_event_key, &dummy_event ); - } - - - static int - event_cff_hinting_engine_change( unsigned int delta ) - { - unsigned int new_cff_hinting_engine = 0; - - - if ( delta ) - new_cff_hinting_engine = - ( status.cff_hinting_engine + - delta + - N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; - - error = FT_Property_Set( handle->library, - "cff", - "hinting-engine", - &new_cff_hinting_engine ); - - if ( !error ) - { - /* Resetting the cache is perhaps a bit harsh, but I'm too */ - /* lazy to walk over all loaded fonts to check whether they */ - /* are of type CFF, then unloading them explicitly. */ - FTC_Manager_Reset( handle->cache_manager ); - status.cff_hinting_engine = new_cff_hinting_engine; - return 1; - } - - return 0; - } - - - static int - event_tt_interpreter_version_change( void ) - { - status.tt_interpreter_version_idx += 1; - status.tt_interpreter_version_idx %= status.num_tt_interpreter_versions; - - error = FT_Property_Set( handle->library, - "truetype", - "interpreter-version", - &status.tt_interpreter_versions[ - status.tt_interpreter_version_idx] ); - - if ( !error ) - { - /* Resetting the cache is perhaps a bit harsh, but I'm too */ - /* lazy to walk over all loaded fonts to check whether they */ - /* are of type TTF, then unloading them explicitly. */ - FTC_Manager_Reset( handle->cache_manager ); - return 1; - } - - return 0; - } - - - static int - event_warping_change( void ) - { - if ( handle->lcd_mode == LCD_MODE_LIGHT ) - { - FT_Bool new_warping_state = !status.warping; - - - error = FT_Property_Set( handle->library, - "autofitter", - "warping", - &new_warping_state ); - - if ( !error ) - { - /* Resetting the cache is perhaps a bit harsh, but I'm too */ - /* lazy to walk over all loaded fonts to check whether they */ - /* are auto-hinted, then unloading them explicitly. */ - FTC_Manager_Reset( handle->cache_manager ); - status.warping = new_warping_state; - return 1; - } - } - - return 0; - } - - - static void - event_gamma_change( double delta ) - { - status.gamma += delta; - - if ( status.gamma > 3.0 ) - status.gamma = 3.0; - else if ( status.gamma < 0.0 ) - status.gamma = 0.0; - - grSetGlyphGamma( status.gamma ); - } - - - static int - event_bold_change( double xdelta, - double ydelta ) - { - double old_xbold_factor = status.xbold_factor; - double old_ybold_factor = status.ybold_factor; - - - status.xbold_factor += xdelta; - status.ybold_factor += ydelta; - - if ( status.xbold_factor > 0.1 ) - status.xbold_factor = 0.1; - else if ( status.xbold_factor < -0.1 ) - status.xbold_factor = -0.1; - - if ( status.ybold_factor > 0.1 ) - status.ybold_factor = 0.1; - else if ( status.ybold_factor < -0.1 ) - status.ybold_factor = -0.1; - - return ( old_xbold_factor == status.xbold_factor && - old_ybold_factor == status.ybold_factor ) ? 0 : 1; - } - - - static int - event_radius_change( double delta ) - { - double old_radius = status.radius; - - - status.radius += delta; - - if ( status.radius > 0.05 ) - status.radius = 0.05; - else if ( status.radius < 0.0 ) - status.radius = 0.0; - - return old_radius == status.radius ? 0 : 1; - } - - - static int - event_slant_change( double delta ) - { - double old_slant = status.slant; - - - status.slant += delta; - - if ( status.slant > 1.0 ) - status.slant = 1.0; - else if ( status.slant < -1.0 ) - status.slant = -1.0; - - return old_slant == status.slant ? 0 : 1; - } - - - static int - event_size_change( int delta ) - { - int old_ptsize = status.ptsize; - - - status.ptsize += delta; - - if ( status.ptsize < 64 * 1 ) - status.ptsize = 1 * 64; - else if ( status.ptsize > MAXPTSIZE * 64 ) - status.ptsize = MAXPTSIZE * 64; - - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - - return old_ptsize == status.ptsize ? 0 : 1; - } - - - static int - event_index_change( int delta ) - { - int old_offset = status.offset; - int num_indices = handle->current_font->num_indices; - - - status.offset += delta; - - if ( status.offset < 0 ) - status.offset = 0; - else if ( status.offset >= num_indices ) - status.offset = num_indices - 1; - - return old_offset == status.offset ? 0 : 1; - } - - - static void - event_render_mode_change( int delta ) - { - if ( delta ) - status.render_mode = ( status.render_mode + - delta + - N_RENDER_MODES ) % N_RENDER_MODES; - } - - - static int - event_encoding_change( void ) - { - PFont font = handle->fonts[status.font_idx]; - FT_Face face; - - - if ( status.encoding != FT_ENCODING_NONE ) - font->cmap_index++; - else - font->cmap_index = 0; - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - - if ( font->cmap_index < face->num_charmaps ) - { - status.encoding = face->charmaps[font->cmap_index]->encoding; - status.offset = 0x20; - - if ( status.encoding == FT_ENCODING_NONE ) /* OTHER, really */ - status.encoding = FT_ENCODING_OTHER; - } - else - { - status.encoding = FT_ENCODING_NONE; - status.offset = 0; - } - - switch ( status.encoding ) - { - case FT_ENCODING_NONE: - font->num_indices = face->num_glyphs; - break; - - case FT_ENCODING_UNICODE: - font->num_indices = 0x110000L; - break; - - case FT_ENCODING_ADOBE_LATIN_1: - case FT_ENCODING_ADOBE_STANDARD: - case FT_ENCODING_ADOBE_EXPERT: - case FT_ENCODING_ADOBE_CUSTOM: - case FT_ENCODING_APPLE_ROMAN: - font->num_indices = 0x100L; - break; - - /* some fonts use range 0x00-0x100, others have 0xF000-0xF0FF */ - case FT_ENCODING_MS_SYMBOL: - default: - font->num_indices = 0x10000L; - } - - return 1; - } - - - static int - event_font_change( int delta ) - { - int num_indices; - - - if ( status.font_idx + delta >= handle->num_fonts || - status.font_idx + delta < 0 ) - return 0; - - status.font_idx += delta; - - FTDemo_Set_Current_Font( handle, handle->fonts[status.font_idx] ); - FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); - FTDemo_Update_Current_Flags( handle ); - - num_indices = handle->current_font->num_indices; - - if ( status.offset >= num_indices ) - status.offset = num_indices - 1; - - return 1; - } - - - static int - Process_Event( grEvent* event ) - { - int ret = 0; - - - status.update = 0; - - if ( status.render_mode == (int)( event->key - '1' ) ) - return ret; - if ( event->key >= '1' && event->key < '1' + N_RENDER_MODES ) - { - status.render_mode = event->key - '1'; - event_render_mode_change( 0 ); - status.update = 1; - return ret; - } - - if ( handle->antialias ) - { - if ( handle->lcd_mode == (int)( event->key - 'A' ) ) - return ret; - if ( event->key >= 'A' && event->key < 'A' + N_LCD_MODES ) - { - handle->lcd_mode = event->key - 'A'; - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - return ret; - } - } - - switch ( event->key ) - { - case grKeyEsc: - case grKEY( 'q' ): - ret = 1; - break; - - case grKeyF1: - case grKEY( '?' ): - event_help(); - status.update = 1; - break; - - case grKEY( 'a' ): - handle->antialias = !handle->antialias; - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - break; - - case grKEY( 'b' ): - handle->use_sbits = !handle->use_sbits; - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - break; - - case grKEY( 'c' ): - handle->color = !handle->color; - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - break; - - case grKEY( 'K' ): - handle->use_sbits_cache = !handle->use_sbits_cache; - status.update = 1; - break; - - case grKEY( 'f' ): - if ( handle->hinted ) - { - handle->autohint = !handle->autohint; - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - } - break; - - case grKEY( 'h' ): - handle->hinted = !handle->hinted; - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - break; - - case grKEY( 'H' ): - if ( !handle->autohint && - handle->lcd_mode != LCD_MODE_LIGHT ) - { - FT_Face face; - FT_Module module; - - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - if ( !error ) - { - module = &face->driver->root; - - if ( !strcmp( module->clazz->module_name, "cff" ) ) - status.update = event_cff_hinting_engine_change( 1 ); - else if ( !strcmp( module->clazz->module_name, "truetype" ) ) - status.update = event_tt_interpreter_version_change(); - } - } - break; - - case grKEY( 'l' ): - case grKEY( 'k' ): - if ( handle->antialias ) - { - handle->lcd_mode = ( event->key == grKEY( 'l' ) ) - ? ( ( handle->lcd_mode == ( N_LCD_MODES - 1 ) ) - ? 0 - : handle->lcd_mode + 1 ) - : ( ( handle->lcd_mode == 0 ) - ? ( N_LCD_MODES - 1 ) - : handle->lcd_mode - 1 ); - FTDemo_Update_Current_Flags( handle ); - status.update = 1; - } - break; - - case grKEY( 'w' ): - status.update = event_warping_change(); - break; - - case grKeySpace: - event_render_mode_change( 1 ); - status.update = 1; - break; - - case grKeyBackSpace: - event_render_mode_change( -1 ); - status.update = 1; - break; - - case grKeyTab: - status.update = event_encoding_change(); - break; - - case grKEY( 's' ): - if ( status.render_mode == RENDER_MODE_SLANTED ) - status.update = event_slant_change( 0.02 ); - break; - - case grKEY( 'S' ): - if ( status.render_mode == RENDER_MODE_SLANTED ) - status.update = event_slant_change( -0.02 ); - break; - - case grKEY( 'r' ): - if ( status.render_mode == RENDER_MODE_STROKE ) - status.update = event_radius_change( 0.005 ); - break; - - case grKEY( 'R' ): - if ( status.render_mode == RENDER_MODE_STROKE ) - status.update = event_radius_change( -0.005 ); - break; - - case grKEY( 'x' ): - if ( status.render_mode == RENDER_MODE_EMBOLDEN ) - status.update = event_bold_change( 0.005, 0.0 ); - break; - - case grKEY( 'X' ): - if ( status.render_mode == RENDER_MODE_EMBOLDEN ) - status.update = event_bold_change( -0.005, 0.0 ); - break; - - case grKEY( 'y' ): - if ( status.render_mode == RENDER_MODE_EMBOLDEN ) - status.update = event_bold_change( 0.0, 0.005 ); - break; - - case grKEY( 'Y' ): - if ( status.render_mode == RENDER_MODE_EMBOLDEN ) - status.update = event_bold_change( 0.0, -0.005 ); - break; - - case grKEY( 'g' ): - event_gamma_change( 0.1 ); - status.update = 1; - break; - - case grKEY( 'v' ): - event_gamma_change( -0.1 ); - status.update = 1; - break; - - case grKEY( 'n' ): - status.update = event_font_change( 1 ); - break; - - case grKEY( 'p' ): - status.update = event_font_change( -1 ); - break; - - case grKeyUp: - status.update = event_size_change( 64 ); - break; - case grKeyDown: - status.update = event_size_change( -64 ); - break; - case grKeyPageUp: - status.update = event_size_change( 640 ); - break; - case grKeyPageDown: - status.update = event_size_change( -640 ); - break; - - case grKeyLeft: - status.update = event_index_change( -1 ); - break; - case grKeyRight: - status.update = event_index_change( 1 ); - break; - case grKeyF7: - status.update = event_index_change( -0x10 ); - break; - case grKeyF8: - status.update = event_index_change( 0x10 ); - break; - case grKeyF9: - status.update = event_index_change( -0x100 ); - break; - case grKeyF10: - status.update = event_index_change( 0x100 ); - break; - case grKeyF11: - status.update = event_index_change( -0x1000 ); - break; - case grKeyF12: - status.update = event_index_change( 0x1000 ); - break; - - case grKEY( 'L' ): - FTC_Manager_RemoveFaceID( handle->cache_manager, - handle->scaler.face_id ); - - status.lcd_filter++; - switch ( status.lcd_filter ) - { - case FT_LCD_FILTER_NONE: - case FT_LCD_FILTER_DEFAULT: - case FT_LCD_FILTER_LIGHT: - case FT_LCD_FILTER_LEGACY1: - FT_Library_SetLcdFilter( handle->library, - (FT_LcdFilter)status.lcd_filter ); - break; - default: - FT_Library_SetLcdFilter( handle->library, FT_LCD_FILTER_DEFAULT ); - FT_Library_SetLcdFilterWeights( handle->library, - status.filter_weights ); - status.lcd_filter = -1; - } - - status.update = 1; - break; - - case grKEY( '[' ): - if ( status.lcd_filter < 0 ) - { - status.fw_idx--; - if ( status.fw_idx < 0 ) - status.fw_idx = 4; - status.update = 1; - } - break; - - case grKEY( ']' ): - if ( status.lcd_filter < 0 ) - { - status.fw_idx++; - if ( status.fw_idx > 4 ) - status.fw_idx = 0; - status.update = 1; - } - break; - - case grKEY( '-' ): - if ( status.lcd_filter < 0 ) - { - FTC_Manager_RemoveFaceID( handle->cache_manager, - handle->scaler.face_id ); - - status.filter_weights[status.fw_idx]--; - FT_Library_SetLcdFilterWeights( handle->library, - status.filter_weights ); - status.update = 1; - } - break; - - case grKEY( '+' ): - case grKEY( '=' ): - if ( status.lcd_filter < 0 ) - { - FTC_Manager_RemoveFaceID( handle->cache_manager, - handle->scaler.face_id ); - - status.filter_weights[status.fw_idx]++; - FT_Library_SetLcdFilterWeights( handle->library, - status.filter_weights ); - status.update = 1; - } - break; - - default: - break; - } - - return ret; - } - - - static void - write_header( FT_Error error_code ) - { - FT_Face face; - char buf[256]; - const char* basename; - const char* format; - - int line = 0; - - - error = FTC_Manager_LookupFace( handle->cache_manager, - handle->scaler.face_id, &face ); - if ( error ) - Fatal( "can't access font file" ); - - /* errors */ - switch ( error_code ) - { - case FT_Err_Ok: - sprintf( buf, " " ); - break; - case FT_Err_Invalid_Pixel_Size: - sprintf( buf, "Invalid pixel size" ); - break; - case FT_Err_Invalid_PPem: - sprintf( buf, "Invalid ppem value" ); - break; - default: - sprintf( buf, "error 0x%04x", - (FT_UShort)error_code ); - break; - } - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, error_code ? display->warn_color - : display->fore_color ); - - /* font and file name */ - basename = ft_basename( handle->current_font->filepathname ); - sprintf( buf, "%.50s %.50s (file `%.100s')", - face->family_name, face->style_name, basename ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - line++; - - /* char code, glyph index, glyph name */ - if ( status.encoding == FT_ENCODING_UNICODE || - status.render_mode == RENDER_MODE_TEXT || - status.render_mode == RENDER_MODE_WATERFALL ) - sprintf( buf, "top left charcode: U+%04X (glyph idx %d)", - status.topleft, - FTDemo_Get_Index( handle, (FT_UInt32)status.topleft ) ); - else if ( status.encoding == FT_ENCODING_NONE ) - sprintf( buf, "top left glyph idx: %d", - status.topleft ); - else - sprintf( buf, "top left charcode: 0x%X (glyph idx %d)", - status.topleft, - FTDemo_Get_Index( handle, (FT_UInt32)status.topleft ) ); - - if ( FT_HAS_GLYPH_NAMES( face ) ) - { - char* p; - unsigned int format_len, glyph_idx, size; - - - size = strlen( buf ); - p = buf + size; - size = 256 - size; - - format = ", name: "; - format_len = strlen( format ); - - if ( size >= format_len + 2 ) - { - glyph_idx = (unsigned int)status.topleft; - if ( status.encoding != FT_ENCODING_NONE || - status.render_mode == RENDER_MODE_TEXT || - status.render_mode == RENDER_MODE_WATERFALL ) - glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)status.topleft ); - - strcpy( p, format ); - if ( FT_Get_Glyph_Name( face, glyph_idx, - p + format_len, size - format_len ) ) - *p = '\0'; - } - } - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - line++; - - /* encoding */ - if ( !( status.render_mode == RENDER_MODE_TEXT || - status.render_mode == RENDER_MODE_WATERFALL ) ) - { - const char* encoding = NULL; - - - switch ( status.encoding ) - { - case FT_ENCODING_NONE: - encoding = "glyph order"; - break; - case FT_ENCODING_MS_SYMBOL: - encoding = "MS Symbol"; - break; - case FT_ENCODING_UNICODE: - encoding = "Unicode"; - break; - case FT_ENCODING_SJIS: - encoding = "SJIS"; - break; - case FT_ENCODING_GB2312: - encoding = "GB 2312"; - break; - case FT_ENCODING_BIG5: - encoding = "Big 5"; - break; - case FT_ENCODING_WANSUNG: - encoding = "Wansung"; - break; - case FT_ENCODING_JOHAB: - encoding = "Johab"; - break; - case FT_ENCODING_ADOBE_STANDARD: - encoding = "Adobe Standard"; - break; - case FT_ENCODING_ADOBE_EXPERT: - encoding = "Adobe Expert"; - break; - case FT_ENCODING_ADOBE_CUSTOM: - encoding = "Adobe Custom"; - break; - case FT_ENCODING_ADOBE_LATIN_1: - encoding = "Latin 1"; - break; - case FT_ENCODING_OLD_LATIN_2: - encoding = "Latin 2"; - break; - case FT_ENCODING_APPLE_ROMAN: - encoding = "Apple Roman"; - break; - default: - encoding = "Other"; - } - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - encoding, display->fore_color ); - } - - /* dpi */ - sprintf( buf, "%ddpi", - status.res ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - /* pt and ppem */ - sprintf( buf, "%gpt (%dppem)", - status.ptsize / 64.0, - ( status.ptsize * status.res / 72 + 32 ) >> 6 ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - line++; - - /* render mode */ - { - const char* render_mode = NULL; - - - switch ( status.render_mode ) - { - case RENDER_MODE_ALL: - render_mode = "all glyphs"; - break; - case RENDER_MODE_EMBOLDEN: - render_mode = "emboldened"; - break; - case RENDER_MODE_SLANTED: - render_mode = "slanted"; - break; - case RENDER_MODE_STROKE: - render_mode = "stroked"; - break; - case RENDER_MODE_TEXT: - render_mode = "text string"; - break; - case RENDER_MODE_WATERFALL: - render_mode = "waterfall"; - break; - } - sprintf( buf, "%d: %s", - status.render_mode + 1, - render_mode ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - - if ( status.render_mode == RENDER_MODE_EMBOLDEN ) - { - /* x emboldening */ - sprintf( buf, " x: %.3f", - status.xbold_factor ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - /* y emboldening */ - sprintf( buf, " y: %.3f", - status.ybold_factor ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - - if ( status.render_mode == RENDER_MODE_STROKE ) - { - /* stroking radius */ - sprintf( buf, " radius: %.3f", - status.radius ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - - if ( status.render_mode == RENDER_MODE_SLANTED ) - { - /* slanting */ - sprintf( buf, " value: %.3f", - status.slant ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - - line++; - - /* anti-aliasing */ - sprintf( buf, "anti-alias: %s", - handle->antialias ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - if ( handle->antialias ) - { - const char* lcd_mode; - - - switch ( handle->lcd_mode ) - { - case LCD_MODE_LIGHT: - lcd_mode = " light AA"; - break; - case LCD_MODE_RGB: - lcd_mode = " LCD (horiz. RGB)"; - break; - case LCD_MODE_BGR: - lcd_mode = " LCD (horiz. BGR)"; - break; - case LCD_MODE_VRGB: - lcd_mode = " LCD (vert. RGB)"; - break; - case LCD_MODE_VBGR: - lcd_mode = " LCD (vert. BGR)"; - break; - default: - handle->lcd_mode = 0; - lcd_mode = " normal AA"; - } - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - lcd_mode, display->fore_color ); - } - - /* hinting */ - sprintf( buf, "hinting: %s", - handle->hinted ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - if ( handle->hinted ) - { - /* auto-hinting */ - sprintf( buf, " forced auto: %s", - ( handle->autohint || - handle->lcd_mode == LCD_MODE_LIGHT ) ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - - if ( !handle->autohint && - handle->lcd_mode != LCD_MODE_LIGHT ) - { - /* hinting engine */ - - FT_Module module = &face->driver->root; - const char* hinting_engine = NULL; - - - if ( !strcmp( module->clazz->module_name, "cff" ) ) - { - switch ( status.cff_hinting_engine ) - { - case FT_CFF_HINTING_FREETYPE: - hinting_engine = "FreeType"; - break; - case FT_CFF_HINTING_ADOBE: - hinting_engine = "Adobe"; - break; - } - } - - else if ( !strcmp( module->clazz->module_name, "truetype" ) ) - { - switch ( status.tt_interpreter_versions[ - status.tt_interpreter_version_idx] ) - { - case TT_INTERPRETER_VERSION_35: - hinting_engine = "v35"; - break; - case TT_INTERPRETER_VERSION_38: - hinting_engine = "v38"; - break; - case TT_INTERPRETER_VERSION_40: - hinting_engine = "v40"; - break; - } - } - - if ( hinting_engine ) - { - sprintf( buf, "engine: %s", - hinting_engine ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - } - - if ( handle->lcd_mode == LCD_MODE_LIGHT ) - { - sprintf( buf, "warping: %s", - status.warping ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - - line++; - - /* embedded bitmaps */ - sprintf( buf, "bitmaps: %s", - handle->use_sbits ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - /* embedded color bitmaps */ - sprintf( buf, "color bitmaps: %s", - handle->color ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - /* cache */ - sprintf( buf, "cache: %s", - handle->use_sbits_cache ? "on" : "off" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - /* gamma */ - if ( status.gamma == 0.0 ) - sprintf( buf, "gamma: sRGB mode" ); - else - sprintf( buf, "gamma: %.1f", status.gamma ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - line++; - - /* LCD filtering */ - sprintf( buf, "LCD filter: %s", - status.lcd_filter == 0 ? "none" : - status.lcd_filter == 1 ? "default" : - status.lcd_filter == 2 ? "light" : - status.lcd_filter == 3 ? "legacy" : "custom" ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - - /* custom LCD filter settings */ - if ( status.lcd_filter < 0 ) - { - int fwi = status.fw_idx; - unsigned char* fw = status.filter_weights; - int i; - - - for ( i = 0; i < 5; i++ ) - { - sprintf( buf, - " %s0x%02X%s", - fwi == i ? "[" : " ", - fw[i], - fwi == i ? "]" : " " ); - grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, - buf, display->fore_color ); - } - } - - grRefreshSurface( display->surface ); - } - - - static void - usage( char* execname ) - { - fprintf( stderr, - "\n" - "ftview: simple glyph viewer -- part of the FreeType project\n" - "-----------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] pt font ...\n" - "\n", - execname ); - fprintf( stderr, - " pt The point size for the given resolution.\n" - " If resolution is 72dpi, this directly gives the\n" - " ppem value (pixels per EM).\n" ); - fprintf( stderr, - " font The font file(s) to display.\n" - " For Type 1 font files, ftview also tries to attach\n" - " the corresponding metrics file (with extension\n" - " `.afm' or `.pfm').\n" - "\n" ); - fprintf( stderr, - " -w W Set the window width to W pixels (default: %dpx).\n" - " -h H Set the window height to H pixels (default: %dpx).\n" - "\n", - DIM_X, DIM_Y ); - fprintf( stderr, - " -r R Use resolution R dpi (default: 72dpi).\n" - " -f index Specify first index to display (default: 0).\n" - " -e enc Specify encoding tag (default: no encoding).\n" - " Common values: `unic' (Unicode), `symb' (symbol),\n" - " `ADOB' (Adobe standard), `ADBC' (Adobe custom).\n" - " -m text Use `text' for rendering.\n" ); - fprintf( stderr, - " -l mode Set start-up rendering mode (0 <= mode <= %d).\n", - N_LCD_MODES ); - fprintf( stderr, - " -p Preload file in memory to simulate memory-mapping.\n" - "\n" - " -v Show version.\n" - "\n" ); - - exit( 1 ); - } - - - static void - parse_cmdline( int* argc, - char** argv[] ) - { - char* execname; - int option; - - - execname = ft_basename( (*argv)[0] ); - - while ( 1 ) - { - option = getopt( *argc, *argv, "e:f:h:l:m:pr:vw:" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'e': - status.encoding = FTDemo_Make_Encoding_Tag( optarg ); - break; - - case 'f': - status.offset = atoi( optarg ); - break; - - case 'h': - status.height = atoi( optarg ); - if ( status.height < 1 ) - usage( execname ); - break; - - case 'l': - status.lcd_mode = atoi( optarg ); - if ( status.lcd_mode < 0 || status.lcd_mode > N_LCD_MODES ) - { - fprintf( stderr, "argument to `l' must be between 0 and %d\n", - N_LCD_MODES ); - exit( 3 ); - } - break; - - case 'm': - Text = optarg; - status.render_mode = RENDER_MODE_TEXT; - break; - - case 'p': - status.preload = 1; - break; - - case 'r': - status.res = atoi( optarg ); - if ( status.res < 1 ) - usage( execname ); - break; - - case 'v': - { - FT_Int major, minor, patch; - - - FT_Library_Version( handle->library, &major, &minor, &patch ); - - printf( "ftview (FreeType) %d.%d", major, minor ); - if ( patch ) - printf( ".%d", patch ); - printf( "\n" ); - exit( 0 ); - } - /* break; */ - - case 'w': - status.width = atoi( optarg ); - if ( status.width < 1 ) - usage( execname ); - break; - - default: - usage( execname ); - break; - } - } - - *argc -= optind; - *argv += optind; - - if ( *argc <= 1 ) - usage( execname ); - - status.ptsize = (int)( atof( *argv[0] ) * 64.0 ); - if ( status.ptsize == 0 ) - status.ptsize = 64 * 10; - - (*argc)--; - (*argv)++; - } - - - int - main( int argc, - char* argv[] ) - { - grEvent event; - unsigned int dflt_tt_interpreter_version; - int i; - unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - TT_INTERPRETER_VERSION_40 }; - - - /* Initialize engine */ - handle = FTDemo_New(); - - parse_cmdline( &argc, &argv ); - - FT_Library_SetLcdFilter( handle->library, FT_LCD_FILTER_DEFAULT ); - - /* get the default value as compiled into FreeType */ - FT_Property_Get( handle->library, - "cff", - "hinting-engine", &status.cff_hinting_engine ); - - /* collect all available versions, then set again the default */ - FT_Property_Get( handle->library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - for ( i = 0; i < 3; i++ ) - { - error = FT_Property_Set( handle->library, - "truetype", - "interpreter-version", &versions[i] ); - if ( !error ) - status.tt_interpreter_versions[ - status.num_tt_interpreter_versions++] = versions[i]; - if ( versions[i] == dflt_tt_interpreter_version ) - status.tt_interpreter_version_idx = i; - } - FT_Property_Set( handle->library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - - FT_Property_Get( handle->library, - "autofitter", - "warping", &status.warping ); - - handle->encoding = status.encoding; - - if ( status.preload ) - FTDemo_Set_Preload( handle, 1 ); - - for ( ; argc > 0; argc--, argv++ ) - FTDemo_Install_Font( handle, argv[0], 0, 0 ); - - if ( handle->num_fonts == 0 ) - Fatal( "could not find/open any font file" ); - - display = FTDemo_Display_New( gr_pixel_mode_rgb24, - status.width, status.height ); - if ( !display ) - Fatal( "could not allocate display surface" ); - - grSetTitle( display->surface, - "FreeType Glyph Viewer - press ? for help" ); - - status.num_fails = 0; - - event_font_change( 0 ); - - if ( status.lcd_mode >= 0 ) - handle->lcd_mode = status.lcd_mode; - - FTDemo_Update_Current_Flags( handle ); - - do - { - if ( !status.update ) - goto Listen; - - FTDemo_Display_Clear( display ); - - switch ( status.render_mode ) - { - case RENDER_MODE_ALL: - error = Render_All( handle->current_font->num_indices, - status.offset ); - break; - - case RENDER_MODE_EMBOLDEN: - error = Render_Embolden( handle->current_font->num_indices, - status.offset ); - break; - - case RENDER_MODE_SLANTED: - error = Render_Slanted( handle->current_font->num_indices, - status.offset ); - break; - - case RENDER_MODE_STROKE: - error = Render_Stroke( handle->current_font->num_indices, - status.offset ); - break; - - case RENDER_MODE_TEXT: - error = Render_Text( -1, status.offset ); - break; - - case RENDER_MODE_WATERFALL: - error = Render_Waterfall( status.ptsize, status.offset ); - break; - } - - write_header( error ); - - Listen: - grListenSurface( display->surface, 0, &event ); - } while ( Process_Event( &event ) == 0 ); - - printf( "Execution completed successfully.\n" ); - printf( "Fails = %d\n", status.num_fails ); - - FTDemo_Display_Done( display ); - FTDemo_Done( handle ); - exit( 0 ); /* for safety reasons */ - - /* return 0; */ /* never reached */ - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/gbench.c freetype-2.8/=unpacked-tar1=/src/gbench.c --- freetype-2.7.1/=unpacked-tar1=/src/gbench.c 2015-09-25 05:43:17.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/gbench.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,750 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality font engine */ -/* */ -/* Copyright 2006 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* gbench is a small program used to benchmark a new algorithm */ -/* performing gamma-corrected alpha-blending. */ -/* */ -/* EXPERIMENTAL: The numbers given here do not correspond to */ -/* typical usage patterns yet, and the algorithm */ -/* can still be tuned. */ -/* */ -/****************************************************************************/ - - -#include -#include -#include -#include -#include - - /* - * gbench is a small program used to benchmark a new algorithm - * performing gamma-corrected alpha-blending. - * - * EXPERIMENTAL: the numbers given here do not correspond to - * typical usage patterns yet, and the algorithm - * can still be tuned - * - */ - -#ifdef UNIX -#include -#endif -#include "gbench.h" - -#define xxCACHE - - static int use_gamma = 0; - static unsigned char gamma_ramp[256]; - static unsigned char gamma_ramp_inv[256]; - - -#define ALGO_KEY_COUNT 256 -#define ALGO_GRADE_BITS 5 -#define ALGO_GRADE_COUNT (1 << ALGO_GRADE_BITS) -#define ALGO_GRADE_INDEX(x) ((x) >> (8-ALGO_GRADE_BITS)) - - typedef struct CKeyRec_ - { - int background; - int foreground; - unsigned char* grades; - - } CKeyRec, *CKey; - - static CKeyRec ckeys [ ALGO_KEY_COUNT ]; - static unsigned char cgrades[ ALGO_KEY_COUNT * ALGO_GRADE_COUNT * 3 ]; - - static chits = 0; - static cmiss1 = 0; - static cmiss2 = 0; - - - /* clear the cache - */ - static void - cclear( void ) - { - int nn; - - for ( nn = 0; nn < ALGO_KEY_COUNT; nn++ ) - ckeys[nn].grades = NULL; - } - - /* recompute the grade levels of a given key - */ - static void - ckey_reset( CKey key ) - { - int back = key->background; - int fore = key->foreground; - unsigned char* gr = key->grades; - int nn; - - int r1,g1,b1,r2,g2,b2; - - r1 = (unsigned char)( back >> 16 ); - g1 = (unsigned char)( back >> 8 ); - b1 = (unsigned char)( back ); - - r2 = (unsigned char)( fore >> 16 ); - g2 = (unsigned char)( fore >> 8 ); - b2 = (unsigned char)( fore ); - - gr[0] = r1; - gr[1] = g1; - gr[2] = b1; - - gr[3] = r2; - gr[4] = g2; - gr[5] = b2; - - gr += 6; - - if ( use_gamma ) - { - r1 = gamma_ramp_inv[r1]; - g1 = gamma_ramp_inv[g1]; - b1 = gamma_ramp_inv[b1]; - - r2 = gamma_ramp_inv[r2]; - g2 = gamma_ramp_inv[g2]; - b2 = gamma_ramp_inv[b2]; - } - - for ( nn = 1; nn < ALGO_GRADE_COUNT-1; nn++ ) - { - int r = r1 + ((r2-r1)*nn)/(ALGO_GRADE_COUNT-1); - int g = g1 + ((g2-g1)*nn)/(ALGO_GRADE_COUNT-1); - int b = b1 + ((b2-b1)*nn)/(ALGO_GRADE_COUNT-1); - - if ( use_gamma ) - { - r = gamma_ramp[r]; - g = gamma_ramp[g]; - b = gamma_ramp[b]; - } - - gr[0] = (unsigned char)r; - gr[1] = (unsigned char)g; - gr[2] = (unsigned char)b; - - gr += 3; - } - cmiss2 ++; - } - - /* lookup the grades of a given (background,foreground) couple - */ - static const unsigned char* - clookup( int background, - int foreground ) - { - int index, index0; - CKey key; - - cmiss1++; - - index0 = ( background + foreground*7 ) % ALGO_KEY_COUNT; - index = index0; - do - { - key = ckeys + index; - - if ( key->grades == NULL ) - goto NewNode; - - if ( key->background == background && - key->foreground == foreground ) - goto Exit; - - index = (index+1) % ALGO_KEY_COUNT; - } - while ( index != index0 ); - - /* the cache is full, clear it completely - */ - cclear(); - - NewNode: - key->background = background; - key->foreground = foreground; - key->grades = cgrades + index0*(3*ALGO_GRADE_COUNT); - - ckey_reset( key ); - - Exit: - return (const unsigned char*)key->grades; - } - - - - void - ggamma_set( double gamma ) - { - int ii; - double gamma_inv = 1.0f / gamma; - - cclear(); - - for ( ii = 0; ii < 256; ii++ ) - gamma_ramp[ii] = (unsigned char)( pow( (double)ii/255.0f, gamma )*255 ); - - for ( ii = 0; ii < 256; ii++ ) - gamma_ramp_inv[ii] = (unsigned char)( pow( (double)ii/255.0f, gamma_inv ) * 255.0f ); - - use_gamma = (gamma != 1.0f); - } - - - - static void - gblitter_blitrgb24_gray_direct( GBlitter blitter, - int color ) - { - unsigned char r = (unsigned char)(color >> 16); - unsigned char g = (unsigned char)(color >> 8); - unsigned char b = (unsigned char)(color); - - int h = blitter->height; - unsigned char* src_line = blitter->src_line; - unsigned char* dst_line = blitter->dst_line; - - if ( use_gamma ) - { - int r1 = gamma_ramp_inv[r]; - int g1 = gamma_ramp_inv[g]; - int b1 = gamma_ramp_inv[b]; - - do - { - unsigned char* src = src_line + (blitter->src_x); - unsigned char* dst = dst_line + (blitter->dst_x*3); - int w = blitter->width; - - do - { - int a = src[0]; - - if ( a < 2 ) - { - /* nothing */ - } - else if ( a >= 254 ) - { - dst[0] = r; - dst[1] = g; - dst[2] = b; - } - else - { - int r0 = dst[0]; - int g0 = dst[1]; - int b0 = dst[2]; - - r0 = gamma_ramp_inv[r0]; - g0 = gamma_ramp_inv[g0]; - b0 = gamma_ramp_inv[b0]; - - a = a + (a >> 7); - - r0 += (r1 - r0)*a/256; - g0 += (g1 - g0)*a/256; - b0 += (b1 - b0)*a/256; - - r0 = gamma_ramp[r0]; - g0 = gamma_ramp[g0]; - b0 = gamma_ramp[b0]; - - dst[0] = (unsigned char)r0; - dst[1] = (unsigned char)g0; - dst[2] = (unsigned char)b0; - } - - src += 1; - dst += 3; - } - while (--w > 0); - - src_line += blitter->src_incr; - dst_line += blitter->dst_incr; - } - while (--h > 0); - - return; - } - - do - { - unsigned char* src = src_line + (blitter->src_x); - unsigned char* dst = dst_line + (blitter->dst_x*3); - int w = blitter->width; - - do - { - int a = src[0]; - - if ( a < 2 ) - { - /* nothing */ - } - else if ( a >= 254 ) - { - dst[0] = r; - dst[1] = g; - dst[2] = b; - } - else - { - int r0 = dst[0]; - int g0 = dst[1]; - int b0 = dst[2]; - - a = a + (a >> 7); - - r0 += (r - r0)*a/256; - g0 += (g - g0)*a/256; - b0 += (b - b0)*a/256; - - dst[0] = (unsigned char)r0; - dst[1] = (unsigned char)g0; - dst[2] = (unsigned char)b0; - } - - src += 1; - dst += 3; - } - while (--w > 0); - - src_line += blitter->src_incr; - dst_line += blitter->dst_incr; - } - while (--h > 0); - } - - - static void - gblitter_blitrgb24_gray_cache( GBlitter blitter, - int color ) - { - unsigned char r = (unsigned char)(color >> 16); - unsigned char g = (unsigned char)(color >> 8); - unsigned char b = (unsigned char)(color); - - int back = -1; - const unsigned char* grades = NULL; - - int h = blitter->height; - unsigned char* src_line = blitter->src_line; - unsigned char* dst_line = blitter->dst_line; - - do - { - unsigned char* src = src_line + (blitter->src_x); - unsigned char* dst = dst_line + (blitter->dst_x*3); - int w = blitter->width; - - do - { - int a = src[0]; - - if ( a < 2 ) - { - /* nothing */ - } - else if ( a >= 254 ) - { - dst[0] = r; - dst[1] = g; - dst[2] = b; - } - else - { - int back0 = ((int)dst[0] << 16) | ((int)dst[1] << 8) | dst[2]; - const unsigned char* g; - - if ( back0 != back ) - { - grades = clookup( back0, color ); - back = back0; - } - else - chits++; - - g = grades + ALGO_GRADE_INDEX(a)*3; - - dst[0] = g[0]; - dst[1] = g[1]; - dst[2] = g[2]; - } - - src += 1; - dst += 3; - } - while (--w > 0); - - src_line += blitter->src_incr; - dst_line += blitter->dst_incr; - } - while (--h > 0); - } - - - - int - gblitter_init_rgb24( GBlitter blitter, - GBitmap src, - int dst_x, - int dst_y, - int dst_width, - int dst_height, - void* dst_buffer, - int dst_pitch ) - { - int width = src->width; - int height = src->height; - int delta; - int src_x = 0; - int src_y = 0; - - if ( dst_x < 0 ) - { - width += dst_x; - src_x = -dst_x; - dst_x = 0; - } - - delta = dst_x + width - dst_width; - if ( delta > 0 ) - width -= delta; - - if ( dst_y < 0 ) - { - height += dst_y; - src_y = -dst_y; - dst_y = 0; - } - - delta = dst_y + height - dst_height; - if ( delta > 0 ) - height -= delta; - - if ( width <= 0 || height <= 0 ) - { - blitter->width = 0; - blitter->height = 0; - blitter->blit = NULL; - - return 1; - } - - blitter->width = width; - blitter->height = height; - - blitter->src_x = src_x; - blitter->src_line = src->buffer + src_y*src->pitch; - blitter->src_incr = src->pitch; - - blitter->dst_x = dst_x; - blitter->dst_line = (unsigned char*)dst_buffer + dst_y*dst_pitch; - blitter->dst_incr = dst_pitch; - - return 0; - } - - - -#include -#include -#include -#include - -#ifdef UNIX -#include -#endif - -typedef int (*bench_t)( int arg ); - -#define BENCH_TIME 3.0f - -double -get_time(void) -{ -#ifdef UNIX - struct timeval tv; - - gettimeofday(&tv, NULL); - return (double)tv.tv_sec + (double)tv.tv_usec / 1E6; -#else - /* clock() has an awful precision (~10ms) under Linux 2.4 + glibc 2.2 */ - return (double)clock() / (double)CLOCKS_PER_SEC; -#endif -} - - -double bench_time = BENCH_TIME; - -static void -bench( bench_t bench_func, - int bench_arg, - const char* title, - int max) -{ - int i, n, done; - double t0, delta; - - printf("%-30s : ", title); - fflush(stdout); - - n = 0; - done = 0; - t0 = get_time(); - do - { - if (!(*bench_func)( bench_arg ) ) - done++; - n++; - delta = get_time() - t0; - } - while ((!max || n < max) && delta < bench_time); - - printf("%5.3f us/op\n", delta * 1E6 / (double)done); -} - - - -/* this is un-hinted "W" in Times New Roman - * this glyph is very fuzzy - */ -static const unsigned char glyph_data[18*14] = -{ - 0x4a, 0x91, 0x94, 0x93, 0x5a, 0x00, 0x4c, 0x92, 0x94, 0x94, 0x67, 0x0b, 0x00, - 0x00, 0x61, 0x92, 0x93, 0x50, - 0x00, 0x65, 0xff, 0xbb, 0x00, 0x00, 0x00, 0x65, 0xff, 0xd5, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xa4, 0x7f, 0x00, - 0x00, 0x08, 0xf0, 0xe6, 0x01, 0x00, 0x00, 0x02, 0xe4, 0xf1, 0x05, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x10, 0x00, - 0x00, 0x00, 0x9c, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x4b, 0x00, 0x00, - 0x00, 0x1d, 0xae, 0x00, 0x00, - 0x00, 0x00, 0x41, 0xff, 0x99, 0x00, 0x00, 0x00, 0x82, 0xff, 0xa6, 0x00, 0x00, - 0x00, 0x74, 0x57, 0x00, 0x00, - 0x00, 0x00, 0x01, 0xe3, 0xed, 0x05, 0x00, 0x00, 0xcd, 0xd9, 0xf4, 0x0b, 0x00, - 0x00, 0xc1, 0x0a, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x89, 0xff, 0x4d, 0x00, 0x33, 0xa1, 0x7a, 0xff, 0x5b, 0x00, - 0x25, 0xa6, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x2e, 0xff, 0xa7, 0x00, 0x8c, 0x46, 0x20, 0xfe, 0xb6, 0x00, - 0x7d, 0x4e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xd2, 0xf5, 0x0d, 0xca, 0x03, 0x00, 0xc4, 0xfb, 0x15, - 0xc4, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x77, 0xff, 0x98, 0x90, 0x00, 0x00, 0x69, 0xff, 0x98, - 0x9d, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfe, 0xff, 0x35, 0x00, 0x00, 0x13, 0xfa, 0xff, - 0x45, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xd9, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xe9, - 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x57, 0x94, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x00, 0x00, 0x08, 0x19, - 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -static const GBitmapRec glyph = -{ - 18, - 14, - 18, - (unsigned char*) glyph_data, - GBITMAP_FORMAT_GRAY -}; - -#define SIZE_X 640 -#define SIZE_Y 480 - - -static unsigned char buffer[ SIZE_X*3*SIZE_Y ]; - -unsigned long seed = 0; - -unsigned long my_rand( void ) -{ - seed = seed * 1103515245 + 12345; - return ((seed >>16) & 32767); -} - - -#define RAND(n) ((unsigned int)my_rand() % (n)) - -static int -do_glyph( int arg ) -{ - GBlitterRec blit; - int dst_x = RAND(SIZE_X); - int dst_y = RAND(SIZE_Y); - int color = 0xFFFFFF; /* draw white exclusively */ - - if ( gblitter_init_rgb24( &blit, - (GBitmap)&glyph, - dst_x, - dst_y, - SIZE_X, - SIZE_Y, - buffer, - SIZE_X*3 ) ) - return 1; - - if ( arg ) - gblitter_blitrgb24_gray_cache( &blit, color ); - else - gblitter_blitrgb24_gray_direct( &blit, color ); - - - return 0; -} - - - -static int -do_glyph_color( int arg ) -{ - GBlitterRec blit; - int dst_x = RAND(SIZE_X); - int dst_y = RAND(SIZE_Y); - int r = RAND(256); - int g = RAND(256); - int b = RAND(256); - int color = (r << 16) | (g << 8) | b; /* draw in colors */ - - if ( gblitter_init_rgb24( &blit, - (GBitmap)&glyph, - dst_x, - dst_y, - SIZE_X, - SIZE_Y, - buffer, - SIZE_X*3 ) ) - return 1; - - if ( arg ) - gblitter_blitrgb24_gray_cache( &blit, color ); - else - gblitter_blitrgb24_gray_direct( &blit, color ); - - return 0; -} - - -static void -dump_cache_stats( void ) -{ - printf( "hits = %ld, miss1 = %ld, miss2 = %ld, hitrate=%.2f%%, miss2rate=%.2f%%\n", - chits, cmiss1, cmiss2, (double)chits*100.0 / (chits+cmiss1), (double)cmiss2*100.0 / (double)cmiss1 ); -} - - -void usage(void) -{ - fprintf( stderr, - "gbench: graphics glyph blending benchmark\n" - "-----------------------------------------\n\n" - "Usage: gbench [options]\n\n" - "options:\n" ); - fprintf( stderr, - " -t : max time per bench in seconds (default is %.0f)\n", BENCH_TIME ); - fprintf( stderr, - " -s seed : specify random seed\n" ); - fprintf( stderr, - " -g gamma : specify gamma\n" ); - exit( 1 ); -} - -#define TEST(x) (!tests || strchr(tests, x)) - -int -main(int argc, - char** argv) -{ - char* tests = NULL; - int size; - double gamma = 1.0; - - while (argc > 1 && argv[1][0] == '-') - { - switch (argv[1][1]) - { - case 't': - argc--; - argv++; - if (argc < 1 || - sscanf(argv[1], "%lf", &bench_time) != 1) - usage(); - break; - - case 'g': - argc--; - argv++; - if (argc < 1 || - sscanf(argv[1], "%lf", &gamma) != 1) - usage(); - break; - - - case 's': - if ( argc < 1 ) - usage(); - - seed = (unsigned long)atol( argv[1] ); - argc -= 2; - argv += 2; - break; - -#if 0 - case 'b': - argc--; - argv++; - if (argc < 2) - usage(); - tests = argv[1]; - break; -#endif - - default: - fprintf(stderr, "Unknown argument `%s'\n\n", argv[1]); - usage(); - break; - } - - argc--; - argv++; - } - - if ( argc != 1 ) - usage(); - - ggamma_set( gamma ); - - memset( buffer, 0, sizeof(buffer) ); - if (TEST('a')) bench( do_glyph, 0, "direct white glyph", 0 ); - - chits = cmiss1 = cmiss2 = 0; - memset( buffer, 0, sizeof(buffer) ); - if (TEST('b')) bench( do_glyph, 1, "cache white glyph", 0 ); - dump_cache_stats(); - - memset( buffer, 0, sizeof(buffer) ); - if (TEST('c')) bench( do_glyph_color, 0, "direct color glyph", 0 ); - - chits = cmiss1 = cmiss2 = 0; - memset( buffer, 0, sizeof(buffer) ); - if (TEST('d')) bench( do_glyph_color, 1, "cache color glyph", 0 ); - dump_cache_stats(); - - return 0; -} - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/gbench.h freetype-2.8/=unpacked-tar1=/src/gbench.h --- freetype-2.7.1/=unpacked-tar1=/src/gbench.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/gbench.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality font engine */ -/* */ -/* Copyright 2006 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* gbench is a small program used to benchmark a new algorithm */ -/* performing gamma-corrected alpha-blending. */ -/* */ -/****************************************************************************/ - - -#ifndef GBENCH_H_ -#define GBENCH_H_ - - typedef enum - { - GBITMAP_FORMAT_NONE = 0, - GBITMAP_FORMAT_RGB24, - GBITMAP_FORMAT_GRAY, - GBITMAP_FORMAT_RGB, - GBITMAP_FORMAT_BGR, - GBITMAP_FORMAT_RGBV, - GBITMAP_FORMAT_BGRV, - - GBITMAP_FORMAT_MAX - - } GBitmapFormat; - - - typedef struct GBitmapRec_ - { - int width; - int height; - int pitch; - unsigned char* buffer; - GBitmapFormat format; - - } GBitmapRec, *GBitmap; - - - typedef struct GBlitterRec_* GBlitter; - - typedef void (*GBlitterFunc)( GBlitter blitter, - int color ); - - typedef struct GBlitterRec_ - { - int width; - int height; - - int src_x; - unsigned char* src_line; - int src_incr; - - int dst_x; - unsigned char* dst_line; - int dst_incr; - - GBlitterFunc blit; - - } GBlitterRec; - - - extern void - ggamma_set( double gamma ); - - extern int - gblitter_init_rgb24( GBlitter blitter, - GBitmap src, - int dst_x, - int dst_y, - int dst_width, - int dst_height, - void* dst_buffer, - int dst_pitch ); - -#define gblitter_blit(b,c) (b)->blit( (b), (c) ) - - -#endif /* GBENCH_H_ */ - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/Jamfile freetype-2.8/=unpacked-tar1=/src/Jamfile --- freetype-2.7.1/=unpacked-tar1=/src/Jamfile 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/Jamfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -# FreeType 2 src Jamfile (c) 2001, 2003, 2004, 2005, 2007 David Turner -# - -SubDir FT2DEMO_TOP src ; - -SubDirHdrs $(FT2_INCLUDE) ; -SubDirHdrs [ FT2DEMO_SubDir src ] ; -SubDirHdrs [ FT2DEMO_SubDir graph ] ; - -COMMON_LIB = $(LIBPREFIX)ft2common$(SUFLIB) ; - -Library $(COMMON_LIB) : ftcommon.c common.c ; - - -if $(UNIX) -{ - CCDEFS += UNIX ; - LINKLIBS += -lm ; -} - -PROGRAMS = ftbench ftlint ftdump fttimer ftchkwd ftvalid ftpatchk ; -GRAPHIC_PROGRAMS = ftview ftmulti ftstring ftgamma ftgrid ftdiff ; -{ - local t ; - - for t in $(PROGRAMS) $(GRAPHIC_PROGRAMS) - { - Main $(t) : $(t).c ; - LinkLibraries $(t) : $(COMMON_LIB) $(FT2_LIB) ; - } - - for t in $(GRAPHIC_PROGRAMS) - { - LINKLIBS on $(t)$(SUFEXE) = $(LINKLIBS) $(GRAPH_LINKLIBS) ; - LinkLibraries $(t) : $(GRAPH_LIB) ; - } -} - - -# Compile bytecode debugger when needed. Define the environment -# variable FT2_DEBUG_TT to enable this one before calling "jam" -# -if $(FT2_DEBUG_TT) -{ - if $(UNIX) { DEFINES += UNIX ; } - SubDirHdrs $(FT2_INCLUDE)/../src/truetype ; - - LinkLibraries ttdebug : $(FT2_LIB) ; - Main ttdebug : ttdebug.c ; -} - -Main gbench : gbench.c ; - - -# end of src Jamfile diff -Nru freetype-2.7.1/=unpacked-tar1=/src/mlgetopt.c freetype-2.8/=unpacked-tar1=/src/mlgetopt.c --- freetype-2.7.1/=unpacked-tar1=/src/mlgetopt.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/mlgetopt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -/* - * This is a cheap replacement for getopt() because that routine is not - * available on some platforms and behaves differently on other platforms. - * This code was written from scratch without looking at any other - * implementation. - * - * This code is hereby expressly placed in the public domain. - * mleisher@crl.nmsu.edu (Mark Leisher) - * 10 October 1997 - * - * Last update 2009-03-11. - */ - -#include "mlgetopt.h" - -#include -#include -#include -#include - -#ifdef __STDC__ -#define CONST const -#else -#define CONST -#endif - - /* - * Externals visible to programs. - */ - - int opterr = 1; - int optind = 1; - char* optarg; - - /* - * Internal variables that are used to detect when the global values - * need to be reset. - */ - - static int cmdac; - static CONST char* cmdname; - static char* CONST* cmdav; - - int -#ifdef __STDC__ - getopt( int ac, char* const* av, const char* pat ) -#else - getopt( ac, av, pat ) - int ac; - char** av; - char* pat; -#endif - { - int opt; - CONST char* p; - CONST char* pp; - - /* - * If there is no pattern, indicate the parsing is done. - */ - if ( pat == 0 || *pat == 0 ) - return -1; - - /* - * Always reset the option argument to NULL. - */ - optarg = 0; - - /* - * If the number of arguments or argument list do not match the last - * values seen, reset the internal pointers and the globals. - */ - if ( ac != cmdac || av != cmdav ) - { - optind = 1; - cmdac = ac; - cmdav = av; - - /* - * Determine the command name in case it is needed for warning - * messages. - */ - for ( cmdname = 0, p = av[0]; *p; p++ ) - { - if ( *p == '/' || *p == '\\' ) - cmdname = p; - } - /* - * Skip the path separator if the name was assigned. - */ - if ( cmdname ) - cmdname++; - else - cmdname = av[0]; - } - - /* - * If the next index is greater than or equal to the number of - * arguments, then the command line is done. - */ - if ( optind >= ac ) - return -1; - - /* - * Test the next argument for one of three cases: - * 1. The next argument does not have an initial '-'. - * 2. The next argument is '-'. - * 3. The next argument is '--'. - * - * In either of these cases, command line processing is done. - */ - if ( av[optind][0] != '-' || - strcmp( av[optind], "-" ) == 0 || - strcmp( av[optind], "--" ) == 0 ) - return -1; - - /* - * Point at the next command line argument and increment the - * command line index. - */ - p = av[optind++]; - - /* - * Look for the first character of the command line option. - */ - for ( opt = *(p + 1), pp = pat; *pp && *pp != opt; pp++ ) - ; - - /* - * If nothing in the pattern was recognized, then issue a warning - * and return a '?'. - */ - if ( *pp == 0 ) - { - if ( opterr ) - fprintf( stderr, "%s: invalid option -- %c\n", cmdname, opt ); - return '?'; - } - - /* - * If the option expects an argument, get it. - */ - if ( *(pp + 1) == ':' && (optarg = av[optind]) == 0 ) - { - /* - * If the option argument is NULL, issue a warning and return a '?'. - */ - if ( opterr ) - fprintf( stderr, "%s: option requires an argument -- %c\n", - cmdname, opt ); - opt = '?'; - } - else if ( optarg ) - /* - * Increment the option index past the argument. - */ - optind++; - - /* - * Return the option character. - */ - return opt; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/mlgetopt.h freetype-2.8/=unpacked-tar1=/src/mlgetopt.h --- freetype-2.7.1/=unpacked-tar1=/src/mlgetopt.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/mlgetopt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* - * This is a cheap replacement for getopt() because that routine is not - * available on some platforms and behaves differently on other platforms. - * - * This code is hereby expressly placed in the public domain. - * mleisher@crl.nmsu.edu (Mark Leisher) - * 10 October 1997 - */ - -#ifndef MLGETOPT_H_ -#define MLGETOPT_H_ - -#ifdef VMS -#define getopt local_getopt -#define optind local_optind -#define opterr local_opterr -#endif - -#ifdef __cplusplus - extern "C" { -#endif - - extern int opterr; - extern int optind; - extern char* optarg; - - extern int getopt( -#ifdef __STDC__ - int argc, - char* const* argv, - const char* pattern -#endif - ); - -#ifdef __cplusplus - } -#endif - -#endif /* MLGETOPT_H_ */ - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/output.c freetype-2.8/=unpacked-tar1=/src/output.c --- freetype-2.7.1/=unpacked-tar1=/src/output.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/output.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,426 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2015 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* output.c - string output routines for the FreeType demo programs. */ -/* */ -/****************************************************************************/ - - -#include "output.h" - - - static char hexdigit[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F' - }; - - - void - put_ascii_string( char* out, - FT_Byte* string, - FT_UInt string_len, - FT_UInt indent ) - { - FT_UInt i, j; - - - for ( j = 0; j < indent; j++ ) - *out++ = ' '; - *out++ = '"'; - - for ( i = 0; i < string_len; i++ ) - { - switch ( string[i] ) - { - case '\n': - *out++ = '\\'; - *out++ = 'n'; - *out++ = '"'; - - if ( i + 1 < string_len ) - { - *out++ = '\n'; - for ( j = 0; j < indent; j++ ) - *out++ = ' '; - *out++ = '"'; - } - break; - - case '\r': - *out++ = '\\'; - *out++ = 'r'; - break; - - case '\t': - *out++ = '\\'; - *out++ = 't'; - break; - - case '\\': - *out++ = '\\'; - *out++ = '\\'; - break; - - case '"': - *out++ = '\\'; - *out++ = '"'; - break; - - default: - if ( string[i] < 0x80 ) - *out++ = (char)string[i]; - else - { - *out++ = '\\'; - *out++ = 'x'; - *out++ = hexdigit[string[i] >> 4]; - *out++ = hexdigit[string[i] & 0xF]; - } - break; - } - } - if ( string[i - 1] != '\n' ) - *out++ = '"'; - - *out++ = '\0'; - } - - - FT_UInt - put_ascii_string_size( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent ) - { - FT_UInt i, len = 0; - - - /* the code formatting follows `put_ascii_string' */ - - len += indent; - len += 1; - - for ( i = 0; i < string_len; i++ ) - { - switch ( string[i] ) - { - case '\n': - len += 3; - - if ( i + 1 < string_len ) - { - len += 1; - len += indent; - len += 1; - } - break; - - case '\r': - case '\t': - case '\\': - case '"': - len += 2; - break; - - default: - if ( string[i] < 0x80 ) - len += 1; - else - len += 4; - break; - } - } - if ( string[i - 1] != '\n' ) - len += 1; - - len += 1; - - return len; - } - - - void - put_ascii( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent ) - { - FT_UInt len; - char* s; - - - len = put_ascii_string_size( string, string_len, indent ); - s = (char*)malloc( len ); - if ( !s ) - printf( "allocation error for name string" ); - else - { - put_ascii_string( s, string, string_len, indent ); - fputs( s, stdout ); - free( s ); - } - } - - - void - put_unicode_be16_string( char* out, - FT_Byte* string, - FT_UInt string_len, - FT_UInt indent, - FT_Int as_utf8 ) - { - FT_Int ch = 0; - FT_UInt i, j; - - - for ( j = 0; j < indent; j++ ) - *out++ = ' '; - *out++ = '"'; - - for ( i = 0; i < string_len; i += 2 ) - { - ch = ( string[i] << 8 ) | string[i + 1]; - - switch ( ch ) - { - case '\n': - *out++ = '\\'; - *out++ = 'n'; - *out++ = '"'; - - if ( i + 2 < string_len ) - { - *out++ = '\n'; - for ( j = 0; j < indent; j++ ) - *out++ = ' '; - *out++ = '"'; - } - continue; - - case '\r': - *out++ = '\\'; - *out++ = 'r'; - continue; - - case '\t': - *out++ = '\\'; - *out++ = 't'; - continue; - - case '\\': - *out++ = '\\'; - *out++ = '\\'; - continue; - - case '"': - *out++ = '\\'; - *out++ = '"'; - continue; - - default: - break; - } - - if ( as_utf8 ) - { - /* - * UTF-8 encoding - * - * 0x00000080 - 0x000007FF: - * 110xxxxx 10xxxxxx - * - * 0x00000800 - 0x0000FFFF: - * 1110xxxx 10xxxxxx 10xxxxxx - */ - - if ( ch < 0x80 ) - *out++ = (char)ch; - else if ( ch < 0x800 ) - { - *out++ = (char)( 0xC0 | ( (FT_UInt)ch >> 6 ) ); - *out++ = (char)( 0x80 | ( (FT_UInt)ch & 0x3F ) ); - } - else - { - /* we don't handle surrogates */ - *out++ = (char)( 0xE0 | ( (FT_UInt)ch >> 12 ) ); - *out++ = (char)( 0x80 | ( ( (FT_UInt)ch >> 6 ) & 0x3F ) ); - *out++ = (char)( 0x80 | ( (FT_UInt)ch & 0x3F ) ); - } - - continue; - } - - switch ( ch ) - { - case 0x00A9: - *out++ = '('; - *out++ = 'c'; - *out++ = ')'; - continue; - - case 0x00AE: - *out++ = '('; - *out++ = 'r'; - *out++ = ')'; - continue; - - case 0x2013: - *out++ = '-'; - *out++ = '-'; - continue; - - case 0x2019: - *out++ = '\''; - continue; - - case 0x2122: - *out++ = '('; - *out++ = 't'; - *out++ = 'm'; - *out++ = ')'; - continue; - - default: - if ( ch < 128 ) - *out++ = (char)ch; - else - { - *out++ = '\\'; - *out++ = 'U'; - *out++ = '+'; - *out++ = hexdigit[( string[i] >> 12 ) & 0xF]; - *out++ = hexdigit[( string[i] >> 8 ) & 0xF]; - *out++ = hexdigit[( string[i] >> 4 ) & 0xF]; - *out++ = hexdigit[ string[i] & 0xF]; - } - continue; - } - } - - if ( ch != '\n' ) - *out++ = '"'; - - *out++ = '\0'; - } - - - FT_UInt - put_unicode_be16_string_size( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent, - FT_Int as_utf8 ) - { - FT_Int ch = 0; - FT_UInt i, len = 0; - - - /* the code formatting follows `put_unicode_be16_string' */ - - len += indent; - len += 1; - - for ( i = 0; i < string_len; i += 2 ) - { - ch = ( string[i] << 8 ) | string[i + 1]; - - switch ( ch ) - { - case '\n': - len += 3; - - if ( i + 2 < string_len ) - { - len += 1; - len += indent; - len += 1; - } - continue; - - case '\r': - case '\t': - case '\\': - case '"': - len += 2; - continue; - - default: - break; - } - - if ( as_utf8 ) - { - if ( ch < 0x80 ) - len += 1; - else if ( ch < 0x800 ) - len += 2; - else - len += 3; - - continue; - } - - switch ( ch ) - { - case 0x00A9: - case 0x00AE: - len += 3; - continue; - - case 0x2013: - len += 2; - continue; - - case 0x2019: - len += 1; - continue; - - case 0x2122: - len += 4; - continue; - - default: - if ( ch < 128 ) - len += 1; - else - len += 7; - continue; - } - } - - if ( ch != '\n' ) - len += 1; - - len += 1; - - return len; - } - - - void - put_unicode_be16( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent, - FT_Int utf8 ) - { - FT_UInt len; - char* s; - - - len = put_unicode_be16_string_size( string, string_len, indent, utf8 ); - s = (char*)malloc( len ); - if ( !s ) - printf( "allocation error for name string" ); - else - { - put_unicode_be16_string( s, string, string_len, indent, utf8 ); - fputs( s, stdout ); - free( s ); - } - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/output.h freetype-2.8/=unpacked-tar1=/src/output.h --- freetype-2.7.1/=unpacked-tar1=/src/output.h 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/output.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 2015 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* output.h - string output routines for the FreeType demo programs. */ -/* */ -/****************************************************************************/ - - -#ifndef OUTPUT_H_ -#define OUTPUT_H_ - - -#include -#include FT_FREETYPE_H - - - void - put_ascii_string( char* out, - FT_Byte* string, - FT_UInt string_len, - FT_UInt indent ); - - FT_UInt - put_ascii_string_size( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent ); - - void - put_ascii( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent ); - - - void - put_unicode_be16_string( char* out, - FT_Byte* string, - FT_UInt string_len, - FT_UInt indent, - FT_Int as_utf8 ); - - FT_UInt - put_unicode_be16_string_size( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent, - FT_Int as_utf8 ); - - void - put_unicode_be16( FT_Byte* string, - FT_UInt string_len, - FT_UInt indent, - FT_Int as_utf8 ); - - -#endif /* OUTPUT_H_ */ - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/testname.c freetype-2.8/=unpacked-tar1=/src/testname.c --- freetype-2.7.1/=unpacked-tar1=/src/testname.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/testname.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -#include -#include -#include - -#include -#include FT_FREETYPE_H - - - int main( int argc, - char* argv[] ) - { - FT_Library font_library; - FT_Face font_face; - FT_Bitmap bitmap; - FT_GlyphSlot cur_glyph; - FT_Glyph_Metrics glyph_metrics; - - int glyph_ind; - int num_chars; - char char_name[256]; - - - if (argc != 2) - exit( 1 ); - if ( FT_Init_FreeType( &font_library ) ) - exit( 1 ); - if ( FT_New_Face( font_library, argv[1], 0 , &font_face ) ) - exit( 1 ); - if ( FT_Set_Char_Size( font_face , 0 , 768 , 300 , 300 ) ) - exit( 1 ); - - num_chars = (int)font_face->num_glyphs; - FT_Set_Transform( font_face , NULL , NULL ); - - for ( glyph_ind = 0 ; glyph_ind < num_chars; glyph_ind++ ) - { - if ( FT_Load_Glyph( font_face, glyph_ind, FT_LOAD_DEFAULT ) ) - exit( 1 ); - cur_glyph = font_face->glyph; - if ( cur_glyph->format != FT_GLYPH_FORMAT_BITMAP ) - if ( FT_Render_Glyph( font_face->glyph, FT_RENDER_MODE_MONO ) ) - exit( 1 ); - if ( FT_Get_Glyph_Name( font_face, glyph_ind, char_name, 16 ) ) - exit( 1 ); - - bitmap = cur_glyph->bitmap; - glyph_metrics = cur_glyph->metrics; - - printf( "Glyph %d name %s %ld %ld %ld %d %d\n", - glyph_ind, - char_name, - glyph_metrics.horiBearingX / 64, - glyph_metrics.horiBearingY / 64, - glyph_metrics.horiAdvance / 64, - bitmap.width , bitmap.rows ); - } - - return 0; - } - - -/* END */ diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ttdebug.1 freetype-2.8/=unpacked-tar1=/src/ttdebug.1 --- freetype-2.7.1/=unpacked-tar1=/src/ttdebug.1 2016-12-30 20:32:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ttdebug.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -.TH TTDEBUG 1 "December 2016" "FreeType 2.7.1" -. -. -.SH NAME -. -ttdebug \- a TrueType bytecode debugger -. -. -.SH SYNOPSIS -. -.B ttdebug -.RI [ options ] -.I index size font -. -. -.SH DESCRIPTION -. -.B ttdebug -is an interactive TrueType bytecode debugger working in a terminal. -Its spartanic interface faintly resembles debuggers like -.BR gdb . -. -.PP -For the specified -.IR font , -a glyph with the given -.I index -and -.I size -is loaded, making it possible to trace the bytecode execution step by step. -. -.PP -This program is part of the FreeType demos package. -. -. -.SH OPTIONS -. -.TP -.BI "\-I " ver -Use TrueType interpreter version -.IR ver . -Available versions are depending on compilation options of FreeType; -call -.B ttdebug -without an argument to get the actual list. -. -.TP -.B \-v -Show version. -. -.\" eof diff -Nru freetype-2.7.1/=unpacked-tar1=/src/ttdebug.c freetype-2.8/=unpacked-tar1=/src/ttdebug.c --- freetype-2.7.1/=unpacked-tar1=/src/ttdebug.c 2016-10-08 16:48:22.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/src/ttdebug.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2088 +0,0 @@ -/****************************************************************************/ -/* */ -/* The FreeType project -- a free and portable quality TrueType renderer. */ -/* */ -/* Copyright 1996-2002, 2007, 2011, 2013, 2014 by */ -/* D. Turner, R.Wilhelm, and W. Lemberg */ -/* */ -/* */ -/* ttdebug - a simple TrueType debugger for the console. */ -/* */ -/****************************************************************************/ - - -#include -#include - -#ifdef UNIX - -#ifndef HAVE_POSIX_TERMIOS - -#include -#include - -#else /* HAVE_POSIX_TERMIOS */ - -#ifndef HAVE_TCGETATTR -#define HAVE_TCGETATTR -#endif - -#ifndef HAVE_TCSETATTR -#define HAVE_TCSETATTR -#endif - -#include - -#endif /* HAVE_POSIX_TERMIOS */ - -#endif /* UNIX */ - - - /* Define the `getch()' function. On Unix systems, it is an alias */ - /* for `getchar()', and the debugger front end must ensure that the */ - /* `stdin' file descriptor is not in line-by-line input mode. */ -#ifndef UNIX -#include -#else -#define getch getchar -#endif - - -#include -#include FT_FREETYPE_H -#include "common.h" -#include "mlgetopt.h" - -#include FT_TRUETYPE_DRIVER_H - - /* The following header shouldn't be used in normal programs. */ - /* `freetype2/src/truetype' must be in the current include path. */ -#include "ttobjs.h" -#include "ttdriver.h" -#include "ttinterp.h" -#include "tterrors.h" - - -#define Quit -1 -#define Restart -2 - - - static FT_Library library; /* root library object */ - static FT_Memory memory; /* system object */ - static FT_Driver driver; /* truetype driver */ - static TT_Face face; /* truetype face */ - static TT_Size size; /* truetype size */ - static TT_GlyphSlot glyph; /* truetype glyph slot */ - - static unsigned int tt_interpreter_versions[3]; - static int num_tt_interpreter_versions; - static unsigned int dflt_tt_interpreter_version; - - static FT_Bool use_float = 0; /* number format */ - - static FT_Error error; - - - typedef char ByteStr[2]; - typedef char WordStr[4]; - typedef char LongStr[8]; - typedef char DebugStr[128]; - - static DebugStr tempStr; - - - typedef struct Storage_ - { - FT_Bool initialized; - FT_Long value; - - } Storage; - - - typedef struct Breakpoint_ - { - FT_Long IP; - FT_Int range; - - } Breakpoint; - - /* right now, we support a single breakpoint only */ - static Breakpoint breakpoint; - - -#undef PACK -#define PACK( x, y ) ( ( x << 4 ) | y ) - - static const FT_Byte Pop_Push_Count[256] = - { - /* Opcodes are gathered in groups of 16. */ - /* Please keep the spaces as they are. */ - - /* SVTCA y */ PACK( 0, 0 ), - /* SVTCA x */ PACK( 0, 0 ), - /* SPvTCA y */ PACK( 0, 0 ), - /* SPvTCA x */ PACK( 0, 0 ), - /* SFvTCA y */ PACK( 0, 0 ), - /* SFvTCA x */ PACK( 0, 0 ), - /* SPvTL // */ PACK( 2, 0 ), - /* SPvTL + */ PACK( 2, 0 ), - /* SFvTL // */ PACK( 2, 0 ), - /* SFvTL + */ PACK( 2, 0 ), - /* SPvFS */ PACK( 2, 0 ), - /* SFvFS */ PACK( 2, 0 ), - /* GPV */ PACK( 0, 2 ), - /* GFV */ PACK( 0, 2 ), - /* SFvTPv */ PACK( 0, 0 ), - /* ISECT */ PACK( 5, 0 ), - - /* SRP0 */ PACK( 1, 0 ), - /* SRP1 */ PACK( 1, 0 ), - /* SRP2 */ PACK( 1, 0 ), - /* SZP0 */ PACK( 1, 0 ), - /* SZP1 */ PACK( 1, 0 ), - /* SZP2 */ PACK( 1, 0 ), - /* SZPS */ PACK( 1, 0 ), - /* SLOOP */ PACK( 1, 0 ), - /* RTG */ PACK( 0, 0 ), - /* RTHG */ PACK( 0, 0 ), - /* SMD */ PACK( 1, 0 ), - /* ELSE */ PACK( 0, 0 ), - /* JMPR */ PACK( 1, 0 ), - /* SCvTCi */ PACK( 1, 0 ), - /* SSwCi */ PACK( 1, 0 ), - /* SSW */ PACK( 1, 0 ), - - /* DUP */ PACK( 1, 2 ), - /* POP */ PACK( 1, 0 ), - /* CLEAR */ PACK( 0, 0 ), - /* SWAP */ PACK( 2, 2 ), - /* DEPTH */ PACK( 0, 1 ), - /* CINDEX */ PACK( 1, 1 ), - /* MINDEX */ PACK( 1, 0 ), - /* AlignPTS */ PACK( 2, 0 ), - /* INS_$28 */ PACK( 0, 0 ), - /* UTP */ PACK( 1, 0 ), - /* LOOPCALL */ PACK( 2, 0 ), - /* CALL */ PACK( 1, 0 ), - /* FDEF */ PACK( 1, 0 ), - /* ENDF */ PACK( 0, 0 ), - /* MDAP[0] */ PACK( 1, 0 ), - /* MDAP[1] */ PACK( 1, 0 ), - - /* IUP[0] */ PACK( 0, 0 ), - /* IUP[1] */ PACK( 0, 0 ), - /* SHP[0] */ PACK( 0, 0 ), - /* SHP[1] */ PACK( 0, 0 ), - /* SHC[0] */ PACK( 1, 0 ), - /* SHC[1] */ PACK( 1, 0 ), - /* SHZ[0] */ PACK( 1, 0 ), - /* SHZ[1] */ PACK( 1, 0 ), - /* SHPIX */ PACK( 1, 0 ), - /* IP */ PACK( 0, 0 ), - /* MSIRP[0] */ PACK( 2, 0 ), - /* MSIRP[1] */ PACK( 2, 0 ), - /* AlignRP */ PACK( 0, 0 ), - /* RTDG */ PACK( 0, 0 ), - /* MIAP[0] */ PACK( 2, 0 ), - /* MIAP[1] */ PACK( 2, 0 ), - - /* NPushB */ PACK( 0, 0 ), - /* NPushW */ PACK( 0, 0 ), - /* WS */ PACK( 2, 0 ), - /* RS */ PACK( 1, 1 ), - /* WCvtP */ PACK( 2, 0 ), - /* RCvt */ PACK( 1, 1 ), - /* GC[0] */ PACK( 1, 1 ), - /* GC[1] */ PACK( 1, 1 ), - /* SCFS */ PACK( 2, 0 ), - /* MD[0] */ PACK( 2, 1 ), - /* MD[1] */ PACK( 2, 1 ), - /* MPPEM */ PACK( 0, 1 ), - /* MPS */ PACK( 0, 1 ), - /* FlipON */ PACK( 0, 0 ), - /* FlipOFF */ PACK( 0, 0 ), - /* DEBUG */ PACK( 1, 0 ), - - /* LT */ PACK( 2, 1 ), - /* LTEQ */ PACK( 2, 1 ), - /* GT */ PACK( 2, 1 ), - /* GTEQ */ PACK( 2, 1 ), - /* EQ */ PACK( 2, 1 ), - /* NEQ */ PACK( 2, 1 ), - /* ODD */ PACK( 1, 1 ), - /* EVEN */ PACK( 1, 1 ), - /* IF */ PACK( 1, 0 ), - /* EIF */ PACK( 0, 0 ), - /* AND */ PACK( 2, 1 ), - /* OR */ PACK( 2, 1 ), - /* NOT */ PACK( 1, 1 ), - /* DeltaP1 */ PACK( 1, 0 ), - /* SDB */ PACK( 1, 0 ), - /* SDS */ PACK( 1, 0 ), - - /* ADD */ PACK( 2, 1 ), - /* SUB */ PACK( 2, 1 ), - /* DIV */ PACK( 2, 1 ), - /* MUL */ PACK( 2, 1 ), - /* ABS */ PACK( 1, 1 ), - /* NEG */ PACK( 1, 1 ), - /* FLOOR */ PACK( 1, 1 ), - /* CEILING */ PACK( 1, 1 ), - /* ROUND[0] */ PACK( 1, 1 ), - /* ROUND[1] */ PACK( 1, 1 ), - /* ROUND[2] */ PACK( 1, 1 ), - /* ROUND[3] */ PACK( 1, 1 ), - /* NROUND[0] */ PACK( 1, 1 ), - /* NROUND[1] */ PACK( 1, 1 ), - /* NROUND[2] */ PACK( 1, 1 ), - /* NROUND[3] */ PACK( 1, 1 ), - - /* WCvtF */ PACK( 2, 0 ), - /* DeltaP2 */ PACK( 1, 0 ), - /* DeltaP3 */ PACK( 1, 0 ), - /* DeltaCn[0] */ PACK( 1, 0 ), - /* DeltaCn[1] */ PACK( 1, 0 ), - /* DeltaCn[2] */ PACK( 1, 0 ), - /* SROUND */ PACK( 1, 0 ), - /* S45Round */ PACK( 1, 0 ), - /* JROT */ PACK( 2, 0 ), - /* JROF */ PACK( 2, 0 ), - /* ROFF */ PACK( 0, 0 ), - /* INS_$7B */ PACK( 0, 0 ), - /* RUTG */ PACK( 0, 0 ), - /* RDTG */ PACK( 0, 0 ), - /* SANGW */ PACK( 1, 0 ), - /* AA */ PACK( 1, 0 ), - - /* FlipPT */ PACK( 0, 0 ), - /* FlipRgON */ PACK( 2, 0 ), - /* FlipRgOFF */ PACK( 2, 0 ), - /* INS_$83 */ PACK( 0, 0 ), - /* INS_$84 */ PACK( 0, 0 ), - /* ScanCTRL */ PACK( 1, 0 ), - /* SDVPTL[0] */ PACK( 2, 0 ), - /* SDVPTL[1] */ PACK( 2, 0 ), - /* GetINFO */ PACK( 1, 1 ), - /* IDEF */ PACK( 1, 0 ), - /* ROLL */ PACK( 3, 3 ), - /* MAX */ PACK( 2, 1 ), - /* MIN */ PACK( 2, 1 ), - /* ScanTYPE */ PACK( 1, 0 ), - /* InstCTRL */ PACK( 2, 0 ), - /* INS_$8F */ PACK( 0, 0 ), - - /* INS_$90 */ PACK( 0, 0 ), - /* INS_$91 */ PACK( 0, 0 ), - /* INS_$92 */ PACK( 0, 0 ), - /* INS_$93 */ PACK( 0, 0 ), - /* INS_$94 */ PACK( 0, 0 ), - /* INS_$95 */ PACK( 0, 0 ), - /* INS_$96 */ PACK( 0, 0 ), - /* INS_$97 */ PACK( 0, 0 ), - /* INS_$98 */ PACK( 0, 0 ), - /* INS_$99 */ PACK( 0, 0 ), - /* INS_$9A */ PACK( 0, 0 ), - /* INS_$9B */ PACK( 0, 0 ), - /* INS_$9C */ PACK( 0, 0 ), - /* INS_$9D */ PACK( 0, 0 ), - /* INS_$9E */ PACK( 0, 0 ), - /* INS_$9F */ PACK( 0, 0 ), - - /* INS_$A0 */ PACK( 0, 0 ), - /* INS_$A1 */ PACK( 0, 0 ), - /* INS_$A2 */ PACK( 0, 0 ), - /* INS_$A3 */ PACK( 0, 0 ), - /* INS_$A4 */ PACK( 0, 0 ), - /* INS_$A5 */ PACK( 0, 0 ), - /* INS_$A6 */ PACK( 0, 0 ), - /* INS_$A7 */ PACK( 0, 0 ), - /* INS_$A8 */ PACK( 0, 0 ), - /* INS_$A9 */ PACK( 0, 0 ), - /* INS_$AA */ PACK( 0, 0 ), - /* INS_$AB */ PACK( 0, 0 ), - /* INS_$AC */ PACK( 0, 0 ), - /* INS_$AD */ PACK( 0, 0 ), - /* INS_$AE */ PACK( 0, 0 ), - /* INS_$AF */ PACK( 0, 0 ), - - /* PushB[0] */ PACK( 0, 1 ), - /* PushB[1] */ PACK( 0, 2 ), - /* PushB[2] */ PACK( 0, 3 ), - /* PushB[3] */ PACK( 0, 4 ), - /* PushB[4] */ PACK( 0, 5 ), - /* PushB[5] */ PACK( 0, 6 ), - /* PushB[6] */ PACK( 0, 7 ), - /* PushB[7] */ PACK( 0, 8 ), - /* PushW[0] */ PACK( 0, 1 ), - /* PushW[1] */ PACK( 0, 2 ), - /* PushW[2] */ PACK( 0, 3 ), - /* PushW[3] */ PACK( 0, 4 ), - /* PushW[4] */ PACK( 0, 5 ), - /* PushW[5] */ PACK( 0, 6 ), - /* PushW[6] */ PACK( 0, 7 ), - /* PushW[7] */ PACK( 0, 8 ), - - /* MDRP[00] */ PACK( 1, 0 ), - /* MDRP[01] */ PACK( 1, 0 ), - /* MDRP[02] */ PACK( 1, 0 ), - /* MDRP[03] */ PACK( 1, 0 ), - /* MDRP[04] */ PACK( 1, 0 ), - /* MDRP[05] */ PACK( 1, 0 ), - /* MDRP[06] */ PACK( 1, 0 ), - /* MDRP[07] */ PACK( 1, 0 ), - /* MDRP[08] */ PACK( 1, 0 ), - /* MDRP[09] */ PACK( 1, 0 ), - /* MDRP[10] */ PACK( 1, 0 ), - /* MDRP[11] */ PACK( 1, 0 ), - /* MDRP[12] */ PACK( 1, 0 ), - /* MDRP[13] */ PACK( 1, 0 ), - /* MDRP[14] */ PACK( 1, 0 ), - /* MDRP[15] */ PACK( 1, 0 ), - - /* MDRP[16] */ PACK( 1, 0 ), - /* MDRP[17] */ PACK( 1, 0 ), - /* MDRP[18] */ PACK( 1, 0 ), - /* MDRP[19] */ PACK( 1, 0 ), - /* MDRP[20] */ PACK( 1, 0 ), - /* MDRP[21] */ PACK( 1, 0 ), - /* MDRP[22] */ PACK( 1, 0 ), - /* MDRP[23] */ PACK( 1, 0 ), - /* MDRP[24] */ PACK( 1, 0 ), - /* MDRP[25] */ PACK( 1, 0 ), - /* MDRP[26] */ PACK( 1, 0 ), - /* MDRP[27] */ PACK( 1, 0 ), - /* MDRP[28] */ PACK( 1, 0 ), - /* MDRP[29] */ PACK( 1, 0 ), - /* MDRP[30] */ PACK( 1, 0 ), - /* MDRP[31] */ PACK( 1, 0 ), - - /* MIRP[00] */ PACK( 2, 0 ), - /* MIRP[01] */ PACK( 2, 0 ), - /* MIRP[02] */ PACK( 2, 0 ), - /* MIRP[03] */ PACK( 2, 0 ), - /* MIRP[04] */ PACK( 2, 0 ), - /* MIRP[05] */ PACK( 2, 0 ), - /* MIRP[06] */ PACK( 2, 0 ), - /* MIRP[07] */ PACK( 2, 0 ), - /* MIRP[08] */ PACK( 2, 0 ), - /* MIRP[09] */ PACK( 2, 0 ), - /* MIRP[10] */ PACK( 2, 0 ), - /* MIRP[11] */ PACK( 2, 0 ), - /* MIRP[12] */ PACK( 2, 0 ), - /* MIRP[13] */ PACK( 2, 0 ), - /* MIRP[14] */ PACK( 2, 0 ), - /* MIRP[15] */ PACK( 2, 0 ), - - /* MIRP[16] */ PACK( 2, 0 ), - /* MIRP[17] */ PACK( 2, 0 ), - /* MIRP[18] */ PACK( 2, 0 ), - /* MIRP[19] */ PACK( 2, 0 ), - /* MIRP[20] */ PACK( 2, 0 ), - /* MIRP[21] */ PACK( 2, 0 ), - /* MIRP[22] */ PACK( 2, 0 ), - /* MIRP[23] */ PACK( 2, 0 ), - /* MIRP[24] */ PACK( 2, 0 ), - /* MIRP[25] */ PACK( 2, 0 ), - /* MIRP[26] */ PACK( 2, 0 ), - /* MIRP[27] */ PACK( 2, 0 ), - /* MIRP[28] */ PACK( 2, 0 ), - /* MIRP[29] */ PACK( 2, 0 ), - /* MIRP[30] */ PACK( 2, 0 ), - /* MIRP[31] */ PACK( 2, 0 ) - }; - - - static const FT_String* OpStr[256] = - { - "SVTCA y", /* set vectors to coordinate axis y */ - "SVTCA x", /* set vectors to coordinate axis x */ - "SPVTCA y", /* set proj. vec. to coord. axis y */ - "SPVTCA x", /* set proj. vec. to coord. axis x */ - "SFVTCA y", /* set free. vec. to coord. axis y */ - "SFVTCA x", /* set free. vec. to coord. axis x */ - "SPVTL ||", /* set proj. vec. parallel to segment */ - "SPVTL +", /* set proj. vec. normal to segment */ - "SFVTL ||", /* set free. vec. parallel to segment */ - "SFVTL +", /* set free. vec. normal to segment */ - "SPVFS", /* set proj. vec. from stack */ - "SFVFS", /* set free. vec. from stack */ - "GPV", /* get projection vector */ - "GFV", /* get freedom vector */ - "SFVTPV", /* set free. vec. to proj. vec. */ - "ISECT", /* compute intersection */ - - "SRP0", /* set reference point 0 */ - "SRP1", /* set reference point 1 */ - "SRP2", /* set reference point 2 */ - "SZP0", /* set zone pointer 0 */ - "SZP1", /* set zone pointer 1 */ - "SZP2", /* set zone pointer 2 */ - "SZPS", /* set all zone pointers */ - "SLOOP", /* set loop counter */ - "RTG", /* round to grid */ - "RTHG", /* round to half-grid */ - "SMD", /* set minimum distance */ - "ELSE", /* else */ - "JMPR", /* jump relative */ - "SCVTCI", /* set CVT cut-in */ - "SSWCI", /* set single width cut-in */ - "SSW", /* set single width */ - - "DUP", /* */ - "POP", /* */ - "CLEAR", /* */ - "SWAP", /* */ - "DEPTH", /* */ - "CINDEX", /* */ - "MINDEX", /* */ - "AlignPTS", /* */ - "INS_$28", - "UTP", /* */ - "LOOPCALL", /* */ - "CALL", /* */ - "FDEF", /* */ - "ENDF", /* */ - "MDAP[0]", /* */ - "MDAP[1]", /* */ - - "IUP[0]", /* */ - "IUP[1]", /* */ - "SHP[0]", /* */ - "SHP[1]", /* */ - "SHC[0]", /* */ - "SHC[1]", /* */ - "SHZ[0]", /* */ - "SHZ[1]", /* */ - "SHPIX", /* */ - "IP", /* */ - "MSIRP[0]", /* */ - "MSIRP[1]", /* */ - "AlignRP", /* */ - "RTDG", /* */ - "MIAP[0]", /* */ - "MIAP[1]", /* */ - - "NPushB", /* */ - "NPushW", /* */ - "WS", /* */ - "RS", /* */ - "WCvtP", /* */ - "RCvt", /* */ - "GC[0]", /* */ - "GC[1]", /* */ - "SCFS", /* */ - "MD[0]", /* */ - "MD[1]", /* */ - "MPPEM", /* */ - "MPS", /* */ - "FlipON", /* */ - "FlipOFF", /* */ - "DEBUG", /* */ - - "LT", /* */ - "LTEQ", /* */ - "GT", /* */ - "GTEQ", /* */ - "EQ", /* */ - "NEQ", /* */ - "ODD", /* */ - "EVEN", /* */ - "IF", /* */ - "EIF", /* */ - "AND", /* */ - "OR", /* */ - "NOT", /* */ - "DeltaP1", /* */ - "SDB", /* */ - "SDS", /* */ - - "ADD", /* */ - "SUB", /* */ - "DIV", /* */ - "MUL", /* */ - "ABS", /* */ - "NEG", /* */ - "FLOOR", /* */ - "CEILING", /* */ - "ROUND[0]", /* */ - "ROUND[1]", /* */ - "ROUND[2]", /* */ - "ROUND[3]", /* */ - "NROUND[0]", /* */ - "NROUND[1]", /* */ - "NROUND[2]", /* */ - "NROUND[3]", /* */ - - "WCvtF", /* */ - "DeltaP2", /* */ - "DeltaP3", /* */ - "DeltaC1", /* */ - "DeltaC2", /* */ - "DeltaC3", /* */ - "SROUND", /* */ - "S45Round", /* */ - "JROT", /* */ - "JROF", /* */ - "ROFF", /* */ - "INS_$7B", - "RUTG", /* */ - "RDTG", /* */ - "SANGW", /* */ - "AA", /* */ - - "FlipPT", /* */ - "FlipRgON", /* */ - "FlipRgOFF", /* */ - "INS_$83", - "INS_$84", - "ScanCTRL", /* */ - "SDPVTL[0]", /* */ - "SDPVTL[1]", /* */ - "GetINFO", /* */ - "IDEF", /* */ - "ROLL", /* */ - "MAX", /* */ - "MIN", /* */ - "ScanTYPE", /* */ - "InstCTRL", /* */ - "INS_$8F", - - "INS_$90", - "INS_$91", - "INS_$92", - "INS_$93", - "INS_$94", - "INS_$95", - "INS_$96", - "INS_$97", - "INS_$98", - "INS_$99", - "INS_$9A", - "INS_$9B", - "INS_$9C", - "INS_$9D", - "INS_$9E", - "INS_$9F", - - "INS_$A0", - "INS_$A1", - "INS_$A2", - "INS_$A3", - "INS_$A4", - "INS_$A5", - "INS_$A6", - "INS_$A7", - "INS_$A8", - "INS_$A9", - "INS_$AA", - "INS_$AB", - "INS_$AC", - "INS_$AD", - "INS_$AE", - "INS_$AF", - - "PushB[0]", /* */ - "PushB[1]", /* */ - "PushB[2]", /* */ - "PushB[3]", /* */ - "PushB[4]", /* */ - "PushB[5]", /* */ - "PushB[6]", /* */ - "PushB[7]", /* */ - "PushW[0]", /* */ - "PushW[1]", /* */ - "PushW[2]", /* */ - "PushW[3]", /* */ - "PushW[4]", /* */ - "PushW[5]", /* */ - "PushW[6]", /* */ - "PushW[7]", /* */ - - "MDRP[G]", /* */ - "MDRP[B]", /* */ - "MDRP[W]", /* */ - "MDRP[?]", /* */ - "MDRP[rG]", /* */ - "MDRP[rB]", /* */ - "MDRP[rW]", /* */ - "MDRP[r?]", /* */ - "MDRP[mG]", /* */ - "MDRP[mB]", /* */ - "MDRP[mW]", /* */ - "MDRP[m?]", /* */ - "MDRP[mrG]", /* */ - "MDRP[mrB]", /* */ - "MDRP[mrW]", /* */ - "MDRP[mr?]", /* */ - "MDRP[pG]", /* */ - "MDRP[pB]", /* */ - - "MDRP[pW]", /* */ - "MDRP[p?]", /* */ - "MDRP[prG]", /* */ - "MDRP[prB]", /* */ - "MDRP[prW]", /* */ - "MDRP[pr?]", /* */ - "MDRP[pmG]", /* */ - "MDRP[pmB]", /* */ - "MDRP[pmW]", /* */ - "MDRP[pm?]", /* */ - "MDRP[pmrG]", /* */ - "MDRP[pmrB]", /* */ - "MDRP[pmrW]", /* */ - "MDRP[pmr?]", /* */ - - "MIRP[G]", /* */ - "MIRP[B]", /* */ - "MIRP[W]", /* */ - "MIRP[?]", /* */ - "MIRP[rG]", /* */ - "MIRP[rB]", /* */ - "MIRP[rW]", /* */ - "MIRP[r?]", /* */ - "MIRP[mG]", /* */ - "MIRP[mB]", /* */ - "MIRP[mW]", /* */ - "MIRP[m?]", /* */ - "MIRP[mrG]", /* */ - "MIRP[mrB]", /* */ - "MIRP[mrW]", /* */ - "MIRP[mr?]", /* */ - "MIRP[pG]", /* */ - "MIRP[pB]", /* */ - - "MIRP[pW]", /* */ - "MIRP[p?]", /* */ - "MIRP[prG]", /* */ - "MIRP[prB]", /* */ - "MIRP[prW]", /* */ - "MIRP[pr?]", /* */ - "MIRP[pmG]", /* */ - "MIRP[pmB]", /* */ - "MIRP[pmW]", /* */ - "MIRP[pm?]", /* */ - "MIRP[pmrG]", /* */ - "MIRP[pmrB]", /* */ - "MIRP[pmrW]", /* */ - "MIRP[pmr?]" /* */ - }; - - - /********************************************************************* - * - * Init_Keyboard: Set the input file descriptor to char-by-char - * mode on Unix. - * - *********************************************************************/ - -#ifdef UNIX - - static struct termios old_termio; - - - static void - Init_Keyboard( void ) - { - struct termios termio; - - -#ifndef HAVE_TCGETATTR - ioctl( 0, TCGETS, &old_termio ); -#else - tcgetattr( 0, &old_termio ); -#endif - - termio = old_termio; - -#if 0 - termio.c_lflag &= (tcflag_t)~( ICANON + ECHO + ECHOE + ECHOK + ECHONL + ECHOKE ); -#else - termio.c_lflag &= (tcflag_t)~( ICANON + ECHO + ECHOE + ECHOK + ECHONL ); -#endif - -#ifndef HAVE_TCSETATTR - ioctl( 0, TCSETS, &termio ); -#else - tcsetattr( 0, TCSANOW, &termio ); -#endif - } - - - static void - Reset_Keyboard( void ) - { -#ifndef HAVE_TCSETATTR - ioctl( 0, TCSETS, &old_termio ); -#else - tcsetattr( 0, TCSANOW, &old_termio ); -#endif - } - -#else /* !UNIX */ - - static void - Init_Keyboard( void ) - { - } - - static void - Reset_Keyboard( void ) - { - } - -#endif /* !UNIX */ - - - static void - Abort( const char* message ) - { - fprintf( stderr, "%s\n error code = 0x%04x.\n", message, error ); - Reset_Keyboard(); - exit( 1 ); - } - - - /****************************************************************** - * - * Function: Calc_Length - * - * Description: Compute the length in bytes of current opcode. - * - *****************************************************************/ - -#define CUR (*exc) - - - static void - Calc_Length( TT_ExecContext exc ) - { - CUR.opcode = CUR.code[CUR.IP]; - - switch ( CUR.opcode ) - { - case 0x40: - if ( CUR.IP + 1 >= CUR.codeSize ) - Abort( "code range overflow!" ); - - CUR.length = CUR.code[CUR.IP + 1] + 2; - break; - - case 0x41: - if ( CUR.IP + 1 >= CUR.codeSize ) - Abort( "code range overflow!" ); - - CUR.length = CUR.code[CUR.IP + 1] * 2 + 2; - break; - - case 0xB0: - case 0xB1: - case 0xB2: - case 0xB3: - case 0xB4: - case 0xB5: - case 0xB6: - case 0xB7: - CUR.length = CUR.opcode - 0xB0 + 2; - break; - - case 0xB8: - case 0xB9: - case 0xBA: - case 0xBB: - case 0xBC: - case 0xBD: - case 0xBE: - case 0xBF: - CUR.length = ( CUR.opcode - 0xB8 ) * 2 + 3; - break; - - default: - CUR.length = 1; - break; - } - - /* make sure result is in range */ - - if ( CUR.IP + CUR.length > CUR.codeSize ) - Abort( "code range overflow!" ); - } - - - /* Disassemble the current line. */ - /* */ - static const FT_String* - Cur_U_Line( TT_ExecContext exc ) - { - FT_String s[32]; - FT_Int op, i, n; - - - op = CUR.code[CUR.IP]; - - sprintf( tempStr, "%s", OpStr[op] ); - - if ( op == 0x40 ) - { - n = CUR.code[CUR.IP + 1]; - sprintf( s, "(%d)", n ); - strncat( tempStr, s, 8 ); - - /* limit output */ - if ( n > 20 ) - n = 20; - - for ( i = 0; i < n; i++ ) - { - sprintf( s, " $%02x", (unsigned)CUR.code[CUR.IP + i + 2] ); - strncat( tempStr, s, 8 ); - } - } - else if ( op == 0x41 ) - { - n = CUR.code[CUR.IP + 1]; - sprintf( s, "(%d)", n ); - strncat( tempStr, s, 8 ); - - /* limit output */ - if ( n > 20 ) - n = 20; - - for ( i = 0; i < n; i++ ) - { - sprintf( s, " $%02x%02x", - (unsigned)CUR.code[CUR.IP + i * 2 + 2], - (unsigned)CUR.code[CUR.IP + i * 2 + 3] ); - strncat( tempStr, s, 8 ); - } - } - else if ( ( op & 0xF8 ) == 0xB0 ) - { - n = op - 0xB0; - - for ( i = 0; i <= n; i++ ) - { - sprintf( s, " $%02x", (unsigned)CUR.code[CUR.IP + i + 1] ); - strncat( tempStr, s, 8 ); - } - } - else if ( ( op & 0xF8 ) == 0xB8 ) - { - n = op - 0xB8; - - for ( i = 0; i <= n; i++ ) - { - sprintf( s, " $%02x%02x", - (unsigned)CUR.code[CUR.IP + i * 2 + 1], - (unsigned)CUR.code[CUR.IP + i * 2 + 2] ); - strncat( tempStr, s, 8 ); - } - } - else if ( op == 0x39 ) /* IP */ - { - sprintf( s, " rp1=%d, rp2=%d", CUR.GS.rp1, CUR.GS.rp2 ); - strncat( tempStr, s, 31 ); - } - - return (FT_String*)tempStr; - } - - - /* we have to track the `WS' opcode specially so that we are able */ - /* to properly handle uninitialized storage area values */ - static void - handle_WS( TT_ExecContext exc, - Storage* storage ) - { - if ( CUR.opcode == 0x42 && CUR.top >= 2 ) - { - FT_ULong idx = (FT_ULong)CUR.stack[CUR.top - 2]; - FT_Long value = (FT_Long) CUR.stack[CUR.top - 1]; - - - if ( idx < CUR.storeSize ) - { - storage[idx].initialized = 1; - storage[idx].value = value; - } - } - } - - - static void - display_changed_points( TT_GlyphZoneRec* prev, - TT_GlyphZoneRec* curr, - FT_Bool is_twilight ) - { - FT_Int A; - - - for ( A = 0; A < curr->n_points; A++ ) - { - FT_Int diff = 0; - - - if ( prev->org[A].x != curr->org[A].x ) - diff |= 1; - if ( prev->org[A].y != curr->org[A].y ) - diff |= 2; - if ( prev->cur[A].x != curr->cur[A].x ) - diff |= 4; - if ( prev->cur[A].y != curr->cur[A].y ) - diff |= 8; - if ( prev->tags[A] != curr->tags[A] ) - diff |= 16; - - if ( diff ) - { - const FT_String* temp; - - - printf( "%3d%s ", A, is_twilight ? "T" : " " ); - printf( "%6ld,%6ld ", curr->orus[A].x, curr->orus[A].y ); - - if ( diff & 16 ) - temp = "(%c%c%c)"; - else - temp = " %c%c%c "; - printf( temp, - prev->tags[A] & FT_CURVE_TAG_ON ? 'P' : 'C', - prev->tags[A] & FT_CURVE_TAG_TOUCH_X ? 'X' : ' ', - prev->tags[A] & FT_CURVE_TAG_TOUCH_Y ? 'Y' : ' ' ); - - if ( diff & 1 ) - temp = use_float ? "(%8.2f)" : "(%8ld)"; - else - temp = use_float ? " %8.2f " : " %8ld "; - if ( use_float ) - printf( temp, prev->org[A].x / 64.0 ); - else - printf( temp, prev->org[A].x ); - - if ( diff & 2 ) - temp = use_float ? "(%8.2f)" : "(%8ld)"; - else - temp = use_float ? " %8.2f " : " %8ld "; - if ( use_float ) - printf( temp, prev->org[A].y / 64.0 ); - else - printf( temp, prev->org[A].y ); - - if ( diff & 4 ) - temp = use_float ? "(%8.2f)" : "(%8ld)"; - else - temp = use_float ? " %8.2f " : " %8ld "; - if ( use_float ) - printf( temp, prev->cur[A].x / 64.0 ); - else - printf( temp, prev->cur[A].x ); - - if ( diff & 8 ) - temp = use_float ? "(%8.2f)" : "(%8ld)"; - else - temp = use_float ? " %8.2f " : " %8ld "; - if ( use_float ) - printf( temp, prev->cur[A].y / 64.0 ); - else - printf( temp, prev->cur[A].y ); - - printf( "\n" ); - - printf( " " ); - - if ( diff & 16 ) - temp = "(%c%c%c)"; - else - temp = " "; - printf( temp, - curr->tags[A] & FT_CURVE_TAG_ON ? 'P' : 'C', - curr->tags[A] & FT_CURVE_TAG_TOUCH_X ? 'X' : ' ', - curr->tags[A] & FT_CURVE_TAG_TOUCH_Y ? 'Y' : ' ' ); - - if ( diff & 1 ) - temp = use_float ? "[%8.2f]" : "[%8ld]"; - else - temp = " "; - if ( use_float ) - printf( temp, curr->org[A].x / 64.0 ); - else - printf( temp, curr->org[A].x ); - - if ( diff & 2 ) - temp = use_float ? "[%8.2f]" : "[%8ld]"; - else - temp = " "; - if ( use_float ) - printf( temp, curr->org[A].y / 64.0 ); - else - printf( temp, curr->org[A].y ); - - if ( diff & 4 ) - temp = use_float ? "[%8.2f]" : "[%8ld]"; - else - temp = " "; - if ( use_float ) - printf( temp, curr->cur[A].x / 64.0 ); - else - printf( temp, curr->cur[A].x ); - - if ( diff & 8 ) - temp = use_float ? "[%8.2f]" : "[%8ld]"; - else - temp = " "; - if ( use_float ) - printf( temp, curr->cur[A].y / 64.0 ); - else - printf( temp, curr->cur[A].y ); - - printf( "\n" ); - } - } - } - - - static void - show_points_table( TT_GlyphZoneRec* zone, - const FT_String* code_range, - int n_points, - FT_Bool is_twilight ) - { - int A; - - - if ( code_range[0] == 'g' ) - { - printf( "%s points\n" - "\n", - is_twilight ? "twilight" : "glyph" ); - printf( " idx " - "orig. unscaled " - " orig. scaled " - " current scaled " - "tags\n" ); - printf( "-----" - "----------------" - "--------------------" - "--------------------" - "----\n" ); - } - else - printf( "Not yet in `glyf' program.\n" ); - - for ( A = 0; A < n_points; A++ ) - { - printf( "%3d%s ", - A, - is_twilight - ? "T" - : ( A >= n_points - 4 ) - ? "F" - : " " ); - printf( "(%5ld,%5ld) - ", - zone->orus[A].x, zone->orus[A].y ); - if ( use_float ) - { - printf( "(%7.2f,%7.2f) - ", - zone->org[A].x / 64.0, zone->org[A].y / 64.0 ); - printf( "(%7.2f,%7.2f) - ", - zone->cur[A].x / 64.0, zone->cur[A].y / 64.0 ); - } - else - { - printf( "(%7ld,%7ld) - ", - zone->org[A].x, zone->org[A].y ); - printf( "(%7ld,%7ld) - ", - zone->cur[A].x, zone->cur[A].y ); - } - printf( "%c%c%c\n", - zone->tags[A] & FT_CURVE_TAG_ON ? 'P' : 'C', - zone->tags[A] & FT_CURVE_TAG_TOUCH_X ? 'X' : ' ', - zone->tags[A] & FT_CURVE_TAG_TOUCH_Y ? 'Y' : ' ' ); - } - printf( "\n" ); - } - - - static FT_Error - RunIns( TT_ExecContext exc ) - { - FT_Int key; - - FT_Bool really_leave; - - FT_String ch, oldch = '\0'; - - FT_Long last_IP = 0; - FT_Int last_range = 0; - - TT_GlyphZoneRec pts; - TT_GlyphZoneRec twilight; - TT_GlyphZoneRec save_pts; - TT_GlyphZoneRec save_twilight; - - FT_Long* save_cvt; - - Storage* storage; - Storage* save_storage; - - const FT_String* code_range; - - const FT_String* round_str[8] = - { - "to half-grid", - "to grid", - "to double grid", - "down to grid", - "up to grid", - "off", - "super", - "super 45" - }; - - - error = FT_Err_Ok; - - pts = CUR.pts; - twilight = CUR.twilight; - - save_pts.n_points = pts.n_points; - save_pts.n_contours = pts.n_contours; - - save_pts.org = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * - save_pts.n_points ); - save_pts.cur = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * - save_pts.n_points ); - save_pts.tags = (FT_Byte*)malloc( save_pts.n_points ); - - save_twilight.n_points = twilight.n_points; - save_twilight.n_contours = twilight.n_contours; - - save_twilight.org = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * - save_twilight.n_points ); - save_twilight.cur = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * - save_twilight.n_points ); - save_twilight.tags = (FT_Byte*)malloc( save_twilight.n_points ); - - save_cvt = (FT_Long*)malloc( sizeof ( FT_Long ) * CUR.cvtSize ); - - /* set everything to zero in Storage Area */ - storage = (Storage*)calloc( CUR.storeSize, sizeof ( Storage ) ); - save_storage = (Storage*)calloc( CUR.storeSize, sizeof ( Storage ) ); - - CUR.instruction_trap = 1; - - switch ( CUR.curRange ) - { - case tt_coderange_glyph: - code_range = "glyf"; - break; - - case tt_coderange_cvt: - code_range = "prep"; - break; - - default: - code_range = "fpgm"; - } - - printf( "Entering `%s' table.\n" - "\n", code_range ); - - really_leave = 0; - - do - { - if ( CUR.IP < CUR.codeSize ) - { - Calc_Length( exc ); - - CUR.args = CUR.top - ( Pop_Push_Count[CUR.opcode] >> 4 ); - - /* `args' is the top of the stack once arguments have been popped. */ - /* One can also interpret it as the index of the last argument. */ - - /* Print the current line. We use an 80-columns console with the */ - /* following formatting: */ - /* */ - /* [loc]:[addr] [opcode] [disassembly] [a][b]|[c][d] */ - - { - char temp[90]; - int n, col, pop; - int args = CUR.args; - - - sprintf( temp, "%78c\n", ' ' ); - - /* first letter of location */ - switch ( CUR.curRange ) - { - case tt_coderange_glyph: - temp[0] = 'g'; - break; - - case tt_coderange_cvt: - temp[0] = 'c'; - break; - - default: - temp[0] = 'f'; - } - - /* current IP */ - sprintf( temp + 1, "%04lx: %02x %-36.36s", - CUR.IP, - CUR.opcode, - Cur_U_Line( &CUR ) ); - - strncpy( temp + 46, " (", 2 ); - - args = CUR.top - 1; - pop = Pop_Push_Count[CUR.opcode] >> 4; - col = 48; - - /* special case for IP */ - if ( CUR.opcode == 0x39 ) - pop = CUR.GS.loop; - - for ( n = 6; n > 0; n-- ) - { - int num_chars; - - - if ( pop == 0 ) - temp[col - 1] = temp[col - 1] == '(' ? ' ' : ')'; - - if ( args < CUR.top && args >= 0 ) - { - /* we display signed hexadecimal numbers, which */ - /* is easier to read and needs less space */ - long val = (signed long)CUR.stack[args]; - - - num_chars = sprintf( temp + col, "%s%04lx", - val < 0 ? "-" : "", - val < 0 ? -val : val ); - if ( col + num_chars >= 78 ) - break; - } - else - num_chars = 0; - - temp[col + num_chars] = ' '; - col += num_chars + 1; - - pop--; - args--; - } - - for ( n = col; n < 78; n++ ) - temp[n] = ' '; - - temp[78] = '\n'; - temp[79] = '\0'; - printf( "%s", temp ); - } - - /* First, check for empty stack and overflow */ - if ( CUR.args < 0 ) - { - printf( "ERROR: Too Few Arguments.\n" ); - error = TT_Err_Too_Few_Arguments; - goto LErrorLabel_; - } - - CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 ); - - /* `new_top' is the new top of the stack, after the instruction's */ - /* execution. `top' will be set to `new_top' after the 'case'. */ - - if ( CUR.new_top > CUR.stackSize ) - { - printf( "ERROR: Stack overflow.\n" ); - error = TT_Err_Stack_Overflow; - goto LErrorLabel_; - } - } - else - { - if ( CUR.curRange == tt_coderange_glyph ) - { - if ( !really_leave ) - { - printf( "End of `glyf' program reached.\n" ); - really_leave = 1; - } - else - { - really_leave = 0; - goto LErrorLabel_; - } - } - else - { - printf( "\n" ); - goto LErrorLabel_; - } - } - - if ( breakpoint.IP == CUR.IP && - breakpoint.range == CUR.curRange ) - printf( "Hit breakpoint.\n" ); - - key = 0; - do - { - /* read keyboard */ - ch = (FT_String)getch(); - - switch ( ch ) - { - /* Help - show keybindings */ - case '?': - case 'h': - printf( - "ttdebug Help\n" - "\n" - "Q quit debugger V show vector info\n" - "R restart debugger G show graphics state\n" - "c continue to next code range P show points zone\n" - "n skip to next instruction T show twilight zone\n" - "s step into S show storage area\n" - "f finish current function C show CVT data\n" - "l show last bytecode instruction F toggle floating/fixed\n" - "b toggle breakpoint at curr. pos. point format\n" - "p toggle breakpoint at prev. pos. B show backtrace\n" - "\n" - "\n" - " Format of point changes:\n" - "\n" - " idx orus.x orus.y tags org.x org.y cur.x cur.y\n" - "\n" - " The first line gives the values before the instruction,\n" - " the second line the changes after the instruction,\n" - " indicated by parentheses and brackets for emphasis.\n" - "\n" - " A `T', `F', `S', or `C' appended to the index indicates\n" - " a twilight point, a phantom point, a storage location,\n" - " or data from the Control Value Table (CVT), respectively.\n" - "\n" - " Possible tag values are `P' (on curve), `C' (control point),\n" - " `X' (touched horizontally), and `Y' (touched vertically).\n" - "\n" ); - break; - - /* Toggle between floating and fixed point format */ - case 'F': - use_float = !use_float; - printf( "Use %s point format for displaying values.\n", - use_float ? "floating" : "fixed" ); - printf( "\n" ); - break; - - /* Show vectors */ - case 'V': - if ( use_float ) - { - /* 2.14 numbers */ - printf( "freedom (%.5f, %.5f)\n", - CUR.GS.freeVector.x / 16384.0, - CUR.GS.freeVector.y / 16384.0 ); - printf( "projection (%.5f, %.5f)\n", - CUR.GS.projVector.x / 16384.0, - CUR.GS.projVector.y / 16384.0 ); - printf( "dual (%.5f, %.5f)\n", - CUR.GS.dualVector.x / 16384.0, - CUR.GS.dualVector.y / 16384.0 ); - printf( "\n" ); - } - else - { - printf( "freedom ($%04hx, $%04hx)\n", - CUR.GS.freeVector.x, - CUR.GS.freeVector.y ); - printf( "projection ($%04hx, $%04hx)\n", - CUR.GS.projVector.x, - CUR.GS.projVector.y ); - printf( "dual ($%04hx, $%04hx)\n", - CUR.GS.dualVector.x, - CUR.GS.dualVector.y ); - printf( "\n" ); - } - break; - - /* Show graphics state */ - case 'G': - { - int version; - - - /* this doesn't really belong to the graphics state, */ - /* but I consider it a good place to show */ - FT_Property_Get( library, - "truetype", - "interpreter-version", &version ); - printf( "hinting engine version: %d\n" - "\n", - version ); - } - - printf( "rounding state %s\n", - round_str[CUR.GS.round_state] ); - if ( use_float ) - { - /* 26.6 numbers */ - printf( "minimum distance %.2f\n", - CUR.GS.minimum_distance / 64.0 ); - printf( "CVT cut-in %.2f\n", - CUR.GS.control_value_cutin / 64.0 ); - } - else - { - printf( "minimum distance $%04lx\n", - CUR.GS.minimum_distance ); - printf( "CVT cut-in $%04lx\n", - CUR.GS.control_value_cutin ); - } - printf( "ref. points 0,1,2 %d, %d, %d\n", - CUR.GS.rp0, CUR.GS.rp1, CUR.GS.rp2 ); - printf( "\n" ); - break; - - /* Show CVT */ - case 'C': - { - if ( code_range[0] == 'f' ) - printf( "Not yet in `prep' or `glyf' program.\n" ); - else - { - FT_ULong i; - - - printf( "Control Value Table (CVT) data\n" - "\n" ); - printf( " idx value \n" - "-------------------------\n" ); - - for ( i = 0; i < CUR.cvtSize; i++ ) - printf( "%3ldC %8ld (%8.2f)\n", - i, CUR.cvt[i], CUR.cvt[i] / 64.0 ); - printf( "\n" ); - } - } - break; - - /* Show Storage Area */ - case 'S': - { - if ( code_range[0] == 'f' ) - printf( "Not yet in `prep' or `glyf' program.\n" ); - else - { - FT_ULong i; - - - printf( "Storage Area\n" - "\n" ); - printf( " idx value \n" - "-------------------------\n" ); - - for ( i = 0; i < CUR.storeSize; i++ ) - { - if ( storage[i].initialized ) - printf( "%3ldS %8ld (%8.2f)\n", - i, - storage[i].value, - storage[i].value / 64.0 ); - else - printf( "%3ldS \n", - i ); - } - printf( "\n" ); - } - } - break; - - /* Show glyph points table */ - case 'P': - show_points_table( &pts, code_range, pts.n_points, 0 ); - break; - - /* Show twilight points table */ - case 'T': - show_points_table( &twilight, code_range, twilight.n_points, 1 ); - break; - - /* Show backtrace */ - case 'B': - if ( CUR.callTop <= 0 ) - printf( "At top level.\n" ); - else - { - FT_Int i; - - - printf( "Function call backtrace\n" - "\n" ); - printf( " idx loopcount start end caller\n" - "----------------------------------------\n" ); - - for ( i = CUR.callTop; i > 0; i-- ) - { - TT_CallRec *rec = &CUR.callStack[i - 1]; - - - printf( " %3d %4ld f%04lx f%04lx %c%04lx\n", - rec->Def->opc, - rec->Cur_Count, - rec->Def->start, - rec->Def->end, - rec->Caller_Range == tt_coderange_font - ? 'f' - : ( rec->Caller_Range == tt_coderange_cvt - ? 'c' - : 'g' ), - rec->Caller_IP - 1 ); - } - printf( "\n" ); - } - break; - - default: - key = 1; - } - } while ( !key ); - - FT_MEM_COPY( save_pts.org, - pts.org, - pts.n_points * sizeof ( FT_Vector ) ); - FT_MEM_COPY( save_pts.cur, - pts.cur, - pts.n_points * sizeof ( FT_Vector ) ); - FT_MEM_COPY( save_pts.tags, - pts.tags, - pts.n_points ); - - FT_MEM_COPY( save_twilight.org, - twilight.org, - twilight.n_points * sizeof ( FT_Vector ) ); - FT_MEM_COPY( save_twilight.cur, - twilight.cur, - twilight.n_points * sizeof ( FT_Vector ) ); - FT_MEM_COPY( save_twilight.tags, - twilight.tags, - twilight.n_points ); - - FT_MEM_COPY( save_cvt, - CUR.cvt, - CUR.cvtSize * sizeof ( FT_Long ) ); - - FT_MEM_COPY( save_storage, - storage, - CUR.storeSize * sizeof ( Storage ) ); - - /* a return indicates the last command */ - if ( ch == '\r' || ch == '\n' ) - ch = oldch; - - switch ( ch ) - { - /* quit debugger */ - case 'Q': - /* without the pedantic hinting flag, */ - /* FreeType ignores bytecode errors in `glyf' programs */ - CUR.pedantic_hinting = 1; - error = Quit; - goto LErrorLabel_; - - /* restart debugger */ - case 'R': - /* without the pedantic hinting flag, */ - /* FreeType ignores bytecode errors in `glyf' programs */ - CUR.pedantic_hinting = 1; - error = Restart; - goto LErrorLabel_; - - /* continue */ - case 'c': - if ( CUR.IP < CUR.codeSize ) - { - last_IP = CUR.IP; - last_range = CUR.curRange; - - /* loop execution until we reach end of current code range */ - /* or hit the breakpoint's position */ - while ( CUR.IP < CUR.codeSize ) - { - handle_WS( exc, storage ); - if ( ( error = TT_RunIns( exc ) ) != 0 ) - goto LErrorLabel_; - - if ( CUR.IP == breakpoint.IP && - CUR.curRange == breakpoint.range ) - break; - } - } - break; - - /* finish current function or hit breakpoint */ - case 'f': - oldch = ch; - - if ( CUR.IP < CUR.codeSize ) - { - if ( code_range[0] == 'f' ) - { - printf( "Not yet in `prep' or `glyf' program.\n" ); - break; - } - - if ( CUR.curRange != tt_coderange_font ) - { - printf( "Not in a function.\n" ); - break; - } - - last_IP = CUR.IP; - last_range = CUR.curRange; - - while ( 1 ) - { - Calc_Length( exc ); /* this updates CUR.opcode also */ - - /* we are done if we see the current function's ENDF opcode */ - if ( CUR.opcode == 0x2d ) - goto Step_into; - - if ( CUR.opcode == 0x2a || CUR.opcode == 0x2b ) - { - FT_Long next_IP; - - - /* loop execution until we reach the next opcode */ - next_IP = CUR.IP + CUR.length; - while ( CUR.IP != next_IP ) - { - handle_WS( exc, storage ); - if ( ( error = TT_RunIns( exc ) ) != 0 ) - goto LErrorLabel_; - - if ( CUR.IP == breakpoint.IP && - CUR.curRange == breakpoint.range ) - break; - } - - printf( "\n" ); - } - else - { - handle_WS( exc, storage ); - if ( ( error = TT_RunIns( exc ) ) != 0 ) - goto LErrorLabel_; - } - - if ( CUR.IP == breakpoint.IP && - CUR.curRange == breakpoint.range ) - break; - } - } - break; - - /* step over or hit breakpoint */ - case 'n': - if ( CUR.IP < CUR.codeSize ) - { - FT_Long next_IP; - FT_Int saved_range; - - - /* `step over' is equivalent to `step into' except if */ - /* the current opcode is a CALL or LOOPCALL */ - if ( CUR.opcode != 0x2a && CUR.opcode != 0x2b ) - goto Step_into; - - last_IP = CUR.IP; - last_range = CUR.curRange; - - /* otherwise, loop execution until we reach the next opcode */ - saved_range = CUR.curRange; - next_IP = CUR.IP + CUR.length; - while ( !( CUR.IP == next_IP && CUR.curRange == saved_range ) ) - { - handle_WS( exc, storage ); - if ( ( error = TT_RunIns( exc ) ) != 0 ) - goto LErrorLabel_; - - if ( CUR.IP == breakpoint.IP && - CUR.curRange == breakpoint.range ) - break; - } - } - - oldch = ch; - break; - - /* step into */ - case 's': - if ( CUR.IP < CUR.codeSize ) - { - Step_into: - last_IP = CUR.IP; - last_range = CUR.curRange; - - handle_WS( exc, storage ); - if ( ( error = TT_RunIns( exc ) ) != 0 ) - goto LErrorLabel_; - } - - oldch = ch; - break; - - /* toggle breakpoint at current position */ - case 'b': - if ( breakpoint.IP == CUR.IP && - breakpoint.range == CUR.curRange ) - { - breakpoint.IP = 0; - breakpoint.range = 0; - - printf( "Breakpoint removed.\n" ); - } - else - { - breakpoint.IP = CUR.IP; - breakpoint.range = CUR.curRange; - - printf( "Breakpoint set.\n" ); - } - - oldch = ch; - break; - - /* toggle breakpoint at previous position */ - case 'p': - if ( last_IP == 0 && last_range == 0 ) - printf( "No previous position yet to set breakpoint.\n" ); - else - { - if ( breakpoint.IP == last_IP && - breakpoint.range == last_range ) - { - breakpoint.IP = 0; - breakpoint.range = 0; - - printf( "Breakpoint removed from previous position.\n" ); - } - else - { - breakpoint.IP = last_IP; - breakpoint.range = last_range; - - printf( "Breakpoint set to previous position (%c%04lx).\n", - last_range == tt_coderange_font - ? 'f' - : ( last_range == tt_coderange_cvt - ? 'c' - : 'g' ), - last_IP ); - } - } - - oldch = ch; - break; - - /* show last bytecode instruction */ - case 'l': - oldch = ch; - break; - - default: - printf( "Unknown command. Press ? or h for help.\n" ); - oldch = '\0'; - break; - } - - display_changed_points(&save_pts, &pts, 0); - display_changed_points(&save_twilight, &twilight, 1); - - { - FT_ULong i; - - - for ( i = 0; i < CUR.cvtSize; i++ ) - if ( save_cvt[i] != CUR.cvt[i] ) - { - printf( "%3ldC %8ld (%8.2f)\n", - i, save_cvt[i], save_cvt[i] / 64.0 ); - printf( " %8ld (%8.2f)\n", - CUR.cvt[i], CUR.cvt[i] / 64.0 ); - } - - for ( i = 0; i < CUR.storeSize; i++ ) - if ( save_storage[i].initialized != storage[i].initialized || - save_storage[i].value != storage[i].value ) - { - printf( "%3ldS %8ld (%8.2f)\n", - i, save_storage[i].value, save_storage[i].value / 64.0 ); - printf( " %8ld (%8.2f)\n", - storage[i].value, storage[i].value / 64.0 ); - } - } - - } while ( 1 ); - - LErrorLabel_: - free( save_pts.org ); - free( save_pts.cur ); - free( save_pts.tags ); - - free( save_twilight.org ); - free( save_twilight.cur ); - free( save_twilight.tags ); - - free( save_cvt ); - - free( storage ); - free( save_storage ); - - if ( error && error != Quit && error != Restart ) - Abort( "error during execution" ); - return error; - } - - - static void - Usage( char* execname ) - { - char versions[32]; - - - /* we expect that at least one interpreter version is available */ - if ( num_tt_interpreter_versions == 2 ) - sprintf(versions, "%d and %d", - tt_interpreter_versions[0], - tt_interpreter_versions[1] ); - else - sprintf(versions, "%d, %d, and %d", - tt_interpreter_versions[0], - tt_interpreter_versions[1], - tt_interpreter_versions[2] ); - - fprintf( stderr, - "\n" - "ttdebug: simple TTF debugger -- part of the FreeType project\n" - "------------------------------------------------------------\n" - "\n" ); - fprintf( stderr, - "Usage: %s [options] idx size font\n" - "\n", execname ); - fprintf( stderr, - " idx The index of the glyph to debug.\n" - " size The size of the glyph in pixels (ppem).\n" - " font The TrueType font file to debug.\n" - "\n" - " -I ver Use TT interpreter version VER.\n" - " Available versions are %s; default is version %d.\n" - " -v Show version.\n" - "\n" - "While running, press the `?' key for help.\n" - "\n", - versions, - dflt_tt_interpreter_version ); - - exit( 1 ); - } - - - static char* file_name; - static unsigned int glyph_index; - static int glyph_size; - - - int - main( int argc, - char** argv ) - { - char* execname; - int option; - char version_string[64]; - - int i; - unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, - TT_INTERPRETER_VERSION_38, - TT_INTERPRETER_VERSION_40 }; - int version; - - int tmp; - - - /* init library, read face object, get driver, create size */ - error = FT_Init_FreeType( &library ); - if ( error ) - Abort( "could not initialize FreeType library" ); - - memory = library->memory; - driver = (FT_Driver)FT_Get_Module( library, "truetype" ); - if ( !driver ) - Abort( "could not find the TrueType driver in FreeType 2\n" ); - - { - FT_Int major, minor, patch; - int offset; - - - FT_Library_Version( library, &major, &minor, &patch ); - - offset = snprintf( version_string, 64, - "ttdebug (FreeType) %d.%d", - major, minor ); - if ( patch ) - offset = snprintf( version_string + offset, (size_t)( 64 - offset ), - ".%d", - patch ); - } - - /* collect all available versions, then set again the default */ - FT_Property_Get( library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - for ( i = 0; i < 3; i++ ) - { - error = FT_Property_Set( library, - "truetype", - "interpreter-version", &versions[i] ); - if ( !error ) - tt_interpreter_versions[num_tt_interpreter_versions++] = versions[i]; - } - FT_Property_Set( library, - "truetype", - "interpreter-version", &dflt_tt_interpreter_version ); - - execname = ft_basename( argv[0] ); - - while ( 1 ) - { - option = getopt( argc, argv, "I:v" ); - - if ( option == -1 ) - break; - - switch ( option ) - { - case 'I': - version = atoi( optarg ); - - if ( version < 0 ) - { - printf( "invalid TrueType interpreter version = %d\n", version ); - Usage( execname ); - } - - for ( i = 0; i < num_tt_interpreter_versions; i++ ) - { - if ( (unsigned int)version == tt_interpreter_versions[i] ) - { - FT_Property_Set( library, - "truetype", - "interpreter-version", &version ); - break; - } - } - - if ( i == num_tt_interpreter_versions ) - { - printf( "invalid TrueType interpreter version = %d\n", version ); - Usage( execname ); - } - break; - - case 'v': - printf( "%s\n", version_string ); - exit( 0 ); - /* break; */ - - default: - Usage( execname ); - break; - } - } - - argc -= optind; - argv += optind; - - if ( argc < 3 ) - Usage( execname ); - - /* get glyph index */ - if ( sscanf( argv[0], "%d", &tmp ) != 1 || tmp < 0 ) - { - printf( "invalid glyph index = %s\n", argv[1] ); - Usage( execname ); - } - glyph_index = (unsigned int)tmp; - - /* get glyph size */ - if ( sscanf( argv[1], "%d", &glyph_size ) != 1 || glyph_size < 0 ) - { - printf( "invalid glyph size = %s\n", argv[1] ); - Usage( execname ); - } - - /* get file name */ - file_name = argv[2]; - - Init_Keyboard(); - - FT_Set_Debug_Hook( library, - FT_DEBUG_HOOK_TRUETYPE, - (FT_DebugHook_Func)RunIns ); - - printf( "%s\n" - "press key `h' or `?' for help\n" - "\n", version_string ); - - while ( !error ) - { - error = FT_New_Face( library, file_name, 0, (FT_Face*)&face ); - if ( error ) - Abort( "could not open input font file" ); - - /* find driver and check format */ - if ( face->root.driver != driver ) - { - error = FT_Err_Invalid_File_Format; - Abort( "this is not a TrueType font" ); - } - - size = (TT_Size)face->root.size; - - error = FT_Set_Char_Size( (FT_Face)face, - glyph_size << 6, - glyph_size << 6, - 72, - 72 ); - if ( error ) - Abort( "could not set character size" ); - - glyph = (TT_GlyphSlot)face->root.glyph; - - /* now load glyph */ - error = FT_Load_Glyph( (FT_Face)face, - (FT_UInt)glyph_index, - FT_LOAD_NO_BITMAP ); - if ( error && error != Quit && error != Restart ) - Abort( "could not load glyph" ); - if ( error == Restart ) - error = FT_Err_Ok; - - FT_Done_Face( (FT_Face)face ); - } - - Reset_Keyboard(); - - FT_Done_FreeType( library ); - - return 0; - } - - -/* End */ diff -Nru freetype-2.7.1/=unpacked-tar1=/vms_make.com freetype-2.8/=unpacked-tar1=/vms_make.com --- freetype-2.7.1/=unpacked-tar1=/vms_make.com 2015-09-25 05:59:28.000000000 +0000 +++ freetype-2.8/=unpacked-tar1=/vms_make.com 1970-01-01 00:00:00.000000000 +0000 @@ -1,315 +0,0 @@ -$!---------------vms_make.com for Freetype2 demos ------------------------------ -$! make Freetype2 under OpenVMS -$! -$! In case of problems with the build you might want to contact me at -$! zinser@zinser.no-ip.info (preferred) or -$! zinser@sysdev.deutsche-boerse.com (Work) -$! -$!------------------------------------------------------------------------------ -$! -$ on error then goto err_exit -$! -$! Just some general constants -$! -$ Make = "" -$ true = 1 -$ false = 0 -$! -$! Setup variables holding "config" information -$! -$ name = "FT2demos" -$ optfile = name + ".opt" -$ ccopt = "/name=(as_is,short)/float=ieee" -$ lopts = "" -$! -$! Check for MMK/MMS -$! -$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" -$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" -$! -$! Which command parameters were given -$! -$ gosub check_opts -$! -$! Create option file -$! -$ open/write optf 'optfile' -$ If f$getsyi("HW_MODEL") .gt. 1024 -$ Then -$ write optf "[-.freetype2.lib]freetype2shr.exe/share" -$ else -$ write optf "[-.freetype2.lib]freetype.olb/lib" -$ endif -$ gosub check_create_vmslib -$ write optf "sys$share:decw$xlibshr.exe/share" -$ close optf -$! -$ gosub crea_mms -$ 'Make' -$ purge/nolog descrip.mms -$! -$ exit -$! -$ERR_LIB: -$ write sys$output "Error reading config file [-.freetype2]vmslib.dat" -$ goto err_exit -$FT2_ERR: -$ write sys$output "Could not locate Freetype 2 include files" -$ goto err_exit -$ERR_EXIT: -$ set message/facil/ident/sever/text -$ close/nolog optf -$ close/nolog out -$ close/nolog libdata -$ write sys$output "Exiting..." -$ exit 2 -$!------------------------------------------------------------------------------ -$! -$! If MMS/MMK are available dump out the descrip.mms if required -$! -$CREA_MMS: -$ write sys$output "Creating descrip.mms..." -$ create descrip.mms -$ open/append out descrip.mms -$ copy sys$input: out -$ deck -# This file is part of the FreeType project. -# -# DESCRIP.MMS: Make file for OpenVMS using MMS or MMK -# Created by Martin P.J. Zinser -# (zinser@decus.de (preferred) or zinser@sysdev.deutsche-boerse.com (work)) -$EOD -$ write out "CCOPT = ", ccopt -$ write out "LOPTS = ", lopts -$ copy sys$input: out -$ deck - -.FIRST - - define freetype [-.freetype2.include.freetype] - -CC = cc - -# location of src for Test programs -SRCDIR = [.src] -GRAPHSRC = [.graph] -GRX11SRC = [.graph.x11] -OBJDIR = [.obj] - -# include paths -INCLUDES = /include=([-.freetype2.include],[.graph]) - -GRAPHOBJ = $(OBJDIR)grblit.obj, \ - $(OBJDIR)grobjs.obj, \ - $(OBJDIR)grfont.obj, \ - $(OBJDIR)grinit.obj, \ - $(OBJDIR)grdevice.obj,\ - $(OBJDIR)grx11.obj, \ - $(OBJDIR)gblender.obj, \ - $(OBJDIR)gblblit.obj - -# C flags -CFLAGS = $(CCOPT)$(INCLUDES)/obj=$(OBJDIR) - -ALL : ftchkwd.exe ftdump.exe ftlint.exe ftmemchk.exe ftmulti.exe ftview.exe \ - ftstring.exe fttimer.exe ftbench.exe testname.exe - - -ftbench.exe : $(OBJDIR)ftbench.obj,$(OBJDIR)common.obj - link $(LOPTS) $(OBJDIR)ftbench.obj,$(OBJDIR)common.obj,- - []ft2demos.opt/opt -ftchkwd.exe : $(OBJDIR)ftchkwd.obj,$(OBJDIR)common.obj - link $(LOPTS) $(OBJDIR)ftchkwd.obj,$(OBJDIR)common.obj,- - []ft2demos.opt/opt -ftdump.exe : $(OBJDIR)ftdump.obj,$(OBJDIR)common.obj - link $(LOPTS) $(OBJDIR)ftdump.obj,common.obj,[]ft2demos.opt/opt -ftlint.exe : $(OBJDIR)ftlint.obj - link $(LOPTS) $(OBJDIR)ftlint.obj,[]ft2demos.opt/opt -ftmemchk.exe : $(OBJDIR)ftmemchk.obj - link $(LOPTS) $(OBJDIR)ftmemchk.obj,[]ft2demos.opt/opt -ftmulti.exe : $(OBJDIR)ftmulti.obj,$(OBJDIR)common.obj,$(GRAPHOBJ) - link $(LOPTS) $(OBJDIR)ftmulti.obj,common.obj,$(GRAPHOBJ),[]ft2demos.opt/opt -ftview.exe : $(OBJDIR)ftview.obj,$(OBJDIR)common.obj,$(GRAPHOBJ) - link $(LOPTS) $(OBJDIR)ftview.obj,common.obj,$(GRAPHOBJ),[]ft2demos.opt/opt -ftstring.exe : $(OBJDIR)ftstring.obj,$(OBJDIR)common.obj,$(GRAPHOBJ) - link $(LOPTS) $(OBJDIR)ftstring.obj,common.obj,$(GRAPHOBJ),[]ft2demos.opt/opt -fttimer.exe : $(OBJDIR)fttimer.obj - link $(LOPTS) $(OBJDIR)fttimer.obj,[]ft2demos.opt/opt -testname.exe : $(OBJDIR)testname.obj - link $(LOPTS) $(OBJDIR)testname.obj,[]ft2demos.opt/opt - -$(OBJDIR)common.obj : $(SRCDIR)common.c , $(SRCDIR)common.h -$(OBJDIR)ftbench.obj : $(SRCDIR)ftbench.c -$(OBJDIR)ftchkwd.obj : $(SRCDIR)ftchkwd.c -$(OBJDIR)ftlint.obj : $(SRCDIR)ftlint.c -$(OBJDIR)ftmemchk.obj : $(SRCDIR)ftmemchk.c -$(OBJDIR)ftdump.obj : $(SRCDIR)ftdump.c -$(OBJDIR)testname.obj : $(SRCDIR)testname.c -$(OBJDIR)ftview.obj : $(SRCDIR)ftview.c -$(OBJDIR)grblit.obj : $(GRAPHSRC)grblit.c -$(OBJDIR)grobjs.obj : $(GRAPHSRC)grobjs.c -$(OBJDIR)grfont.obj : $(GRAPHSRC)grfont.c -$(OBJDIR)gblender.obj : $(GRAPHSRC)gblender.c -$(OBJDIR)gblblit.obj : $(GRAPHSRC)gblblit.c -$(OBJDIR)grinit.obj : $(GRAPHSRC)grinit.c - set def $(GRAPHSRC) - $(CC)$(CCOPT)/include=([.x11],[])/define=(DEVICE_X11)/obj=[-.obj] grinit.c - set def [-] -$(OBJDIR)grx11.obj : $(GRX11SRC)grx11.c - set def $(GRX11SRC) - $(CC)$(CCOPT)/obj=[--.obj]/include=([-]) grx11.c - set def [--] -$(OBJDIR)grdevice.obj : $(GRAPHSRC)grdevice.c -$(OBJDIR)ftmulti.obj : $(SRCDIR)ftmulti.c -$(OBJDIR)ftstring.obj : $(SRCDIR)ftstring.c -$(OBJDIR)fttimer.obj : $(SRCDIR)fttimer.c - -CLEAN : - delete $(OBJDIR)*.obj;*,[]ft2demos.opt;* -# EOF -$ eod -$ close out -$ return -$!------------------------------------------------------------------------------ -$! -$! Check commandline options and set symbols accordingly -$! -$ CHECK_OPTS: -$ i = 1 -$ OPT_LOOP: -$ if i .lt. 9 -$ then -$ cparm = f$edit(p'i',"upcase") -$ if cparm .eqs. "DEBUG" -$ then -$ ccopt = ccopt + "/noopt/deb" -$ lopts = lopts + "/deb" -$ endif -$! if cparm .eqs. "link $(LOPTS)" then link only = true -$ if f$locate("LOPTS",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ lopts = lopts + f$extract(start,len,cparm) -$ endif -$ if f$locate("CCOPT",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ ccopt = ccopt + f$extract(start,len,cparm) -$ endif -$ i = i + 1 -$ goto opt_loop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Take care of driver file with information about external libraries -$! -$! Version history -$! 0.01 20040220 First version to receive a number -$! 0.02 20040229 Echo current procedure name; use general error exit handler -$! Remove xpm hack -> Replaced by more general dnsrl handling -$! ---> Attention slightly changed version to take into account special -$! Situation for Freetype2 demos -$CHECK_CREATE_VMSLIB: -$! -$ if f$search("[-.freetype2]VMSLIB.DAT") .eqs. "" -$ then -$ write sys$output "Freetype2 driver file [-.freetype2]vmslib.dat not found." -$ write sys$output "Either Ft2demos have been installed in the wrong location" -$ write sys$output "or Freetype2 has not yet been configured." -$ write sys$output "Exiting..." -$ goto err_exit -$ endif -$! -$! Init symbols used to hold CPP definitions and include path -$! -$ libdefs = "" -$ libincs = "" -$! -$! Open data file with location of libraries -$! -$ open/read/end=end_lib/err=err_lib libdata [-.freetype2]VMSLIB.DAT -$LIB_LOOP: -$ read/end=end_lib libdata libline -$ libline = f$edit(libline, "UNCOMMENT,COLLAPSE") -$ if libline .eqs. "" then goto LIB_LOOP ! Comment line -$ libname = f$edit(f$element(0,"#",libline),"UPCASE") -$ write sys$output "Processing ''libname' setup ..." -$ libloc = f$element(1,"#",libline) -$ libsrc = f$element(2,"#",libline) -$ testinc = f$element(3,"#",libline) -$ cppdef = f$element(4,"#",libline) -$ old_cpp = f$locate("=1",cppdef) -$ if old_cpp.lt.f$length(cppdef) then cppdef = f$extract(0,old_cpp,cppdef) -$ if f$search("''libloc'").eqs. "" -$ then -$ write sys$output "Can not find library ''libloc' - Skipping ''libname'" -$ goto LIB_LOOP -$ endif -$ libsrc_elem = 0 -$ libsrc_found = false -$LIBSRC_LOOP: -$ libsrcdir = f$element(libsrc_elem,",",libsrc) -$ if (libsrcdir .eqs. ",") then goto END_LIBSRC -$ if f$search("''libsrcdir'''testinc'") .nes. "" then libsrc_found = true -$ libsrc_elem = libsrc_elem + 1 -$ goto LIBSRC_LOOP -$END_LIBSRC: -$ if .not. libsrc_found -$ then -$ write sys$output "Can not find includes at ''libsrc' - Skipping ''libname'" -$ goto LIB_LOOP -$ endif -$ if (cppdef .nes. "") then libdefs = libdefs + cppdef + "," -$ libincs = libincs + "," + libsrc -$ lqual = "/lib" -$ libtype = f$edit(f$parse(libloc,,,"TYPE"),"UPCASE") -$ if f$locate("EXE",libtype) .lt. f$length(libtype) then lqual = "/share" -$ write optf libloc , lqual -$ if (f$trnlnm("topt") .nes. "") then write topt libloc , lqual -$! -$! Nasty hack to get the freetype includes to work -$! -$ ft2def = false -$ if ((libname .eqs. "FREETYPE") .and. - - (f$locate("FREETYPE2",cppdef) .lt. f$length(cppdef))) -$ then -$ if ((f$search("freetype:freetype.h") .nes. "") .and. - - (f$search("freetype:[internal]ftobjs.h") .nes. "")) -$ then -$ write sys$output "Will use local definition of freetype logical" -$ else -$ ft2elem = 0 -$FT2_LOOP: -$ ft2srcdir = f$element(ft2elem,",",libsrc) -$ if f$search("''ft2srcdir'''testinc'") .nes. "" -$ then -$ if f$search("''ft2srcdir'internal.dir") .nes. "" -$ then -$ ft2dev = f$parse("''ft2srcdir'",,,"device","no_conceal") -$ ft2dir = f$parse("''ft2srcdir'",,,"directory","no_conceal") -$ ft2conc = f$locate("][",ft2dir) -$ ft2len = f$length(ft2dir) -$ if ft2conc .lt. ft2len -$ then -$ ft2dir = f$extract(0,ft2conc,ft2dir) + - - f$extract(ft2conc+2,ft2len-2,ft2dir) -$ endif -$ ft2dir = ft2dir - "]" + ".]" -$ define freetype 'ft2dev''ft2dir','ft2srcdir' -$ ft2def = true -$ else -$ goto ft2_err -$ endif -$ else -$ ft2elem = ft2elem + 1 -$ goto ft2_loop -$ endif -$ endif -$ endif -$ goto LIB_LOOP -$END_LIB: -$ close libdata -$ return diff -Nru freetype-2.7.1/=unpacked-tar2=/bin/README freetype-2.8/=unpacked-tar2=/bin/README --- freetype-2.7.1/=unpacked-tar2=/bin/README 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/bin/README 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1 @@ +This directory contains all executables for the FreeType demo programs diff -Nru freetype-2.7.1/=unpacked-tar2=/ChangeLog freetype-2.8/=unpacked-tar2=/ChangeLog --- freetype-2.7.1/=unpacked-tar2=/ChangeLog 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/ChangeLog 2017-05-13 10:45:02.000000000 +0000 @@ -0,0 +1,6500 @@ +2017-05-13 Werner Lemberg + + * Version 2.8 released. + ======================= + + + Tag sources with `VER-2-8. + + * README: Updated. + * src/*.1: Updated. + * src/ftinspect.pro: Updated. + +2017-05-11 Werner Lemberg + + * src/ftinspect.cpp: Don't include `cstdint', which is C++11. + + Right now, we still want to be able to compile with older C++ + compilers. + +2017-05-11 Philipp Kerling + + [ftinspect] Check glyph index before discarding sign. + + * src/ftinspect.cpp (Engine:glyphName, Engine::loadOutline): Do it. + +2017-05-11 Philipp Kerling + + * src/ftinspect.cpp (GlyphPointNumbers::paint): Fix `ptIdx' type. + +2017-05-11 Philipp Kerling + + [ftinspect] Mark float literals as float. + + * src/ftinspect.cpp (GlyphPointNumbers::paint): Do it. + +2017-05-11 Philipp Kerling + + [ftinspect] Insert explicit casts where warranted. + + This avoids compiler warnings. + + * src/ftinspect.cpp (Engine::numberOfNamedInstances, + Engine::glyphName, Engine::loadOutline, GlyphBitmap::GlyphBitmap, + GlyphBitmap::paint, QGraphicsViewx::resizeEvent): Do it. + +2017-05-11 Philipp Kerling + + [ftinspect] Replace old-style casts with C++ casts. + + * src/ftinspect.cpp (Engine::update, GlyphPointNumbers::paint): Do + it. + +2017-05-11 Philipp Kerling + + [ftinspect] Make color tables and settings more readable. + + * src/ftinspect.cpp (MainGUI::setGraphicsDefaults): Use Qt + constants and `qRgba'. + +2017-05-11 Philipp Kerling + + [ftinspect] Use symbolic constant for TrueType interpreter v40. + + v40 is implemented meanwhile. + + * src/ftinspect.cpp (Engine::Engine, MainGUI::setDefaults): Use + `TT_INTERPRETER_VERSION_40'. + +2017-05-11 Philipp Kerling + + [ftinspect] Remove unneeded explicit array sizes. + + * src/ftinspect.cpp (Engine::Engine): Do it. + +2017-05-11 Philipp Kerling + + [ftinspect] Make `ftcFaceID' conversion safe. + + * src/ftinspect.cpp: Include `stdint.h'. + (faceRequester): Implement it. + +2017-05-11 Philipp Kerling + + [ftinspect] Synchronize dpi, target, pxlMode types with FreeType. + + * src/ftinspect.h (Engine): Make `dpi' unsigned int. + Make `loadFlags' unsigned long. + (GlyphBitmap): Use `FT_Pixel_Mode' for `pixelMode' and constructor. + + * src/ftinspect.c: Include `cstdint', `cmath', `limits', + `stdexcept', needed by forthcoming commits. + (Engine::update, GlyphBitmap::GlyphBitmap, MainGUI::drawGlyph): + Updated. + +2017-05-11 Philipp Kerling + + [ftinspect] Change freetype2 include path to system include path. + + This avoids warnings. + + * src/ftinspect.pro: Do it. + +2017-05-11 Philipp Kerling + + [ftinspect] Remove `const_cast'. + + * src/ftinspect.cpp (GlyphBitmap::paint): `const_cast' is + potentially dangerous and should only be used as a last resort. + Here, the mutable data can just be accessed with `.bits()' instead. + +2017-05-11 Werner Lemberg + + Fix clang warnings. + + * src/ftbench.c (main): Use cast. + + * src/ftview.c (N_LCD_IDXS): Cast to `int'. + (usage, parse_cmdline): Updated. + +2017-05-09 Alexei Podtelezhnikov + + [ftview] Report fractional ppem for scalable fonts. + + * src/ftview.c (write_header): Updated, ppem and errors consolidated. + +2017-05-08 Alexei Podtelezhnikov + + * src/ftview.c (write_header): Revert due to segmentation fault. + +2017-05-02 Werner Lemberg + + Remove `slight' auto-hinting mode. Add sub-pixel `light' mode. + + * src/ftcommon.h (LCD_MODE_SLIGHT): Replace with... + (LCD_MODE_LIGHT_SUBPIXEL): ...this new enum value. + + * src/ftcommon.c (FTDemo_Update_Current_Flags, + FTDemo_Glyph_To_Bitmap): Updated. + (string_load): Handle `LCD_MODE_LIGHT_SUBPIXEL'. + Make integer delta support actually work. + (string_render_prepare): Support `LCD_MODE_LIGHT_SUBPIXEL'. + + * src/ftdiff.c (HintMode): Replace HINT_MODE_AUTOHINT_SLIGHT with + HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL. + (render_mode_names, render_state_draw, event_help): Updated. + + * src/ftgrid.c (grid_status_draw_outline): Show fractional advance + width. + (event_lcd_mode_change, Process_Event): Updated. + + * src/ftstring.c (event_lcdmode_change): Updated. + + * src/ftview.c (lcd_modes): New array to map indices (as produced by + key presses) to LCD modes; we omit LCD_MODE_LIGHT_SUBPIXEL, which + doesn't make much sense within ftview. + (N_LCD_IDXS): New macro. + (status): Replace `lcd_mode' with `lcd_idx'. + (event_help): Revert change from 2017-04-19. + (Process_Event): Updated to use `lcd_modes' array. + Remove references to LCD_MODE_LIGHT. + (write_header, usage, parse_cmdline, main): Updated. + + * src/ftinspect.h (AntiAliasing): Remove `AntiAliasing_Slight'. + + * src/ftinspect.cpp (Engine::update, MainGUI::checkHinting, + MainGUI::checkAutoHinting, MainGUI::checkAntiAliasing, + MainGUI::createLayout): Updated. + +2017-04-19 Werner Lemberg + + Support new `slight' auto-hinting mode. + + Note that currently only `ftdiff' shows what the new mode really can + do – `ftview' uses integer advance values, which doesn't work well + with the `slight' mode. + + * src/ftcommon.h (LCD_MODE_SLIGHT): New enumeration. + + * src/ftcommon.c (FTDemo_Update_Current_Flags, + FTDemo_Glyph_To_Bitmap): Handle `LCD_MODE_SLIGHT'. + + * src/ftdiff.c (HintMode): Add `HINT_MODE_AUTOHINT_SLIGHT'. + (render_mode_names): Updated. + (render_state_draw): Handle `HINT_MODE_AUTOHINT_SLIGHT'. + + * src/ftgrid.c (event_lcd_mode_change): Handle `LCD_MODE_SLIGHT'. + (Process_Event): Updated. + + * src/ftstring.c (event_lcdmode_change): Handle `LCD_MODE_SLIGHT'. + + * src/ftview.c (event_help): Updated; we now have keys A-H to + directly select rendering modes. + (Process_Event, write_header): Updated. + + * src/ftinspect.h (AntiAliasing): Add `AntiAliasing_Light'. + + * src/ftinspect.cpp (Engine::update): Handle `AntiAliasing_Light', + update `AntiAliasing_Slight'. + (MainGUI::checkHinting, MainGUI::checkAutoHinting, + MainGUI::checkAntiAliasing, MainGUI::createLayout): Updated. + +2014-04-19 Werner Lemberg + + [ftgrid] Fix out-of-array memory access. + + * src/ftgrid.c (bitmap_scale) [gr_pixel_mode_lcd]: We handle input + pixel by pixel, not the full line; consequently, we have to use + `width', not `pitch'. + +2017-04-17 Alexei Podtelezhnikov + + * src/ftview.c (write_header): Report fractional ppem differently. + + To convince Werner. + +2017-04-16 Alexei Podtelezhnikov + + * src/ftview.c (write_header): Report fractional ppem. + +2017-04-16 Werner Lemberg + + * src/ftdump.c (Print_Charmaps): Better show synthetic cmaps. + +2017-04-09 Werner Lemberg + + * src/ftmulti.c (Render_All, Render_Text): Round advance widths. + + Problem spotted by Nikolaus. + +2017-03-30 Werner Lemberg + + * src/ftview.c (write_header): Show current instance index. + +2017-03-29 Alexei Podtelezhnikov + + Use `LCD_MODE_XXX' enum values. + + * src/ftcommon.c (FTDemo_New, FTDemo_Update_Current_Flags, + FTDemo_Glyph_To_Bitmap, FTDemo_Index_To_Bitmap): Ditto. + * src/ftgrid.c (event_lcd_filter_change): Ditto. + * src/ftstring.c (event_lcdmode_change): Ditto. + +2017-03-29 Werner Lemberg + + * src/ftview.c (INIT_SIZE): Improve vertical start position. + +2017-03-27 Alexei Podtelezhnikov + + [ftview] Stuff right margin. + + * src/ftview.c (X_TOO_LONG): Rely on `horiAdvance' when available. + (Render_All): Use `FTDemo_Draw_Slot' so that updated X_TOO_LONG works. + (Render_Stroke, Render_Fancy): Updated. + +2017-03-26 Alexei Podtelezhnikov + + [ftview] Hide LCD filter from grayscale modes. + + * src/ftview.c (Process_Event, write_header): Check the LCD mode + before adjusting or reporting the LCD filter. + +2017-03-26 Alexei Podtelezhnikov + + [ftview, ftstring, ftgrid] Remove anti-aliasing toggle. + + * src/ftcommon.h (FTDemo_Handle): Replace `antialias' field with + `LCD_MODE_MONO' enumerator. + * src/ftcommon.c (FTDemo_Update_Current_Flags, FTDemo_Glyph_To_Bitmap, + FTDemo_Index_To_Bitmap): Updated. + * src/ftgrid.c (Process_Event, event_help, event_lcd_mode_change, + event_lcd_filter_change): Ditto. + * src/ftstring.c (Process_Event, event_help, event_lcdmode_change): + Ditto. + * src/ftview.c (Process_Event, event_help, write_header): Ditto. + +2017-03-24 Alexei Podtelezhnikov + + * src/ftview.c (Render_*): Improve readability. + +2017-03-24 Alexei Podtelezhnikov + + [ftview] Consolidate emboldening and slanting modes. + + * src/ftview.c (Render_Slanted, Render_Embolden): Merged into... + (Render_Fancy): ... this new function. + (event_help, Process_Event, write_header, main): Updated. + * src/ftview.1: Updated. + +2017-03-23 Alexei Podtelezhnikov + + * src/ftmulti.c (Process_Event, main): Use `FT_RoundFix'. + +2017-03-23 Werner Lemberg + + * src/ftmulti.c (Process_Event, main): Fix rounding. + +2017-03-23 Werner Lemberg + + [ftmulti] Show PS name. + + * src/ftmulti.c (Render_All): Adjust vertical start position. + (Render_Text): Make arguments similar to `Render_All'. + Adjust vertical start position. + (Process_Event): Round non-integer axis values to two decimal + digits. + (main): Updated. + Print PostScript name. + +2017-03-20 Brian Nixon + + [ftview] Improve waterfall mode (#50586). + + * src/ftview.c (Render_Waterfall): Stop repeating of the default + glyph to the end of each line after the display text. + +2017-03-20 Brian Nixon + + * graph/win32/grwin32.c(syskey_translators): Fix F10 key (#50585). + + `F10' does not work as advertised in the demos because the + message-handling code expects it to arrive as a `normal' key but + Windows sends it as a `system' key (because it is reserved for + activating the menu bar, per the IBM Common User Access standard). + + Fix this by adding `F10' to the ‛syskey_translators’ table. + + (We also remove the existing handling of `F1' as a `system' key, + because this does not appear to be necessary. `F1' is sent as a + `normal' key and is correctly handled by the ‛key_translators’ + table.) + +2017-03-19 Alexei Podtelezhnikov + + * src/ftbench.c (main, usage): Add optional LCD filtering. + +2017-03-19 Brian Nixon + + [graph] Make demo windows minimise-able on Win32 (#50582). + + * graph/win32/grwin32.c (gr_win32_surface_init): Implement it. + +2017-03-13 Werner Lemberg + + [ftdump] Show ID numbers for standard `name' table entries. + + * src/ftdump.c (EXPAND, XEXPAND, NAME_ID): New macros. + (name_id): Use new macros. + +2017-02-07 Alexei Podtelezhnikov + + * src/ftgamma.c (main): Label images. + +2017-02-03 Alexei Podtelezhnikov + + [ftgamma] Add box-filtered subpixel pattern. + + Two alternative patterns now demonstrate the importance of correct + gamma for both grayscale and subpixel anti-aliasing, where it helps + normalize thickness in the former and remove color fringes in the + latter. + + * src/ftgamma.*: Updated. + +2017-01-28 Alexei Podtelezhnikov + + [ftstring] Improve gamma ramp appearance. + + * src/ftstring.c (event_gamma_change, gamma_ramp_draw): Updated. + +2017-01-28 Werner Lemberg + + [ftdump] Always finalize FreeType. + + * src/ftdump.c (PanicZ, usage): Add `library' argument so that we + can call `FT_Done_FreeType'. + (main): Updated. + +2017-01-28 Werner Lemberg + + [ftdump] Sync with current FreeType. + + * src/ftdump.c (name_id): Use updated ID macros. + Add new ID macros. + +2017-01-27 Alexei Podtelezhnikov + + [ftview] Align with current FreeType. + + * src/ftview.c (write_header): s/GB2312/PRC/. + (Process_Event): `FT_Library_SetLcdFilterWeights' now enables + filtering without `FT_Library_SetLcdFilter'. + +2016-12-30 Werner Lemberg + + * Version 2.7.1 released. + ========================= + + + Tag sources with `VER-2-7-1'. + + * README: Updated. + * src/*.1: Updated. + * src/ftinspect.pro: Updated. + +2016-12-27 Werner Lemberg + + [ftmulti] Minor. + + * src/ftmulti.c (Process_Event, main): If MM, round design + coordinates. + +2016-12-25 Werner Lemberg + + Fixes for clang++. + + * Makefile (COMPILE): Don't add `-std=c99' if using a C++ compiler. + + * src/ftbench.c (_GNU_SOURCE): Declare only if not already defined. + + * src/ftcommon.c (_GNU_SOURCE): Declare only if not already defined. + (FTDemo_Install_Font): Use proper case for `FT_Select_Charmap'. + + * src/ftmulti.c (main): Use proper case for `FT_Select_Charmap'. + +2016-12-20 Werner Lemberg + + * src/ftmulti.c: Minor clang fixes. + +2016-12-19 Werner Lemberg + + [ftmulti] Support multiple engines. + + Similar to other programs, use the `H' key to cycle through engines + (if available). + + * src/ftmulti.c: Include FT_FONT_FORMATS_H, FT_MODULE_H, + FT_TRUETYPE_DRIVER_H, FT_CFF_DRIVER_H. + (N_CFF_HINTING_ENGINES): New macro. + (cff_hinting_engine, tt_interpreter_versions, + num_tt_interpreter_versions, tt_interpreter_version_idx, + font_format): New global variables. + (Help): Updated. + (cff_hinting_engine_change, tt_interpreter_version_change): New + functions. + (Process_Event): Handle key `H'. + (main): Set up selection of CFF and TrueType engine versions. + Display selected engine. + Force redisplay of current font if `H' key was pressed. + +2016-11-06 Werner Lemberg + + * src/ftbench.c (main): Adjust size argument for bitmap strikes. + + For bitmap-only fonts we enforce the selection of the first bitmap + strike size. + This commit also fixes the `size' value itself. + +2016-10-29 Werner Lemberg + + Minor compilation issues. + + * Makefile: Use ANSIFLAGS and select C99 for GNU-like compilers. + + * src/ftbench.c, src/ftcommon.c (_GNU_SOURCE): Define. We use + functionality not covered by ANSI. + +2016-10-29 Werner Lemberg + + Fix clang warnings. + + We now have a new `FT_ENCODING_OTHER' tag used for internal + purposes. Since it is not possible to extend an enumeration after + its definition, replace `FT_Encoding' types with `unsigned long'. + + * src/ftcommon.c (FTDemo_Make_Encoding_Tag): Updated. + * src/ftcommon.h (FTDemo_Handle): Ditto. + + * src/ftmulti.c (encoding): Use `unsigned long'. + (main): Updated. + + * src/ftstring.c (Sample): Make array of type `const char*'. + (status): Use `unsigned long' for `encoding' field. + Use `const char*' for `text' field. + + * src/ftview.c (status): Use `unsigned long' for `encoding'. + (FT_ENCODING_OTHER): Use `unsigned long'. + +2016-10-18 Alexei Podtelezhnikov + + [graph] Untested legacy 15/16-bit color fixes. + + Our tools do not use the legacy 15/16-bit color modes. This is mostly + for the sake of correctness. We might also remove the code. + + * graph/grblit.c (blit_gray{8,}_to_{555,565}): Updated. + * graph/x11/grx11.c (gr_x11_format_{bgr565,rgb555,bgr555}): Updated. + +2016-10-13 Alexei Podtelezhnikov + + * graph/grblit.c (blit_lcd28_to_24): Typo. + +2016-10-10 Alexei Podtelezhnikov + + * src/ftdump.c (Print_Charmaps): Dump format info. + +2016-10-09 Alexei Podtelezhnikov + + [ftview] Recognize other charmaps. + + * src/ftview.c (event_change_encoding): Recognize when + FT_ENCODING_NONE has special other meaning. + (write_header): Default case for `status.encoding'. + +2016-10-07 Alexei Podtelezhnikov + + [ftview] Fix charmap cycling. + + * src/ftview.c (event_change_encoding): Reimplement relying on + `cmap_index' field in TFont structure. + +2016-10-05 Alexei Podtelezhnikov + + [ftview] Implement cycling through available charmaps. + + * src/ftview.c (event_change_encoding): New function. + (Process_Event): New [Tab] event to cycle through available charmaps, + also increase index steps to 16, 256, and 4096. + (event_help): Updated. + +2016-10-03 Alexei Podtelezhnikov + + * graph/grevents.h (grKey): Typo. + +2016-10-01 Ä°smail Dönmez + + * src/ftinspect.pro (LIBS): Fix default value. + +2016-09-24 Alexei Podtelezhnikov + + [ftstring] Add LGC and CJK sample strings. + + * src/ftstring.c (event_text_change): New function. + (Process_Event): New [Tab] event to cycle through sample strings. + (event_help): Offer it. + (status, event_font_change, main): Updated. + +2016-09-16 Werner Lemberg + + * src/ftbench.1: Improve. + +2016-09-08 Werner Lemberg + + * Version 2.7 released. + ======================= + + + Tag sources with `VER-2-7'. + + * README: Updated. + * src/*.1: Updated. + * src/ftinspect.pro: Updated. + +2016-08-20 Alexei Podtelezhnikov + + * src/ftdump.c (Print_Programs): Use fewer casts. + +2018-08-19 Werner Lemberg + + [ftdump] Fix clang compiler warnings. + + * src/ftdump.c (Print_Bytecode): Use cast instead of printf length + modifier – we would need `hh', which only glibc offers. + (Print_Programs): Use proper casts for constant strings and 16bit + integer types. + +2018-08-19 Werner Lemberg + + [ftgamma] Fix compiler warnings. + + * src/ftgamma.c (bit1, bit2, bit): Make them static. + +2016-08-18 Alexei Podtelezhnikov + + [ftdump] Hexdump composite glyf instructions too. + + * src/ftdump.c (Print_Programs): Updated. + (Print_Bytecode): Cleaned up. + +2016-08-18 Alexei Podtelezhnikov + + [ftdump] Implement hexdump of TrueType instructions. + + This is useful when searching for interesting instructions. Pushed + values come with underscore prefix to distinguish them from actual + opcodes. + + * src/ftdump.c (Print_Bytecode, Print_Programs): Implement this. + (usage): New option `-p' described. + (main): Updated. + * src/ftdump.1: Updated. + +2016-08-06 Werner Lemberg + + Move Mark Leisher's `getopt' implementation to a separate file. + + We need this since `ftbench.c' now includes `unistd.h', which in + turn declares `getopt'. + + * src/common.c, src/common.h: Move `getopt' stuff to... + * src/mlgetopt.c, src/mlgetopt.h: ... these new files. + Update all callers. + + * src/common.c, src/common.h: Use standard C only. + Replace `CONST' with `const'. + + * Makefile (COMMON_OBJ): Add `mlgetopt'. + +2016-08-02 Alexei Podtelezhnikov + + * src/ftbench.c (get_time, benchmark): Clean up timers. + +2016-08-01 Alexei Podtelezhnikov + + [ftbench] Use POSIX timers when available. + + * src/ftbench.c (get_time): Use `clock_gettime' instead of obsolete + and less accurate `gettimeofday'. + (benchmark): Updated. + +2016-07-14 Werner Lemberg + + [ftgrid] New option `-d' to give start-up design coordinates. + + This code is similar to the one from `ftmulti'. + + * src/ftgrid.c: Include `stdlib.h'. + (GridStatusRec): Add `requested_pos' and `requested_cnt' to hold the + design coordinate data from the command line. + (event_font_change): Handle them. + (parse_cmdline): Handle option `-d'. + (usage): Document `-d'. + (main): Don't load named instances if we have start-up design + coordinates. + + * src/ftgrid.1: Updated. + +2016-07-14 Werner Lemberg + + Prepare suppression of named instances. + + No functional change. + + * src/ftcommon.c (FTDemo_Install_Font): Add boolean parameter to + avoid loading of instances. + * src/ftcommon.h: Updated. + * src/ftgrid.c (main), src/ftstring.c (main), src/ftview.c (main): + Updated. + +2016-07-14 Werner Lemberg + + [ftgrid] Properly handle named instances. + + * src/ftgrid.c (event_font_change): Properly initialize the design + positions with the named instance's value, if appropriate. + +2016-07-12 Werner Lemberg + + * Version 2.6.5 released. + ========================= + + + Tag sources with `VER-2-6-5'. + + * README: Updated. + * src/*.1: Updated. + * src/ftinspect.pro: Updated. + +2016-07-05 Werner Lemberg + + * Version 2.6.4 released. + ========================= + + + Tag sources with `VER-2-6-4'. + + * README: Updated. + * src/*.1: Updated. + * src/ftinspect.pro: Updated. + +2016-06-26 Werner Lemberg + + [ftinspect] Fix pixel box drawing. + + This commit circumvents a problem with Qt's `QPainter::drawImage' + function; it seems that the alignment of the output becomes + imprecise at high magnification values. + + * src/ftinspect.c (GlyphBitmap::paint): Manually draw pixel boxes + with `fillRect'. + +2016-05-29 Werner Lemberg + + * src/ftbench.c (main): Add cast to remove compiler warning. + +2016-05-29 Werner Lemberg + + [ftinspect] Mark pixel centers in the grid with a cross. + + * src/ftinspect.c (Grid::paint): Implement it. + +2016-05-29 Werner Lemberg + + [ftinspect] Prepare zoom for drawing pixel center. + + This change makes the zoom use only even values larger than a given + threshold; it also implements (kind of) logarithmic zooming. + + * src/ftinspect.h (QSpinBoxx): New class, derived from `QSpinBox'. + (MainGUI): Updated. + + * src/ftinspect.cpp (MainGUI::createLayout): Updated. + (QSpinBoxx::valueFromText, QSpinBoxx::stepBy): New methods. + +2016-05-26 Werner Lemberg + + [ftbench] Add support for third TrueType interpreter version. + + Option `-H' now takes an argument to select the CFF hinting engine, + and new option `-I' selects the TT interpreter version. + + * src/ftbench.c (default_hinting_engine, + default_interpreter_version): Replaced with... + (tt_interpreter_versions, num_tt_interpreter_versions, + dflt_tt_interpreter_version, cff_hinting_engines, + num_cff_hinting_engines, dflt_cff_hinting_engine, + cff_hinting_engine_names): ... these new global variables. + (main): Expand check for alternative TrueType interpreter versions + and CFF hinting engines. + Add argument to option `-H'. + Add new option `-I'. + (usage): Updated. + + * src/ftbench.1: Updated. + +2016-05-26 Werner Lemberg + + [ttdebug] Rename option `-H' to `-I'. + + This is for consistency with a forthcoming change to `ftbench'. + + * src/ttdebug.c (main): Implement it. + (Usage): Updated. + + * src/ttdebug.1: Updated. + +2016-05-26 Werner Lemberg + + [ttdebug] Add support for third TrueType interpreter version. + + Option `-H' now takes an argument. + + * src/ttdebug.c (default_version, alternative_version): Replaced + with... + (tt_interpreter_versions, num_tt_interpreter_versions, + dflt_tt_interpreter_version): ... these new global variables. + (main): Expand check for alternative TrueType interpreter versions. + Add argument to option `-H'. + (Usage): Updated. + + * src/ttdebug.1: Updated. + +2016-05-21 Werner Lemberg + + [ftgrid] Add support for third TrueType interpreter version. + + * src/ftgrid.c (GridStatusRec): Replace `tt_interpreter_version' + with `tt_interpreter_versions' array. + Add `num_tt_interpreter_versions' and `tt_interpreter_version_idx'. + (event_tt_interpreter_version_change): Updated. + (main): Expand check for alternative TrueType interpreter versions. + +2016-05-21 Werner Lemberg + + [ftdiff] Add support for third TrueType interpreter version. + + * src/ftdiff.c (ColumnStateRec): Replace `tt_interpreter_version' + with `tt_interpreter_versions' array. + Add `num_tt_interpreter_versions' and `tt_interpreter_version_idx'. + (render_state_init): Expand check for alternative TrueType + interpreter versions. + (render_state_draw): Updated. + (process_event) <'H'>: Updated. + +2016-05-21 Werner Lemberg + + [ftview] Add support for third TrueType interpreter version. + + * src/ftview.c (status): Replace `tt_interpreter_version' with + `tt_interpreter_versions' array. + Add `num_tt_interpreter_versions' and `tt_interpreter_version_idx'. + (event_tt_interpreter_version_change, write_header): Updated. + (main): Expand check for alternative TrueType interpreter versions. + +2016-05-21 Werner Lemberg + + Make compilation work with clang++. + + Also fix some warning messages. + + * src/ftcommon.c (FTDemo_Display_Clear): Use proper cast. + (string_load): Replace shifts with multiplication. + + * src/ftgamma.c: (bit1, bit2): Complete initializer. + (do_ptrn, do_fill): Use proper casts. + (Render_Bitmap): s/bitmap/out/, s/bit/in/, to avoid shadowing global + variable `bit'. + + * src/ftgrid.c (GridStatus): Make `lcd_filter' of type + `FT_LcdFilter'. + (bitmap_scale): Use proper casts. + (grid_status_draw_outline): Fix int vs. short warnings. + (event_cff_hinting_engine_change): Add initializer. + (event_lcd_filter_change): Properly handle `status.lcd_filter'. + + * src/ftmulti.c (requested_cnt, used_num_axis): Make them `unsigned + int'. + (Process_Event, main): Updated. + + * src/ftstring.c (status): Complete initializer. + + * src/ftvalid.c (ValidatorType): Fix enum syntax. + + * src/ftview.c (event_cff_hinting_engine_change): Add initializer. + (Process_Event) <'L'>: Fix call to FT_Library_SetLcdFilter. + + * src/output.c (put_ascii_string, put_unicode_be16_string): Add + casts. + +2016-05-19 Werner Lemberg + + [ftinspect] Use bottom left as the viewport anchor for resizing. + + We store the last bottom left corner point of the viewport rectangle + and adjust the verticalScrollBar value by the delta relative to the + current bottom left corner position. + + * src/ftinspect.h (QGraphicsViewx): New class, derived from + `QGraphicsView'. + (MainGUI): Updated. + + * src/ftinspect.cpp (MainGUI::createLayout): Updated. + (QGraphicsViewx::QGraphicsViewx, QGraphicsViewx::scrollContentsBy, + QGraphicsView::resizeEvent): New methods. + +2016-05-18 Werner Lemberg + + [ftinspect] Re-implement file watching. + + * src/ftinspect.cpp (MainGUI::MainGUI): Initialize file watcher and + timer. + (MainGUI::closeFont): Updated. + (MainGUI::watchCurrentFont): New method. + (MainGUI::showFont): Handle file watching for both real files and + softlinks. + Display a softlink name as italic font. + (MainGUI::createConnections): Updated. + + * src/ftinspect.h (MainGUI): Updated. + +2016-05-15 Werner Lemberg + + [ftinspect] Redesign file/face/instance navigation. + + Instead of peeking into a font with a negative argument to + `FT_Face_New', we now directly load appropriate (font, face, + instance) triplets. + + The new code also tries a bit harder to separate the font stuff in + the `Engine' class from the GUI navigation control in `MainGUI'. + + * src/ftinspect.h (Font): Removed. + (MainGUI): Make `fontList' a `QStringList'. + New members `currentNumberOfFaces' and + `currentNumberOfNamedInstances'. + Move `faceCounter' and `faceIDMap' members to... + (Engine): ...this class. + Make `faceRequester' a friend. + + * src/ftinspect.cpp (faceRequester): Check font index. + Updated. + (Engine::Engine): Updated. + (Engine::numberOfFaces, Engine::numberOfNamedInstances, + Engine::loadFont, Engine::removeFont): Rewritten. + (MainGUI::loadFonts, MainGUI::closeFont, MainGUI::showFont, + MainGUI::adjustGlyphIndex, MainGUI::checkCurrentFaceIndex, + MainGUI::checkCurrentNamedInstanceIndex): + Simplified. + (MainGUI::nextFace, MainGUI::nextNamedInstance, MainGUI::drawGlyph, + MainGUI::setDefaults): Updated. + +2016-05-15 Werner Lemberg + + [ftinspect] Minor issues. + + * src/ftinspect.cpp (Engine::loadFont): More readable code. + (MainGUI::showFont): Remove no longer needed argument. + Updated. + (MainGUI::checkCurrentFontIndex, MainGUI::checkCurrentFaceIndex, + MainGUI::checkCurrentNamedInstanceIndex): Minor generalization. + + * src/ftinspect.h (MainGUI): Updated. + +2016-05-15 Werner Lemberg + + [ftinspect] Replace face ID hash with a map. + + We need this for later changes that will rely on ordered data. + + * src/ftinspect.cpp (FaceID::operator==): Replace with... + (FaceID::operator<): ... this method. + (qHash): Removed. + (faceRequester, Engine::loadFont, Engine::removeFont, + MainGUI::closeFont, MainGUI::showFont): Updated. + + * src/ftinspect.h (FaceID): Updated. + (Main): Rename member `faceIDHash' to `faceIDMap'. + +2016-05-15 Werner Lemberg + + [ftinspect] More variable and function renamings. + + Mainly for consistency. + + * src/ftinspect.cpp (faceRequester): s/faceID/ftcFaceID/, + s/id/faceID/. + (Engine::numberOfFaces): s/result/numFaces/. + (Engine::numberOfNamedInstances): s/result/numNamedInstances/. + (Engine::loadFont): s/instanceIndex/namedInstanceIndex/. + (Engine::removeFont): s/face_id/ftcFaceID/, + s/instanceIndex/namedInstanceIndex/. + (MainGUI::showFont): s/numberOfFaces/currentNumberOfFaces/, + s/numberOfNamedInstances/currentNumberOfNamedInstances/. + Updated. + (MainGUI::checkCurrentFaceIndex): + s/numberOfFaces/currentNumberOfFaces/. + (MainGUI::checkCurrentInstanceIndex): Renamed to... + (MainGUI::checkCurrentNamedInstanceIndex): ...this. + s/numberOfNamedInstances/currentNumberOfNamedInstances/. + Updated. + (MainGUI::nextFace): s/numberOfFaces/currentNumberOfFaces/. + (MainGUI::nextInstance): Renamed to... + (MainGUI::nextNamedInstance): ... this. + s/numberOfNamedInstances/currentNumberOfNamedInstances/. + (MainGUI::previousInstance): Renamed to... + (MainGUI::previousNamedInstance): ...this. + (MainGUI::createLayout, MainGUI::createConnections, + MainGUI::setDefaults): Updated. + + * src/ftinspect.h (Engine): Updated. + (MainGUI): s/nextInstanceButton/nextNamedInstanceButton/ + s/previousInstanceButton/previousNamedInstanceButton/. + +2016-05-14 Werner Lemberg + + [ftinspect] Remove file watching. + + This approach doesn't work well. A new, improved implementation + will follow. + + * src/ftinspect.h (Engine): Remove `currentFontFileInfo', + `currentFontFileDate', `maxRetries', and `currentRetry'. + Updated. + (MainGUI): Remove `timer'. + Updated. + + * src/ftinspect.cpp (Engine::watchCurrentFont): Removed. + (Engine::loadFont, Engine::update): Updated. + (MainGUI::MainGUI): Updated. + (MainGUI::watchCurrentFont): Removed. + (MainGUI::createConnections): Updated. + +2016-05-14 Werner Lemberg + + [ftinspect] Variable renaming. + + * src/ftinspect.cpp, src/ftinspect.h (FaceID): + s/instanceIndex/namedInstanceIndex/. + +2016-05-12 Werner Lemberg + + [ftinspect] Variable renamings. + + For consistency. + + * src/ftinspect.cpp, src/ftinspect.h: s/numFaces/numberOfFaces/, + s/numNamedInstancesList/numberOfNamedInstancesList/, + s/numNamedInstances/numberOfNamedInstances/, + s/currentInstanceIndex/currentNamedInstanceIndex/. + s/currentNumGlyphs/currentNumberOfGlyphs/. + +2016-05-12 Werner Lemberg + + [ftinspect] Display more glyph and font information. + + * src/ftinspect.cpp (Engine::loadFont): Update `curFamilyName' and + `curStyleName'. + (Engine::currentFamilyName, Engine::currentStyleName, + Engine::glyphName): New methods. + + (MainGUI::closeFont, MainGUI::showFont, MainGUI::adjustGlyphIndex, + MainGUI::createLayout): Updated. + + * src/ftinspect.h (Engine): New members `curFamilyName' and + `curStyleName'. + Updated. + (MainGUI): New `fontFilenameLabel', `fontNameLabel', and + `glyphNameLabel' members. + Use `QGridLayout' for `infoRightLayout'. + +2016-05-12 Werner Lemberg + + [ftinspect] Fix logical mistakes in font navigation. + + * src/ftinspect.cpp (Engine::Engine): Initialize `ftSize'. + (MainGUI::showFont): Don't let exceed indices the number of + available index values if `preserveIndices' is active. + Always call `engine->loadFont' even for invalid fonts so that + various font-global variables are set correctly. + +2016-05-11 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.cpp, src/ftinspect.h: s/Instances/NamedInstances/. + Also display `Previous/Next Named Instance' on the buttons. + +2016-05-11 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.cpp, src/ftinspect.h: s/fonts/fontList/. + +2016-05-11 Werner Lemberg + + [ftinspect] Display glyph index. + + * src/ftinspect.cpp (MainGUI::createLayout): Add `infoLeftLayout' + and `infoRightLayout' at the top of the window; add + `glyphIndexLabel' to the right. + (MainGUI::adjustGlyphIndex): Set text for `glyphIndexLabel' + (MainGUI::setDefaults): Call `adjustGlyphIndex'. + + * src/ftinspect.h: Updated. + +2016-05-11 Werner Lemberg + + [ftinspect] Only use integer values for size if units are px. + + * src/ftinspect.cpp (MainGUI::checkUnits): Implement it. + (MainGUI::createLayout): Updated. + +2016-05-11 Werner Lemberg + + [ftinspect] Add file watching; remove watch button. + + * src/ftinspect.cpp (Engine::loadFont): Initialize file info. + (Engine::watchCurrentFont): New method. + (Engine::update): Updated. + (MainGUI::MainGUI): Set up timer. + (MainGUI::showFont): Add parameter to control updating of current + indices. + (MainGUI::watchCurrentFont): New method. + (MainGUI::createLayout): Remove watch button code. + (MainGUI::createConnections): Handle timer. + + * src/ftinspect.h (Engine): Add `currentFontFileInfo', + `currentFontDateTime', `maxRetries', and `currentRetry'. + Updated. + (MainGUI): Updated. + +2016-05-10 Werner Lemberg + + * src/ftinspect.cpp, src/ftinspect.h (MainGUI): Provide `aboutQt'. + + This removes a warning at start-up. + +2016-05-10 Werner Lemberg + + [ftinspect] Display rendered glyph bitmaps. + + * src/ftinspect.cpp (Engine::update): Updated. + (GlyphBitmap::GlyphBitmap, GlyphBitmap::~GlyphBitmap, + GlyphBitmap::boundRect, GlyphBitmap::paint): New methods + for constructing a rendered bitmap of the glyph. + (MainGUI::checkAntiAliasing): Updated. + (MainGUI::setGraphicsDefaults): Create color mapping tables for 8bit + and 1bit pixmaps as needed by Qt. + (MainGUI::drawGlyph): Honor `show bitmap' check box. + (MainGUI::createLayout, MainGUI::setDefaults): Updated. + (MainGUI::createConnections): Handle `showBitmapCheckBox'. + + * src/ftinspect.h (GlyphBitmap): New class, derived from + `QGraphicsItem'. + (MainGUI): Mew member `currentGlyphBitmapItem'. + New members `grayColorTable' and `monoColorTable'. + Updated. + (Engine): Remove unused `showBitmap' member. + +2016-05-10 Werner Lemberg + + [ftinspect] Make hinting mode selection work. + + * src/ftinspect.cpp (Engine::loadFont): Set font type. + (Engine::setCFFHintingMode, Engine::setTTInterpreterVersion): New + methods. + (MainGUI::showFont): Updated. + (MainGUI::checkHinting): Gray out hinting mode combo box items + depending on font type. + (MainGUI::checkHintingMode): Implemented. + (MainGUI::checkAutoHinting): Updated. + (MainGUI::setDefaults): Updated. + + * src/ftinspect.h: Include some internal FreeType header files. + (Engine): New member `fontType'. + New enumeration `FontType'. + Updated. + (MainGUI): New members `currentCFFHintingMode' and + `currentTTInterpreterVersion'. + + * ftinspect.pro (DEFINES): Add `FT2_BUILD_LIBRARY' to enable access + to internal FreeType headers. + +2016-05-10 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.cpp, src/ftinspect.h: Rename `point indices' to + `point numbers'. + +2016-05-10 Werner Lemberg + + [ftinspect] Display glyph point numbers. + + * src/ftinspect.cpp (GlyphPointNumbers::GlyphPointNumbers, + GlyphPointNumbers::boundRect, GlyphPointNumbers::paint): New methods + for constructing the set of glyph point numbers. + (MainGUI::drawGlyph): Honor `glyph point indices' check box. + (MainGUI::createLayout): Updated. + (MainGUI::createConnections): Handle `showPointIndicesCheckBox'. + + * src/ftinspect.h (GlyphPoints): New class, derived from + `QGraphicsItem'. + (MainGUI): Mew member `currentGlyphPointNumbersItem'. + Updated. + +2016-05-09 Werner Lemberg + + [ftinspect] Display glyph points. + + Also fix other minor issues. + + * src/ftinspect.cpp (GlyphPoints::GlyphPoints, + GlyphPoints::boundRect, GlyphPoints::paint): New methods for + constructing the set of glyph points. + (MainGUI::checkShowPoints, MainGUI::setGraphicsDefaults): Updated. + (MainGUI::drawGlyph): Honor `glyph outlines' and `glyph points' + check boxes. + (MainGUI::createLayout): Updated. + (MainGUI::createConnections): Handle `showOutlinesCheckBox'. + + (GlyphOutline::GlyphOutline): Improve computation of bounding + rectangle. + (Engine::update): Updated. + + * src/ftinspect.h (Engine): Remove unused members which are handled + in MainGUI. + (GlyphPoints): New class, derived from `QGraphicsItem'. + (MainGUI): Mew member `currentGlyphPointsItem'. + +2016-05-09 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.cpp, src/ftinspect.h: s/loadGlyph/loadOutline/. + s/Glyph/GlyphOutline/. + s/drawGlyphOutline/drawGlyph/. + +2016-05-09 Werner Lemberg + + [ftinspect] Display glyphs outlines. + + * src/ftinspect.cpp (Engine::loadGlyph): New method. + (moveTo, lineTo, conicTo, cubicTo): New wrapper functions for + `QPainterPath' methods. + (outlineFuncs): New structure, used as an interface to + `FT_Outline_Decompose'. + (Glyph::Glyph, Glyph::boundRect, Glyph::paint): New methods for + constructing a glyph object. + (MainGUI::drawGlyphOutline): New method. + (MainGUI::showFont, MainGUI::checkUnits, MainGUI::adjustGlyphIndex, + MainGUI::createLayout): Updated. + (MainGUI::createConnections): Handle `sizeDoubleSpinBox' and + `dpiSpinBox'. + + * src/ftinspect.h (Engine): Updated. + (Glyph): New class, derived from `QGraphicsItem'. + (MainGUI): New member `currentGlyphOutlineItem'. + Updated. + +2016-05-09 Werner Lemberg + + [ftinspect] Fix a bunch of glitches. + + * src/ftinspect.cpp (FaceID::FaceID): Initialize members with `-1'. + While not needed, it better indicates an invalid lookup in the hash + for debugging purposes. + (Engine::Engine): Don't call `update' here, since + `MainGUI::setDefaults' wasn't called yet. + (Engine::loadFont): Call `update'. + Return -1 for an invalid face ID. + (Engine::removeFont): Properly handle invalid face ID. + (Engine::update): Fix code reversal for pixels vs. points. + (MainGUI::MainGUI): Initialize `engine'. + (MainGUI::closeFont): First remove the font, then the face ID. + Handle invalid font also. + (MainGUI::showFont): Handle invalid font also. + (MainGUI::setGraphicsDefaults): Set width of outline pen. + +2016-05-08 Werner Lemberg + + [ftinspect] Display axes. + + * src/ftinspect.cpp (Grid::Grid): Add second parameter to pass axis + pen. + (Grid::paint): Add axes. + Increase grid size. + (Grid::boundingRect):Updated. + (MainGUI::createLayout): Updated. + + * src/ftinspect.h: Updated. + +2016-05-08 Werner Lemberg + + [ftinspect] Display grid. + + The dimensions are still arbitrary, though. + + We now need Qt 4.6 or newer. + + * src/ftinspect.h (Engine): Remove `zoom' member. It doesn't belong + here. + (Grid): New class, derived from `QGraphicsItem'. We need this to + disable drawing of the grid if the zoom factor is too small. + (MainGUI): Add a `QGraphicsScene' member. + Add a `zoom' method. + + * src/ftinspect.cpp (Engine::update): Updated. + (Grid::Grid, Grid::boundingRect, Grid::paint): New methods. + (MainGUI::createLayout): Initialize `glyphView' and `glyphScene'; + add a grid object. + Change zoomSpinBox to display an integer zoom factor instead of a + percentage. This simplifies code since we don't have to bother with + scaling values < 1. + (MainGUI::createConnections, MainGUI::setDefaults): Updated. + +2016-05-08 Werner Lemberg + + [ftinspect] Provide some drawing pens. + + * src/ftinspect.h (MainGUI): Provide colored pens for axes, blue + zones, grid lines, on and off points, outlines, and segment lines. + + * src/ftinspect.cpp (MainGUI::setGraphicsDefaults): New method. + (MainGUI::MainGUI): Updated. + +2016-05-07 Werner Lemberg + + [ftinspect] Make glyph navigation work. + + * src/ftinspect.cpp (MainGUI::showFont): Don't use local variable. + (MainGUI::adjustGlyphIndex): New method. + (MainGUI::createConnections): Use `QSignalMapper' class to map all + navigation button signals to a single receiver function (namely + `adjustGlyphIndex'). + (MainGUI::setDefaults): Updated. + + * src/ftinspect.h (MainGUI): New `currentGlyphIndex' member. + Updated. + +2016-05-07 Werner Lemberg + + [ftinspect] Really load fonts. + + * src/ftinspect.cpp (Engine::loadFont, Engine::removeFont): New + methods. + (Engine::update): Set font-independent scaler values. + (MainGUI::closeFont): Remove font ID from hash and font from cache. + (MainGUI::showFOnt): Call `loadFont'. + (MainGUI::setDefaults): Set initial value of `faceCounter' to 1 to + circumvent a FreeType buglet. + + * src/ftinspect.h (Engine): New `scaler' and `ftSize' members. + Updated. + (MainGUI): New member `currentNumGlyphs'. + +2016-05-07 Werner Lemberg + + * src/ftinspect.cpp (MainGUI::showFont): Another logic fix. + +2016-05-07 Werner Lemberg + + [ftinspect] s/maxFaces/faceCounter/. + + * src/ftinspect.cpp, src/ftinspect.h: Do it. + +2016-05-07 Werner Lemberg + + [ftinspect] Another try to implement `faceRequester'. + + * src/ftinspect.h (FaceID): Extend structure to make it suitable as + key to Qt's `QHash' class. + (qHash): Also needed for `QHash'. + (MainGUI): Provide running ID number in `maxFaces'. + New `faceIDHash' to map between (font,face,instance) index triplets + and IDs. + + * src/ftinspect.cpp (FaceID::FaceID, FaceID::operator==, qHash): + Implement. + (faceRequester): Use `faceIDHash'. + (MainGUI::showFont): Fill `faceIDHash'. + (MainGUI::setDefaults): Updated. + +2016-05-06 Werner Lemberg + + * src/ftinspect.cpp (MainGUI::showFont): Fix logic. + +2016-05-06 Werner Lemberg + + [ftinspect] Simplify code. + + * src/ftinspect.cpp (MainGUI::createConnections, + MainGUI::createActions): Use `connect' variant that doesn't need + `this' parameter. + +2016-05-06 Werner Lemberg + + [ftinspect] Compute load flags for `FT_Load_Glyph'. + + * src/ftinspect.cpp (Engine::update): Compute `doHinting' and + `doAutoHinting', and `loadFlags'. + + * src/ftinspect.h (Engine): Updated. + +2016-05-06 Werner Lemberg + + [ftinspect] Add general hinting check button. + + * src/ftinspect.cpp (MainGUI::checkHinting): New method. + (MainGUI::createLayout, MainGUI::createConnections, + MainGUI::setDefaults): Updated. + (MainGUI::checkAutoHinting): Also handle `hintingModeLabel'. + + * src/ftinspect.h: Updated. + +2016-05-06 Werner Lemberg + + [ftinspect] More gamma slider settings. + + * src/ftinspect.cpp (MainGUI::createLayout): Set gamma slider tick + intervals. + + (MainGUI::setDefaults): Set default value for gamma slider. + Also move other spin box default values to this function. + +2016-05-06 Werner Lemberg + + [ftinspect] Handle LCD filter change. + + * src/ftinspect.cpp (MainGUI::checkLcdFilter): New method. + (MainGUI::setDefaults): Set up LCD filter mapping. + Call `checkLcdFilter'. + (MainGUI::createConnections): Register `checkLcdFilter'. + + * src/ftinspect.h (MainGUI): Updated. + +2016-05-06 Werner Lemberg + + [ftinspect] Indent `show point indices' check box. + + * src/ftinspect.cpp (MainGUI::createLayout): Implement it. + + * src/ftinspect.h: Updated. + +2016-05-06 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.cpp (MainGUI::checkAutoHinting): Fix logic for + warping check box. + +2016-05-06 Werner Lemberg + + [ftinspect] Add check box for auto-hinting. + + This allows easier hinting mode switch than having it in the hinting + mode combo box. + + * src/ftinspect.cpp (MainGUI::checkAutoHinting): New method, + containing almost stuff from ... + (MainGUI::checkHintingMode): Updated. + (MainGUI::createLayout): Updated; we also indent check boxes + dependent on auto-hinting. + (MainGUI::createConnections, MainGUI::setDefaults): Updated. + + * src/ftinspect.h: Updated. + (HintingModes): Remove `HintingMode_AutoHinting' enum value. + +2016-05-06 Werner Lemberg + + [ftinspect] Disable unavailable items in anti-aliasing combo box. + + * src/ftinspect.h (MainGUI): Make `setDefaults' public. + (hintingModesTrueTypeHash, hintingModesCFFHash): New maps. + (hintingModesAlwaysDisabled): New list. + + * src/ftinspect.cpp (MainGUI::setDefaults): Set up mappings between + GUI enumerations and FreeType property values. + + Use them to create `hintingModesAlwaysDisabled', a list of enum + values that gets fed to the anti-alias combo box's `setItemDisabled' + method. + (MainGUI::MainGUI): Don't call `setDefaults' + here but... + (main): ... here, after FreeType initialization. + +2016-05-05 Werner Lemberg + + [ftinspect] Handle engine properties. + + * src/ftinspect.cpp (Engine::Engine): Handle CFF's `hinting-engine', + TrueType's `interpreter-version', and the auto-hinter's `warping' + properties. + + * src/ftinspect.h (Engine): Updated. + +2016-05-05 Werner Lemberg + + [ftinspect] Start implementation of `showFont'. + + * src/ftinspect.cpp (MainGUI::loadFonts): Call `showFont'. + (MainGUI:closeFont): Fix logic and call `showFont'. + (MainGUI::showFont): New method. Doesn't display something yet, but + font navigation buttons are fully functional now. + (MainGUI::previousFont, MainGUI::nextFont, MainGUI::previousFace, + MainGUI::nextFace, MainGUI::previousInstance, + MainGUI::nextInstance): Call `showFont'. + + * src/ftinspect.h (MainGUI): Updated. + +2016-05-05 Werner Lemberg + + [ftinspect] Add methods to get number of faces and instances. + + * src/ftinspect.cpp (Engine::numFaces, Engine::numInstances): New + methods. + + * src/ftinspect.h (Engine): Updated. + +2016-05-05 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.cpp (faceRequester): Use reference. + (MainGUI::loadFonts): Simplify. + +2016-05-05 Werner Lemberg + + [ftinspect] Make `MainGUI' and `Engine' classes more symmetric. + + Also avoid `const' issues. + + * src/ftinspect.h (Engine): Add `gui' field. + Updated. + (MainGUI): Don't use `const' for `engine'. + Updated. + + * src/ftinspect.cpp (Engine::Engine, Engine::update): Updated. + (MainGUI::update, main): Updated. + +2016-05-04 Werner Lemberg + + [ftinspect] Add buttons for instances. + + * src/ftinspect.cpp (MainGUI::checkCurrentInstanceIndex, + MainGUI::previousInstance, MainGUI::nextInstance): New methods. + (MainGUI::createLayout): Updated. We now use a grid layout for the + font buttons. + (MainGUI::createConnections, MainGUI::setDefaults): Updated. + + * src/ftinspect.h: Updated. + +2016-05-04 Werner Lemberg + + [ftinspect] Redesign font handling. + + At this early stage, it's not always clear to me how to do things + correctly, so here's another try. + + * src/ftinspect.h (Font): Redesigned, using a list of + instance numbers. + (FaceID): New structure, for communication with the face requester. + (Engine): We need the `MainGUI' structure for initializing the face + requester. + (MainGUI): Make `faceRequester' a friend. + Replace string list `fontFileNames' with `fonts', which is a list of + `Font' elements. + Add `currentInstanceIndex'. + + * src/ftinspect.cpp (faceRequester): Replace dummy code with + something more serious. + (Engine::Engine, Engine::update): Updated. + (MainGUI::loadFonts, MainGUI::closeFont, + MainGUI::checkCurrentFontIndex, MainGUI::checkCurrentFaceIndex, + MainGUI::nextFont, MainGUI::nextFace): + Updated to use new `fonts' member. + (MainGUI::setDefaults, main): Updated. + +2016-05-04 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.h, src/ftinspect.cpp: + s/checkCurrentFontFileIndex/checkCurrentFontIndex/, + s/currentFontFileIndex/currentFontIndex/. + +2016-05-04 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.h (Engine): Add destructor. + (MainGUI): Use point to `engine'. + + * src/ftinspect.cpp (Engine::~Engine): Implement. + (MainGUI::update): Updated. + +2016-05-04 Werner Lemberg + + [ftinspect] Better intertwine `Engine' and `MainGUI'. + + * src/ftinspect.cpp (MainGUI::update): New method. + (main): Use it. + + * src/ftinspect.h (Engine): Make it a friend of `MainGUI'. + (MainGUI): New member `engine'. + Updated. + +2016-05-04 Werner Lemberg + + * src/ftinspect.cpp (MainGUI::loadFonts): Improve logic. + +2016-05-04 Werner Lemberg + + [ftinspect] Make `previous face' and `next face' button logic work. + + It still does nothing, though. + + * src/ftinspect.h (MainGUI): New slots `checkCurrentFaceIndex', + `previousFace, and `nextFace'. + New members `numFaces' and `currentFaceIndex'. + + * src/ftinspect.cpp + (MainGUI::checkCurrentFaceIndex, MainGUI::previousFace, + MainGUI::nextFace): New methods. + (MainGUI::createConnections): Register connections for + `previousFaceButton' and `nextFaceButton'. + (MainGUI::setDefaults): Updated. + +2016-05-04 Werner Lemberg + + * src/ftinspect.cpp (MainGUI::checkCurrentFontFileIndex): Fix logic. + +2016-05-04 Werner Lemberg + + [ftinspect] Add buttons for faces. + + * src/ftinspect.cpp (MainGUI::createLayout): New buttons for + `previous face' and `next face'; they are put into a separate row + (`fontLayout') together with the buttons for `previous font' and + `next font'. + s/fontSizeLayout/sizeLayout/. + + * src/ftinspect.h: Updated. + +2016-05-04 Werner Lemberg + + [ftinspect] Don't use size in pixels for navigation buttons. + + Instead, derive the width from the displayed text. + + * src/ftinspect.h (QPushButtonx): New class, derived from + `QPushButton'. + + * src/ftinspect.cpp (QPushButtonx::QPushButtonx): New constructor. + (MainGUI::createLayout): Use `QPushButtonx' for navigation buttons. + +2016-05-03 Werner Lemberg + + [ftinspect] Make `previous font' and `next font' button logic work. + + * src/ftinspect.h (MainGUI): New slots `checkCurrentFontFileIndex', + `previousFont, and `nextFont'. + + * src/ftinspect.cpp + (MainGUI::checkCurrentFontFileIndex, MainGUI::previousFont, + MainGUI::nextFont): New methods. + (MainGUI::createConnections): Register connections for + `previousFontButton' and `nextFontButton'. + (MainGUI::loadFonts, MainGUI::closeFont, MainGUI::setDefaults): + Updated. + +2016-05-03 Werner Lemberg + + [ftinspect] Add file dialogs. + + * src/ftinspect.h: Include some more Qt headers. + (MainGUI): Add `fontFileNames' and `currentFontFileIndex'. + Add actions to load and close font files. + + * src/ftinspect.cpp (MainGUI::loadFonts, MainGUI::closeFont): New + methods. + (MainGUI::createActions, MainGUI::createMenus, + MainGUI::setDefaults): Updated. + +2016-05-03 Werner Lemberg + + [ftinspect] Better code. + + * src/ftinspect.h (QComboBoxx): New class, derived from `QComboBox'; + we add one method `setItemEnabled' to enable (or disable) an item + with a given index. + (MainGUI): Use `QComboBoxx' for `antiAliasingComboBoxx' (was: + `antiAliasingComboBox') and `hintingModeComboBoxx' (was: + `hintingModeComboBox'). + Update all users. + + * src/ftinspect.cpp (MainGUI::checkHintingMode): Simplified. + (QComboBoxx::setItemEnabled): New method. + +2016-05-03 Werner Lemberg + + [ftinspect] Start with FreeType initialization. + + * src/ftinspect.h: Include some FreeType headers. + (Font): New structure for holding a (physical) font. + (Engine): New class for communication with FreeType library. + (MainGUI): Make `engine' a friend. + + * src/ftinspect.cpp (faceRequester): New function for FreeType's + cache manager. + (Engine::Engine, Engine::update): Some basic functions; to be + extensively revised in later commits. + (main): Updated. + + * src/ftinspect.pro: Add support for FreeType and dependent + libraries. Right now, you have to adjust paths manually. + +2016-05-02 Werner Lemberg + + [ftinspect] Minor. + + * src/ftinspect.h, src/ftinspect.cpp: + s/showBitmapsCheckBox/showBitmapCheckBox/. + +2016-05-02 Werner Lemberg + + [ftinspect] Adjust layout. + + * src/ftinspect.cpp (MainGUI::createLayout): Move size, dpi, and + zoom stuff one row down. + s/fontLayout/fontSizeLayout/. + + * src/ftinspect.h: Updated. + +2016-05-02 Werner Lemberg + + [ftinspect] Add DPI control. + + * src/ftinspect.cpp (MainGUI::createLayout): Add `unitsComboBox' to + select between px and pt. + Add `dpiLabel' and `dpiSpinBox' to select the DPI value. + (MainGUI::checkUnits): New function. + (MainGUI::createConnections, MainGUI::setDefaults): Updated. + + * src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Some more GUI initialization defaults. + + * src/ftinspect.cpp (MainGUI::setDefaults): Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Avoid parameters for signal functions. + + This makes the code a bit more elegant. + + * src/ftinspect.cpp (MainGUI::checkHintingMode, + MainGUI::checkAntiAliasing): Implement. + (MainGUI::createConnections, MainGUI::setDefaults): Updated. + + * src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Rename some enum values. + + * src/ftinspect.cpp, src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Provide dummy default values for GUI initialization. + + * src/ftinspect.cpp (MainGUI::setDefaults): Set some values. + +2016-05-01 Werner Lemberg + + [ftinspect] Add signal for showPointsCheckBox. + + * src/ftinspect.cpp (MainGUI::checkShowPoints): New function. + (MainGUI::createConnections): Add signal. + + * src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Add signal for antiAliasingComboBox. + + * src/ftinspect.cpp (MainGUI::checkAntiAliasing): New function. + (MainGUI::createConnections): Add signal. + + * src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Refine signal for hintingModeComboBox. + + * src/ftinspect.cpp (MainGUI::checkHintingMode): Grey out `slight' + hinting item in antiAliasingComboBox if not in auto-hinting mode. + Also set a different anti aliasing value for this case if `slight' + was the current value. + + * src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Add signal for hintingModeComboBox. + + Also fix typo `hortizontal' -> `horizontal'. + + * src/ftinspect.cpp (MainGUI::checkHintingMode): New function. + (MainGUI::createConnections): Add signal. + + * src/ftinspect.h: Updated. + +2016-05-01 Werner Lemberg + + [ftinspect] Improve combo box setup. + + * src/ftinspect.h (MainGUI): New enums `AntiAliasing', + `HintingModes', and `LCDFilter'. + + * src/ftinspect.cpp (MainGUI::createLayout): Use new enums to set + items in combo boxes. + Also simplify computation of maximum width. + +2016-04-30 Werner Lemberg + + * src/ftinspect.cpp (MainGUI::createLayout): Fix memory leak. + +2016-04-30 Werner Lemberg + + [ftinspect] A new Qt based variant for ftgrid. GUI draft only. + + The idea is to eventually integrate the functionality of ftview, + ftkern, and ftdiff also. + + The code compiles fine with both Qt4 and Qt5; it doesn't do anything + yet beyond showing how the GUI looks like. + + * src/ftinspect.cpp, src/ftinspect.h: New source code files. + + * src/ftinspect.pro: New qmake input file. + +2016-04-08 Werner Lemberg + + [ftview] Avoid hangs with bitmap only fonts. + + Problem reported by Hin-Tak Leung . + + * src/ftview.c (Render_Text, Render_Waterfall): Escape loop if not a + single glyph could be rendered. + +2016-03-18 Werner Lemberg + + * graph/x11/rules.mk (X11_LIB): Also append `/lib64'. + +2016-03-02 Werner Lemberg + + [ftgrid] Use colors for dot numbers. + + We now have bitmap rendering also, and black numbers on a black + background are ... not optimal. + + * src/ftgrid.c (grid_status_draw_outline): Implement it. + +2016-03-01 Werner Lemberg + + [ftgrid] Exchange movement directions of `i' and `k' keys. + + This synchronizes the actions with its descriptions in the help + screen. + + * src/ftgrid.c (Process_Event): Implement it. + +2016-03-01 Werner Lemberg + + * src/ftgrid.c (grid_status_draw_outline): Fix memory leak. + +2016-02-21 Alexei Podtelezhnikov + + [ftgrid] Touch up. + + * src/ftgrid.c (status): Initialize `header' as NULL to display font + name initially. Use bits of new field `work' to control... + (grid_status_draw_outline, main, Process_Event): Updated accordingly. + * src/ftgrid.1: Updated. + +2016-02-21 Werner Lemberg + + * src/ftgrid.c (event_grid_zoom): Make zoom up always work. + +2016-02-21 Alexei Podtelezhnikov + + [ftgrid] Enable LCD filtering. + + * src/ftgrid.c (event_lcd_filter_change): New function. + (status, main, Process_Event, event_help): Updated. + +2016-02-20 Alexei Podtelezhnikov + + [ftgrid] Improve stroked path appearance. + + * src/ftgrid.c (grid_status_draw_outline): Hint scaled outline to + follow gridlines and cover entire pixels. + +2016-02-20 Alexei Podtelezhnikov + + [ftgrid] Display monochrome and LCD bitmaps. + + * src/ftgrid.c (grid_status_draw_outline): Rework to use... + (bitmap_scale): New function that implements bitmap scaling. + +2016-02-13 Alexei Podtelezhnikov + + [graph] Actually clear cache when full. + + * graph/gblender.c (gblender_lookup, gblender_lookup_channel): + Updated. + +2016-02-12 Alexei Podtelezhnikov + + [ftgrid] Display rendered bitmap (new feature). + + * src/ftgrid.c (status): New field to control new feature. + (grid_status_draw_outline): Implement new feature here. + (Process_Event, usage): Updated. + +2016-02-10 Alexei Podtelezhnikov + + * src/ftgrid.c (grid_status_draw_outline): Use simpler line join. + +2016-02-10 Alexei Podtelezhnikov + + [ftgrid] Use fixed-point scale and integer origin. + + * src/ftgrid.c (status): Change field types. + (grid_status_init, grid_status_rescale_initial, grid_status_draw_grid, + grid_hint_draw_segment, grid_status_draw_outline): Updated. + +2016-02-07 Werner Lemberg + + * Version 2.6.3 released. + ========================= + + + Tag sources with `VER-2-6-3'. + + * README: Updated. + * src/*.1: Updated. + +2016-02-04 Alexei Podtelezhnikov + + * src/ftcommon.c (FTDemo_String_Draw): Typo. + +2016-02-02 Alexei Podtelezhnikov + + * src/ftgrid.c, src/ftview.c, src/testname.c: Remove math.h. + +2016-02-02 Alexei Podtelezhnikov + + [ftgrid] Fix dot position and shape. + + * src/ftgrid.c (circle_draw): Correct subpixel positioning. + (ft_outline_new_circle): Correct circle approximation. + +2016-02-01 Nikolaus Waxweiler + + [ftview] Fix toggling of `force auto-hinter' in light mode. + + Light mode does not imply auto-hinter anymore. + + * src/ftview.c (Process event) <'f'>: Update code. + +2016-01-17 Alexei Podtelezhnikov + + * src/ftdiff.c (render_state_init): Update default LCD filter. + +2016-01-14 Werner Lemberg + + Don't use macro names that start with `_[A-Z]' or contain `__'. + + Such macro names are reserved for both C and C++. + + * *.h: Harmonize ID macros so that file `foo.h' uses `FOO_H_'. + * *.c: s/_Translator/Translator_'. + + * graph/x11/grx11.c (gr_x11_surface_init): + s/_NET_WM_PID/NET_WM_PID/. + * src/ftdiff.c: Replace structure names `_foo' with `foo_'. + +2016-01-13 Alexei Podtelezhnikov + + [ftview] Cycle through available LCD filtering. + + * src/ftview.c (status, Process_Event): Implement cycle through + `FT_LcdFilter'. + +2016-01-11 Alexei Podtelezhnikov + + * src/ftview.c (status, Process_Event): Update default LCD filter. + +2016-01-09 Alexei Podtelezhnikov + + [ftgamma] Provide alternative pattern. + + * src/ftgamma.c (do_ptrn, GammaPtrn): Implement slightly slanted + anti-aliased lines. + (Process_Event, event_help, main): Updated. + * src/ftgamma.1: Updated. + +2016-01-04 Alexei Podtelezhnikov + + [ftgamma] Enable color. + + * src/ftgamma.c (Render_GammaGrid): Split into... + (Render_Bitmap): ... this renderer with color controls. + (GammaGrid): ... and this grayscale bitmap builder. + (event_color_change): New function. + (Process_Event, event_help, main): Updated. + * src/ftgamma.1: Updated. + +2015-12-22 Alexei Podtelezhnikov + + [ftgamma] Minor refactoring. + + * src/ftgamma.c (Render_GammaGrid): Move labels from here... + (main): ... to here. + +2015-12-20 Alexei Podtelezhnikov + + Relocate gamma grid display from [ftview] to [ftgamma]. + + * src/ftview.c (Process_Event): Remove event `G'. + (event_help): Update. + (event_gamma_grid): Move to... + * src/ftgamma.c (event_gamma_grid): ... here. + (Process_Event): New function. + (event_help): New function. + (main): Update to handle events. + +2015-12-18 Alexei Podtelezhnikov + + [ftstring, ftview] Auxiliary gamma rounding fixes. + + * src/ftstring.c (event_gamma_change): Updated. + * src/ftview.c (event_gamma_grid): Updated. + +2015-12-18 Alexei Podtelezhnikov + + * graph/gblender.c (gblender_set_gamma_table): Rounding, formatting. + +2015-12-15 Werner Lemberg + + * src/ftgamma.c (do_fill): Fix compiler warning. + +2015-12-14 Alexei Podtelezhnikov + + [ftgamma] Modernize appearance. + + * src/ftgamma.c: Major renovations. + * src/ftgamma.1: Update. + +2015-12-10 Werner Lemberg + + * src/ftcommon.c (FTDemo_Install_Font): Handle alloc/file errors. + + Problem reported by Alexei. + +2015-12-09 Alexei Podtelezhnikov + + * src/ftstring.c (event_angle_change): Wrap angle differently. + +2015-12-07 Alexei Podtelezhnikov + + [ftstring] Miscellaneous updates. + + * src/ftstring.c (event_gamma_change): Do not report gamma updates. + (write_header): Permanently display gamma. + (gamma_ramp_draw): Brighten the curve. + +2015-12-06 Alexei Podtelezhnikov + + [graph] Small improvements. + + * graph/gblender.h (GBLENDER_SHADE_INDEX): Round to nearest grid. + * graph/gblender.c (gblender_lookup, gblender_lookup_channel): Minor. + +2015-12-05 Alexei Podtelezhnikov + + [graph] Unravel blending, part 2. + + * graph/gblender.c (gblender_reset_key, gblender_reset_channel_key): + Set alpha grid values explicitly. + +2015-12-03 Alexei Podtelezhnikov + + [graph] Unravel blending. + + * graph/gblender.c (gblender_reset_key, gblender_reset_channel_key): + Entrust optimizations to modern compilers, remove unused variables. + +2015-11-30 Werner Lemberg + + [graph] Initialize local variables after checking channel change. + + This fixes a crash if foreground color == background color. + + Problem reported by Alexei. + + * graph/gblender.h (GBLENDER_VARS): Split off initialization to... + (GBLENDER_VARS_SET): ...this new macro. + (GBLENDER_CHANNEL_VARS): Split off initialization to... + (GBLENDER_CHANNEL_VARS_SET): ...this new macro. + + * graph/gblcolor.h, graph/gblhbgr.h, graph/gblhrgb.h, + graph/gblvbgr.h, graph/gblvrgb.h: Updated. + +2015-11-29 Alexei Podtelezhnikov + + * graph/gblender.c (gblender_clear): Fix typo. + +2015-11-29 Alexei Podtelezhnikov + + * src/fttimer.c (main): Remove unused variable. + +2015-11-28 Alexei Podtelezhnikov + + * src/ftcommon.c (FTDemo_Display_Clear): Speed up. + +2015-11-28 Werner Lemberg + + * Version 2.6.2 released. + ========================= + + + Tag sources with `VER-2-6-2'. + + * README: Updated. + * src/*.1: Updated. + +2015-11-25 Alexei Podtelezhnikov + + [ftstring, ftview] Small clean-ups. + + * src/ftstring.c (event_lcdmode_change): Robustify the switch. + * src/ftview.c (write_header): Ditto. + +2015-11-25 Werner Lemberg + + * src/ftstring.c: Fix compilation warnings. + +2015-11-24 Alexei Podtelezhnikov + + [ftstring] Enable sub-pixel rendering. + + * src/ftstring.c (event_lcdmode_change): New function. + (Process_Event): New event to change LCD mode. + (event_help): Offer it. + (main): Select light LCD filter. + +2015-11-22 Alexei Podtelezhnikov + + * src/ftstring.c (main): Move gamma curve in the background. + +2015-11-22 Alexei Podtelezhnikov + + [ftstring] Enable changing display color. + + * src/ftstring.c (event_color_change): New function. + (Process_Event) [grKeySpace]: New event to change color. + (event_help): Offer it. + (main): Updated. + * src/ftstring.1: Updated. + +2015-11-22 Alexei Podtelezhnikov + + [ftstring] Use shared `grSetGlyphGamma'. + + * src/ftcommon.h (FTDemo_String_Context): Remove `gamma_ramp'. + * src/ftcommon.c (apply_gamma_ramp): Remove. + (FTDemo_String_Draw): Do not apply gamma correction here. + * src/ftstring.c (event_gamma_change): Call `grSetGlyphGamma' here. + (main): Switch from gray to rgb24; update. + +2015-11-22 Alexei Podtelezhnikov + + [ftstring] Remove gamma toggle. + + * src/ftstring.c (event_help, Process_Event): Updated. + +2015-11-21 Alexei Podtelezhnikov + + Copy-paste typos. + + * src/ftstring.1: Updated. + * src/ftstring.c: Updated. + +2015-11-19 Alexei Podtelezhnikov + + Cosmetic improvements. + + * src/ftdiff.c (write_global_info): Do not display zero gamma. + * src/ftgrid.c (event_gamma_change): Ditto. + * src/ftview.c (write_header): Ditto. + +2015-11-12 Alexei Podtelezhnikov + + * graph/gblender.c (gblender_reset_key): Fix typo. + +2015-11-12 Alexei Podtelezhnikov + + Define and use GAMMA. + + * src/ftcommon.h (GAMMA): Define new macro. + * src/ftdiff.c (adisplay_init): Use it. + * src/ftgrid.c (grid_status_init): Use it. + * src/ftstring.c (status): Use it. + * src/ftview.c (status): Use it. + +2015-11-11 Alexei Podtelezhnikov + + [ftdiff,ftgrid] Default to gamma = 1.8. + + * src/ftcommon.c (FTDemo_Display_New): Do not set gamma. + * graph/grblit.c (gr_glyph_gamma): Updated. + * src/ftdiff.c (adisplay_init): Updated. + * src/ftgrid.c (grid_status_init): Updated. + +2015-11-06 Alexei Podtelezhnikov + + [graph] Minor sRGB accuracy update. + + * graph/gblender.c (gblender_set_gamma_table): Updated. + +2015-11-06 Alexei Podtelezhnikov + + [ftview,ftstring] Default to gamma = 1.8. + + * src/ftview.c (status): Updated. + * src/ftstring.c (status, main): Updated. + +2015-10-16 Werner Lemberg + + Don't use `aux' as a file name. + + This should be avoided under Windows. + Problem reported by Dave Arnold . + + * src/aux.c, src/aux.h: Renamed to... + * src/output.c, src/output.h: ... these file names. + + * Makefile, src/ftdump.c, src/ftgrid.c: Updated. + +2015-10-04 Werner Lemberg + + * Version 2.6.1 released. + ========================= + + + Tag sources with `VER-2-6-1'. + + * README: Updated. + * src/*.1: Updated. + +2015-09-13 Werner Lemberg + + * Makefile (FT_H): Updated to recent directory changes (#45954). + + The patch is taken from the anonymous Savannah bug report. + +2015-08-13 Werner Lemberg + + [ftcommon] Support named instances of GX variation fonts. + + * src/ftcommon.c (FTDemo_Install_Font): Add inner loop for named + instances. + +2015-08-05 Werner Lemberg + + [ftgrid] Avoid invalid left-shift of negative values. + + * src/ftgrid.c (grid_status_draw_outline): Don't use left-shift but + multiplication. + +2015-08-04 Werner Lemberg + + * src/ftmulti.c (main): Fix double-free in case of invalid font. + +2015-07-08 Werner Lemberg + + [ftcommon] Improve loading of font collections. + + * src/ftcommon.c (FTDemo_Install_Font): Don't exit if first face of + a font is invalid. + Don't exit if we want outline fonts only and the first face isn't. + Don't exit if there are problems with the cmap. + + In all three cases, simply skip the font face. + +2015-06-07 Werner Lemberg + + * Version 2.6 released. + ======================= + + + Tag sources with `VER-2-6'. + + * README: Updated. + * src/*.1: Updated. + + * Makefile: Omit a zero patch level in computation of `version'. + +2015-06-06 Werner Lemberg + + [ftgrid] Key `D' now toggles display of point numbers. + + * src/ftgrid.c: Include FT_TRIGONOMETRY_H. + (GridStatusRec): Add field `do_dotnumbers'. + (grid_status_init): Updated. + (grid_status_draw_outline): Implement point number display. + (event_help): Updated. + (Process_Event): Handle `D' key. + (main): Updated. + +2015-04-22 Werner Lemberg + + * src/ftdiff.c (process_event): Add missing `break' statement. + +2015-04-21 Werner Lemberg + + [ftview] Key `w' now toggles warper (if compiled-in). + + * src/ftview.c (status): Add `warping' field. + (event_help): Updated. + (event_warping_change): New function. + (Process_Event): Handle `w' key. + (write_header, main): Updated. + +2015-04-21 Werner Lemberg + + [ftgrid] Key `w' now toggles warper (if compiled-in). + + This replaces the no longer existing debugging hook with a generic + solution that uses the `warping' auto-hinter module property. + + * src/ftgrid.c (_af_debug_disable_warper): Removed. + (GridStatusRec): s/do_warp/warping/. + (grid_status_init, grid_status_draw_outline, event_help): Updated. + (event_warping_change): New function. + (Process_Event): Handle `w', not `W', and use + `event_warping_change'. + (main): Updated. + +2015-04-21 Werner Lemberg + + [ftdiff] Key `w' now toggles warper (if compiled-in). + + * src/ftdiff.c (render_mode_names): Updated. + (ColumnStateRec): Add `warping' field. + (render_state_init, render_state_draw, event_help): Updated. + (process_event): Handle `w' key. + +2015-04-19 Werner Lemberg + + [ftdiff] Correctly reload face after changing hinting engine. + + In most cases, calling `FT_Property_Set' acts globally on the + FT_Library object. + + * src/ftdiff.c (RenderStateRec): Remove `need_rescale', since we + always rescale now after reloading the face. + Update all users. + (render_state_set_face_index): New function. + (render_state_set_file): Remove `idx' argument. Instead, (re)load + font with index `state->face_index'. + (render_state_draw): Call `render_state_set_file'. + (event_change_face_index): New function. + (process_event): s/render_state_set_file/event_change_face_index/. + (main): Updated. + +2015-04-18 Werner Lemberg + + [ftgrid] Show advance width. + + * src/ftgrid.c (grid_status_draw_outline): Display vertical line at + advance width position. + +2015-04-16 Werner Lemberg + + [ftgrid] Key `W' now toggles warper (if compiled-in). + + * src/ftgrid.c [FT_DEBUG_AUTOFIT]: New extern variable + `_af_debug_disable_warper'. + (GridStatusRec): Add `do_warp' member. + (grid_status_init): Updated. + (grid_status_draw_outline): Set `_af_debug_disable_warper'. + (event_help): Updated. + (Process_Event): Handle `W' key. + +2015-04-16 Werner Lemberg + + [ftgrid] Make blue zone toggling actually work. + + * src/ftgrid.c (grid_status_draw_outline) [FT_DEBUG_AUTOFIT]: Set + `_af_debug_disable_blue_hints'. + +2015-04-16 Werner Lemberg + + * src/ftgrid.c (Process_Event) <' '>: Don't reset debugging flags. + +2015-04-16 Werner Lemberg + + [ftgrid] Cycle through AA rendering modes with F5 and F6. + + * src/ftgrid.c (event_lcd_mode_change): New function. + (Process_Event) [FT_DEBUG_AUTOFIT]: Enable debug stuff for light AA + mode also. + Handle `F5' and `F6' keys. + (event_help): Updated. + +2015-04-14 Werner Lemberg + + [ftgrid] Fix memory leak. + + * src/ftgrid.c (event_font_change): Free `status.mm' before calling + `FT_Get_MM_Var' (again). + +2015-04-14 Werner Lemberg + + [ftgrid] Show proper names for GX axes. + + * src/ftgrid.c: Include `aux.h', FT_SFNT_NAMES_H, and + FT_TRUETYPE_IDS_H. + (GridStatusRec): Add `axis_name' array. + (event_font_change): Set GX axis name if possible. + (write_header): Use `axis_name' if non-NULL. + (main): Add clean-up code for `axis_name' array. + +2015-04-14 Werner Lemberg + + [aux] Add functions for outputting strings. + + * src/aux.c (hexdigit): New static array. + (put_ascii_string, put_ascii_string_size, put_unicode_be16_string, + put_unicode_be16_string_size): New functions. + (put_ascii, put_unicode_be16): Use new functions to implement it. + + * src/aux.h: Updated. + +2015-04-14 Werner Lemberg + + Move some output functions to a separate file. + + * src/aux.c, src/aux.h: New files, holding `put_ascii' and + `put_unicode_be16' from... + * src/ftdump.c: ... this file, which now includes `aux.h'. + + * Makefile (COMMON_OBJ): Add `aux.c'. + Fix rule. + +2015-04-11 Werner Lemberg + + [ftbench] Check unscaled advance widths also. + + * src/ftbench.c (main) : Add test. + +2015-04-05 Werner Lemberg + + [ftdump] Simplify code. + + * src/ftdump.c (put_unicode_be16_as_utf8): Fold into... + (put_unicode_be16): This function, with an additional argument. + Update all callers. + +2015-04-03 Werner Lemberg + + [ftdump] Remove dead code. + + * src/ftdump.c (debug, trace_level): Remove. + (usage): Remove #ifdef'ed code. + (main): Don't handle obsolete options `-d' and `-l'. + Remove #ifdef'ed code. + +2015-04-03 Werner Lemberg + + [ftdump] Add option `-u' to emit data in UTF-8 encoding. + + * src/ftdump.c (utf8): New global variable. + (usage): Updated. + (put_unicode_be16): Only emit characters < 0x80 as-is. + (put_unicode_be_as_utf8): New function. + (Print_Sfnt_Names, Print_MM_Axes): Use it. + (main): Handle new option `-u'. + + * src/ftdump.1: Updated. + +2015-04-02 Werner Lemberg + + [ftmulti] Make the first six axes accessible. + + We now use keys F1-F6 and 1-6. F7 and F8 get its original function + back (this is, adjusting the glyph index by 10). + + * src/ftmulti.c (MAX_MM_AXES): New macro. Replaces `T1_MAX_MM_AXIS' + everywhere. + (Render_All): Adjust vertical position depending on number of axes. + (Help): Updated. + (Process_Event): Handle new keys. + (main): Use two lines for axes if we have more than three. + +2015-04-01 Werner Lemberg + + [ftgrid] Fix minor memory leak. + + * src/ftgrid.c (GridStatusRec): Add `stroker' field. + (grid_status_draw_outline): Updated. + (main): Call `FT_Stroker_Done'. + +2015-03-30 Werner Lemberg + + [ftdump] Show proper names for GX axes. + + * src/ftdump.c (Print_MM_Axes): Try to find and display English + versions of the GX axis names (stored in the `name' table) instead + of 4-letter tags. + +2015-03-29 Werner Lemberg + + [ftgrid, ftmulti]: Handle GX fonts with more than 4 axes. + + ftgrid now handles up to 32 axes, while ftmulti will ignore all axes + but the first four. + + * src/ftgrid.c (MAX_MM_AXES): New macro. + (GridStatusRec): New field `used_num_axis'. + (event_axis_change, event_font_change, Process_Event): Use it. + + * src/ftmulti.c (used_num_axis): New global variable. + (Process_Event, main): Use it. + +2015-03-29 Werner Lemberg + + [ftdump] Display info about MM axes. + + * src/ftdump.c: Include FT_MULTIPLE_MASTERS_H. + (Print_MM_Axes): New function. + (main): Use it. + +2015-03-19 Werner Lemberg + + [ftdump] Various minor improvements. + + * src/ftdump.c (name_id): Handle WWS entries also. + Return NULL for not pre-defined entries. + (put_ascii): Display characters >= 0x80 as hex escape sequence. + (Print_Sfnt_Names): Improve output. + +2015-03-11 Werner Lemberg + + Update to latest FreeType library changes. + + * src/ftcommon.c: s/FT_XFREE86_H/FT_FONT_FORMATS_H/. + (my_face_requester): s/FT_Get_X11_Font_Format/FT_Get_Font_Format/. + +2015-03-07 Werner Lemberg + + * src/ftvalid.c: Various minor compiler warning fixes. + +2015-03-07 Werner Lemberg + + * src/ftview.c: Various minor compiler warning fixes. + + * src/ftcommon.c, src/ftcommon.h (FTDemo_Draw_Index): Change type of + `gindex' to unsigned. + +2015-03-07 Werner Lemberg + + * src/ftstring.c: Various minor compiler warning fixes. + +2015-03-07 Werner Lemberg + + [ftmulti] Various minor compiler warning fixes. + + * src/ftmulti.c: Fix signedness issues. + Add `static' keyword where appropriate. + (CENTER_X, CENTER_Y, autorun, use_grays, raster_buff, FLOOR, CEIL, + TRUNC): Removed. Unused. + +2015-03-06 Werner Lemberg + + [ftgrid] Various minor compiler warning fixes. + + * src/ftgrid.c: Fix signedness issues. + (event_axis_change, event_font_change): Avoid variable shadowing. + (CEIL, X_TOO_LONG, Y_TOO_LONG): Removed. Unused. + +2015-03-06 Werner Lemberg + + * src/ftgamma.c: Various minor compiler warning fixes. + +2015-03-06 Werner Lemberg + + [ftcommon] Various minor compiler warning fixes. + + * src/ftcommon.c: Fix signedness issues. + (my_face_requester): Remove dead code. + (FTDemo_Install_Font): Protect against stream failure. + (string_render_prepare): Add `static' keyword. + * src/ftcommon.h: Updated. + +2015-03-05 Werner Lemberg + + * src/ftdiff.c: Various minor compiler warning fixes. + +2015-03-05 Werner Lemberg + + [graph] Many compiler warning fixes. + + * graph/*, graph/x11/*: Fix signedness issues. + Unified handling of unused variables. + Add `static' keyword where appropriate. + Include `foo.h' into `foo.c' where appropriate. + + * graph/grobjs.c, graph/grobjs.h (grRealloc): Removed. Unused. + +2015-03-04 Werner Lemberg + + [ttdebug] Various compiler warning fixes. + + * src/ttdebug.c: Decorate global variables/functions with `static'. + Signedness fixes. + (main): Protect various command line arguments against invalid + values. + +2015-03-04 Werner Lemberg + + * src/ftlint.c: Various minor compiler warning fixes. + +2015-03-04 Werner Lemberg + + * src/ftdump.c: Various minor compiler warning fixes. + +2015-03-04 Werner Lemberg + + [ftbench] Various compiler warning fixes. + + * src/ftbench.c: Decorate global variables/functions with `static'. + Signedness fixes. + (main): Protect various command line arguments against invalid + values. + +2015-03-03 Werner Lemberg + + [ftgrid] Add support for MM (and GX) fonts. + + F2 selects the axis, F3 and F4 change the axis value. + + The new code is adapted from `ftmulti.c'. + + * src/ftgrid.c: Include FT_MULTIPLE_MASTERS_H. + (GridStatusRec): Add `mm', `design_pos', and `current_axis' fields. + (grid_status_init): Initialize new fields. + (event_help): Updated. + (event_axis_change): New function. + (event_font_change): Handle MM data. + (Process_Event): Handle new keys. + (write_header, main): Updated. + +2015-03-03 Werner Lemberg + + [ftgrid] Less verbose header line. + + * src/ftgrid.c (BUFSIZE): New macro. + (GridStatusRec, event_help): Use it. + (write_header): Use it. + Emit more compact header line. + +2015-03-03 Werner Lemberg + + * src/ftmulti.c (main): Always display 1/100ths for axis values. + +2015-03-03 Werner Lemberg + + [ftmulti] Use F1-F8 keys to handle four axes. + + Previously, we used F1 for help and F3-F8 for three axes. + + * src/ftmulti.c (Process_Event): Implement. + (Help): Updated. + +2015-03-03 Werner Lemberg + + Recommend `?' instead of `F1' for help. + + Usually, both `F1' and `?' map to the help screen. However, not all + display managers provide the F1 key to the application. + + * src/ftdiff.c (main), src/ftgrid.c (main), src/ftmulti.c (main), + src/ftstring.c (main), src/ftview.c (main): Apply. + +2014-12-30 Werner Lemberg + + * Version 2.5.5 released. + ========================= + + + Tag sources with `VER-2-5-5'. + + * README: Updated. + * src/*.1: Updated. + + * Makefile (dist): Fix typos. + +2014-12-11 Werner Lemberg + + * Makefile (dist): Use older POSIX standard for `tar'. + + Apparently, BSD tar isn't capable yet of handling POSIX-1.2001 + (contrary to GNU tar), so force the POSIX-1.1988 format. + + Problem reported by Stephen Fisher . + +2014-12-06 Werner Lemberg + + * Version 2.5.4 released. + ========================= + + + Tag sources with `VER-2-5-4'. + + * README: Updated. + * src/*.1: Updated. + +2014-11-22 Werner Lemberg + + Show FreeType version in demo program help screens. + + * src/ftdiff.c (event_help), src/ftgrid.c (event_help), + src/ftmulti.c (Help), src/ftstring.c (event_help), src/ftview.c + (event_help): Implement it. + +2014-05-11 Werner Lemberg + + Fix Savannah bug #42182. + + * src/ttdebug.c (main): Fix typos. + +2014-03-06 Werner Lemberg + + * Version 2.5.3 released. + ========================= + + + Tag sources with `VER-2-5-3'. + + * README: Updated. + * src/*.1: Updated. + +2014-03-04 Werner Lemberg + + * Makefile (LINK_LIBS) [unixdev]: Don't use pkg-config for bzip2. + + Not all platforms have `bzip2.pc'. We also add `-lz' just for + completeness. + +2014-01-30 Werner Lemberg + + [ftbench] Allow `-s 0' for better testing of FT_LOAD_NO_SCALE. + + * src/ftbench.c (main) <'s'>: Don't alter value 0. + Don't call `FT_Set_Pixel_Sizes' for size == 0. + Don't call tests for size == 0 that need valid scaling factors. + (usage): Updated. + (benchmark): Return meaningful timer value for error-only calls. + (test_embolden): Enable test. I think there is no longer a reason + to not run it. + + * src/ftbench.1: Updated. + +2014-01-28 Werner Lemberg + + * src/ftgrid.c (grid_status_rescale_initial): Avoid NaN values. + Remove forgotten debug message. + +2014-01-28 Werner Lemberg + + * graph/grblit.c (grBlitGlyphToBitmap): Don't crash on empty glyphs. + Problem reported by Dave Arnold . + +2014-01-03 Werner Lemberg + + [ftgrid] Show (some) blue zones. + + * src/ftgrid.c (af_glyph_hints_get_segment_offset): Update + prototype. + (GridStatusRec): New member `blue_color'. + (grid_status_display): Change `on' color to red. + Set `blue' color. + (grid_hint_draw_segment): Show associated blue zones. + (event_help): Updated. + +2014-01-03 Werner Lemberg + + [ftgrid] Minor. + + * src/ftgrid.c (GridStatusRec): Rename `conic_color' to `off_color'. + Remove unused `cubic_color' member. + (grid_status_display, grid_status_draw_outline): Updated. + +2013-12-22 Werner Lemberg + + * Makefile (LINK_LIBS) [unixdev]: Use pkg-config to get link flags. + + This corresponds to a similar change in current FreeType to link + with HarfBuzz in development mode. + +2013-12-08 Werner Lemberg + + * Version 2.5.2 released. + ========================= + + + Tag sources with `VER-2-5-2'. + + * README: Updated. + * src/*.1: Updated. + +2013-11-27 Werner Lemberg + + [ftgrid] Fix compilation in non-debug mode. + + * src/ftgrid.c: Guard autofit dump functions with FT_DEBUG_AUTOFIT + clause. + Update prototypes. + (grid_hint_draw_segment): Guard with FT_DEBUG_AUTOFIT clause. + (grid_status_draw_outline): Guard call to `grid_hint_draw_segment' + with FT_DEBUG_AUTOFIT clause. + (Process_Event) <'1'>, <'2'>, <'3'>: Don't mess around with trace + levels, which should always stay internal to the FreeType library. + Update calls to dump functions. + +2013-11-25 Werner Lemberg + + * Version 2.5.1 released. + ========================= + + + Tag sources with `VER-2-5-1'. + + * README: Updated. + * src/*.1: Updated. + +2013-11-21 Werner Lemberg + + [ftgrid] Make keys `1', `2', and `3' work again. + + * src/ftgrid.c (Process_Event) <'1'>, <'2'>, <'3'>: Set + `trace_afhints' trace level to value 7 temporarily since the autofit + dumping functions use `FT_TRACE7' since 2012-07-06. + +2013-11-21 Werner Lemberg + + [ftgrid] Fix compilation with C++. + + * src/ftgrid.c (_af_debug_*): Add `extern' keyword. + +2013-11-20 Werner Lemberg + + Increase file path size. + + * src/compos.c (main), src/ftchkwd.c (main), src/ftdump.c (main), + src/ftlint.c (main), src/ftmemchk.c (main), src/ftsbit.c (main), + src/fttimer.c (main), src/fttry.c (main): Increase array size of + `filename' and `alt_filename' to 1024. + +2013-11-13 Werner Lemberg + + * Makefile (FT_H): Update to new header layout of FreeType. + +2013-11-05 Werner Lemberg + + [ttdebug] Improve display of point tags. + + * src/ttdebug.c (old_tag_to_new): Removed, no longer used. + (display_changed_points, show_points_table): Display tags with + mnemonic characters instead of ORed numbers. + (RunIns) <'h'>: Updated. + +2013-11-05 Werner Lemberg + + [ttdebug] Enable debugging of composite glyphs (again). + + This was lost while improving key handling. + + * src/ttdebug.c (RunIns): Introduce variable `really_leave' to + insert one stop before really leaving the current glyph range. + Without that, inspecting the current data right after finishing the + hinting of a subglyph wouldn't be possible. + (main): Stay in loop even if `FT_Load_Glyph' returns zero. + +2013-11-04 Werner Lemberg + + [ttdebug] Provide man page and compile program by default. + + * Makefile (EXES): Add `ttdebug'. + + * src/ttdebug.1: New file. + +2013-11-01 Werner Lemberg + + [ttdebug] Make `B' emit a function backtrace. + + This needs the today's version of the FreeType library. + + * src/ttdebug (RunIns) <'h'>: Updated. + <'B'>: Print backtrace. + +2013-11-01 Werner Lemberg + + [ttdebug] Make `p' set a breakpoint at previous position. + + * src/ttdebug.c (RunIns): Store information about last position in + `last_IP' and `last_range'. + <'h'>, <'c'>, <'f'>, <'n'>, <'s'>: Updated. + <'p'>: Set breakpoint at previous instruction. + +2013-10-31 Werner Lemberg + + [ttdebug] Minor. + + * src/ttdebug.c: Make full-sentence messages where appropriate. + (RunIns): Make help screen more compact vertically. + +2013-10-31 Werner Lemberg + + [ttdebug] Make `b' set a breakpoint. + + * src/ttdebug.c (Breakpoint): New structure. + (RunIns): Handle breakpoint. + <'h'>, <'c'>, <'f'>, <'n'>: Updated. + <'b'>: Set breakpoint. + +2013-10-31 Werner Lemberg + + [ttdebug] Improve help; add key `h' to show it. + + * src/ttdebug.c (RunIns) <'?'>: Update and redesign help screen. + <'h'>: Same as key `?'. + (main): Show version string and help info at start-up. + +2013-10-31 Werner Lemberg + + [ttdebug] Make key `R' restart the debugger. + + * src/ttdebug.c (Restart): New macro. + (RunIns) <'Q'>: Set `pedantic_hinting' flag. + <'R'>: Set error to `Restart'. + (main): Add loop. + +2013-10-30 Werner Lemberg + + [ttdebug] Make key `f' finish current function. + Change old `f' key to `F'. + + * src/ttdebug.c (RunIns) + <'f'>: Renamed to ... + <'F'>: ... this. + <'f'>: Loop until current function is finished. + <'?'>: Updated. + +2013-10-28 Werner Lemberg + + Add manual pages. + Originally contributed (but heavily modified) by Nis Martensen + . + + * src/ftbench.1, src/ftdiff.1, src/ftdump.1, src/ftgamma.1, + src/ftgrid.1, src/ftlint.1, src/ftmulti.1, src/ftstring.1, + src/ftvalid.1, src/ftview.1: New files. + +2013-10-28 Werner Lemberg + + [ftbench, ftmulti, ftvalid] Improve and correct usage output. + + This commit also changes key mappings in ftvalid ('L' -> 'l', 'v' -> + 'V'), adds option -v to display the version, and removes dead code. + + * src/ftbench.c (bench_desc): Fix typo. + + * src/ftmulti.c (usage): Do it. + + * src/ftvalid.c (validators, print_usage): Do it. + (main): Updated. + +2013-10-27 Werner Lemberg + + * src/ttdebug.c (main, RunIns): Fix memory leaks. + +2013-10-26 Werner Lemberg + + [ttdebug] Display storage are data; key 'S' shows all of them. + + * src/ttdebug.c (Storage): New structure. We need to handle storage + area data specially since we have to make a distinction between + initialized and uninitialized values. + (handle_WS): New function. Since it is not necessary for the + bytecode interpreter to trace whether a value is uninitialized or + not, we have to do it manually right before every debugging step. + (RunIns): After executing a step, storage area data different to + before is displayed. + <'?'>: Help updated. + <'S'>: Show storage area data. + <'c'>, <'s'>, <'n'>: Call `handle_WS'. + +2013-10-26 Werner Lemberg + + [ttdebug] Fix code range detection. + + * src/ttdebug.c (RunIns): The `code_range' string identifies the + code range where `RunIns' has been called, so it's best to use it + throughout the code for this purpose. + <'C'>, <'P'>, <'S'>: Updated accordingly. + (show_points_table): Updated accordingly. + +2013-10-25 Werner Lemberg + + [ttdebug] Display CVT data; key `C' shows all Control Values. + + * src/ttdebug.c (RunIns): New array `save_cvt'. + After executing a step, CVT data different to before is displayed. + <'C'>: Show CVT data. + <'?'>: Help updated. + +2013-10-25 Werner Lemberg + + [ttdebug] Change some key assignments from lowercase to uppercase. + + * src/ttdebug.c (RunIns) <'v'>: Use 'V' instead. + <'g'>: Use 'G' instead. + <'p'>: Use 'P' instead. + <'t'>: Use 'T' instead. + <'q'>: Use 'Q' instead. + <'?'>: Help updated. + +2013-10-25 Werner Lemberg + + * src/ttdebug.c (RunIns) <'n'>: Handle ranges correctly. + +2013-10-16 Werner Lemberg + + * src/ttdebug.c (RunIns): Handle `Enter' key correctly. + +2013-10-16 Werner Lemberg + + [ttdebug] Display twilight data; key `t' shows twilight point table. + + * src/ttdebug.c (display_changed_points, show_points_table): Pass + flag for twilight zone and handle it accordingly. + (RunIns): Track twilight data. + Handle key `t'. + Update help. + +2013-10-16 Werner Lemberg + + [ttdebug] Some refactorization. + + * src/ttdebug.c (display_changed_points, show_points_table): New + functions, extracted from... + (RunIns): ... this one. + +2013-10-16 Werner Lemberg + + * src/ttdebug.c: s/save/save_pts/. + +2013-10-16 Werner Lemberg + + [ttdebug] Display improvements. + + * src/ttdebug.c (exec): Removed, unused. + (RunIns): Increase size of `temp' buffer. + Display negative hex numbers. + Correctly display hex numbers with more than 4 digits. + (RunIns) <'g'>: Display interpreter version. + +2013-10-09 Werner Lemberg + + * src/ftview.c (Render_Waterfall): Avoid `%n' in `snprintf'. + + MSVC disables this by default, and compilation would fail otherwise. + +2013-09-28 Dave Arnold + + * src/ftdiff.c (Process_Event) <'H'>: Fix typo. + + If FT_DEBUG_AUTOFIT is false, then the command `H' had a side-effect + of decrementing the glyph index. + +2013-09-23 Werner Lemberg + + [ftdiff] Improve text display at small sizes. + + * src/ftdiff.c (render_state_draw): Loop over the text. This also + avoids problems if the .notdef character has zero width (for + whatever reasons). + +2013-07-21 Behdad Esfahbod + + * src/ftcommon.c (FTDemo_Index_To_Bitmap): Add BGRA support. + +2013-07-21 Werner Lemberg + + * graph/rules.mk (GRAPH_H): Add missing files. + +2013-07-21 Behdad Esfahbod + + * src/ftcommon.c (FTDemo_Index_To_Bitmap): Remove unneeded code. + +2013-07-21 Behdad Esfahbod + + [graph] Fix BGRA blending. + + * graph/gblbgra.h: Simplify and correct blending operation. + +2013-07-20 Werner Lemberg + + Fix Savannah bug #39537. + + */* s/FALSE/0/, s/TRUE/1/. + +2013-07-20 Werner Lemberg + + Improve font loading. + + In particular, avoid a crash in ftgrid for fonts without outlines. + + * src/ftcommon.c (FTDemo_Install_Font): Provide argument to load + fonts with outlines only. + * src/ftcommon.h, src/ftview.c, src/ftstring.c: Updated. + * src/ftgrid.c (main): Updated. + Emit warning message for skipped fonts. + +2013-07-05 Werner Lemberg + + [ftbench] Be more verbose in reporting results. + + * src/ftbench.c (benchmark): Indent trace output. + (usage): Minor improvement. + (main): Add some option value guards. + Print information on test setup. + +2013-07-02 Werner Lemberg + + [ftbench] Improve `usage' text. + + * src/ftbench.c (default_hinting_engine, + default_interpreter_version): New global variables. + (usage): Improve text for `-H' and `-f'. + (main): Updated. + +2013-06-26 Werner Lemberg + + [ftgrid] Implement CFF and TTF engine change support. + + Key `H' toggles this. + + * src/ftgrid.c: Include FT_MODULE_H, FT_INTERNAL_OBJECTS_H, + FT_INTERNAL_DRIVER_H, FT_CFF_DRIVER_H, and FT_TRUETYPE_DRIVER_H. + (N_CFF_HINTING_ENGINES): Define macro. + (GridStatusRec): Add `cff_hinting_engine' and + `tt_interpreter_version'. + (event_help): New layout similar to ftview. + (event_cff_hinting_engine_change, + event_tt_interpreter_version_change): New functions. + (Process_Event): Extend handling of `H' key. + (main): Get default properties of CFF and TTF drivers. + +2013-06-26 Werner Lemberg + + * src/ftview.c (event_help): Mention `q' and `ESC' keys. + +2013-06-19 Werner Lemberg + + * Version 2.5.0 released. + ========================= + + + Tag sources with `VER-2-5-0'. + + * README: Updated. + +2013-06-12 Werner Lemberg + + [ftbench] Allow arbitrary sizes. + + * src/ftbench.c (main): Remove size limit. + +2013-06-10 Werner Lemberg + + [ftview] Use key `K' for toggling small cache. + + Key `C' is already in use. + + * src/ftview.c (Process_Event) <'C'>: Replace with... + <'K'>: This key. + Add missing `break'. + (event_help): Updated. + +2013-06-09 Werner Lemberg + + [ttdebug] Add command `f' to select number format. + + * src/ttdebug.c (use_float): New global variable. + (RunIns): Add `f' key to toggle between floating and fixed point + number formats. + Update all affected print commands. + +2013-06-09 Werner Lemberg + + [ttdebug] Add command `l', improve help and output. + + * src/ttdebug.c (RunIns): Display message if entering a new code + range. + Improve output of `?' and `p' keys. + Add `l' key to show last bytecode instruction. + +2013-06-09 Werner Lemberg + + [ttdebug] Add command line option `-H' to select hinting engine. + + * src/ttdebug.c: Include FT_TRUETYPE_DRIVER_H. + (default_version, alternative_version): New global variables. + (Usage): Updated. + (main): Handle option `-H'. + +2013-06-09 Werner Lemberg + + [ftview] Fix cache handling. + + * src/ftview.c (event_cff_hinting_engine_change, + event_tt_interpreter_version_change): Reset the cache to flush the + glyph image cache. Otherwise, the cache lookup functions get + confused since info about module properties is not stored in the + glyph cache nodes. + +2013-06-03 Werner Lemberg + + [ftview, ftdiff, ftbench] Update CFF and TT property handling. + + * src/ftbench.c (main): Make option `-H' use the non-default + properties and warning if there is a problem. + + * src/ftdiff (render_state_init): At startup, use default + properties. + (process_event) <'H'>: Do nothing if non-default `hinting-engine' + property is not available. + + * src/ftview.c (event_cff_hinting_engine_change): Do nothing if + non-default `hinting-engine' property is not available. + (Process_Event) <'H'>: Updated. + (main): At startup, use default properties. + +2013-05-22 Behdad Esfahbod + + Add support for color glyphs. + + In ftview, key `c' toggles color, while use of sbits cache is now + mapped to key `C'. + + The premultiplied bgra blending is still off. + + * graph/gblany.h (_gblender_blit_bgra_): New template. + * graph/graph.h (grPixelMode): Add gr_pixel_mode_bgra. + * graph/gblblit.h (GBlenderSourceFormat): Add GBLENDER_SOURCE_BGRA. + * graph/gblblit.c (gblender_blit_init): Handle GBLENDER_SOURCE_BGRA. + * graph/grblit.c (grBlitGlyphToBitmap): Updated. + * graph/gblbgra.h: New header file. + + * src/ftcommon.h (FTDemo_Handle): New member `color'. + * src/ftcommon.c (FTDemo_New, FTDemo_Update_Current_Flags): Updated. + (FTDemo_Glyph_To_Bitmap): Handle FT_PIXEL_MODE_BGRA. + + * src/ftview.c (Process_Event) <'c'>: Handle color. + <'C'>: Handle sbits cache. + (help): Updated. + (write_header): Updated. + + * Makefile (LINK_LIBS): Add -lpng. + +2013-05-17 Werner Lemberg + + [ftview, ftdiff, ftbench] Support `interpreter-version' property. + + * src/ftbench.c: Include FT_TRUETYPE_DRIVER_H. + (usage): Updated. + (main): Update `-H' option. + + * src/ftdiff.c: Include FT_TRUETYPE_DRIVER_H. + s/hinting_engine/cff_hinting_engine/. + (ColumnStateRec): Add `tt_interpreter_version' member. + (render_state_init, render_state_draw): Updated. + (event_help): Updated. + (process_event) <'H'>: Handle new property. + + * src/ftview.c: Include FT_TRUETYPE_DRIVER_H. + s/hinting_engine/cff_hinting_engine/. + s/HINTING_ENGINES/CFF_HINTING_ENGINES/. + (status): Add `tt_interpreter_version' member. + (event_tt_interpreter_version_change): New function. + (Process_Event) <'H'>: Use it. + (write_header): Updated. + (main): Set default value for `interpreter-version'. + +2013-05-13 Sebastien Bacher + + * src/ftview.c (write_header): Fix uninitialized variables. + +2013-05-08 Werner Lemberg + + * Version 2.4.12 released. + ========================== + + + Tag sources with `VER-2-4-12'. + + * README: Updated. + + * src/x11/grx11.c: s/read/lread/, s/write/lwrite/ where appropriate + to avoid variable shadow warnings. + +2013-05-03 Werner Lemberg + + [ftbench] New command line option `-H' to select Adobe's CFF engine. + + * src/ftbench.c: Include FT_MODULE_H and FT_CFF_DRIVER_H. + (main): Handle `H' key. + (usage): Updated. + +2013-04-27 Werner Lemberg + + [ftview] Don't show encoding in `text' and `waterfall' modes. + + Those two modes always use UTF-8 (or rather, they use + FTDemo_Get_Index). + + * src/ftview.c (write_header): Implement it. + +2013-04-26 Werner Lemberg + + [ftview] Allow engine change for non-hinted modes also. + + This is useful to demonstrate the stem darkening of the Adobe's CFF + engine. + + * src/ftview.c (Process_Event) <'H'>, (write_header): Adjust + conditions. + +2013-04-23 Werner Lemberg + + [ftview] Improve waterfall and text mode. + + * src/ftview.c (status): New member `topleft'. + (Text): Convert string to UTF-8 encoding. Now the whole string is + displayed again. + (Render_Stroke, Render_Slanted, Render_Embolden, Render_All): Set + `status.topleft' to the first offset which gets really displayed. + (Render_Text, Render_Waterfall): Set `status.topleft' to the first + offset which gets really displayed. + If characters from the `Text' string have been exhausted, start + again from the beginning. + (write_header): Always assume UTF-8 encoding for displaying header + in `text' and `waterfall' modes. + +2013-04-23 Werner Lemberg + + [ftview] Rename some variables. + + * src/ftview.c (status): s/font_index/font_idx/. + s/Num/offset/. + s/Fail/num_fails/. + s/fw_index/fw_idx/. + Update all callers. + (Render_Stroke, Render_Slanted, Render_Embolden, Render_All, + Render_Text, Render_Waterfall): s/first_index/offset/. + (event_index_change): s/old_Num/old_offset/. + (write_header): s/gindex/glyph_idx/. + +2013-04-20 Werner Lemberg + + [ftdiff] New `x' key to toggle layout modes. (cbox vs. adv. width). + + Using the advance width is the new default. + + * src/ftdiff.c (ColumnStateRec): New member `use_cboxes'. + (render_state_init): Updated. + (render_state_draw): Use advance width instead of the maximum x + value of the cbox if `use_cboxes' is set to 0. + (event_help): Updated. + (process_event): Handle `x' key. + +2013-04-18 Werner Lemberg + + [ftdiff] Implement key `H' to select CFF hinting engine. + + * src/ftdiff.c: Include FT_CFF_DRIVER_H. + Include FT_MODULE_H, FT_INTERNAL_OBJECTS_H, and + FT_INTERNAL_DRIVER_H. + (HINTING_ENGINE_MAX): New macro. + (ColumnStateRec): New member `hinting_engine'. + (render_state_init): Updated. + (render_state_draw): Select hinting engine. + Display hinting engine if we have CFF font. + (event_help): Updated. + (process_event): Handle `H' key. + + * Makefile (ftdiff.$(SO)): Enable inclusion of internal header + files. + +2013-04-17 Werner Lemberg + + Support display of no anti-aliasing, no hinting. + + * src/ftcommon.c (FTDemo_Update_Current_Flags): Handle this by + setting FT_LOAD_MONOCHROME for this combination. + +2013-04-17 Werner Lemberg + + [ftview] Be more intelligent in updating the display. + + This improves readability of tracing messages. + + * src/ftview.c (event_bold_change, event_change_radius, + event_slant_change, event_size_change, event_index_change, + event_font_change): Return update status. + (Process_Event): Update display only if an event causes a change. + +2013-04-17 Werner Lemberg + + [ftview] Minor GUI improvements. + + * src/ftview.c (event_hinting_engine_change, + event_render_mode_change): Simplify. + (Process_Event): Make keys `A'-`F' work only if AA is active. + Disable keys `f' and `H' if in light hinting mode. + (write_header): Ditto for header messages. + +2013-04-17 Werner Lemberg + + [ftview] Key `H' should be active only if we have a CFF. + + * src/ftview.c (Process_Event): Do it. + +2013-04-13 Werner Lemberg + + [ftview] Add keys `A'-`F' to select LCD mode. + + * src/ftview.c (event_help): Updated and rewritten to provide a + two-column layout. + (Process_Event): Handle `A'-`F'; former key `F' is now mapped to + `L'. + +2013-04-13 Werner Lemberg + + [ftview] Key `H' switches CFF hinting engines. + + * src/ftview.c: Include FT_MODULE_H, FT_INTERNAL_OBJECTS_H, + FT_INTERNAL_DRIVER_H, and FT_CFF_DRIVER_H. + (N_HINTING_ENGINES): New macro. + (status): New member `hinting_engine'. + (event_help): Updated. + (event_hinting_engine_change): New function. + (Process_Event): Handle `H' key. + (main): Set default CFF engine. + +2013-04-21 Werner Lemberg + + [graph/x11] Set _NET_WM_PID property. + + * graph/X11/x11/grx11.c: Include `sys/types.h', `unistd.h', and + `XAtom.h'. + (gr_x11_surface_init): Get process ID and set _NET_WM_PID property. + +2013-03-27 Werner Lemberg + + Makefile (COMPILE): Add `CPPFLAGS'. + + Two reasons: + + (a) for orthogonality with freetype.mk + (b) users can pass additional stuff to the compiler + +2013-03-24 Werner Lemberg + + [ftview] Improve rendering mode switching. + + * src/ftview.c (status): Add `update' field. + (Process_Event): Set `update' to 1 only if we really have to do an + update. + (main): Updated. + +2013-03-24 Werner Lemberg + + [ftview] Use `l' and `k' keys instead of `L' and `K'. + + * src/ftview.c (event_help, Process_Event): Implement it. + +2013-03-24 Werner Lemberg + + Don't try to handle rendering precision. + + This is a non-functional remnant of FreeType 1. All font drivers + using B/W rendering activate this at ppem < 24. + + * src/ftcommon.h (FTDemo_Handle): Remove `low_prec' field. + * src/ftcommon.c (FTDemo_New): Updated. + * src/ftmulti.c (low_prec): Removed. + (Help, Process_Event): Updated. + * src/ftstring.c (event_help, Process_Event): Updated. + * src/ftview.c (event_help, Process_Event, write_header): Updated. + +2013-03-17 Werner Lemberg + + [ftview] Remove options -d and -L. + + Not documented and no longer working. This functionality is now + available via FreeType's FT2_DEBUG environment variable. + + * src/ftview.c (status): Remove `debug' and `trace_level'. + (parse_cmdline, main): Updated. + +2013-03-17 Werner Lemberg + + [ftview] Remove option -D. + + This no longer works because the used cache values are now internal. + + * src/ftview.c (status): Remove `dump_cache_stats'. + (usage, parse_cmdline, main): Updated. + +2013-02-16 Alexei Podtelezhnikov + + [ftbench] Make BBox test harder. + + Rotating an outline puts more off-points outside of its bounding box. + + * src/ftbench.c: Include FT_OUTLINE_H. + (test_get_bbox): Rotate outline by 30 degrees. + +2013-02-12 Werner Lemberg + + [ftbench] Add test for `FT_Outline_Get_BBox'. + + * src/ftbench.c: Include FT_BBOX_H. + (FT_BENCH_GET_BBOX): New enumeration value. + (bench_desc): Updated. + (test_get_bbox): New function. + (main): Handle FT_BENCH_GET_BBOX. + +2013-02-08 Werner Lemberg + + Implement `-v' to show version. + + Rename ftdump's `verbose' option to `-V'. + Beautify and harmonize usage strings. + + * src/ftbench.c (bench_desc): Improve. + (usage): Updated. + (main): Handle `-v'. + + * src/ftdiff.c (usage): Updated. + (render_state_init): Pass `library' argument. + Move FreeType initialization to... + (main): Here. + Handle `-v'. + + * src/ftdump.c (usage): Updated. + (main): Handle `-v', rename old `-v' to `-V'. + + * src/ftmulti.c (usage): Updated. + (main): Handle `-v'. + + * src/ftgrid.c, src/ftstring.c, src/ftview (usage): Updated. + (parse_cmdline): Handle `-v'. + (main): Updated. + +2013-02-08 Werner Lemberg + + [ftdiff] Simplify option handling. + + * src/ftdiff.c (get_option_arg): Removed. + (main): Use `getopt'. + +2013-02-08 Werner Lemberg + + * src/ftcommon.c, src/ftcommon.h (FTDemo_New): Take no parameter. + + * src/ftgrid.c, src/ftstring.c, src/ftview.c: Updated. + +2013-02-06 Werner Lemberg + + [ttdebug] Remove options `-n' and `d'; add `-v' to show version. + + * src/ttdebug.c: Include `common.h'. + (Panic): Renamed to... + (Abort): This to avoid name clash. + (dump_mode, non_interactive_mode): Removed. Unused. + (main): Use `getopt'. + Implement `-v' to show FreeType version. + (Usage): Updated and synchronized with other usage messages from + FreeType demo programs. + + * Makefile (ttdebug$E): Updated to use `common.c'. + +2013-02-06 Werner Lemberg + + [ttdebug] Make `q' work correctly. + + * src/ttdebug.c (Quit): New macro. + (RunIns, main): Handle `Quit'. + +2013-02-06 Werner Lemberg + + * src/ttdebug.c (RunIns): Slightly beautify output. + (Usage): Mention help key. + +2013-02-06 Werner Lemberg + + [ttdebug] Make it work again (partially). + + Since we now have lazy execution of the `prep' bytecode, the old + ttdebug code no longer could debug it. + + The new code debugs `fpgm', `prep', and the glyph's bytecode in one + run. To facilitate it, it also adds a new `c' key to continue to + the next code range. + + * src/ttdebug.c (debug_coderange): Removed. + (RunIns): Always run debugger. + Report `end of program' only after glyph program. + Update output of `?' key. + Handle `c' key to loop until end of code range is reached. + (Usage): Updated. + (main): Don't handle negative glyph indices. + +2013-02-06 Werner Lemberg + + * src/ttdebug.c: s/exc->/CUR./. + +2013-02-05 Werner Lemberg + + * src/ttdebug.c (OpStr): Oops! Add commas back. + +2013-02-05 Werner Lemberg + + [ttdebug] Fix compilation warnings. + + * src/ttdebug.c (Cur_U_Line): Use `CUR' macro. + (RunIns): Use global `error' variable. + Use a const `temp' pointer locally. + (Usage): Fix declaration. + +2013-02-05 Werner Lemberg + + * src/ttdebug.c: Formatting, improving messages. + +2013-01-28 Werner Lemberg + + [ftview] Make waterfall display -m string. + + Also make leftArrow key and friends functional. + + * src/ftview.c (Text): Make it `const char*'. + (Render_Waterfall): Add argument to pass first index. + Use -m option if given, and handle it as UTF-8. + (Render_Text, parse_cmdline, main): Updated. + +2013-01-28 Werner Lemberg + + * src/ftview.c (write_header): Show rendering mode number. + +2013-01-03 Werner Lemberg + + [ftdiff] Slightly redesign layout to display all options. + + Also some other, minor changes. + + * src/ftdiff.c: Include . + (RenderStateRec): Remove `message' and `message0'. + Update all users. + (render_state_draw): Display one more line for status information. + (write_message): Renamed to... + (write_global_info): This. + Also display family and style name; we thus no longer need to + display the number of subfonts. + Also display dpi, ppem, and gamma. + (main): Slightly improve column layout. + + (event_help): Minor improvement. + (adisplay_change_gamma): Use epsilons. + (render_state_set_file): Don't loop around the start or end of the + face list. Other FreeType demo programs don't do this either. + +2013-01-03 Werner Lemberg + + [ftdiff] Store family and style name of loaded fonts. + + To be used in a following commit. + + * src/ftdiff.c (FontFaceRec): New members `family_name' and + `style_name'. + (render_state_set_files): Fill new FontFaceRec members. + +2013-01-03 Werner Lemberg + + * src/ftdiff (event_help): Improve text. + +2013-01-03 Werner Lemberg + + [ftgrid] Make it work again. + + * src/ftgrid.c (grid_status_init): Don't initialize variables + related to `display'. Do this... + (grid_status_display): ... in this new function instead. + (main): Use new function to handle command line arguments before + initializing the display. + +2013-01-02 Werner Lemberg + + Increase line height in help texts. + + * src/ftview.c (event_help): Increase line height. + Improve text. + * src/ftdiff.c (event_help), src/ftgrid.c (event_help), + src/ftmulti.c (Help), src/ftstring.c (event_help): Increase line + height. + +2013-01-02 Werner Lemberg + + [graph] Implement adjustable line height. + + * graph/grfont.c (gr_line_height): New global variable. + (grSetLineHeight): New function. + (grWrite): Use gr_line_height. + + * graph/grfont.h: Updated. + +2013-01-02 Werner Lemberg + + * src/ftview.c (write_header): Improve displayed strings. + +2013-01-02 Werner Lemberg + + [ftview] Better input key handling. + + * src/ftview.c (Process_Event): Don't handle key events if not + in a mode where they change something visible. + +2013-01-02 Werner Lemberg + + * src/ftdiff.c (render_state_set_files): Skip non-scalable fonts. + +2013-01-02 Werner Lemberg + + * src/ftview.c (main) Remove redundant code. + +2013-01-02 Werner Lemberg + + [ftview] Redesign layout. + + It now displays all options, not only the changes, in a structured + way. + + * src/ftview.c (START_X, START_Y): New macros. + (INIT_SIZE): Use them. + (status): Remove `header' and `header_buffer' members. + (Render_Waterfall): Use START_X and START_Y. + (event_gamma_change, event_bold_change, event_radius_change, + event_slant_change, event_render_mode_change, Process_Event): Don't + set `status.header'. + (write_header): Display all options. + + (main): Updated. + +2012-12-31 Werner Lemberg + + Introduce a warn color. + + * src/ftcommon.h (FTDemo_Display): Add `warn_color' member. + + * src/ftcommon.c (FTDemo_Display_New): Initialize it. + +2012-12-31 Werner Lemberg + + * src/ftdiff.c (render_state_draw, main): Use HEADER_HEIGHT. + +2012-12-27 Werner Lemberg + + Increase header line distances. + + * src/ftgrid.c, src/ftview.c (HEADER_HEIGHT): Move to... + * src/ftcommon.h: ... this file. Set it to value 12. + +2012-12-27 Werner Lemberg + + * Makefile: Add dependencies on `ftcommon.h'. + +2012-12-26 Werner Lemberg + + Implement -w and -h options to specify window width and height. + + * src/ftcommon.c (FTDemo_Display_New): Two new parameters to pass + width and height. + (DIM_X, DIM_Y): Moved to ... + * src/ftcommon.h: ... this. + + * src/ftdiff.c (usage): Updated. + (ADisplayRec): Add `width' and `height' elements. + (adisplay_init): Two new parameters to pass width and height. + (write_message): Updated. + (main): Handle `-w' and `-h' options. + + * src/ftgamma.c (DIM_X, DIM_Y): Removed. + + * src/ftgrid.c (GridStatusRec): Add `width' and `height' elements. + (grid_status_init): Updated. + (usage): Updated. + (parse_cmdline): Handle `-w' and `-h' options. + (main): Updated. + + * src/ftmulti.c (DIM_X, DIM_Y): Use the same (new) values as in + other demo programs. + (width, height): New global variables. + (Init_Display): Updated. + (usage): Updated. + (main): Handle `-w' and `-h' options. + + * src/ftstring.c (status): Add `width' and `height' elements. + (usage): Updated. + (parse_cmdline): Handle `-w' and `-h' options. + (main): Updated. + + * src/ftview.c (status): Add `width' and `height' elements. + (usage): Updated. + (parse_cmdline): Handle `-w' and `-h' options. + (main): Updated. + +2012-12-20 Werner Lemberg + + * bin/.cvsignore: Renamed to... + * bin/.gitignore: ... this. + + * Makefile (dist): Don't include `.mailmap' and `.gitignore' + +2012-12-19 Werner Lemberg + + * Version 2.4.11 released. + ========================== + + + Tag sources with `VER-2-4-11'. + + * README: Updated. + +2012-11-27 Werner Lemberg + + * src/ftdiff.c (usage): Updated. + +2012-11-26 Werner Lemberg + + [ftdiff] Accept UTF-8 encoded input files. + + * src/ftdiff.c (default_text): Use `char*' instead of `unsigned + char*'. + (main): Ditto for `text' variable. + (RenderStateRec): Ditto for `text' member. + (render_state_draw): Ditto for `text' argument. + Use `utf8_next' to parse UTF-8 encoded text. + +2012-11-04 Werner Lemberg + + [ftdump] Improve output of cmap tables. + + * src/ftdump.c (Print_Charmaps): Indicate Unicode Variation + Sequences. + +2012-10-20 Werner Lemberg + + * src/ftdump.c: (main): Minor output formatting. + +2012-09-01 Alexei Podtelezhnikov + + [ftview] Use pixel size calculation that works for bitmap fonts too. + + * src/ftview.c (Render_Stroke, Render_Embolden): Rely on the status + point size and resolution to get the pixel size. + +2012-08-19 Alexei Podtelezhnikov + + [ftview] Implement adjustable stroker radius. + + * src/ftview.c (status): New field 'radius'. + (Render_Stroke): Updated. + (Process_Event): Add the keys `r' and `R' to handle the change. + (event_radius_change): Implement it. + (event_help): Updated. + +2012-08-18 Alexei Podtelezhnikov + + [ftview] Use more readable loop. + + * src/ftview.c (main): use do-while instead of for-break. + +2012-07-20 Alexei Podtelezhnikov + + [ftview] Clean up the code. + + * src/ftview.c (Render_Slanted): Move the shear matrix setup out of + the loop. + * src/ftview.c (Render_Embolden): Move the emboldening strength + calculation out of the loop. + +2012-07-12 Alexei Podtelezhnikov + + [ftview] Further code homogenization. + + * src/ftview.c (Render_Stroke): Stroker constructor and destructor + are moved to... + * src/ftcommon.c (FTDemo_New, FTDemo_Done): Here. + * src/ftcommon.h (FTDemo_Handle): New field `stroker'. + +2012-07-11 Werner Lemberg + + Avoid crashes in case of failure. + + * src/ftcommon.c (FTDemo_Draw_Slot), src/ftgrid.c + (grid_status_draw_outline), src/ftview.c (Render_Stroke): Only call + `FT_Done_Glyph' in case of success. + +2012-07-10 Alexei Podtelezhnikov + + [ftview] Clean up and homogenize the code. + + * src/ftview.c (Render_Stroke): Replace while-loop with for-loop. + (Render_Slanted): Ditto. + (Render_Embolden): Ditto. + (Render_All): Ditto. + (Render_Waterfall): Ditto. + (Render_Stroke): Homogenize with other similar functions. + (Render_Text): Code cleanup. + (event_gamma_grid): Ditto. + +2012-06-15 Werner Lemberg + + * Version 2.4.10 released. + ========================== + + + Tag sources with `VER-2-4-10'. + + * README: Updated. + +2012-05-28 Alexei Podtelezhnikov + + [ftview] Implement handling of FT_Outline_EmboldenXY. + + * src/ftview.c (status): Replace `bold_factor' with `xbold_factor' + and `ybold_factor'. + (Render_Embolden): Updated. + (Process_Event): Replacing handling of `e', `E' keys with `x', `X', + `y', and `Y'. + (event_bold_change): Implement it. + (event_help): Updated. + +2012-03-14 Alexei Podtelezhnikov + + [ftview] Improve spacing for bold rendering mode. + + * src/ftview.c (Render_Embolden): Fix algorithm to reduce spacing. + +2012-03-08 Werner Lemberg + + * Version 2.4.9 released. + ========================= + + + Tag sources with `VER-2-4-9' (the previous commit has this tag). + + * README: Updated. + +2012-03-03 Werner Lemberg + + [ftstring] Fix display of kern compare mode. + + * src/ftstring.c (main) : Fix scaling of + `height'. + +2012-03-03 Werner Lemberg + + Fix handling of track kerning. + + * src/ftcommon.c (string_render_prepare): Fix scaling for + `FT_Get_Track_Kerning'. + +2012-03-03 Werner Lemberg + + Remove unused function. + + * src/ftcommon.[ch] (FTDemo_Set_Current_Pointsize): Remove. + +2012-03-02 Werner Lemberg + + Fix Savannah bug #33660. + + * src/ftcommon.c: Include `FT_XFREE86_H'. + (file_suffixes): Remove. + (my_face_requester): Check whether font driver is `Type 1' instead + of relying on the file suffix. + Additionally, prefer `.afm' over `.pfm'. + (FTDemo_Install_Font): Don't try various suffixes. + Allocate more memory for `font->filepathname' as needed by + `my_face_requester'. + + * src/ftdiff.c: Include `ftcommon.h' and `common.h'. + Remove declaration of `error' everywhere. + (usage): Updated. + Add argument for binary name. + Update all callers. + (event_help): Updated. + + * src/ftgrid.c (usage): Updated. + + * src/ftstring.c (event_help, usage): Updated. + + * src/ftview.c (usage): Updated. + +2012-03-02 Werner Lemberg + + * src/ftstring.c: Remove redundant code; formatting. + +2012-03-02 Werner Lemberg + + * src/ftdiff.c: Formatting. + +2012-03-02 Werner Lemberg + + * src/ftgrid.c: Remove redundant code; formatting. + +2012-03-02 Werner Lemberg + + * src/ftcommon.c: Remove dead code; formatting. + +2012-02-13 Peter Grandi + + [ftview] Implement cycling backwards for rendering and LCD modes. + + * src/ftview.c (Process_Event): Handle keys `K' and `backspace'. + (event_help): Updated. + +2012-02-13 Werner Lemberg + + Fix X11 keyboard handling. + + * graph/grevents.h (grKey): Shift special keys to a higher range, + otherwise it can happen that they are processed twice. For example, + `grKeyBackSpace' also returns key code 8 under X11, and this was + previously mapped to `grKeyF8'. + +2011-12-07 Antoine Leca + + Fix printf specifications and parameters. + + * src/ttdebug.c (Cur_U_Line, RunIns): Use "%hu" for FT_UShort, + "%ld" for FT_Pos; drop the "h" in "%hx" for FT_Byte parameters + and cast the parameters to (unsigned) ("%hhx" is C99 only, and + often unimplemented). Noticed by clang. + +2011-12-02 suzuki toshiya + + Use $(LIBTOOL) to make graph.a, if it is defined. + + If configure script in FreeType2 library directory creates GNU + Libtool, using it is better than using raw `ar'. For example, + Mac OS X archive library is required to be processed by ranlib. + See discussion in + http://lists.gnu.org/archive/html/freetype-devel/2011-10/msg00034.html + + * graph/rules.mk: Change the object suffix $(SO) to $(O) for + the sake of GNU Libtool. If $(LIBTOOL) is defined, use it to + compile the objects and make the library. + * graph/x11/rules.mk: Ditto. + * graph/beos/rules.mk: Ditto. + + * Makefile: `clean' target erases the object, the library and + GNU Libtool related files in .libs/ directory. + +2011-11-15 Werner Lemberg + + * Version 2.4.8 released. + ========================= + + + Tag sources with `VER-2-4-8'. + + * README: Updated. + +2011-10-18 Werner Lemberg + + * Version 2.4.7 released. + ========================= + + + Tag sources with `VER-2-4-7'. + + * README: Updated. + +2011-08-14 Werner Lemberg + + Improve usage messages. + + This should fix Savannah bug #33660. + + * src/ftgrid.c, src/ftstring.c, src/ftview.c (usage): Reword and + extend. + +2011-07-29 Werner Lemberg + + * Version 2.4.6 released. + ========================= + + + Tag sources with `VER-2-4-6'. + + * README: Updated. + +2011-06-24 Werner Lemberg + + * Version 2.4.5 released. + ========================= + + + Tag sources with `VER-2-4-5'. + + * README: Updated. + +2011-06-01 Werner Lemberg + + Fix gcc 4.6 warnings. + + * graph/grblit.c (blit_gray_to_gray): Remove unused variables. + (blit_gray_to_gray_simple): Declare and set `max' conditionally. + + * src/ftcommon.c (FTDemo_Index_To_Bitmap): Remove unused variable. + * src/ftmulti.c (Render_All, Render_Text): Ditto. + * src/ftview.c (INIT_SIZE, Render_Stroke, Render_Slanted, + Render_Embolden, Render_All, Render_Text, Render_Waterfall): Ditto. + +2011-05-01 Just Fill Bugs + Werner Lemberg + + [ftgrid] Show autohinter segments. Toggle with key `s'. + + * src/ftgrid.c: Add declarations for + `af_glyph_hints_get_num_segments' and + `af_glyph_hints_get_segments_offset'. + (GridStatus): Add `segment_color' and `do_segment'. + (grid_status_init): Updated. + (grid_hint_draw_segment): New function. + (grid_status_draw_outline): Call it. + (Process_Event) <'s'>: Toggle display of segment lines. + (event_help): Updated. + +2011-04-24 Werner Lemberg + + * src/ftgrid.c (event_grid_zoom): Fix status message. + +2011-04-21 Werner Lemberg + + FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH is deprecated and ignored. + + * src/ftchkwd.c (check_face): Update load flags. + * src/ftcommon.h (FTDemo_Handle): Remove `use_global_advance_width'. + * src/ftcommon.c (FTDemo_New, FTDemo_Update_Current_Flags): Updated. + * src/ftmulti.c (LoadChar): Update load flags. + + * src/ftdiff.c (ColumnStateRec): Remove `use_global_advance_width'. + (render_state_init, render_state_draw): Updated. + (process_event): No longer handle key `a'. + (event_help): Updated. + + * src/ftview.c (Process_Event): No longer handle key `A'. + (event_help): Updated. + +2011-04-20 Werner Lemberg + + [ftgrid]: Prevent incorrect output of `1', `2', and `3' keys. + + * src/ftgrid.c (Process_Event) <'1', '2', '3'>: Ensure that hinting + is active, otherwise old table data could be emitted. + +2011-04-19 Werner Lemberg + + * Makefile (FT_INCLUDES): Simplify. + +2011-04-18 Werner Lemberg + + [ftgrid]: Limit autofit control even more. + + * src/ftgrid.c (Process_Event) <'H', 'V', 'B'> [FT_DEBUG_AUTOFIT]: + Limit visibility and improve status messages. + (event_help): Updated. + +2011-04-18 Werner Lemberg + + [ftgrid] Add forced autohinting and limit autofit dumping. + + * src/ftgrid.c (_af_debug): Remove, unused. + (Process_Event) <'f'>: Toggle autohinting. + [FT_DEBUG_AUTOFIT] <'1', '2', '3'>: Limit visibility and improve + status messages. + (event_help): Updated. + (main): Updated. + +2011-04-18 Werner Lemberg + + Honor DEVEL_DIR. + + * Makefile (FT_INCLUDES) [DEVEL_DIR]: Add $DEVEL_DIR. + +2011-03-19 Werner Lemberg + + C++ compilation fixes. + + * src/ftcommon.c, src/ftdiff.c: `strrchr' returns `const char *'. + + * src/ftview.c (status): Fix initialization. + +2011-01-30 Werner Lemberg + + Add flag `A' to ftview for toggling the global advance width flag. + + * src/ftcommon.h (FTDemo_Handle): New field + `use_global_advance_width'. + * src/ftcommon.c (FTDemo_New): Set it. + (FTDemo_Update_Current_Flags): Handle it. + + * src/ftview.c (Process_Event): Handle key `A'. + (event_help): Updated. + +2010-12-31 Werner Lemberg + + * Makefile: Add -lbz2 for development builds. + +2010-11-28 Werner Lemberg + + * Version 2.4.4 released. + ========================= + + + Tag sources with `VER-2-4-4'. + + * README: Updated. + +2010-10-03 Werner Lemberg + + * Version 2.4.3 released. + ========================= + + + Tag sources with `VER-2-4-3'. + + * README: Updated. + +2010-08-29 Steve Langasek + + Make `grKey' enum comprehensive for gcc 4.5 compatibility. + + * graph/grevents.h (grKey): Avoid the situation of trying to compare + an enum variable with a value not included in that enum in a case + statement. An enum needs to be declared to include the list of all + possible values (which in the case of keypresses is quite a few), + not just the most convenient ones. + +2010-08-17 Werner Lemberg + + [ftbench] Add option `-i' to specify first used glyph index. + + * src/ftbench.c (first_index): New global variable. + (test_load, test_load_advances, test_render, test_embolden, + test_get_cbox, test_get_glyph, test_image_cache, test_sbit_cache, + get_charset): Use it. + (usage): Updated. + (main): Handle `-i'. + +2010-08-06 Werner Lemberg + + * Version 2.4.2 released. + ========================= + + + Tag sources with `VER-2-4-2'. + + * README: Updated. + +2010-07-23 Werner Lemberg + + ftmulti: Oops! Patch has been applied incorrectly. + + * src/ftmulti.c (main): Really limit axis name length. + +2010-07-19 Werner Lemberg + + * Version 2.4.1 released. + ========================== + + + Tag sources with `VER-2-4-1'. + + * README: Updated. + +2010-07-17 Werner Lemberg + + ftmulti: Fix possible buffer overflow. + Based on a patch from Marek Kašík . + + * src/ftmulti.c (main): Limit axis name length in `Header'. + +2010-07-13 suzuki toshiya + + ftdump: Show language ID for all cmap subtables. + + * src/ftdump.c (Print_Charmaps): Print the language IDs obtained by + FT_Get_CMap_Language_ID(). The language IDs is cast to FT_UInt, so + broken IDs (> 0xFFFF) will not be shown correctly. + +2010-07-12 Werner Lemberg + + * Version 2.4.0 released. + ========================== + + + Tag sources with `VER-2-4-0'. + + * README: Updated. + +2010-06-28 Werner Lemberg + + ftbench: Fix suboptions of `-b'. + + * src/ftbench.c (bench_desc): Add missing description for + FT_BENCH_LOAD_ADVANCES. + +2010-06-07 Werner Lemberg + + Fix Savannah bug #30054. + + * src/ftdiff.c, src/ftgrid.c, src/ftmulti.c, src/ftstring.c, + src/ftview.c: Use precision for `%s' where appropriate to avoid + buffer overflows. + +2010-04-14 Werner Lemberg + + ftdiff: Add support for LCD filter control. + + Key `l' cycles through the filter modes, `[' and `]' select the + custom filter weight, `-' and `+' (or `=') adjust the selected + filter weight. + + This is based on code written by Lifter + . + + * src/ftdiff.c (ColumnStateRec): Add members for LCD filter control. + (render_state_init): Updated. + (render_state_draw): Add support for custom LCD filter. + (event_help): Document new keys. + Make help screen more compact. + (process_event): Handle new keys. + +2010-04-14 Werner Lemberg + + ftview: Add support for LCD filter control. + + Key `F' toggles custom LCD filter mode, `[' and `]' select the + custom filter weight, `-' and `+' (or `=') adjust the selected + filter weight. + + This is based on code written by Lifter + . + + * src/ftview.c (INIT_SIZE, Render_Waterfall): Add space for a third + header line. + (status_): Add members for LCD filter control. + (event_help): Document new keys. + Make help screen more compact. + (Process_Event): Handle new keys. Use FTC_Manager_RemoveFaceID to + flush the bitmap caches, forcing a redraw. I'm not sure whether + this is the right thing, but it seems to work... + (write_header): Display custom filter weights. + +2010-02-11 Werner Lemberg + + * Version 2.3.12 released. + ========================== + + + Tag sources with `VER-2-3-12'. + + * README: Updated. + +2009-10-10 Werner Lemberg + + * Version 2.3.11 released. + ========================== + + + Tag sources with `VER-2-3-11'. + + * README: Updated. + +2009-10-06 Werner Lemberg + + * Version 2.3.10 released. + ========================== + + + Tag sources with `VER-2-3-10'. + + * README: Updated. + + * Makefile (major, minor, patch): Fix regexp to allow more + than a single digit. + (dist): We now use git. + +2009-07-30 Boris Letocha + + [graph] Fix rendering on Windows. + + * graph/win32/grwin32.c (gr_win32_surface_refresh_rectangle): + Handle `gr_pixel_mode_gray' correctly. + +2009-06-17 Werner Lemberg + + Reduce number of automatically compiled programs. + Many GNU/Linux distributions install those programs, and most of + them are completely useless or very specialized. + + * Makefile (LINK): Define. + (EXES): Reduce list to retain only generally useful programs. + (ftsbit): Comment out. Program doesn't compile (but may be useful). + (ttdebug.o): Make it compile again. + +2009-06-17 Werner Lemberg + + * Makefile: Handle `EXTRAFLAGS' for platform `unixdev' also. + +2009-04-30 Werner Lemberg + + ftview: Make slant and boldness controllable. + + Keys `e' and `E' adjust emboldening, keys `s' and `S' the slant. + + * src/ftview.c (status): Add `bold_factor' and `slant' members. + (Render_Slanted): Use `status.slant'. + (Render_Embolden): Copy code from `FT_GlyphSlot_Embolden' and use + `status.bold_factor'. + (event_bold_change, event_slant_change): New functions. + (Process_Event): Handle keys `s', `S', `e', and `E'. + (event_help): Updated. + +2009-04-26 Werner Lemberg + + * graph/grblit.c (blit_lcd8_to_24): Fix typo. + Reported by suyu@cooee.cn. + +2009-04-22 Werner Lemberg + + Fix crash in ftgrid. + + * src/ftgrid.c (grid_status_draw_outline): Handle return value of + FT_Load_Glyph. + +2009-03-12 Werner Lemberg + + * Version 2.3.9 released. + ========================= + + + Tag sources with `VER-2-3-9'. + + * README: Updated. + +2009-03-10 Werner Lemberg + + * src/common.c (CONST): New macro, defined depending on __STDC__. + Use it where necessary. + +2009-03-10 Werner Lemberg + + Fix C++ compilation. + + * src/ftbench.c (test_load_advances): Use cast. + * src/ftgrid.c: Protect `extern' declarations with `extern "C"'. + +2009-03-03 Werner Lemberg + + Fix signedness issues. + + * src/ftcommon.c (FTDemo_String_Set): Fix signedness. + Update callers. + Include `common.h'. + Use __STDC__ macro. + * src/ftcommon.h (FTDemo_String_Set): Fix signedness. + + * src/common.h, src/common.c: Use __STDC__ macro. + +2009-03-03 David Turner + + Add utf-8 support to ftview. Fixes Savannah BUG #18225. + + * src/common.h, src/common.c: Add `utf8_next' function. + * src/ftcommon.c (FTDemo_String_Set), src/ftview.c (Render_Text): + Use `utf8_next'. + +2009-01-14 Werner Lemberg + + + * Version 2.3.8 released. + ========================= + + + Tag sources with `VER-2-3-8'. + + * README: Updated. + +2009-01-07 Werner Lemberg + + ftdiff: Add `a' key to toggle global advance width. + + * src/ftdiff.c (ColumnStateRec): Add `use_global_advance_width' + field. + (render_state_init): Updated. + (render_state_draw): Control FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH. + Update screen output. + (event_help): Document `a' key. + Sort output. + (process_keys): Handle `a' key. + Sort entries in `case' block. + +2008-12-05 Werner Lemberg + + * src/ftbench.c: Remove #if FT_ADVANCES_H ... conditionals. + +2008-09-02 David Turner + + * src/ftbench.c: Include FT_ADVANCES_H. + (FT_BENCH_LOAD_ADVANCES): New enumeration value. + (test_load_advances): New function. + (main) : New case. + +2008-06-29 Werner Lemberg + + + * Version 2.3.7 released. + ========================= + + + Tag sources with `VER-2-3-7'. + + * README: Updated. + +2008-06-10 Werner Lemberg + + + * Version 2.3.6 released. + ========================= + + + Tag sources with `VER-2-3-6'. + + * README: Updated. + +2008-05-18 Werner Lemberg + + * src/ftdiff.c (render_mode_names): Use better strings. + +2008-05-13 Werner Lemberg + + * src/ftcommon.c (string_render_prepare): Always set extent in last + slot. + +2008-01-10 Allan Yang, Jian Hua - SH + + * graph/grfill.c: Include . + +2007-12-29 Allan Yang, Jian Hua - SH + Werner Lemberg + + * src/ftview.c: Implement slanting. + +2007-08-08 Werner Lemberg + + * src/ftvalid.c (print_usage): Add option `-f'. + +2007-08-08 George Williams + + * src/ftvalid.c (ot_table_spec): Handle `MATH' table also. + (main): Add option `-f' to select font index. + +2007-07-07 Werner Lemberg + + * src/ftview.c (parse_cmdline): Remove C++ compiler warning. + + * src/ftcommon.c (my_file_requester), src/ftgrid.c + (grid_status_draw_grid, ft_outline_draw, ft_outline_new_circle, + grid_status_draw_outline, _af_debug_hints), src/ftdiff.c + (_render_state_rescale, render_state_set_files, + render_state_set_file, adisplay_draw_glyph, adisplay_draw_text, + event_help, event_change_gamma, process_event, write_message, main): + Fix compilation with C++ compiler. + +2007-07-02 Werner Lemberg + + + * Version 2.3.5 released. + ========================= + + + Tag sources with `VER-2-3-5'. + + * README: Updated. + +2007-06-19 Werner Lemberg + + * src/ftview.c (usage): Make it more readable. + +2007-06-16 Werner Lemberg + + * src/ftpatentcheck.c: Renamed to... + * src/ftpatchk.c: This. + Minor fixes. + + * src/Jamfile (PROGRAMS), Makefile: Updated. + +2007-06-10 David Turner + + Add the new `ftpatentcheck' program; it is a simple wrapper of the + new FT_Face_CheckTrueTypePatents function. + + * src/ftpatentcheck.c: New file. + * src/Jamfile (PROGRAMS), Makefile: Updated. + +2007-06-09 Werner Lemberg + + * src/ftgrid.c (Process_Event): Assign usual actions to keys F7-F12. + (event_help): Updated. + (main): Don't expect a Unicode encoded font -- we are only working + with glyph indices currently. + +2007-06-01 Werner Lemberg + + * src/ftcommon.c (FTDemo_Index_To_Bitmap): Initialize `*x_advance'. + +2007-05-28 David Turner + + * src/ftcommon.h: fix compilation warning + + * src/ftview.c: fix size bugs in waterfall mode + +2007-05-11 David Turner + + * src/ftcommon.h, src/ftcommon.c, src/ftview.c, src/ftgrid.c, + src/ftstring.c: adapt test programs to use the new + FTC_ImageCache_LookupScaler and FTC_SBitCache_LookupScaler + functions. This allows you to specify fractional pixel/point + sizes on the command line (e.g. ftview 13.5 ~/fonts/*) + +2007-05-09 Ryan Hill + + * Makefile: Fix rules for fttimer which doesn't use graphical + output. + Fix rule for ftdump to make it work with parallel builds. + +2007-04-09 Werner Lemberg + + + * Version 2.3.4 released. + ========================= + + + Tag sources with `VER-2-3-4'. + + * README: Updated. + + * src/ftdiff.c (process_event): Handle `?' key. + +2007-04-04 Werner Lemberg + + + * Version 2.3.3 released. + ========================= + + + Tag sources with `VER-2-3-3'. + + * README: Updated. + +2007-04-03 Werner Lemberg + + * src/ftdiff.c (usage): Make message similar to other ftdemo + programs. + +2007-04-02 David Turner + + * graph/win32/grwin32.c (gr_win32_surface_init): Fix the Win32 + window size computations to properly adjust border thickness and + other extras. Fix by Sébastien Leix . + + * src/ftdiff.c (render_state_draw): Fix small bug that prevented + unhinted rendering from working as expected with embedded bitmaps. + + (adisplay_init): Fix small bug that occurred when the + call to grNewSurface() failed. Reported by Sébastien Leix + . + + (usage): Move up in file. + + (FontFaceRec): New structure. + (RenderStateRec): Integrate it. + Update all users. + + (render_state_set_files, render_state_set_file): Handle all faces in + a multi-face font file. + + (write_message): Handle multi-face font files. + +2007-04-01 Werner Lemberg + + * src/ftdiff.c: Remove compiler warnings. + Formatting. + +2007-03-30 David Turner + + Change interface keys to allow you to change settings for a single + column only. Press F1 for details. + + * src/ftdiff.c: Include FT_LCD_FILTER_H. + (DisplayMode): Add DISPLAY_MODE_LCD. + + (Display_textFunc): New function pointer. + (DisplayRec): Add it. + + (RenderMode): Replace it with... + (HintMode): This. Update all users. + + (render_mode_names): New array. + + (ColumnStateRec): New struct. + (RenderStateRec): Use it. + (render_state_init): Initialize it. + + (render_state_draw): Pass index as argument. + Use ColumnStateRec. + Implement sub-pixel positioning for unhinted mode. + Add column footers, showing current rendering state. + + (adisplay_draw_glyph): Handle DISPLAY_MODE_LCD. + (adisplay_draw_text): New function. + + (event_help): Updated. + (process_event): Add many keys to control rendering modes in more + detail. + + (main): Updated. + +2007-03-28 Werner Lemberg + + * src/ftdiff.c: Remove many compiler warnings. + Fix some typos. + Improve and fix help texts. + Formatting. + +2007-03-26 David Turner + + * src/ftdiff.c: New proofing program that displays text in three + columns: bytecode-hinted, auto-hinted with rsb/lsb delta + adjustments, and unhinted/subpixel-positioned. For comparison + purposes. + + * Makefile, Jamfile: Add ftdiff. + +2007-03-22 suzuki toshiya + + * src/ftvalid.c (print_usage): Fix a typo in the help message. + +2007-03-09 Werner Lemberg + + + * Version 2.3.2 released. + ========================= + + + Tag sources with `VER-2-3-2'. + + * README: Updated. + +2007-02-14 David Turner + + * src/ttdebug.c: another refresh of the debugger. Minor improvements + to be able to display more useful information during debugging + +2007-02-12 David Turner + + * src/ttdebug.c: refresh the TrueType debugger code + +2007-02-06 Alexei Podtelezhnikov + + * src/ftstring.c (event_render_mode_change): Fix spelling. + +2007-01-31 Werner Lemberg + + + * Version 2.3.1 released. + ========================= + + + Tag sources with `VER-2-3-1-FINAL'. + + * README: Updated. + +2007-01-17 Werner Lemberg + + + * Version 2.3.0 released. + ========================= + + + Tag sources with `VER-2-3-0-FINAL'. + +2007-01-11 Masatake YAMATO + + * src/ftvalid.c (run_ot_validator, run_gx_validator, + run_ckern_validator): Return FT_Error value instead of int value. + (main): Return value returned from validator's run method. + (report_result): Don't show `invalid' message if there is no target + table. + +2006-12-15 suzuki toshiya + + * mac/ftoldmac.c: Fix conditional macros of FSSpec/FSRef and + QuickDraw/ATS functionalities. + +2006-12-10 Werner Lemberg + + * Makefile (dist): Extract version number from freetype.h. + +2006-11-15 David Turner + + * graph/x11/rules.mk (X11_PATH): Check /usr also. + Search for `Xlib.h'. + +2006-11-03 Werner Lemberg + + * src/ftgrid.c: Fix external function declarations. + (event_help): Document `1', `2', and `3' keys. + (grid_status_init, grid_status_rescale_initial, + grid_status_draw_grid, grid_status_draw_outline, event_grid_reset): + s/status/st/, s/error/err/ where appropriate to avoid shadowed + variables. + (GridStatusRec): Add `const' to `header'. + Update all assignments. + + * Makefile: Add ftgrid. + +2006-11-02 David Turner + + Add `B' key to ftgrid for toggling blue zone hinting. + Add `1', `2', and `3' keys to dump hints for edges, segments, and + points, respectively. + + * src/ftgrid.c: Add some externs. + (_af_debug, _af_debug_disable_blue_hints, _af_debug_hints): New + global variables. + (GridStatusRec): Add `do_blue_hints' variable. + (grid_status_init): Set do_blue_hints. + (event_help): Updated. + (Process_Event): Updated. + (main): Set _af_debug. + +2006-10-23 Zhe Su + + Add a benchmark for the emboldening algorithm. + + * src/ftbench.c: Include FT_SYNTHESIS_H. + (FT_BENCH_EMBOLDEN): New enumeration value. + (bench_desc): Add `Embolden'. + (test_embolden): New function. + (main): Add it. + +2006-10-23 David Turner + + * src/ftgrid.c: Make the file compile again. + +2006-10-11 suzuki toshiya + + * mac/ftoldmac.c (print_help): Renamed to... + (print_help_and_exit): This. Update callers. + Improve the conditionals in source to separate Toolbox QuickDraw and + Carbon QuickDraw. + (reserveToolBoxQuickDrawFontName, test_face_quickdraw, + test_font_list_quickdraw_old, test_font_list_quickdraw, + test_font_list_ats): Ditto. + +2006-10-11 suzuki toshiya + + * mac/Makefile: Synchronize with the changes of top-level Makefile + on 2006-02-01. + +2006-09-27 David Turner + + Add support for LCD color filtering to ftview. + + * src/ftview.c: Include FT_LCD_FILTER_H. + (status): Initialize it completely. + (main): Call FT_Library_SetLcdFilter. + + * src/ftcommon.c (FT_Demo_Draw_Glyph): Renamed to... + (FT_Demo_Draw_Glyph_Color): This. Add an argument to pass the + colour. + (FT_Demo_Draw_Glyph): New function, calling + FT_Demo_Draw_Glyph_Color. + + * src/ftcommon.h (FT_Demo_Draw_Glyph_Color): New declaration. + + * src/ftgrid.c: New file, implementing an auto-fitter debugger. + This is a very preliminary version. It only compiles with Jam at + the moment, and you must have AF_DEBUG defined in your + `src/autofit/aftypes.h' file to be able to link it. + + * src/Jamfile (GRAPHIC_PROGRAMS): Add ftgrid. + + * graph/graph.h (grFindColor, grFillHLine, grFillVLine, grFillRect): + New declarations. + + * graph/grfill.c: New file which implements `grFillHLine', + `grFillVLine', and `grFillRect'. They are mainly used by the + auto-fitter debugger. + + * graph/grobjs.c (grFindColor): New function for the auto-fitter + debugger. + + * graph/gblender.c (gblender_set_gamma_table): Set + `gamma_ramp_inv[gmax]'. + + * graph/gblender.h (GBLENDER_STAT_HIT, GBLENDER_LOOKUP): Move them + up in source file. + + * graph/Jamfile (graph_sources), graph/rules.mk (GRAPH_OBJS): Add + `grfill'. + +2006-09-11 David Turner + + Add support for OLPC swizzle simulation (must define SWIZZLE at + compile time for this to work). + + * graph/grswizzle.c, graph/grswizzle.h: New files. + + * graph/grdevice.h (gr_swizzle_rgb24): Declare. + + * graph/Jamfile (graph_sources): Add `grswizzle'. + + * graph/win32/grwin32.c [SWIZZLE]: Include `grswizzle.h'. + (gr_win32_surface_refresh_rectangle) [SWIZZLE]: Don't call + gr_swizzle_rgb24 but gr_rect_swizzle_rgb24. + Remove unused variables. + +2006-09-01 David Turner + + Fix various bugs in the glyph blender/blitter. + + * graph/gblcolor.h, graph/gblhbgr.h, graph/gblhrgb.h, + graph/gblvbgr.h, graph/gblvrgb.h: Fix off-by-one + error. + + * graph/gblender.c (gblender_lookup): Fix computation of key->cells. + (gblender_lookup_channel): Fix computation of key->index. + + * graph/win32/grwin32.c: Fix RGB/BGR ordering -- Win32 uses BGR + ordering for its 24-bit bitmaps. + (SWIZZLE): New macro (set to undefined). + (grWin32SurfaceRec): Add `bgrBitmap'. + [SWIZZLE]: Add `swizzle_bitmap'. + (gr_win32_surface_done) [SWIZZLE]: Handle `swizzle_bitmap'. + (gr_win32_surface_refresh_rectangle): Do conversion RGB->BGR. + (gr_win32_surface_init): Initialize `bgrBitmap'. + [SWIZZLE]: Initialize `swizzle_bitmap'. + +2006-07-03 Masatake YAMATO + + * src/ftvalid.c (library): Move this global variable to main as a + local variable. + (print_usage): Introduce function static variable `library'. + Add one argument for initializing the static variable. + (main): Call print_usage with `library'. + (main, else, parse_table_specs, find_validation_flag): Call + print_usage with NULL. + +2006-06-17 Masatake YAMATO + + * src/ftvalid.c: Rearrange code. + (library): Make variable having global scope. + (OT_VALIDATOR_SYMBOL): Remove. + (GX_VALIDATOR_SYMBOL): Remove. + (CKERN_VALIDATOR_SYMBOL): Remove. + (validator_symbols): Remove. + (ValidatorType::LAST_VALIDATE): New enum element used in loop + sentinel. + (ot_table_spec): Remove const modifier. + (gx_table_spec): Remove const modifier. + (Validator): New data type. + (validators): New variable. + (print_usage): Use validators. + (report_header, report_result): Use validators. + (is_ot_validator_implemented): New function. + (is_gx_validator_implemented): New function. + (is_ckern_validator_implemented): New function. + (run_ckern_validator): Use validators. + (main): Initialize library at the beginning of main. + Use validators. + Report messages and exit if the validator specified by command line + is not implemented in libfreetype2 linked to ftvalid. Suggested by + George Williams. + +2006-06-09 Werner Lemberg + + * src/ftcommon.c (FTDemo_Install_Font): Fix index range for MS + Symbol. + +2006-06-07 Werner Lemberg + + * src/ftcommon.c (FTDemo_Display_Done, FTDemo_Done): Protect against + NULL argument. + + * src/ftview.c (Fatal): New function to finalize FreeType library. + This allows using FreeType's memory debugger in case of errors. + s/PanicZ/Fatal/. + +2006-06-04 David Turner + + * src/ftbench.c (main): fixed a subtle memory corruption bug + at program exit. Reported by . + +2006-05-21 Werner Lemberg + + * src/ftdump.c (Print_Type): Fix type for `module'. Reported by + Mark Wang. + +2006-05-17 Werner Lemberg + + * src/ftcommon.c, src/ftview.c [_WIN32]: Define `strcasecmp' and + `snprintf'. + +2006-05-17 yi luo + + * graph/win32/rules.mk: Add support for icl compiler. + + * src/ftcommon.c (strcasecmp): Define to `_stricmp' if not + available. + + * src/ftview.c (snprintf): Define to `_snprintf' if not available. + +2006-05-12 Werner Lemberg + + + * Version 2.2.1 released. + ========================= + + +2006-05-10 Werner Lemberg + + * Makefile (clean distclean) [no_config_mk]: Fix warning message. + (dist): New target to build .tar.bz2, .tar.gz, and .zip bundles. + Note that there are still many hard-coded version strings. + +2006-05-06 Werner Lemberg + + * src/ftdump.c (main): Fix compiler warning. + +2006-05-02 David Turner + + Add support for font preloading with the `-p' flag, simulating + memory-mapped file access. + + * src/ftcommon.h (TFont): New elements `file_address' and + `file_size'. + (FTDemo_Handle): New element `preload'. + (FTDemo_Set_Preload): New prototype. + + * src/ftcommon.c (my_face_requester): Use FT_New_Memory_Face for + preloaded font. + Handle PFM files also. + (FTDemo_Install_Font): Handle preloading (this is, load font into a + buffer). + (FTDemo_Set_Preload): New function. + + * src/ftview.c (status): Add `preload' field. + (parse_cmdline): Handle `-p' command line option. + (usage): Updated. + (main): + + * src/ftdump.c (main): Add glyph count dump. + +2006-04-26 David Turner + + + * Version 2.2 released. + ======================= + + +2006-04-24 Werner Lemberg + + * src/ftview.c (Render_Stroke): Update parameters in call to + FT_Stroker_New. + +2006-03-20 David Turner + + Disable cache statistics dump, since the cache + internals are not available anymore. + Rename `-l' to `-L'. + Add new command line options `-m text' and `-l render_mode'. + + * src/ftview.c (status): Add member `lcd_mode'. + (Render_Text): Compensate the additional empty pixels inserted by + Draw_Index. + Handle number of glyph indices better. + (parse_cmdline): Handle `-m' and `-l'. + Updated. + (usage): Updated. + (main): Handle `status.lcd_mode'. + Updated. + Print cache statistics only conditionally (for FreeType versions + lower than 2.2). + +2006-03-02 Chia-I Wu + + * src/ftcommon.c (string_render_prepare): Fix a possible crash. + +2006-02-28 suzuki toshiya + + * Makefile: include modules.cfg to reflect module configuration, + and ftvalid is built when required stubs (ftgxval and ftotval) + are built in libfreetype. + +2006-02-27 suzuki toshiya + + * mac/ftoldmac.m68k_far.make.txt, mac/ftoldmac.ppc_classic.make.txt: + Update to new header inclusion introduced on 2006-02-16. + +2006-02-27 Chia-I Wu + + * src/ftcommon.c (my_face_requester): Attach the AFM only for PFA + and PFB. + +2006-02-25 Werner Lemberg + + * src/ftbench.c, src/ftcommon.c, src/ftvalid.c: Add proper casts + where necessary to allow compilation with C++. + Other minor fixes to remove compiler warnings. + +2006-02-01 Werner Lemberg + + * Makefile (PLATFORM): Define to `unixdev' if PLATFORM=unix and + DEVEL_DIR is defined. + (BIN_DIR, OBJ_DIR): Replaced with... + (BIN_DIR_2, OBJ_DIR_2): New variables, set with `?='. + Update all callers. + (BIN_DIR): Set also. + (COMPILE): Add definition for FT_CONFIG_MODULES_H since we always + build with an uninstalled FreeType version. + (ftdump.$(SO), ftvalid.$(SO), ftview.$(SO)): Add -DFT2_BUILD_LIBRARY + since these programs use internal headers. + + * graph/rules.mk, graph/*/rules.mk: s/OBJ_DIR/OBJ_DIR_2/. + + * src/ftcommon.c (string_render_prepare): Fix compiler warnings. + +2006-01-16 Chia-I Wu + + Add support for track kerning and a new rendering mode for kerning + comparison to ftstring. + + * src/ftcommon.c (my_face_requester): Try to attach the file having + the same name as the font, but with suffix `.afm'. + (FTDemo_New): Updated. + (FTDemo_String_Set_Kerning, FTDemo_String_Set_Vertical): Removed. + (string_load): Rewritten. + (string_render_prepare): New function. + (FTDemo_String_Draw): Rewritten to have more flexibility. For + example, we can now draw the string twice with different kerning + modes without reloading the glyphs. + + * src/ftcommon.h (TGlyph): Add more data, mainly taken from + FTDemo_Handle structure. + (KERNING_DEGREE_XXX): New enumerations. + (FTDemo_String_Context): New structure. + (FTDemo_Handle): Updated. + (FTDemo_String_Set_Kerning, FTDemo_String_Set_Vertical): Removed. + (FTDemo_String_Draw): Updated. + + * src/ftstring.c: Updated along with many cleanups. + (CELLSTRING_HEIGHT): New macro. + (RENDER_MODE_XXX): New enumeration values. + (status): Add more fields. + (event_help, event_angle_change): Updated. + (event_render_mode_change): New function. + (Process_Event): Handle `1', `2', and `t' events. + Update handling of `g', `k', and `V' events. + (error_message): Renamed to... + (write_header): This. + Display point size and rotation angle. + (main): Handle new render mode. + +2006-01-12 suzuki toshiya + + Add `ftoldmac' commandline program to test MacOS specific feature: + font file access by FSSpec, font file search by old/new QuickDraw, + and font name or ATS font name. + + * mac/ftoldmac.c: Added. + * mac/Makefile: Unix Makefile for MacOS X. + * mac/ftoldmac.m68k_far.make.txt: MPW Makefile skeleton. + * mac/ftoldmac.ppc_carbon.make.txt: MPW Makefile skeleton. + * mac/ascii2mpw.py: Python script to generate MPW Makefile from + the skeletons. + * mac/README: Add note about ftoldmac, because ft2demos/mac was + originally for demos built by CodeWarrior. + +2005-12-08 Chia-I Wu + + * src/ftview.c (error_message): Renamed to write_header. + Also write face size, first glyph index. + Write glyph name if available. + (main): Updated to use write_header. + +2005-12-04 Chia-I Wu + + * src/ftbench.c: Update copyright date. + Use `getopt' from `common.h'. + +2005-12-04 Chia-I Wu + + * src/ftbench.c: Formatting. + Make `face' and `charset' local variables. + (btest_t): Use `const' qualifier for `title'. + (bcharset_t): Change the type of `size' to `FT_Int'. + (face_requester, benchmark): Updated because `face' is no longer + global. + (test_get_char_index, test_cmap_cache, get_charset): Updated because + `charset' is no longer global. + (main): New variables, `face' and `charset'. + Updated because `face' and `charset' are local now. + `get_charset' only when perform FT_BENCH_CMAP. + +2005-12-02 Chia-I Wu + + Overhaul `ftbench.' Now it can perform tests with arbitrary load + flags and render mode. Testing `Render' instead of `Load + Render', + for example, is also possible now. + + * src/ftbench.c: Overhauled. + +2005-11-30 Werner Lemberg + + Replace flag `-c' with `-v' to indicate verbosity. + + * src/ftdump.c (verbose): New global variable. + (usage): Updated. + (Print_Charmaps): Only take a single argument. Update caller. + Always show some charmap info. + Use `verbose'. + (main): Remove verbose_cmap. + Handle `-v' instead of `-c'. + + * src/common.c (getopt): s/illegal/invalid/. + +2005-11-30 Chia-I Wu + + * src/ftdump.c (Print_Charmaps): face->charmap might be NULL. + +2005-11-30 Chia-I Wu + + * src/ftdump.c (main): New command line option `c' to show the + contents of charmaps. + (Print_Charmaps): Take one more argument: `verbose'. + (usage): Updated. + +2005-11-21 Werner Lemberg + + * graph/grinit.c (grDoneDevices): New function. + + * graph/graph.h (grInit, grDone): Remove unused declarations. + (grDoneDevices): New declaration. + + * src/ftcommon.c (FTDemo_Display_Done): Call grDoneDevices. + (FTDemo_Done): Free `handle'. + + * src/ftmulti.c (main): Call grDoneSurface and grDoneDevices. + +2005-11-18 Werner Lemberg + + * src/ftvalid.c (run_ot_validator, run_gx_validator, + run_ckern_validator): Remove unused variable `memory'. + +2005-11-18 suzuki toshiya + + * src/ftvalid.c: Use FT_TrueTypeGX_Validate, FT_ClassicKern_Validate + and FT_OpenType_Validate instead of FT_FREE (it calls FT_Free_Debug + of libfreetype, which is not a public function). + +2005-11-16 David Turner + + * graph/graph.h: Updated. + + * graph/grdevice.c (grSurfaceDone): New function to free surface + correctly. This was commented out previously. + + * graph/x11/grx11.c (gr_x11_device_done): Call XFreeCursor. + (gr_x11_surface_done): Call XFreeGC to fix memory leak. + + * src/ftcommon.c (FTDemo_Display_Done): Call `grDoneSurface' instead + of `free' to fix memory leak. + + * src/ftbench.c (main): Add the `-c' flag to specify maximum + iteration count. Useful for repeat profiling. + (usage): Updated. + +2005-09-29 Werner Lemberg + + * src/ftcommon.c (FTDemo_Update_Current_Flags): Fix variable + shadowing. + +2005-09-27 David Turner + + Fix gamma handling, mainly for LCD modes. + + * graph/gblgblit.c (GRGB_TO_RGB565): Protect arguments correctly. + + * graph/gblcolor.h, graph/gblhbgr.h, graph/gblhrgb.h, + graph/gblvbgr.h, graph/gblvrgb.h: Call gblender_use_channels. + + * graph/gblender.c (gblender_clear, gblender_reset): Handle blender + cache. + (gblender_use_channels): New function. + (gblender_reset_key): Improve. + (gblender_lookup, gblender_lookup_channel): Comment possible call to + gblender_reset. + Fix computation of `idx'. + (gblender_reset_channel_key): Fix computation of `a' and `r'. + + * graph/gblender.h (GBLENDER_SHADE_INDEX): Corrected definition. + (gblender_use_channels): New declaration. + + * src/Jamfile: Include ftcommon.c. + Fix order of link libraries. + +2005-09-22 David Turner + + * src/ftcommon.c (FTDemo_Update_Current_Flags): Fix load flags + computation to mimic libXft's behaviour. + +2005-08-30 Werner Lemberg + + * graph/graph.h (grFillRectangle): Comment out -- we don't have an + implementation. + +2005-08-23 Masatake YAMATO + + * src/ftvalid.c: Add gxvalid support. + (GX_VALIDATOR_SYMBOL): New definition. + (CKERN_VALIDATOR_SYMBOL): New definition. + (ValidatorType::GX_VALIDATE): New enum member. + (ValidatorType::CKERN_VALIDATE): New enum member. + (validator_symbols): Added GX_VALIDATOR_SYMBOL and + CKERN_VALIDATOR_SYMBOL. + (gx_table_spec): New const. + (N_GX_TABLE_SPEC): New definition. + (print_usage): Write about gxvalid and ckern valid. + (run_gx_validator): New function. + (list_gx_tables): Ditto. + (run_ckern_validator): Ditto. + (list_ckern_tables): Ditto. + (main): Call new validators. + + * src/ftvalid.c: Following are misc modifications. + (report_result): Use printf instead fprintf. Fix incorrect message. + (main): Use switch/case instead of if/else + when calling per validator functions. + Call FT_Done_Face. Use a loop to set validator. + (print_usage): Insert empty line in usage strings. + (validator_symbols): Added NULL as the last + array element. + +2005-07-04 Chia I Wu + + * src/ftcommon.i: Removed. + + * src/ftgamma.c: Updated to use api provided by ftcommon.c. + + * Makefile: Make ftgamma depend on ftcommon.c. + Remove dependency of ftmulti.c on ftcommon.i. + +2005-06-17 Werner Lemberg + + * Makefile: Update rules for ftview and ftstring which no longer + depend on ftcommon.i but on ftcommon.c. + + (LINK_ITEMS, LINK_CMD, LINK_LIBS): New variables. + (GRAPH_LINK2): Removed. + (COMMON_LINK, GRAPH_LINK): Replace with... + (LINK_COMMON, LINK_GRAPH): This. Use LINK_ITEMS, LINK_CMD, and + LINK_LIBS. + Update all affected targets. + (LINK_NEW): Temporary new link command to handle executables which + use ftcommon.c. + (FTCOMMON_OBJ): New variable to handle ftcommon.c. + +2005-06-17 Chia I Wu + + * src/ftcommon.c, src/ftcommon.h: New files. + + * src/ftstring.c: Rewritten. + Make the function keys more compatible with ftview.c. + New key 'V' for vertical rendering. + + * src/ftview.c: Rewritten. + Now we can use number keys (i.e. 1, 2, ...) to select rendering mode. + +2005-06-08 Werner Lemberg + + + * Version 2.1.10 released. + ========================== + + +2005-05-26 Werner Lemberg + + * src/ftcommon.i (get_glyph_bitmap, glyph_to_bitmap): Initialize + `target->grays' even for FT_PIXEL_MODE_MONO since it is tested in + grBlitGlyphToBitmap. + + * graph/x11/grx11.c (gr_x11_surface_init): Initialize + `xswa.border_pixel'. + +2005-05-25 Chia I Wu + + * src/ftcommon.i: Include FT_SYNTHESIS_H. + Make `render_mode' an enumeration. + + * src/ftview.c (Render_Embolden): New function. + (Process_Event, main): Update to `render_mode' enumeration. + +2005-05-23 Werner Lemberg + + * src/ftvalid (main) <'v'>: Add cast to make it compile with C++. + +2005-04-24 YAMATO Masatake + + * src/ftvalid.c: New file. + + * Makefile, src/Jamfile: Add ftvalid. + +2005-03-04 Werner Lemberg + + * src/ftgamma.c (Render_GammaGrid), src/ftmulti.c + (parse_design_coords), src/ftview.c (Render_GammaGrid): Fix compiler + warnings. + +2005-02-28 David Turner + + * src/ftbench.c (preload, memory_file, memory_size): New global + variables. + (bench_open_close): Handle `preload' by using `FT_New_Memory_Face'. + (main): Remove `preload', `memory_file', and `memory_size'. + +2005-02-23 David Turner + + * src/ftbench.c (fetch_test, cbox_test): Fix memory leaks. + +2005-02-12 Werner Lemberg + + Make ft2demos support a separate build directory. + + * Makefile (have_makefile): New variable. Set if the build + directory is the same as the source directory. + (GRAPH_DIR): Give full path. + (BIN_DIR, OBJ_DIR): Updated. + (FT_INCLUDES): Include $(OBJ_BUILD). + (LINK) : Fix path to `libtool'. + + * README: Updated. + +2004-12-15 Werner Lemberg + + * src/ftcommon.i (glyph_to_bitmap): Don't convert 1bpp bitmaps. + +2004-12-14 Werner Lemberg + + * src/ftcommon.i: Include new FT_BITMAP_H. + Remove dead code. + (ft_bitmap): New global variable. + (init_freetype): Call FT_Bitmap_New. + (done_freetype): Call FT_Bitmap_Done. + (glyph_to_bitmap, get_glyph_bitmap): Handle 2bpp and 4bpp bitmaps + using FT_Bitmap_Convert. + +2004-12-12 Steve Hartwell + + * graph/grblit.c (blit_mono_to_rgb32): Advance read buffer properly. + +2004-11-26 Jouk Jansen + + * vms_make.com: Don't assume that the ft2demos package is a + subdirectory of freetype2. + Fix `ccopt'. + +2004-11-19 Werner Lemberg + + * src/ftview.c (Render_Waterfall): Handle size as points, not as + pixels. + + * src/ftstring.c (layout_glyphs), src/ftmulti.c (LoadChar), + src/ftcommon.i (set_current_image_type): Always use + FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH. + +2004-11-16 Dr. Martin P.J. Zinser + + * vms_make.com: Updated to be in sync with vms_make.com from FT2. + +2004-10-18 Werner Lemberg + + * graph/gblblit.c (gblender_blit_init): Fix blit test. + +2004-09-08 Jouk Jansen + + * graph/x11/grx11.c [__VMS]: Include vms_x_fix.h. + + * vms_make.com: Updated. + +2004-08-29 Werner Lemberg + + * graph/gblender.c (gblender_lookup, gblender_lookup_channel): + s/index/idx/ to avoid compiler warnings. + +2004-08-19 Werner Lemberg + + * src/ftstring.c (prepare_text): Handle encoding = 0. + +2004-07-14 Werner Lemberg + + * src/ftcommon.i (get_glyph_bitmap): Don't accept a `missing' + character with zero or negative width. + +2004-07-13 David Turner + + * graph/x11/grx11.c (gr_x11_device_init): Fix memory leak. + + * src/ftbench.c (bench_cmap_parse): New function, assigned to + key `j'. + (usage, main): Updated. + + * src/ftcommon.i (install_font_file): Initialize `cmap_index' here. + (my_face_requester): Don't initialize `cmap_index'. + (glyph_to_bitmap): Add new argument to get glyph reference. + (get_glyph_bitmap): Updated. + + * src/ftview.c (Render_Stroke): Increase stroker limit. + Fix glyph indices. + Fix memory leaks. + +2004-06-24 David Turner + + + * Version 2.1.9 released. + ========================= + + +2004-06-24 Werner Lemberg + + * Makefile (GRAPH_LINK): Add $(MATH). + Remove $(MATH) from link rule for ftstring. + +2004-06-23 Werner Lemberg + + * src/ftbench.c: Fix compiler warnings. + (usage): Updated. + +2004-06-23 David Turner + + * src/ftbench.c (bench_open_close): New benchmark to measure face + open/close performance (controlled by the `i' flag for the `-b' + command-line option flag). + (main): Use it. + +2004-06-11 Werner Lemberg + + * src/ftstring.c (layout_glyphs): Updated to latest FreeType library + changes. + +2004-06-03 Werner Lemberg + + Add autohinting toggling (using the `f' key) to ftstring. + Handle new inter-letter spacing support for autohinting. + + * src/ftstring.c (autohint): New global variable. + (layout_glyphs): Handle `autohint' variable. + Handle new `lsb_delta' and `rsb_delta' elements of + face->glyph->metrics. + Remove some dead code. + (Help): Updated. + (Process_Event): Handle key `f'. + Extend key `k'. + +2004-05-23 Werner Lemberg + + * graph/gblender_blit.c: Renamed to... + * graph/gblblit.c: This. + Updated to use new include file names. + (gblender_blit_init): Change 11th argument to `unsigned char*' + + * graph/gblender_blit.h: Renamed to... + * graph/gblblit.h: This. + Updated. + + * graph/gblender_blit_any.h: Renamed to... + * graph/gblany.h: This. + Updated to use new include file names. + + * graph/gblender_blit_hbgr.h: Renamed to... + * graph/gblhbgr.h: This. + + * graph/gblender_blit_hrgb.h: Renamed to... + * graph/gblhrgb.h: This. + + * graph/gblender_blit_vbgr.h: Renamed to... + * graph/gblvbgr.h: This. + + * graph/gblender_blit_vrgb.h: Renamed to... + * graph/gblvrgb.h: This. + + * graph/gblender.h (GBLENDER_CHANNEL_VARS): Remove final `;'. + * graph/grblit.c: Updated to use new include file names. + + * graph/rules.mk, graph/Jamfile: Updated. + + * Makefile: Build `ftgamma'. + + * src/ftview.c (Render_GammaGrid): Fix compiler warnings. + (Help): Updated. + + * src/ftgamma.c: Fix compiler warnings. + +2004-05-20 David Turner + + Adding support for fast gamma-corrected alpha-blending. + New test program `ftgamma'. + + * graph/grblit.c: Include gblender_blit.h. + (GRAY8): New macro. + (blit_gray8_to_555, blit_gray8_to_565, blit_gray8_to_24, + blit_lcd8_to_24, blit_lcd28_to_24) [GRAY8]: New functions. + (blit_gray8_to_32): New function. + (gr_gray8_blitters) [GRAY8]: New function table. + (grSetGlyphGamma): New function. + (grBlitGlyphToBitmap): Implement blending. + * graph/graph.h (grSetGlyphGamma): New declaration. + + * graph/grfont.c, graph/grfont.h (grSetPixelMargin): New function. + + * graph/gblender.c, graph/gblender.h, graph/gblender_blit.c, + graph/gblender_blit.h, graph/gblender_blit_any.h, + gblender_blit_color.h, gblender_blit_hbgr.h, gblender_blit_hrgb.h, + gblender_blit_vbgr.h, gblender_blit_vrgb.h: New files. + + * graph/Jamfile (graph_sources): Add gblender and gblender_bnit. + * graph/rules.mk (GRAPH_H, GRAPH_OBJS): Updated. + + * src/ftcommon.i (the_gamma): New global variable. + (Init_Display): Call grSetGlyphGamma. + + * src/ftgamma.c: New demo program. + + * src/ftview.c: Include math.h. + (Render_GammaGrid): New function. + (Help): Updated. + (Process_Event): Assign increase and decrease of gamma value to + keys `g' and `G'. + Assign gamma grid rendering mode to key `K'. + (main): Updated. + + * src/Jamfile (LINKLIBS): Add -lm. + (GRAPHIC_PROGRAMS): Add ftgamma.c. + Add LINKLIBS for all GRAPHIC_PROGRAMS. + * vms_make.com: Updated. + +2004-05-19 George Williams + + * src/ftmulti.c (main): Use default axis values. + +2004-05-09 Werner Lemberg + + * src/ftdump.c (put_unicode_be16): Initialize `ch'. + +2004-04-29 Flavio Stanchina + + Parse SFNT `name' table in ftdump if new option -n is given. + + * src/ftdump.c: Include FT_SFNT_NAMES_H and FT_TRUETYPE_IDS_H. + (name_tables): New global variable. + (usage): Show -d and -i info conditionally. + Add -n info. + (platform_id, name_id, put_ascii, put_unicode_be16, + Print_Sfnt_Names): New functions. + (main): Handle -n. + +2004-04-24 George Williams + + Add GX var font support to ftmulti. + Add command line option `-d' to ftmulti to select design + coordinates. + + * src/ftmulti.c: New global variables `requested_pos' and + `requested_cnt'. + Make `multimaster' a pointer. + (parse_design_coords): New function. + (Help, usage): Updated. + (Process_Event) : Don't use fixed 20 unit steps but a + proportional granularity. + Use FT_Set_Var_Design_Coordinates instead of + FT_Set_MM_Design_Coordinates. + (main): Handle new option `-d'. + Use FT_Get_MM_Var and FT_Set_Var_Design_Coordinates instead of + FT_Get_Multi_Master and FT_Set_MM_Design_Coordinates. + +2004-04-23 Werner Lemberg + + * src/ftcommon.i (TFont): Add `cmap_index'. + (my_face_requester): Set `font->cmap_index'. + (get_glyph_index): Properly set third argument. + +2004-04-21 David Turner + + + * Version 2.1.8 released. + ========================= + + +2004-04-10 Werner Lemberg + + * src/ftbench.c (cmap_cache_test, main): Use proper cast for + `face_id'. + +2004-03-26 Ulrich + + * graph/x11/grx11.c (grX11DeviceRec): Add `visual' member. + (gr_x11_device_init): Directly manipulate `x11dev'. + Use XGetVisualInfo. + (gr_x11_surface_init): Directly use `x11dev'. + Fix other visual selection problems. + +2004-03-20 Steve Hartwell + + Updated to make it compile with newer MacOS versions. + + * graph/mac: Don't include Windows.h but MacWindows.h. + Include SIOUX.h only if __MWERKS__ is defined. + (refresh_rectangle): Updated. + (listen_event): Remove `theEventMask'. + Updated. + Make code conditional to __MWERKS__ which is related to SIOUX. + (init_surface): Handle gr_pixel_mode_rgb24. + Updated. + +2004-02-20 Werner Lemberg + + Add `light' render mode to ftview (using key `L'). + + * src/ftcommon.i (set_current_image_type): Handle + FT_LOAD_TARGET_LIGHT. + (glyph_to_bitmap, get_glyph_bitmap): Updated. + * src/ftview.c (Process_Event): Provide proper header for `light' + render mode. + (Help): Updated. + +2004-02-18 Werner Lemberg + + * src/ftcommon.i: Include FT_CACHE_MANAGER_H and FT_STROKER_H. + Don't include obsolete FT_CACHE_* macros. + (glyph_to_bitmap): Remove declaration of `error'. + + * src/ftview.c: Don't include FT_CACHE_MANAGER_H. + (Render_Stroke): Remove declaration of `error'. + Fix other compiler warnings. + (Render_Waterfall): Remove declaration of `face'. + +2004-01-29 David Turner + + * src/ftcommon.i (get_glyph_bitmap): Rewritten for new cache code. + (glyph_to_bitmap): New function. + + * src/ftview.c (Render_Stroke): New function. + (Render_Waterfall): Use FTC_Manager_LookupFace. + (Process_Event) <' '>: Provide header text for stroked text. + (main): Add Render_Stroke. + +2003-12-26 Werner Lemberg + + * src/ftcommon.i (set_current_size): Don't allow values larger than + 0xFFFF. + * src/ftview.c (main): Set `face'. + (Render_Waterfall): Don't set `face'. + use precomputed value instead. + (main): Don't use `face->' but `size->face->'. + Use `exit' in case of fatal error. + Don't test `face' but `size' for printing error messages. + Print proper error message for FT_Err_Invalid_PPem. + +2003-12-21 David Turner + + * graph/graph.h (grPixelMode): Add `gr_pixel_mode_lcd2' and + `gr_pixel_mode_lcdv2' modes. + (grBlitGlyphToBitmap): Remove `is_bgr' argument. + Updated all callers. + * graph/grblit.c (blit_mono_to_pal8): Speed up loop. + (blit_lcd_to_24, blit_lcdv_to_24): Remove `is_bgr' argument. + (blit_lcd2_to_24, blit_lcdv2_to_24): New functions. + (compute_clips): Updated. + (grBlitGlyphToBitmap): Remove `is_bgr' argument. + Use new blitter functions for the two new modes. + + * graph/win32/Jamfile: s/TOOLSET/JAM_TOOLSET/. + + * src/gbench.c, src/gbench.h: New files. + + * src/Jamfile: Handle `gbench'. + + * src/ftbench.c, src/ftcommon.i, src/ftview.c: Updated to use new + FreeType cache implementation and new blitter modes. + +2003-11-10 Werner Lemberg + + Add display of bitmap fonts to ftstring. + + * src/ftstring.c (layout_glyphs): Call FT_Vector_Transform for + scalable fonts only. + (render_string): Handle bitmap fonts. + +2003-11-07 Werner Lemberg + + + * Version 2.1.7 released. + ========================= + + +2003-11-06 David Turner + + + * Version 2.1.6 released. + ========================= + + +2003-11-01 Werner Lemberg + + * src/testname.c: Include ft2build.h. + +2003-10-22 Werner Lemberg + + * src/ftdump.c (usage): Fix typo. + +2003-10-17 Werner Lemberg + + * src/ftmulti.c (main): Call `FT_Done_Face'. + + * src/ftstring.c (main): Clean up glyph and face objects, then + finish FreeType library. + +2003-10-10 Werner Lemberg + + * src/ftmulti.c (Help): Document all keys. + (main): Call FT_Done_FreeType. + +2003-09-02 David Turner + + + * Version 2.1.5 released. + ========================= + + +2003-06-30 Werner Lemberg + + * src/ftdump.c (Print_Fixed): Print all elements of + face->available_sizes. + +2003-06-17 Werner Lemberg + + * src/*.c: s/ft_glyph_format_*/FT_GLYPH_FORMAT_*/. + s/ft_pixel_mode_*/FT_PIXEL_MODE_*/. + s/ft_glyph_bbox_*/FT_GLYPH_BBOX_*/. + +2003-06-16 YAMANO-UCHI Hidetoshi + + * graph/x11/rules.mk (GRAPH_LINK): Add run-time search path on + Unix systems. + +2003-06-16 Werner Lemberg + + * src/ftcheckfixedwidth.c: Renamed to... + * src/ftchkwd.c: This. + * src/testnames.c: Renamed to... + * src/testname.c: This. + * src/Jamfile, Makefile: Updated. + +2003-06-15 Werner Lemberg + + * *.mk: Updated and revised to latest changes in FreeType 2. + +2003-06-13 Werner Lemberg + + * src/ftdump.c (Print_Type): Don't emit bbox, ascender, descender, + and height for non-scalable fonts. + +2003-06-08 Werner Lemberg + + * graph/x11/grx11.c (gr_x11_surface_init): Add proper cast in call + to grAlloc. + + * src/ftbench.c (main): Add proper cast in call to malloc. + Use FT_ENCODING_NONE, not 0. + +2003-06-01 Werner Lemberg + + * src/ftview.c (Render_Waterfall): Handle fixed-sized fonts better. + +2003-05-27 Martin Zinser + + * vms_make.com: Handle ftbench. + +2003-05-21 Werner Lemberg + + * src/ftcommon.i (install_font_file): Initialize new elements of + reallocated `fonts' array with zero bytes. + +2003-05-20 Martin Zinser + + * descrip.mms: Removed. Now created by... + + * vms_make.com: New file. + +2003-05-19 Werner Lemberg + + * src/ftcommon.i (install_font_file): Use calloc to allocate + `fonts'. + (done_freetype): Deallocate `fonts'. + +2003-04-28 Werner Lemberg + + * src/ftcheckfixedwidth.c: Remove unused global variables; make + global variables local to `main' if possible. + Fixed compiler warnings (s/index/idx/). + +2003-04-25 Davor Buvinic + + * Makefile: Add rules to build ftcheckfixedwidth. + +2003-04-24 Anthony Fok + + * src/ftcommon.i: Replace `ft_encoding_*' with `FT_ENCODING_*'. + (file_suffixes): Add `.otf'. + (install_font_file): Set font->num_indices depending on encoding. + * src/ftmulti.c, src/ftstring.c, src/fttimer.c, src/ftview.c: + Replace `ft_encoding_*' with `FT_ENCODING_*'. + * src/testnames.c: Replace `ft_render_mode_mono' with + `FT_RENDER_MODE_MONO'. + +2003-04-09 David Turner + + * Jamfile: Set FT2_TOP. + * src/ftbench.c (main): Use `long' for `max_bytes'. + * src/ftcheckfixedwidth.c: New test program. + * src/ftstring.c: (prepare_text): Remove unused variable `codepoint'. + (apply_gamma): Fix initialization of `buffer'. + * src/ftview.c (Render_Waterfall): Print more characters. + +2003-04-08 David Turner + + + * Version 2.1.4 released. + ========================= + + +2002-12-02 Antoine Leca + + * src/ftstring.c: Use `FT_ENCODING_*' everywhere instead of + deprecated lowercase variants. + (prepare_text): 'message' for the -m option is now expected to be + encoded with UTF-8. This allows testing of Unicode chars, including + non-BMP characters. + +2002-12-01 Antoine Leca + + * graph/win32/rules.mk: Adding link rules for Borland C++. + +2002-11-18 David Turner + + + * Version 2.1.3 released. + ========================= + + +2002-11-10 David Turner + + * src/Jamfile (PROGRAMS): Add `ftcheckfixedwidth'. + +2002-09-25 David Turner + + * graph/win32/grwin32.c: Removing compiler warnings. + + * descrip.mms: Removing 'ftmemchk' and 'testnames' from the list + of programs to compile, these are now obsolete. + +2002-09-25 Anthony Fok + + * src/ftbench.c: The program did perform out-of-bound memory writes + with certain fonts containing a buggy charmap. + +2002-09-18 Werner Lemberg + + Add LCD BGR support. + + * graph/grblit.c (blit_lcd_to_24, blit_lcdv_to_24): Add parameter + `is_bgr' to assign color components in reversed order. + (grBlitGlyphToBitmap): Add parameter `is_bgr' passed on to + `blit_lcd_lcd*'. + Updated all callers. + Remove unused label. + * graph/graph.h, graph/grfont.c: Updated. + + * src/ftcommon.i (set_current_image_type), src/ftview.c (Render_All, + Render_Text, Render_Waterfall, Process_Event): Handle LCD modes + 3 and 4. + * src/ftstring.c, src/ftmulti.c: Updated. + + * graph/x11/grx11.c (gr_x11_device_init, gr_x11_surface_init): + Remove unused variables. + (gr_x11_format_rgb555): Fix typos. + +2002-09-08 David Turner + + Add support for sub-pixel rendering. + + * graph/x11/grx11.c, graph/win32/grwin32.c: Completely rewritten to + support 24-bits RGB surfaces. This is needed to test sub-pixel + rendering. + + Note that other drivers haven't been touched yet. The X11 driver + doesn't work with 8-bit displays for now, but a reduced mode will + probably be introduced in the near future. + + * graph/graph.h (grPixelMode): Add `gr_pixel_mode_lcd' and + `gr_pixel_mode_lcdv'. + * graph/grblit.c (compute_clips): Use `gr_pixel_mode_lcd' and + `gr_pixel_mode_lcdv'. + (compose_pixel_full): New macro. + (compose_pixel): Use it. + (blit_lcd_to_24, blit_lcdv_to_24): New functions. for RGB-decimated + modes (BGR not yet implemented). + (gr_color_blitters): Updated. + (grBlitGlyphToBitmap): Support new pixel modes. + + * src/Jamfile (PROGRAMS): Don't include fttimer, fttry, and + testnames. + + * src/ftbench.c: Updated to latest changes in FreeType library. + * src/ftcommon.i (Init_Display): New default mode is + `gr_pixel_mode_rgb24'. + (set_current_image_type, get_glyph_bitmap): Add support for LCD + modes (horizontal and vertical). + * src/ftview.c (Render_Waterfall): Call `set_current_size'. + (Help): Document new `L' key for cycling through the pixel modes. + (Process_Event): Handle `L' key. + +2002-08-04 Vincent Caron + + * src/ftcommon.i (Text), src/ftmulti.c (Text): s/jumped/jumps/. + * src/ftview.c (Render_Waterfall): Remove unused variable. + +2002-07-03 David Turner + + * src/ftview.c (Render_Waterfall): New function, adding a + "waterfall" rendering mode (accessible by cycling modes with the + space bar). + (Process_Event, main): Use it. + +2002-07-01 David Turner + + * src/ftbench.c: Adding the "-p" option to pre-load font files in + memory. This is a very useful thing to quantify the performance + improvements achieved by many of FreeType internal optimizations + regarding stream i/o. + + * src/ftstring.c (reset_transform): Fix Werner's incorrect fix. + +2002-06-25 Werner Lemberg + + * src/ftstring.c (reset_transform): Fix transformation matrix. + +2002-06-23 Vincent Caron + + Adding support for gamma-corrected display to ftstring (assigned to + `g', F9, and F10 keys). + + * src/ftstring.c (use_gamma, gamma_value, gamma_ramp): New global + variables. + (init_gamma, apply_gamma, draw_gamma_ramp): New functions. + (render_string): Use apply_gamma. + (Help): Updated. + (Process_Event): Handle `g', F9, and F10 keys. + (main): Call init_gamma and draw_gamma_ramp. + +2002-06-21 David Turner + + + * Version 2.1.2 released. + ========================= + + +2002-06-14 Werner Lemberg + + * Makefile, graph/rules.mk: s/TOP/TOP_DIR/, s/TOP2/TOP_DIR_2/. + +2002-06-10 Werner Lemberg + + * src/ftbench.c: s/index/idx/. + Fixed more gcc compiler warnings. + +2002-06-10 David Turner + + * src/ftbench.c: Removing compiler warnings. + + * src/ttdebug.c: Updating to latest internal changes. + +2002-06-09 David Turner + + + * Version 2.1.1 released. + ========================= + + +2002-06-07 David Turner + + Adding Vincent Caron's benchmark program. + + * src/ftbench.c: New file. + * Makefile, src/Jamfile: Updated. + Other minor fixes. + + * src/ftview.c (Render_Text): Call get_glyph_index() conditionally. + +2002-05-20 Werner Lemberg + + * src/ftcommon.i (get_glyph_bitmap): Use `sbit->num_grays'. + Handle `sbit->buffer == 0' correctly. + +2002-05-17 Michael Pfeiffer + + * graph/beos/Jamfile: New file. + +2002-05-12 Werner Lemberg + + * README: Updated. + +2002-05-12 Michael Pfeiffer + + * graph/Jamfile: Add support for BeOS. + +2002-04-28 Werner Lemberg + + * src/ftview.c (Render_Text): Don't call `get_glyph_index'. This + is done in `get_glyph_bitmap'. + + * src/ftstring.c (encoding): New global variable, initialized to + `ft_encoding_unicode'. + (render_mode): Removed. + (make_tag): New utility function (copied from ftcommon.i). + (prepare_text): Call `FT_Select_Charmap'. + (Process_Event): Don't handle ` '. + (main): Add option -e to select encoding. + (usage): Document it. + + * src/ftmulti.c (encoding): New global variable. + (make_tag): New utility function (copied from ftcommon.i). + (main): Add option -e to select encoding. + (usage): Document it. + +2002-04-28 Martin Zinser + + * descrip.mms: Add clean target. + Handle compiler options better. + +2002-04-17 David Turner + + + * Version 2.1.0 released. + ========================= + + +2002-04-01 Werner Lemberg + + * graph/x11/grx11.c: Use `c_class' instead of `class' if compiling + with C++. + * src/ftcommon.i (encoding): Use `FT_Encoding' type. Update all + using code. + (done_glyph_bitmap): Use cast. + * src/ftview.c: Updated to changes in `ftcommon.i'. + (main): Use cast for `encoding'. + +2002-03-30 Werner Lemberg + + * src/ftdump.c (Print_Type): Use `%ld' for some fields. + * src/testnames.c (main): Exit if no parameter. + +2002-03-21 David Turner + + * graph/grblit.c, graph/win32/grwin32.c, src/common.c, + src/ftcommon.i, src/ftdump.c: Getting rid of compiler warnings. + +2002-03-08 David Turner + + + * Version 2.0.9 released. + ========================= + + +2002-03-06 David Turner + + * src/ftdump.c: Added display of ascender/descender/text height. + + * Jamfile: Support the FT2_TOP environment variable to indicate + where the FreeType 2 sources are located. This is very useful for + switching between the STABLE and HEAD branches of the library. + +2002-03-05 David Turner + + * src/ftdump.c: Added the display of a font's Postscript name, + EM size and global Bbox. Now supports the debugging mode of + 2.1.x. + + * src/ftview.c: Minor change to support debugging mode of 2.1.x. + +2002-02-14 Detlef Würkner + + * src/fttimer.c (ConvertRaster): Handle embedded bitmaps properly. + * src/ftstring.c (use_sbits): Default value is no 0. + (layout_glyphs): Handle `use_sbits'. + (Process_Event): Make friendlier error messages. + +2002-02-09 David Turner + + + * Version 2.0.8 released. + ========================= + + +2002-02-02 David Turner + + + * Version 2.0.7 released. + ========================= + + +2002-01-25 Martin Zinser + + * src/common.h ([VMS]): Alias stuff specific to getopt. + * graph/grinit.c ([DEVICE_X11]): Handle VMS. + * descrip.mms: New file for compiling the demo programs with + OpenVMS. + +2002-01-07 David Turner + + + * Version 2.0.6 released. + ========================= + + +2001-12-31 Werner Lemberg + + * graph/x11/rules.mk: Fix typo (wilcard -> wildcard). + +2001-12-30 David Turner + + * README: Updated to version 2.0.6. + + * graph/x11/rules.mk: Updated X11 detection rules: "/usr/X11R6" and + "/usr/local/X11R6" are now probed as a fallback. This allows the + test programs to work automatically on Debian Linux systems (which + only use "/usr/bin/X11" in the path). + +2001-12-21 David Turner + + * src/ftcommon.i (get_glyph_bitmap): Added a missing error check. + Make the function return an error code if necessary. + * src/testnames.c (main): Fix typo. + +2001-12-15 Werner Lemberg + + * Makefile: Add `testnames' program. + * src/testnames.c (main): Remove unused variable. + First command line parameter is now used as the font to be tested + instead of a fixed string. + +2001-12-14 David Turner + + * src/ftstring.c (layout_glyphs): Fix centering bug. + +2001-12-12 David Turner + + * src/testnames.c: New test program. + +2001-12-08 David Turner + + Use new charmap cache. + + * src/ftcommon.i: Include FT_CACHE_CHARMAP_H. + (cmap_cache): New global variable. + (encoding): Change type to FT_UInt32. + (init_freetype): Initialize charmap cache. + (get_glyph_index): New function. + (get_glyph_bitmap): Use it. + Increase pixel dimensions to 48 for sbit cache. + Add ftc_image_format_outline flag if not a bitmap glyph. + * src/ftview.c: Use `get_glyph_index'. + +2001-12-06 David Turner + + An update to use the new cache manager code. + + * src/ftcommon.i: s/FTC_Image_Cache/FTC_ImageCache/. + s/FTC_SBit_Cache/FTC_SBitCache/. + s/FTC_Image_Desc/FTC_ImageDesc/. + s/image_type/type/. + (done_glyph_bitmap): New function. + (get_glyph_bitmap): Add new argument. + Use sbits cache only of pixel size <= 32. + Other fixes. + * src/ftview.c (Render_All, Render_Text): Updated to changes in + ftcommon.i. + +2001-12-05 Werner Lemberg + + * src/ftcommon.i, src/ftview.c: s/manager/cache_manager/ to avoid + compiler warnings. + +2001-12-05 Taiji Yamada + + * src/graph/x11/grx11.c (done_surface): Free and reset color map. + (init_surface): Use private colormap if there are no more shared + colormap entries. + +2001-10-27 David Turner + + * src/ftcommon.i (use_sbits_cache): Set to 1. + +2001-10-26 Leonard Rosenthol + + * mac/codewarrior/carbonprefix.h: New file to define building + the demos Carbonized. + * mac/codewarrior/ftview.prj: Updated for CW7 and to build a + Carbonized version. + * mac/getargv.c: Updated to build Carbonized. + * mac/ftview_m.c: Updated to build Carbonized. + +2001-10-18 David Turner + + * Jamrules: Define X11_LINKLIBS. + * README: Updated. + * graph/os2/Jamfile: Define GROS2_PATH and GRAPH_LINKLIBS. + * src/Jamfile (PROGRAMS): Add fttry. + Fix order of libraries. + * src/ftview.c (main): Update cache dump code. + * src/ftlint.c (main) [TEST_PSNAMES]: Add some debugging code. + * src/fttry.c (main) [DUMP_NAME]: Add some glyph name debugging code. + +2001-10-17 David Turner + + + * Version 2.0.5 released. + ========================= + + +2001-09-21 Eric Olson + + * graph/os2/gros2pm.c: Remove global variable `window_created'. + (LOCK): Fix typo. + (refresh_rectangle): Use LOCK() and UNLOCK(). + (init_surface): Don't use `window_created'. + Use LOCK() and UNLOCK(). + (RunPMWindow): Use LOCK() and UNLOCK(). + Fix typo. + Don't use `window_created'. + (Message_Process): Allow F9, F10, and others keys to pass through + the application. + Use LOCK() and UNLOCK(). + +2001-09-10 Werner Lemberg + + * README: Slight update. + +2001-08-25 Werner Lemberg + + Added CMap support to ftview: The new flag `-e' accepts an encoding + tag as defined in freetype.h (e.g. `unic') to select a character + map. Only fonts with a valid character map are selected. + + * src/ftcommon.i: s/num_glyphs/num_indices/. + (encoding): New global variable. + (make_tag): New function. + (install_font_file): If a cmap tag has been specified, load + functions only which have a valid cmap. + (my_face_requester): Select cmap also if `encoding' is non-zero. + (get_glyph_bitmap): Map char index to glyph if `encoding' is + non-zero. + + * src/ftview.c: s/first_glyph/first_index/. + (Help): Adjust help text. + (usage): Document -e switch. + (main): Implement -e switch. + Adjust `Header'. + + + * Version 2.0.4 released. + ========================= + + +2001-06-27 Werner Lemberg + + * src/ftmemchk.c: s/memtest/ftmemchk/. + +2001-06-27 David Turner + + * src/ftcommon.i, src/ftmemchk.c: Changes due to the modification of + the FT_CALLBACK_DEF macro definition. + +2001-06-24 David Turner + + Renamed the test program "memtest" to "ftmemchk". + + * src/memtest.c: Renamed to ... + * src/ftmemchk.c: This file. + * Makefile, src/Jamfile: Updated. + + + * Version 2.0.3 released. + ========================= + + +2001-05-28 David Turner + + * Jamfile, src/Jamfile, graph/os2/Jamfile, graph/win32/Jamfile, + graph/x11/Jamfile: Updating Jamfiles to correctly link the graphics + programs on all platforms with Jam. + + * src/ftstring.c: Removing debugging output. + +2001-04-25 David Turner + + * graph/beos/grbeos.cpp, graph/beos/grbeos.h, graph/beos/rules.mk, + graph/grinit.c: added BeOS graphics driver to MiGS. + +2001-04-04 Werner Lemberg + + * graph/allegro/gralleg.c, graph/mac/grmac.c, graph/os2/gros2pm.c, + graph/x11/grx11.c: Don't include system-specific header but + `grobjs.h'. + * graph/x11/grx11.c: Some structural reorderings. + Include `grdevice.h'. + * graph/grinit.c: Use subdirectories for #include. + * graph/rules.mk, graph/*/rules.mk (DEVICE_INCLUDE): Removed. + + * Jamrules, Jamfile, */Jamfile: Updated. It now compiles with + X11 also (no checking for X header and lib locations yet). + +2001-04-04 David Turner + + * Jamrules, Jamfile, graph/Jamfile, graph/x11/Jamfile, + graph/win32/Jamfile, graph/os2/Jamfile, src/Jamfile: Added Jamfiles + to build the FreeType 2 demos with Jam. Be careful, they probably + don't work on Unix and OS/2 yet. + +2000-03-24 David Turner + + + * Version 2.0.2 released. + ========================= + + +2001-03-23 David Turner + + * Makefile, src/*.c: Changed to new header inclusion scheme. + +2001-03-13 Werner Lemberg + + * graph/x11/grx11.c: Increase MAX_PIXEL_MODES to 100. + +2001-03-06 Werner Lemberg + + * src/memtest.c (my_memory): Add cast to remove C++ compiler error. + +2001-02-22 David Turner + + * src/memtest.c: Fixed the debug memory allocator. The constant + "my_memory" was replaced by a function that allocates a new "memory + allocator through "my_alloc()" and returns it. + +2001-02-06 James H. Cloos Jr. + + * src/ftview.c (Render_Text): Fix rendering of test string. + +2001-01-31 Werner Lemberg + + * src/ftstring.c (Help): Added `void' type. + +2000-12-09 Werner Lemberg + + * Makefile: Added $(LDFLAGS) variable for `unix' link target. + +2000-12-01 David Turner + + + * Version 2.0.1 released. + ========================= + + +2000-11-09 David Turner + + + * Version 2.0 released. + ======================= + + +Local Variables: +version-control: never +coding: utf-8 +End: diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/allegro/gralleg.c freetype-2.8/=unpacked-tar2=/graph/allegro/gralleg.c --- freetype-2.7.1/=unpacked-tar2=/graph/allegro/gralleg.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/allegro/gralleg.c 2016-10-14 07:08:52.000000000 +0000 @@ -0,0 +1,220 @@ +/******************************************************************* + * + * ft2demos/graph/allegro/gralleg.c + * + * Allegro driver for MiGS (minimalist graphics subsystem). Allegro + * (Allegro Low LEvel Gaming ROutines) is a library for sound, + * graphics, timers, etc., and is available on 32-bit DOS, Windows, + * UNIX (X11, DGA, DGA2), Linux (svgalib, framebuffer) and BeOS. + * + * http://liballeg.org/ + * https://github.com/liballeg + * + ******************************************************************/ + +/* FT graphics subsystem */ +#include "grobjs.h" +#include "grdevice.h" + +/* Allegro header */ +#include + +static void set_graypalette() +{ + PALETTE pal; + int i = 0; + + for(; i < 256; i++) { + pal[i].r = i >> 2; + pal[i].g = i >> 2; + pal[i].b = i >> 2; + } + + set_palette(pal); +} + +static int almodes[] = { + 32, + 24, + 16, + 15, + 8, + 0 +}; + +static int gray[256]; + +static int init_device(void) +{ + int* almode = almodes; + + if(allegro_init()) return -1; + if(install_keyboard()) return -1; + + while(*almode) { + set_color_depth(*almode); + if(*almode == 8) set_graypalette(); + if(set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) == 0) { + int i = 0; + for(; i < 256; i++) gray[i] = makecol(i, i, i); + + clear(screen); + return 0; + } + almode++; + } + + return -1; +} + +static void done_device(void) +{ + allegro_exit(); +} + +static void alset_title(grSurface* surface, const char* title_string) +{ + set_window_title(title_string); +} + +static void alrefresh_rect(grSurface* surface, int x, int y, int width, int height) +{ + unsigned char* bufptr = surface->bitmap.buffer; + int cx = 0, cy = 0; + + switch(surface->bitmap.mode) { + case gr_pixel_mode_mono: + for(; cy < height; cy++) { + for(cx = 0; cx < width; cx++) { + putpixel(screen, cx + x, cy + y, (*bufptr++ ? gray[255] : gray[0])); + } + } + break; + + case gr_pixel_mode_gray: + for(; cy < height; cy++) { + for(cx = 0; cx < width; cx++) { + putpixel(screen, cx + x, cy + y, gray[*bufptr++]); + } + } + break; + + default: + break; + } +} + +static void aldone(grSurface* surface) +{ + grDoneBitmap(&(surface->bitmap)); +} + +static int key_translator[] = { + KEY_F1, grKeyF1, + KEY_F2, grKeyF2, + KEY_F3, grKeyF3, + KEY_F4, grKeyF4, + KEY_F5, grKeyF5, + KEY_F6, grKeyF6, + KEY_F7, grKeyF7, + KEY_F8, grKeyF8, + KEY_F9, grKeyF9, + KEY_F10, grKeyF10, + KEY_F11, grKeyF11, + KEY_F12, grKeyF12, + KEY_LEFT, grKeyLeft, + KEY_RIGHT, grKeyRight, + KEY_UP, grKeyUp, + KEY_DOWN, grKeyDown, + KEY_INSERT, grKeyIns, + KEY_DEL, grKeyDel, + KEY_HOME, grKeyHome, + KEY_END, grKeyEnd, + KEY_PGUP, grKeyPageUp, + KEY_PGDN, grKeyPageDown, + KEY_ESC, grKeyEsc, + KEY_TAB, grKeyTab, + KEY_BACKSPACE, grKeyBackSpace, + KEY_ENTER, grKeyReturn, + 0, 0 +}; + +static int translateKey(int scancode) +{ + int* trans = key_translator; + + while(*trans) { + if(scancode == *trans++) { + return *trans; + } + trans++; + } + + return 0; +} + +static int allisten_event(grSurface* surface, int event_mode, grEvent* event) +{ + int ch = 0, ascii = 0, scancode = 0, shifts = 0; + + event->type = gr_event_key; + + while(1) { + ch = readkey(); + + shifts = 0; + + if(key_shifts & KB_SHIFT_FLAG) shifts |= grKeyShift; + if(key_shifts & KB_CTRL_FLAG) shifts |= grKeyCtrl; + if(key_shifts & KB_ALT_FLAG) shifts |= grKeyAlt; + + ascii = ch & 0xFF; + scancode = ch >> 8; + + if(ascii > 31 && ascii < 127) { + event->key = ascii | shifts; + return 1; + } + + if( (ch = translateKey(scancode)) ) { + event->key = ch | shifts; + return 1; + } + } + + return 0; +} + +static int init_surface(grSurface* surface, grBitmap* bitmap) +{ + if(grNewBitmap(bitmap->mode, bitmap->grays, bitmap->width, bitmap->rows, bitmap)) return 0; + + surface->device = &gr_alleg_device; + surface->bitmap = *bitmap; + surface->refresh = 0; + surface->owner = 0; + surface->saturation = 0; + surface->blit_mono = 0; + + surface->refresh_rect = alrefresh_rect; + surface->set_title = alset_title; + surface->listen_event = allisten_event; + surface->done = aldone; + + return 1; +} + +grDevice gr_alleg_device = +{ + sizeof(grSurface), + "Allegro", + + init_device, + done_device, + + init_surface, + + 0, + 0 +}; + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/allegro/gralleg.h freetype-2.8/=unpacked-tar2=/graph/allegro/gralleg.h --- freetype-2.7.1/=unpacked-tar2=/graph/allegro/gralleg.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/allegro/gralleg.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,23 @@ +#ifndef GRALLEG_H_ +#define GRALLEG_H_ + +#include "grobjs.h" + + extern + grDevice gr_alleg_device; + +#ifdef GR_INIT_BUILD + static + grDeviceChain gr_alleg_device_chain = + { + "Allegro", + &gr_alleg_device, + GR_INIT_DEVICE_CHAIN + }; + +#undef GR_INIT_DEVICE_CHAIN +#define GR_INIT_DEVICE_CHAIN &gr_alleg_device_chain + +#endif /* GR_INIT_BUILD */ + +#endif /* GRALLEG_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/allegro/rules.mk freetype-2.8/=unpacked-tar2=/graph/allegro/rules.mk --- freetype-2.7.1/=unpacked-tar2=/graph/allegro/rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/allegro/rules.mk 2015-09-25 05:40:31.000000000 +0000 @@ -0,0 +1,36 @@ +#************************************************************************** +#* +#* Allegro driver makefile +#* +#************************************************************************** + +# test for the `ALLEGRO' environment variable. This is non-optimal. +# +ifdef ALLEGRO + + # directory of Allegro driver + # + GR_ALLEG := $(GRAPH)/allegro + + # add Allegro driver to lib objects + # + GRAPH_OBJS += $(OBJ_DIR_2)/gralleg.$O + + # add Allegro driver to list of devices + # + DEVICES += ALLEGRO + + # our compilation rule + # + $(OBJ_DIR_2)/gralleg.$O : $(GR_ALLEG)/gralleg.c $(GR_ALLEG)/gralleg.h + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_ALLEG)) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + + # we need to link with Allegro + # + GRAPH_LINK += -lalleg + +endif # test ALLEGRO + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/beos/grbeos.cpp freetype-2.8/=unpacked-tar2=/graph/beos/grbeos.cpp --- freetype-2.7.1/=unpacked-tar2=/graph/beos/grbeos.cpp 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/beos/grbeos.cpp 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,359 @@ +/******************************************************************* + * + * grbeos.c graphics driver for BeOS platform. 0.1 + * + * This is the driver for displaying inside a window under BeOS, + * used by the graphics utility of the FreeType test suite. + * + * Written by Michael Pfeiffer. + * Copyright 2001 by Michael Pfeiffer + * + * 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. + * + ******************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "grbeos.h" + + +/* logging facility */ +#include + +#define DEBUG + +#ifdef DEBUG +#define LOG(x) LogMessage##x +#else +#define LOG(x) /* empty */ +#endif + +#ifdef DEBUG + static void LogMessage( const char* fmt, ... ) + { + va_list ap; + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } +#endif + + typedef struct Translator_ + { + int32 beoskey; +grKey grkey; + + } Translator; + + static + Translator key_translators[] = + { + { B_BACKSPACE, grKeyBackSpace }, + { B_TAB, grKeyTab }, + { B_ENTER, grKeyReturn }, + { B_ESCAPE, grKeyEsc }, + { B_HOME, grKeyHome }, + { B_LEFT_ARROW, grKeyLeft }, + { B_UP_ARROW, grKeyUp }, + { B_RIGHT_ARROW, grKeyRight }, + { B_DOWN_ARROW, grKeyDown }, + { B_PAGE_UP, grKeyPageUp }, + { B_PAGE_DOWN, grKeyPageDown }, + { B_END, grKeyEnd } + }; + + static + Translator fkey_translators[] = + { + { B_F1_KEY, grKeyF1 }, + { B_F2_KEY, grKeyF2 }, + { B_F3_KEY, grKeyF3 }, + { B_F4_KEY, grKeyF4 }, + { B_F5_KEY, grKeyF5 }, + { B_F6_KEY, grKeyF6 }, + { B_F7_KEY, grKeyF7 }, + { B_F8_KEY, grKeyF8 }, + { B_F9_KEY, grKeyF9 }, + { B_F10_KEY, grKeyF10 }, + { B_F11_KEY, grKeyF11 }, + { B_F12_KEY, grKeyF12 } + }; + + static Translator* find_key(int32 key, Translator t[], int size) { + for (int i = 0; i < size; i++) { + if (t[i].beoskey == key) { + return &t[i]; + } + } + return NULL; + } + +static const grPixelMode pixel_modes[] = +{ + gr_pixel_mode_mono, + gr_pixel_mode_gray +// gr_pixel_mode_rgb565, +// gr_pixel_mode_rgb32, +}; + +class Window; + +typedef struct grBeOSSurface_ +{ + grSurface root; + Window* window; +} grBeOSSurface; + +class Window : public BWindow { + private: + grBeOSSurface* _surface; + BBitmap* _offscreen; + BBitmap* _bitmap; + BMessageQueue _event_queue; + sem_id _locker; + + class View : public BView { + BBitmap* _offscreen; + BMessageQueue* _event_queue; + sem_id _locker; + + public: + View(BBitmap* offscreen, BMessageQueue* event_queue, sem_id locker, BRect r); + void Draw(BRect r); + void KeyDown(const char *bytes, int32 numBytes); + }; + View* _view; + + public: + Window(grBeOSSurface* surface, grBitmap* bitmap); + ~Window(); + + void Refresh(int x, int y, int w, int h); + int listen_event(int event_mask, grEvent* grevent); + + static grSurface* init_surface(grSurface* surface, grBitmap* bitmap); + static void done_surface(grSurface* surface); + static void refresh_rectangle(grSurface* surface, int x, int y, int w, int h); + static void set_title(grSurface* surface, const char* title); + static int listen_event(grSurface* surface, int event_mask, grEvent* grevent); +}; + +static int init_device(); +static void done_device(void); + +grDevice gr_beos_device = +{ + sizeof( grBeOSSurface ), + "beos", + + init_device, + done_device, + + (grDeviceInitSurfaceFunc) Window::init_surface, + + 0, + 0 +}; + +static int init_device() { + gr_beos_device.num_pixel_modes = 2; + gr_beos_device.pixel_modes = (grPixelMode*) pixel_modes; + new BApplication("application/x.mp.freetype.test"); + return 0; +} + +static void done_device(void) { + if (be_app) { + delete be_app; + be_app = NULL; + } +} + + +Window::View::View(BBitmap* offscreen, BMessageQueue* event_queue, sem_id locker, BRect r) : + BView(r, "", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), + _offscreen(offscreen), + _event_queue(event_queue), + _locker(locker) { + SetViewColor(B_TRANSPARENT_COLOR); +} + +void Window::View::Draw(BRect r) { + DrawBitmap(_offscreen); +} + +void Window::View::KeyDown(const char *bytes, int32 numBytes) { + BMessage* m = Window()->CurrentMessage(); + int32 key; + if (B_OK == m->FindInt32("key", &key)) { + Translator* t = NULL; + if (numBytes == 1) { + if (*bytes == B_FUNCTION_KEY) { + t = find_key(key, fkey_translators, sizeof(fkey_translators)/sizeof(Translator)); + } else { + t = find_key(*bytes, key_translators, sizeof(key_translators)/sizeof(Translator)); + } + } + if (t || numBytes == 1) { + _event_queue->Lock(); + if (_event_queue->IsEmpty()) release_sem(_locker); + _event_queue->AddMessage(new BMessage(t ? t->grkey : *bytes)); + _event_queue->Unlock(); + return; + } + } + BView::KeyDown(bytes, numBytes); +} + +int Window::listen_event(int event_mask, grEvent* grevent) { + acquire_sem(_locker); + _event_queue.Lock(); + BMessage* m = _event_queue.NextMessage(); + if (!_event_queue.IsEmpty()) release_sem(_locker); + _event_queue.Unlock(); + grevent->type = gr_key_down; + grevent->key = (grKey)m->what; + delete m; + return 0; +} + +Window::Window(grBeOSSurface* surface, grBitmap* bitmap) : + BWindow(BRect(20, 20, 100, 100), "", B_TITLED_WINDOW, B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { + _locker = create_sem(0, "event_locker"); + _surface = surface; + surface->root.done = done_surface; + surface->root.refresh_rect = refresh_rectangle; + surface->root.set_title = set_title; + surface->root.listen_event = listen_event; + surface->window = this; + int w = bitmap->width; + int h = bitmap->rows; + BRect r(0, 0, w, h); + switch (bitmap->mode) { + case gr_pixel_mode_mono: + _bitmap = new BBitmap(r, B_GRAY1); + break; + case gr_pixel_mode_gray: + _bitmap = new BBitmap(r, B_CMAP8); + break; + case gr_pixel_mode_rgb565: + _bitmap = new BBitmap(r, B_RGB16); + break; + case gr_pixel_mode_rgb32: + _bitmap = new BBitmap(r, B_RGB32); + break; + default: + LOG(("unsupported mode")); + exit(-1); + } + + bitmap->buffer = (unsigned char*)_bitmap->Bits(); + bitmap->pitch = _bitmap->BytesPerRow(); + _surface->root.bitmap = *bitmap; + _offscreen = new BBitmap(r, B_RGB32); + + _view = new View(_offscreen, &_event_queue, _locker, r); + AddChild(_view); + _view->MakeFocus(true); + ResizeTo(w, h); + Show(); +} + +Window::~Window() { + delete_sem(_locker); + delete _offscreen; delete _bitmap; +} + +void Window::Refresh(int x, int y, int w, int h) { + int32* d = (int32*)_offscreen->Bits(); + int32* dl = d; + uint8* s = (uint8*)_bitmap->Bits(); + uint8* sl = s; + if (Lock()) { + switch(_surface->root.bitmap.mode) { + case gr_pixel_mode_mono: + for (y = 0; y < _surface->root.bitmap.rows; y++) { + sl = s; + dl = d; + for (x = 0; x < _surface->root.bitmap.width; x++) { + *dl = *sl ? -1 : 0; + sl++; dl++; + } + s += _bitmap->BytesPerRow(); + d = (int32*)(((char*)d) + _offscreen->BytesPerRow()); + } + break; + case gr_pixel_mode_gray: + for (y = 0; y < _surface->root.bitmap.rows; y++) { + sl = s; + int8* dx = (int8*)d; + for (x = 0; x < _surface->root.bitmap.width; x++) { + *dx = *sl; dx++; + *dx = *sl; dx++; + *dx = *sl; dx++; + *dx = *sl; dx++; + sl++; + } + s += _bitmap->BytesPerRow(); + d = (int32*)(((char*)d) + _offscreen->BytesPerRow()); + } + break; + default: + fprintf(stderr, "unsupported mode: %d\n", _surface->root.bitmap.mode); + break; + } + _view->Invalidate(); + Unlock(); + } +} + +grSurface* Window::init_surface( grSurface* surface, grBitmap* bitmap) { + new Window((grBeOSSurface*) surface, bitmap); + return surface; +} + +void Window::done_surface(grSurface* surface) { + Window* w = ((grBeOSSurface*)surface)->window; + if (w->Lock()) { + w->PostMessage(B_QUIT_REQUESTED); + w->Unlock(); + } +} + +void Window::refresh_rectangle(grSurface* surface, int x, int y, int w, int h) { + Window* win = ((grBeOSSurface*)surface)->window; + win->Refresh(x, y, w, h); +} + +void Window::set_title(grSurface* surface, const char* title) { + Window* win = ((grBeOSSurface*)surface)->window; + if (win->Lock()) { + win->SetTitle(title); + win->Unlock(); + } +} + +int Window::listen_event(grSurface* surface, int event_mask, grEvent* grevent) { + Window* win = ((grBeOSSurface*)surface)->window; + return win->listen_event(event_mask, grevent); +} + +/* End */ + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/beos/grbeos.h freetype-2.8/=unpacked-tar2=/graph/beos/grbeos.h --- freetype-2.7.1/=unpacked-tar2=/graph/beos/grbeos.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/beos/grbeos.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,24 @@ +#ifndef GRBEOS_H_ +#define GRBEOS_H_ + +#include "grobjs.h" + + extern + grDevice gr_beos_device; + +#ifdef GR_INIT_BUILD + static + grDeviceChain gr_beos_device_chain = + { + "beos", + &gr_beos_device, + GR_INIT_DEVICE_CHAIN + }; + +#undef GR_INIT_DEVICE_CHAIN +#define GR_INIT_DEVICE_CHAIN &gr_beos_device_chain + +#endif /* GR_INIT_BUILD */ + +#endif /* GRBEOS_H_ */ + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/beos/Jamfile freetype-2.8/=unpacked-tar2=/graph/beos/Jamfile --- freetype-2.7.1/=unpacked-tar2=/graph/beos/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/beos/Jamfile 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,12 @@ +# FreeType2 demos graph/beos Jamfile (c) 2002 David Turner +# + +SubDir FT2DEMO_TOP graph beos ; + +SubDirHdrs $(GRAPH_INCLUDE) ; + +GRAPH_LINKLIBS = -lbe -lstdc++.r4 ; + +Library $(GRAPH_LIB) : grbeos.cpp ; + +# end of graph/beos Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/beos/rules.mk freetype-2.8/=unpacked-tar2=/graph/beos/rules.mk --- freetype-2.7.1/=unpacked-tar2=/graph/beos/rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/beos/rules.mk 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,42 @@ +#************************************************************************** +#* +#* BeOS specific rules file, used to compile the BeOS graphics driver +#* to the graphics subsystem +#* +#************************************************************************** + +ifeq ($(PLATFORM),beos) + + # directory of the BeOS graphics driver + # + GR_BEOS := $(GRAPH)/beos + + # add the BeOS driver object file to the graphics library `graph.a' + # + GRAPH_OBJS += $(OBJ_DIR_2)/grbeos.$(O) + + DEVICES += BEOS + DEVICE_INCLUDES += $(GR_BEOS) + + # the rule used to compile the graphics driver + # + $(OBJ_DIR_2)/grbeos.$(O): $(GR_BEOS)/grbeos.cpp $(GR_BEOS)/grbeos.h + ifneq ($(LIBTOOL),) + $(LIBTOOL) --mode=compile $(CC) -static $(CFLAGS) \ + $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_BEOS)) \ + $(X11_INCLUDE:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + else + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_BEOS)) \ + $(X11_INCLUDE:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + endif + + # Now update GRAPH_LINK according to the compiler used on BeOS + GRAPH_LINK += -lbe -lstdc++.r4 + +endif + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblany.h freetype-2.8/=unpacked-tar2=/graph/gblany.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblany.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblany.h 2016-01-13 11:00:32.000000000 +0000 @@ -0,0 +1,144 @@ +/* check that all macros are correctly set + */ +#ifndef GDST_INCR +#error "GDST_INCR not defined" +#endif + +#ifndef GDST_TYPE +#error "GDST_TYPE not defined" +#endif + +#ifndef GDST_READ +#error "GDST_READ not defined" +#endif + +#ifdef GBLENDER_STORE_BYTES +# ifndef GDST_STOREB +# error "GDST_STOREB not defined" +# endif +#else +# ifndef GDST_STOREP +# error "GDST_STOREP not defined" +# endif +#endif /* !STORE_BYTES */ + +#ifndef GDST_STOREC +#error "GDST_STOREC not defined" +#endif + +#ifndef GDST_COPY +#error "GDST_COPY not defined" +#endif + +#ifndef GDST_COPY_VAR +#error "GDST_COPY_VAR not defined" +#endif + +#undef GCONCAT +#undef GCONCATX +#define GCONCAT(x,y) GCONCATX(x,y) +#define GCONCATX(x,y) x ## y + + +static void +GCONCAT( _gblender_blit_gray8_, GDST_TYPE )( GBlenderBlit blit, + GBlenderPixel color ) +{ + GBlender blender = blit->blender; + unsigned int r = (color >> 16) & 255; + unsigned int g = (color >> 8) & 255; + unsigned int b = (color) & 255; + + GDST_COPY_VAR + +#include "gblcolor.h" +} + + +static void +GCONCAT( _gblender_blit_hrgb_, GDST_TYPE )( GBlenderBlit blit, + GBlenderPixel color ) +{ + GBlender blender = blit->blender; + unsigned int r = (color >> 16) & 255; + unsigned int g = (color >> 8) & 255; + unsigned int b = (color) & 255; + + GDST_COPY_VAR + +#include "gblhrgb.h" +} + + +static void +GCONCAT( _gblender_blit_hbgr_, GDST_TYPE )( GBlenderBlit blit, + GBlenderPixel color ) +{ + GBlender blender = blit->blender; + unsigned int r = (color >> 16) & 255; + unsigned int g = (color >> 8) & 255; + unsigned int b = (color) & 255; + + GDST_COPY_VAR + +#include "gblhbgr.h" +} + + +static void +GCONCAT( _gblender_blit_vrgb_, GDST_TYPE )( GBlenderBlit blit, + GBlenderPixel color ) +{ + GBlender blender = blit->blender; + unsigned int r = (color >> 16) & 255; + unsigned int g = (color >> 8) & 255; + unsigned int b = (color) & 255; + + GDST_COPY_VAR + +#include "gblvrgb.h" +} + + +static void +GCONCAT( _gblender_blit_vbgr_, GDST_TYPE )( GBlenderBlit blit, + GBlenderPixel color ) +{ + GBlender blender = blit->blender; + unsigned int r = (color >> 16) & 255; + unsigned int g = (color >> 8) & 255; + unsigned int b = (color) & 255; + + GDST_COPY_VAR + +#include "gblvbgr.h" +} + + +static void +GCONCAT( _gblender_blit_bgra_, GDST_TYPE )( GBlenderBlit blit, + GBlenderPixel color ) +{ + GBlender blender = blit->blender; + + (void)color; /* unused */ + +#include "gblbgra.h" +} + + +/* unset the macros, to prevent accidental re-use + */ + +#undef GCONCATX +#undef GCONCAT +#undef GDST_TYPE +#undef GDST_INCR +#undef GDST_READ +#undef GDST_COPY +#undef GDST_STOREB +#undef GDST_STOREP +#undef GDST_STOREC +#undef GDST_COPY_VAR + +/* EOF */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblbgra.h freetype-2.8/=unpacked-tar2=/graph/gblbgra.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblbgra.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblbgra.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,56 @@ + + int h = blit->height; + const unsigned char* src_line = blit->src_line; + unsigned char* dst_line = blit->dst_line; + + gblender_use_channels( blender, 0 ); + + do + { + const unsigned char* src = src_line + blit->src_x * 4; + unsigned char* dst = dst_line + blit->dst_x * GDST_INCR; + int w = blit->width; + + do + { + unsigned int a = GBLENDER_SHADE_INDEX(src[3]); + unsigned int ra = src[3]; + + unsigned int b = src[0]; + unsigned int g = src[1]; + unsigned int r = src[2]; + + + if ( a == 0 ) + { + /* nothing */ + } + else if ( a == 255 ) + { + dst[0] = (unsigned char)r; + dst[1] = (unsigned char)g; + dst[2] = (unsigned char)b; + } + else + { + unsigned int ba = 255 - ra; + unsigned int br = dst[0]; + unsigned int bb = dst[1]; + unsigned int bg = dst[2]; + + + dst[0] = (unsigned char)(br * ba / 255 + r); + dst[1] = (unsigned char)(bg * ba / 255 + g); + dst[2] = (unsigned char)(bb * ba / 255 + b); + } + + src += 4; + dst += GDST_INCR; + + } while ( --w > 0 ); + + src_line += blit->src_pitch; + dst_line += blit->dst_pitch; + + } while ( --h > 0 ); + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblblit.c freetype-2.8/=unpacked-tar2=/graph/gblblit.c --- freetype-2.7.1/=unpacked-tar2=/graph/gblblit.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblblit.c 2015-10-09 07:14:19.000000000 +0000 @@ -0,0 +1,328 @@ +#include "gblblit.h" + +/* blitting gray glyphs + */ + +/* generic macros + */ +#define GRGB_PACK(r,g,b) ( ((GBlenderPixel)(r) << 16) | \ + ((GBlenderPixel)(g) << 8) | \ + (GBlenderPixel)(b) ) + +#define GDST_STORE3(d,r,g,b) (d)[0] = (unsigned char)(r); \ + (d)[1] = (unsigned char)(g); \ + (d)[2] = (unsigned char)(b) + +/* */ + +#define GRGB_TO_RGB565(r,g,b) ((unsigned short)( (((r) << 8) & 0xF800) | \ + (((g) << 3) & 0x07E0) | \ + (((b) >> 3) & 0x001F) ) ) + +#define GRGB565_TO_RGB24(p) ( ( ((p) << 8) & 0xF80000 ) | \ + ( ((p) << 3) & 0x0700F8 ) | \ + ( ((p) << 5) & 0x00FC00 ) | \ + ( ((p) >> 1) & 0x000300 ) | \ + ( ((p) >> 2) & 0x000007 ) ) + +#define GRGB24_TO_RGB565(p) ( (unsigned short)( (((p) >> 8) & 0xF800 ) | \ + (((p) >> 5) & 0x07E0 ) | \ + (((p) >> 3) & 0x001F ) ) ) + +/* */ + +#define GRGB_TO_BGR565(r,g,b) GRGB_TO_RGB565(b,g,r) + +#define GBGR565_TO_RGB24(p) ( ( ((p) << 19) & 0xF80000 ) | \ + ( ((p) << 12) & 0x070000 ) | \ + ( ((p) << 5) & 0x00FC00 ) | \ + ( ((p) >> 1) & 0x000300 ) | \ + ( ((p) >> 8) & 0x0000F8 ) | \ + ( ((p) >> 13) & 0x000007 ) ) + +#define GRGB24_TO_BGR565(p) ( (unsigned short)( (((p) << 8) & 0xF800 ) | \ + (((p) >> 5) & 0x07E0 ) | \ + (((p) >> 19) & 0x001F ) ) ) + +/* */ + +/* Rgb32 blitting routines + */ + +#define GDST_TYPE rgb32 +#define GDST_INCR 4 +#define GDST_READ(d,p) (p) = *(GBlenderPixel*)(d) & 0xFFFFFF +#define GDST_COPY(d) *(GBlenderPixel*)(d) = color +#define GDST_STOREP(d,cells,a) *(GBlenderPixel*)(d) = (cells)[(a)] +#define GDST_STOREB(d,cells,a) \ + { \ + GBlenderCell* _g = (cells) + (a)*3; \ + \ + GDST_STOREC(d,_g[0],_g[1],_g[2]); \ + } +#define GDST_STOREC(d,r,g,b) *(GBlenderPixel*)(d) = GRGB_PACK(r,g,b) +#define GDST_COPY_VAR /* nothing */ + +#include "gblany.h" + +/* Rgb24 blitting routines + */ + +#define GDST_TYPE rgb24 +#define GDST_INCR 3 +#define GDST_READ(d,p) (p) = GRGB_PACK((d)[0],(d)[1],(d)[2]) +#define GDST_COPY(d) GDST_STORE3(d,r,g,b) +#define GDST_STOREC(d,r,g,b) GDST_STORE3(d,r,g,b) + +#define GDST_STOREB(d,cells,a) \ + { \ + GBlenderCell* _g = (cells) + (a)*3; \ + \ + (d)[0] = _g[0]; \ + (d)[1] = _g[1]; \ + (d)[2] = _g[2]; \ + } + +#define GDST_STOREP(d,cells,a) \ + { \ + GBlenderPixel _pix = (cells)[(a)]; \ + \ + GDST_STORE3(d,_pix >> 16,_pix >> 8,_pix); \ + } + +#define GDST_COPY_VAR /* nothing */ + +#include "gblany.h" + +/* Rgb565 blitting routines + */ + +#define GDST_TYPE rgb565 +#define GDST_INCR 2 + +#define GDST_READ(d,p) p = (GBlenderPixel)*(unsigned short*)(d); \ + p = GRGB565_TO_RGB24(p) + +#define GDST_COPY_VAR unsigned short pix = GRGB_TO_RGB565(r,g,b); +#define GDST_COPY(d) *(unsigned short*)(d) = pix + +#define GDST_STOREB(d,cells,a) \ + { \ + GBlenderCell* _g = (cells) + (a)*3; \ + \ + *(unsigned short*)(d) = GRGB_TO_RGB565(_g[0],_g[1],_g[2]); \ + } + +#define GDST_STOREP(d,cells,a) \ + { \ + GBlenderPixel _pix = (cells)[(a)]; \ + \ + *(unsigned short*)(d) = GRGB24_TO_RGB565(_pix); \ + } + +#define GDST_STOREC(d,r,g,b) *(unsigned short*)(d) = GRGB_TO_RGB565(r,g,b) + +#include "gblany.h" + +/* Bgr565 blitting routines + */ +#define GDST_TYPE bgr565 +#define GDST_INCR 2 + +#define GDST_READ(d,p) p = (GBlenderPixel)*(unsigned short*)(d); \ + p = GBGR565_TO_RGB24(p) + +#define GDST_COPY_VAR unsigned short pix = GRGB_TO_BGR565(r,g,b); +#define GDST_COPY(d) *(d) = (unsigned char)pix + +#define GDST_STOREB(d,cells,a) \ + { \ + GBlenderCell* _g = (cells) + (a)*3; \ + \ + *(unsigned short*)(d) = GRGB_TO_BGR565(_g[0],_g[1],_g[2]); \ + } + +#define GDST_STOREP(d,cells,a) \ + { \ + GBlenderPixel _pix = (cells)[(a)]; \ + \ + *(unsigned short*)(d) = GRGB24_TO_BGR565(_pix); \ + } + +#define GDST_STOREC(d,r,g,b) *(unsigned short*)(d) = GRGB_TO_BGR565(r,g,b) + +#include "gblany.h" + +/* */ + +static void +_gblender_blit_dummy( GBlenderBlit blit, + GBlenderPixel color ) +{ + (void)blit; + (void)color; +} + + +GBLENDER_APIDEF( int ) +gblender_blit_init( GBlenderBlit blit, + GBlender blender, + int dst_x, + int dst_y, + GBlenderSourceFormat src_format, + const unsigned char* src_buffer, + int src_pitch, + int src_width, + int src_height, + GBlenderTargetFormat dst_format, + unsigned char* dst_buffer, + int dst_pitch, + int dst_width, + int dst_height ) +{ + int src_x = 0; + int src_y = 0; + int delta; + GBlenderBlitFunc blit_func = 0; + + switch ( src_format ) + { + case GBLENDER_SOURCE_GRAY8: + switch ( dst_format ) + { + case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_gray8_rgb32; break; + case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_gray8_rgb24; break; + case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_gray8_rgb565; break; + case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_gray8_bgr565; break; + default: + ; + } + break; + + case GBLENDER_SOURCE_HRGB: + switch ( dst_format ) + { + case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_hrgb_rgb32; break; + case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_hrgb_rgb24; break; + case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_hrgb_rgb565; break; + case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_hrgb_bgr565; break; + default: + ; + } + break; + + case GBLENDER_SOURCE_HBGR: + switch ( dst_format ) + { + case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_hbgr_rgb32; break; + case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_hbgr_rgb24; break; + case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_hbgr_rgb565; break; + case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_hbgr_bgr565; break; + default: + ; + } + break; + + case GBLENDER_SOURCE_VRGB: + switch ( dst_format ) + { + case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_vrgb_rgb32; break; + case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_vrgb_rgb24; break; + case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_vrgb_rgb565; break; + case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_vrgb_bgr565; break; + default: + ; + } + break; + + case GBLENDER_SOURCE_VBGR: + switch ( dst_format ) + { + case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_vbgr_rgb32; break; + case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_vbgr_rgb24; break; + case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_vbgr_rgb565; break; + case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_vbgr_bgr565; break; + default: + ; + } + break; + + case GBLENDER_SOURCE_BGRA: + switch ( dst_format ) + { + case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_bgra_rgb32; break; + case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_bgra_rgb24; break; + case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_bgra_rgb565; break; + case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_bgra_bgr565; break; + default: + ; + } + break; + + default: + ; + } + + blit->blender = blender; + blit->blit_func = blit_func; + + if ( blit_func == 0 ) + { + /* unsupported blit mode + */ + blit->blit_func = _gblender_blit_dummy; + return -2; + } + + if ( dst_x < 0 ) + { + src_width += dst_x; + src_x -= dst_x; + dst_x = 0; + } + + delta = dst_x + src_width - dst_width; + if ( delta > 0 ) + src_width -= delta; + + if ( dst_y < 0 ) + { + src_height += dst_y; + src_y -= dst_y; + dst_y = 0; + } + + delta = dst_y + src_height - dst_height; + if ( delta > 0 ) + src_height -= delta; + + /* nothing to blit + */ + if ( src_width <= 0 || src_height <= 0 ) + { + blit->blit_func = _gblender_blit_dummy; + return -1; + } + + blit->width = src_width; + blit->height = src_height; + blit->src_format = src_format; + blit->dst_format = dst_format; + + blit->src_x = src_x; + blit->src_y = src_y; + blit->src_line = src_buffer + src_pitch*src_y; + blit->src_pitch = src_pitch; + if ( src_pitch < 0 ) + blit->src_line -= (src_height-1)*src_pitch; + + blit->dst_x = dst_x; + blit->dst_y = dst_y; + blit->dst_line = dst_buffer + dst_pitch*dst_y; + blit->dst_pitch = dst_pitch; + if ( dst_pitch < 0 ) + blit->dst_line -= (dst_height-1)*dst_pitch; + + return 0; +} + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblblit.h freetype-2.8/=unpacked-tar2=/graph/gblblit.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblblit.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblblit.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,83 @@ +#ifndef GBLBLIT_H_ +#define GBLBLIT_H_ + +#include "gblender.h" + +/* + * blitting interface + * + */ + +typedef enum +{ + GBLENDER_SOURCE_GRAY8 = 0, + GBLENDER_SOURCE_HRGB, + GBLENDER_SOURCE_HBGR, + GBLENDER_SOURCE_VRGB, + GBLENDER_SOURCE_VBGR, + GBLENDER_SOURCE_BGRA, + + GBLENDER_SOURCE_MAX + +} GBlenderSourceFormat; + + +typedef enum +{ + GBLENDER_TARGET_GRAY8 = 0, + GBLENDER_TARGET_RGB32, + GBLENDER_TARGET_RGB24, + GBLENDER_TARGET_RGB565, + GBLENDER_TARGET_BGR565, + + GBLENDER_TARGET_MAX + +} GBlenderTargetFormat; + +typedef struct GBlenderBlitRec_* GBlenderBlit; + +typedef void (*GBlenderBlitFunc)( GBlenderBlit blit, + GBlenderPixel color ); + +typedef struct GBlenderBlitRec_ +{ + int width; + int height; + const unsigned char* src_line; + int src_pitch; + int src_x; + int src_y; + unsigned char* dst_line; + int dst_pitch; + int dst_x; + int dst_y; + GBlenderSourceFormat src_format; + GBlenderTargetFormat dst_format; + + GBlender blender; + GBlenderBlitFunc blit_func; + +} GBlenderBlitRec; + + + +GBLENDER_API( int ) +gblender_blit_init( GBlenderBlit blit, + GBlender blender, + int dst_x, + int dst_y, + GBlenderSourceFormat src_format, + const unsigned char* src_buffer, + int src_pitch, + int src_width, + int src_height, + GBlenderTargetFormat dst_format, + unsigned char* dst_buffer, + int dst_pitch, + int dst_width, + int dst_height ); + +#define gblender_blit_run(b,color) (b)->blit_func( (b), (color) ) + + +#endif /* GBLBLIT_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblcolor.h freetype-2.8/=unpacked-tar2=/graph/gblcolor.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblcolor.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblcolor.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,60 @@ + + GBLENDER_VARS; + + int h = blit->height; + const unsigned char* src_line = blit->src_line; + unsigned char* dst_line = blit->dst_line; + + gblender_use_channels( blender, 0 ); + + GBLENDER_VARS_SET(blender,color); + + /* make compiler happy */ + (void)(r); + (void)(g); + (void)(b); + + do + { + const unsigned char* src = src_line + (blit->src_x); + unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; + int w = blit->width; + + do + { + int a = GBLENDER_SHADE_INDEX(src[0]); + + if ( a == 0 ) + { + /* nothing */ + } + else if ( a == GBLENDER_SHADE_COUNT-1 ) + { + GDST_COPY(dst); + } + else + { + GBlenderPixel back; + + GDST_READ(dst,back); + + GBLENDER_LOOKUP( blender, back ); + +#ifdef GBLENDER_STORE_BYTES + GDST_STOREB(dst,_gcells,a); +#else + GDST_STOREP(dst,_gcells,a); +#endif + } + + src += 1; + dst += GDST_INCR; + } + while (--w > 0); + + src_line += blit->src_pitch; + dst_line += blit->dst_pitch; + } + while (--h > 0); + + GBLENDER_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblender.c freetype-2.8/=unpacked-tar2=/graph/gblender.c --- freetype-2.7.1/=unpacked-tar2=/graph/gblender.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblender.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,414 @@ +#include "gblender.h" +#include +#include + +static void +gblender_set_gamma_table( double gamma_value, + unsigned short* gamma_ramp, + unsigned char* gamma_ramp_inv ) +{ + const int gmax = (256 << GBLENDER_GAMMA_SHIFT)-1; + + if ( gamma_value <= 0 ) /* special case for sRGB */ + { + int ii; + + for ( ii = 0; ii < 256; ii++ ) + { + double x = (double)ii / 255.0; + + if ( x <= 0.039285714 ) + x /= 12.92321; + else + x = pow( (x+0.055)/ 1.055, 2.4 ); + + gamma_ramp[ii] = (unsigned short)(gmax*x + 0.5); + } + + for ( ii = 0; ii <= gmax; ii++ ) + { + double x = (double)ii / gmax; + + if ( x <= 0.0030399346 ) + x *= 12.92321; + else + x = 1.055*pow(x,1/2.4) - 0.055; + + gamma_ramp_inv[ii] = (unsigned char)(255.*x + 0.5); + } + } + else + { + int ii; + double gamma_inv = 1. / gamma_value; + + /* voltage to linear */ + for ( ii = 0; ii < 256; ii++ ) + gamma_ramp[ii] = + (unsigned short)( gmax*pow( (double)ii/255., gamma_value ) + 0.5 ); + + /* linear to voltage */ + for ( ii = 0; ii <= gmax; ii++ ) + gamma_ramp_inv[ii] = + (unsigned char)( 255.*pow( (double)ii/gmax, gamma_inv ) + 0.5 ); + } +} + + +/* clear the cache + */ +static void +gblender_clear( GBlender blender ) +{ + int nn; + GBlenderKey keys = blender->keys; + + if ( blender->channels ) + { + GBlenderChanKey chan_keys = (GBlenderChanKey) blender->keys; + + for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ ) + chan_keys[nn].index = -1; + + blender->cache_r_back = ~0U; + blender->cache_r_fore = ~0U; + blender->cache_r_cells = NULL; + + blender->cache_g_back = ~0U; + blender->cache_g_fore = ~0U; + blender->cache_g_cells = NULL; + + blender->cache_b_back = ~0U; + blender->cache_b_fore = ~0U; + blender->cache_b_cells = NULL; + } + else + { + for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ ) + keys[nn].cells = NULL; + + blender->cache_back = ~0U; + blender->cache_fore = ~0U; + blender->cache_cells = NULL; + } +} + +GBLENDER_APIDEF( void ) +gblender_reset( GBlender blender ) +{ + gblender_clear( blender ); + + if ( blender->channels ) + { + blender->cache_r_back = 0; + blender->cache_r_fore = 0xFFFFFF; + blender->cache_r_cells = gblender_lookup_channel( blender, + blender->cache_r_back, + blender->cache_r_fore ); + blender->cache_g_back = 0; + blender->cache_g_fore = 0xFFFFFF; + blender->cache_g_cells = gblender_lookup_channel( blender, + blender->cache_g_back, + blender->cache_g_fore ); + blender->cache_b_back = 0; + blender->cache_b_fore = 0xFFFFFF; + blender->cache_b_cells = gblender_lookup_channel( blender, + blender->cache_b_back, + blender->cache_b_fore ); + } + else + { + blender->cache_back = 0; + blender->cache_fore = 0xFFFFFF; + blender->cache_cells = gblender_lookup( blender, + blender->cache_back, + blender->cache_fore ); + } + +#ifdef GBLENDER_STATS + blender->stat_hits = 0; + blender->stat_lookups = 0; + blender->stat_keys = 0; + blender->stat_clears = 0; +#endif +} + +GBLENDER_APIDEF( void ) +gblender_init( GBlender blender, + double gamma_value ) +{ + blender->channels = 0; + + gblender_set_gamma_table ( gamma_value, + blender->gamma_ramp, + blender->gamma_ramp_inv ); + + gblender_reset( blender ); +} + + +GBLENDER_API( void ) +gblender_use_channels( GBlender blender, + int channels ) +{ + channels = (channels != 0); + + if ( blender->channels != channels ) + { + blender->channels = channels; + gblender_reset( blender ); + } +} + + + +/* recompute the grade levels of a given key + */ +static void +gblender_reset_key( GBlender blender, + GBlenderKey key ) +{ + GBlenderPixel back = key->background; + GBlenderPixel fore = key->foreground; + GBlenderCell* gr = key->cells; + unsigned int nn; + + const unsigned char* gamma_ramp_inv = blender->gamma_ramp_inv; + const unsigned short* gamma_ramp = blender->gamma_ramp; + + unsigned int r1,g1,b1,r2,g2,b2; + + r1 = ( back >> 16 ) & 255; + g1 = ( back >> 8 ) & 255; + b1 = ( back ) & 255; + + r2 = ( fore >> 16 ) & 255; + g2 = ( fore >> 8 ) & 255; + b2 = ( fore ) & 255; + +#ifdef GBLENDER_STORE_BYTES + gr[0] = (unsigned char)r1; + gr[1] = (unsigned char)g1; + gr[2] = (unsigned char)b1; + gr += 3; +#else + gr[0] = back; + gr += 1; +#endif + + r1 = gamma_ramp[r1]; + g1 = gamma_ramp[g1]; + b1 = gamma_ramp[b1]; + + r2 = gamma_ramp[r2]; + g2 = gamma_ramp[g2]; + b2 = gamma_ramp[b2]; + + for ( nn = 1; nn < GBLENDER_SHADE_COUNT; nn++ ) + { + unsigned int a = 255 * nn / ( GBLENDER_SHADE_COUNT - 1 ); + unsigned int r, g, b; + + + r = ( r2 * a + r1 * ( 255 - a ) + 127 ) / 255; + g = ( g2 * a + g1 * ( 255 - a ) + 127 ) / 255; + b = ( b2 * a + b1 * ( 255 - a ) + 127 ) / 255; + + r = gamma_ramp_inv[r]; + g = gamma_ramp_inv[g]; + b = gamma_ramp_inv[b]; + +#ifdef GBLENDER_STORE_BYTES + gr[0] = (unsigned char)r; + gr[1] = (unsigned char)g; + gr[2] = (unsigned char)b; + gr += 3; +#else + gr[0] = (( r & 255 ) << 16) | + (( g & 255 ) << 8 ) | + (( b & 255 ) ) ; + gr ++; +#endif + } +} + + /* lookup the grades of a given (background,foreground) couple + */ +GBLENDER_APIDEF( GBlenderCell* ) +gblender_lookup( GBlender blender, + GBlenderPixel background, + GBlenderPixel foreground ) +{ + int idx, idx0; + GBlenderKey key; + +#ifdef GBLENDER_STATS + blender->stat_hits--; + blender->stat_lookups++; +#endif + +#if 0 + if ( blender->channels ) + { + /* set to normal mode */ + blender->channels = 0; + gblender_reset( blender ); + } +#endif + + idx0 = ( background + foreground*63 ) & (GBLENDER_KEY_COUNT-1); + idx = idx0; + do + { + key = blender->keys + idx; + + if ( key->cells == NULL ) + goto NewNode; + + if ( key->background == background && + key->foreground == foreground ) + goto Exit; + + idx = (idx+1) & (GBLENDER_KEY_COUNT-1); + } + while ( idx != idx0 ); + + /* the cache is full, clear it completely + */ +#ifdef GBLENDER_STATS + blender->stat_clears++; +#endif + gblender_clear( blender ); + +NewNode: + key->background = background; + key->foreground = foreground; + key->cells = blender->cells + + idx*(GBLENDER_SHADE_COUNT*GBLENDER_CELL_SIZE); + + gblender_reset_key( blender, key ); + +#ifdef GBLENDER_STATS + blender->stat_keys++; +#endif + +Exit: + return key->cells; +} + + +static void +gblender_reset_channel_key( GBlender blender, + GBlenderChanKey key ) +{ + unsigned int back = key->backfore & 255; + unsigned int fore = (key->backfore >> 8) & 255; + unsigned char* gr = (unsigned char*)blender->cells + key->index; + unsigned int nn; + + const unsigned char* gamma_ramp_inv = blender->gamma_ramp_inv; + const unsigned short* gamma_ramp = blender->gamma_ramp; + + unsigned int r1,r2; + + r1 = back; + r2 = fore; + + gr[0] = (unsigned char)r1; + gr++; + + r1 = gamma_ramp[r1]; + r2 = gamma_ramp[r2]; + + for ( nn = 1; nn < GBLENDER_SHADE_COUNT; nn++ ) + { + unsigned int a = 255 * nn / ( GBLENDER_SHADE_COUNT - 1 ); + unsigned int r; + + + r = ( r2 * a + r1 * ( 255 - a ) + 127 ) / 255; + + r = gamma_ramp_inv[r]; + + gr[0] = (unsigned char)r; + gr++; + } +} + + +GBLENDER_APIDEF( unsigned char* ) +gblender_lookup_channel( GBlender blender, + unsigned int background, + unsigned int foreground ) +{ + int idx, idx0; + unsigned short backfore = (unsigned short)((foreground << 8) | background); + GBlenderChanKey key; + +#ifdef GBLENDER_STATS + blender->stat_hits--; + blender->stat_lookups++; +#endif + +#if 0 + if ( !blender->channels ) + { + /* set to normal mode */ + blender->channels = 1; + gblender_reset( blender ); + } +#endif + + idx0 = ( background + foreground*17 ) & (GBLENDER_KEY_COUNT-1); + idx = idx0; + do + { + key = (GBlenderChanKey)blender->keys + idx; + + if ( key->index < 0 ) + goto NewNode; + + if ( key->backfore == backfore ) + goto Exit; + + idx = (idx+1) & (GBLENDER_KEY_COUNT-1); + } + while ( idx != idx0 ); + + /* the cache is full, clear it completely + */ +#ifdef GBLENDER_STATS + blender->stat_clears++; +#endif + gblender_clear( blender ); + +NewNode: + key->backfore = backfore; + key->index = (signed short)( idx * GBLENDER_SHADE_COUNT ); + + gblender_reset_channel_key( blender, key ); + +#ifdef GBLENDER_STATS + blender->stat_keys++; +#endif + +Exit: + return (unsigned char*)blender->cells + key->index; +} + + + +#ifdef GBLENDER_STATS +#include +GBLENDER_APIDEF( void ) +gblender_dump_stats( GBlender blender ) +{ + printf( "hits = %ld, miss1 = %ld, miss2 = %ld, rate1=%.2f%%, rate2=%.2f%%\n", + blender->stat_hits, + blender->stat_lookups, + blender->stat_keys, + (100.0*blender->stat_hits) / (double)(blender->stat_hits + blender->stat_lookups), + (100.0*blender->stat_lookups) / (double)( blender->stat_lookups + blender->stat_keys) + ); +} +#endif diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblender.h freetype-2.8/=unpacked-tar2=/graph/gblender.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblender.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblender.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,236 @@ +/**************************************************************************** + * + * Gamma-correct alpha blending of text + * + * (C) 2004 David Turner + * + */ + +#ifndef GBLENDER_H_ +#define GBLENDER_H_ + +#ifndef GBLENDER_API +#define GBLENDER_API(x) extern x +#endif + +#ifndef GBLENDER_APIDEF +#define GBLENDER_APIDEF(x) x +#endif + +#define GBLENDER_SHADE_BITS 4 /* must be <= 7 !! */ +#define GBLENDER_SHADE_COUNT ( 1 << GBLENDER_SHADE_BITS ) +#define GBLENDER_SHADE_INDEX(n) (((n) * (GBLENDER_SHADE_COUNT-1) + 128) >> 8) +#define GBLENDER_KEY_COUNT 256 /* must be a power of 2 */ +#define GBLENDER_GAMMA_SHIFT 2 + +#define xGBLENDER_STORE_BYTES /* define this to store (R,G,B) values on 3 + * bytes, instead of a single 32-bit integer. + * surprisingly, this can speed up + * the blender on certain machines. + * Go figure what's really happening though :-) + */ + +#define xGBLENDER_STATS /* define this to collect statistics in the + * blender + */ + + typedef unsigned int GBlenderPixel; /* needs 32-bits here !! */ + +#ifdef GBLENDER_STORE_BYTES + typedef unsigned char GBlenderCell; +# define GBLENDER_CELL_SIZE 3 +#else + typedef GBlenderPixel GBlenderCell; +# define GBLENDER_CELL_SIZE 1 +#endif + + + typedef struct + { + GBlenderPixel background; + GBlenderPixel foreground; + GBlenderCell* cells; + + } GBlenderKeyRec, *GBlenderKey; + + + typedef struct + { + unsigned short backfore; /* (fore << 8) | back */ + signed short index; /* offset in (unsigned char*)cells */ + + } GBlenderChanKeyRec, *GBlenderChanKey; + + + typedef struct GBlenderRec_ + { + GBlenderKeyRec keys [ GBLENDER_KEY_COUNT ]; + GBlenderCell cells[ GBLENDER_KEY_COUNT*GBLENDER_SHADE_COUNT*GBLENDER_CELL_SIZE ]; + + /* a small cache for normal modes + */ + GBlenderPixel cache_back; + GBlenderPixel cache_fore; + GBlenderCell* cache_cells; + + /* a small cache for RGB channels modes + */ + unsigned int cache_r_back; + unsigned int cache_r_fore; + unsigned char* cache_r_cells; + + unsigned int cache_g_back; + unsigned int cache_g_fore; + unsigned char* cache_g_cells; + + unsigned int cache_b_back; + unsigned int cache_b_fore; + unsigned char* cache_b_cells; + + /* are we in color or channel mode ? + */ + int channels; + + /* the gamma table + */ + unsigned short gamma_ramp[256]; /* voltage to linear */ + unsigned char gamma_ramp_inv[256 << GBLENDER_GAMMA_SHIFT]; /* linear to voltage */ + +#ifdef GBLENDER_STATS + long stat_hits; /* number of direct hits */ + long stat_lookups; /* number of table lookups */ + long stat_keys; /* number of table key recomputation */ + long stat_clears; /* number of table clears */ +#endif + + } GBlenderRec, *GBlender; + + + /* initialize with a given gamma */ + GBLENDER_API( void ) + gblender_init( GBlender blender, + double gamma ); + + + /* clear blender, and reset stats */ + GBLENDER_API( void ) + gblender_reset( GBlender blender ); + + + GBLENDER_API( void ) + gblender_use_channels( GBlender blender, + int channels ); + + /* lookup a cell range for a given (background,foreground) pair + */ + GBLENDER_API( GBlenderCell* ) + gblender_lookup( GBlender blender, + GBlenderPixel background, + GBlenderPixel foreground ); + + GBLENDER_API( unsigned char* ) + gblender_lookup_channel( GBlender blender, + unsigned int background, + unsigned int foreground ); + +#ifdef GBLENDER_STATS + GBLENDER_API( void ) + gblender_dump_stats( GBlender blender ); +#else +# define gblender_dump_stats(b) do { } while (0); +#endif + +#ifdef GBLENDER_STATS +#define GBLENDER_STAT_HIT(gb) (gb)->stat_hits++ +#else +#define GBLENDER_STAT_HIT(gb) /* nothing */ +#endif + + + /* no final `;'! */ +#define GBLENDER_VARS \ + GBlenderPixel _gback; \ + GBlenderCell* _gcells; \ + GBlenderPixel _gfore + +#define GBLENDER_VARS_SET(_gb,_fore) \ + _gback = (_gb)->cache_back; \ + _gcells = ( (_fore) == (_gb)->cache_fore ? (_gb)->cache_cells : gblender_lookup( (_gb), _gback, _fore ) ); \ + _gfore = (_fore) + +#define GBLENDER_LOOKUP(gb,back) \ + GBLENDER_STAT_HIT(gb); \ + if ( _gback != (GBlenderPixel)(back) ) \ + { \ + _gback = (GBlenderPixel)(back); \ + _gcells = gblender_lookup( (gb), _gback, _gfore ); \ + } + +#define GBLENDER_CLOSE(_gb) \ + (_gb)->cache_back = _gback; \ + (_gb)->cache_fore = _gfore; \ + (_gb)->cache_cells = _gcells; + + + + /* no final `;'! */ +#define GBLENDER_CHANNEL_VARS \ + unsigned int _grback; \ + unsigned char* _grcells; \ + unsigned int _grfore; \ + unsigned int _ggback; \ + unsigned char* _ggcells; \ + unsigned int _ggfore; \ + unsigned int _gbback; \ + unsigned char* _gbcells; \ + unsigned int _gbfore + +#define GBLENDER_CHANNEL_VARS_SET(_gb,_rfore,_gfore,_bfore) \ + _grback = (_gb)->cache_r_back; \ + _grcells = ( (_rfore) == (_gb)->cache_r_fore ? (_gb)->cache_r_cells : gblender_lookup_channel( (_gb), _grback, _rfore )); \ + _grfore = (_rfore); \ + _ggback = (_gb)->cache_g_back; \ + _ggcells = ( (_gfore) == (_gb)->cache_g_fore ? (_gb)->cache_g_cells : gblender_lookup_channel( (_gb), _ggback, _gfore )); \ + _ggfore = (_gfore); \ + _gbback = (_gb)->cache_b_back; \ + _gbcells = ( (_bfore) == (_gb)->cache_b_fore ? (_gb)->cache_b_cells : gblender_lookup_channel( (_gb), _gbback, _bfore )); \ + _gbfore = (_bfore); + +#define GBLENDER_CHANNEL_CLOSE(_gb) \ + (_gb)->cache_r_back = _grback; \ + (_gb)->cache_r_fore = _grfore; \ + (_gb)->cache_r_cells = _grcells; \ + (_gb)->cache_g_back = _ggback; \ + (_gb)->cache_g_fore = _ggfore; \ + (_gb)->cache_g_cells = _ggcells; \ + (_gb)->cache_b_back = _gbback; \ + (_gb)->cache_b_fore = _gbfore; \ + (_gb)->cache_b_cells = _gbcells; + + +#define GBLENDER_LOOKUP_R(gb,back) \ + GBLENDER_STAT_HIT(gb); \ + if ( _grback != (back) ) \ + { \ + _grback = (GBlenderPixel)(back); \ + _grcells = gblender_lookup_channel( (gb), _grback, _grfore ); \ + } + +#define GBLENDER_LOOKUP_G(gb,back) \ + GBLENDER_STAT_HIT(gb); \ + if ( _ggback != (back) ) \ + { \ + _ggback = (GBlenderPixel)(back); \ + _ggcells = gblender_lookup_channel( (gb), _ggback, _ggfore ); \ + } + +#define GBLENDER_LOOKUP_B(gb,back) \ + GBLENDER_STAT_HIT(gb); \ + if ( _gbback != (back) ) \ + { \ + _gbback = (GBlenderPixel)(back); \ + _gbcells = gblender_lookup_channel( (gb), _gbback, _gbfore ); \ + } + + +#endif /* GBLENDER_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblhbgr.h freetype-2.8/=unpacked-tar2=/graph/gblhbgr.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblhbgr.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblhbgr.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,79 @@ + + GBLENDER_CHANNEL_VARS; + + int h = blit->height; + const unsigned char* src_line = blit->src_line; + unsigned char* dst_line = blit->dst_line; + + gblender_use_channels( blender, 1 ); + + GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); + + do + { + const unsigned char* src = src_line + blit->src_x*3; + unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; + int w = blit->width; + + do + { + unsigned int ab = GBLENDER_SHADE_INDEX(src[0]); + unsigned int ag = GBLENDER_SHADE_INDEX(src[1]); + unsigned int ar = GBLENDER_SHADE_INDEX(src[2]); + unsigned int aa = (ar << 16) | (ag << 8) | ab; + + if ( aa == 0 ) + { + /* nothing */ + } + else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | + ((GBLENDER_SHADE_COUNT-1) << 8) | + (GBLENDER_SHADE_COUNT-1) ) ) + { + GDST_COPY(dst); + } + else + { + GBlenderPixel back; + int pix_r, pix_g, pix_b; + + GDST_READ(dst,back); + + { + unsigned int back_r = (back >> 16) & 255; + + GBLENDER_LOOKUP_R( blender, back_r ); + + pix_r = _grcells[ar]; + } + + { + unsigned int back_g = (back >> 8) & 255; + + GBLENDER_LOOKUP_G( blender, back_g ); + + pix_g = _ggcells[ag]; + } + + { + unsigned int back_b = (back) & 255; + + GBLENDER_LOOKUP_B( blender, back_b ); + + pix_b = _gbcells[ab]; + } + + GDST_STOREC(dst,pix_r,pix_g,pix_b); + } + + src += 3; + dst += GDST_INCR; + } + while (--w > 0); + + src_line += blit->src_pitch; + dst_line += blit->dst_pitch; + } + while (--h > 0); + + GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblhrgb.h freetype-2.8/=unpacked-tar2=/graph/gblhrgb.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblhrgb.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblhrgb.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,79 @@ + + GBLENDER_CHANNEL_VARS; + + int h = blit->height; + const unsigned char* src_line = blit->src_line; + unsigned char* dst_line = blit->dst_line; + + gblender_use_channels( blender, 1 ); + + GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); + + do + { + const unsigned char* src = src_line + blit->src_x*3; + unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; + int w = blit->width; + + do + { + unsigned int ar = GBLENDER_SHADE_INDEX(src[0]); + unsigned int ag = GBLENDER_SHADE_INDEX(src[1]); + unsigned int ab = GBLENDER_SHADE_INDEX(src[2]); + unsigned int aa = (ar << 16) | (ag << 8) | ab; + + if ( aa == 0 ) + { + /* nothing */ + } + else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | + ((GBLENDER_SHADE_COUNT-1) << 8) | + (GBLENDER_SHADE_COUNT-1) ) ) + { + GDST_COPY(dst); + } + else + { + GBlenderPixel back; + int pix_r, pix_g, pix_b; + + GDST_READ(dst,back); + + { + unsigned int back_r = (back >> 16) & 255; + + GBLENDER_LOOKUP_R( blender, back_r ); + + pix_r = _grcells[ar]; + } + + { + unsigned int back_g = (back >> 8) & 255; + + GBLENDER_LOOKUP_G( blender, back_g ); + + pix_g = _ggcells[ag]; + } + + { + unsigned int back_b = (back) & 255; + + GBLENDER_LOOKUP_B( blender, back_b ); + + pix_b = _gbcells[ab]; + } + + GDST_STOREC(dst,pix_r,pix_g,pix_b); + } + + src += 3; + dst += GDST_INCR; + } + while (--w > 0); + + src_line += blit->src_pitch; + dst_line += blit->dst_pitch; + } + while (--h > 0); + + GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblvbgr.h freetype-2.8/=unpacked-tar2=/graph/gblvbgr.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblvbgr.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblvbgr.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,80 @@ + + GBLENDER_CHANNEL_VARS; + + int h = blit->height; + const unsigned char* src_line = blit->src_line; + int src_pitch = blit->src_pitch; + unsigned char* dst_line = blit->dst_line; + + gblender_use_channels( blender, 1 ); + + GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); + + do + { + const unsigned char* src = src_line + blit->src_x; + unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; + int w = blit->width; + + do + { + unsigned int ab = GBLENDER_SHADE_INDEX(src[0]); + unsigned int ag = GBLENDER_SHADE_INDEX(src[src_pitch]); + unsigned int ar = GBLENDER_SHADE_INDEX(src[src_pitch << 1]); + GBlenderPixel aa = ((GBlenderPixel)ar << 16) | (ag << 8) | ab; + + if ( aa == 0 ) + { + /* nothing */ + } + else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | + ((GBLENDER_SHADE_COUNT-1) << 8) | + (GBLENDER_SHADE_COUNT-1) ) ) + { + GDST_COPY(dst); + } + else + { + GBlenderPixel back; + int pix_r, pix_g, pix_b; + + GDST_READ(dst,back); + + { + unsigned int back_r = (back >> 16) & 255; + + GBLENDER_LOOKUP_R( blender, back_r ); + + pix_r = _grcells[ar]; + } + + { + unsigned int back_g = (back >> 8) & 255; + + GBLENDER_LOOKUP_G( blender, back_g ); + + pix_g = _ggcells[ag]; + } + + { + unsigned int back_b = (back) & 255; + + GBLENDER_LOOKUP_B( blender, back_b ); + + pix_b = _gbcells[ab]; + } + + GDST_STOREC(dst,pix_r,pix_g,pix_b); + } + + src += 1; + dst += GDST_INCR; + } + while (--w > 0); + + src_line += blit->src_pitch*3; + dst_line += blit->dst_pitch; + } + while (--h > 0); + + GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/gblvrgb.h freetype-2.8/=unpacked-tar2=/graph/gblvrgb.h --- freetype-2.7.1/=unpacked-tar2=/graph/gblvrgb.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/gblvrgb.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,80 @@ + + GBLENDER_CHANNEL_VARS; + + int h = blit->height; + const unsigned char* src_line = blit->src_line; + int src_pitch = blit->src_pitch; + unsigned char* dst_line = blit->dst_line; + + gblender_use_channels( blender, 1 ); + + GBLENDER_CHANNEL_VARS_SET(blender,r,g,b); + + do + { + const unsigned char* src = src_line + blit->src_x; + unsigned char* dst = dst_line + blit->dst_x*GDST_INCR; + int w = blit->width; + + do + { + unsigned int ar = GBLENDER_SHADE_INDEX(src[0]); + unsigned int ag = GBLENDER_SHADE_INDEX(src[src_pitch]); + unsigned int ab = GBLENDER_SHADE_INDEX(src[src_pitch << 1]); + GBlenderPixel aa = ((GBlenderPixel)ar << 16) | (ag << 8) | ab; + + if ( aa == 0 ) + { + /* nothing */ + } + else if ( aa == (((GBLENDER_SHADE_COUNT-1) << 16) | + ((GBLENDER_SHADE_COUNT-1) << 8) | + (GBLENDER_SHADE_COUNT-1) ) ) + { + GDST_COPY(dst); + } + else + { + GBlenderPixel back; + int pix_r, pix_g, pix_b; + + GDST_READ(dst,back); + + { + unsigned int back_r = (back >> 16) & 255; + + GBLENDER_LOOKUP_R( blender, back_r ); + + pix_r = _grcells[ar]; + } + + { + unsigned int back_g = (back >> 8) & 255; + + GBLENDER_LOOKUP_G( blender, back_g ); + + pix_g = _ggcells[ag]; + } + + { + unsigned int back_b = (back) & 255; + + GBLENDER_LOOKUP_B( blender, back_b ); + + pix_b = _gbcells[ab]; + } + + GDST_STOREC(dst,pix_r,pix_g,pix_b); + } + + src += 1; + dst += GDST_INCR; + } + while (--w > 0); + + src_line += blit->src_pitch*3; + dst_line += blit->dst_pitch; + } + while (--h > 0); + + GBLENDER_CHANNEL_CLOSE(blender); diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/graph.h freetype-2.8/=unpacked-tar2=/graph/graph.h --- freetype-2.7.1/=unpacked-tar2=/graph/graph.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/graph.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,682 @@ +/*************************************************************************** + * + * graph.h + * + * Graphics Subsystem interface + * + * Copyright 1999-2007, 2013 + * - The FreeType Development Team - www.freetype.org + * + ***************************************************************************/ + +#ifndef GRAPH_H_ +#define GRAPH_H_ + +#include "grevents.h" + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /******** ********/ + /******** GENERAL DEFINITIONS AND BLITTING ROUTINES ********/ + /******** ********/ + /******** ********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /* define the global error variable */ + extern int grError; + + + /* pixel mode constants */ + typedef enum grPixelMode + { + gr_pixel_mode_none = 0, + gr_pixel_mode_mono, /* monochrome bitmaps */ + gr_pixel_mode_pal4, /* 4-bit paletted - 16 colors */ + gr_pixel_mode_pal8, /* 8-bit paletted - 256 colors */ + gr_pixel_mode_gray, /* 8-bit gray levels */ + gr_pixel_mode_rgb555, /* 15-bits mode - 32768 colors */ + gr_pixel_mode_rgb565, /* 16-bits mode - 65536 colors */ + gr_pixel_mode_rgb24, /* 24-bits mode - 16 million colors */ + gr_pixel_mode_rgb32, /* 32-bits mode - 16 million colors */ + gr_pixel_mode_lcd, /* horizontal RGB-decimated */ + gr_pixel_mode_lcdv, /* vertical RGB-decimated */ + gr_pixel_mode_lcd2, /* horizontal BGR-decimated */ + gr_pixel_mode_lcdv2, /* vertical BGR-decimated */ + gr_pixel_mode_bgra, /* premultiplied BGRA colors */ + + gr_pixel_mode_max /* don't remove */ + + } grPixelMode; + + + /* forward declaration of the surface class */ + typedef struct grSurface_ grSurface; + + + /********************************************************************* + * + * + * grBitmap + * + * + * a simple bitmap descriptor + * + * + * rows :: height in pixels + * width :: width in pixels + * pitch :: + or - the number of bytes per row + * mode :: pixel mode of bitmap buffer + * grays :: number of grays in palette for PAL8 mode. 0 otherwise + * buffer :: pointer to pixel buffer + * + * + * the 'pitch' is positive for downward flows, and negative otherwise + * Its absolute value is always the number of bytes taken by each + * bitmap row. + * + * All drawing operations will be performed within the first + * "width" pixels of each row (clipping is always performed). + * + ********************************************************************/ + + typedef struct grBitmap_ + { + int rows; + int width; + int pitch; + grPixelMode mode; + int grays; + unsigned char* buffer; + + } grBitmap; + + + + typedef long grPos; + typedef char grBool; + + typedef struct grVector_ + { + grPos x; + grPos y; + + } grVector; + + + typedef union grColor_ + { + long value; + unsigned char chroma[4]; + + } grColor; + + + + /********************************************************************** + * + * + * grNewBitmap + * + * + * creates a new bitmap + * + * + * pixel_mode :: the target surface's pixel_mode + * num_grays :: number of grays levels for PAL8 pixel mode + * width :: width in pixels + * height :: height in pixels + * + * + * bit :: descriptor of the new bitmap + * + * + * Error code. 0 means success. + * + * + * This function really allocates a pixel buffer, zero it, then + * returns a descriptor for it. + * + * Call grDoneBitmap when you're done with it.. + * + **********************************************************************/ + + extern int grNewBitmap( grPixelMode pixel_mode, + int num_grays, + int width, + int height, + grBitmap *bit ); + + + /********************************************************************** + * + * + * grBlitGlyphToBitmap + * + * + * writes a given glyph bitmap to a target surface. + * + * + * target :: handle to target bitmap + * glyph :: handle to source glyph bitmap + * x :: position of left-most pixel of glyph image in target surface + * y :: position of top-most pixel of glyph image in target surface + * color :: color to be used to draw a monochrome glyph + * + * + * Error code. 0 means success + * + * + * There are only two supported source pixel modes : monochrome + * and gray. The 8-bit images can have any number of grays between + * 2 and 128, and conversions to the target surface is handled + * _automatically_. + * + * Note however that you should avoid blitting a gray glyph to a gray + * bitmap with fewer levels of grays, as this would much probably + * give unpleasant results.. + * + * This function performs clipping + * + **********************************************************************/ + + extern int + grBlitGlyphToBitmap( grBitmap* target, + grBitmap* glyph, + grPos x, + grPos y, + grColor color ); + + + /* values must be in 0..255 range */ + extern grColor + grFindColor( grBitmap* target, + int red, + int green, + int blue, + int alpha ); + + + /********************************************************************** + * + * + * grWriteCellChar + * + * + * The graphics sub-system contains an internal CP437 8x8 font + * which can be used to display simple strings of text without + * using FreeType. + * + * This function writes a single 8x8 character on the target bitmap. + * + * + * target :: handle to target surface + * x :: x pixel position of character cell's top left corner + * y :: y pixel position of character cell's top left corner + * charcode :: Latin-1 character code + * color :: color to be used to draw the character + * + **********************************************************************/ + + extern + void grWriteCellChar( grBitmap* target, + int x, + int y, + int charcode, + grColor color ); + + + /********************************************************************** + * + * + * grWriteCellString + * + * + * The graphics sub-system contains an internal CP437 8x8 font + * which can be used to display simple strings of text without + * using FreeType. + * + * This function writes a string with the internal font + * + * + * target :: handle to target bitmap + * x :: x pixel position of string's top left corner + * y :: y pixel position of string's top left corner + * string :: Latin-1 text string + * color :: color to be used to draw the character + * + **********************************************************************/ + + extern + void grWriteCellString( grBitmap* target, + int x, + int y, + const char* string, + grColor color ); + + /********************************************************************** + * + * + * grDoneBitmap + * + * + * destroys a bitmap + * + * + * bitmap :: handle to bitmap descriptor + * + * + * This function does NOT release the bitmap descriptor, only + * the pixel buffer. + * + **********************************************************************/ + + extern void grDoneBitmap( grBitmap* bit ); + + + /********************************************************************** + * + * + * grFillRect + * + * + * this function is used to fill a given rectangle on a surface + * + * + * target :: handle to target surface + * x :: x coordinate of the top-left corner of the rectangle + * y :: y coordinate of the top-left corner of the rectangle + * width :: rectangle width in pixels + * height :: rectangle height in pixels + * color :: fill color + * + **********************************************************************/ + + extern void + grFillHLine( grBitmap* target, + int x, + int y, + int width, + grColor color ); + + extern void + grFillVLine( grBitmap* target, + int x, + int y, + int height, + grColor color ); + + extern void + grFillRect( grBitmap* target, + int x, + int y, + int width, + int height, + grColor color ); + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /******** ********/ + /******** DEVICE-SPECIFIC DEFINITIONS AND ROUTINES ********/ + /******** ********/ + /******** ********/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + + /* forward declaration - the definition of grDevice is not visible */ + /* to clients.. */ + typedef struct grDevice_ grDevice; + + + /********************************************************************** + * + * + * grDeviceChain + * + * + * a simple structure used to implement a linked list of + * graphics device descriptors. The list is called a + * "device chain" + * + * + * name :: ASCII name of the device, e.g. "x11", "os2pm", etc.. + * device :: handle to the device descriptor. + * next :: next element in chain + * + * + * the 'device' field is a blind pointer; it is thus unusable by + * client applications.. + * + **********************************************************************/ + + typedef struct grDeviceChain_ grDeviceChain; + + struct grDeviceChain_ + { + const char* name; + grDevice* device; + grDeviceChain* next; + }; + + + /********************************************************************** + * + * + * grInitDevices + * + * + * This function is in charge of initialising all system-specific + * devices. A device is responsible for creating and managing one + * or more "surfaces". A surface is either a window or a screen, + * depending on the system. + * + * + * a pointer to the first element of a device chain. The chain can + * be parsed to find the available devices on the current system + * + * + * If a device cannot be initialised correctly, it is not part of + * the device chain returned by this function. For example, if an + * X11 device was compiled in the library, it will be part of + * the returned device chain only if a connection to the display + * could be established + * + * If no driver could be initialised, this function returns NULL. + * + **********************************************************************/ + + extern + grDeviceChain* grInitDevices( void ); + + + /********************************************************************** + * + * + * grDoneDevices + * + * + * Finalize all devices activated with grInitDevices. + * + **********************************************************************/ + + extern + void grDoneDevices( void ); + + + /********************************************************************** + * + * + * grGetDeviceModes + * + * + * queries the available pixel modes for a device. + * + * + * device_name :: name of device to be used. 0 for the default + * device. For a list of available devices, see + * grInitDevices. + * + * + * num_modes :: number of available modes. 0 in case of error, + * which really is an invalid device name. + * + * pixel_modes :: array of available pixel modes for this device + * this table is internal to the device and should + * not be freed by client applications. + * + * + * error code. 0 means success. invalid device name otherwise + * + * + * All drivers are _required_ to support at least the following + * pixel formats : + * + * - gr_pixel_mode_mono : i.e. monochrome bitmaps + * - gr_pixel_mode_gray : with any number of gray levels between + * 2 and 256. + * + * the pixel modes do not provide the number of grays in the case + * of "gray" devices. You should try to create a surface with the + * maximal number (256, that is) and see the value returned in + * the bitmap descriptor. + * + **********************************************************************/ + + extern void grGetDeviceModes( const char* device_name, + int *num_modes, + grPixelMode* *pixel_modes ); + + + + /********************************************************************** + * + * + * grNewSurface + * + * + * creates a new device-specific surface. A surface is either + * a window or a screen, depending on the device. + * + * + * device :: name of the device to use. A value of NULL means + * the default device (which depends on the system). + * for a list of available devices, see grInitDevices. + * + * + * bitmap :: handle to a bitmap descriptor containing the + * requested pixel mode, number of grays and dimensions + * for the surface. the bitmap's 'pitch' and 'buffer' + * fields are ignored on input. + * + * On output, the bitmap describes the surface's image + * completely. It is possible to write directly in it + * with grBlitGlyphToBitmap, even though the use of + * grBlitGlyphToSurface is recommended. + * + * + * handle to the corresponding surface object. 0 in case of error + * + * + * All drivers are _required_ to support at least the following + * pixel formats : + * + * - gr_pixel_mode_mono : i.e. monochrome bitmaps + * - gr_pixel_mode_gray : with any number of gray levels between + * 2 and 256. + * + * This function might change the bitmap descriptor's fields. For + * example, when displaying a full-screen surface, the bitmap's + * dimensions will be set to those of the screen (e.g. 640x480 + * or 800x600); also, the bitmap's 'buffer' field might point to + * the Video Ram depending on the mode requested.. + * + * The surface contains a copy of the returned bitmap descriptor, + * you can thus discard the 'bitmap' parameter after the call. + * + **********************************************************************/ + + extern grSurface* grNewSurface( const char* device, + grBitmap* bitmap ); + + extern void grDoneSurface( grSurface* surface ); + + /********************************************************************** + * + * + * grRefreshRectangle + * + * + * this function is used to indicate that a given surface rectangle + * was modified and thus needs re-painting. It really is useful for + * windowed or gray surfaces. + * + * + * surface :: handle to target surface + * x :: x coordinate of the top-left corner of the rectangle + * y :: y coordinate of the top-left corner of the rectangle + * width :: rectangle width in pixels + * height :: rectangle height in pixels + * + **********************************************************************/ + + extern void grRefreshRectangle( grSurface* surface, + grPos x, + grPos y, + grPos width, + grPos height ); + + + /********************************************************************** + * + * + * grRefreshSurface + * + * + * a variation of grRefreshRectangle which repaints the whole surface + * to the screen. + * + * + * surface :: handle to target surface + * + **********************************************************************/ + + extern void grRefreshSurface( grSurface* surface ); + + + + /********************************************************************** + * + * + * grWriteSurfaceChar + * + * + * This function is equivalent to calling grWriteCellChar on the + * surface's bitmap, then invoking grRefreshRectangle. + * + * The graphics sub-system contains an internal CP437 8x8 font + * which can be used to display simple strings of text without + * using FreeType. + * + * This function writes a single 8x8 character on the target bitmap. + * + * + * target :: handle to target surface + * x :: x pixel position of character cell's top left corner + * y :: y pixel position of character cell's top left corner + * charcode :: Latin-1 character code + * color :: color to be used to draw the character + * + **********************************************************************/ + + extern + void grWriteSurfaceChar( grSurface* target, + int x, + int y, + int charcode, + grColor color ); + + + /********************************************************************** + * + * + * grWriteSurfaceString + * + * + * This function is equivalent to calling grWriteCellString on the + * surface's bitmap, then invoking grRefreshRectangle. + * + * The graphics sub-system contains an internal CP437 8x8 font + * which can be used to display simple strings of text without + * using FreeType. + * + * This function writes a string with the internal font + * + * + * target :: handle to target bitmap + * x :: x pixel position of string's top left corner + * y :: y pixel position of string's top left corner + * string :: Latin-1 text string + * color :: color to be used to draw the character + * + **********************************************************************/ + + extern + void grWriteSurfaceString( grSurface* target, + int x, + int y, + const char* string, + grColor color ); + + + /********************************************************************** + * + * + * grSetTitle + * + * + * set the window title of a given windowed surface. + * + * + * surface :: handle to target surface + * title_string :: the new title + * + **********************************************************************/ + + extern void grSetTitle( grSurface* surface, + const char* title_string ); + + + + + /********************************************************************** + * + * + * grListenSurface + * + * + * listen the events for a given surface + * + * + * surface :: handle to target surface + * event_mask :: the event mask (mode) + * + * + * event :: the returned event + * + * + * XXX : For now, only keypresses are supported. + * + **********************************************************************/ + + extern + int grListenSurface( grSurface* surface, + int event_mask, + grEvent *event ); + + /********************************************************************** + * + * + * grSetGlyphGamma + * + * + * set the gamma-correction coefficient. This is only used to + * blit glyphs + * + * + * gamma :: gamma value. <= 0 to select sRGB transfer function + * + **********************************************************************/ + + extern + void grSetGlyphGamma( double gamma_value ); + +/* */ + +#endif /* GRAPH_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grblit.c freetype-2.8/=unpacked-tar2=/graph/grblit.c --- freetype-2.7.1/=unpacked-tar2=/graph/grblit.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grblit.c 2016-10-19 04:55:23.000000000 +0000 @@ -0,0 +1,2060 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2002, 2009, 2011, 2014 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* grblit.c: Support for blitting of bitmaps with various depth. */ +/* */ +/****************************************************************************/ + +#include "grblit.h" +#include "grobjs.h" + +#define GRAY8 + + static + int compute_clips( grBlitter* blit, + int x_offset, + int y_offset ) + { + int xmin, ymin, xmax, ymax, width, height, target_width; + + /* perform clipping and setup variables */ + width = blit->source.width; + height = blit->source.rows; + + switch ( blit->source.mode ) + { + case gr_pixel_mode_mono: + width = (width + 7) & -8; + break; + + case gr_pixel_mode_pal4: + width = (width + 1) & -2; + break; + + case gr_pixel_mode_lcd: + case gr_pixel_mode_lcd2: + width /= 3; + break; + + case gr_pixel_mode_lcdv: + case gr_pixel_mode_lcdv2: + height /= 3; + break; + + default: + ; + } + + xmin = x_offset; + ymin = y_offset; + xmax = xmin + width-1; + ymax = ymin + height-1; + + /* clip if necessary */ + if ( width == 0 || height == 0 || + xmax < 0 || xmin >= blit->target.width || + ymax < 0 || ymin >= blit->target.rows ) + return 1; + + /* set up clipping and cursors */ + blit->yread = 0; + if ( ymin < 0 ) + { + blit->yread -= ymin; + height += ymin; + blit->ywrite = 0; + } + else + blit->ywrite = ymin; + + if ( ymax >= blit->target.rows ) + height -= ymax - blit->target.rows + 1; + + blit->xread = 0; + if ( xmin < 0 ) + { + blit->xread -= xmin; + width += xmin; + blit->xwrite = 0; + } + else + blit->xwrite = xmin; + + target_width = blit->target.width; + + switch ( blit->target.mode ) + { + case gr_pixel_mode_mono: + target_width = (target_width + 7) & -8; + break; + case gr_pixel_mode_pal4: + target_width = (target_width + 1) & -2; + break; + + default: + ; + } + + blit->right_clip = xmax - target_width + 1; + if ( blit->right_clip > 0 ) + width -= blit->right_clip; + else + blit->right_clip = 0; + + blit->width = width; + blit->height = height; + + /* set read and write to the top-left corner of the read */ + /* and write areas before clipping. */ + + blit->read = blit->source.buffer; + blit->write = blit->target.buffer; + + blit->read_line = blit->source.pitch; + blit->write_line = blit->target.pitch; + + if ( blit->read_line < 0 ) + blit->read -= (blit->source.rows-1) * blit->read_line; + + if ( blit->write_line < 0 ) + blit->write -= (blit->target.rows-1) * blit->write_line; + + /* now go to the start line. Note that we do not move the */ + /* x position yet, as this is dependent on the pixel format */ + blit->read += blit->yread * blit->read_line; + blit->write += blit->ywrite * blit->write_line; + + return 0; + } + + +/**************************************************************************/ +/* */ +/* blit_mono_to_mono */ +/* */ +/**************************************************************************/ + + static + void blit_mono_to_mono( grBlitter* blit, + grColor color ) + { + unsigned int shift; + int left_clip, x, y; + + byte* read; + byte* write; + + (void)color; /* unused argument */ + + left_clip = ( blit->xread > 0 ); + shift = (unsigned int)( blit->xwrite - blit->xread ) & 7; + + read = blit->read + (blit->xread >> 3); + write = blit->write + (blit->xwrite >> 3); + + if ( shift == 0 ) + { + y = blit->height; + do + { + byte* _read = read; + byte* _write = write; + + x = blit->width; + + do + { + *_write++ |= *_read++; + x -= 8; + } while ( x > 0 ); + + read += blit->read_line; + write += blit->write_line; + y--; + } while ( y > 0 ); + } + else + { + int first, last, count; + + + first = blit->xwrite >> 3; + last = (blit->xwrite + blit->width-1) >> 3; + + count = last - first; + + if ( blit->right_clip ) + count++; + + y = blit->height; + + do + { + unsigned char* _read = read; + unsigned char* _write = write; + unsigned int old; + unsigned int shift2 = (8-shift); + + if ( left_clip ) + old = (unsigned int)(*_read++) << shift2; + else + old = 0; + + x = count; + while ( x > 0 ) + { + unsigned char val; + + val = *_read++; + *_write++ |= (unsigned char)( (val >> shift) | old ); + old = (unsigned int)val << shift2; + x--; + } + + if ( !blit->right_clip ) + *_write |= (unsigned char)old; + + read += blit->read_line; + write += blit->write_line; + y--; + + } while ( y > 0 ); + } + } + + +/**************************************************************************/ +/* */ +/* blit_mono_to_pal8 */ +/* */ +/**************************************************************************/ + + static + void blit_mono_to_pal8( grBlitter* blit, + grColor color ) + { + int x, y; + unsigned int shift; + unsigned char* read; + unsigned char* write; + + read = blit->read + (blit->xread >> 3); + write = blit->write + blit->xwrite; + shift = blit->xread & 7; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; + + x = blit->width; + do + { + if (val & 0x10000) + val = *_read++ | 0x100; + + if ( val & 0x80 ) + *_write = (unsigned char)color.value; + + val <<= 1; + _write++; + + } while ( --x > 0 ); + + read += blit->read_line; + write += blit->write_line; + y--; + } while ( y > 0 ); + } + + +/**************************************************************************/ +/* */ +/* blit_mono_to_pal4 */ +/* */ +/**************************************************************************/ + + static + void blit_mono_to_pal4( grBlitter* blit, + grColor color ) + { + int x, y, phase; + unsigned int shift; + unsigned char* read; + unsigned char* write; + unsigned int col; + + + col = color.value & 15; + read = blit->read + (blit->xread >> 3); + write = blit->write + (blit->xwrite >> 1); + + /* now begin blit */ + shift = blit->xread & 7; + phase = blit->xwrite & 1; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int _phase = phase; + unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; + + x = blit->width; + do + { + if (val & 0x10000) + val = *_read++ | 0x100; + + if ( val & 0x80 ) + { + if ( _phase ) + *_write = (unsigned char)((*_write & 0xF0) | col); + else + *_write = (unsigned char)((*_write & 0x0F) | (col << 4)); + } + + val <<= 1; + + _write += _phase; + _phase ^= 1; + x--; + } while ( x > 0 ); + + read += blit->read_line; + write += blit->write_line; + y--; + } while ( y > 0 ); + } + + +/**************************************************************************/ +/* */ +/* blit_mono_to_rgb16 */ +/* */ +/**************************************************************************/ + + static + void blit_mono_to_rgb16( grBlitter* blit, + grColor color ) + { + int x, y; + unsigned int shift; + unsigned char* read; + unsigned char* write; + + read = blit->read + (blit->xread >> 3); + write = blit->write + blit->xwrite*2; + shift = blit->xread & 7; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; + + x = blit->width; + do + { + if (val & 0x10000) + val = *_read++ | 0x100; + + if ( val & 0x80 ) + *(short*)_write = (short)color.value; + + val <<= 1; + _write +=2; + x--; + } while ( x > 0 ); + + read += blit->read_line; + write += blit->write_line; + y--; + } while ( y > 0 ); + } + + +/**************************************************************************/ +/* */ +/* blit_mono_to_rgb24 */ +/* */ +/**************************************************************************/ + + static + void blit_mono_to_rgb24( grBlitter* blit, + grColor color ) + { + int x, y; + unsigned int shift; + unsigned char* read; + unsigned char* write; + + read = blit->read + (blit->xread >> 3); + write = blit->write + blit->xwrite*3; + shift = blit->xread & 7; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + unsigned long val = ((unsigned long)*_read++ | 0x100) << shift; + + x = blit->width; + do + { + if (val & 0x10000) + val = *_read++ | 0x100; + + if ( val & 0x80 ) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + } + + val <<= 1; + _write += 3; + x--; + } while ( x > 0 ); + + read += blit->read_line; + write += blit->write_line; + y--; + } while ( y > 0 ); + } + + +/**************************************************************************/ +/* */ +/* blit_mono_to_rgb32 */ +/* */ +/**************************************************************************/ + + static + void blit_mono_to_rgb32( grBlitter* blit, + grColor color ) + { + int x, y; + unsigned int shift; + unsigned char* read; + unsigned char* write; + + read = blit->read + ( blit->xread >> 3 ); + write = blit->write + blit->xwrite*4; + shift = blit->xread & 7; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + unsigned long val = ((unsigned long)*_read++ | 0x100L ) << shift; + + x = blit->width; + do + { + if ( val & 0x10000 ) + val = *_read++ | 0x100L; + + if ( val & 0x80 ) + { + /* this could be greatly optimized as */ + /* */ + /* *(long*)_write = color.value */ + /* */ + /* but it wouldn't work on 64-bits systems... stupid C types! */ + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + _write[3] = color.chroma[3]; + } + + val <<= 1; + _write += 4; + x--; + + } while ( x > 0 ); + + read += blit->read_line; + write += blit->write_line; + y--; + + } while ( y > 0 ); + } + + + static + const grBlitterFunc gr_mono_blitters[gr_pixel_mode_max] = + { + 0, + blit_mono_to_mono, + blit_mono_to_pal4, + blit_mono_to_pal8, + blit_mono_to_pal8, + blit_mono_to_rgb16, + blit_mono_to_rgb16, + blit_mono_to_rgb24, + blit_mono_to_rgb32 + }; + + + /*******************************************************************/ + /* */ + /* Saturation tables */ + /* */ + /*******************************************************************/ + + typedef struct grSaturation_ + { + int count; + const byte* table; + + } grSaturation; + + + static + const byte gr_saturation_5[8] = { 0, 1, 2, 3, 4, 4, 4, 4 }; + + + static + const byte gr_saturation_17[32] = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + }; + + + static + grSaturation gr_saturations[ GR_MAX_SATURATIONS ] = + { + { 5, gr_saturation_5 }, + { 17, gr_saturation_17 } + }; + + static + int gr_num_saturations = 2; + + static + grSaturation* gr_last_saturation = gr_saturations; + + + static const byte* + grGetSaturation( int num_grays ) + { + /* first of all, scan the current saturations table */ + grSaturation* sat = gr_saturations; + grSaturation* limit = sat + gr_num_saturations; + + if ( num_grays < 2 ) + { + grError = gr_err_bad_argument; + return 0; + } + + for ( ; sat < limit; sat++ ) + { + if ( sat->count == num_grays ) + { + gr_last_saturation = sat; + return sat->table; + } + } + + /* not found, simply create a new entry if there is room */ + if (gr_num_saturations < GR_MAX_SATURATIONS) + { + int i; + const byte* table; + + table = (const byte*)grAlloc( (unsigned long)( 3 * num_grays - 1 ) * + sizeof ( byte ) ); + if (!table) return 0; + + sat->count = num_grays; + sat->table = table; + + for ( i = 0; i < num_grays; i++, table++ ) + *(unsigned char*)table = (unsigned char)i; + + for ( i = 2*num_grays-1; i > 0; i--, table++ ) + *(unsigned char*)table = (unsigned char)(num_grays-1); + + gr_num_saturations++; + gr_last_saturation = sat; + return sat->table; + } + grError = gr_err_saturation_overflow; + return 0; + } + + + + /*******************************************************************/ + /* */ + /* conversion tables */ + /* */ + /*******************************************************************/ + + typedef struct grConversion_ + { + int target_grays; + int source_grays; + const byte* table; + + } grConversion; + + + + static + const byte gr_gray5_to_gray17[5] = { 0, 4, 8, 12, 16 }; + + + static + const byte gr_gray5_to_gray128[5] = { 0, 32, 64, 96, 127 }; + + + static + const unsigned char gr_gray17_to_gray128[17] = + { + 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 127 + }; + + static + grConversion gr_conversions[ GR_MAX_CONVERSIONS ] = + { + { 17, 5, gr_gray5_to_gray17 }, + { 128, 5, gr_gray5_to_gray128 }, + { 128, 17, gr_gray17_to_gray128 } + }; + + static + int gr_num_conversions = 3; + + static + grConversion* gr_last_conversion = gr_conversions; + + + static const byte* + grGetConversion( int target_grays, + int source_grays ) + { + grConversion* conv = gr_conversions; + grConversion* limit = conv + gr_num_conversions; + + if ( target_grays < 2 || source_grays < 2 ) + { + grError = gr_err_bad_argument; + return 0; + } + + /* otherwise, scan table */ + for ( ; conv < limit; conv++ ) + { + if ( conv->target_grays == target_grays && + conv->source_grays == source_grays ) + { + gr_last_conversion = conv; + return conv->table; + } + } + + /* not found, add a new conversion to the table */ + if (gr_num_conversions < GR_MAX_CONVERSIONS) + { + const byte* table; + int n; + + table = (const byte*)grAlloc( (unsigned long)source_grays * + sizeof ( byte ) ); + if (!table) + return 0; + + conv->target_grays = target_grays; + conv->source_grays = source_grays; + conv->table = table; + + for ( n = 0; n < source_grays; n++ ) + ((unsigned char*)table)[n] = (unsigned char)(n*(target_grays-1) / + (source_grays-1)); + + gr_num_conversions++; + gr_last_conversion = conv; + return table; + } + grError = gr_err_conversion_overflow; + return 0; + } + + + + +/**************************************************************************/ +/* */ +/* blit_gray_to_gray */ +/* */ +/**************************************************************************/ + + static + void blit_gray_to_gray( grBlitter* blit, + const byte* saturation, + const byte* conversion ) + { + int y; + unsigned char* read; + unsigned char* write; + + + read = blit->read + blit->xread; + write = blit->write + blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { +#ifdef GR_CONFIG_GRAY_SKIP_WHITE + unsigned char val = *_read; + + if (val) + { + if (val == max) + *_write = max2; + else + *_write = saturation[ (int)*_write + conversion[ *_read ] ]; + } +#else + *_write = saturation[ (int)*_write + conversion[ *_read ] ]; +#endif + _write++; + _read++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + +/**************************************************************************/ +/* */ +/* blit_gray_to_gray_simple */ +/* */ +/**************************************************************************/ + + static + void blit_gray_to_gray_simple( grBlitter* blit, + const byte* saturation ) + { + int y; + unsigned char* read; + unsigned char* write; +#ifdef GR_CONFIG_GRAY_SKIP_WHITE + unsigned char max; + + + max = (unsigned char)( blit->source.grays - 1 ); +#endif + + read = blit->read + blit->xread; + write = blit->write + blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { +#ifdef GR_CONFIG_GRAY_SKIP_WHITE + unsigned char val = *_read; + + if (val) + { + if (val == max) + *_write = val; + else + *_write = saturation[ (int)*_write + *_read ]; + } +#else + *_write = saturation[ (int)*_write + *_read ]; +#endif + _write++; + _read++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + + +#define compose_pixel_full( a, b, n0, n1, n2, max ) \ + { \ + int d, half = max >> 1; \ + \ + \ + d = (int)b.chroma[0] - a.chroma[0]; \ + a.chroma[0] += (unsigned char)((n0*d + half)/max); \ + \ + d = (int)b.chroma[1] - a.chroma[1]; \ + a.chroma[1] += (unsigned char)((n1*d + half)/max); \ + \ + d = (int)b.chroma[2] - a.chroma[2]; \ + a.chroma[2] += (unsigned char)((n2*d + half)/max); \ + } + +#define compose_pixel( a, b, n, max ) \ + compose_pixel_full( a, b, n, n, n, max ) + + +#define extract555( pixel, color ) \ + color.chroma[0] = (unsigned char)((pixel >> 10) & 0x1F); \ + color.chroma[1] = (unsigned char)((pixel >> 5) & 0x1F); \ + color.chroma[2] = (unsigned char)((pixel ) & 0x1F); + + +#define extract565( pixel, color ) \ + color.chroma[0] = (unsigned char)((pixel >> 11) & 0x1F); \ + color.chroma[1] = (unsigned char)((pixel >> 5) & 0x3F); \ + color.chroma[2] = (unsigned char)((pixel ) & 0x1F); + + +#define inject555( color ) \ + ( ( (unsigned short)color.chroma[0] << 10 ) | \ + ( (unsigned short)color.chroma[1] << 5 ) | \ + color.chroma[2] ) + + +#define inject565( color ) \ + ( ( (unsigned short)color.chroma[0] << 11 ) | \ + ( (unsigned short)color.chroma[1] << 5 ) | \ + color.chroma[2] ) + + +/**************************************************************************/ +/* */ +/* blit_gray_to_555 */ +/* */ +/**************************************************************************/ + +#ifdef GRAY8 + static + void blit_gray8_to_555( grBlitter* blit, + grColor color ) + { + int y; + int sr = (color.chroma[0] << 7) & 0x7C00; + int sg = (color.chroma[1] << 2) & 0x03E0; + int sb = (color.chroma[2] >> 3) & 0x001F; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 2*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + unsigned short* pixel = (unsigned short*)_write; + + if (val >= 254 ) + *pixel = (unsigned short)( sr | sg | sb ); + else if ( val >= 2 ) + { + /* compose gray value */ + int pix = (int)*pixel; + int dr = pix & 0x7C00; + int dg = pix & 0x03E0; + int db = pix & 0x001F; + + dr += ((sr-dr)*val) >> 8; + dr &= 0x7C00; + + dg += ((sg-dg)*val) >> 8; + dg &= 0x03E0; + + db += ((sb-db)*val) >> 8; + db &= 0x001F; + + *pixel = (unsigned short)( dr | dg | db ); + } + } + _write +=2; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + + } +#endif /* GRAY8 */ + + static + void blit_gray_to_555( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 2*blit->xwrite; + + /* scale down R:G:B triplet */ + color.chroma[0] >>= 3; + color.chroma[1] >>= 3; + color.chroma[2] >>= 3; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + unsigned short* pixel = (unsigned short*)_write; + + if (val == max) + *pixel = (unsigned short)(inject555( color )); + else + { + /* compose gray value */ + unsigned short pix16 = *pixel; + grColor pix; + + extract555( pix16, pix ); + + compose_pixel( pix, color, val, max ); + *pixel = (unsigned short)(inject555( pix )); + } + } + _write += 2; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + +/**************************************************************************/ +/* */ +/* blit_gray_to_565 */ +/* */ +/**************************************************************************/ + +#ifdef GRAY8 + static + void blit_gray8_to_565( grBlitter* blit, + grColor color ) + { + int y; + int sr = (color.chroma[0] << 8) & 0xF800; + int sg = (color.chroma[1] << 3) & 0x07E0; + int sb = (color.chroma[2] >> 3) & 0x001F; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 2*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + unsigned short* pixel = (unsigned short*)_write; + + if (val >= 254 ) + *pixel = (unsigned short)( sr | sg | sb ); + else if ( val >= 2 ) + { + /* compose gray value */ + int pix = (int)*pixel; + int dr = pix & 0xF800; + int dg = pix & 0x07E0; + int db = pix & 0x001F; + + dr += ((sr-dr)*val) >> 8; + dr &= 0xF800; + + dg += ((sg-dg)*val) >> 8; + dg &= 0x07E0; + + db += ((sb-db)*val) >> 8; + db &= 0x001F; + + *pixel = (unsigned short)( dr | dg | db ); + } + } + _write +=2; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } +#endif + + static + void blit_gray_to_565( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 2*blit->xwrite; + + /* scale down R:G:B triplet */ + color.chroma[0] >>= 3; + color.chroma[1] >>= 2; + color.chroma[2] >>= 3; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + unsigned short* pixel = (unsigned short*)_write; + + if (val == max) + *pixel = (unsigned short)inject565( color ); + else + { + /* compose gray value */ + unsigned short pix16 = *pixel; + grColor pix; + + extract565( pix16, pix ); + + compose_pixel( pix, color, val, max ); + *pixel = (unsigned short)inject565( pix ); + } + } + _write +=2; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + +/**************************************************************************/ +/* */ +/* blit_gray_to_24 */ +/* */ +/**************************************************************************/ + +#ifdef GRAY8 + static void + blit_gray8_to_24( grBlitter* blit, + grColor color ) + { + int y; + int sr = color.chroma[0]; + int sg = color.chroma[1]; + int sb = color.chroma[2]; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 3*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + if (val >= 254) + { + _write[0] = (unsigned char)sr; + _write[1] = (unsigned char)sg; + _write[2] = (unsigned char)sb; + } + else if ( val >= 2 ) + { + int dr = _write[0]; + int dg = _write[1]; + int db = _write[2]; + + dr += ((sr-dr)*val) >> 8; + dg += ((sg-dg)*val) >> 8; + db += ((sb-db)*val) >> 8; + + _write[0] = (unsigned char)dr; + _write[1] = (unsigned char)dg, + _write[2] = (unsigned char)db; + } + } + _write += 3; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } +#endif /* GRAY8 */ + + + static + void blit_gray_to_24( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 3*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + if (val == max) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + } + else + { + /* compose gray value */ + grColor pix; + + pix.chroma[0] = _write[0]; + pix.chroma[1] = _write[1]; + pix.chroma[2] = _write[2]; + + compose_pixel( pix, color, val, max ); + + _write[0] = pix.chroma[0]; + _write[1] = pix.chroma[1]; + _write[2] = pix.chroma[2]; + } + } + _write += 3; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + +/**************************************************************************/ +/* */ +/* blit_gray_to_32 */ +/* */ +/**************************************************************************/ + + static + void blit_gray_to_32( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + + read = blit->read + blit->xread; + write = blit->write + 4*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val; + + val = *_read; + if (val) + { + if (val == max) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + _write[3] = color.chroma[3]; + } + else + { + /* compose gray value */ + grColor pix; + + pix.chroma[0] = _write[0]; + pix.chroma[1] = _write[1]; + pix.chroma[2] = _write[2]; + + compose_pixel( pix, color, val, max ); + + _write[0] = pix.chroma[0]; + _write[1] = pix.chroma[1]; + _write[2] = pix.chroma[2]; + } + } + _write += 4; + _read ++; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + + static + void blit_gray8_to_32( grBlitter* blit, + grColor color ) + { + blit_gray_to_32( blit, color, 255 ); + } + + +/**************************************************************************/ +/* */ +/* blit_lcd_to_24 */ +/* */ +/**************************************************************************/ + +#ifdef GRAY8 + static void + blit_lcd8_to_24( grBlitter* blit, + grColor color ) + { + int y; + int sr = color.chroma[0]; + int sg = color.chroma[1]; + int sb = color.chroma[2]; + unsigned char* read; + unsigned char* write; + + read = blit->read + 3*blit->xread; + write = blit->write + 3*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + int val0, val1, val2; + + val0 = _read[0]; + val1 = _read[1]; + val2 = _read[2]; + + if ( val0 | val1 | val2 ) + { + if ( val0 == val1 && + val0 == val2 && + val0 == 255 ) + { + _write[0] = (unsigned char)sr; + _write[1] = (unsigned char)sg; + _write[2] = (unsigned char)sb; + } + else + { + /* compose gray value */ + int dr, dg, db; + + dr = _write[0]; + dr += (sr-dr)*val0 >> 8; + + dg = _write[1]; + dg += (sg-dg)*val1 >> 8; + + db = _write[2]; + db += (sb-db)*val2 >> 8; + + _write[0] = (unsigned char)dr; + _write[1] = (unsigned char)dg; + _write[2] = (unsigned char)db; + } + } + _write += 3; + _read += 3; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } +#endif /* GRAY8 */ + + static void + blit_lcd_to_24( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + + read = blit->read + 3*blit->xread; + write = blit->write + 3*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + int val0, val1, val2; + + val0 = _read[0]; + val1 = _read[1]; + val2 = _read[2]; + + if ( val0 | val1 | val2 ) + { + if ( val0 == val1 && + val0 == val2 && + val0 == max ) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + } + else + { + /* compose gray value */ + grColor pix; + + pix.chroma[0] = _write[0]; + pix.chroma[1] = _write[1]; + pix.chroma[2] = _write[2]; + + compose_pixel_full( pix, color, val0, val1, val2, max ); + + _write[0] = pix.chroma[0]; + _write[1] = pix.chroma[1]; + _write[2] = pix.chroma[2]; + } + } + _write += 3; + _read += 3; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + +#ifdef GRAY8 + static void + blit_lcd28_to_24( grBlitter* blit, + grColor color ) + { + int y; + int sr = color.chroma[0]; + int sg = color.chroma[1]; + int sb = color.chroma[2]; + unsigned char* read; + unsigned char* write; + + read = blit->read + 3*blit->xread; + write = blit->write + 3*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + int val0, val1, val2; + + val0 = _read[2]; + val1 = _read[1]; + val2 = _read[0]; + + if ( val0 | val1 | val2 ) + { + if ( val0 == val1 && + val0 == val2 && + val0 == 255 ) + { + _write[0] = (unsigned char)sr; + _write[1] = (unsigned char)sg; + _write[2] = (unsigned char)sb; + } + else + { + /* compose gray value */ + int dr, dg, db; + + dr = _write[0]; + dr += (sr-dr)*val0 >> 8; + + dg = _write[1]; + dg += (sg-dg)*val1 >> 8; + + db = _write[2]; + db += (sb-db)*val2 >> 8; + + _write[0] = (unsigned char)dr; + _write[1] = (unsigned char)dg; + _write[2] = (unsigned char)db; + } + } + _write += 3; + _read += 3; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } +#endif /* GRAY8 */ + + static void + blit_lcd2_to_24( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + + read = blit->read + 3*blit->xread; + write = blit->write + 3*blit->xwrite; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + int val0, val1, val2; + + val0 = _read[2]; + val1 = _read[1]; + val2 = _read[0]; + + if ( val0 | val1 | val2 ) + { + if ( val0 == val1 && + val0 == val2 && + val0 == max ) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + } + else + { + /* compose gray value */ + grColor pix; + + pix.chroma[0] = _write[0]; + pix.chroma[1] = _write[1]; + pix.chroma[2] = _write[2]; + + compose_pixel_full( pix, color, val0, val1, val2, max ); + + _write[0] = pix.chroma[0]; + _write[1] = pix.chroma[1]; + _write[2] = pix.chroma[2]; + } + } + _write += 3; + _read += 3; + x--; + } + + read += blit->read_line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + +/**************************************************************************/ +/* */ +/* blit_lcdv_to_24 */ +/* */ +/**************************************************************************/ + + static void + blit_lcdv_to_24( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + long line; + + read = blit->read + blit->xread; + write = blit->write + 3*blit->xwrite; + line = blit->read_line; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val0, val1, val2; + + val0 = _read[0*line]; + val1 = _read[1*line]; + val2 = _read[2*line]; + + if ( val0 | val1 | val2 ) + { + if ( val0 == val1 && + val0 == val2 && + val0 == max ) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + } + else + { + /* compose gray value */ + grColor pix; + + pix.chroma[0] = _write[0]; + pix.chroma[1] = _write[1]; + pix.chroma[2] = _write[2]; + + compose_pixel_full( pix, color, val0, val1, val2, max ); + + _write[0] = pix.chroma[0]; + _write[1] = pix.chroma[1]; + _write[2] = pix.chroma[2]; + } + } + _write += 3; + _read += 1; + x--; + } + + read += 3*line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + + static void + blit_lcdv2_to_24( grBlitter* blit, + grColor color, + int max ) + { + int y; + unsigned char* read; + unsigned char* write; + long line; + + read = blit->read + blit->xread; + write = blit->write + 3*blit->xwrite; + line = blit->read_line; + + y = blit->height; + do + { + unsigned char* _read = read; + unsigned char* _write = write; + int x = blit->width; + + while (x > 0) + { + unsigned char val0, val1, val2; + + val0 = _read[2*line]; + val1 = _read[1*line]; + val2 = _read[0*line]; + + if ( val0 | val1 | val2 ) + { + if ( val0 == val1 && + val0 == val2 && + val0 == max ) + { + _write[0] = color.chroma[0]; + _write[1] = color.chroma[1]; + _write[2] = color.chroma[2]; + } + else + { + /* compose gray value */ + grColor pix; + + pix.chroma[0] = _write[0]; + pix.chroma[1] = _write[1]; + pix.chroma[2] = _write[2]; + + compose_pixel_full( pix, color, val0, val1, val2, max ); + + _write[0] = pix.chroma[0]; + _write[1] = pix.chroma[1]; + _write[2] = pix.chroma[2]; + } + } + _write += 3; + _read += 1; + x--; + } + + read += 3*line; + write += blit->write_line; + y--; + } + while (y > 0); + } + + + /********************************************************************** + * + * + * grBlitGlyphToBitmap + * + * + * writes a given glyph bitmap to a target surface. + * + * + * surface :: handle to target surface + * x :: position of left-most pixel of glyph image in surface + * y :: position of top-most pixel of glyph image in surface + * bitmap :: source glyph image + * + * + * Error code. 0 means success + * + **********************************************************************/ + + typedef void (*grColorGlyphBlitter)( grBlitter* blit, + grColor color, + int max_gray ); + + static + const grColorGlyphBlitter gr_color_blitters[gr_pixel_mode_max] = + { + 0, + 0, + 0, + 0, + 0, + blit_gray_to_555, + blit_gray_to_565, + blit_gray_to_24, + blit_gray_to_32 + }; + +#ifdef GRAY8 + typedef void (*grGray8GlyphBlitter)( grBlitter* blit, + grColor color ); + + static + const grGray8GlyphBlitter gr_gray8_blitters[gr_pixel_mode_max] = + { + 0, + 0, + 0, + 0, + 0, + blit_gray8_to_555, + blit_gray8_to_565, + blit_gray8_to_24, + blit_gray8_to_32 + }; +#endif + + +#include "gblblit.h" + + static double gr_glyph_gamma = 1.8; + + void grSetGlyphGamma( double gamma ) + { + gr_glyph_gamma = gamma; + } + + + int + grBlitGlyphToBitmap( grBitmap* target, + grBitmap* glyph, + grPos x, + grPos y, + grColor color ) + { + grBlitter blit; + grPixelMode mode; + + + /* check arguments */ + if ( !target || !glyph ) + { + grError = gr_err_bad_argument; + return -1; + } + + if ( !glyph->rows || !glyph->width ) + { + /* nothing to do */ + return 0; + } + + /* short cut to alpha blender for certain glyph types + */ + { + GBlenderSourceFormat src_format; + GBlenderTargetFormat dst_format; + int width, height; + GBlenderBlitRec gblit[1]; + GBlenderPixel gcolor; + static GBlenderRec gblender[1]; + static double gblender_gamma = -100.0; + + if ( glyph->grays != 256 ) + goto LegacyBlit; + + switch ( glyph->mode ) + { + case gr_pixel_mode_gray: src_format = GBLENDER_SOURCE_GRAY8; break; + case gr_pixel_mode_lcd: src_format = GBLENDER_SOURCE_HRGB; break; + case gr_pixel_mode_lcdv: src_format = GBLENDER_SOURCE_VRGB; break; + case gr_pixel_mode_lcd2: src_format = GBLENDER_SOURCE_HBGR; break; + case gr_pixel_mode_lcdv2: src_format = GBLENDER_SOURCE_VBGR; break; + case gr_pixel_mode_bgra: src_format = GBLENDER_SOURCE_BGRA; break; + + default: + goto LegacyBlit; + } + + width = glyph->width; + height = glyph->rows; + + if ( glyph->mode == gr_pixel_mode_lcd || + glyph->mode == gr_pixel_mode_lcd2 ) + width /= 3; + + if ( glyph->mode == gr_pixel_mode_lcdv || + glyph->mode == gr_pixel_mode_lcdv2 ) + height /= 3; + + switch ( target->mode ) + { + case gr_pixel_mode_rgb32: dst_format = GBLENDER_TARGET_RGB32; break; + case gr_pixel_mode_rgb24: dst_format = GBLENDER_TARGET_RGB24; break; + case gr_pixel_mode_rgb565: dst_format = GBLENDER_TARGET_RGB565; break; + default: + goto LegacyBlit; + } + + /* initialize blender when needed, i.e. when gamma changes + */ + if ( gblender_gamma != gr_glyph_gamma ) + { + gblender_gamma = gr_glyph_gamma; + gblender_init( gblender, gblender_gamma ); + } + + if ( gblender_blit_init( gblit, gblender, + x, y, + src_format, + glyph->buffer, + glyph->pitch, + width, + height, + dst_format, + target->buffer, + target->pitch, + target->width, + target->rows ) < 0 ) + { + /* nothing to do */ + return 0; + } + + gcolor = ((GBlenderPixel)color.chroma[0] << 16) | + ((GBlenderPixel)color.chroma[1] << 8 ) | + ((GBlenderPixel)color.chroma[2] ) ; + + gblender_blit_run( gblit, gcolor ); + return 1; + } + + LegacyBlit: /* no gamma correction, no caching */ + + /* set up blitter and compute clipping. Return immediately if needed */ + blit.source = *glyph; + blit.target = *target; + mode = target->mode; + + if ( compute_clips( &blit, x, y ) ) + return 0; + + switch ( glyph->mode ) + { + case gr_pixel_mode_mono: /* handle monochrome bitmap blitting */ + if ( mode <= gr_pixel_mode_none || mode >= gr_pixel_mode_max ) + { + grError = gr_err_bad_source_depth; + return -1; + } + + gr_mono_blitters[mode]( &blit, color ); + break; + + case gr_pixel_mode_gray: + if ( glyph->grays > 1 ) + { + int target_grays = target->grays; + int source_grays = glyph->grays; + const byte* saturation; + + + if ( mode == gr_pixel_mode_gray && target_grays > 1 ) + { + /* rendering into a gray target - use special composition */ + /* routines.. */ + if ( gr_last_saturation->count == target_grays ) + saturation = gr_last_saturation->table; + else + { + saturation = grGetSaturation( target_grays ); + if ( !saturation ) + return -3; + } + + if ( target_grays == source_grays ) + blit_gray_to_gray_simple( &blit, saturation ); + else + { + const byte* conversion; + + + if ( gr_last_conversion->target_grays == target_grays && + gr_last_conversion->source_grays == source_grays ) + conversion = gr_last_conversion->table; + else + { + conversion = grGetConversion( target_grays, source_grays ); + if ( !conversion ) + return -3; + } + + blit_gray_to_gray( &blit, saturation, conversion ); + } + } + else + { + /* rendering into a color target */ + if ( mode <= gr_pixel_mode_gray || + mode >= gr_pixel_mode_max ) + { + grError = gr_err_bad_target_depth; + return -1; + } + +#ifdef GRAY8 + if ( source_grays == 256 ) + gr_gray8_blitters[mode]( &blit, color ); + else +#endif /* GRAY8 */ + gr_color_blitters[mode]( &blit, color, source_grays - 1 ); + } + } + break; + + case gr_pixel_mode_lcd: + if ( mode == gr_pixel_mode_rgb24 ) + { +#ifdef GRAY8 + if ( glyph->grays == 256 ) + blit_lcd8_to_24( &blit, color ); + else +#endif + if ( glyph->grays > 1 ) + blit_lcd_to_24( &blit, color, glyph->grays-1 ); + } + break; + + + case gr_pixel_mode_lcdv: + if ( glyph->grays > 1 && mode == gr_pixel_mode_rgb24 ) + { + blit_lcdv_to_24( &blit, color, glyph->grays-1 ); + break; + } + + case gr_pixel_mode_lcd2: + if ( mode == gr_pixel_mode_rgb24 ) + { +#ifdef GRAY8 + if ( glyph->grays == 256 ) + blit_lcd28_to_24( &blit, color ); + else +#endif + if ( glyph->grays > 1 ) + blit_lcd2_to_24( &blit, color, glyph->grays-1 ); + } + break; + + case gr_pixel_mode_lcdv2: + if ( mode == gr_pixel_mode_rgb24 ) + { + if ( glyph->grays > 1 ) + blit_lcdv2_to_24( &blit, color, glyph->grays-1 ); + } + break; + + default: + /* we don't support the blitting of bitmaps of the following */ + /* types : pal4, pal8, rgb555, rgb565, rgb24, rgb32 */ + /* */ + grError = gr_err_bad_source_depth; + return -2; + } + + return 0; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grblit.h freetype-2.8/=unpacked-tar2=/graph/grblit.h --- freetype-2.7.1/=unpacked-tar2=/graph/grblit.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grblit.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,27 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-1999 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* blitter.h: Support for blitting of bitmaps with various depth. */ +/* */ +/****************************************************************************/ + +#ifndef GRBLIT_H_ +#define GRBLIT_H_ + +#include "grobjs.h" + + int grBlitMono( grBitmap* target, + grBitmap* source, + int x_offset, + int y_offset, + grColor color ); + + +#endif /* GRBLIT_H_ */ + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grconfig.h freetype-2.8/=unpacked-tar2=/graph/grconfig.h --- freetype-2.7.1/=unpacked-tar2=/graph/grconfig.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grconfig.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,9 @@ +#ifndef GRCONFIG_H_ +#define GRCONFIG_H_ + +#define GR_MAX_SATURATIONS 8 +#define GR_MAX_CONVERSIONS 16 + +#define GR_MAX_DEVICES 8 + +#endif /* GRCONFIG_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grdevice.c freetype-2.8/=unpacked-tar2=/graph/grdevice.c --- freetype-2.7.1/=unpacked-tar2=/graph/grdevice.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grdevice.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,362 @@ +#include "grobjs.h" +#include "grdevice.h" +#include +#include + + grDeviceChain gr_device_chain[ GR_MAX_DEVICES ]; + int gr_num_devices = 0; + + static + grDevice* find_device( const char* device_name ) + { + int idx = 0; + + if (device_name) + { + for ( idx = gr_num_devices-1; idx > 0; idx-- ) + if ( strcmp( device_name, gr_device_chain[idx].name ) == 0 ) + break; + } + + if ( idx < 0 || gr_num_devices <= 0 || !gr_device_chain[idx].device ) + { + grError = gr_err_invalid_device; + return 0; + } + + return gr_device_chain[idx].device; + } + + + + /********************************************************************** + * + * + * grGetDeviceModes + * + * + * queries the available pixel modes for a device. + * + * + * device_name :: name of device to be used. 0 for the default + * device. For a list of available devices, see + * grInitDevices. + * + * + * num_modes :: number of available modes. 0 in case of error, + * which really is an invalid device name. + * + * pixel_modes :: array of available pixel modes for this device + * this table is internal to the device and should + * not be freed by client applications. + * + * + * error code. 0 means success. invalid device name otherwise + * + * + * All drivers are _required_ to support at least the following + * pixel formats : + * + * - gr_pixel_mode_mono : i.e. monochrome bitmaps + * - gr_pixel_mode_gray : with any number of gray levels between + * 2 and 256. + * + * the pixel modes do not provide the number of grays in the case + * of "gray" devices. You should try to create a surface with the + * maximal number (256, that is) and see the value returned in + * the bitmap descriptor. + * + **********************************************************************/ + + extern void grGetDeviceModes( const char* device_name, + int *num_modes, + grPixelMode* *pixel_modes ) + { + grDevice* device; + + *num_modes = 0; + *pixel_modes = 0; + + device = find_device( device_name ); + if (device) + { + *num_modes = device->num_pixel_modes; + *pixel_modes = device->pixel_modes; + } + } + + + /********************************************************************** + * + * + * grNewSurface + * + * + * creates a new device-specific surface. A surface is either + * a window or a screen, depending on the device. + * + * + * device :: name of the device to use. A value of NULL means + * the default device (which depends on the system). + * for a list of available devices, see grInitDevices. + * + * + * bitmap :: handle to a bitmap descriptor containing the + * requested pixel mode, number of grays and dimensions + * for the surface. the bitmap's 'pitch' and 'buffer' + * fields are ignored on input. + * + * On output, the bitmap describes the surface's image + * completely. It is possible to write directly in it + * with grBlitGlyphToBitmap, even though the use of + * grBlitGlyphToSurface is recommended. + * + * + * handle to the corresponding surface object. 0 in case of error + * + * + * All drivers are _required_ to support at least the following + * pixel formats : + * + * - gr_pixel_mode_mono : i.e. monochrome bitmaps + * - gr_pixel_mode_gray : with any number of gray levels between + * 2 and 256. + * + * This function might change the bitmap descriptor's fields. For + * example, when displaying a full-screen surface, the bitmap's + * dimensions will be set to those of the screen (e.g. 640x480 + * or 800x600); also, the bitmap's 'buffer' field might point to + * the Video Ram depending on the mode requested.. + * + * The surface contains a copy of the returned bitmap descriptor, + * you can thus discard the 'bitmap' parameter after the call. + * + **********************************************************************/ + + extern grSurface* grNewSurface( const char* device_name, + grBitmap* bitmap ) + { + grDevice* device; + grSurface* surface; + + /* Now find the device */ + device = find_device( device_name ); + if (!device) return 0; + + surface = (grSurface*)grAlloc( device->surface_objsize ); + if (!surface) return 0; + + if ( !device->init_surface( surface, bitmap ) ) + { + grFree( (void *)surface ); + surface = 0; + } + return surface; + } + + + + extern + void grDoneSurface( grSurface* surface ) + { + if (surface) + { + /* first of all, call the device-specific destructor */ + surface->done(surface); + + /* then remove the bitmap if we're owner */ + if (surface->owner) + grFree( surface->bitmap.buffer ); + + surface->owner = 0; + surface->bitmap.buffer = 0; + grFree( surface ); + } + } + + + /********************************************************************** + * + * + * grRefreshRectangle + * + * + * this function is used to indicate that a given surface rectangle + * was modified and thus needs re-painting. It really is useful for + * windowed or gray surfaces. + * + * + * surface :: handle to target surface + * x :: x coordinate of the top-left corner of the rectangle + * y :: y coordinate of the top-left corner of the rectangle + * width :: rectangle width in pixels + * height :: rectangle height in pixels + * + **********************************************************************/ + + extern void grRefreshRectangle( grSurface* surface, + grPos x, + grPos y, + grPos width, + grPos height ) + { + if (surface->refresh_rect) + surface->refresh_rect( surface, x, y, width, height ); + } + + + + /********************************************************************** + * + * + * grWriteSurfaceChar + * + * + * This function is equivalent to calling grWriteCellChar on the + * surface's bitmap, then invoking grRefreshRectangle. + * + * The graphics sub-system contains an internal CP437 8x8 font + * which can be used to display simple strings of text without + * using FreeType. + * + * This function writes a single 8x8 character on the target bitmap. + * + * + * target :: handle to target surface + * x :: x pixel position of character cell's top left corner + * y :: y pixel position of character cell's top left corner + * charcode :: Latin-1 character code + * color :: color to be used to draw the character + * + **********************************************************************/ + + extern + void grWriteSurfaceChar( grSurface* target, + int x, + int y, + int charcode, + grColor color ) + { + grWriteCellChar( &target->bitmap, x, y, charcode, color ); + if (target->refresh_rect) + target->refresh_rect( target, x, y, 8, 8 ); + } + + + /********************************************************************** + * + * + * grWriteSurfaceString + * + * + * This function is equivalent to calling grWriteCellString on the + * surface's bitmap, then invoking grRefreshRectangle. + * + * The graphics sub-system contains an internal CP437 8x8 font + * which can be used to display simple strings of text without + * using FreeType. + * + * This function writes a string with the internal font + * + * + * target :: handle to target bitmap + * x :: x pixel position of string's top left corner + * y :: y pixel position of string's top left corner + * string :: Latin-1 text string + * color :: color to be used to draw the character + * + **********************************************************************/ + + extern + void grWriteSurfaceString( grSurface* target, + int x, + int y, + const char* string, + grColor color ) + { + int len; + + len = (int)strlen(string); + grWriteCellString( &target->bitmap, x, y, string, color ); + if (target->refresh_rect) + target->refresh_rect( target, x, y, 8*len, 8 ); + } + + + /********************************************************************** + * + * + * grRefreshSurface + * + * + * a variation of grRefreshRectangle which repaints the whole surface + * to the screen. + * + * + * surface :: handle to target surface + * + **********************************************************************/ + + extern void grRefreshSurface( grSurface* surface ) + { + if (surface->refresh_rect) + surface->refresh_rect( surface, 0, 0, + surface->bitmap.width, + surface->bitmap.rows ); + } + + + + /********************************************************************** + * + * + * grSetTitle + * + * + * set the window title of a given windowed surface. + * + * + * surface :: handle to target surface + * title_string :: the new title + * + **********************************************************************/ + + extern void grSetTitle( grSurface* surface, + const char* title_string ) + { + if (surface->set_title) + surface->set_title( surface, title_string ); + } + + + + + /********************************************************************** + * + * + * grListenSurface + * + * + * listen the events for a given surface + * + * + * surface :: handle to target surface + * event_mask :: the event mask (mode) + * + * + * event :: the returned event + * + * + * XXX : For now, only keypresses are supported. + * + **********************************************************************/ + + extern + int grListenSurface( grSurface* surface, + int event_mask, + grEvent *event ) + { + return surface->listen_event( surface, event_mask, event ); + } + + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grdevice.h freetype-2.8/=unpacked-tar2=/graph/grdevice.h --- freetype-2.7.1/=unpacked-tar2=/graph/grdevice.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grdevice.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,136 @@ +/*************************************************************************** + * + * grdevice.h + * + * Graphics device interface + * + * Copyright 1999 - The FreeType Development Team - www.freetype.org + * + * + ***************************************************************************/ + +#ifndef GRDEVICE_H_ +#define GRDEVICE_H_ + +#include "graph.h" + + + /******************************************************************** + * + * + * grDeviceInitFunc + * + * + * Simple device initialiser function + * + * + * error code. 0 means success + * + ********************************************************************/ + + typedef int (*grDeviceInitFunc)( void ); + + + /******************************************************************** + * + * + * grDeviceDoneFunc + * + * + * Simple device finaliser function + * + * + * error code. 0 means success + * + ********************************************************************/ + + typedef void (*grDeviceDoneFunc)( void ); + + + /******************************************************************** + * + * + * grDeviceInitSurfaceFunc + * + * + * initializes a new surface for the device. This may be a window + * or a video screen, depending on the device. + * + * + * surface :: handle to target surface + * + * + * bitmap :: handle to bitmap descriptor + * + ********************************************************************/ + + typedef int (*grDeviceInitSurfaceFunc)( grSurface* surface, + grBitmap* bitmap ); + + + /******************************************************************** + * + * + * grDevice + * + * + * Simple device interface structure + * + * + * surface_objsize :: size in bytes of a single surface object for + * this device. + * + * device_name :: name of device, e.g. "x11", "os2pm", "directx" etc.. + * init :: device initialisation routine + * done :: device finalisation + * new_surface :: function used to create a new surface (screen or + * window) from the device + * + * num_pixel_modes :: the number of pixel modes supported by this + * device. This value _must_ be set to -1 + * default, unless the device provides a + * static set of pixel modes (fullscreen). + * + * pixel_modes :: an array of pixel modes supported by this + * device + * + * + * the fields "num_pixel_modes" and "pixel_modes" must be + * set by the "init" function. + * + * This allows windowed devices to "discover" at run-time the + * available pixel modes they can provide depending on the + * current screen depth. + * + ********************************************************************/ + + struct grDevice_ + { + unsigned int surface_objsize; + const char* device_name; /* name of device */ + + grDeviceInitFunc init; + grDeviceDoneFunc done; + + grDeviceInitSurfaceFunc init_surface; + + int num_pixel_modes; + grPixelMode* pixel_modes; + }; + + + extern grDevice* gr_devices[]; + extern grDeviceChain gr_device_chain[]; + extern int gr_num_devices; + extern int gr_max_devices; + + +extern void +gr_swizzle_rgb24( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int width, + int height ); + +#endif /* GRDEVICE_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grevents.h freetype-2.8/=unpacked-tar2=/graph/grevents.h --- freetype-2.7.1/=unpacked-tar2=/graph/grevents.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grevents.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,177 @@ +#ifndef GREVENTS_H_ +#define GREVENTS_H_ + + +#define gr_event_none 0 +#define gr_event_wait 1 +#define gr_event_poll 2 +#define gr_event_flush 3 + +#define gr_mouse_down 0x04 +#define gr_mouse_move 0x08 +#define gr_mouse_up 0x10 +#define gr_mouse_drag 0x20 + +#define gr_key_down 0x40 +#define gr_key_up 0x80 + + +#define gr_event_mouse 0x3C +#define gr_event_key 0xC0 + +#define gr_event_type ( gr_event_mouse | gr_event_key ) + + + typedef enum grKey_ + { + grKeyNone = 0, + + grKeySpace = ' ', + grKey0 = '0', + grKey1 = '1', + grKey2 = '2', + grKey3 = '3', + grKey4 = '4', + grKey5 = '5', + grKey6 = '6', + grKey7 = '7', + grKey8 = '8', + grKey9 = '9', + + grKeyPlus = '+', + grKeyLess = '-', + grKeyEqual = '=', + grKeyMult = '*', + grKeyDollar = '$', + grKeySmaller = '<', + grKeyGreater = '>', + grKeyQuestion = '?', + grKeyComma = ',', + grKeyDot = '.', + grKeySemiColon = ';', + grKeyColon = ':', + grKeyDiv = '/', + grKeyExclam = '!', + grKeyPercent = '%', + grKeyLeftParen = '(', + grKeyRightParen = ')', + grKeyAt = '@', + + grKey_A = 'A', + grKey_B = 'B', + grKey_C = 'C', + grKey_D = 'D', + grKey_E = 'E', + grKey_F = 'F', + grKey_G = 'G', + grKey_H = 'H', + grKey_I = 'I', + grKey_J = 'J', + grKey_K = 'K', + grKey_L = 'L', + grKey_M = 'M', + grKey_N = 'N', + grKey_O = 'O', + grKey_P = 'P', + grKey_Q = 'Q', + grKey_R = 'R', + grKey_S = 'S', + grKey_T = 'T', + grKey_U = 'U', + grKey_V = 'V', + grKey_W = 'W', + grKey_X = 'X', + grKey_Y = 'Y', + grKey_Z = 'Z', + + grKeyLeftB = '[', + grKeyBackSlash = '\\', + grKeyRightB = ']', + grKeyCircumflex = '^', + grKeyUnder = '_', + grKeyBackTick = '`', + + grKey_a = 'a', + grKey_b = 'b', + grKey_c = 'c', + grKey_d = 'd', + grKey_e = 'e', + grKey_f = 'f', + grKey_g = 'g', + grKey_h = 'h', + grKey_i = 'i', + grKey_j = 'j', + grKey_k = 'k', + grKey_l = 'l', + grKey_m = 'm', + grKey_n = 'n', + grKey_o = 'o', + grKey_p = 'p', + grKey_q = 'q', + grKey_r = 'r', + grKey_s = 's', + grKey_t = 't', + grKey_u = 'u', + grKey_v = 'v', + grKey_w = 'w', + grKey_x = 'x', + grKey_y = 'y', + grKey_z = 'z', + + grKeyBackSpace = 0x100, + grKeyTab, + grKeyReturn, + grKeyEsc, + + grKeyIns, + grKeyDel, + grKeyHome, + grKeyEnd, + grKeyPageUp, + grKeyPageDown, + + grKeyF1, + grKeyF2, + grKeyF3, + grKeyF4, + grKeyF5, + grKeyF6, + grKeyF7, + grKeyF8, + grKeyF9, + grKeyF10, + grKeyF11, + grKeyF12, + + grKeyLeft, + grKeyRight, + grKeyUp, + grKeyDown, + + grKeyForceShort = 0x7FFF, /* this forces the grKey to be stored */ + /* on at least one short */ + grKeyMax + + } grKey; + + +#define grKEY( c ) ( (grKey)( c ) ) + /* masks - to be used as enums they would have to be included */ + /* in the grKey enum */ +#define grKeyAlt ( (grKey)0x8000 ) +#define grKeyCtrl ( (grKey)0x4000 ) +#define grKeyShift ( (grKey)0x2000 ) + +#define grKeyModifiers ( (grKey)0xE000 ) + + + typedef struct grEvent_ + { + int type; + grKey key; + int x, y; + + } grEvent; + + +#endif /* GREVENTS_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grfill.c freetype-2.8/=unpacked-tar2=/graph/grfill.c --- freetype-2.7.1/=unpacked-tar2=/graph/grfill.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grfill.c 2015-10-09 07:14:19.000000000 +0000 @@ -0,0 +1,266 @@ +#include "graph.h" +#include +#include + +static void +gr_fill_hline_mono( unsigned char* line, + int x, + int width, + grColor color ) +{ + int c1 = (x >> 3); + int lmask = 0xFF >> (x & 7); + int c2 = ((x+width-1) >> 3); + int rmask = 0x7F8 >> ((x+width-1) & 7); + + if ( color.value != 0 ) + { + if ( c1 == c2 ) + line[c1] = (unsigned char)( line[c1] | (lmask & rmask)); + else + { + line[c1] = (unsigned char)(line[c1] | lmask); + for ( ++c1; c1 < c2; c1++ ) + line[c1] = 0xFF; + line[c2] = (unsigned char)(line[c2] | rmask); + } + } + else + { + if ( c1 == c2 ) + line[c1] = (unsigned char)( line[c1] & ~(lmask & rmask) ); + else + { + line[c1] = (unsigned char)(line[c1] & ~lmask); + for (++c1; c1 < c2; c1++) + line[c1] = 0; + line[c2] = (unsigned char)(line[c2] & ~rmask); + } + } +} + +static void +gr_fill_hline_4( unsigned char* line, + int x, + int width, + grColor color ) +{ + int col = color.value | (color.value << 4); + + line += (x >> 1); + if ( x & 1 ) + { + line[0] = (unsigned char)((line[0] & 0xF0) | (col & 0x0F)); + line++; + width--; + } + + for ( ; width >= 2; width -= 2 ) + { + line[0] = (unsigned char)col; + line++; + } + + if ( width > 0 ) + line[0] = (unsigned char)((line[0] & 0x0F) | (col & 0xF0)); +} + +static void +gr_fill_hline_8( unsigned char* line, + int x, + int width, + grColor color ) +{ + memset( line+x, color.value, (unsigned int)width ); +} + +static void +gr_fill_hline_16( unsigned char* _line, + int x, + int width, + grColor color ) +{ + unsigned short* line = (unsigned short*)_line + x; + + for ( ; width > 0; width-- ) + *line++ = (unsigned short)color.value; +} + +static void +gr_fill_hline_24( unsigned char* line, + int x, + int width, + grColor color ) +{ + int r = color.chroma[0]; + int g = color.chroma[1]; + int b = color.chroma[2]; + + line += 3*x; + + if (r == g && g == b) + memset( line, r, (unsigned int)(width*3) ); + else + { + for ( ; width > 0; width--, line += 3 ) + { + line[0] = (unsigned char)r; + line[1] = (unsigned char)g; + line[2] = (unsigned char)b; + } + } +} + +static void +gr_fill_hline_32( unsigned char* line, + int x, + int width, + grColor color ) +{ + line += 4*x; + + /* clearly slow */ + for (; width > 0; width--, line += 4) + { + line[0] = color.chroma[0]; + line[1] = color.chroma[1]; + line[2] = color.chroma[2]; + line[3] = color.chroma[3]; + } +} + + +typedef void (*grFillHLineFunc)( unsigned char* line, + int x, + int width, + grColor color ); + +static const grFillHLineFunc gr_fill_hline_funcs[gr_pixel_mode_max] = +{ + NULL, + gr_fill_hline_mono, + gr_fill_hline_4, + gr_fill_hline_8, + gr_fill_hline_8, + gr_fill_hline_16, + gr_fill_hline_16, + gr_fill_hline_24, + gr_fill_hline_32, + NULL, + NULL, + NULL, + NULL +}; + +extern void +grFillHLine( grBitmap* target, + int x, + int y, + int width, + grColor color ) +{ + int delta; + unsigned char* line; + grFillHLineFunc hline_func = gr_fill_hline_funcs[target->mode]; + + if ( x < 0 ) + { + width += x; + x = 0; + } + delta = x + width - target->width; + if ( delta > 0 ) + width -= x; + + if ( y < 0 || y >= target->rows || width < 0 || hline_func == NULL ) + return; + + line = target->buffer + y*target->pitch; + if ( target->pitch < 0 ) + line -= target->pitch*(target->rows-1); + + hline_func( line, x, width, color ); +} + +extern void +grFillVLine( grBitmap* target, + int x, + int y, + int height, + grColor color ) +{ + int delta; + unsigned char* line; + grFillHLineFunc hline_func; + + if ( x < 0 || x >= target->width ) + return; + + if ( y < 0 ) + { + height += y; + y = 0; + } + delta = y + height - target->rows; + if ( delta > 0 ) + height -= delta; + + if ( height <= 0 ) + return; + + hline_func = gr_fill_hline_funcs[ target->mode ]; + if ( hline_func ) + { + line = target->buffer + y*target->pitch; + if ( target->pitch < 0 ) + line -= target->pitch*(target->rows-1); + + for ( ; height > 0; height--, line += target->pitch ) + hline_func( line, x, 1, color ); + } +} + +extern void +grFillRect( grBitmap* target, + int x, + int y, + int width, + int height, + grColor color ) +{ + int delta; + unsigned char* line; + grFillHLineFunc hline_func; + + if ( x < 0 ) + { + width -= x; + x = 0; + } + delta = x + width - target->width; + if ( delta > 0 ) + width -= delta; + + if ( y < 0 ) + { + height += y; + y = 0; + } + delta = y + height - target->rows; + if ( delta > 0 ) + height -= delta; + + if ( width <= 0 || height <= 0 ) + return; + + hline_func = gr_fill_hline_funcs[ target->mode ]; + if ( hline_func ) + { + line = target->buffer + y*target->pitch; + if ( target->pitch < 0 ) + line -= target->pitch*(target->rows-1); + + for ( ; height > 0; height--, line += target->pitch ) + hline_func( line, x, width, color ); + } +} diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grfont.c freetype-2.8/=unpacked-tar2=/graph/grfont.c --- freetype-2.7.1/=unpacked-tar2=/graph/grfont.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grfont.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,398 @@ +/* grfont.c */ + +#include "grfont.h" +#include + + + /* internal CP437 8x8 font characters */ + + const unsigned char font_8x8[2048] = + { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E, + 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, + 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, + 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, + 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x92, 0x10, 0x7C, + 0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C, + 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, + 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, + 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, + 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, + 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, + 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0, + 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, + 0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99, + 0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00, + 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, + 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, + 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, + 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, + 0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0x86, 0xFC, + 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, + 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, + 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, + 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, + 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, + 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, + 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00, + 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, + 0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00, + 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, + 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, + 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00, + 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00, + 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, + 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, + 0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00, + 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00, + 0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00, + 0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00, + 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, + 0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00, + 0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00, + 0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, + 0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00, + 0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, + 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00, + 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00, + 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, + 0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, + 0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00, + 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00, + 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, + 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, + 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, + 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, + 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, + 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00, + 0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00, + 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, + 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, + 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, + 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, + 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, + 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, + 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, + 0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00, + 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00, + 0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00, + 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, + 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00, + 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, + 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00, + 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, + 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00, + 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, + 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00, + 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, + 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, + 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, + 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, + 0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00, + 0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00, + 0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00, + 0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, + 0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00, + 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, + 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, + 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, + 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, + 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00, + 0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, + 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00, + 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0, + 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, + 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00, + 0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00, + 0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00, + 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, + 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, + 0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00, + 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, + 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, + 0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00, + 0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00, + 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, + 0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00, + 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00, + 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x0C, 0x06, 0x7C, + 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, + 0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, + 0x7E, 0x81, 0x3C, 0x06, 0x3E, 0x66, 0x3B, 0x00, + 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, + 0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, + 0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, + 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x78, 0x0C, 0x38, + 0x7E, 0x81, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, + 0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, + 0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00, + 0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x7C, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, + 0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0xC6, 0x10, 0x7C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, + 0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00, + 0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00, + 0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00, + 0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00, + 0x78, 0x84, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, + 0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, + 0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, + 0x78, 0x84, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, + 0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, + 0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, + 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00, + 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00, + 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18, + 0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00, + 0xCC, 0xCC, 0x78, 0x30, 0xFC, 0x30, 0xFC, 0x30, + 0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC3, + 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70, + 0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, + 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, + 0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00, + 0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00, + 0x00, 0xF8, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0x00, + 0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00, + 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, + 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, + 0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0xFC, 0xC0, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00, + 0xC6, 0xCC, 0xD8, 0x36, 0x6B, 0xC2, 0x84, 0x0F, + 0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6D, 0xCF, 0x03, + 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00, + 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, + 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, + 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, + 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, + 0xDB, 0xF6, 0xDB, 0x6F, 0xDB, 0x7E, 0xD7, 0xED, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, + 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, + 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, + 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, + 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, + 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, + 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, + 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, + 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00, + 0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0, + 0x00, 0xFC, 0xCC, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, + 0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, + 0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00, + 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00, + 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0, + 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00, + 0xFC, 0x30, 0x78, 0xCC, 0xCC, 0x78, 0x30, 0xFC, + 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00, + 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00, + 0x1C, 0x30, 0x18, 0x7C, 0xCC, 0xCC, 0x78, 0x00, + 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00, + 0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0, + 0x38, 0x60, 0xC0, 0xF8, 0xC0, 0x60, 0x38, 0x00, + 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, + 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, + 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00, + 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00, + 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00, + 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70, + 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00, + 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C, + 0x58, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, + 0x70, 0x98, 0x30, 0x60, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + + static grBitmap gr_charcell = { + 8, /* rows */ + 8, /* width */ + 1, /* pitch */ + gr_pixel_mode_mono, /* mode */ + 0, /* grays */ + 0 /* buffer */ + }; + + + void + grWriteCellChar( grBitmap* target, + int x, + int y, + int charcode, + grColor color ) + { + if ( charcode < 0 || + charcode > 255 ) + return; + + gr_charcell.buffer = (unsigned char*)font_8x8 + 8 * charcode; + grBlitGlyphToBitmap( target, &gr_charcell, x, y, color ); + } + + + void + grWriteCellString( grBitmap* target, + int x, + int y, + const char* string, + grColor color ) + { + while ( *string ) + { + gr_charcell.buffer = (unsigned char *)font_8x8 + + 8 * (int)(unsigned char) * string++; + grBlitGlyphToBitmap( target, &gr_charcell, x, y, color ); + x += 8; + } + } + + + static int gr_cursor_x = 0; + static int gr_cursor_y = 0; + static int gr_line_height = 8; + static grBitmap* gr_text_bitmap = 0; + static int gr_margin_right = 0; + static int gr_margin_top = 0; + + + void + grGotobitmap( grBitmap* bitmap ) + { + gr_text_bitmap = bitmap; + } + + + void + grSetMargin( int right, + int top ) + { + gr_margin_top = top << 3; + gr_margin_right = right << 3; + } + + + void + grSetPixelMargin( int right, + int top ) + { + gr_margin_top = top; + gr_margin_right = right; + } + + + void + grSetLineHeight( int height ) + { + gr_line_height = height; + } + + + void + grGotoxy( int x, + int y ) + { + gr_cursor_x = x; + gr_cursor_y = y; + } + + + void + grWrite( const char* string ) + { + if ( string ) + { + grColor color; + + + color.value = 127; + grWriteCellString( gr_text_bitmap, + gr_margin_right + ( gr_cursor_x << 3 ), + gr_margin_top + gr_cursor_y * gr_line_height, + string, + color ); + + gr_cursor_x += strlen( string ); + } + } + + + void + grLn( void ) + { + gr_cursor_y++; + gr_cursor_x = 0; + } + + + void + grWriteln( const char* string ) + { + grWrite( string ); + grLn(); + } + + +/* eof */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grfont.h freetype-2.8/=unpacked-tar2=/graph/grfont.h --- freetype-2.7.1/=unpacked-tar2=/graph/grfont.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grfont.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,42 @@ +/* grfont.h */ + +#ifndef GRFONT_H_ +#define GRFONT_H_ + +#include "graph.h" + + extern const unsigned char font_8x8[]; + + + void + grGotobitmap( grBitmap* bitmap ); + + void + grSetMargin( int right, + int top ); + + void + grSetPixelMargin( int right, + int top ); + + void + grSetLineHeight( int height ); + + void + grGotoxy ( int x, + int y ); + + + void + grWrite( const char* string ); + + void + grWriteln( const char* string ); + + void + grLn( void ); + +#endif /* GRFONT_H_ */ + + +/* eof */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grinit.c freetype-2.8/=unpacked-tar2=/graph/grinit.c --- freetype-2.7.1/=unpacked-tar2=/graph/grinit.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grinit.c 2015-09-25 05:40:31.000000000 +0000 @@ -0,0 +1,117 @@ +#include "grobjs.h" +#include "grdevice.h" +#include + +#define GR_INIT_DEVICE_CHAIN ((grDeviceChain*)0) +#define GR_INIT_BUILD + +#ifdef DEVICE_X11 +#ifndef VMS +#include "x11/grx11.h" +#else +#include "grx11.h" +#endif +#endif + +#ifdef DEVICE_OS2_PM +#include "os2/gros2pm.h" +#endif + +#ifdef DEVICE_WIN32 +#include "win32/grwin32.h" +#endif + +#ifdef macintosh +#include "mac/grmac.h" +#endif + +#ifdef DEVICE_ALLEGRO +#include "allegro/gralleg.h" +#endif + +#ifdef DEVICE_BEOS +#include "beos/grbeos.h" +#endif + + + /********************************************************************** + * + * + * grInitDevices + * + * + * This function is in charge of initialising all system-specific + * devices. A device is responsible for creating and managing one + * or more "surfaces". A surface is either a window or a screen, + * depending on the system. + * + * + * a pointer to the first element of a device chain. The chain can + * be parsed to find the available devices on the current system + * + * + * If a device cannot be initialised correctly, it is not part of + * the device chain returned by this function. For example, if an + * X11 device was compiled in the library, it will be part of + * the returned device chain only if a connection to the display + * could be established + * + * If no driver could be initialised, this function returns NULL. + * + **********************************************************************/ + + extern + grDeviceChain* grInitDevices( void ) + { + grDeviceChain* chain = GR_INIT_DEVICE_CHAIN; + grDeviceChain* cur = gr_device_chain; + + + while (chain) + { + /* initialize the device */ + grDevice* device; + + device = chain->device; + if ( device->init() == 0 && + gr_num_devices < GR_MAX_DEVICES ) + + { + /* successful device initialisation - add it to our chain */ + cur->next = 0; + cur->device = device; + cur->name = device->device_name; + + if (cur > gr_device_chain) + cur[-1].next = cur; + + cur++; + gr_num_devices++; + } + chain = chain->next; + } + + return (gr_num_devices > 0 ? gr_device_chain : 0 ); + } + + + extern + void grDoneDevices( void ) + { + int i; + grDeviceChain* chain = gr_device_chain; + + + for ( i = 0; i < gr_num_devices; i++ ) + { + chain->device->done(); + + chain->next = 0; + chain->device = 0; + chain->name = 0; + + chain++; + } + + gr_num_devices = 0; + } diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grobjs.c freetype-2.8/=unpacked-tar2=/graph/grobjs.c --- freetype-2.7.1/=unpacked-tar2=/graph/grobjs.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grobjs.c 2015-10-09 07:14:19.000000000 +0000 @@ -0,0 +1,230 @@ +#include "grobjs.h" +#include +#include + + int grError = 0; + + + /* values must be in 0..255 range */ + grColor + grFindColor( grBitmap* target, + int red, + int green, + int blue, + int alpha ) + { + grColor color; + + color.value = 0; + + switch (target->mode) + { + case gr_pixel_mode_mono: + if ( (red|green|blue) ) + color.value = 1; + break; + + case gr_pixel_mode_gray: + color.value = (3*red + 6*green + blue)/10; + break; + + case gr_pixel_mode_rgb565: + color.value = ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | ((blue & 0xF8) >> 3); + break; + + case gr_pixel_mode_rgb24: + color.chroma[0] = (unsigned char)red; + color.chroma[1] = (unsigned char)green; + color.chroma[2] = (unsigned char)blue; + break; + + case gr_pixel_mode_rgb32: + color.chroma[0] = (unsigned char)red; + color.chroma[1] = (unsigned char)green; + color.chroma[2] = (unsigned char)blue; + color.chroma[3] = (unsigned char)alpha; + break; + + default: + ; + } + return color; + } + + + /******************************************************************** + * + * + * grAlloc + * + * + * Simple memory allocation. The returned block is always zero-ed + * + * + * size :: size in bytes of the requested block + * + * + * the memory block address. 0 in case of error + * + ********************************************************************/ + + unsigned char* + grAlloc( unsigned long size ) + { + unsigned char* p; + + p = (unsigned char*)malloc(size); + if (!p && size > 0) + { + grError = gr_err_memory; + } + + if (p) + memset( p, 0, size ); + + return p; + } + + + /******************************************************************** + * + * + * grFree + * + * + * Simple memory release + * + * + * block :: target block + * + ********************************************************************/ + + void grFree( const void* block ) + { + if (block) + free( (void *)block ); + } + + + + static + int check_mode( grPixelMode pixel_mode, + int num_grays ) + { + if ( pixel_mode <= gr_pixel_mode_none || + pixel_mode >= gr_pixel_mode_max ) + goto Fail; + + if ( pixel_mode != gr_pixel_mode_gray || + ( num_grays >= 2 && num_grays <= 256 ) ) + return 0; + + Fail: + grError = gr_err_bad_argument; + return grError; + } + + + /********************************************************************** + * + * + * grNewBitmap + * + * + * creates a new bitmap + * + * + * pixel_mode :: the target surface's pixel_mode + * num_grays :: number of grays levels for PAL8 pixel mode + * width :: width in pixels + * height :: height in pixels + * + * + * bit :: descriptor of the new bitmap + * + * + * Error code. 0 means success. + * + **********************************************************************/ + + extern int grNewBitmap( grPixelMode pixel_mode, + int num_grays, + int width, + int height, + grBitmap *bit ) + { + int pitch; + + /* check mode */ + if (check_mode(pixel_mode,num_grays)) + goto Fail; + + /* check dimensions */ + if (width < 0 || height < 0) + { + grError = gr_err_bad_argument; + goto Fail; + } + + bit->width = width; + bit->rows = height; + bit->mode = pixel_mode; + bit->grays = num_grays; + + pitch = width; + + switch (pixel_mode) + { + case gr_pixel_mode_mono : pitch = (width+7) >> 3; break; + case gr_pixel_mode_pal4 : pitch = (width+3) >> 2; break; + + case gr_pixel_mode_pal8 : + case gr_pixel_mode_gray : pitch = width; break; + + case gr_pixel_mode_rgb555: + case gr_pixel_mode_rgb565: pitch = width*2; break; + + case gr_pixel_mode_rgb24 : pitch = width*3; break; + + case gr_pixel_mode_rgb32 : pitch = width*4; break; + + default: + grError = gr_err_bad_target_depth; + return 0; + } + + bit->pitch = pitch; + bit->buffer = grAlloc( (unsigned long)( bit->pitch * bit->rows ) ); + if (!bit->buffer) goto Fail; + + return 0; + + Fail: + return grError; + } + + /********************************************************************** + * + * + * grDoneBitmap + * + * + * destroys a bitmap + * + * + * bitmap :: handle to bitmap descriptor + * + * + * This function does NOT release the bitmap descriptor, only + * the pixel buffer. + * + **********************************************************************/ + + extern void grDoneBitmap( grBitmap* bit ) + { + grFree( bit->buffer ); + bit->buffer = 0; + } + + + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grobjs.h freetype-2.8/=unpacked-tar2=/graph/grobjs.h --- freetype-2.7.1/=unpacked-tar2=/graph/grobjs.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grobjs.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,163 @@ +/*************************************************************************** + * + * grobjs.h + * + * basic object classes definitions + * + * Copyright 1999 - The FreeType Development Team - www.freetype.org + * + * + * + * + ***************************************************************************/ + +#ifndef GROBJS_H_ +#define GROBJS_H_ + +#include "graph.h" +#include "grconfig.h" +#include "grtypes.h" + + + typedef struct grBiColor_ + { + grColor foreground; + grColor background; + + int num_levels; + int max_levels; + grColor* levels; + + } grBiColor; + + + + /********************************************************************** + * + * Technical note : explaining how the blitter works. + * + * The blitter is used to "draw" a given source bitmap into + * a given target bitmap. + * + * The function called 'compute_clips' is used to compute clipping + * constraints. These lead us to compute two areas : + * + * - the read area : is the rectangle, within the source bitmap, + * which will be effectively "drawn" in the + * target bitmap. + * + * - the write area : is the rectangle, within the target bitmap, + * which will effectively "receive" the pixels + * from the read area + * + * Note that both areas have the same dimensions, but are + * located in distinct surfaces. + * + * These areas are computed by 'compute_clips' which is called + * by each blitting function. + * + * Note that we use the Y-downwards convention within the blitter + * + **********************************************************************/ + + typedef struct grBlitter_ + { + int width; /* width in pixels of the areas */ + int height; /* height in pixels of the areas */ + + int xread; /* x position of start point in read area */ + int yread; /* y position of start point in read area */ + + int xwrite; /* x position of start point in write area */ + int ywrite; /* y position of start point in write area */ + + int right_clip; /* amount of right clip */ + + unsigned char* read; /* top left corner of read area in source map */ + unsigned char* write; /* top left corner of write area in target map */ + + int read_line; /* byte increment to go down one row in read area */ + int write_line; /* byte increment to go down one row in write area */ + + grBitmap source; /* source bitmap descriptor */ + grBitmap target; /* target bitmap descriptor */ + + } grBlitter; + + + + typedef void (*grBlitterFunc)( grBlitter* blitter, + grColor color ); + + typedef void (*grSetTitleFunc)( grSurface* surface, + const char* title_string ); + + typedef void (*grRefreshRectFunc)( grSurface* surface, + int x, + int y, + int width, + int height ); + + typedef void (*grDoneSurfaceFunc)( grSurface* surface ); + + typedef int (*grListenEventFunc)( grSurface* surface, + int event_mode, + grEvent *event ); + + + + struct grSurface_ + { + grDevice* device; + grBitmap bitmap; + grBool refresh; + grBool owner; + + const byte* saturation; /* used for gray surfaces only */ + grBlitterFunc blit_mono; /* 0 by default, set by grBlit.. */ + + grRefreshRectFunc refresh_rect; + grSetTitleFunc set_title; + grListenEventFunc listen_event; + grDoneSurfaceFunc done; + }; + + + + /******************************************************************** + * + * + * grAlloc + * + * + * Simple memory allocation. The returned block is always zero-ed + * + * + * size :: size in bytes of the requested block + * + * + * the memory block address. 0 in case of error + * + ********************************************************************/ + + extern unsigned char* + grAlloc( unsigned long size ); + + + /******************************************************************** + * + * + * grFree + * + * + * Simple memory release + * + * + * block :: target block + * + ********************************************************************/ + + extern void grFree( const void* block ); + + +#endif /* GROBJS_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grswizzle.c freetype-2.8/=unpacked-tar2=/graph/grswizzle.c --- freetype-2.7.1/=unpacked-tar2=/graph/grswizzle.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grswizzle.c 2015-10-09 07:14:19.000000000 +0000 @@ -0,0 +1,673 @@ +#include + +/* Author: David Turner + * + * this filtering code is explicitly placed in the public domain !! + */ +#include +#include + +#include "grswizzle.h" + +/* technical note: + * + * the following code is used to simulate the color display of an + * OLPC screen on a traditional LCD or CRT screen. First, here's more or + * less how the laptop's hardware works: + * + * when in color mode, the screen uses the following colored pixels + * arrangement, where each pixel is square and can have its luminosity + * set between 0 and 255: + * + * R G B R G B .... + * G B R G B R + * B R G B R G + * R G B R G B + * G B R G B R + * B R G B R G + * : + * : + * + * in its normal mode of operation, the laptop's graphics chip gets its + * data from a normal frame buffer (where each pixel has three + * components: R, G and B) but only selects the red signal for the first + * pixel, the green signal for the second pixel, etc... + * + * in other words, it ignores 2/3rd of the frame buffer data ! + * + * there is also another interesting mode of operation, so-called + * "anti-aliasing mode" where the value of displayed pixel is obtained + * by performing a simple 3x3 linear filter on the frame-buffer data. + * the filter's matrix being: + * + * 0 1/8 0 + * + * 1/8 1/2 1/8 + * + * 0 1/8 0 + * + * note that this filtering is per-color, so the *displayed* intensity of + * a given red pixel corresponds to an average of the pixel's red value and + * its four neighboring pixels' red values. + * + * note that the code below uses a 3-lines work buffer, where each line + * in the buffer holds a copy of the source frame buffer. + * + * more exactly, each line has 'width+2' pixels, where the first and last + * pixels are always set to 0. this allows us to ignore edge cases in the + * filtering code. + * + * similarly, we artificially extend the source buffer with zero-ed lines + * above and below. + */ + + +/* define ANTIALIAS to perform anti-alias filtering before swizzling */ +#define ANTIALIAS + +/* define POSTPROCESS to enhance the output for traditional displays, + * otherwise, you'll get those ugly diagonals everywhere + */ +#define POSTPROCESS + +/************************************************************************/ +/************************************************************************/ +/***** *****/ +/***** G E N E R I C F I L T E R I N G *****/ +/***** *****/ +/************************************************************************/ +/************************************************************************/ + +/* the type of a line filtering function, see below for usage */ +typedef void +(*filter_func_t)( unsigned char** lines, + unsigned char* write, + int width, + int offset ); + +static void +copy_line_generic( unsigned char* from, + unsigned char* to, + int x, + int width, + int buff_width, + int pix_bytes ) +{ + if (x > 0) + { + width += 1; + from -= pix_bytes; + } + else + to += pix_bytes; + + if (x+width < buff_width) + width += 1; + + memcpy( to, from, (unsigned int)( width * pix_bytes ) ); +} + + + +/* a generic function to perform 3x3 filtering of a given rectangle, + * from a source bitmap into a destination one, the source *can* be + * equal to the destination. + * + * IMPORTANT: this will read the rectangle (x-1,y-1,width+2,height+2) + * from the source (clipping and edge cases are handled). + * + * read_buff :: first byte of source buffer + * read_pitch :: source buffer bytes per row + * write_buff :: first byte of target buffer + * write_pitch :: target buffer bytes per row + * buff_width :: width in pixels of both buffers + * buff_height :: height in pixels of both buffers + * x :: rectangle's left-most horizontal coordinate + * y :: rectangle's top-most vertical coordinate + * width :: rectangle width in pixels + * height :: rectangle height in pixels + * pix_bytes :: number of bytes per pixels in both buffer + * filter_func :: line filtering function + * temp_lines :: a work buffer of at least '3*(width+2)*pix_bytes' bytes + */ +static void +filter_rect_generic( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height, + int pix_bytes, + filter_func_t filter_func, + unsigned char* temp_lines ) +{ + unsigned char* lines[3]; + int offset = (x+y) % 3; + int delta, height2; + + /* clip rectangle, just to be sure */ + if (x < 0) + { + width += x; + x = 0; + } + delta = x+width - buff_width; + if (delta > 0) + width -= delta; + + if (y < 0) + { + height += y; + y = 0; + } + delta = y+height - buff_height; + if (delta > 0) + height -= delta; + + if (width <= 0 || height <= 0) /* nothing to do */ + return; + + /* now setup the three work lines */ + read_buff += y*read_pitch + pix_bytes*x; + write_buff += y*write_pitch + pix_bytes*x; + + memset( temp_lines, 0, (unsigned int)(3 * pix_bytes * ( width + 2 ) ) ); + + lines[0] = (unsigned char*) temp_lines; + lines[1] = lines[0] + pix_bytes*(width+2); + lines[2] = lines[1] + pix_bytes*(width+2); + + /* lines[0] correspond to the pixels of the line above + */ + if (y > 0) + copy_line_generic( read_buff - read_pitch, lines[0], + x, width, buff_width, pix_bytes ); + + /* lines[1] correspond to the pixels of the current line + */ + copy_line_generic( read_buff, lines[1], + x, width, buff_width, pix_bytes ); + + /* process all lines, except the last one */ + for ( height2 = height; height2 > 1; height2-- ) + { + unsigned char* tmp; + + /* lines[2] correspond to the pixels of the line below */ + copy_line_generic( read_buff + read_pitch, lines[2], + x, width, buff_width, pix_bytes ); + + filter_func( lines, write_buff, width, offset ); + + if (++offset == 3) + offset = 0; + + /* scroll the work lines */ + tmp = lines[0]; + lines[0] = lines[1]; + lines[1] = lines[2]; + lines[2] = tmp; + + read_buff += read_pitch; + write_buff += write_pitch; + } + + /* process last line */ + if (y+height == buff_height) + memset( lines[2], 0, (unsigned int)( ( width + 2 ) * pix_bytes ) ); + else + copy_line_generic( read_buff + read_pitch, lines[2], + x, width, buff_width, pix_bytes ); + + filter_func ( lines, write_buff, width, offset ); +} + + +/************************************************************************/ +/************************************************************************/ +/***** *****/ +/***** R G B 2 4 S U P P O R T *****/ +/***** *****/ +/************************************************************************/ +/************************************************************************/ + + +/* this function performs AA+swizzling of a given line from/to RGB24 buffers + */ +static void +swizzle_line_rgb24( unsigned char** lines, + unsigned char* write, + int width, + int offset ) +{ + unsigned char* above = lines[0] + 3; + unsigned char* current = lines[1] + 3; + unsigned char* below = lines[2] + 3; + int nn; + + width *= 3; + for ( nn = 0; nn < width; nn += 3 ) + { + unsigned int sum; + int off = nn + offset; + +#ifdef ANTIALIAS + sum = (unsigned int)current[off] << 2; + + sum += current[off-3] + + current[off+3] + + above [off] + + below [off] ; + + /* performance trick: use shifts to avoid jumps */ + sum = (sum >> 3) << (offset*8); +#else /* !ANTIALIAS */ + sum = current[off] << (offset*8); +#endif + + write[nn] = (unsigned char) sum; + write[nn+1] = (unsigned char)(sum >> 8); + write[nn+2] = (unsigned char)(sum >> 16); + + if ( ++offset == 3 ) + offset = 0; + } +} + + +/* the following function is used to post-process the result of the + * swizzling algorithm to provide a more pleasant output on normal + * (LCD and CRT) display screens. + * + * that's because the normal processing creates images that are not + * relevant to the display's true nature. For example, consider a 3x3 + * white square on the original frame buffer, after simple swizzling, this + * will generate the following picture (represented by RGB triplets): + * + * (255,0,0)(0,255,0)(0,0,255) + * (0,255,0)(0,0,255)(255,0,0) + * (0,0,255)(255,0,0)(0,255,0) + * + * the laptop's DCON chip ignores all the 0s above, and will essentially + * display a *bright* white square + * + * a traditional display will not, and this will result in an image that + * will be much darker (due to all the zeroes). + * + * moreover, on an typical LCD screen, this creates very visible + * black diagonals. On a CRT, some thinner diagonals are also visible, but + * this is mostly due to the fact that the human eye is much more sensitive + * to green than red and blue + */ + + +/* in this algorithm we steal the green and blue components from each pixel's + * neighbours. For example, for a red pixel, we compute the average of the + * green pixels on its right and below it, and the average of the blue pixels + * on its left and above it. + */ +static void +postprocess_line_rgb24( unsigned char** lines, + unsigned char* write, + int width, + int offset ) +{ + unsigned char* above = lines[0] + 3; + unsigned char* current = lines[1] + 3; + unsigned char* below = lines[2] + 3; + int nn; + + width *= 3; + for ( nn = 0; nn < width; nn += 3 ) + { + if (offset == 0) /* red */ + { + write[nn] = current[nn]; + write[nn+1] = (unsigned char)((current[nn+4] + below[nn+1]) >> 1); + write[nn+2] = (unsigned char)((current[nn-1] + above[nn+2]) >> 1); + offset = 1; + } + else if (offset == 1) /* green */ + { + write[nn] = (unsigned char)((current[nn-3] + above[nn]) >> 1); + write[nn+1] = current[nn+1]; + write[nn+2] = (unsigned char)((current[nn+5] + below[nn+2]) >> 1); + offset = 2; + } + else /* blue */ + { + write[nn] = (unsigned char)((current[nn+3] + below[nn]) >> 1); + write[nn+1] = (unsigned char)((current[nn-2] + above[nn+1]) >> 1); + write[nn+2] = current[nn+2]; + offset = 0; + } + } +} + + +/************************************************************************/ +/************************************************************************/ +/***** *****/ +/***** R G B 5 6 5 S U P P O R T *****/ +/***** *****/ +/************************************************************************/ +/************************************************************************/ + + + + +/* this function performs AA+swizzling of a given line from/to RGB565 buffers + */ +static void +swizzle_line_rgb565( unsigned char** lines, + unsigned char* _write, + int width, + int offset ) +{ + unsigned short* above = (unsigned short*) lines[0] + 1; + unsigned short* current = (unsigned short*) lines[1] + 1; + unsigned short* below = (unsigned short*) lines[2] + 1; + unsigned short* write = (unsigned short*) _write; + int nn; + + static const unsigned int masks[3] = { 0xf800, 0x07e0, 0x001f }; + + for (nn = 0; nn < width; nn++) + { + unsigned int mask = masks[offset]; +#ifdef ANTIALIAS + unsigned int sum; + + sum = ((unsigned int)current[nn] & mask) << 2; + + sum += ((unsigned int)current[nn-1] & mask) + + ((unsigned int)current[nn+1] & mask) + + ((unsigned int)above[nn] & mask) + + ((unsigned int)below[nn] & mask); + + write[nn] = (unsigned short)( (sum >> 3) & mask ); +#else + write[nn] = (unsigned short)( current[nn] & mask ); +#endif + + if (++offset == 3) + offset = 0; + } +} + + +static void +postprocess_line_rgb565( unsigned char** lines, + unsigned char* _write, + int width, + int offset ) +{ + unsigned short* above = (unsigned short*) lines[0] + 1; + unsigned short* current = (unsigned short*) lines[1] + 1; + unsigned short* below = (unsigned short*) lines[2] + 1; + unsigned short* write = (unsigned short*) _write; + int nn; + + static const unsigned int masks[5] = { 0xf800, 0x07e0, 0x001f, 0xf800, 0x07e0 }; + + unsigned int l_mask, r_mask, c_mask; + + l_mask = masks[offset]; + c_mask = masks[offset+1]; + r_mask = masks[offset+2]; + + for ( nn = 0; nn < width; nn += 1 ) + { + unsigned int left, right, center, tmp; + + center = current[nn]; + left = ((current[nn-1] & l_mask) + (above[nn] & l_mask)) >> 1; + right = ((current[nn+1] & r_mask) + (below[nn] & r_mask)) >> 1; + + write[nn] = (unsigned short)( (left & l_mask) | + (right & r_mask) | + (center & c_mask) ); + + tmp = l_mask; + l_mask = c_mask; + c_mask = r_mask; + r_mask = tmp; + } +} + + + +/************************************************************************/ +/************************************************************************/ +/***** *****/ +/***** X R G B 3 2 S U P P O R T *****/ +/***** *****/ +/************************************************************************/ +/************************************************************************/ + + +/* this function performs AA+swizzling of a given line from/to 32-bit ARGB or RGB + * buffers + */ +static void +swizzle_line_xrgb32( unsigned char** lines, + unsigned char* _write, + int width, + int offset ) +{ + unsigned int* above = (unsigned int*) lines[0] + 1; + unsigned int* current = (unsigned int*) lines[1] + 1; + unsigned int* below = (unsigned int*) lines[2] + 1; + unsigned int* write = (unsigned int*) _write; + int nn; + unsigned int mask = (0xff0000) >> (offset*8); + + for (nn = 0; nn < width; nn++) + { +#ifdef ANTIALIAS + unsigned int sum; + + sum = (current[nn] & mask) << 2; + + sum += (current[nn-1] & mask) + + (current[nn+1] & mask) + + (above[nn] & mask) + + (below[nn] & mask); + + write[nn] = (sum >> 3) & mask; /* should we set ALPHA to 0xFF ? */ +#else + write[nn] = current[nn] & mask; +#endif + + mask >>= 8; + if (mask == 0) + mask = 0x00ff0000; + } +} + + +static void +postprocess_line_xrgb32( unsigned char** lines, + unsigned char* _write, + int width, + int offset ) +{ + unsigned int* above = (unsigned int*) lines[0] + 1; + unsigned int* current = (unsigned int*) lines[1] + 1; + unsigned int* below = (unsigned int*) lines[2] + 1; + unsigned int* write = (unsigned int*) _write; + int nn; + + static const unsigned int masks[5] = + { 0xff0000, 0x00ff00, 0x0000ff, 0xff0000, 0x00ff00 }; + + unsigned int l_mask, r_mask, c_mask; + + l_mask = masks[offset]; + c_mask = masks[offset+1]; + r_mask = masks[offset+2]; + + for ( nn = 0; nn < width; nn += 1 ) + { + unsigned int left, right, center, tmp; + + center = current[nn]; + left = ((current[nn-1] & l_mask) + (above[nn] & l_mask)) >> 1; + right = ((current[nn+1] & r_mask) + (below[nn] & r_mask)) >> 1; + + write[nn] = (unsigned int)( (left & l_mask) | + (right & r_mask) | + (center & c_mask) ); + + tmp = l_mask; + l_mask = c_mask; + c_mask = r_mask; + r_mask = tmp; + } +} + + + +static void +gr_swizzle_generic( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height, + int pixbytes, + filter_func_t swizzle_func, + filter_func_t postprocess_func ) +{ + unsigned char* temp_lines; + unsigned char temp_local[ 2048 ]; + unsigned int temp_size; + + if ( height <= 0 || width <= 0 ) + return; + + if ( read_pitch < 0 ) + read_buff -= (buff_height-1)*read_pitch; + + if ( write_pitch < 0 ) + write_buff -= (buff_height-1)*write_pitch; + + /* we allocate a work buffer that will be used to hold three + * working 'lines', each of them having width+2 pixels. the first + * and last pixels being always 0 + */ + temp_size = (unsigned int)( ( width + 2 ) * 3 * pixbytes ); + if ( temp_size <= sizeof ( temp_local ) ) + { + /* try to use stack allocation, which is a lot faster than malloc */ + temp_lines = temp_local; + } + else + { + temp_lines = (unsigned char*)malloc( temp_size ); + if ( temp_lines == NULL ) + return; + } + + filter_rect_generic( read_buff, read_pitch, write_buff, write_pitch, + buff_width, buff_height, x, y, width, height, + pixbytes, swizzle_func, temp_lines ); + + +#ifdef POSTPROCESS + /* perform darkness correction */ + if ( postprocess_func ) + filter_rect_generic( write_buff, write_pitch, write_buff, write_pitch, + buff_width, buff_height, x, y, width, height, + pixbytes, postprocess_func, + temp_lines ); +#endif + + /* free work buffer if needed */ + if (temp_lines != temp_local) + free( temp_lines ); +} + + + +extern void +gr_swizzle_rect_rgb24( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height ) +{ + gr_swizzle_generic( read_buff, read_pitch, + write_buff, write_pitch, + buff_width, + buff_height, + x, y, width, height, + 3, + swizzle_line_rgb24, + postprocess_line_rgb24 ); +} + + + +extern void +gr_swizzle_rect_rgb565( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height ) +{ + gr_swizzle_generic( read_buff, read_pitch, + write_buff, write_pitch, + buff_width, + buff_height, + x, y, width, height, + 2, + swizzle_line_rgb565, + postprocess_line_rgb565 ); +} + + + +extern void +gr_swizzle_rect_xrgb32( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height ) +{ + gr_swizzle_generic( read_buff, read_pitch, + write_buff, write_pitch, + buff_width, + buff_height, + x, y, width, height, + 4, + swizzle_line_xrgb32, + postprocess_line_xrgb32 ); +} + + + + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grswizzle.h freetype-2.8/=unpacked-tar2=/graph/grswizzle.h --- freetype-2.7.1/=unpacked-tar2=/graph/grswizzle.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grswizzle.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,40 @@ +#ifndef GRSWIZZLE_H_ +#define GRSWIZZLE_H_ + +void +gr_swizzle_rect_rgb24( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height ); + +void +gr_swizzle_rect_rgb565( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height ); + +void +gr_swizzle_rect_xrgb32( unsigned char* read_buff, + int read_pitch, + unsigned char* write_buff, + int write_pitch, + int buff_width, + int buff_height, + int x, + int y, + int width, + int height ); + +#endif /* GRSWIZZLE_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/grtypes.h freetype-2.8/=unpacked-tar2=/graph/grtypes.h --- freetype-2.7.1/=unpacked-tar2=/graph/grtypes.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/grtypes.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,52 @@ +/*************************************************************************** + * + * grtypes.h + * + * basic type definitions + * + * Copyright 1999 - The FreeType Development Team - www.freetype.org + * + * + * + * + ***************************************************************************/ + +#ifndef GRTYPES_H_ +#define GRTYPES_H_ + + typedef unsigned char byte; + +#if 0 + typedef signed char uchar; + + typedef unsigned long ulong; + typedef unsigned short ushort; + typedef unsigned int uint; +#endif + + typedef struct grDimension_ + { + int x; + int y; + + } grDimension; + +#define gr_err_ok 0 +#define gr_err_memory -1 +#define gr_err_bad_argument -2 +#define gr_err_bad_target_depth -3 +#define gr_err_bad_source_depth -4 +#define gr_err_saturation_overflow -5 +#define gr_err_conversion_overflow -6 +#define gr_err_invalid_device -7 + + +#ifdef GR_MAKE_OPTION_SINGLE_OBJECT +#define GR_LOCAL_DECL static +#define GR_LOCAL_FUNC static +#else +#define GR_LOCAL_DECL extern +#define GR_LOCAL_FUNC /* void */ +#endif + +#endif /* GRTYPES_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/Jamfile freetype-2.8/=unpacked-tar2=/graph/Jamfile --- freetype-2.7.1/=unpacked-tar2=/graph/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/Jamfile 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,58 @@ +# FreeType2 demo graph Jamfile (c) 2001 David Turner +# + +SubDir FT2DEMO_TOP graph ; + +GRAPH_INCLUDE = $(FT2DEMO_GRAPH) ; +GRAPH_LIB = $(LIBPREFIX)graph$(SUFLIB) ; + +graph_sources = grblit + grobjs + grfont + grdevice + grinit + gblender + gblblit + grfill + grswizzle + ; + +if $(OS) = BEOS +{ + DEVICE_DEFINE = -DDEVICE_BEOS ; +} +else if $(UNIX) +{ + DEVICE_DEFINE = -DDEVICE_X11 ; +} +else if $(NT) +{ + DEVICE_DEFINE = -DDEVICE_WIN32 ; +} +else if $(OS2) +{ + DEVICE_DEFINE = -DDEVICE_OS2 ; +} + +CCFLAGS on grinit$(SUFOBJ) = $(CCFLAGS) $(DEVICE_DEFINE) ; + +Library $(GRAPH_LIB) : $(graph_sources).c ; + +if $(OS) = BEOS +{ + SubInclude FT2DEMO_TOP graph beos ; +} +else if $(UNIX) +{ + SubInclude FT2DEMO_TOP graph x11 ; +} +else if $(NT) +{ + SubInclude FT2DEMO_TOP graph win32 ; +} +else if $(OS2) +{ + SubInclude FT2DEMO_TOP graph os2 ; +} + +# end of graph Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/mac/grmac.c freetype-2.8/=unpacked-tar2=/graph/mac/grmac.c --- freetype-2.7.1/=unpacked-tar2=/graph/mac/grmac.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/mac/grmac.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,395 @@ +/******************************************************************* + * + * grmac.c graphics driver for MacOS platform. + * + * This is the driver for displaying inside a window under MacOS, + * used by the graphics utility of the FreeType test suite. + * + * Largely written by Just van Rossum, but derived from grwin32.c. + * Copyright 1999-2000, 2004 by Just van Rossum, Antoine Leca, + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Borrowing liberally from the other FreeType drivers. + * + * 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. + * + ******************************************************************/ + +/* ANSI C */ +#include + +/* Mac Toolbox */ +#include + +/* FT graphics subsystem */ +#include "grobjs.h" +#include "grdevice.h" + +#ifdef __MWERKS__ +/* CodeWarrior's poor excuse for a console */ +#include +#endif + +/* Mac function key definitions. The 0x100 is a kludge, see listen_event(). */ +#define KEY_F1 (0x7A | 0x100) +#define KEY_F2 (0x78 | 0x100) +#define KEY_F3 (0x63 | 0x100) +#define KEY_F4 (0x76 | 0x100) +#define KEY_F5 (0x60 | 0x100) +#define KEY_F6 (0x61 | 0x100) +#define KEY_F7 (0x62 | 0x100) +#define KEY_F8 (0x64 | 0x100) +#define KEY_F9 (0x65 | 0x100) +#define KEY_F10 (0x6D | 0x100) +#define KEY_F11 (0x67 | 0x100) +#define KEY_F12 (0x6F | 0x100) +#define KEY_F13 (0x69 | 0x100) +#define KEY_F14 (0x6B | 0x100) +#define KEY_F15 (0x71 | 0x100) + + +/* Mac to FT key mapping */ + + typedef struct Translator_ + { + short mackey; + grKey grkey; + + } Translator; + + static + Translator key_translators[] = + { + { kBackspaceCharCode, grKeyBackSpace }, + { kTabCharCode, grKeyTab }, + { kReturnCharCode, grKeyReturn }, + { kEscapeCharCode, grKeyEsc }, + { kHomeCharCode, grKeyHome }, + { kLeftArrowCharCode, grKeyLeft }, + { kUpArrowCharCode, grKeyUp }, + { kRightArrowCharCode, grKeyRight }, + { kDownArrowCharCode, grKeyDown }, + { kPageUpCharCode, grKeyPageUp }, + { kPageDownCharCode, grKeyPageDown }, + { kEndCharCode, grKeyEnd }, + { kHelpCharCode, grKeyF1 }, /* map Help key to F1... */ + { KEY_F1, grKeyF1 }, + { KEY_F2, grKeyF2 }, + { KEY_F3, grKeyF3 }, + { KEY_F4, grKeyF4 }, + { KEY_F5, grKeyF5 }, + { KEY_F6, grKeyF6 }, + { KEY_F7, grKeyF7 }, + { KEY_F8, grKeyF8 }, + { KEY_F9, grKeyF9 }, + { KEY_F10, grKeyF10 }, + { KEY_F11, grKeyF11 }, + { KEY_F12, grKeyF12 } + }; + + + /* This is a minimalist driver, it is only able to display */ + /* a _single_ window. Moreover, only monochrome and gray */ + /* bitmaps are supported.. */ + + /* pointer to the window. */ + static WindowPtr theWindow = NULL; + + /* the pixmap */ + static PixMap thePixMap; + + + /* destroys the window */ + static + void done_window( ) + { + if ( theWindow ) + { + DisposeWindow ( theWindow ); + } + theWindow = NULL; + } + + /* destroys the surface*/ + static + void done_surface( grSurface* surface ) + { + /* ick! this never gets called... */ + done_window(); + grDoneBitmap( &surface->bitmap ); + } + + static + void refresh_rectangle( grSurface* surface, + int x, + int y, + int w, + int h ) + { + Rect bounds; + SetRect( &bounds, x, y, x+w, y+h ); + if ( theWindow ) { + GrafPtr windowPort = GetWindowPort(theWindow); + RgnHandle visRgn = GetPortVisibleRegion(windowPort, NewRgn()); + SetPort(windowPort); + CopyBits( (BitMap*)&thePixMap, GetPortBitMapForCopyBits(windowPort), + &bounds, &bounds, srcCopy, visRgn); + DisposeRgn(visRgn); + } + } + + static + void set_title( grSurface* surface, const char* title ) + { + Str255 pTitle; + strcpy( (char*)pTitle+1, title ); + pTitle[0] = strlen( title ); + if ( theWindow ) + SetWTitle( theWindow, pTitle ); + } + + static + void listen_event( grSurface* surface, + int event_mask, + grEvent* grevent ) + { + grEvent our_grevent; + EventRecord mac_event; + + our_grevent.type = gr_event_none; + our_grevent.key = grKeyNone; + + for ( ;; ) + /* The event loop. Sorry, but I'm too lazy to split the various events + to proper event handler functions. This whole app is rather ad hoc + anyway, so who cares ;-) */ + { + if ( WaitNextEvent( everyEvent, &mac_event, 10, NULL ) ) + { + switch ( mac_event.what ) + { + case autoKey: + case keyDown: + { + int count = sizeof( key_translators ) / sizeof( key_translators[0] ); + Translator* trans = key_translators; + Translator* limit = trans + count; + short char_code; + + char_code = mac_event.message & charCodeMask; + if ( char_code == kFunctionKeyCharCode ) + /* Le kluge. Add a flag to differentiate the F-keys from normal keys. */ + char_code = 0x100 | ((mac_event.message & keyCodeMask) >> 8); + + our_grevent.key = char_code; + + for ( ; trans < limit; trans++ ) + /* see if the key maps to a special "gr" key */ + if ( char_code == trans->mackey ) + { + our_grevent.key = trans->grkey; + } + our_grevent.type = gr_event_key; + } + if ( our_grevent.key == grKEY('q') || our_grevent.key == grKeyEsc ) + /* destroy the window here, since done_surface() doesn't get called */ + done_window(); + *grevent = our_grevent; + return; + case updateEvt: + if ( theWindow && (WindowPtr)mac_event.message == theWindow ) + { + SetPortWindowPort( theWindow ); + BeginUpdate( theWindow ); + refresh_rectangle( surface, + 0, 0, + thePixMap.bounds.right, thePixMap.bounds.bottom ); + EndUpdate( theWindow ); + } +#ifdef __MWERKS__ + else + { + SIOUXHandleOneEvent( &mac_event ); + } +#endif + break; + case mouseDown: + { + short part; + WindowPtr wid; + + part = FindWindow( mac_event.where, &wid ); + if ( wid == theWindow ) + { + if ( theWindow && part == inDrag) { +#if TARGET_API_MAC_CARBON +#define screenBounds NULL +#else + Rect *screenBounds = &qd.screenBits.bounds; +#endif + DragWindow( wid, mac_event.where, screenBounds); + } + else if (part == inGoAway) + { + if ( TrackGoAway( theWindow, mac_event.where ) ) + { + /* The user clicked the window away, emulate quit event */ + done_window(); + our_grevent.type = gr_event_key; + our_grevent.key = grKeyEsc; + *grevent = our_grevent; + return; + } + } + else if (part == inContent) + { + SelectWindow( theWindow ); + } + } +#ifdef __MWERKS__ + else + { + SIOUXHandleOneEvent( &mac_event ); + } +#endif + } + break; + default: + InitCursor(); + break; + } + } + } + } + + +static +grSurface* init_surface( grSurface* surface, + grBitmap* bitmap ) +{ + PixMapPtr pixMap = &thePixMap; + + Rect bounds; + SetRect(&bounds, 0, 0, bitmap->width, bitmap->rows); + + switch (bitmap->mode) + { + case gr_pixel_mode_rgb24: + bitmap->mode = gr_pixel_mode_rgb32; + break; + + default: + bitmap->mode = gr_pixel_mode_mono; + bitmap->grays = 0; + break; + } + + /* create the bitmap - under MacOS, we support all modes as the GDI */ + /* handles all conversions automatically.. */ + if ( grNewBitmap( bitmap->mode, + bitmap->grays, + bitmap->width, + bitmap->rows, + bitmap ) ) + return 0; + + surface->bitmap = *bitmap; + + /* initialize the PixMap to appropriate values */ + pixMap->baseAddr = (char*)bitmap->buffer; + pixMap->rowBytes = bitmap->pitch; + if (pixMap->rowBytes < 0) + pixMap->rowBytes = -pixMap->rowBytes; + pixMap->rowBytes |= 0x8000; /* flag indicating it's a PixMap, not a BitMap */ + pixMap->bounds = bounds; + pixMap->pmVersion = baseAddr32; /* pixmap base address is 32-bit address */ + pixMap->packType = 0; + pixMap->packSize = 0; + pixMap->hRes = 72 << 16; + pixMap->vRes = 72 << 16; + pixMap->pmTable = 0; +#if OLDPIXMAPSTRUCT + pixMap->planeBytes = 0; + pixMap->pmReserved = 0; +#else + pixMap->pixelFormat = 0; + pixMap->pmExt = 0; +#endif + + switch ( bitmap->mode ) + { + case gr_pixel_mode_mono: + case gr_pixel_mode_gray: + + pixMap->pixelType = 0; /* indexed color */ + pixMap->cmpCount = 1; + + if (bitmap->mode == gr_pixel_mode_mono) + { + pixMap->pixelSize = 1; + } + else + { + pixMap->pixelSize = 8; + pixMap->pmTable = GetCTable(256); /* color palette matching FT's idea */ + break; /* of grayscale. See ftview.rsrc */ + } + pixMap->cmpSize = pixMap->pixelSize; + break; + + case gr_pixel_mode_rgb32: + pixMap->pixelSize = 32; + pixMap->pixelType = RGBDirect; + pixMap->cmpCount = 3; + pixMap->cmpSize = 8; + pixMap->baseAddr -= 1; /*SHH: goofy hack to reinterpret bitmap's RGBx -> xRGB */ + break; + + default: + return 0; /* Unknown mode */ + } + + /* create the window */ + OffsetRect(&bounds, 10, 44); /* place it at a decent location */ + theWindow = NewCWindow(NULL, &bounds, "\p???", 1, 0, (WindowRef)-1, 1, 0); + + /* fill in surface interface */ + surface->done = (grDoneSurfaceFunc) done_surface; + surface->refresh_rect = (grRefreshRectFunc) refresh_rectangle; + surface->set_title = (grSetTitleFunc) set_title; + surface->listen_event = (grListenEventFunc) listen_event; + + return surface; +} + + + static int init_device( void ) + { + return 0; + } + + static void done_device( void ) + { + /* won't get called either :-( */ + } + + grDevice gr_mac_device = + { + sizeof( grSurface ), + "mac", + + init_device, + done_device, + + (grDeviceInitSurfaceFunc) init_surface, + + 0, + 0 + }; + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/mac/grmac.h freetype-2.8/=unpacked-tar2=/graph/mac/grmac.h --- freetype-2.7.1/=unpacked-tar2=/graph/mac/grmac.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/mac/grmac.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,23 @@ +#ifndef GRMAC_H_ +#define GRMAC_H_ + +#include "grobjs.h" + + extern + grDevice gr_mac_device; + +#ifdef GR_INIT_BUILD + static + grDeviceChain gr_mac_device_chain = + { + "mac", + &gr_mac_device, + GR_INIT_DEVICE_CHAIN + }; + +#undef GR_INIT_DEVICE_CHAIN +#define GR_INIT_DEVICE_CHAIN &gr_mac_device_chain + +#endif /* GR_INIT_BUILD */ + +#endif /* GRMAC_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/migs.html freetype-2.8/=unpacked-tar2=/graph/migs.html --- freetype-2.7.1/=unpacked-tar2=/graph/migs.html 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/migs.html 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,304 @@ + + + + + + + + +
MiGS Overview +
A Minimalist Graphics Subsystem +

+


+ +

+Introduction

+ +
This document details the design and implementation of MiGS, +the minimalist graphics subsystem used by the FreeType 2 demonstration +programs. Its purpose is mainly to help writers of new demo programs, as +well as developers who would like port the subsystem to other platforms.
+ +
+

+I - Design goals

+ +
MiGS is a tiny graphics subsystem used to demo text rendering +through the FreeType library. It was mainly written to provide the abilities +to :
+ +
    +
      +
    • +draw a monochrome glyph bitmap to many kinds of target surfaces (i.e. really +bitmaps/pixmaps)
    • + +
    • +draw an anti-aliased glyph bitmap, with any level of grays, to many kinds +of target surfaces
    • + +
    • +display a simple window on many systems like X11, OS/2 and Windows
    • + +
    • +accept simple events (keypresses and mouse buttons) in this window.
    • + +
    • +to be portable and present a unified API on all running systems
    • +
    + +


    MiGS uses system-specific "drivers" in order to perform display +and event handling. The blitting functions are not device-specific. MiGS +can be built and/or used with no system-specific features, like for example, +to generate simple GIF, PNG, TIFF, etc.. images without ever needing to +display them.

+ +

+ +

+ +

+II - Surfaces, bitmaps and windows

+ +
A surface in MiGS models a drawable region where glyph images +can be rendered, a surface always contains a bitmap descriptor as well +as a few other things that will be described later in this section. +

Some surfaces can be displayed, they are then either called windowed +surfaces or screen surfaces depending on the nature of the device +used to display them. Each device is implemented by a very simple +driver in the MiGS code. Here are a few example devices that are +or could be written to display surfaces : +

- an X11 device +
- a Win 32 GDI device +
- an OS/2 Presentation Manager device +
- a fullscreen SVGALib device on Linux +
- a GGI visual device +
- an OS/2 "Dive" device, or the equivalent Win32 "DirectX" device +

etc.. +

NOTE: For now, only the X11 device was written and tested.. More +devices should come later +

Before explaining how to create a surface, we need to explain how MiGS +manages bitmaps and renders glyph images to them. +

+1. Bitmaps :

+ +
A bitmap in MiGS features the following things : +
    +
  • +a width in pixels
  • + +
  • +a height in pixels
  • + +
  • +a pixel mode, which indicates how the pixels are stored in +the surface's buffer
  • + +
  • +a pitch, whose absolute values is the number of bytes taken +by each surface row
  • + +
  • +a number of valid gray levels (see below)
  • + +
  • +a buffer, holding the surface's pixels
  • +
+ +


MiGS uses the "Y downwards" convention, which means that +increasing +Y coordinates correspond to lower rows of the bitmap. Hence, +the coordinate (0,0) always corresponds to the bitmap's +top-left +pixel. +

The bitmap's rows can be stored either "downwards" or "upwards" +in the pixel buffer. +

In the first case (downwards), increasing memory addresses in +the pixel buffer correspond to lower rows of the bitmap(e.g. PC video modes), +and the pitch should be equal to the number of bytes +taken by each row. The first pixel buffer byte corresponds to the +upper row. +

In the second case (upwards), increasing memory addresses in +the pixel buffer correspond to upper rows of the bitmap and the pitch +should be equal to the opposite of the number of bytes +taken by each row. The first pixel buffer byte corresponds to the lower +row. +

In all cases, the pitch is the increment to be used +to go from one bitmap row to the one below it. +

The supported pixel modes are : +

    +
  • +1-bit monochrome bitmaps. With "0" as the background, and "1" as the foreground.
  • + +
  • +4-bit color bitmaps, using an arbitrary palette.
  • + +
  • +8-bit color bitmaps, using an arbitrary palette.
  • + +
  • +8-bit gray bitmaps, using a given N number of gray levels in the range +0..N-1.
  • + +
  • +15-bit color bitmaps, also known as RGB555
  • + +
  • +16-bit color bitmaps, also known as RGB565
  • + +
  • +24-bit color bitmaps, also known as RGB
  • + +
  • +32-bit color bitmaps, also known as RGBA (though the A is ignored by MiGS)
  • +
+The bitmap's number of gray levels is only relevant for 8-bit +gray bitmaps, and indicates the range of gray levels that can be +found in the bitmap. If a bitmap as N gray levels, it is said to be N-grayscales, +and the pixels within it must all have values between 0, considered as +the background color, and N-1, considered as the foreground +color. +

N-grayscale bitmaps are crucial for the rendering of anti-aliased text. +
 

+ +

+2. Glyph images :

+ +
The glyph images that can be drawn on bitmaps through MiGS +are bitmaps themselves, though limited to the following pixel modes : +

1-bit monochrome glyph bitmaps +

These can be drawn on any kind of bitmap. Note that only +the "lit" pixels (i.e. the bits set to 1) are effectively drawn to +the target, as opaque blitting isn't supported (remember, it's a minimalist +library !)
+ +


N-grayscales glyph images (with any value of N >= 2) +

These can be drawn to all RGB bitmaps (15, 16, 24 & +32 bits/pixel), as well as any other M-grayscales bitmaps. In the latter +case, the values of N and M need not be equal, as the library is +able to perform automatic conversions on the fly. +

For example, it is possible to render a 5-grayscales glyph image into +a 128-grayscales bitmap. Moreover, it is also possible to render a 17-grayscales +glyph image into a 5-grayscales bitmap, even if this will result in a +loss of quality. This feature is crucial in order to experiment easily +with other anti-aliasing algorithms for FreeType +
 

+Note that you can only draw monochrome bitmaps to the following +pixel modes : monochrome, 4-bit color and 8-bit color.
+ +

+3. Windows and Screens:

+ +
In order to debug FreeType, displaying a surface in a window +or in full-screen mode, is required. MiGS thus makes a difference between +simple +surfaces, which only contain a bitmap, windowed surfaces, which +are used to display their content in a window, and screen surfaces, +which are used to display their content in a full-screen mode (SVGAlib, +DirectX, GGI or whatever). +

A few important things must be said about non-simple surfaces. +
  +

    +
  • +First, they might contain some system-specific data which is used to manage +the display in a window or on the screen. This must be completely hidden +to MiGS clients. Indeed, rendering to any kind of surface is achieved through +exactly +the same function calls.
  • +
+ +
    +
  • +Second, they may contain a bitmap whose pixel mode doesn't correspond to +the screen's depth used to display it. For example, the surface might contain +an 128-grayscale bitmap, while the screen is in RGB24 mode. Some conversion +must be performed to display the surface. This can either happen in the +system-specific graphics library (e.g. on OS/2, a single Presentation Manager +call is used to blit a N-grayscale image to any kind of window) +or in the system-specific part of MiGS (e.g. the X11 MiGS driver must convert +the surface's bitmap into the appropriate X11 image each time a +repaint is requested). Again this must be completely hidden to MiGS clients
  • +
+Surfaces have also a few fields that are only used when displaying them +in Windows : +

a title string +

This is simply a text string that is displayed on the title +bar of the surface's window. It can also appear at the top or bottom of +full-screen surfaces if the MiGS driver supports it. The title string can +be changed with a call to grSetTitle, and is ignored for simple +surfaces.
+ +


a refresh flag +

This boolean flag is only used for window surfaces, and some +fullscreen ones (depending on the driver implementation). When set, it +indicates that each glyph image blit must be displayed immediately. By +default, this flag is set to False, which means that demo programs must +call the grRefreshSurface(surface) function to display the whole +contents of a surface one it has been updated. +

The refresh flag can be set with grSetSurfaceRefresh(surface,flag). +Note that a single surface rectangle can be forced to be displayed with +a call to grRefreshRectangle(surface,x,y,w,h) at any time.

+
+ +

+4. Devices :

+ +
As said before, each device is in charge of displaying a surface +in a given window or screen. Each device is managed through a very simple +driver, described to MiGS through a very simple "grDevice" structure. +

A grDevice contains, among other things, pointers to the functions used +to: +

- refresh/display a given rectangle of the surface to the window/screen +
- listen events (key presses and mouse) and send them back to client +apps. +
- for windowed devices, update the title bar. +

As said before, this is a highly minimalist system.. +
 

+
+ +
+

+III - Important implementation issues :

+ +
+

+1. Display surface negotiation :

+ +
A display surface is created with the function grNewScreenSurface +which takes parameters indicating which device should be used, the pixel +dimensions of the requested surface, as well as its pixel mode. +

Because of some device-specific limitations, the resulting surface's +properties might not match exactly those requested for the call. Hence, +a developer should always take care of reading a new display surface's +bitmap descriptor in order to get its real dimensions, pixel +mode and eventually number of grays. +

The function grNewSurface will create a memory surface with the corresponding +bitmap. +
The function grNewBitmapSurface will create a surface from a pre-existing +bitmap. This is useful to draw text on loaded images, for example. +

Any surface (display or not) is destroyed with grDoneSurface.

+ +

+

+ +

+2. Supporting 8-bit grayscale mode :

+ +
It is important, for the debugging of FreeType anti-aliased +renderer(s), that _all_ devices should support the 8-bit gray mode. +The number of gray levels can be fixed or negotiated as required by implementation-specific +issues. +

As most existing devices do not provide direct support for such a mode, +each 8-bit surface must thus contain : +

- an internal N-grayscale bitmap, used as the target of all glyph drawings +
- its own device-specific "image", which matches the display depth. +

Each time the device's "refresh_rect" function is called, it should +then : +
- convert the grayscales within the bitmap's rectangle into the image's +buffer and format. +
- display the corresponding image rectangle. +

This scheme is used, for example, by the X11 device.

+
+ + + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/os2/gros2pm.c freetype-2.8/=unpacked-tar2=/graph/os2/gros2pm.c --- freetype-2.7.1/=unpacked-tar2=/graph/os2/gros2pm.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/os2/gros2pm.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,753 @@ +#include "grobjs.h" +#include "grdevice.h" + +#define INCL_DOS +#define INCL_WIN +#define INCL_GPI +#define INCL_SUB + +#include +#include +#include +#include +#include + +#define DEBUGxxx + +#ifdef DEBUG +#define LOG(x) LogMessage##x +#else +#define LOG(x) /* rien */ +#endif + +#ifdef DEBUG + static void LogMessage( const char* fmt, ... ) + { + va_list ap; + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } +#endif + + typedef struct Translator + { + ULONG os2key; + grKey grkey; + + } Translator; + + + static + Translator key_translators[] = + { + { VK_BACKSPACE, grKeyBackSpace }, + { VK_TAB, grKeyTab }, + { VK_ENTER, grKeyReturn }, + { VK_ESC, grKeyEsc }, + { VK_HOME, grKeyHome }, + { VK_LEFT, grKeyLeft }, + { VK_UP, grKeyUp }, + { VK_RIGHT, grKeyRight }, + { VK_DOWN, grKeyDown }, + { VK_PAGEUP, grKeyPageUp }, + { VK_PAGEDOWN, grKeyPageDown }, + { VK_END, grKeyEnd }, + { VK_F1, grKeyF1 }, + { VK_F2, grKeyF2 }, + { VK_F3, grKeyF3 }, + { VK_F4, grKeyF4 }, + { VK_F5, grKeyF5 }, + { VK_F6, grKeyF6 }, + { VK_F7, grKeyF7 }, + { VK_F8, grKeyF8 }, + { VK_F9, grKeyF9 }, + { VK_F10, grKeyF10 }, + { VK_F11, grKeyF11 }, + { VK_F12, grKeyF12 } + }; + + +#define MAX_PIXEL_MODES 32 + + static HAB gr_anchor; /* device anchor block */ + + typedef POINTL PMBlitPoints[4]; + + typedef struct grPMSurface_ + { + grSurface root; + grBitmap image; + + HAB anchor; /* handle to anchor block for surface's window */ + HWND frame_window; /* handle to window's frame */ + HWND client_window; /* handle to window's client */ + HWND title_window; /* handle to window's title bar */ + + HPS image_ps; /* memory presentation space used to hold */ + /* the surface's content under PM */ + HDC image_dc; /* memory device context for the image */ + + HEV event_lock; /* semaphore used in listen_surface */ + HMTX image_lock; /* a mutex used to synchronise access */ + /* to the memory presentation space */ + /* used to hold the surface */ + + TID message_thread; /* thread used to process this surface's */ + /* messages.. */ + + PBITMAPINFO2 bitmap_header;/* os/2 bitmap descriptor */ + HBITMAP os2_bitmap; /* Handle to OS/2 bitmap contained in image */ + BOOL ready; /* ??? */ + + long shades[256]; /* indices of gray levels in pixel_mode_gray */ + + POINTL surface_blit[4]; /* surface blitting table */ + POINTL magnify_blit[4]; /* magnifier blitting table */ + int magnification; /* level of magnification */ + POINTL magnify_center; + SIZEL magnify_size; + + grEvent event; + + PMBlitPoints blit_points; + + } grPMSurface; + + /* we use a static variable to pass a pointer to the PM Surface */ + /* to the client window. This is a bit ugly, but it makes things */ + /* a lot more simple.. */ + static grPMSurface* the_surface; + + static + void enable_os2_iostreams( void ) + { + PTIB thread_block; + PPIB process_block; + + /* XXX : This is a very nasty hack, it fools OS/2 and let the program */ + /* call PM functions, even though stdin/stdout/stderr are still */ + /* directed to the standard i/o streams.. */ + /* The program must be compiled with WINDOWCOMPAT */ + /* */ + /* Credits go to Michal for finding this !! */ + /* */ + DosGetInfoBlocks( &thread_block, &process_block ); + process_block->pib_ultype = 3; + } + + + + static + int init_device( void ) + { + enable_os2_iostreams(); + + /* create an anchor block. This will allow this thread (i.e. the */ + /* main one) to call Gpi functions.. */ + gr_anchor = WinInitialize(0); + if (!gr_anchor) + { + /* could not initialise Presentation Manager */ + return -1; + } + + return 0; + } + + + + static + void done_device( void ) + { + /* Indicates that we do not use the Presentation Manager, this */ + /* will also release all associated resources.. */ + WinTerminate( gr_anchor ); + } + + + + /* close a given window */ + static + void done_surface( grPMSurface* surface ) + { + LOG(( "Os2PM: done_surface(%08lx)\n", (long)surface )); + + if ( surface->frame_window ) + WinDestroyWindow( surface->frame_window ); + + WinReleasePS( surface->image_ps ); + + grDoneBitmap( &surface->image ); + grDoneBitmap( &surface->root.bitmap ); + } + + +#define LOCK(x) DosRequestMutexSem( x, SEM_INDEFINITE_WAIT ) +#define UNLOCK(x) DosReleaseMutexSem( x ) + + static + const int pixel_mode_bit_count[] = + { + 0, + 1, /* mono */ + 4, /* pal4 */ + 8, /* pal8 */ + 8, /* grays */ + 15, /* rgb15 */ + 16, /* rgb16 */ + 24, /* rgb24 */ + 32 /* rgb32 */ + }; + + + /************************************************************************ + * + * Technical note : how the OS/2 Presentation Manager driver works + * + * PM is, in my opinion, a bloated and over-engineered graphics + * sub-system, even though it has lots of nice features. Here are + * a few tidbits about it : + * + * + * - under PM, a "bitmap" is a device-specific object whose bits are + * not directly accessible to the client application. This means + * that we must use a scheme like the following to display our + * surfaces : + * + * - hold, for each surface, its own bitmap buffer where the + * rest of the graph library writes directly. + * + * - create a PM bitmap object with the same dimensions (and + * possibly format). + * + * - copy the content of each updated rectangle into the + * PM bitmap with the function 'GpiSetBitmapBits'. + * + * - finally, "blit" the PM bitmap to the screen calling + * 'GpiBlitBlt' + * + * - but there is more : you cannot directly blit a PM bitmap to the + * screen with PM. The 'GpiBlitBlt' only works with presentation + * spaces. This means that we also need to create, for each surface : + * + * - a memory presentation space, used to hold the PM bitmap + * - a "memory device context" for the presentation space + * + * The blit is then performed from the memory presentation space + * to the screen's presentation space.. + * + * + * - because each surface creates its own event-handling thread, + * we must protect the surface's presentation space from concurrent + * accesses (i.e. calls to 'GpiSetBitmapBits' when drawing to the + * surface, and calls to 'GpiBlitBlt' when drawing it on the screen + * are performed in two different threads). + * + * we use a simple mutex to do this. + * + * + * - we also use a semaphore to perform a rendez-vous between the + * main and event-handling threads (needed in "listen_event"). + * + ************************************************************************/ + + static + void RunPMWindow( grPMSurface* surface ); + + + + + static + void refresh_rectangle( grPMSurface* surface, + int x, + int y, + int w, + int h ) + { + LOG(( "Os2PM: refresh_rectangle( %08lx, %d, %d, %d, %d )\n", + (long)surface, x, y, w, h )); + + (void)x; + (void)y; + (void)w; + (void)h; + + /* + convert_rectangle( surface, x, y, w, h ); + */ + LOCK( surface->image_lock ); + GpiSetBitmapBits( surface->image_ps, + 0, + surface->root.bitmap.rows, + surface->root.bitmap.buffer, + surface->bitmap_header ); + UNLOCK( surface->image_lock ); + + WinInvalidateRect( surface->client_window, NULL, FALSE ); + WinUpdateWindow( surface->frame_window ); + } + + + static + void set_title( grPMSurface* surface, + const char* title ) + { + ULONG rc; + +#if 1 + LOG(( "Os2PM: set_title( %08lx == %08lx, %s )\n", + (long)surface, surface->client_window, title )); +#endif + LOG(( " -- frame = %08lx\n", + (long)surface->frame_window )); + LOG(( " -- client parent = %08lx\n", + (long)WinQueryWindow( surface->client_window, QW_PARENT ) )); + rc = WinSetWindowText( surface->client_window, (PSZ)title ); + LOG(( " -- returned rc = %ld\n",rc )); + } + + + + static + void listen_event( grPMSurface* surface, + int event_mask, + grEvent* grevent ) + { + ULONG ulRequestCount; + + (void) event_mask; /* ignored for now */ + + /* the listen_event function blocks until there is an event to process */ + DosWaitEventSem( surface->event_lock, SEM_INDEFINITE_WAIT ); + DosQueryEventSem( surface->event_lock, &ulRequestCount ); + *grevent = surface->event; + DosResetEventSem( surface->event_lock, &ulRequestCount ); + + return; + } + + + static + grPMSurface* init_surface( grPMSurface* surface, + grBitmap* bitmap ) + { + PBITMAPINFO2 bit; + SIZEL sizl = { 0, 0 }; + LONG palette[256]; + LOG(( "Os2PM: init_surface( %08lx, %08lx )\n", + (long)surface, (long)bitmap )); + + LOG(( " -- input bitmap =\n" )); + LOG(( " -- mode = %d\n", bitmap->mode )); + LOG(( " -- grays = %d\n", bitmap->grays )); + LOG(( " -- width = %d\n", bitmap->width )); + LOG(( " -- height = %d\n", bitmap->rows )); + + /* create the bitmap - under OS/2, we support all modes as PM */ + /* handles all conversions automatically.. */ + if ( grNewBitmap( bitmap->mode, + bitmap->grays, + bitmap->width, + bitmap->rows, + bitmap ) ) + return 0; + + LOG(( " -- output bitmap =\n" )); + LOG(( " -- mode = %d\n", bitmap->mode )); + LOG(( " -- grays = %d\n", bitmap->grays )); + LOG(( " -- width = %d\n", bitmap->width )); + LOG(( " -- height = %d\n", bitmap->rows )); + + bitmap->pitch = -bitmap->pitch; + surface->root.bitmap = *bitmap; + + /* create the image and event lock */ + DosCreateEventSem( NULL, &surface->event_lock, 0, TRUE ); + DosCreateMutexSem( NULL, &surface->image_lock, 0, FALSE ); + + /* create the image's presentation space */ + surface->image_dc = DevOpenDC( gr_anchor, + OD_MEMORY, (PSZ)"*", 0L, 0L, 0L ); + + surface->image_ps = GpiCreatePS( gr_anchor, + surface->image_dc, + &sizl, + PU_PELS | GPIT_MICRO | + GPIA_ASSOC | GPIF_DEFAULT ); + + GpiSetBackMix( surface->image_ps, BM_OVERPAINT ); + + /* create the image's PM bitmap */ + bit = (PBITMAPINFO2)grAlloc( sizeof(BITMAPINFO2) + 256*sizeof(RGB2) ); + surface->bitmap_header = bit; + + bit->cbFix = sizeof( BITMAPINFOHEADER2 ); + bit->cx = surface->root.bitmap.width; + bit->cy = surface->root.bitmap.rows; + bit->cPlanes = 1; + + bit->argbColor[0].bBlue = 255; + bit->argbColor[0].bGreen = 0; + bit->argbColor[0].bRed = 0; + + bit->argbColor[1].bBlue = 0; + bit->argbColor[1].bGreen = 255; + bit->argbColor[1].bRed = 0; + + bit->cBitCount = (bitmap->mode == gr_pixel_mode_gray ? 8 : 1 ); + + if (bitmap->mode == gr_pixel_mode_gray) + { + RGB2* color = bit->argbColor; + int x, count; + + count = bitmap->grays; + for ( x = 0; x < count; x++, color++ ) + { + color->bBlue = + color->bGreen = + color->bRed = (((count-x)*255)/count); + } + } + else + { + RGB2* color = bit->argbColor; + + color[0].bBlue = + color[0].bGreen = + color[0].bRed = 0; + + color[1].bBlue = + color[1].bGreen = + color[1].bRed = 255; + } + + surface->os2_bitmap = GpiCreateBitmap( surface->image_ps, + (PBITMAPINFOHEADER2)bit, + 0L, NULL, NULL ); + + GpiSetBitmap( surface->image_ps, surface->os2_bitmap ); + + bit->cbFix = sizeof( BITMAPINFOHEADER2 ); + GpiQueryBitmapInfoHeader( surface->os2_bitmap, + (PBITMAPINFOHEADER2)bit ); + surface->bitmap_header = bit; + + /* for gr_pixel_mode_gray, create a gray-levels logical palette */ + if ( bitmap->mode == gr_pixel_mode_gray ) + { + int x, count; + + count = bitmap->grays; + for ( x = 0; x < count; x++ ) + palette[x] = (((count-x)*255)/count) * 0x010101; + + /* create logical color table */ + GpiCreateLogColorTable( surface->image_ps, + (ULONG) LCOL_PURECOLOR, + (LONG) LCOLF_CONSECRGB, + (LONG) 0L, + (LONG) count, + (PLONG) palette ); + + /* now, copy the color indexes to surface->shades */ + for ( x = 0; x < count; x++ ) + surface->shades[x] = GpiQueryColorIndex( surface->image_ps, + 0, palette[x] ); + } + + /* set up the blit points array */ + surface->blit_points[1].x = surface->root.bitmap.width; + surface->blit_points[1].y = surface->root.bitmap.rows; + surface->blit_points[3] = surface->blit_points[1]; + + /* Finally, create the event handling thread for the surface's window */ + DosCreateThread( &surface->message_thread, + (PFNTHREAD) RunPMWindow, + (ULONG) surface, + 0UL, + 32920 ); + + /* wait for the window creation */ + LOCK(surface->image_lock); + UNLOCK(surface->image_lock); + + surface->root.done = (grDoneSurfaceFunc) done_surface; + surface->root.refresh_rect = (grRefreshRectFunc) refresh_rectangle; + surface->root.set_title = (grSetTitleFunc) set_title; + surface->root.listen_event = (grListenEventFunc) listen_event; + + /* convert_rectangle( surface, 0, 0, bitmap->width, bitmap->rows ); */ + return surface; + } + + + + MRESULT EXPENTRY Message_Process( HWND handle, + ULONG mess, + MPARAM parm1, + MPARAM parm2 ); + + + static + void RunPMWindow( grPMSurface* surface ) + { + unsigned char class_name[] = "DisplayClass"; + ULONG class_flags; + + static HMQ queue; + QMSG message; + + /* store the current surface pointer in "the_surface". It is a static */ + /* variable that is only used to retrieve the pointer in the client */ + /* window procedure the first time it is called.. */ + the_surface = surface; + + /* try to prevent the program from going on without the setup of thread 2 */ + LOCK( surface->image_lock ); + + LOG(( "Os2PM: RunPMWindow( %08lx )\n", (long)surface )); + + /* create an anchor to allow this thread to use PM */ + surface->anchor = WinInitialize(0); + if (!surface->anchor) + { + printf( "Error doing WinInitialize()\n" ); + return; + } + + /* create a message queue */ + queue = WinCreateMsgQueue( surface->anchor, 0 ); + if (!queue) + { + printf( "Error doing WinCreateMsgQueue()\n" ); + return; + } + + /* register the window class */ + if ( !WinRegisterClass( surface->anchor, + (PSZ) class_name, + (PFNWP) Message_Process, + CS_SIZEREDRAW, + 0 ) ) + { + printf( "Error doing WinRegisterClass()\n" ); + return; + } + + /* create the PM window */ + class_flags = FCF_TITLEBAR | FCF_MINBUTTON | FCF_DLGBORDER | + FCF_TASKLIST | FCF_SYSMENU; + + LOG(( "Os2PM: RunPMWindow: Creating window\n" )); + surface->frame_window = WinCreateStdWindow( + HWND_DESKTOP, + WS_VISIBLE, + &class_flags, + (PSZ) class_name, + (PSZ) "FreeType Viewer - press F1 for help", + WS_VISIBLE, + 0, 0, + &surface->client_window ); + if (!surface->frame_window) + { + printf( "Error doing WinCreateStdWindow()\n" ); + return; + } + + /* find the title window handle */ + surface->title_window = WinWindowFromID( surface->frame_window, + FID_TITLEBAR ); + LOG (( "Os2PM: RunPMWIndow: Creation succeeded\n" )); + LOG (( " -- frame = %08lx\n", surface->frame_window )); + LOG (( " -- client = %08lx\n", surface->client_window )); + + /* set Window size and position */ + WinSetWindowPos( surface->frame_window, + 0L, + (SHORT) 60, + + (SHORT) WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) - + (surface->root.bitmap.rows + 100), + + (SHORT) WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME )*2 + + surface->root.bitmap.width, + + (SHORT) WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) + + WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME )*2 + + surface->root.bitmap.rows, + + SWP_SIZE | SWP_MOVE ); + +#if 0 + /* save the handle to the current surface within the window words */ + WinSetWindowPtr( surface->client_window,QWL_USER, surface ); +#endif + + /* Announcing window_created */ + UNLOCK(surface->image_lock); + + /* run the message queue till the end */ + while ( WinGetMsg( surface->anchor, &message, (HWND)NULL, 0, 0 ) ) + { + WinDispatchMsg( surface->anchor, &message ); + } + + /* clean-up */ + WinDestroyWindow( surface->frame_window ); + surface->frame_window = 0; + + WinDestroyMsgQueue( queue ); + WinTerminate( surface->anchor ); + + /* await death... */ + while ( 1 ) + DosSleep( 100 ); + } + + + + + /* Message processing for our PM Window class */ + MRESULT EXPENTRY Message_Process( HWND handle, + ULONG mess, + MPARAM parm1, + MPARAM parm2 ) + { + static HDC screen_dc; + static HPS screen_ps; + static BOOL minimized; + + SIZEL sizl; + SWP swp; + + grPMSurface* surface; + + /* get the handle to the window's surface -- note that this */ + /* value will be null when the window is created */ + surface = (grPMSurface*)WinQueryWindowPtr( handle, QWL_USER ); + if (!surface) + { + surface = the_surface; + WinSetWindowPtr( handle, QWL_USER, surface ); + } + + switch( mess ) + { + case WM_DESTROY: + /* warn the main thread to quit if it didn't know */ + surface->event.type = gr_event_key; + surface->event.key = grKeyEsc; + DosPostEventSem( surface->event_lock ); + break; + + case WM_CREATE: + /* set original magnification */ + minimized = FALSE; + + /* create Device Context and Presentation Space for screen. */ + screen_dc = WinOpenWindowDC( handle ); + screen_ps = GpiCreatePS( surface->anchor, + screen_dc, + &sizl, + PU_PELS | GPIT_MICRO | + GPIA_ASSOC | GPIF_DEFAULT ); + /* take the input focus */ + WinFocusChange( HWND_DESKTOP, handle, 0L ); + LOG(( "screen_dc and screen_ps have been created\n" )); + + /* To permit F9, F10 and others to pass through to the application */ + if (TRUE != WinSetAccelTable (surface->anchor, 0, surface->frame_window)) + { + printf( "Error - failed to clear accel table\n"); + } + break; + + case WM_MINMAXFRAME: + /* to update minimized if changed */ + swp = *((PSWP) parm1); + if ( swp.fl & SWP_MINIMIZE ) + minimized = TRUE; + if ( swp.fl & SWP_RESTORE ) + minimized = FALSE; + return WinDefWindowProc( handle, mess, parm1, parm2 ); + break; + + case WM_ERASEBACKGROUND: + case WM_PAINT: + /* copy the memory image of the screen out to the real screen */ + LOCK( surface->image_lock ); + WinBeginPaint( handle, screen_ps, NULL ); + + /* main image and magnified picture */ + GpiBitBlt( screen_ps, + surface->image_ps, + 4L, + surface->blit_points, + ROP_SRCCOPY, BBO_AND ); + + WinEndPaint( screen_ps ); + UNLOCK( surface->image_lock ); + break; + + case WM_HELP: /* this really is a F1 Keypress !! */ + surface->event.key = grKeyF1; + goto Do_Key_Event; + + case WM_CHAR: + if ( CHARMSG( &mess )->fs & KC_KEYUP ) + break; + + /* look for a specific vkey */ + { + int count = sizeof( key_translators )/sizeof( key_translators[0] ); + Translator* trans = key_translators; + Translator* limit = trans + count; + + for ( ; trans < limit; trans++ ) + if ( CHARMSG(&mess)->vkey == trans->os2key ) + { + surface->event.key = trans->grkey; + goto Do_Key_Event; + } + } + + /* otherwise, simply record the character code */ + if ( (CHARMSG( &mess )->fs & KC_CHAR) == 0 ) + break; + + surface->event.key = CHARMSG(&mess)->chr; + + Do_Key_Event: + surface->event.type = gr_event_key; + DosPostEventSem( surface->event_lock ); + break; + + default: + return WinDefWindowProc( handle, mess, parm1, parm2 ); + } + + return (MRESULT) FALSE; + } + + + + + grDevice gr_os2pm_device = + { + sizeof( grPMSurface ), + "os2pm", + + init_device, + done_device, + + (grDeviceInitSurfaceFunc) init_surface, + + 0, + 0 + + }; + + diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/os2/gros2pm.def freetype-2.8/=unpacked-tar2=/graph/os2/gros2pm.def --- freetype-2.7.1/=unpacked-tar2=/graph/os2/gros2pm.def 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/os2/gros2pm.def 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,5 @@ +NAME WINDOWCOMPAT + +DESCRIPTION 'FreeType Graphics' +HEAPSIZE 8192 +STACKSIZE 40888 diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/os2/gros2pm.h freetype-2.8/=unpacked-tar2=/graph/os2/gros2pm.h --- freetype-2.7.1/=unpacked-tar2=/graph/os2/gros2pm.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/os2/gros2pm.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,23 @@ +#ifndef GROS2PM_H_ +#define GROS2PM_H_ + +#include "grobjs.h" + + extern + grDevice gr_os2pm_device; + +#ifdef GR_INIT_BUILD + static + grDeviceChain gr_os2pm_device_chain = + { + "os2pm", + &gr_os2pm_device, + GR_INIT_DEVICE_CHAIN + }; + +#undef GR_INIT_DEVICE_CHAIN +#define GR_INIT_DEVICE_CHAIN &gr_os2pm_device_chain + +#endif /* GR_INIT_BUILD */ + +#endif /* GROS2PM_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/os2/Jamfile freetype-2.8/=unpacked-tar2=/graph/os2/Jamfile --- freetype-2.7.1/=unpacked-tar2=/graph/os2/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/os2/Jamfile 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,13 @@ +# FreeType2 demos graph/os2 Jamfile (c) 2001 David Turner +# + +SubDir FT2DEMO_TOP graph os2 ; + +SubDirHdrs $(GRAPH_INCLUDE) ; + +GROS2_PATH = [ FT2_SubDir graph os2 ]; +GRAPH_LINKLIBS = $(GROS2_PATH)gros2pm.def ; + +Library $(GRAPH_LIB) : grxos2.c ; + +# end of graph/os2 Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/os2/rules.mk freetype-2.8/=unpacked-tar2=/graph/os2/rules.mk --- freetype-2.7.1/=unpacked-tar2=/graph/os2/rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/os2/rules.mk 2015-09-25 05:40:31.000000000 +0000 @@ -0,0 +1,32 @@ +#************************************************************************** +#* +#* OS/2 specific rules file, used to compile the OS/2 graphics driver +#* to the graphics subsystem +#* +#************************************************************************** + +ifeq ($(PLATFORM),os2) + + GR_OS2 := $(GRAPH)/os2 + + # the GRAPH_LINK is expanded each time an executable is linked with the + # graphics library. + # + GRAPH_LINK += $(subst /,$(COMPILER_SEP),$(GR_OS2)/gros2pm.def) + + # add the OS/2 driver object file to the graphics library `graph.a' + # + GRAPH_OBJS += $(OBJ_DIR_2)/gros2pm.$O + + DEVICES += OS2_PM + + # the rule used to compile the graphics driver + # + $(OBJ_DIR_2)/gros2pm.$O: $(GR_OS2)/gros2pm.c $(GR_OS2)/gros2pm.h + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_OS2)) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + +endif + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/rules.mk freetype-2.8/=unpacked-tar2=/graph/rules.mk --- freetype-2.7.1/=unpacked-tar2=/graph/rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/rules.mk 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,106 @@ +#************************************************************************** +#* +#* FreeType demo utilities sub-Makefile +#* +#* This Makefile is to be included by `../Makefile'. Its +#* purpose is to compile MiGS (the Minimalist Graphics Subsystem). +#* +#* It is written for GNU Make. Other make utilities are not +#* supported! +#* +#************************************************************************** + + +GRAPH_INCLUDES := $(subst /,$(COMPILER_SEP),$(TOP_DIR_2)/graph) +GRAPH_LIB := $(OBJ_DIR_2)/graph.$(SA) + +GRAPH := $(TOP_DIR_2)/graph + +GRAPH_H := $(GRAPH)/gblany.h \ + $(GRAPH)/gblbgra.h \ + $(GRAPH)/gblblit.h \ + $(GRAPH)/gblcolor.h \ + $(GRAPH)/gblhbgr.h \ + $(GRAPH)/gblhrgb.h \ + $(GRAPH)/gblvbgr.h \ + $(GRAPH)/gblvrgb.h \ + $(GRAPH)/gblender.h \ + $(GRAPH)/graph.h \ + $(GRAPH)/grblit.h \ + $(GRAPH)/grconfig.h \ + $(GRAPH)/grdevice.h \ + $(GRAPH)/grevents.h \ + $(GRAPH)/grfont.h \ + $(GRAPH)/grobjs.h \ + $(GRAPH)/grswizzle.h \ + $(GRAPH)/grtypes.h + + +GRAPH_OBJS := $(OBJ_DIR_2)/gblblit.$(O) \ + $(OBJ_DIR_2)/gblender.$(O) \ + $(OBJ_DIR_2)/grblit.$(O) \ + $(OBJ_DIR_2)/grdevice.$(O) \ + $(OBJ_DIR_2)/grfill.$(O) \ + $(OBJ_DIR_2)/grfont.$(O) \ + $(OBJ_DIR_2)/grinit.$(O) \ + $(OBJ_DIR_2)/grobjs.$(O) \ + $(OBJ_DIR_2)/grswizzle.$(O) + + + +# Default value for COMPILE_GRAPH_LIB; +# this value can be modified by the system-specific graphics drivers. +# +ifneq ($(LIBTOOL),) + COMPILE_GRAPH_LIB = $(LIBTOOL) --mode=link $(CCraw) -static \ + -o $(subst /,$(COMPILER_SEP),$@ $(GRAPH_OBJS)) +else + COMPILE_GRAPH_LIB = ar -r $(subst /,$(COMPILER_SEP),$@ $(GRAPH_OBJS)) +endif + + +# Add the rules used to detect and compile graphics driver depending +# on the current platform. +# +include $(wildcard $(TOP_DIR_2)/graph/*/rules.mk) + + +######################################################################### +# +# Build the `graph' library from its objects. This should be changed +# in the future in order to support more systems. Probably something +# like a `config/' hierarchy with a system-specific rules file +# to indicate how to make a library file, but for now, I'll stick to +# unix, Win32, and OS/2-gcc. +# +# +$(GRAPH_LIB): $(GRAPH_OBJS) + $(COMPILE_GRAPH_LIB) + + +# pattern rule for normal sources +# +$(OBJ_DIR_2)/%.$(O): $(GRAPH)/%.c $(GRAPH_H) +ifneq ($(LIBTOOL),) + $(LIBTOOL) --mode=compile $(CC) -static $(CFLAGS) \ + $(GRAPH_INCLUDES:%=$I%) $T$@ $< +else + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) $T$@ $< +endif + + +# a special rule is used for 'grinit.o' as it needs the definition +# of some macros like "-DDEVICE_X11" or "-DDEVICE_OS2_PM" +# +$(OBJ_DIR_2)/grinit.$(O): $(GRAPH)/grinit.c $(GRAPH_H) +ifneq ($(LIBTOOL),) + $(LIBTOOL) --mode=compile $(CC) -static \ + $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $(DEVICES:%=$DDEVICE_%) $T$(subst /,$(COMPILER_SEP),$@ $<) +else + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $(DEVICES:%=$DDEVICE_%) $T$(subst /,$(COMPILER_SEP),$@ $<) +endif + + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/win32/grwin32.c freetype-2.8/=unpacked-tar2=/graph/win32/grwin32.c --- freetype-2.7.1/=unpacked-tar2=/graph/win32/grwin32.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/win32/grwin32.c 2017-03-23 11:16:47.000000000 +0000 @@ -0,0 +1,659 @@ +/******************************************************************* + * + * grwin32.c graphics driver for Win32 platform + * + * This is the driver for displaying inside a window under Win32, + * used by the graphics utility of the FreeType test suite. + * + * Written by Antoine Leca. + * Copyright 1999-2000, 2001, 2002, 2007 by Antoine Leca, + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Borrowing liberally from the other FreeType drivers. + * + * 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. + * + ******************************************************************/ + +#include +#include +#include + +/* define to activate OLPC swizzle */ +#define xxSWIZZLE + +#define WIN32_LEAN_AND_MEAN +#include + +#include +#include +#ifdef SWIZZLE +#include +#endif + +/* logging facility */ +#include + +#define DEBUGxxx + +#ifdef DEBUG +#define LOG(x) LogMessage##x +#else +#define LOG(x) /* rien */ +#endif + +#ifdef DEBUG + static void LogMessage( const char* fmt, ... ) + { + va_list ap; + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } +#endif +/*-------------------*/ + +/* Size of the window. */ +#define WIN_WIDTH 640u +#define WIN_HEIGHT 450u + +/* These values can be changed, but WIN_WIDTH should remain for now a */ +/* multiple of 32 to avoid padding issues. */ + + typedef struct Translator_ + { + ULONG winkey; + grKey grkey; + + } Translator; + + static + Translator key_translators[] = + { + { VK_BACK, grKeyBackSpace }, + { VK_TAB, grKeyTab }, + { VK_RETURN, grKeyReturn }, + { VK_ESCAPE, grKeyEsc }, + { VK_HOME, grKeyHome }, + { VK_LEFT, grKeyLeft }, + { VK_UP, grKeyUp }, + { VK_RIGHT, grKeyRight }, + { VK_DOWN, grKeyDown }, + { VK_PRIOR, grKeyPageUp }, + { VK_NEXT, grKeyPageDown }, + { VK_END, grKeyEnd }, + { VK_F1, grKeyF1 }, + { VK_F2, grKeyF2 }, + { VK_F3, grKeyF3 }, + { VK_F4, grKeyF4 }, + { VK_F5, grKeyF5 }, + { VK_F6, grKeyF6 }, + { VK_F7, grKeyF7 }, + { VK_F8, grKeyF8 }, + { VK_F9, grKeyF9 }, + { VK_F10, grKeyF10 }, + { VK_F11, grKeyF11 }, + { VK_F12, grKeyF12 } + }; + + static + Translator syskey_translators[] = + { + { VK_F10, grKeyF10 } + }; + + static ATOM ourAtom; + + typedef struct grWin32SurfaceRec_ + { + grSurface root; + HWND window; + int window_width; + int window_height; + int title_set; + const char* the_title; + LPBITMAPINFO pbmi; + char bmi[ sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD) ]; + HBITMAP hbm; + grEvent ourevent; + int eventToProcess; + grBitmap bgrBitmap; /* windows wants data in BGR format !! */ +#ifdef SWIZZLE + grBitmap swizzle_bitmap; +#endif + } grWin32Surface; + + +/* destroys the surface*/ +static void +gr_win32_surface_done( grWin32Surface* surface ) +{ + /* The graphical window has perhaps already destroyed itself */ + if ( surface->window ) + { + DestroyWindow ( surface->window ); + PostMessage( surface->window, WM_QUIT, 0, 0 ); + } +#ifdef SWIZZLE + grDoneBitmap( &surface->swizzle_bitmap ); +#endif + grDoneBitmap( &surface->bgrBitmap ); + grDoneBitmap( &surface->root.bitmap ); +} + + +static void +gr_win32_surface_refresh_rectangle( + grWin32Surface* surface, + int x, + int y, + int w, + int h ) +{ + HDC hDC; + int row_bytes, delta; + LPBITMAPINFO pbmi = surface->pbmi; + HANDLE window = surface->window; + grBitmap* bitmap = &surface->root.bitmap; + + LOG(( "gr_win32_surface_refresh_rectangle: ( %p, %d, %d, %d, %d )\n", + (long)surface, x, y, w, h )); + + /* clip update rectangle */ + + if ( x < 0 ) + { + w += x; + x = 0; + } + + delta = x + w - surface->window_width; + if ( delta > 0 ) + w -= delta; + + if ( y < 0 ) + { + h += y; + y = 0; + } + + delta = y + h - surface->window_height; + if ( delta > 0 ) + h -= delta; + + if ( w <= 0 || h <= 0 ) + return; + + /* now, perform the blit */ + row_bytes = surface->root.bitmap.pitch; + if ( row_bytes < 0 ) + row_bytes = -row_bytes; + + if ( row_bytes * 8 != pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount ) + pbmi->bmiHeader.biWidth = row_bytes * 8 / pbmi->bmiHeader.biBitCount; + +#ifdef SWIZZLE + { + grBitmap* swizzle = &surface->swizzle_bitmap; + + gr_swizzle_rect_rgb24( bitmap->buffer, bitmap->pitch, + swizzle->buffer, swizzle->pitch, + bitmap->width, + bitmap->rows, + 0, 0, bitmap->width, bitmap->rows ); + + bitmap = swizzle; + } +#endif + + /* copy to BGR buffer */ + { + unsigned char* read_line = (unsigned char*)bitmap->buffer; + int read_pitch = bitmap->pitch; + unsigned char* write_line = (unsigned char*)surface->bgrBitmap.buffer; + int write_pitch = surface->bgrBitmap.pitch; + int height = bitmap->rows; + int width = bitmap->width; + + if ( read_pitch < 0 ) + read_line -= ( height - 1 ) * read_pitch; + + if ( write_pitch < 0 ) + write_line -= ( height - 1 ) * write_pitch; + + if ( bitmap->mode == gr_pixel_mode_gray ) + { + for ( ; height > 0; height-- ) + { + unsigned char* read = read_line; + unsigned char* read_limit = read + width; + unsigned char* write = write_line; + + for ( ; read < read_limit; read++, write++ ) + *write = *read; + + read_line += read_pitch; + write_line += write_pitch; + } + } + else + { + for ( ; height > 0; height-- ) + { + unsigned char* read = read_line; + unsigned char* read_limit = read + 3 * width; + unsigned char* write = write_line; + + for ( ; read < read_limit; read += 3, write += 3 ) + { + write[0] = read[2]; + write[1] = read[1]; + write[2] = read[0]; + } + + read_line += read_pitch; + write_line += write_pitch; + } + } + } + + hDC = GetDC ( window ); + SetDIBits ( hDC, surface->hbm, + 0, + bitmap->rows, + surface->bgrBitmap.buffer, + pbmi, + DIB_RGB_COLORS ); + + ReleaseDC ( window, hDC ); + + ShowWindow( window, SW_SHOW ); + InvalidateRect ( window, NULL, FALSE ); + UpdateWindow ( window ); +} + + +static void +gr_win32_surface_set_title( grWin32Surface* surface, + const char* title ) +{ + /* the title will be set on the next listen_event, just */ + /* record it there.. */ + surface->title_set = 1; + surface->the_title = title; +} + +static void +gr_win32_surface_listen_event( grWin32Surface* surface, + int event_mask, + grEvent* grevent ) +{ + MSG msg; + HANDLE window = surface->window; + + event_mask=event_mask; /* unused parameter */ + + if ( window && !surface->title_set ) + { + SetWindowText( window, surface->the_title ); + surface->title_set = 1; + } + + surface->eventToProcess = 0; + while (GetMessage( &msg, 0, 0, 0 )) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + if (surface->eventToProcess) + break; + } + + *grevent = surface->ourevent; +} + +/* + * set graphics mode + * and create the window class and the message handling. + */ + + +static grWin32Surface* +gr_win32_surface_init( grWin32Surface* surface, + grBitmap* bitmap ) +{ + static RGBQUAD black = { 0, 0, 0, 0 }; + static RGBQUAD white = { 0xFF, 0xFF, 0xFF, 0 }; + LPBITMAPINFO pbmi; + + /* find some memory for the bitmap header */ + surface->pbmi = pbmi = (LPBITMAPINFO) surface->bmi; + + LOG(( "Win32: init_surface( %p, %p )\n", surface, bitmap )); + + LOG(( " -- input bitmap =\n" )); + LOG(( " -- mode = %d\n", bitmap->mode )); + LOG(( " -- grays = %d\n", bitmap->grays )); + LOG(( " -- width = %d\n", bitmap->width )); + LOG(( " -- height = %d\n", bitmap->rows )); + + /* create the bitmap - under Win32, we support all modes as the GDI */ + /* handles all conversions automatically.. */ + if ( grNewBitmap( bitmap->mode, + bitmap->grays, + bitmap->width, + bitmap->rows, + bitmap ) ) + return 0; + + /* allocate the BGR shadow bitmap */ + if ( grNewBitmap( bitmap->mode, + bitmap->grays, + bitmap->width, + bitmap->rows, + &surface->bgrBitmap ) ) + return 0; + + surface->bgrBitmap.pitch = -surface->bgrBitmap.pitch; + +#ifdef SWIZZLE + if ( bitmap->mode == gr_pixel_mode_rgb24 ) + { + if ( grNewBitmap( bitmap->mode, + bitmap->grays, + bitmap->width, + bitmap->rows, + &surface->swizzle_bitmap ) ) + return 0; + + surface->swizzle_bitmap.pitch = -surface->swizzle_bitmap.pitch; + } +#endif + + LOG(( " -- output bitmap =\n" )); + LOG(( " -- mode = %d\n", bitmap->mode )); + LOG(( " -- grays = %d\n", bitmap->grays )); + LOG(( " -- width = %d\n", bitmap->width )); + LOG(( " -- height = %d\n", bitmap->rows )); + + bitmap->pitch = -bitmap->pitch; + surface->root.bitmap = *bitmap; + + /* initialize the header to appropriate values */ + memset( pbmi, 0, sizeof ( BITMAPINFO ) + sizeof ( RGBQUAD ) * 256 ); + + pbmi->bmiHeader.biSize = sizeof ( BITMAPINFOHEADER ); + pbmi->bmiHeader.biWidth = bitmap->width; + pbmi->bmiHeader.biHeight = bitmap->rows; + pbmi->bmiHeader.biPlanes = 1; + + switch ( bitmap->mode ) + { + case gr_pixel_mode_mono: + pbmi->bmiHeader.biBitCount = 1; + pbmi->bmiColors[0] = white; + pbmi->bmiColors[1] = black; + break; + + case gr_pixel_mode_rgb24: + pbmi->bmiHeader.biBitCount = 24; + pbmi->bmiHeader.biCompression = BI_RGB; + break; + + case gr_pixel_mode_gray: + pbmi->bmiHeader.biBitCount = 8; + pbmi->bmiHeader.biClrUsed = bitmap->grays; + { + int count = bitmap->grays; + int x; + RGBQUAD* color = pbmi->bmiColors; + + for ( x = 0; x < count; x++, color++ ) + { + color->rgbRed = + color->rgbGreen = + color->rgbBlue = (unsigned char)(((count-x)*255)/count); + color->rgbReserved = 0; + } + } + break; + + default: + return 0; /* Unknown mode */ + } + + surface->window_width = bitmap->width; + surface->window_height = bitmap->rows; + + { + DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; + RECT WndRect; + + WndRect.left = 0; + WndRect.top = 0; + WndRect.right = bitmap->width; + WndRect.bottom = bitmap->rows; + + AdjustWindowRect( &WndRect, style, FALSE ); + + surface->window = CreateWindow( + /* LPCSTR lpszClassName; */ "FreeTypeTestGraphicDriver", + /* LPCSTR lpszWindowName; */ "FreeType Test Graphic Driver", + /* DWORD dwStyle; */ style, + /* int x; */ CW_USEDEFAULT, + /* int y; */ CW_USEDEFAULT, + /* int nWidth; */ WndRect.right - WndRect.left, + /* int nHeight; */ WndRect.bottom - WndRect.top, + /* HWND hwndParent; */ HWND_DESKTOP, + /* HMENU hmenu; */ 0, + /* HINSTANCE hinst; */ GetModuleHandle( NULL ), + /* void FAR* lpvParam; */ surface ); + } + + if ( surface->window == 0 ) + return 0; + + surface->root.done = (grDoneSurfaceFunc) gr_win32_surface_done; + surface->root.refresh_rect = (grRefreshRectFunc) gr_win32_surface_refresh_rectangle; + surface->root.set_title = (grSetTitleFunc) gr_win32_surface_set_title; + surface->root.listen_event = (grListenEventFunc) gr_win32_surface_listen_event; + + return surface; +} + + +/* ---- Windows-specific stuff ------------------------------------------- */ + + + /* Message processing for our Windows class */ +LRESULT CALLBACK Message_Process( HWND handle, UINT mess, + WPARAM wParam, LPARAM lParam ) + { + grWin32Surface* surface = NULL; + + if ( mess == WM_CREATE ) + { + /* WM_CREATE is the first message sent to this function, and the */ + /* surface handle is available from the 'lParam' parameter. We */ + /* save its value in a window property.. */ + /* */ + surface = ((LPCREATESTRUCT)lParam)->lpCreateParams; + + SetProp( handle, (LPCSTR)(LONG)ourAtom, surface ); + } + else + { + /* for other calls, we retrieve the surface handle from the window */ + /* property.. ugly, isn't it ?? */ + /* */ + surface = (grWin32Surface*) GetProp( handle, (LPCSTR)(LONG)ourAtom ); + } + + switch( mess ) + { + case WM_DESTROY: + /* warn the main thread to quit if it didn't know */ + surface->ourevent.type = gr_event_key; + surface->ourevent.key = grKeyEsc; + surface->eventToProcess = 1; + surface->window = 0; + PostQuitMessage ( 0 ); + DeleteObject ( surface->hbm ); + return 0; + + case WM_CREATE: + { + HDC hDC; + LPBITMAPINFO pbmi = surface->pbmi; + + hDC = GetDC ( handle ); + surface->hbm = CreateDIBitmap ( + /* HDC hdc; handle of device context */ hDC, + /* BITMAPINFOHEADER FAR* lpbmih; addr.of header*/ &pbmi->bmiHeader, + /* DWORD dwInit; CBM_INIT to initialize bitmap */ 0, + /* const void FAR* lpvBits; address of values */ NULL, + /* BITMAPINFO FAR* lpbmi; addr.of bitmap data */ pbmi, + /* UINT fnColorUse; RGB or palette indices */ DIB_RGB_COLORS); + ReleaseDC ( handle, hDC ); + break; + } + + case WM_PAINT: + { + HDC hDC, memDC; + HANDLE oldbm; + PAINTSTRUCT ps; + + hDC = BeginPaint ( handle, &ps ); + memDC = CreateCompatibleDC( hDC ); + oldbm = SelectObject( memDC, surface->hbm ); + + BitBlt ( hDC, 0, 0, surface->window_width, surface->window_height, + memDC, 0, 0, SRCCOPY); + + ReleaseDC ( handle, hDC ); + SelectObject ( memDC, oldbm ); + DeleteObject ( memDC ); + EndPaint ( handle, &ps ); + return 0; + } + + case WM_SYSKEYDOWN: + { + int count = sizeof( syskey_translators )/sizeof( syskey_translators[0] ); + Translator* trans = syskey_translators; + Translator* limit = trans + count; + for ( ; trans < limit; trans++ ) + if ( wParam == trans->winkey ) + { + surface->ourevent.key = trans->grkey; + goto Do_Key_Event; + } + return DefWindowProc( handle, mess, wParam, lParam ); + } + + + case WM_KEYDOWN: + switch ( wParam ) + { + case VK_ESCAPE: + surface->ourevent.type = gr_event_key; + surface->ourevent.key = grKeyEsc; + surface->eventToProcess = 1; + PostQuitMessage ( 0 ); + return 0; + + default: + /* lookup list of translated keys */ + { + int count = sizeof( key_translators )/sizeof( key_translators[0] ); + Translator* trans = key_translators; + Translator* limit = trans + count; + for ( ; trans < limit; trans++ ) + if ( wParam == trans->winkey ) + { + surface->ourevent.key = trans->grkey; + goto Do_Key_Event; + } + } + + /* the key isn't found, default processing */ + /* return DefWindowProc( handle, mess, wParam, lParam ); */ + return DefWindowProc( handle, mess, wParam, lParam ); + } + + case WM_CHAR: + { + surface->ourevent.key = wParam; + + Do_Key_Event: + surface->ourevent.type = gr_event_key; + surface->eventToProcess = 1; + } + break; + + default: + return DefWindowProc( handle, mess, wParam, lParam ); + } + return 0; + } + + static int + gr_win32_device_init( void ) + { + WNDCLASS ourClass = { + /* UINT style */ 0, + /* WNDPROC lpfnWndProc */ Message_Process, + /* int cbClsExtra */ 0, + /* int cbWndExtra */ 0, + /* HANDLE hInstance */ 0, + /* HICON hIcon */ 0, + /* HCURSOR hCursor */ 0, + /* HBRUSH hbrBackground*/ 0, + /* LPCTSTR lpszMenuName */ NULL, + /* LPCTSTR lpszClassName*/ "FreeTypeTestGraphicDriver" + }; + + /* register window class */ + + ourClass.hInstance = GetModuleHandle( NULL ); + ourClass.hIcon = LoadIcon(0, IDI_APPLICATION); + ourClass.hCursor = LoadCursor(0, IDC_ARROW); + ourClass.hbrBackground= GetStockObject(BLACK_BRUSH); + + if ( RegisterClass(&ourClass) == 0 ) + return -1; + + /* add global atom */ + ourAtom = GlobalAddAtom( "FreeType.Surface" ); + + return 0; + } + + static void + gr_win32_device_done( void ) + { + GlobalDeleteAtom( ourAtom ); + } + + + grDevice gr_win32_device = + { + sizeof( grWin32Surface ), + "win32", + + gr_win32_device_init, + gr_win32_device_done, + + (grDeviceInitSurfaceFunc) gr_win32_surface_init, + + 0, + 0 + }; + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/win32/grwin32.h freetype-2.8/=unpacked-tar2=/graph/win32/grwin32.h --- freetype-2.7.1/=unpacked-tar2=/graph/win32/grwin32.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/win32/grwin32.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,44 @@ +/******************************************************************* + * + * grwin32.h graphics driver for Win32 platform (header) + * + * This is the driver for displaying inside a window under Win32, + * used by the graphics utility of the FreeType test suite. + * + * Written by Antoine Leca. + * Copyright 1999-2000, 2001, 2002 by Antoine Leca, David Turner + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * Borrowing liberally from the other FreeType drivers. + * + * 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 GRWIN32_H_ +#define GRWIN32_H_ + +#include "grobjs.h" + + extern + grDevice gr_win32_device; + +#ifdef GR_INIT_BUILD + static + grDeviceChain gr_win32_device_chain = + { + "win32", + &gr_win32_device, + GR_INIT_DEVICE_CHAIN + }; + +#undef GR_INIT_DEVICE_CHAIN +#define GR_INIT_DEVICE_CHAIN &gr_win32_device_chain + +#endif /* GR_INIT_BUILD */ + +#endif /* GRWIN32_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/win32/Jamfile freetype-2.8/=unpacked-tar2=/graph/win32/Jamfile --- freetype-2.7.1/=unpacked-tar2=/graph/win32/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/win32/Jamfile 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,19 @@ +# FreeType2 demos graph/win32 Jamfile (c) 2001 David Turner +# + +SubDir FT2DEMO_TOP graph win32 ; + +SubDirHdrs $(GRAPH_INCLUDE) ; + +if $(JAM_TOOLSET) = MINGW +{ + GRAPH_LINKLIBS = "-luser32 -lgdi32" ; +} +else +{ + GRAPH_LINKLIBS = user32.lib gdi32.lib ; +} + +Library $(GRAPH_LIB) : grwin32.c ; + +# end of graph/win32 Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/win32/rules.mk freetype-2.8/=unpacked-tar2=/graph/win32/rules.mk --- freetype-2.7.1/=unpacked-tar2=/graph/win32/rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/win32/rules.mk 2015-09-25 05:43:49.000000000 +0000 @@ -0,0 +1,51 @@ +#************************************************************************** +#* +#* Win32 specific rules file, used to compile the Win32 graphics driver +#* to the graphics subsystem +#* +#************************************************************************** + +ifeq ($(PLATFORM),win32) + + # directory of the Win32 graphics driver + # + GR_WIN32 := $(GRAPH)/win32 + + # add the Win32 driver object file to the graphics library `graph.lib' + # + GRAPH_OBJS += $(OBJ_DIR_2)/grwin32.$O + + DEVICES += WIN32 + + # the rule used to compile the graphics driver + # + $(OBJ_DIR_2)/grwin32.$O: $(GR_WIN32)/grwin32.c $(GR_WIN32)/grwin32.h + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_WIN32)) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + + # now update COMPILE_GRAPH_LIB according to the compiler used on Win32 + # + ifeq ($(firstword $(CC)),gcc) # test for GCC + GRAPH_LINK += -luser32 -lgdi32 + endif + + ifeq ($(findstring $(CC),cl icl), $(CC)) # test for Visual C++ & Intel C++ + COMPILE_GRAPH_LIB = lib /nologo /out:$(subst /,$(COMPILER_SEP),$(GRAPH_LIB) $(GRAPH_OBJS)) + LINK = cl /nologo /MD /Fe$(subst /,$(COMPILER_SEP),$@ $< $(FTLIB)) + GRAPH_LINK += user32.lib gdi32.lib + endif + + ifeq ($(CC),lcc) # test for LCC-Win32 + COMPILE_GRAPH_LIB = lcclib /out:$(subst /,$(COMPILER_SEP),$(GRAPH_LIB) $(GRAPH_OBJS)) + LINK = lcclnk -o $(subst /,$(COMPILER_SEP),$@ $< $(FTLIB)) + GRAPH_LINK += user32.lib gdi32.lib + endif + + ifeq ($(CC),bcc32) # test for Borland C++ + COMPILE_GRAPH_LIB = tlib /u $(subst /,$(COMPILER_SEP),$(GRAPH_LIB) $(GRAPH_OBJS:%=+%)) + LINK = bcc32 -e$(subst /,$(COMPILER_SEP),$@ $< $(FTLIB)) + endif +endif + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/x11/grx11.c freetype-2.8/=unpacked-tar2=/graph/x11/grx11.c --- freetype-2.7.1/=unpacked-tar2=/graph/x11/grx11.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/x11/grx11.c 2016-10-19 04:55:23.000000000 +0000 @@ -0,0 +1,1598 @@ +/******************************************************************* + * + * grx11.c graphics driver for X11. + * + * This is the driver for displaying inside a window under X11, + * used by the graphics utility of the FreeType test suite. + * + * Copyright 1999-2002, 2005, 2006, 2013 by Antoine Leca, + * 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. + * + ******************************************************************/ + +#ifdef __VMS +#include +#endif + +#include +#include + +#define xxTEST + +#ifdef TEST +#include "grfont.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "grx11.h" + + +#if defined( __cplusplus ) || defined( c_plusplus ) +#define Class c_class +#else +#define Class class +#endif + + /* old trick to determine 32-bit integer type */ +#include + + /* The number of bytes in an `int' type. */ +#if UINT_MAX == 0xFFFFFFFFUL +#define GR_SIZEOF_INT 4 +#elif UINT_MAX == 0xFFFFU +#define GR_SIZEOF_INT 2 +#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU +#define GR_SIZEOF_INT 8 +#else +#error "Unsupported number of bytes in `int' type!" +#endif + + /* The number of bytes in a `long' type. */ +#if ULONG_MAX == 0xFFFFFFFFUL +#define GR_SIZEOF_LONG 4 +#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU +#define GR_SIZEOF_LONG 8 +#else +#error "Unsupported number of bytes in `long' type!" +#endif + +#if GR_SIZEOF_INT == 4 +typedef int int32; +typedef unsigned int uint32; +#elif GR_SIZEOF_LONG == 4 +typedef long int32; +typedef unsigned long uint32; +#else +#error "could not find a 32-bit integer type" +#endif + + + typedef struct Translator + { + KeySym xkey; + grKey grkey; + + } Translator; + + + static + Translator key_translators[] = + { + { XK_BackSpace, grKeyBackSpace }, + { XK_Tab, grKeyTab }, + { XK_Return, grKeyReturn }, + { XK_Escape, grKeyEsc }, + { XK_Home, grKeyHome }, + { XK_Left, grKeyLeft }, + { XK_Up, grKeyUp }, + { XK_Right, grKeyRight }, + { XK_Down, grKeyDown }, + { XK_Page_Up, grKeyPageUp }, + { XK_Page_Down, grKeyPageDown }, + { XK_End, grKeyEnd }, + { XK_Begin, grKeyHome }, + { XK_F1, grKeyF1 }, + { XK_F2, grKeyF2 }, + { XK_F3, grKeyF3 }, + { XK_F4, grKeyF4 }, + { XK_F5, grKeyF5 }, + { XK_F6, grKeyF6 }, + { XK_F7, grKeyF7 }, + { XK_F8, grKeyF8 }, + { XK_F9, grKeyF9 }, + { XK_F10, grKeyF10 }, + { XK_F11, grKeyF11 }, + { XK_F12, grKeyF12 } + }; + + typedef XPixmapFormatValues XDepth; + + +#ifdef TEST +#define grAlloc malloc +#endif + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** PIXEL BLITTING SUPPORT *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + typedef struct grX11Blitter_ + { + unsigned char* src_line; + int src_pitch; + + unsigned char* dst_line; + int dst_pitch; + + int x; + int y; + int width; + int height; + + } grX11Blitter; + + + /* setup blitter; returns 1 if no drawing happens */ + static int + gr_x11_blitter_reset( grX11Blitter* blit, + grBitmap* source, + grBitmap* target, + int x, + int y, + int width, + int height ) + { + long pitch; + int delta; + + + /* clip rectangle to source bitmap */ + if ( x < 0 ) + { + width += x; + x = 0; + } + + delta = x + width - source->width; + if ( delta > 0 ) + width -= delta; + + if ( y < 0 ) + { + height += y; + y = 0; + } + + delta = y + height - source->rows; + if ( delta > 0 ) + height -= delta; + + /* clip rectangle to target bitmap */ + delta = x + width - target->width; + if ( delta > 0 ) + width -= delta; + + delta = y + height - target->rows; + if ( delta > 0 ) + height -= delta; + + if ( width <= 0 || height <= 0 ) + return 1; + + /* now, setup the blitter */ + pitch = blit->src_pitch = source->pitch; + + blit->src_line = source->buffer + y * pitch; + if ( pitch < 0 ) + blit->src_line -= ( source->rows - 1 ) * pitch; + + pitch = blit->dst_pitch = target->pitch; + + blit->dst_line = target->buffer + y * pitch; + if ( pitch < 0 ) + blit->dst_line -= ( target->rows - 1 ) * pitch; + + blit->x = x; + blit->y = y; + blit->width = width; + blit->height = height; + + return 0; + } + + + typedef void (*grX11ConvertFunc)( grX11Blitter* blit ); + + typedef struct grX11FormatRec_ + { + int x_depth; + int x_bits_per_pixel; + unsigned long x_red_mask; + unsigned long x_green_mask; + unsigned long x_blue_mask; + + grX11ConvertFunc rgb_convert; + grX11ConvertFunc gray_convert; + + } grX11Format; + + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR RGB565 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_rgb565( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 2; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned short* lwrite = (unsigned short*)line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite++ ) + { + unsigned int r = lread[0]; + unsigned int g = lread[1]; + unsigned int b = lread[2]; + + + lwrite[0] = (unsigned short)( ( ( r << 8 ) & 0xF800U ) | + ( ( g << 3 ) & 0x07E0 ) | + ( ( b >> 3 ) & 0x001F ) ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static void + gr_x11_convert_gray_to_rgb565( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x; + unsigned char* line_write = blit->dst_line + blit->x * 2; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned short* lwrite = (unsigned short*)line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread++, lwrite++ ) + { + unsigned int p = lread[0]; + + + lwrite[0] = (unsigned short)( ( ( p << 8 ) & 0xF800U ) | + ( ( p << 3 ) & 0x07E0 ) | + ( ( p >> 3 ) & 0x001F ) ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_rgb565 = + { + 16, 16, 0xF800U, 0x07E0, 0x001F, + gr_x11_convert_rgb_to_rgb565, + gr_x11_convert_gray_to_rgb565 + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR BGR565 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_bgr565( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 2; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned short* lwrite = (unsigned short*)line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite++ ) + { + unsigned int r = lread[0]; + unsigned int g = lread[1]; + unsigned int b = lread[2]; + + + lwrite[0] = (unsigned short)( ( ( b << 8 ) & 0xF800U ) | + ( ( g << 3 ) & 0x07E0 ) | + ( ( r >> 3 ) & 0x001F ) ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_bgr565 = + { + 16, 16, 0x001F, 0x07E0, 0xF800U, + gr_x11_convert_rgb_to_bgr565, + gr_x11_convert_gray_to_rgb565 /* the same for bgr565! */ + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR RGB555 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_rgb555( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 2; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned short* lwrite = (unsigned short*)line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite++ ) + { + unsigned int r = lread[0]; + unsigned int g = lread[1]; + unsigned int b = lread[2]; + + + lwrite[0] = (unsigned short)( ( ( r << 7 ) & 0x7C00 ) | + ( ( g << 2 ) & 0x03E0 ) | + ( ( b >> 3 ) & 0x001F ) ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static void + gr_x11_convert_gray_to_rgb555( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x; + unsigned char* line_write = blit->dst_line + blit->x * 2; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned short* lwrite = (unsigned short*)line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread++, lwrite++ ) + { + unsigned int p = lread[0]; + + + lwrite[0] = (unsigned short)( ( ( p << 7 ) & 0x7C00 ) | + ( ( p << 2 ) & 0x03E0 ) | + ( ( p >> 3 ) & 0x001F ) ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_rgb555 = + { + 15, 16, 0x7C00, 0x03E0, 0x001F, + gr_x11_convert_rgb_to_rgb555, + gr_x11_convert_gray_to_rgb555 + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR BGR555 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_bgr555( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 2; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned short* lwrite = (unsigned short*)line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite++ ) + { + unsigned int r = lread[0]; + unsigned int g = lread[1]; + unsigned int b = lread[2]; + + + lwrite[0] = (unsigned short)( ( ( b << 7 ) & 0x7C00 ) | + ( ( g << 2 ) & 0x03E0 ) | + ( ( r >> 3 ) & 0x001F ) ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_bgr555 = + { + 15, 16, 0x001F, 0x03E0, 0x7C00, + gr_x11_convert_rgb_to_bgr555, + gr_x11_convert_gray_to_rgb555 /* the same for bgr555! */ + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR RGB888 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_rgb888( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 3; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + memcpy( line_write, line_read, (unsigned int)( blit->width * 3 ) ); + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static void + gr_x11_convert_gray_to_rgb888( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x; + unsigned char* line_write = blit->dst_line + blit->x * 3; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread++, lwrite += 3 ) + { + unsigned char p = lread[0]; + + + lwrite[0] = p; + lwrite[1] = p; + lwrite[2] = p; + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_rgb888 = + { + 24, 24, 0xFF0000L, 0x00FF00U, 0x0000FF, + gr_x11_convert_rgb_to_rgb888, + gr_x11_convert_gray_to_rgb888 + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR BGR888 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_bgr888( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 3; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite += 3 ) + { + lwrite[0] = lread[2]; + lwrite[1] = lread[1]; + lwrite[2] = lread[0]; + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_bgr888 = + { + 24, 24, 0x0000FF, 0x00FF00U, 0xFF0000L, + gr_x11_convert_rgb_to_bgr888, + gr_x11_convert_gray_to_rgb888 /* the same for bgr888 */ + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR RGB8880 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_rgb8880( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 4; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite += 4 ) + { + uint32 r = lread[0]; + uint32 g = lread[1]; + uint32 b = lread[2]; + + + *(uint32*)lwrite = ( r << 24 ) | + ( g << 16 ) | + ( b << 8 ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static void + gr_x11_convert_gray_to_rgb8880( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x; + unsigned char* line_write = blit->dst_line + blit->x*4; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread ++, lwrite += 4 ) + { + uint32 p = lread[0]; + + + *(uint32*)lwrite = ( p << 24 ) | + ( p << 16 ) | + ( p << 8 ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_rgb8880 = + { + 24, 32, 0xFF000000UL, 0x00FF0000L, 0x0000FF00U, + gr_x11_convert_rgb_to_rgb8880, + gr_x11_convert_gray_to_rgb8880 + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR RGB0888 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_rgb0888( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 4; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite += 4 ) + { + uint32 r = lread[0]; + uint32 g = lread[1]; + uint32 b = lread[2]; + + + *(uint32*)lwrite = ( r << 16 ) | + ( g << 8 ) | + ( b << 0 ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static void + gr_x11_convert_gray_to_rgb0888( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x; + unsigned char* line_write = blit->dst_line + blit->x * 4; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread ++, lwrite += 4 ) + { + uint32 p = lread[0]; + + + *(uint32*)lwrite = ( p << 16 ) | + ( p << 8 ) | + ( p << 0 ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_rgb0888 = + { + 24, 32, 0x00FF0000L, 0x0000FF00U, 0x000000FF, + gr_x11_convert_rgb_to_rgb0888, + gr_x11_convert_gray_to_rgb0888 + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR BGR8880 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_bgr8880( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 4; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite += 4 ) + { + uint32 r = lread[0]; + uint32 g = lread[1]; + uint32 b = lread[2]; + + + *(uint32*)lwrite = ( r << 8 ) | + ( g << 16 ) | + ( b << 24 ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_bgr8880 = + { + 24, 32, 0x0000FF00U, 0x00FF0000L, 0xFF000000UL, + gr_x11_convert_rgb_to_bgr8880, + gr_x11_convert_gray_to_rgb8880 /* the same for bgr8880 */ + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** BLITTING ROUTINES FOR BGR0888 *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static void + gr_x11_convert_rgb_to_bgr0888( grX11Blitter* blit ) + { + unsigned char* line_read = blit->src_line + blit->x * 3; + unsigned char* line_write = blit->dst_line + blit->x * 4; + int h = blit->height; + + + for ( ; h > 0; h-- ) + { + unsigned char* lread = line_read; + unsigned char* lwrite = line_write; + int x = blit->width; + + + for ( ; x > 0; x--, lread += 3, lwrite += 4 ) + { + uint32 r = lread[0]; + uint32 g = lread[1]; + uint32 b = lread[2]; + + + *(uint32*)lwrite = ( r << 0 ) | + ( g << 8 ) | + ( b << 16 ); + } + + line_read += blit->src_pitch; + line_write += blit->dst_pitch; + } + } + + + static const grX11Format gr_x11_format_bgr0888 = + { + 24, 32, 0x000000FF, 0x0000FF00U, 0x00FF0000L, + gr_x11_convert_rgb_to_bgr0888, + gr_x11_convert_gray_to_rgb0888 /* the same for bgr0888 */ + }; + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** X11 DEVICE SUPPORT *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + static const grX11Format* gr_x11_formats[] = + { + &gr_x11_format_rgb565, + &gr_x11_format_bgr565, + &gr_x11_format_rgb555, + &gr_x11_format_bgr555, + &gr_x11_format_rgb888, + &gr_x11_format_bgr888, + &gr_x11_format_rgb0888, + &gr_x11_format_bgr0888, + &gr_x11_format_rgb8880, + &gr_x11_format_bgr8880, + NULL + }; + + typedef struct grX11DeviceRec_ + { + Display* display; + Cursor idle; + Cursor busy; + const grX11Format* format; + int scanline_pad; + Visual* visual; + + } grX11Device; + + + static grX11Device x11dev; + + + static void + gr_x11_device_done( void ) + { + if ( x11dev.display ) + { + XFreeCursor( x11dev.display, x11dev.busy ); + XFreeCursor( x11dev.display, x11dev.idle ); + + XCloseDisplay( x11dev.display ); + x11dev.display = NULL; + } + } + + + static int + gr_x11_device_init( void ) + { + memset( &x11dev, 0, sizeof ( x11dev ) ); + + XrmInitialize(); + + x11dev.display = XOpenDisplay( "" ); + if ( !x11dev.display ) + { + fprintf( stderr, "cannot open X11 display\n" ); + return -1; + } + + x11dev.idle = XCreateFontCursor( x11dev.display, XC_left_ptr ); + x11dev.busy = XCreateFontCursor( x11dev.display, XC_watch ); + + { + int count; + XDepth* format; + XDepth* formats; + XVisualInfo templ; + + templ.screen = DefaultScreen( x11dev.display ); + formats = XListPixmapFormats( x11dev.display, &count ); + +#ifdef TEST + printf( "available pixmap formats\n" ); + printf( "depth pixbits scanpad\n" ); +#endif /* TEST */ + + for ( format = formats; count > 0; count--, format++ ) + { +#ifdef TEST + printf( " %3d %3d %3d\n", + format->depth, + format->bits_per_pixel, + format->scanline_pad ); +#endif /* TEST */ + + /* note, the 32-bit modes return a depth of 24, */ + /* and 32 bits per pixel */ + switch ( format->depth ) + { + case 16: + case 24: + case 32: + { + int count2; + XVisualInfo* visual; + XVisualInfo* visuals; + + templ.depth = format->depth; + visuals = XGetVisualInfo( x11dev.display, + VisualScreenMask | VisualDepthMask, + &templ, + &count2 ); + + for ( visual = visuals; count2 > 0; count2--, visual++ ) + { +#ifdef TEST + const char* visualClass; + + switch ( visual->Class ) + { + case TrueColor: + visualClass = "TrueColor"; + break; + case DirectColor: + visualClass = "DirectColor"; + break; + case PseudoColor: + visualClass = "PseudoColor"; + break; + case StaticGray: + visualClass = "StaticGray"; + break; + case StaticColor: + visualClass = "StaticColor"; + break; + case GrayScale: + visualClass = "GrayScale"; + break; + default: + visualClass = "unknown"; + } + + printf( "> RGB %04lx:%04lx:%04lx, colors %3d, bits %2d %s\n", + visual->red_mask, + visual->green_mask, + visual->blue_mask, + visual->colormap_size, + visual->bits_per_rgb, + visualClass ); +#endif /* TEST */ + + /* compare to the list of supported formats */ + { + const grX11Format** pcur_format = gr_x11_formats; + const grX11Format* cur_format; + + + for (;;) + { + cur_format = *pcur_format++; + if ( cur_format == NULL ) + break; + + if ( format->depth == cur_format->x_depth && + format->bits_per_pixel == cur_format->x_bits_per_pixel && + visual->red_mask == cur_format->x_red_mask && + visual->green_mask == cur_format->x_green_mask && + visual->blue_mask == cur_format->x_blue_mask ) + { + x11dev.format = cur_format; + x11dev.scanline_pad = format->scanline_pad; + x11dev.visual = visual->visual; + + XFree( visuals ); + XFree( formats ); + return 0; + } + } + } + } /* for visuals */ + + XFree( visuals ); + } + break; + + default: + ; + } /* switch format depth */ + } /* for formats */ + XFree( formats ); + } + + fprintf( stderr, "unsupported X11 display depth!\n" ); + + return -1; + } + + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** X11 SURFACE SUPPORT *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ + + typedef struct grX11Surface_ + { + grSurface root; + Display* display; + Window win; + Visual* visual; + Colormap colormap; + GC gc; + int depth; + XImage* ximage; + grBitmap ximage_bitmap; + + const grX11Format* format; + grX11ConvertFunc convert; + + int win_org_x, win_org_y; + int win_width, win_height; + int image_width, image_height; + + char key_buffer[10]; + int key_cursor; + int key_number; + + } grX11Surface; + + + /* close a given window */ + static void + gr_x11_surface_done( grX11Surface* surface ) + { + Display* display = surface->display; + + + if ( display ) + { + XFreeGC( display, surface->gc ); + + if ( surface->ximage ) + { + XDestroyImage( surface->ximage ); + surface->ximage = 0; + } + + if ( surface->win ) + { + XUnmapWindow( display, surface->win ); + surface->win = 0; + } + } + } + + + static void + gr_x11_surface_refresh_rect( grX11Surface* surface, + int x, + int y, + int w, + int h ) + { + grX11Blitter blit; + + + if ( !gr_x11_blitter_reset( &blit, &surface->root.bitmap, + &surface->ximage_bitmap, + x, y, w, h ) ) + { + surface->convert( &blit ); + + XPutImage( surface->display, + surface->win, + surface->gc, + surface->ximage, + blit.x, blit.y, + blit.x, blit.y, + (unsigned int)blit.width, (unsigned int)blit.height ); + } + } + + + static void + gr_x11_surface_refresh( grX11Surface* surface ) + { + gr_x11_surface_refresh_rect( surface, 0, 0, + surface->root.bitmap.width, + surface->root.bitmap.rows ); + } + + + static void + gr_x11_surface_set_title( grX11Surface* surface, + const char* title ) + { + XStoreName( surface->display, surface->win, title ); + } + + + static grKey + KeySymTogrKey( KeySym key ) + { + grKey k; + int count = sizeof ( key_translators ) / + sizeof( key_translators[0] ); + Translator* trans = key_translators; + Translator* limit = trans + count; + + + k = grKeyNone; + + while ( trans < limit ) + { + if ( trans->xkey == key ) + { + k = trans->grkey; + break; + } + trans++; + } + + return k; + } + + + static void + gr_x11_surface_listen_event( grX11Surface* surface, + int event_mask, + grEvent* grevent ) + { + XEvent x_event; + KeySym key; + Display* display = surface->display; + + int bool_exit; + grKey grkey; + + XComposeStatus compose; + + /* XXX: for now, ignore the event mask, and only exit when */ + /* a key is pressed */ + (void)event_mask; + + bool_exit = surface->key_cursor < surface->key_number; + + XDefineCursor( display, surface->win, x11dev.idle ); + + while ( !bool_exit ) + { + XNextEvent( display, &x_event ); + + switch ( x_event.type ) + { + case KeyPress: + surface->key_number = XLookupString( &x_event.xkey, + surface->key_buffer, + sizeof ( surface->key_buffer ), + &key, + &compose ); + surface->key_cursor = 0; + + if ( surface->key_number == 0 || + key > 512 ) + { + /* this may be a special key like F1, F2, etc. */ + grkey = KeySymTogrKey( key ); + if ( grkey != grKeyNone ) + goto Set_Key; + } + else + bool_exit = 1; + break; + + case MappingNotify: + XRefreshKeyboardMapping( &x_event.xmapping ); + break; + + case Expose: +#if 1 + /* we don't need to convert the bits on each expose! */ + XPutImage( surface->display, + surface->win, + surface->gc, + surface->ximage, + x_event.xexpose.x, + x_event.xexpose.y, + x_event.xexpose.x, + x_event.xexpose.y, + (unsigned int)x_event.xexpose.width, + (unsigned int)x_event.xexpose.height ); +#else + gr_x11_surface_refresh_rectangle( surface, + x_event.xexpose.x, + x_event.xexpose.y, + x_event.xexpose.width, + x_event.xexpose.height ); +#endif + break; + + /* You should add more cases to handle mouse events, etc. */ + } + } + + XDefineCursor( display, surface->win, x11dev.busy ); + XFlush ( display ); + + /* now, translate the keypress to a grKey; */ + /* if this wasn't part of the simple translated keys, */ + /* simply get the charcode from the character buffer */ + grkey = grKEY( surface->key_buffer[surface->key_cursor++] ); + + Set_Key: + grevent->type = gr_key_down; + grevent->key = grkey; + } + + + static int + gr_x11_surface_init( grX11Surface* surface, + grBitmap* bitmap ) + { + Display* display; + int screen; + grBitmap* pximage = &surface->ximage_bitmap; + const grX11Format* format; + + + surface->key_number = 0; + surface->key_cursor = 0; + surface->display = display = x11dev.display; + + screen = DefaultScreen( display ); + + surface->depth = x11dev.format->x_depth; + surface->visual = x11dev.visual; + + surface->format = format = x11dev.format; + surface->root.bitmap = *bitmap; + + switch ( bitmap->mode ) + { + case gr_pixel_mode_rgb24: + surface->convert = format->rgb_convert; + break; + + case gr_pixel_mode_gray: + /* we only support 256-gray level 8-bit pixmaps */ + if ( bitmap->grays == 256 ) + { + surface->convert = format->gray_convert; + break; + } + + default: + /* we don't support other modes */ + return 0; + } + + /* allocate surface image */ + { + int bits, over; + + + bits = bitmap->width * format->x_bits_per_pixel; + over = bits % x11dev.scanline_pad; + + if ( over ) + bits += x11dev.scanline_pad - over; + + pximage->pitch = bits >> 3; + pximage->width = bitmap->width; + pximage->rows = bitmap->rows; + } + + pximage->buffer = (unsigned char*)grAlloc( + (unsigned long)( pximage->pitch * pximage->rows ) ); + if ( !pximage->buffer ) + return 0; + + /* create the bitmap */ + if ( grNewBitmap( bitmap->mode, + bitmap->grays, + bitmap->width, + bitmap->rows, + bitmap ) ) + return 0; + + surface->root.bitmap = *bitmap; + + /* Now create the surface X11 image */ + surface->ximage = XCreateImage( display, + surface->visual, + (unsigned int)format->x_depth, + ZPixmap, + 0, + (char*)pximage->buffer, + (unsigned int)pximage->width, + (unsigned int)pximage->rows, + x11dev.scanline_pad, + 0 ); + if ( !surface->ximage ) + return 0; + + { + XColor color, dummy; + XTextProperty xtp; + XSizeHints xsh; + XSetWindowAttributes xswa; + unsigned long xswa_mask = CWBackPixel | CWEventMask | CWCursor; + + pid_t pid; + Atom NET_WM_PID; + + + xswa.border_pixel = BlackPixel( display, screen ); + + if (surface->visual == DefaultVisual( display, screen ) ) + { + xswa.background_pixel = WhitePixel( display, screen ); + surface->colormap = DefaultColormap( display, screen ); + } + else + { + xswa_mask |= CWColormap | CWBorderPixel; + xswa.colormap = XCreateColormap( display, + RootWindow( display, screen ), + surface->visual, + AllocNone ); + XAllocNamedColor( display, xswa.colormap, "white", &color, &dummy ); + xswa.background_pixel = color.pixel; + surface->colormap = xswa.colormap; + } + + xswa.cursor = x11dev.busy; + + xswa.event_mask = KeyPressMask | ExposureMask; + + surface->win = XCreateWindow( display, + RootWindow( display, screen ), + 0, + 0, + (unsigned int)bitmap->width, + (unsigned int)bitmap->rows, + 10, + format->x_depth, + InputOutput, + surface->visual, + xswa_mask, + &xswa ); + + XMapWindow( display, surface->win ); + + surface->gc = XCreateGC( display, surface->win, + 0L, NULL ); + XSetForeground( display, surface->gc, xswa.border_pixel ); + XSetBackground( display, surface->gc, xswa.background_pixel ); + + /* make window manager happy :-) */ + xtp.value = (unsigned char*)"FreeType"; + xtp.encoding = 31; + xtp.format = 8; + xtp.nitems = strlen( (char*)xtp.value ); + + xsh.x = 0; + xsh.y = 0; + + xsh.width = bitmap->width; + xsh.height = bitmap->rows; + xsh.flags = PPosition | PSize; + xsh.flags = 0; + + XSetWMProperties( display, surface->win, &xtp, &xtp, + NULL, 0, &xsh, NULL, NULL ); + + pid = getpid(); + NET_WM_PID = XInternAtom( display, "_NET_WM_PID", False ); + XChangeProperty( display, surface->win, NET_WM_PID, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&pid, 1 ); + } + + surface->root.done = (grDoneSurfaceFunc)gr_x11_surface_done; + surface->root.refresh_rect = (grRefreshRectFunc)gr_x11_surface_refresh_rect; + surface->root.set_title = (grSetTitleFunc) gr_x11_surface_set_title; + surface->root.listen_event = (grListenEventFunc)gr_x11_surface_listen_event; + + gr_x11_surface_refresh( surface ); + + return 1; + } + + + grDevice gr_x11_device = + { + sizeof( grX11Surface ), + "x11", + + gr_x11_device_init, + gr_x11_device_done, + + (grDeviceInitSurfaceFunc) gr_x11_surface_init, + + 0, + 0 + }; + + +#ifdef TEST + + typedef struct grKeyName + { + grKey key; + const char* name; + + } grKeyName; + + + static const grKeyName key_names[] = + { + { grKeyF1, "F1" }, + { grKeyF2, "F2" }, + { grKeyF3, "F3" }, + { grKeyF4, "F4" }, + { grKeyF5, "F5" }, + { grKeyF6, "F6" }, + { grKeyF7, "F7" }, + { grKeyF8, "F8" }, + { grKeyF9, "F9" }, + { grKeyF10, "F10" }, + { grKeyF11, "F11" }, + { grKeyF12, "F12" }, + { grKeyEsc, "Esc" }, + { grKeyHome, "Home" }, + { grKeyEnd, "End" }, + + { grKeyPageUp, "Page_Up" }, + { grKeyPageDown, "Page_Down" }, + { grKeyLeft, "Left" }, + { grKeyRight, "Right" }, + { grKeyUp, "Up" }, + { grKeyDown, "Down" }, + { grKeyBackSpace, "BackSpace" }, + { grKeyReturn, "Return" } + }; + + +#if 0 + int + main( void ) + { + grSurface* surface; + int n; + + + grInit(); + surface = grNewScreenSurface( 0, gr_pixel_mode_gray, 320, 400, 128 ); + if ( !surface ) + Panic( "Could not create window\n" ); + else + { + grColor color; + grEvent event; + const char* string; + int x; + + + grSetSurfaceRefresh( surface, 1 ); + grSetTitle( surface, "X11 driver demonstration" ); + + for ( x = -10; x < 10; x++ ) + { + for ( n = 0; n < 128; n++ ) + { + color.value = ( n * 3 ) & 127; + grWriteCellChar( surface, + x + ( ( n % 60 ) << 3 ), + 80 + ( x + 10 ) * 8 * 3 + ( ( n / 60 ) << 3 ), + n, color ); + } + } + + color.value = 64; + grWriteCellString( surface, 0, 0, "just an example", color ); + + do + { + listen_event( (grXSurface*)surface, 0, &event ); + + /* return if ESC was pressed */ + if ( event.key == grKeyEsc ) + return 0; + + /* otherwise, display key name */ + color.value = ( color.value + 8 ) & 127; + { + int count = sizeof ( key_names ) / sizeof ( key_names[0] ); + grKeyName* name = key_names; + grKeyName* limit = name + count; + const char* kname = 0; + char kname_temp[16]; + + + while ( name < limit ) + { + if ( name->key == event.key ) + { + kname = name->name; + break; + } + name++; + } + + if ( !kname ) + { + sprintf( kname_temp, "char '%c'", (char)event.key ); + kname = kname_temp; + } + + grWriteCellString( surface, 30, 30, kname, color ); + grRefreshSurface( surface ); + paint_rectangle( surface, 0, 0, + surface->bitmap.width, surface->bitmap.rows ); + } + } while ( 1 ); + } + + return 0; + } +#endif /* O */ +#endif /* TEST */ + + +/* END */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/x11/grx11.h freetype-2.8/=unpacked-tar2=/graph/x11/grx11.h --- freetype-2.7.1/=unpacked-tar2=/graph/x11/grx11.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/x11/grx11.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,46 @@ +/******************************************************************* + * + * grx11.h graphics driver for X11 (header) + * + * This is the driver for displaying inside a window under X11, + * used by the graphics utility of the FreeType test suite. + * + * Copyright 1999-2000, 2001, 2002 by Antoine Leca, David Turner + * 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 GRX11_H_ +#define GRX11_H_ + +#ifdef __cplusplus +#define class c_class +#endif + +#include "grobjs.h" +#include "grdevice.h" + + extern + grDevice gr_x11_device; + +#ifdef GR_INIT_BUILD + static + grDeviceChain gr_x11_device_chain = + { + "x11", + &gr_x11_device, + GR_INIT_DEVICE_CHAIN + }; + +#undef GR_INIT_DEVICE_CHAIN +#define GR_INIT_DEVICE_CHAIN &gr_x11_device_chain + +#endif /* GR_INIT_BUILD */ + +#endif /* GRX11_H_ */ diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/x11/Jamfile freetype-2.8/=unpacked-tar2=/graph/x11/Jamfile --- freetype-2.7.1/=unpacked-tar2=/graph/x11/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/x11/Jamfile 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,12 @@ +# FreeType2 demos graph/x11 Jamfile (c) 2001 David Turner +# + +SubDir FT2DEMO_TOP graph x11 ; + +SubDirHdrs $(GRAPH_INCLUDE) ; + +GRAPH_LINKLIBS = -lX11 -L/usr/X11R6/lib ; + +Library $(GRAPH_LIB) : grx11.c ; + +# end of graph/x11 Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/x11/rules.mk freetype-2.8/=unpacked-tar2=/graph/x11/rules.mk --- freetype-2.7.1/=unpacked-tar2=/graph/x11/rules.mk 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/x11/rules.mk 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,116 @@ +#************************************************************************** +#* +#* X11-specific rules files, used to compile the X11 graphics driver +#* when supported by the current platform +#* +#************************************************************************** + + +######################################################################### +# +# Try to detect an X11 setup. +# +# We try to detect the following directories (in that order) in the current +# path: +# +# X11 (usually a symlink to the current release) +# X11R6 +# X11R5 +# +# If no success, we directly check the directories +# +# /usr +# /usr/X11R6 +# /usr/local/X11R6 +# +# whether they contain `include/X11/Xlib.h'. Note that the Makefile +# silently assumes that they will also contain `lib/X11/libX11.(a|so)'. +# +# If the variable X11_PATH is set (to specify unusual locations of X11), no +# other directory is searched. More than one directory must be separated +# with spaces. Example: +# +# make X11_PATH="/usr/openwin /usr/local/X11R6" +# +FT_PATH := $(subst ;, ,$(subst :, ,$(subst $(SEP),/,$(PATH)))) + +ifndef X11_PATH + ifneq ($(findstring X11/bin,$(FT_PATH)),) + xversion := X11 + else + ifneq ($(findstring X11R6/bin,$(FT_PATH)),) + xversion := X11R6 + else + ifneq ($(findstring X11R5/bin,$(FT_PATH)),) + xversion := X11R5 + endif + endif + endif + + ifdef xversion + X11_PATH := $(filter %$(xversion)/bin,$(FT_PATH)) + X11_PATH := $(X11_PATH:%/bin=%) + else + X11_DIRS := /usr /usr/X11R6 /usr/local/X11R6 + X11_XLIB := include/X11/Xlib.h + X11_PATH := $(foreach dir,$(X11_DIRS),$(wildcard $(dir)/$(X11_XLIB))) + X11_PATH := $(X11_PATH:%/$(X11_XLIB)=%) + endif +endif + + +########################################################################## +# +# Update some variables to compile the X11 graphics module. Note that +# X11 is available on Unix, or on OS/2. However, it only compiles with +# gcc on the latter platform, which is why it is safe to use the flags +# `-L' and `-l' in GRAPH_LINK. +# +ifneq ($(X11_PATH),) + + X11_INCLUDE := $(subst /,$(COMPILER_SEP),$(X11_PATH:%=%/include)) + X11_LIB := $(subst /,$(COMPILER_SEP),$(X11_PATH:%=%/lib64) \ + $(X11_PATH:%=%/lib)) + + # The GRAPH_LINK variable is expanded each time an executable is linked + # against the graphics library. + # + ifeq ($(PLATFORM),unix) + GRAPH_LINK += $(X11_LIB:%=-R%) + endif + GRAPH_LINK += $(X11_LIB:%=-L%) -lX11 + + # Solaris needs a -lsocket in GRAPH_LINK. + # + UNAME := $(shell uname) + ifneq ($(findstring $(UNAME),SunOS Solaris),) + GRAPH_LINK += -lsocket + endif + + + # Add the X11 driver object file to the graphics library. + # + GRAPH_OBJS += $(OBJ_DIR_2)/grx11.$(O) + + GR_X11 := $(GRAPH)/x11 + + DEVICES += X11 + + # the rule used to compile the X11 driver + # + $(OBJ_DIR_2)/grx11.$(O): $(GR_X11)/grx11.c $(GR_X11)/grx11.h + ifneq ($(LIBTOOL),) + $(LIBTOOL) --mode=compile $(CC) -static $(CFLAGS) \ + $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_X11)) \ + $(X11_INCLUDE:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + else + $(CC) $(CFLAGS) $(GRAPH_INCLUDES:%=$I%) \ + $I$(subst /,$(COMPILER_SEP),$(GR_X11)) \ + $(X11_INCLUDE:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + endif +endif + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/graph/xtest.c freetype-2.8/=unpacked-tar2=/graph/xtest.c --- freetype-2.7.1/=unpacked-tar2=/graph/xtest.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/graph/xtest.c 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,125 @@ +#include "graph.h" +#include "grfont.h" /* dispara^itra bientot */ +#include + + +static +void Panic( const char* message ) +{ + fprintf( stderr, "PANIC: %s\n", message ); + exit(1); +} + + +typedef struct grKeyName +{ + grKey key; + const char* name; + +} grKeyName; + + +static +const grKeyName key_names[] = +{ + { grKeyF1, "F1" }, + { grKeyF2, "F2" }, + { grKeyF3, "F3" }, + { grKeyF4, "F4" }, + { grKeyF5, "F5" }, + { grKeyF6, "F6" }, + { grKeyF7, "F7" }, + { grKeyF8, "F8" }, + { grKeyF9, "F9" }, + { grKeyF10, "F10" }, + { grKeyF11, "F11" }, + { grKeyF12, "F12" }, + { grKeyEsc, "Esc" }, + { grKeyHome, "Home" }, + { grKeyEnd, "End" }, + + { grKeyPageUp, "Page_Up" }, + { grKeyPageDown, "Page_Down" }, + { grKeyLeft, "Left" }, + { grKeyRight, "Right" }, + { grKeyUp, "Up" }, + { grKeyDown, "Down" }, + { grKeyBackSpace, "BackSpace" }, + { grKeyReturn, "Return" } +}; + +int main( void ) +{ + grSurface* surface; + int n; + + grInit(); + surface = grNewScreenSurface( 0, gr_pixel_mode_gray, 320, 400, 128 ); + if (!surface) + Panic("Could not create window\n" ); + else + { + grColor color; + grEvent event; + const char* string; + int x; + + grSetSurfaceRefresh( surface, 1 ); + grSetTitle(surface,"X11 driver demonstration" ); + + for ( x = -10; x < 10; x++ ) + { + for ( n = 0; n < 128; n++ ) + { + color.value = (n*3) & 127; + grWriteCellChar( surface, + x + ((n % 60) << 3), + 80 + (x+10)*8*3 + ((n/60) << 3), n, color ); + } + + } + color.value = 64; + grWriteCellString( surface, 0, 0, "just an example", color ); + + do + { + grListenSurface( surface, 0, &event); + + /* return if ESC was pressed */ + if ( event.key == grKeyEsc ) + return 0; + + /* otherwise, display key string */ + color.value = (color.value + 8) & 127; + { + int count = sizeof(key_names)/sizeof(key_names[0]); + grKeyName* name = (grKeyName*)key_names; + grKeyName* limit = name + count; + const char* kname = 0; + char kname_temp[16]; + + while (name < limit) + { + if ( name->key == event.key ) + { + kname = (const char*)name->name; + break; + } + name++; + } + + if (!kname) + { + sprintf( kname_temp, "char '%c'", (char)event.key ); + kname = kname_temp; + } + + grWriteCellString( surface, 30, 30, kname, color ); + grRefreshSurface(surface); + } + } while (1); + } + + return 0; +} + diff -Nru freetype-2.7.1/=unpacked-tar2=/Jamfile freetype-2.8/=unpacked-tar2=/Jamfile --- freetype-2.7.1/=unpacked-tar2=/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/Jamfile 2015-09-25 05:38:49.000000000 +0000 @@ -0,0 +1,27 @@ +# FreeType2 demos top Jamfile (c) 2001 David Turner +# + +if $(FT2DEMO_TOP) != $(DOT) +{ + SubDir FT2DEMO_TOP ; +} + +# compile FreeType library here! +# +FT2_TOP ?= ../freetype2 ; + +SubInclude FT2_TOP ; + +FT2DEMO_SRC = [ FT2DEMO_SubDir src ] ; +FT2DEMO_GRAPH = [ FT2DEMO_SubDir graph ] ; + +# Include Graph sub-system rules +# +SubInclude FT2DEMO_GRAPH ; + +# Include demos rules +# +SubInclude FT2DEMO_SRC ; + + +# end of top Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/Jamrules freetype-2.8/=unpacked-tar2=/Jamrules --- freetype-2.7.1/=unpacked-tar2=/Jamrules 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/Jamrules 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,66 @@ +# FreeType 2 Demos JamRules (c) 2001 David Turner +# +# This file contains the Jam rules needed to build the FreeType 2 Demos. +# It is shared by all Jamfiles and is included only once in the build +# process. +# + + +# Determine prefix of library file. We must use "libxxxxx" on Unix systems, +# while all other simply use the real name. +# +if $(UNIX) +{ + LIBPREFIX ?= lib ; +} +else +{ + LIBPREFIX ?= "" ; +} + + +FT2_TOP ?= [ FDirName $(DOTDOT) freetype2 ] ; + +# FT2_INCLUDE contains the location of the public FreeType 2 header files +# it is ../freetype2/include by default +# +FT2_INCLUDE ?= [ FDirName $(FT2_TOP) include ] ; + + +# FT2_LIB contains the path to the FreeType 2 library object +# +FT2_LIB ?= [ FDirName $(FT2_TOP) objs $(LIBPREFIX)freetype$(SUFLIB) ] ; + +# X11_LINKLIBS is only used when compiling the X11 graphics back-end +# this should be generated from a "configure" script on Unix +# +X11_LINKLIBS = -lX11 -L/usr/X11R6/lib ; + + +# FT2DEMO_TOP contains the location of the FreeType demos directory. +# +FT2DEMO_TOP ?= $(DOT) ; + + +# Define a new rule used to declare a sub directory of the Nirvana source +# tree. +# +rule FT2DEMO_SubDir +{ + if $(FT2DEMO_TOP) = $(DOT) + { + return [ FDirName $(<) ] ; + } + else + { + return [ FDirName $(FT2DEMO_TOP) $(<) ] ; + } +} + +# We also set ALL_LOCATE_TARGET in order to place all object and library +# files in "objs". +# +ALL_LOCATE_TARGET ?= [ FT2DEMO_SubDir objs ] ; + + +# end of Jamrules diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/ascii2mpw.py freetype-2.8/=unpacked-tar2=/mac/ascii2mpw.py --- freetype-2.7.1/=unpacked-tar2=/mac/ascii2mpw.py 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/ascii2mpw.py 2015-09-25 05:40:31.000000000 +0000 @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import sys +import string + +if len( sys.argv ) == 1 : + for asc_line in sys.stdin.readlines(): + mpw_line = string.replace(asc_line, "\\xA5", "\245") + mpw_line = string.replace(mpw_line, "\\xB6", "\266") + mpw_line = string.replace(mpw_line, "\\xC4", "\304") + mpw_line = string.replace(mpw_line, "\\xC5", "\305") + mpw_line = string.replace(mpw_line, "\\xFF", "\377") + mpw_line = string.replace(mpw_line, "\n", "\r") + mpw_line = string.replace(mpw_line, "\\n", "\n") + sys.stdout.write(mpw_line) +elif sys.argv[1] == "-r" : + for mpw_line in sys.stdin.readlines(): + asc_line = string.replace(mpw_line, "\n", "\\n") + asc_line = string.replace(asc_line, "\r", "\n") + asc_line = string.replace(asc_line, "\245", "\\xA5") + asc_line = string.replace(asc_line, "\266", "\\xB6") + asc_line = string.replace(asc_line, "\304", "\\xC4") + asc_line = string.replace(asc_line, "\305", "\\xC5") + asc_line = string.replace(asc_line, "\377", "\\xFF") + sys.stdout.write(asc_line) diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/codewarrior/carbonprefix.h freetype-2.8/=unpacked-tar2=/mac/codewarrior/carbonprefix.h --- freetype-2.7.1/=unpacked-tar2=/mac/codewarrior/carbonprefix.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/codewarrior/carbonprefix.h 2016-01-13 11:00:32.000000000 +0000 @@ -0,0 +1,3 @@ +#define USING_CARBON + +#include "ftoption.h" \ No newline at end of file Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/=unpacked-tar2=/mac/codewarrior/ftlint.prj and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/=unpacked-tar2=/mac/codewarrior/ftlint.prj differ Binary files /tmp/tmpszuupr/rJWXqCItoM/freetype-2.7.1/=unpacked-tar2=/mac/codewarrior/ftview.prj and /tmp/tmpszuupr/pi1nxWX6ju/freetype-2.8/=unpacked-tar2=/mac/codewarrior/ftview.prj differ diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/ftlint_m.c freetype-2.8/=unpacked-tar2=/mac/ftlint_m.c --- freetype-2.7.1/=unpacked-tar2=/mac/ftlint_m.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/ftlint_m.c 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,59 @@ +/* minimal Mac wrapper for the ftlint.c program */ + + +int original_main( int argc, char** argv ); + +/* We rename the original main() program to original_main, + so we can provide a wrapper around it */ +#define main original_main +#include "ftlint.c" +#undef main + + +#define PPEM "24" /* hard-code the ppem size */ + + +#include +#include "getargv.h" +#include +#include +#include +#include + +static void +init_toolbox() +{ + InitGraf(&qd.thePort); + InitFonts(); + InitWindows(); + TEInit(); + InitDialogs((long)0); + InitMenus(); + InitCursor(); + SIOUXSettings.asktosaveonclose = 0; +} + +int main() +{ + int argc, i; + char** argv; + + init_toolbox(); + + /* put paths of all files dropped onto the app into argv */ + argc = FTMac_GetArgv(&argv); + if (argc < 2) + { + printf("Please drop one or more font files onto the app (but quit first!)\n"); + exit(1); + } + /* move argv[1:] to argv[2:] and fill in the ppem arg */ + for (i = argc; i > 1; i--) + { + argv[i] = argv[i-1]; + } + argc++; + argv[1] = PPEM; + /* call the original main() program */ + original_main(argc, argv); +} diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/ftoldmac.c freetype-2.8/=unpacked-tar2=/mac/ftoldmac.c --- freetype-2.7.1/=unpacked-tar2=/mac/ftoldmac.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/ftoldmac.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,934 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2000, 2003, 2004, 2005, 2006 by */ +/* suzuki toshiya, D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* ftoldmac - test program for MacOS specific API in ftmac.c */ +/* */ +/* */ +/****************************************************************************/ + + +#if defined(__GNUC__) && defined(__APPLE_CC__) +# include +# include +# include +# include +#else +# include +# include +# include +#endif + +#include +#include FT_FREETYPE_H +#include FT_SFNT_NAMES_H +#include FT_TRUETYPE_IDS_H + + /* the following header shouldn't be used in normal programs */ +#include FT_INTERNAL_DEBUG_H + + /* showing driver name */ +#include FT_MODULE_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DRIVER_H + + /* FSSpec functions are deprecated since Mac OS X 10.4 */ +#ifndef HAVE_FSSPEC +#if defined( __LP64__ ) && !TARGET_CPU_68K && !TARGET_CPU_PPC && !TARGET_CPU_PPC64 +#define HAVE_FSSPEC 0 +typedef void FSSpec; +#else +#define HAVE_FSSPEC 1 +#endif +#endif + + /* most FSRef functions were introduced since Mac OS 9 */ +#ifndef HAVE_FSREF +#if TARGET_API_MAC_OSX +#define HAVE_FSREF 1 +#else +#define HAVE_FSREF 0 +typedef void FSRef; +#endif +#endif + + /* QuickDraw is deprecated since Mac OS X 10.4 */ +#ifndef HAVE_QUICKDRAW_CARBON +#if defined( __LP64__ ) && !TARGET_CPU_68K && !TARGET_CPU_PPC && !TARGET_CPU_PPC64 +#define HAVE_QUICKDRAW_CARBON 0 +#define HAVE_QUICKDRAW_TOOLBOX 0 +#elif TARGET_API_MAC_CARBON || TARGET_API_MAC_OSX +#define HAVE_QUICKDRAW_CARBON 1 +#define HAVE_QUICKDRAW_TOOLBOX 1 +#elif TARGET_API_MAC_OS8 +#define HAVE_QUICKDRAW_CARBON 0 +#define HAVE_QUICKDRAW_TOOLBOX 1 +#endif +#endif + + /* AppleTypeService is available since Mac OS X */ +#ifndef HAVE_ATS +#if TARGET_API_MAC_OSX +#define HAVE_ATS 1 +#else +#define HAVE_ATS 0 +#endif +#endif + +#include FT_MAC_H + +#undef FT_GetFile_From_Mac_Name +#undef FT_GetFile_From_Mac_ATS_Name +#undef FT_New_Face_From_FSSpec + +#include +#include +#include + +typedef enum +{ + FT_OldMac_Err_Unimplemented, + FT_OldMac_Err_TooLongFileName, + FT_OldMac_Err_FileNotFound, + FT_OldMac_Err_UnresolvableFontName, + FT_OldMac_Err_PseudoFontName, + FT_OldMac_Err_UnswappableFontID, + FT_OldMac_Err_TooLargeFaceIndex, + FT_OldMac_Err_Ok = 0 +} FT_OldMac_Err; + + +/* statics of font scanning */ +int num_scanned_fonts; +int num_opened_fonts; +int num_scanned_faces; +int num_opened_faces; + +/* setting for face scanning */ +int max_face_number; +Boolean force_scan_face; +char* font_listing_api; +char* font_resolve_api; +Boolean auto_suffix; + + +void initParamBlock( CInfoPBRec*, Str255 ); +void dumpPBErr( CInfoPBRec* ); +void crawlDir( CInfoPBRec*, char* ); +void crawlFontFile( char* ); +OSErr ftmac_FSPathMakeSpec( const UInt8*, FSSpec*, Boolean ); +OSErr ftmac_FSpMakePath( const FSSpec*, UInt8*, UInt32 ); + + +OSErr +ftmac_FSpMakePath( const FSSpec* spec_p, + UInt8* path, + UInt32 maxPathSize ) +{ + OSErr err; + FSSpec spec = *spec_p; + short vRefNum; + long dirID; + Str255 parDir_name; + + + FT_MEM_SET( path, 0, maxPathSize ); + while ( 1 ) + { + int child_namelen = ft_strlen( (char *)path ); + unsigned char node_namelen = spec.name[0]; + unsigned char* node_name = spec.name + 1; + + + if ( node_namelen + child_namelen > maxPathSize ) + return errFSNameTooLong; + + FT_MEM_MOVE( path + node_namelen + 1, path, child_namelen ); + FT_MEM_COPY( path, node_name, node_namelen ); + if ( child_namelen > 0 ) + path[ node_namelen ] = ':'; + + vRefNum = spec.vRefNum; + dirID = spec.parID; + parDir_name[0] = '\0'; + err = FSMakeFSSpec( vRefNum, dirID, parDir_name, &spec ); + if ( noErr != err || dirID == spec.parID ) + break; + } + return noErr; +} + + +void +dump_face_info( FT_Face face ) +{ + printf( "\t\tface_index=%d, face_flags=0x%08x, num_glyphs=%d\n", + (int)face->face_index, + (unsigned int)(face->face_flags), + (int)face->num_glyphs ); + printf( "\t\tnum_fixed_sizes=%d, style_flags=%d%d%d%d%d%d\n", + face->num_fixed_sizes, + ( (unsigned int)(face->style_flags) >> 5 ) & 1, + ( (unsigned int)(face->style_flags) >> 4 ) & 1, + ( (unsigned int)(face->style_flags) >> 3 ) & 1, + ( (unsigned int)(face->style_flags) >> 2 ) & 1, + ( (unsigned int)(face->style_flags) >> 1 ) & 1, + ( (unsigned int)(face->style_flags) ) & 1 + ); + printf("\t\tfamily_name=[%s], style_name=[%s]\n", + face->family_name, face->style_name ); +} + + +void +crawlFontFile( char* font_file_path ) +{ + FT_Library library; + FT_Face face; + int i, j; + FSSpec spec; + + + printf( "*** check font file [%s]\n", font_file_path ); + + if ( 0 != FT_Init_FreeType( &library ) ) + { + printf( "\tError: Could not initialize FreeType\n" ); + return; + } + + if ( noErr != ftmac_FSPathMakeSpec( (unsigned char const *)font_file_path, &spec, FALSE ) ) + { + printf( "\tError: Could not open File (MacOS API)\n" ); + return; + } + + face = NULL; + num_scanned_fonts ++; + if ( 0 != FT_New_Face_From_FSSpec( library, &spec, 0, &face ) ) + { + printf( "\tError: Could not open File (FreeType API)\n" ); + return; + } + + num_opened_fonts ++; + printf( "\tFont file has %d face\n", (int)face->num_faces ); + + + j = face->num_faces + max_face_number; + for ( i = 0; i < j; i++ ) + { + num_scanned_faces ++; + printf( "\tCheck Face #%d...", i ); + if ( 0 == FT_New_Face_From_FSSpec( library, &spec, i, &face ) ) + { + num_opened_faces ++; + printf( "Ok\n" ); + dump_face_info( face ); + FT_Done_Face( face ); + } + else + { + printf( "Failed\n" ); + if ( !force_scan_face ) + goto no_more_face; + } + } +no_more_face: + FT_Done_FreeType( library ); +} + + +void +crawlDir( CInfoPBRec* ci_pb_dir, + char* dir_path ) +{ + CInfoPBRec ci_pb; + char file_full_path[1024]; + int dirname_len; + int i; + + + printf( "ioVRefNum = 0x%04x, ioDrDirID = 0x%08x, ioDrParID= 0x%08x\n", + ci_pb_dir->dirInfo.ioVRefNum, + (unsigned int) ci_pb_dir->dirInfo.ioDrParID, + (unsigned int) ci_pb_dir->dirInfo.ioDrDirID ); + printf( "files in directory: %d\n", ci_pb_dir->dirInfo.ioDrNmFls ); + + + dirname_len = strlen( dir_path ); + strcpy( file_full_path, dir_path ); + if ( 0 < dirname_len && ':' != file_full_path[ dirname_len - 1 ] ) + dirname_len ++; + + file_full_path[ dirname_len - 1 ] = ':'; + + + for ( i = 0; i <= ci_pb_dir->dirInfo.ioDrNmFls; i ++ ) + { + Str255 fileName; + + + memset( &ci_pb, 0, sizeof( CInfoPBRec ) ); + fileName[0] = 0; + ci_pb.hFileInfo.ioVRefNum = ci_pb_dir->dirInfo.ioVRefNum; + ci_pb.hFileInfo.ioDirID = ci_pb_dir->dirInfo.ioDrDirID; + ci_pb.hFileInfo.ioNamePtr = fileName; + ci_pb.hFileInfo.ioFDirIndex = i; + if ( noErr == PBGetCatInfoSync( &ci_pb ) ) + { + if ( NULL != ci_pb.hFileInfo.ioNamePtr ) + { + char file_name[256]; + + + strncpy( file_name, (char *)ci_pb.hFileInfo.ioNamePtr + 1, ci_pb.hFileInfo.ioNamePtr[0] ); + file_name[ ci_pb.hFileInfo.ioNamePtr[0] ] = '\0'; + if ( 0 == strcmp( ".DS_Store", file_name ) ) + printf( "*** known non-font filename [%s]\n", file_name ); + else if ( 0 == ( ci_pb.hFileInfo.ioFlAttrib & ioDirMask ) ) + { + file_full_path[ dirname_len ] = '\0'; + strncat( file_full_path, file_name, sizeof( file_full_path ) ); + crawlFontFile( file_full_path ); + } + } + } + } +} + + +void +initParamBlock( CInfoPBRec* paramBlock, + Str255 fileName ) +{ + paramBlock->hFileInfo.ioCompletion = 0; /* synch calls */ + paramBlock->hFileInfo.ioNamePtr = fileName; + paramBlock->hFileInfo.ioVRefNum = 0; /* alias for default */ + paramBlock->hFileInfo.ioFDirIndex = 0; /* XXX */ + paramBlock->hFileInfo.ioDirID = 0; /* alias for default */ +} + +void +dumpPBErr( CInfoPBRec* paramBlock ) +{ + printf( "[PB access returned after " ); + switch ( paramBlock->hFileInfo.ioResult ) + { + case ioErr: + printf( "I/O Error" ); + break; + case fnOpnErr: + printf( "File not Open Error" ); + break; + case nsvErr: + printf( "No such volume Error" ); + break; + case fnfErr: + printf( "File not found Error" ); + break; + case rfNumErr: + printf( "Bad reference number Error" ); + break; + default: + printf( "unexpected err=%d", paramBlock->hFileInfo.ioResult ); + break; + } + printf( "]\n" ); +} + + +OSErr +ftmac_FSPathMakeSpec( const UInt8* pathname, + FSSpec* spec_p, + Boolean isDirectory ) +{ + const char *p, *q; + short vRefNum; + long dirID; + Str255 nodeName; + OSErr err; + + + FT_UNUSED( isDirectory ); + p = q = (const char *)pathname; + dirID = 0; + vRefNum = 0; + + while ( 1 ) + { + q = p + FT_MIN( 255, ft_strlen( (char const *)p ) ); + + if ( q == p ) + return 0; + + if ( 255 < ft_strlen( (char const *)pathname ) ) + { + while ( p < q && *q != ':' ) + q--; + } + + if ( p < q ) + nodeName[0] = q - p; + else if ( ft_strlen( (char const *)p ) < 256 ) + nodeName[0] = ft_strlen( p ); + else + return errFSNameTooLong; + + strncpy( (char *)nodeName + 1, (char *)p, nodeName[0] ); + nodeName[ nodeName[0] + 1 ] = '\0'; + err = FSMakeFSSpec( vRefNum, dirID, nodeName, spec_p ); + if ( err || '\0' == *q ) + return err; + + vRefNum = spec_p->vRefNum; + dirID = spec_p->parID; + + p = q + 1; + } +} + + +void +test_font_files( int argc, + char** argv ) +{ + int i; + + + for ( i = 1; i < argc; i++ ) + { + OSErr status; + CInfoPBRec paramBlock; + Str255 fileName; + + + /* XXX: should be skipped by better argument handler */ + if ( '-' == argv[i][0] && '-' == argv[i][1] ) + continue; + + + /* XXX: restrict pathname to legacy HFS limit for simplicity */ + if ( 254 < strlen( argv[i] ) ) + continue; + + fileName[0] = strlen( argv[i] ); + memcpy( fileName + 1, argv[i], fileName[0] ); + initParamBlock( ¶mBlock, fileName ); + status = PBGetCatInfoSync( ¶mBlock ); + if ( 0 > status ) + printf( "[PB access failed] error = %d\n", status ); + + + { + FSSpec spec; + Str255 volName; + int i; + + + strncpy( (char *)volName, (char *)fileName, fileName[0] ); + printf( "given file name [%s]", fileName + 1 ); + for ( i = 1; i < fileName[0] && ':' != fileName[i + 1]; i ++ ) + ; + volName[i + 1] = ':'; + volName[i + 2] = '\0'; + volName[0] = i + 1; + printf( "-> volume name [%s]", volName + 1 ); + status = FSMakeFSSpec( 0, 0, volName, &spec); + if ( noErr != status ) + printf( "FSMakeFSSpec(%s) error %d\n", volName, status ); + else + { + printf( "FSMakeFSSpec(%s) return volID = 0x%08x\n", volName + 1, spec.vRefNum ); + paramBlock.hFileInfo.ioVRefNum = spec.vRefNum; + } + } + + + if ( 0 != paramBlock.hFileInfo.ioResult ) + dumpPBErr( ¶mBlock ); + else if ( 0 != ( paramBlock.hFileInfo.ioFlAttrib & ioDirMask ) ) + crawlDir( ¶mBlock, argv[i] ); + else + crawlFontFile( argv[i] ); + } +} + + +void +print_help_and_exit() +{ + printf("\n" ); + printf(" ftoldmac [pathname in HFS syntax]\n" ); + printf("\n" ); + printf(" e.g. \"Macintosh HD:System Folder:Fonts:\"\n" ); + printf(" quotation is required to avoid shell expansion\n" ); + printf(" scan directory and open all font files in there\n" ); + printf("\n" ); + printf(" --max-face-number=N\n" ); + printf(" scan face until N instead of face->num_faces\n" ); + printf("\n" ); + printf(" --force-scan-face\n" ); + printf(" ignore the error to open face and continue to max face number\n" ); + printf("\n" ); + printf(" ftoldmac --font-listing-api=XXX --font-resolve-api=YYY\n" ); + printf("\n" ); + printf(" --font-listing-api={quickdraw_old|quickdraw|ats}\n" ); + printf(" specify API to list system font\n" ); + printf("\n" ); + printf(" --font-resolve-api={quickdraw|ats}\n" ); + printf(" specify API to find fontfile by fontname\n" ); + printf("\n" ); + printf(" --auto-suffix\n" ); + printf(" old QuickDraw API cannot list available style suffixes,\n" ); + printf(" this option adds Bold and Italic suffixes automatically.\n" ); + printf("\n" ); + printf(" available API:" ); +#if HAVE_QUICKDRAW_TOOLBOX + printf(" quickdraw_old" ); +#endif +#if HAVE_QUICKDRAW_CARBON + printf(" quickdraw" ); +#endif +#if HAVE_ATS + printf(" ats" ); +#endif + printf("\n" ); + printf("\n" ); + exit( 0 ); +} + + +void +verifyFMOutput( FMOutput* fmout ) +{ + OSErr err; + Handle font_handle; + short rsrcID; + ResType rsrcType; + Str255 rsrcName; + + + +#ifdef VERBOSE + printf( "FMOutput.boldPixels 0x%02x\n", fmout->boldPixels ); + printf( "FMOutput.italicPixels 0x%02x\n", fmout->italicPixels ); + printf( "FMOutput.ulOffset 0x%02x\n", fmout->ulOffset ); + printf( "FMOutput.ulShadow 0x%02x\n", fmout->ulShadow ); + printf( "FMOutput.ulThick 0x%02x\n", fmout->ulThick ); + printf( "FMOutput.shadowPixels 0x%02x\n", fmout->shadowPixels ); + printf( "FMOutput.extra 0x%02x\n", fmout->extra ); + printf( "FMOutput.curStyle 0x%02x\n", fmout->curStyle ); +#else + printf( "FMOutput.widMax:%d\n", fmout->widMax ); +#endif + + font_handle = fmout->fontHandle, + GetResInfo( font_handle, &rsrcID, &rsrcType, rsrcName ); + err = ResError(); + if ( 0 != err ) + printf( "could not get resource info for handle 0x%08x, err=%d\n", + (int)(fmout->fontHandle), err ); + else + printf( "resource: ID=0x%04x, Type=%c%c%c%c, name=%s\n", + rsrcID, + (int)MAX( (rsrcType >> 24) & 0xFF, 0x20 ), + (int)MAX( (rsrcType >> 16) & 0xFF, 0x20 ), + (int)MAX( (rsrcType >> 8) & 0xFF, 0x20 ), + (int)MAX( (rsrcType >> 0) & 0xFF, 0x20 ), + rsrcName[0] > 0 ? rsrcName + 1 : '\0' ); +} + + +FT_OldMac_Err +resolveToolBoxQuickDrawFontName( const char* font_name ) +{ +#if !HAVE_QUICKDRAW_TOOLBOX + printf( "cannot check [%s] by Toolbox QuickDraw\n", font_name ); + return FT_OldMac_Err_Unimplemented; +#else + Str255 familyName; + SInt16 familyID; + FMInput lookup_inst; + FMOutput* lookup_rslt; + + + ft_strncpy( (char*)familyName + 1, (char*)font_name, 254 ); + familyName[0] = strlen( (char *)familyName + 1 ); + GetFNum( familyName, &familyID ); + if ( 0 > familyID ) + { + printf( "familyName %s is unresolvable\n", familyName + 1 ); + return FT_OldMac_Err_UnresolvableFontName; + } + else if ( 0 == familyID ) + return FT_OldMac_Err_PseudoFontName; + + printf( "familyName %s:%d -> familyID 0x%04x: -> ", + familyName + 1, familyName[0], + familyID ); + + bzero( &lookup_inst, sizeof( FMInput ) ); + lookup_inst.family = familyID; + lookup_inst.size = 14; + lookup_inst.face = 0; + lookup_inst.needBits = FALSE; + lookup_inst.device = 0; + lookup_inst.numer.v = 1; + lookup_inst.numer.h = 1; + lookup_inst.denom.v = 1; + lookup_inst.denom.h = 1; + + lookup_rslt = FMSwapFont( &lookup_inst ); + if ( NULL == lookup_rslt ) + { + printf( "FMSwapFont returns NULL (unresolved)\n" ); + return FT_OldMac_Err_UnswappableFontID; + } + else + verifyFMOutput( lookup_rslt ); + return FT_OldMac_Err_Ok; +#endif +} + + +void +test_face_quickdraw( char* face_name, + FT_Library library ) +{ +#if !HAVE_QUICKDRAW_CARBON + printf( "cannot check [%s] by Carbon QuickDraw\n", face_name ); +#else + FSSpec spec; + UInt8 font_file_path[1024]; + FT_Long face_index; + FT_Face face; + + + printf( "Lookup [%s]...", face_name ); + if ( 0 != FT_GetFile_From_Mac_Name( face_name, &spec, &face_index ) ) + { + printf( "FreeType could not find font file\n" ); + return; + } + + ftmac_FSpMakePath( &spec, font_file_path, 1024 ); + printf( "Font file found [%s], face #%d...", font_file_path, (int)face_index ); + if ( 0 != FT_New_Face_From_FSSpec( library, &spec, face_index, &face ) ) + { + printf( "FreeType could not load font file\n" ); + return; + } + printf( "Ok\n" ); + + num_opened_faces ++; + dump_face_info( face ); + FT_Done_Face( face ); +#endif +} + + +void +test_face_ats( char* face_name, + FT_Library library ) +{ +#if !HAVE_ATS + FT_UNUSED( library ); + printf( "cannot check [%s] by ATS\n", face_name ); +#else + UInt8 font_file_path[1024]; + FT_Long face_index; + FT_Face face; + FSSpec spec; + + + printf( "Lookup [%s]...", face_name ); + if ( 0 != FT_GetFile_From_Mac_ATS_Name( face_name, &spec, &face_index ) ) + { + printf( "FreeType could not find font file\n" ); + return; + } + + ftmac_FSpMakePath( &spec, font_file_path, 1024 ); + + printf( "Font file found [%s], face #%d...", font_file_path, (int)face_index ); + + if ( 0 != FT_New_Face_From_FSSpec( library, &spec, face_index, &face ) ) + { + printf( "FreeType could not load font file\n" ); + return; + } + printf( "Ok\n" ); + + num_opened_faces ++; + dump_face_info( face ); + FT_Done_Face( face ); +#endif +} + + +void +test_face( char* face_name, + FT_Library library ) +{ + num_scanned_faces ++; + if ( 0 == ft_strcmp( font_resolve_api, "quickdraw" ) ) + test_face_quickdraw( face_name, library ); + else if ( 0 == ft_strcmp( font_resolve_api, "ats" ) ) + test_face_ats( face_name, library ); + else + { + printf( "invalid api name to resolve [%s]\n", font_resolve_api ); + exit( -1 ); + } +} + + +void +test_font_list_quickdraw_old( FT_Library library ) +{ +#if !HAVE_QUICKDRAW_TOOLBOX + FT_UNUSED( library ); + printf( "FreeType2 is configured without quickdraw_old (Toolbox QuickDraw)\n" ); +#else + Str255 fmo_family_name; + char fmo_face_name[1024]; + int i; + + + for ( i = 0; i < 0x7FFF; i++ ) + { + GetFontName( i, fmo_family_name ); + if ( 0 < fmo_family_name[0] ) + { + fmo_family_name[ fmo_family_name[0] + 1 ] = '\0'; + + ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); + test_face( fmo_face_name, library ); + + if ( !auto_suffix ) + continue; + + ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); + strncat( (char *)fmo_face_name, " Bold", 1024 ); + printf( "+ " ); + test_face( fmo_face_name, library ); + + ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); + strncat( (char *)fmo_face_name, " Italic", 1024 ); + printf( "+ " ); + test_face( fmo_face_name, library ); + + ft_strncpy( (char *)fmo_face_name, (char *)fmo_family_name + 1, 1024 ); + strncat( (char *)fmo_face_name, " Bold Italic", 1024 ); + printf( "+ " ); + test_face( fmo_face_name, library ); + } + } +#endif +} + + +char* +make_style_suffix( char* fm_style_name, + FMFontStyle fm_style ) +{ + fm_style_name[0] = ' '; + fm_style_name[1] = '\0'; + if ( fm_style & bold ) strcat( fm_style_name, "Bold " ); + if ( fm_style & italic ) strcat( fm_style_name, "Italic " ); + if ( fm_style & underline ) strcat( fm_style_name, "Underline " ); + if ( fm_style & outline ) strcat( fm_style_name, "Outline " ); + if ( fm_style & shadow ) strcat( fm_style_name, "Shadow " ); + if ( fm_style & condense ) strcat( fm_style_name, "Condense " ); + if ( fm_style & extend ) strcat( fm_style_name, "Extend " ); + if ( ft_strlen( fm_style_name ) > 0 ) + fm_style_name[ strlen( fm_style_name) - 1 ] = '\0'; + + return fm_style_name; +} + + +void +test_font_list_quickdraw( FT_Library library ) +{ +#if !HAVE_QUICKDRAW_CARBON + FT_UNUSED( library ); + printf( "FreeType2 is configured without quickdraw (Carbon QuickDraw)\n" ); +#else + FMFontFamilyIterator fm_family_iter; + FMFontFamily fm_family; + Str255 fm_family_namestr; + char fm_family_name[1024]; + + FMFontFamilyInstanceIterator fm_font_iter; + FMFont fm_font; + FMFontStyle fm_style; + FMFontSize fm_size; + char fm_style_name[1024]; + + + + if ( 0 != FMCreateFontFamilyIterator( NULL, NULL, + kFMUseGlobalScopeOption, + &fm_family_iter ) ) + return; + +get_quickdraw_font_family: + if ( 0 == FMGetNextFontFamily( &fm_family_iter, &fm_family ) ) + { + if ( 0 == FMCreateFontFamilyInstanceIterator( fm_family, &fm_font_iter ) ) + { +get_quickdraw_font_instance: + if ( 0 == FMGetNextFontFamilyInstance( &fm_font_iter, &fm_font, &fm_style, &fm_size ) ) + { + if ( 0 == fm_size ) + { + FMGetFontFamilyName( fm_family, fm_family_namestr ); + CopyPascalStringToC( fm_family_namestr, fm_family_name ); + strcat( fm_family_name, make_style_suffix( fm_style_name, fm_style ) ); + test_face( fm_family_name, library ); + } + goto get_quickdraw_font_instance; + } + else + { + FMDisposeFontFamilyInstanceIterator( &fm_font_iter ); + goto get_quickdraw_font_family; + } + } + else + goto get_quickdraw_font_family; + } + + FMDisposeFontFamilyIterator( &fm_family_iter ); + return; +#endif +} + + +void +test_font_list_ats( FT_Library library ) +{ +#if !HAVE_ATS + FT_UNUSED( library ); + printf( "FreeType2 is configured without ats (AppleTypeService)\n" ); +#else + ATSFontIterator ats_font_iter; + ATSFontRef ats_font_ref; + CFStringRef ats_font_name; + char face_name[1024]; +#ifndef kATSOptionFlagsUnRestrictedScope +#define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault +#endif + + + if ( noErr != ATSFontIteratorCreate( kATSFontContextGlobal, + NULL, NULL, + kATSOptionFlagsUnRestrictedScope, + &ats_font_iter ) ) + return; + + while ( noErr == ATSFontIteratorNext( ats_font_iter, &ats_font_ref ) ) + { + if ( 0 != ATSFontGetName( ats_font_ref, kATSOptionFlagsUnRestrictedScope, &ats_font_name ) ) + continue; + + if ( NULL == ats_font_name ) + continue; + + if ( CFStringGetCString( ats_font_name, face_name, 1024, kCFStringEncodingNonLossyASCII ) ) + test_face( (char *)face_name, library ); + } + return; +#endif +} + + +void +test_system_font_list() +{ + FT_Library library; + + + printf( "fontlist is generated by [%s]\n", font_listing_api ); + printf( "fontname is resolved by [%s]\n", font_resolve_api ); + + if ( 0 != FT_Init_FreeType( &library ) ) + return; + + if ( 0 == ft_strcmp( font_listing_api, "quickdraw_old" ) ) + test_font_list_quickdraw_old( library ); + else if ( 0 == ft_strcmp( font_listing_api, "quickdraw" ) ) + test_font_list_quickdraw( library ); + else if ( 0 == ft_strcmp( font_listing_api, "ats" ) ) + test_font_list_ats( library ); + else + { + printf( "invalid api name to list [%s]\n", font_listing_api ); + exit( -1 ); + } + + FT_Done_FreeType( library ); +} + + +int +main( int argc, + char** argv ) +{ + int i; + + + num_scanned_fonts = 0; + num_opened_fonts = 0; + num_scanned_faces = 0; + num_opened_faces = 0; + + font_listing_api = NULL; + font_resolve_api = NULL; + auto_suffix = FALSE; + max_face_number = 0; + force_scan_face = FALSE; + + if ( 1 == argc ) + print_help_and_exit(); + else + { + for ( i = 1; i < argc; i++ ) + { + if ( 0 == ft_strcmp( "--help", argv[i] ) ) + print_help_and_exit(); + else if ( 0 == ft_strncmp( "--font-listing-api=", argv[i], 19 ) ) + font_listing_api = argv[i] + 19; + else if ( 0 == ft_strncmp( "--font-resolve-api=", argv[i], 19 ) ) + font_resolve_api = argv[i] + 19; + else if ( 0 == ft_strcmp( "--auto-suffix", argv[i] ) ) + auto_suffix = TRUE; + else if ( 0 == ft_strncmp( "--max-face-number=", argv[i], 18 ) ) + max_face_number = atoi( argv[i] + 18 ); + else if ( 0 == ft_strcmp( "--force-scan-face", argv[i] ) ) + force_scan_face = TRUE; + } + } + + if ( NULL == font_listing_api && NULL == font_resolve_api ) + test_font_files( argc, argv ); + else if ( NULL != font_listing_api && NULL != font_resolve_api ) + test_system_font_list( argc, argv ); + else if ( NULL == font_listing_api ) + printf( "require --font-listing-api to specify how to list system font\n" ); + else if ( NULL == font_resolve_api ) + printf( "require --font-resolve-api to specify how to find file by fontname\n" ); + + printf( "\n" ); + printf( "---------------------------------\n" ); + printf( "Summary\n" ); + printf( "Font File opened/scanned = %d/%d\n", num_opened_fonts, num_scanned_fonts ); + printf( "Font Face opened/scanned = %d/%d\n", num_opened_faces, num_scanned_faces ); + exit( 0 ); +} diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/ftoldmac.m68k_far.make.txt freetype-2.8/=unpacked-tar2=/mac/ftoldmac.m68k_far.make.txt --- freetype-2.7.1/=unpacked-tar2=/mac/ftoldmac.m68k_far.make.txt 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/ftoldmac.m68k_far.make.txt 2015-09-25 05:41:45.000000000 +0000 @@ -0,0 +1,103 @@ +# File: ftoldmac.m68k_far.make +# Target: ftoldmac.m68k_far +# Created: Wednesday, November 23, 2005 04:21:20 PM + + +MAKEFILE = ftoldmac.m68k_far.make +\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified + +FT2Dir = ::freetype2: +ObjDir = :obj: +Includes = \xB6 + -i "{FT2Dir}include:" \xB6 + -i "{FT2Dir}src:" \xB6 + -i :src: \xB6 + -i "{FT2Dir}include:freetype:config:" + +Sym-68K = -sym off + +COptions = \xB6 + -d HAVE_FSSPEC=1 \xB6 + -d HAVE_FSREF=0 \xB6 + -d HAVE_QUICKDRAW_TOOLBOX=1 \xB6 + -d HAVE_QUICKDRAW_CARBON=0 \xB6 + -d HAVE_ATS=0 \xB6 + -d FT2_BUILD_LIBRARY \xB6 + -d FT_CONFIG_CONFIG_H="" \xB6 + -d FT_CONFIG_MODULES_H="" \xB6 + {Includes} {Sym-68K} -model far -includes unix + + +### Source Files ### + +SrcFiles = \xB6 + :mac:ftoldmac.c \xB6 + :src:common.c + + +### Object Files ### + +ObjFiles-68K = \xB6 + "{ObjDir}ftoldmac.c.o" \xB6 + "{ObjDir}common.c.o" + + +### Libraries ### + +LibFiles-68K = \xB6 + "{FT2Dir}FreeType.m68k_far.o" \xB6 + "{Libraries}Stubs.o" \xB6 + "{Libraries}MathLib.far.o" \xB6 + "{CLibraries}StdCLib.far.o" \xB6 + "{Libraries}MacRuntime.o" \xB6 + "{Libraries}IntEnv.far.o" \xB6 + "{Libraries}ToolLibs.far.o" \xB6 + "{Libraries}Interface.o" + + +### Default Rules ### + +.c.o \xC4 .c {\xA5MondoBuild\xA5} + {C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} + + +### Build Rules ### + +ftoldmac.m68k_far \xC4\xC4 {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5} + ILink \xB6 + -o {Targ} \xB6 + {ObjFiles-68K} \xB6 + {LibFiles-68K} \xB6 + {Sym-68K} \xB6 + -mf -d \xB6 + -t 'MPST' \xB6 + -c 'MPS ' \xB6 + -model far \xB6 + -state rewrite \xB6 + -compact -pad 0 \xB6 + -br on + If "{Sym-68K}" =~ /-sym \xC5[nNuU]\xC5/ + ILinkToSYM {Targ}.NJ -mf -sym 3.2 -c 'sade' + End + + + +### Required Dependencies ### + +"{ObjDir}ftoldmac.c.o" \xC4 :mac:ftoldmac.c +"{ObjDir}common.c.o" \xC4 :src:common.c + + +### Optional Dependencies ### +### Build this target to generate "include file" dependencies. ### + +Dependencies \xC4 $OutOfDate + MakeDepend \xB6 + -append {MAKEFILE} \xB6 + -ignore "{CIncludes}" \xB6 + -objdir "{ObjDir}" \xB6 + -objext .o \xB6 + {Includes} \xB6 + {SrcFiles} + + diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/ftoldmac.ppc_classic.make.txt freetype-2.8/=unpacked-tar2=/mac/ftoldmac.ppc_classic.make.txt --- freetype-2.7.1/=unpacked-tar2=/mac/ftoldmac.ppc_classic.make.txt 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/ftoldmac.ppc_classic.make.txt 2015-09-25 05:41:45.000000000 +0000 @@ -0,0 +1,95 @@ +# File: ftoldmac.ppc_classic.make +# Target: ftoldmac.ppc_classic +# Created: Thursday, November 24, 2005 10:02:30 AM + + +MAKEFILE = ftoldmac.ppc_classic.make +\xA5MondoBuild\xA5 = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified + +FT2Dir = ::freetype2: +ObjDir = :obj: +Includes = \xB6 + -i "{FT2Dir}include:" \xB6 + -i "{FT2Dir}src:" \xB6 + -i :src: \xB6 + -i "{FT2Dir}include:freetype:config:" + +Sym-PPC = -sym off + +PPCCOptions = \xB6 + -d HAVE_FSSPEC=1 \xB6 + -d HAVE_FSREF=0 \xB6 + -d HAVE_QUICKDRAW_TOOLBOX=1 \xB6 + -d HAVE_QUICKDRAW_CARBON=0 \xB6 + -d HAVE_ATS=0 \xB6 + -d FT2_BUILD_LIBRARY \xB6 + -d FT_CONFIG_CONFIG_H="" \xB6 + -d FT_CONFIG_MODULES_H="" \xB6 + {Includes} {Sym-PPC} -includes unix -ansi strict + + +### Source Files ### + +SrcFiles = \xB6 + :mac:ftoldmac.c \xB6 + :src:common.c + + +### Object Files ### + +ObjFiles-PPC = \xB6 + "{ObjDir}common.c.x" \xB6 + "{ObjDir}ftoldmac.c.x" + + +### Libraries ### + +LibFiles-PPC = \xB6 + "{FT2Dir}FreeType.ppc_classic.o" \xB6 + "{SharedLibraries}InterfaceLib" \xB6 + "{SharedLibraries}StdCLib" \xB6 + "{SharedLibraries}MathLib" \xB6 + "{PPCLibraries}StdCRuntime.o" \xB6 + "{PPCLibraries}PPCCRuntime.o" \xB6 + "{PPCLibraries}PPCToolLibs.o" + + +### Default Rules ### + +.c.x \xC4 .c {\xA5MondoBuild\xA5} + {PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions} + + +### Build Rules ### + +ftoldmac.ppc_classic \xC4\xC4 {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5} + PPCLink \xB6 + -o {Targ} \xB6 + {ObjFiles-PPC} \xB6 + {LibFiles-PPC} \xB6 + {Sym-PPC} \xB6 + -mf -d \xB6 + -t 'MPST' \xB6 + -c 'MPS ' + + + +### Required Dependencies ### + +"{ObjDir}common.c.x" \xC4 :src:common.c +"{ObjDir}ftoldmac.c.x" \xC4 :mac:ftoldmac.c + + +### Optional Dependencies ### +### Build this target to generate "include file" dependencies. ### + +Dependencies \xC4 $OutOfDate + MakeDepend \xB6 + -append {MAKEFILE} \xB6 + -ignore "{CIncludes}" \xB6 + -objdir "{ObjDir}" \xB6 + -objext .x \xB6 + {Includes} \xB6 + {SrcFiles} + + diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/ftview_m.c freetype-2.8/=unpacked-tar2=/mac/ftview_m.c --- freetype-2.7.1/=unpacked-tar2=/mac/ftview_m.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/ftview_m.c 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1,66 @@ +/* minimal Mac wrapper for the ftview.c program */ + + +int original_main( int argc, char** argv ); + +/* We rename the original main() program to original_main, + so we can provide a wrapper around it */ +#define main original_main +#include "ftview.c" +#undef main + + +#define PPEM "24" /* hard-code the ppem size */ + + +#include +#include "getargv.h" +#ifndef USING_CARBON +#include +#include +#include +#include +#else +#include +#endif + +static void +init_toolbox() +{ +#ifndef USING_CARBON + InitGraf(&qd.thePort); + InitFonts(); + InitWindows(); + TEInit(); + InitDialogs((long)0); + InitMenus(); + InitCursor(); +#endif + + SIOUXSettings.asktosaveonclose = 0; +} + +int main() +{ + int argc, i; + char** argv; + + init_toolbox(); + + /* put paths of all files dropped onto the app into argv */ + argc = FTMac_GetArgv(&argv); + if (argc < 2) + { + printf("Please drop one or more font files onto the app (but quit first!)\n"); + exit(1); + } + /* move argv[1:] to argv[2:] and fill in the ppem arg */ + for (i = argc; i > 1; i--) + { + argv[i] = argv[i-1]; + } + argc++; + argv[1] = PPEM; + /* call the original main() program */ + original_main(argc, argv); +} diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/getargv.c freetype-2.8/=unpacked-tar2=/mac/getargv.c --- freetype-2.7.1/=unpacked-tar2=/mac/getargv.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/getargv.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,324 @@ +/*********************************************************** +Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, +The Netherlands. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + +/* Construct argc and argv for main() by using Apple Events */ +/* From Jack's implementation for STDWIN */ + +/* Modified for use with FreeType from MacPython's macgetargv.c + by Just van Rossum */ + +#include +#include +#include "getargv.h" + +#ifndef USING_CARBON +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +#if defined(GENERATINGCFM) && !defined(USING_CARBON) /* Defined to 0 or 1 in Universal headers */ +#define HAVE_UNIVERSAL_HEADERS +#endif + +#if !defined(HAVE_UNIVERSAL_HEADERS) && !defined(USING_CARBON) +#define NewAEEventHandlerProc(x) (x) +#define AEEventHandlerUPP EventHandlerProcPtr +#endif + +static int arg_count; +static char *arg_vector[256]; +static char app_name[256]; +static int app_name_inited; + + +/* Duplicate a string to the heap. */ + +static char * +strdup(char *src) +{ + char *dst = malloc(strlen(src) + 1); + if (dst) + strcpy(dst, src); + return dst; +} + + +/* Given an FSSpec, return the FSSpec of the parent folder */ + +static OSErr +get_folder_parent (FSSpec * fss, FSSpec * parent) +{ + CInfoPBRec rec; + short err; + + * parent = * fss; + rec.hFileInfo.ioNamePtr = parent->name; + rec.hFileInfo.ioVRefNum = parent->vRefNum; + rec.hFileInfo.ioDirID = parent->parID; + rec.hFileInfo.ioFDirIndex = -1; + rec.hFileInfo.ioFVersNum = 0; + if (err = PBGetCatInfoSync (& rec)) + return err; + parent->parID = rec.dirInfo.ioDrParID; +/* parent->name[0] = 0; */ + return 0; +} + + +/* Given an FSSpec return a full, colon-separated pathname */ + +static OSErr +FTMac_GetFullPath (FSSpec *fss, char *buf) +{ + short err; + FSSpec fss_parent, fss_current; + char tmpbuf[256]; + int plen; + + fss_current = *fss; + plen = fss_current.name[0]; + memcpy(buf, &fss_current.name[1], plen); + buf[plen] = 0; + /* Special case for disk names */ + if ( fss_current.parID <= 1 ) { + buf[plen++] = ':'; + buf[plen] = 0; + return 0; + } + while (fss_current.parID > 1) { + /* Get parent folder name */ + if (err = get_folder_parent(&fss_current, &fss_parent)) + return err; + fss_current = fss_parent; + /* Prepend path component just found to buf */ + plen = fss_current.name[0]; + if (strlen(buf) + plen + 1 > 256) { + /* Oops... Not enough space (shouldn't happen) */ + *buf = 0; + return -1; + } + memcpy(tmpbuf, &fss_current.name[1], plen); + tmpbuf[plen] = ':'; + strcpy(&tmpbuf[plen+1], buf); + strcpy(buf, tmpbuf); + } + return 0; +} + + +/* Initialize name of current application */ + +static OSErr +init_app_name() +{ + ProcessSerialNumber currentPSN; + ProcessInfoRec info; + OSErr err; + FSSpec appSpec; + + if ( app_name_inited ) return 0; + currentPSN.highLongOfPSN = 0; + currentPSN.lowLongOfPSN = kCurrentProcess; + info.processInfoLength = sizeof(ProcessInfoRec); + info.processName = NULL; + info.processAppSpec = &appSpec; + if ( err=GetProcessInformation(¤tPSN, &info)) + return err; + strncpy(app_name, (char*)appSpec.name + 1, appSpec.name[0]); + app_name[appSpec.name[0]] = '\0'; + app_name_inited = 1; + return 0; +} + + +/* Check that there aren't any args remaining in the event */ + +static OSErr +get_missing_params(const AppleEvent *theAppleEvent) +{ + DescType theType; + Size actualSize; + OSErr err; + + err = AEGetAttributePtr(theAppleEvent, keyMissedKeywordAttr, typeWildCard, + &theType, nil, 0, &actualSize); + if (err == errAEDescNotFound) + return noErr; + else + return errAEEventNotHandled; +} + +static int got_one; /* Flag that we can stop getting events */ + + +/* Handle the Print or Quit events (by failing) */ + +static pascal OSErr +handle_not(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) +{ + #pragma unused (reply, refCon) + got_one = 1; + return errAEEventNotHandled; +} + + +/* Handle the Open Application event (by ignoring it) */ + +static pascal OSErr +handle_open_app(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) +{ + #pragma unused (reply, refCon) +#if 0 + /* Test by Jack: would removing this facilitate debugging? */ + got_one = 1; +#endif + return get_missing_params(theAppleEvent); +} + + +/* Handle the Open Document event, by adding an argument */ + +static pascal OSErr +handle_open_doc(const AppleEvent *theAppleEvent, AppleEvent *reply, long refCon) +{ + #pragma unused (reply, refCon) + OSErr err; + AEDescList doclist; + AEKeyword keywd; + DescType rttype; + long i, ndocs, size; + FSSpec fss; + char path[256]; + + got_one = 1; + if (err = AEGetParamDesc(theAppleEvent, + keyDirectObject, typeAEList, &doclist)) + return err; + if (err = get_missing_params(theAppleEvent)) + return err; + if (err = AECountItems(&doclist, &ndocs)) + return err; + for(i = 1; i <= ndocs; i++) { + err = AEGetNthPtr(&doclist, i, typeFSS, + &keywd, &rttype, &fss, sizeof(fss), &size); + if (err) + break; + FTMac_GetFullPath(&fss, path); + arg_vector[arg_count++] = strdup(path); + } + return err; +} + + +/* Install standard core event handlers */ +static AEEventHandlerUPP open_doc_upp; +static AEEventHandlerUPP open_app_upp; +static AEEventHandlerUPP not_upp; + +static void +set_ae_handlers() +{ +#ifdef USING_CARBON + open_doc_upp = NewAEEventHandlerUPP(handle_open_doc); + open_app_upp = NewAEEventHandlerUPP(handle_open_app); + not_upp = NewAEEventHandlerUPP(handle_not); +#else + open_doc_upp = NewAEEventHandlerProc(handle_open_doc); + open_app_upp = NewAEEventHandlerProc(handle_open_app); + not_upp = NewAEEventHandlerProc(handle_not); +#endif + + AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, + open_app_upp, 0L, false); + AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, + open_doc_upp, 0L, false); + AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, + not_upp, 0L, false); + AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, + not_upp, 0L, false); +} + +/* Uninstall standard core event handlers */ + +static void +reset_ae_handlers() +{ + AERemoveEventHandler(kCoreEventClass, kAEOpenApplication, + open_app_upp, false); + AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, + open_doc_upp, false); + AERemoveEventHandler(kCoreEventClass, kAEPrintDocuments, + not_upp, false); + AERemoveEventHandler(kCoreEventClass, kAEQuitApplication, + not_upp, false); +} + +/* Wait for events until a core event has been handled */ + +static void +event_loop() +{ + EventRecord event; + int n; + int ok; + + got_one = 0; + for (n = 0; n < 100 && !got_one; n++) { + #ifndef USING_CARBON + SystemTask(); + #endif + ok = GetNextEvent(everyEvent, &event); + if (ok && event.what == kHighLevelEvent) { + AEProcessAppleEvent(&event); + } + } +} + +/* Get the argv vector, return argc. See macgetargv.h for more doco. */ + +int +FTMac_GetArgv(pargv) + char ***pargv; +{ + + arg_count = 0; + (void)init_app_name(); + arg_vector[arg_count++] = strdup(app_name); + + set_ae_handlers(); + event_loop(); + reset_ae_handlers(); + + arg_vector[arg_count] = NULL; + + *pargv = arg_vector; + return arg_count; +} diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/getargv.h freetype-2.8/=unpacked-tar2=/mac/getargv.h --- freetype-2.7.1/=unpacked-tar2=/mac/getargv.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/getargv.h 2016-01-13 11:00:32.000000000 +0000 @@ -0,0 +1,19 @@ +/* + + FTMac_GetArgv + + + argc/argv emulation for the Mac. Converts files dropped + onto the application to full paths, and stuff them into + argv. + + + pargv :: a pointer to an argv array. The array doesn't need to + exist before calling this function. + + + The number of files dropped onto the app (ie. argc) +*/ + +int FTMac_GetArgv(char ***pargv); + diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/Makefile freetype-2.8/=unpacked-tar2=/mac/Makefile --- freetype-2.7.1/=unpacked-tar2=/mac/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/Makefile 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,125 @@ +################################################################## +# +# Makefile for MacOS X to build MacOS-specific API test program, +# Also targets to setup vanilla source for MPW are included. +# This should be executed in this directory, as +# "cd ft2demos ; make -C mac". +# +# most part is taken from ft2demos/Makefile, for UNIX platform. +# + +all: exes + +empty := +space := $(empty) $(empty) + +TOP_DIR ?= ../../freetype2 +OBJ_DIR ?= $(TOP_DIR)/objs +TOP_DIR_2 ?= .. +OBJ_DIR_2 ?= $(TOP_DIR_2)/obj +TOP_DIR_2_MAC ?= $(TOP_DIR_2)/mac + +ifndef CONFIG_MK + PROJECT := freetype + CONFIG_MK := $(TOP_DIR)/config.mk +endif + +ifeq ($(wildcard $(CONFIG_MK)),) + no_config_mk := 1 +endif + +ifdef no_config_mk + exes: + @echo Please compile the library before the demo programs! + clean distclean: + @echo "I need \`$(subst /,$(SEP),$(TOP_DIR)/config.mk)' to do that!" +else + include $(CONFIG_MK) + have_makefile := $(strip $(wildcard Makefile)) + TOP_DIR := $(shell cd $(TOP_DIR); pwd) + TOP_DIR_2 := $(shell cd $(TOP_DIR_2); pwd) + ifneq ($(have_makefile),) + BIN_DIR_2 ?= $(TOP_DIR_2)/bin + OBJ_DIR_2 ?= $(TOP_DIR_2)/obj + else + BIN_DIR_2 ?= .. + OBJ_DIR_2 ?= .. + endif + + GRAPH_DIR := $(TOP_DIR_2)/graph + include $(GRAPH_DIR)/rules.mk + + ifeq ($(TOP_DIR),..) + SRC_DIR := src + else + SRC_DIR := $(TOP_DIR_2)/src + endif + + FT_INCLUDES := $(OBJ_BUILD) $(BUILD_DIR) $(TOP_DIR)/include $(SRC_DIR) + INCLUDES := $(subst /,$(COMPILER_SEP),$(FT_INCLUDES)) + COMPILE = $(CC) $(CFLAGS) $(INCLUDES:%=$I%) + FTLIB := $(LIB_DIR)/$(LIBRARY).$A + ifeq ($(PLATFORM),unix) + MATH := -lm + endif + ifeq ($(PLATFORM),unixdev) + MATH := -lm + endif + LINK_ITEMS = $T$(subst /,$(COMPILER_SEP),$@ $<) + + CC = $(CCraw) + LINK_CMD = $(subst /,$(SEP),$(OBJ_BUILD)/libtool) \ + --mode=link $(CC) \ + $(subst /,$(COMPILER_SEP),$(LDFLAGS)) + ifeq ($(findstring CoreServices,$(LDFLAGS)),) + LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) $(MATH) \ + -Xlinker -framework -Xlinker CoreServices \ + -Xlinker -framework -Xlinker ApplicationServices + else + LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) $(MATH) + endif + LINK_COMMON = $(LINK_CMD) \ + $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ)) \ + $(LINK_LIBS) + + .PHONY: exes clean distclean + + E := + EXES := ftoldmac + exes: $(EXES:%=$(BIN_DIR_2)/%$E) + + $(BIN_DIR_2)/ftoldmac$E: $(OBJ_DIR_2)/ftoldmac.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(OBJ_DIR_2)/ftoldmac.$(SO): $(TOP_DIR_2_MAC)/ftoldmac.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + COMMON_OBJ := $(OBJ_DIR_2)/common.$(SO) + $(COMMON_OBJ): $(SRC_DIR)/common.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + ################################################################ + # Targets to setup MPW + # + + clean: + rm -f \ + $(TOP_DIR_2)/ftoldmac.*.make \ + $(OBJ_DIR_2)/*.NJ \ + $(OBJ_DIR_2)/*.makeout \ + $(OBJ_DIR_2)/*.o $(OBJ_DIR_2)/*.exe + + makefiles: + python $(TOP_DIR_2_MAC)/ascii2mpw.py \ + > $(TOP_DIR_2)/ftoldmac.m68k_far.make \ + < $(TOP_DIR_2_MAC)/ftoldmac.m68k_far.make.txt + python $(TOP_DIR_2_MAC)/ascii2mpw.py \ + > $(TOP_DIR_2)/ftoldmac.ppc_classic.make \ + < $(TOP_DIR_2_MAC)/ftoldmac.ppc_classic.make.txt + find $(TOP_DIR_2) -name '*.make' | \ + xargs /Developer/Tools/SetFile -a l -c "MPS " -t TEXT + + resource: + find $(SRC_DIR) $(TOP_DIR_2_MAC) -name '*.[ch]' | \ + xargs /Developer/Tools/SetFile -a l -c "MPS " -t TEXT +endif diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/README freetype-2.8/=unpacked-tar2=/mac/README --- freetype-2.7.1/=unpacked-tar2=/mac/README 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/README 2015-09-25 05:40:31.000000000 +0000 @@ -0,0 +1,32 @@ +This folder contains supporting code and CodeWarrior Pro 4 project +files to build the FreeType demo programs ftlint and ftview for MacOS. + +Building +To build these apps, you'll first need to build the FreeType library +(see config/mac). Be sure to unpack the resource.hqx file; it contains +two resource files that are needed for ftlint and ftview. The +applications get built in the demos/bin folder. + +Notes +Since the Mac doesn't have the notion of argc/argv, we'll emulate +this: each file dropped onto the application will be translated +to a command line argument. Both ftlint and ftview take a ppem +value as their first command line argument: for the Mac version +this has been hard-coded into the source. Also: the additional +options for ftview cannot be set. + +Appendix +Makefile, ftoldmac.m68k_far.make.txt, ftoldmac.ppc_classic.make.txt +and ftoldmac.c are for commandline program "ftoldmac" to test MacOS +specific API, written by suzuki toshiya. On MacOS X, you can build +ftoldmac by "make -C mac" in the top directory of ft2demos. Also +you can generate MPW makefiles by "make -C mac makefiles", in MacOS +X commandline. + +Have fun with FreeType on the Mac! + +Just van Rossum, + +DISCLAIMER: this subdirectory is *not* being maintained by the +FreeType team, but by Just van Rossum. It's being released under +the same terms as FreeType (see LICENSE.TXT). diff -Nru freetype-2.7.1/=unpacked-tar2=/mac/resource.hqx freetype-2.8/=unpacked-tar2=/mac/resource.hqx --- freetype-2.7.1/=unpacked-tar2=/mac/resource.hqx 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/mac/resource.hqx 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1 @@ +(This file must be converted with BinHex 4.0) :$(*PFfpeFQ0P,R0TG!"6594%8dP8)3%!!!!(9!!!!4kE)90*9#%!!J!!"e4b6'& e!J!!!!!@!!!0!!YQG'aTER3ZFR0bB`EK@D!!4J`+!!!!J!!!!!!'k52Z%qJ*KJ! !!!!!!!!!!!!!!!!!!!!!!!'I!!!!!2rrrrpbFh*M8P0&4!%!Y0lZjl6HlcS!!!' C!!!!!!!!!4N!!!!!Pl)!!!!!!!!!!&+E%3!)(#ae#1,@kQ-l3-r1rA-h'clY+LM H9q+m@S[Fj'KEDPD(PRRlbr3)Nck4+9)bfh$4M895H*J+"lDRd-a-6hUrB81a2k& e%)&b(ZXdrYBdI[ZdE)8F9('8dr066MF[CQTkaA%3fiT"m8l2P`!e0ENhlY2j"FL II%YbGc@ph91S4%8'Z5Xc+&ScAr+%DY2QlM5MEm[C1mhS@lHGdf@4$r)jQ+1c[Yf b16K0FP*c0Q[Vq(0e9lNT3"NeFC`c!fd61PVU13*GNpUBBBEDYdiZ2hX`9eAR44H ,BIaH('A$McIF3lH!AZ"TPCcBbG(bCcBTR0P-J9(CPq!SQh,26%f1,GX[-,2KJYL bC2[mR3Fc+V#JQ6c,1D9*!!!0!!YQG(CTCAFZFR0bB`EK@D!!4J`+!!!!J!!!!!! 'k52ZdTd*KJ!!!!!!!!!!!!!!!!!!!"B!!!!!!!!!!2rrrrpbFh*M8P0&4!%!Y0l Zjl@I*fJ!!!R0!!!!!!!!"88!!!!!G63!!!!!!!!!!0H8#eLdNFH9qjfA8IjfVYc V+,IcSPG[%r1Mef"PGRNH2bHC[@GR+aYdP+r9fR9b,hXDfQaLU$)NfG$H6Ma3l!J rb@q#cPhiF`e!5[$!i!F%P!CrjdRIiQ1U8#HUXAqC0ZNE+"#Gi-UPXm`GcPR6d1+ %j@UFd,+C*c(%&qq,LAI(q@TjQmA%0I,iR)F[aK-IRb@fBHY@VQVKj@[iNHP`l[3 r8D8HchTk%V!p1-QjjcVRES%ZEfC'F$,CbRNT829k%*Nh)ZZjkNHPN6Xb0E*fCNE %"EqJB#rq4EhN$`f-A&)XrIQFJU,$rTe68(6*#1FZS5%%1XqmqPYTB@9aET+h5Bi bPCcIjpGGAFkd#f@Z5RE'80"GFffLmqlRVPl4EB0*UP`qXXLr!m[jJH2TNIjAr2f IrFkCEHB6KGq6aiSXMc-8@6-H+E)pHUM)r[#")XH$G%A1p2X+rr[h&!(hlLTHZ(Y (NH[1E8AJl9Z+&frG915qH814jdDD)QrDGF9,ekmTAVjf9C([kK9&rLZA&DpF[U3 SF1QLiY@,&a4"&miVAMYr6[(kZE1+0mkH843mFeVajZP6LVG1R9381RP#i6TaA2( fm@1+`XH1+SSF2D*ijmKKaEZ($bQ#$ae8[(I`J+,SJIf+prI[8hb`EkqLf0ipLZ* lGLXqh,e,%E)V94'DZP04BZF1a8FlYLXqhVj0mFQfVBU5@lFS2Yfb@I(CjNf+ccG Y9(baFB2Lb`hV&DA@Ve0mY@kYS[6D0BSbDeBVbUjHTIKke8T&f-S9L[!9baAPPLp 6P&qf9&&Kk4*&a5@,&Hl&La59&Le84#aFS+LmB,kLb[ajLQrQc998R6Y(8@h1E%A Nl&Q+U&Nc&Gr16&&mPc*$8Ah'G%@0kG-80DG09G5D1N94HdUbi[[NbBSkNbFTITJ d89&hiJ6&Ma2'+hiD2dlamlLaLRTMabMUMaQYL"ip5Y&Je%K&`j%M&$%MKLXD$4q Qm!`EUQJmG)LLbC!!`BUQJ`FTQJdDU2KPi!$&V`2k+f,lpe2meUq[`YZhMb+Z6fp &mpkp&,rhkUR`pHbKL1r4AC(3[CZL4EHZLTCGZbJ5Zh4@r0'jNk*9Tik+eKdl+2l Xd&l4TRdla9rYfLVqETZNq#I*)ZNI3pZr$Hhq-V4[BqM`Tk&MDd1R9SE1IaLk*"U kYM4dDf(SRQ$S%@rSk62dqYh3ZlQK6jbKVpI3lcG$reM$J&m0!hma$'TQ'0c8-+5 *B@KM`c#2BAJM`iJB`mL'KP%0$+1M$@2U'mE@-iclf6$q*m1%(`d6kaSQr@#BA-H 3!2bpB8TY`p4DKQNe$G0V''C80k4mCjMjV@&@P'&fT'&10F2FUSCjhaMQ9c%XU'a B''&B9-Q`f'eB8Y'`Y)*K@AR$mR+'&H''P@''99mE9TFeV#PM@&[DX1iV`rT5KJe I'MCqBGMdZ@(cCiBYRaUfPM4Xqm5`r@2$MSm-1dXB8N-0Zd)-Zcmdl#PZf&[-X%p IX-ihl2lh$3H+'JkqCcJ8E$MmVZ()1iDM43c(#KZ1[fdii6+F,'3ipCEKp*Z'-`8 0Cpm`R([GF2ie`i8J`m9A$CF+'#krBVL5hh!eRq(DbiEV,aR5mKTZj$(Fc'fipD, KGU$K6Ll$h4F-p`)-prd0k6N0$h)B(QBh2-TQb-KUH*c&m-62k-[r[hh!IlZ6J*4 "Cl2AG8i+iL9VZFJ+9Cfc`Xqf#L(2YJbPBQ*E*$M[ET+HEdHHRVQHVdQ+2EYI(ZH e4%$+`06F8BPHMmrPmm6(YA"@,IRF2SqRCU[Q(PGiZ+YjJeK23S,Rrjhb!!!"!!! !!3!!!!!!!!!!(MX0)#!J)#!J)#"'9&p(E(P`D&p0CA4bD@0c+L"YCA4b$A*PFfp eFQ0PFbjcDA4jFe0jFe0jFe0jFfjcC#PdFh-#)&0*9%46593K!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!YD"h%3!!"e3!!!%HGA4XD@jPAe4bB@jcCQpbE5JJ*QGXHA" S,6jbEfpd,QpeG'aTEQ8X$5!J)#!J)#!J)#!J)#!J)#!J)#!J)#!J)#!J)#!J)#C QB@0P,6jdHA"P-5jQEfjdAfeKG(*TH#!T1`d0)#!J)#!J)#"'9&p2GA4XD@jPAdG PG&p$3Qpi+#!QC`!!!3!!!!%!!!!!!!!!!"i!!!!!!!!!!!!F!"lrrf$Z: \ No newline at end of file diff -Nru freetype-2.7.1/=unpacked-tar2=/Makefile freetype-2.8/=unpacked-tar2=/Makefile --- freetype-2.7.1/=unpacked-tar2=/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/Makefile 2016-12-25 05:45:00.000000000 +0000 @@ -0,0 +1,606 @@ +all: exes + + +#################################################################### +# +# The `space' variable is used to avoid trailing spaces in defining +# the `T' variable later. +# +empty := +space := $(empty) $(empty) + + +#################################################################### +# +# TOP_DIR is the directory where the main FreeType source is found, +# as well as the `config.mk' file. +# +# TOP_DIR_2 is the directory is the top of the demonstration +# programs directory. +# +# OBJ_DIR gives the objects directory of the FreeType library. +# +TOP_DIR ?= ../freetype2 +TOP_DIR_2 ?= . +OBJ_DIR ?= $(TOP_DIR)/objs + + +###################################################################### +# +# CONFIG_MK points to the current `config.mk' to use. It is defined +# by default as $(TOP_DIR)/config.mk. +# +ifndef CONFIG_MK + PROJECT := freetype + CONFIG_MK := $(TOP_DIR)/config.mk +endif + + +###################################################################### +# +# MODULES_CFG points to the current `modules.cfg' to use. It is defined +# by default as $(TOP_DIR)/modules.cfg. +# +MODULES_CFG ?= $(TOP_DIR)/modules.cfg + +ifeq ($(wildcard $(MODULES_CFG)),) + no_modules_cfg := 1 +endif + + +#################################################################### +# +# Check that we have a working `config.mk' in the above directory. +# If not, issue a warning message, then stop there. +# +ifeq ($(wildcard $(CONFIG_MK)),) + no_config_mk := 1 +endif + +ifdef no_config_mk + + exes: + @echo Please compile the library before the demo programs! + clean distclean: + @echo "I need a path to FreeType 2's \`config.mk' to do that!" + @echo "Set the \`TOP_DIR' variable to the correct value." + +else + + #################################################################### + # + # Good, now include `config.mk' in order to know how to build + # object files from sources, as well as other things (compiler + # flags). + # + include $(CONFIG_MK) + + ifndef no_modules_cfg + include $(MODULES_CFG) + endif + + have_makefile := $(strip $(wildcard Makefile)) + + ifeq ($(PLATFORM),unix) + ifdef DEVEL_DIR + PLATFORM := unixdev + endif + endif + + + #################################################################### + # + # Define a few important variables now. + # + ifeq ($(PLATFORM),unix) + # without absolute paths libtool fails + TOP_DIR := $(shell cd $(TOP_DIR); pwd) + TOP_DIR_2 := $(shell cd $(TOP_DIR_2); pwd) + ifneq ($(have_makefile),) + BIN_DIR_2 ?= $(TOP_DIR_2)/bin + OBJ_DIR_2 ?= $(TOP_DIR_2)/obj + else + BIN_DIR_2 ?= . + OBJ_DIR_2 ?= . + endif + else + ifneq ($(have_makefile),) + BIN_DIR_2 ?= bin + OBJ_DIR_2 ?= obj + else + BIN_DIR_2 ?= . + OBJ_DIR_2 ?= . + endif + endif + + GRAPH_DIR := $(TOP_DIR_2)/graph + + ifeq ($(TOP_DIR),..) + SRC_DIR := src + else + SRC_DIR := $(TOP_DIR_2)/src + endif + + FT_INCLUDES := $(OBJ_BUILD) \ + $(BUILD_DIR) \ + $(DEVEL_DIR) \ + $(TOP_DIR)/include \ + $(SRC_DIR) + + COMPILE = $(CC) $(CPPFLAGS) \ + $(CFLAGS) \ + $(ANSIFLAGS) \ + $(INCLUDES:%=$I%) \ + $DFT_CONFIG_MODULES_H="" + + # Enable C99 for gcc to avoid warnings. + # Note that clang++ aborts with an error if we use `-std=C99', + # so check for `++' in $(CC) also. + ifneq ($(findstring -pedantic,$(COMPILE)),) + ifeq ($(findstring ++,$(CC)),) + COMPILE += -std=c99 + endif + endif + + FTLIB := $(LIB_DIR)/$(LIBRARY).$A + + # `-lm' is required to compile on some Unix systems. + # + ifeq ($(PLATFORM),unix) + MATH := -lm + endif + + ifeq ($(PLATFORM),unixdev) + MATH := -lm + endif + + # The default variables used to link the executables. These can + # be redefined for platform-specific stuff. + # + # The first token of LINK_ITEMS must be the executable. + # + LINK_ITEMS = $T$(subst /,$(COMPILER_SEP),$@ $<) + + ifeq ($(PLATFORM),unix) + CC = $(CCraw) + LINK_CMD = $(subst /,$(SEP),$(OBJ_BUILD)/libtool) \ + --mode=link $(CC) \ + $(subst /,$(COMPILER_SEP),$(LDFLAGS)) + LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) + else + LINK_CMD = $(CC) $(subst /,$(COMPILER_SEP),$(LDFLAGS)) + ifeq ($(PLATFORM),unixdev) + LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) -lm -lrt -lz -lbz2 + LINK_LIBS += $(shell pkg-config --libs libpng harfbuzz) + else + LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) + endif + endif + + LINK = $(LINK_CMD) \ + $(LINK_ITEMS) \ + $(LINK_LIBS) + LINK_COMMON = $(LINK_CMD) \ + $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ)) \ + $(LINK_LIBS) + LINK_GRAPH = $(LINK_COMMON) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \ + $(GRAPH_LINK) $(MATH) + LINK_NEW = $(LINK_CMD) \ + $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ) \ + $(FTCOMMON_OBJ)) \ + $(LINK_LIBS) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \ + $(GRAPH_LINK) $(MATH) + + .PHONY: exes clean distclean + + + ################################################################### + # + # Include the rules needed to compile the graphics sub-system. + # This will also select which graphics driver to compile to the + # sub-system. + # + include $(GRAPH_DIR)/rules.mk + + + #################################################################### + # + # Detect DOS-like platforms, currently DOS, Win 3.1, Win32 & OS/2. + # + ifneq ($(findstring $(PLATFORM),os2 win16 win32 dos),) + DOSLIKE := 1 + endif + + + ################################################################### + # + # Clean-up rules. Because the `del' command on DOS-like platforms + # cannot take a long list of arguments, we simply erase the directory + # contents. + # + ifdef DOSLIKE + + clean_demo: + -del obj\*.$(SO) 2> nul + -del $(subst /,\,$(TOP_DIR_2)/src/*.bak) 2> nul + + distclean_demo: clean_demo + -del obj\*.lib 2> nul + -del bin\*.exe 2> nul + + else + + clean_demo: + -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/*.$(SO) $(OBJ_DIR_2)/*.$(O)) + -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/*.$(SA) $(OBJ_DIR_2)/*.$(A)) + -$(DELETE) $(subst /,$(SEP),$(OBJ_DIR_2)/.libs/*) + -$(DELETE) $(subst /,$(SEP),$(SRC_DIR)/*.bak graph/*.bak) + -$(DELETE) $(subst /,$(SEP),$(SRC_DIR)/*~ graph/*~) + + distclean_demo: clean_demo + -$(DELETE) $(subst /,$(SEP),$(EXES:%=$(BIN_DIR_2)/%$E)) + -$(DELETE) $(subst /,$(SEP),$(GRAPH_LIB)) + ifeq ($(PLATFORM),unix) + -$(DELETE) $(BIN_DIR_2)/.libs/* + -$(DELDIR) $(BIN_DIR_2)/.libs + endif + + endif + + clean: clean_demo + distclean: distclean_demo + + + #################################################################### + # + # Compute the executable suffix to use, and put it in `E'. + # It is ".exe" on DOS-ish platforms, and nothing otherwise. + # + ifdef DOSLIKE + E := .exe + else + E := + endif + + + #################################################################### + # + # POSIX TERMIOS: Do not define if you use OLD U*ix like 4.2BSD. + # + ifeq ($(PLATFORM),unix) + EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS + endif + + ifeq ($(PLATFORM),unixdev) + EXTRAFLAGS = $DUNIX $DHAVE_POSIX_TERMIOS + endif + + + ################################################################### + # + # The list of demonstration programs to build. + # + # Note that ttdebug only works if the FreeType's `truetype' driver has + # been compiled with TT_CONFIG_OPTION_BYTECODE_INTERPRETER defined. + # + EXES := ftbench \ + ftdump \ + ftlint \ + ttdebug + + # Comment out the next line if you don't have a graphics subsystem. + EXES += ftdiff \ + ftgamma \ + ftgrid \ + ftmulti \ + ftstring \ + ftview + + # ftvalid requires ftgxval.c and ftotval.c + # + ifneq ($(findstring ftgxval.c,$(BASE_EXTENSIONS)),) + ifneq ($(findstring ftotval.c,$(BASE_EXTENSIONS)),) + EXES += ftvalid + endif + endif + + # The following programs are not compiled automatically; either comment + # out the affected line or use the program name as a Makefile target. + # + # EXES += ftchkwd + # EXES += ftmemchk + # EXES += ftpatchk + # EXES += fttimer + # EXES += testname + + exes: $(EXES:%=$(BIN_DIR_2)/%$E) + + + INCLUDES := $(subst /,$(COMPILER_SEP),$(FT_INCLUDES)) + + + # generic rule + $(OBJ_DIR_2)/%.$(SO): $(SRC_DIR)/%.c $(FTLIB) + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + + #################################################################### + # + # Rules for compiling object files for text-only demos. + # + $(OBJ_DIR_2)/common.$(SO): $(SRC_DIR)/common.c + $(OBJ_DIR_2)/output.$(SO): $(SRC_DIR)/output.c + $(OBJ_DIR_2)/mlgetopt.$(SO): $(SRC_DIR)/mlgetopt.c + COMMON_OBJ := $(OBJ_DIR_2)/common.$(SO) \ + $(OBJ_DIR_2)/output.$(SO) \ + $(OBJ_DIR_2)/mlgetopt.$(SO) + + + FTCOMMON_OBJ := $(OBJ_DIR_2)/ftcommon.$(SO) + $(FTCOMMON_OBJ): $(SRC_DIR)/ftcommon.c $(SRC_DIR)/ftcommon.h + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + + + $(OBJ_DIR_2)/ftlint.$(SO): $(SRC_DIR)/ftlint.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/ftbench.$(SO): $(SRC_DIR)/ftbench.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS) + + $(OBJ_DIR_2)/ftpatchk.$(SO): $(SRC_DIR)/ftpatchk.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS) + + $(OBJ_DIR_2)/ftchkwd.$(SO): $(SRC_DIR)/ftchkwd.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $(EXTRAFLAGS) + + $(OBJ_DIR_2)/compos.$(SO): $(SRC_DIR)/compos.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/ftmemchk.$(SO): $(SRC_DIR)/ftmemchk.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/fttimer.$(SO): $(SRC_DIR)/fttimer.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/fttry.$(SO): $(SRC_DIR)/fttry.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/testname.$(SO): $(SRC_DIR)/testname.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + +# $(OBJ_DIR_2)/ftsbit.$(SO): $(SRC_DIR)/ftsbit.c +# $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + + # We simplify the dependencies on the graphics library by using + # $(GRAPH_LIB) directly. + + $(OBJ_DIR_2)/ftgamma.$(SO): $(SRC_DIR)/ftgamma.c \ + $(SRC_DIR)/ftcommon.h \ + $(GRAPH_LIB) + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/ftmulti.$(SO): $(SRC_DIR)/ftmulti.c \ + $(GRAPH_LIB) + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + + $(OBJ_DIR_2)/ftstring.$(SO): $(SRC_DIR)/ftstring.c \ + $(SRC_DIR)/ftcommon.h \ + $(GRAPH_LIB) + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) + + + #################################################################### + # + # Special rule to compile the `ftdump' program as it includes + # internal header files. + # + $(OBJ_DIR_2)/ftdump.$(SO): $(SRC_DIR)/ftdump.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + + #################################################################### + # + # Special rule to compile the `t1dump' program as it includes + # the Type1 source path. + # + $(OBJ_DIR_2)/t1dump.$(SO): $(SRC_DIR)/t1dump.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + + #################################################################### + # + # Special rule to compile the `ftvalid' program as it includes + # internal header files. + # + $(OBJ_DIR_2)/ftvalid.$(SO): $(SRC_DIR)/ftvalid.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + + #################################################################### + # + # Special rule to compile the `ftview' program as it includes + # internal header files. + # + $(OBJ_DIR_2)/ftview.$(SO): $(SRC_DIR)/ftview.c \ + $(SRC_DIR)/ftcommon.h \ + $(GRAPH_LIB) + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + + #################################################################### + # + # Special rule to compile the `ftdiff' program as it includes + # internal header files. + # + $(OBJ_DIR_2)/ftdiff.$(SO): $(SRC_DIR)/ftdiff.c \ + $(SRC_DIR)/ftcommon.h \ + $(GRAPH_LIB) + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + + #################################################################### + # + # Special rule to compile the `ftgrid' program as it includes + # internal header files. + # + $(OBJ_DIR_2)/ftgrid.$(SO): $(SRC_DIR)/ftgrid.c \ + $(SRC_DIR)/ftcommon.h \ + $(GRAPH_LIB) + $(COMPILE) $(GRAPH_INCLUDES:%=$I%) \ + $T$(subst /,$(COMPILER_SEP),$@ $<) $DFT2_BUILD_LIBRARY + + + #################################################################### + # + # Special rule to compile the `ttdebug' program as it includes + # the TrueType source path and needs extra flags for correct keyboard + # handling on Unix. + + $(OBJ_DIR_2)/ttdebug.$(SO): $(SRC_DIR)/ttdebug.c + $(COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) \ + $I$(subst /,$(COMPILER_SEP),$(TOP_DIR)/src/truetype) \ + $(EXTRAFLAGS) $DFT2_BUILD_LIBRARY + + + #################################################################### + # + # Rules used to link the executables. Note that they could be + # overridden by system-specific things. + # + $(BIN_DIR_2)/ftlint$E: $(OBJ_DIR_2)/ftlint.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/ftbench$E: $(OBJ_DIR_2)/ftbench.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/ftpatchk$E: $(OBJ_DIR_2)/ftpatchk.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/ftchkwd$E: $(OBJ_DIR_2)/ftchkwd.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/ftmemchk$E: $(OBJ_DIR_2)/ftmemchk.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/compos$E: $(OBJ_DIR_2)/compos.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/ftvalid$E: $(OBJ_DIR_2)/ftvalid.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/ftdump$E: $(OBJ_DIR_2)/ftdump.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/fttimer$E: $(OBJ_DIR_2)/fttimer.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/fttry$E: $(OBJ_DIR_2)/fttry.$(SO) $(FTLIB) + $(LINK) + +# $(BIN_DIR_2)/ftsbit$E: $(OBJ_DIR_2)/ftsbit.$(SO) $(FTLIB) +# $(LINK) + + $(BIN_DIR_2)/t1dump$E: $(OBJ_DIR_2)/t1dump.$(SO) $(FTLIB) + $(LINK) + + $(BIN_DIR_2)/ttdebug$E: $(OBJ_DIR_2)/ttdebug.$(SO) $(FTLIB) $(COMMON_OBJ) + $(LINK_COMMON) + + $(BIN_DIR_2)/testname$E: $(OBJ_DIR_2)/testname.$(SO) $(FTLIB) + $(LINK) + + + $(BIN_DIR_2)/ftview$E: $(OBJ_DIR_2)/ftview.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) + $(LINK_NEW) + + $(BIN_DIR_2)/ftgrid$E: $(OBJ_DIR_2)/ftgrid.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) + $(LINK_NEW) + + $(BIN_DIR_2)/ftgamma$E: $(OBJ_DIR_2)/ftgamma.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) + $(LINK_NEW) + + $(BIN_DIR_2)/ftdiff$E: $(OBJ_DIR_2)/ftdiff.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) + $(LINK_NEW) + + $(BIN_DIR_2)/ftmulti$E: $(OBJ_DIR_2)/ftmulti.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) + $(LINK_GRAPH) + + $(BIN_DIR_2)/ftstring$E: $(OBJ_DIR_2)/ftstring.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) + $(LINK_NEW) + + +endif + + +# This target builds the tarballs. +# +# Not to be run by a normal user -- there are no attempts to make it +# generic. + +# we check for `dist', not `distclean' +ifneq ($(findstring distx,$(MAKECMDGOALS)x),) + FT_H := ../freetype2/include/freetype/freetype.h + + major := $(shell sed -n 's/.*FREETYPE_MAJOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) + minor := $(shell sed -n 's/.*FREETYPE_MINOR[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) + patch := $(shell sed -n 's/.*FREETYPE_PATCH[^0-9]*\([0-9]\+\)/\1/p' < $(FT_H)) + + ifneq ($(findstring x0x,x$(patch)x),) + version := $(major).$(minor) + winversion := $(major)$(minor) + else + version := $(major).$(minor).$(patch) + winversion := $(major)$(minor)$(patch) + endif +endif + +dist: + -rm -rf tmp + rm -f ft2demos-$(version).tar.gz + rm -f ft2demos-$(version).tar.bz2 + rm -f ftdmo$(winversion).zip + + for d in `find . -wholename '*/.git' -prune \ + -o -type f \ + -o -print` ; do \ + mkdir -p tmp/$$d ; \ + done ; + + currdir=`pwd` ; \ + for f in `find . -wholename '*/.git' -prune \ + -o -name .gitignore \ + -o -name .mailmap \ + -o -type d \ + -o -print` ; do \ + ln -s $$currdir/$$f tmp/$$f ; \ + done + + cd tmp ; \ + $(MAKE) distclean + + mv tmp ft2demos-$(version) + + tar -H ustar -chf - ft2demos-$(version) \ + | gzip -c > ft2demos-$(version).tar.gz + tar -H ustar -chf - ft2demos-$(version) \ + | bzip2 -c > ft2demos-$(version).tar.bz2 + + @# Use CR/LF for zip files. + zip -lr ftdmo$(winversion).zip ft2demos-$(version) + + rm -fr ft2demos-$(version) + +# EOF diff -Nru freetype-2.7.1/=unpacked-tar2=/obj/README freetype-2.8/=unpacked-tar2=/obj/README --- freetype-2.7.1/=unpacked-tar2=/obj/README 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/obj/README 2009-03-14 13:58:28.000000000 +0000 @@ -0,0 +1 @@ +This directory contains all the object files generated for the demonstration programs diff -Nru freetype-2.7.1/=unpacked-tar2=/README freetype-2.8/=unpacked-tar2=/README --- freetype-2.7.1/=unpacked-tar2=/README 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/README 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,74 @@ +This package contains example programs for the FreeType 2 library. + + +WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + + The Makefile and Jamfile contained in this directory assume that the + FreeType 2 library sources are located in `../freetype2'. If you + downloaded one of the stable FreeType 2 source packages from our + server, you most probably have to rename its directory, for example: + + mv freetype-2.8 freetype2 on Unix + rename freetype-2.8 freetype2 on Windows + +WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + + + First compile the FreeType 2 library, then say `make'. However, you + must rename the directory of the FreeType 2 library to `freetype2' + (or create a symlink) before doing this. + + Note that the demonstration programs include a tiny graphics + sub-system that includes `drivers' to display Windows on Win32, X11, + BeOS, Mac, and OS/2. The build system should automatically detect + which driver to use based on the current platform. + + UNIX USERS + ========== + + X11 issues + ---------- + + When building the demos, the build system tries to detect your X11 + path by looking for the patterns `X11/bin', `X11R6/bin', and + `X11R5/bin' in your current path (in this order). If no X11 path + is found, some demo programs will not be able to display graphics + and will fail. If you have X11 in an unusual place, use the + X11_PATH make variable. More than one directory, if necessary, + must be separated with spaces. Example: + + make X11_PATH="/usr/openwin /usr/local/X11R6" + + The build system then derives the X11_INCLUDE include file path + from X11_PATH by appending `/include' to all path components. It + also derives the X11_LIB library path from X11_PATH by appending + `/lib64' and `/lib' to all components (in that order). You might + override those variables similar to X11_PATH as arguments to + `make'. + + If you don't have X11 at all, fix the definition of the EXES + variable as described in the top-level Makefile. + + Recent versions of Mac OS X no longer deliver X11 by default; you + have to install XQuartz, see + + https://support.apple.com/en-us/HT201341 + + for more details. + + + Using a different build directory + --------------------------------- + + If the `configure' script of the FreeType 2 library is run from a + separate build directory, it creates a dummy Makefile which sets + some variables before including the top-level Makefile of the + source directory. This dummy Makefile can also be used for the + ft2demos package to be compiled in a different build directory: + + make FT2DEMOS=1 -f /path/to/freetype2/build-dir/Makefile + + If necessary, adapt the `TOP_DIR_2' variable to make it point to + the ft2demos source directory. + +--- end of README --- diff -Nru freetype-2.7.1/=unpacked-tar2=/src/common.c freetype-2.8/=unpacked-tar2=/src/common.c --- freetype-2.7.1/=unpacked-tar2=/src/common.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/common.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,109 @@ +/* some utility functions */ + +#include "common.h" + +#include +#include +#include + + + char* + ft_basename( const char* name ) + { + const char* base; + const char* current; + char c; + + base = name; + current = name; + + c = *current; + + while ( c ) + { +#ifndef macintosh + if ( c == '/' || c == '\\' ) +#else + if ( c == ':' ) +#endif + base = current + 1; + + current++; + c = *current; + } + + return (char*)base; + } + + + void + Panic( const char* fmt, + ... ) + { + va_list ap; + + + va_start( ap, fmt ); + vprintf( fmt, ap ); + va_end( ap ); + + exit( 1 ); + } + + + extern int + utf8_next( const char** pcursor, + const char* end ) + { + const unsigned char* p = (const unsigned char*)*pcursor; + int ch; + + + if ( (const char*)p >= end ) /* end of stream */ + return -1; + + ch = *p++; + if ( ch >= 0x80 ) + { + int len; + + + if ( ch < 0xc0 ) /* malformed data */ + goto BAD_DATA; + else if ( ch < 0xe0 ) + { + len = 1; + ch &= 0x1f; + } + else if ( ch < 0xf0 ) + { + len = 2; + ch &= 0x0f; + } + else + { + len = 3; + ch &= 0x07; + } + + while ( len > 0 ) + { + if ( (const char*)p >= end || ( p[0] & 0xc0 ) != 0x80 ) + goto BAD_DATA; + + ch = ( ch << 6 ) | ( p[0] & 0x3f ); + p += 1; + len -= 1; + } + } + + *pcursor = (const char*)p; + + return ch; + + BAD_DATA: + return -1; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/common.h freetype-2.8/=unpacked-tar2=/src/common.h --- freetype-2.7.1/=unpacked-tar2=/src/common.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/common.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,36 @@ +#ifndef COMMON_H_ +#define COMMON_H_ + + +#ifdef __cplusplus + extern "C" { +#endif + + extern char* + ft_basename( const char* name ); + + /* print a message and exit */ + extern void + Panic( const char* fmt, + ... ); + + /* + * Read the next UTF-8 code from `*pcursor' and + * returns its value. `end' is the limit of the + * input string. + * + * Return -1 if the end of the input string is + * reached, or in case of malformed data. + */ + extern int + utf8_next( const char** pcursor, + const char* end ); + +#ifdef __cplusplus + } +#endif + +#endif /* COMMON_H_ */ + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/compos.c freetype-2.8/=unpacked-tar2=/src/compos.c --- freetype-2.7.1/=unpacked-tar2=/src/compos.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/compos.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,192 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-1998, 2001, 2003, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* compos: this is a very simple program used to test the flag */ +/* FT_LOAD_NO_RECURSE */ +/* */ +/* NOTE: This is just a test program that is used to show off and */ +/* debug the current engine. */ +/* */ +/****************************************************************************/ + +#include +#include FT_FREETYPE_H + +#include +#include +#include + + +#define gettext( x ) ( x ) + + FT_Error error; + + FT_Library library; + FT_Face face; + FT_Size size; + FT_GlyphSlot slot; + + unsigned int num_glyphs; + int ptsize; + + int Fail; + int Num; + + + + static void Usage( char* name ) + { + printf( "compos: test FT_LOAD_NO_RECURSE load flag - www.freetype.org\n" ); + printf( "------------------------------------------------------------\n" ); + printf( "\n" ); + printf( "Usage: %s fontname[.ttf|.ttc] [fontname2..]\n", name ); + printf( "\n" ); + + exit( 1 ); + } + + + static void Panic( const char* message ) + { + fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); + exit(1); + } + + + int main( int argc, char** argv ) + { + int i, file_index; + unsigned int id; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + char* fname; + + + execname = argv[0]; + + if ( argc < 2 ) + Usage( execname ); + + error = FT_Init_FreeType( &library ); + if (error) Panic( "Could not create library object" ); + + /* Now check all files */ + for ( file_index = 1; file_index < argc; file_index++ ) + { + fname = argv[file_index]; + i = strlen( fname ); + while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) + { + if ( fname[i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, fname, 1024 ); + strncpy( alt_filename, fname, 1024 ); + +#ifndef macintosh + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } +#endif + i = strlen( filename ); + fname = filename; + + while ( i >= 0 ) +#ifndef macintosh + if ( filename[i] == '/' || filename[i] == '\\' ) +#else + if ( filename[i] == ':' ) +#endif + { + fname = filename + i + 1; + i = -1; + } + else + i--; + + printf( "%s:\n", fname ); + + /* Load face */ + error = FT_New_Face( library, filename, 0, &face ); + if (error) + { + if (error == FT_Err_Invalid_File_Format) + printf( "unknown format\n" ); + else + printf( "could not find/open file (error: %d)\n", error ); + continue; + } + + num_glyphs = face->num_glyphs; + slot = face->glyph; + + Fail = 0; + { + for ( id = 0; id < num_glyphs; id++ ) + { + int has_scale; + + error = FT_Load_Glyph( face, id, FT_LOAD_NO_RECURSE ); + if ( !error && slot->format == FT_GLYPH_FORMAT_COMPOSITE ) + { + int n; + FT_SubGlyph* subg = slot->subglyphs; + + printf( "%4d:", id ); + for ( n = 0; n < slot->num_subglyphs; n++, subg++ ) + { + has_scale = subg->flags & ( + FT_SUBGLYPH_FLAG_SCALE | + FT_SUBGLYPH_FLAG_XY_SCALE | + FT_SUBGLYPH_FLAG_2X2 ); + + printf( " [%d%c", + subg->index, + subg->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ? '*' : ' ' ); + + if ( subg->arg1|subg->arg2 ) + { + if ( subg->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) + printf( "(%d,%d)", subg->arg1, subg->arg2 ); + else + printf( "<%d,%d>", subg->arg1, subg->arg2 ); + } + + if (has_scale) + printf( "-{%0.3f %0.3f %0.3f %0.3f}", + subg->transform.xx/65536.0, + subg->transform.xy/65536.0, + subg->transform.yx/65536.0, + subg->transform.yy/65536.0 ); + printf( "]" ); + } + printf( " adv=%ld lsb=%ld\n", + slot->metrics.horiAdvance, + slot->metrics.horiBearingX ); + } + } + } + + FT_Done_Face( face ); + } + + FT_Done_FreeType(library); + exit( 0 ); /* for safety reasons */ + + return 0; /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftbench.1 freetype-2.8/=unpacked-tar2=/src/ftbench.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftbench.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftbench.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,162 @@ +'\" t +.TH FTVIEW 1 "May 2017" "Freetype 2.8" +. +. +.SH NAME +. +ftbench \- benchmark some common FreeType paths +. +. +.SH SYNOPSIS +. +.B ftbench +.RI [ options ] +.I fontname +. +. +.SH DESCRIPTION +. +The +.B ftbench +tool measures performance of some common FreeType operations. +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.B \-C +Compare with cached version if available. +. +.TP +.BI \-c \ n +Use at most +.I n +iterations for each test (0 means time limited). +. +.TP +.BI \-f \ l +Use +.B hexadecimal +(not decimal) number +.I l +as load flags (see the +.RB ` FT_LOAD_XXX ' +macros in the FreeType reference). +. +.TP +.BI "\-H " name +Using CFF hinting engine +.IR name . +Available versions are depending on compilation options of FreeType; +call +.B ftbench +without an argument to get the actual list. +. +.TP +.BI "\-I " ver +Using TT interpreter version +.IR ver . +Available versions are depending on compilation options of FreeType; +call +.B ftbench +without an argument to get the actual list. +. +.TP +.BI \-i \ idx +Start with glyph index +.I idx +(default is 0, which means to process all glyphs). +. +.TP +.BI \-m \ m +Set maximum cache size to +.I M +KiByte (default is 1024). +. +.TP +.B \-p +Preload font file in memory (this is, testing +.B FT_New_Memory_Face +instead of +.BR FT_New_Face ). +. +.TP +.BI \-r \ n +Set render mode to +.IR n : +. +.RS +.TS +tab (@); +rB l. +0@normal +1@light +2@mono +3@horizontal LCD +4@vertical LCD +.TE +.RE +. +.IP +(default is 0). +This corresponds to the values of the +.RB ` FT_RENDER_MODE_XXX ' +flags. +. +.TP +.BI \-s \ s +Use +.I s +ppem as face size (default is 10ppem). +If set to zero, don't call +.BR FT_Set_Pixel_Sizes . +Use value\ 0 with option +.RB ` "-f\ 1" ' +or something similar to load the glyphs unscaled, +otherwise errors will show up. +. +.TP +.BI \-t \ t +Use at most +.I t +seconds per test (default is 2). +. +.TP +.BI \-b \ tests +Perform chosen tests: +. +.RS +.TS +tab (@); +rB l. +a@load glyphs (FT_Load_Glyph) +b@load advance widths (FT_Get_Advances) +c@render glyphs (FT_Render_Glyph) +d@load glyphs (FT_Get_Glyph) +e@get glyph cboxes (FT_Glyph_Get_CBox) +f@get glyph indices (FT_Get_Char_Index) +g@iterate CMap (FT_Get_{First,Next}_Char) +h@open a new face (FT_New_Face or FT_New_Memory_Face) +i@embolden glyphs (FT_GlyphSlot_Embolden) +j@get glyph bboxes (FT_Outline_Get_BBox) +.TE +.RE +. +.IP +(default is +.BR abcdefghij , +this is, all tests). +. +.IP +The number of used glyphs per test (within a single iteration) is given by +option +.BR \-i . +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftbench.c freetype-2.8/=unpacked-tar2=/src/ftbench.c --- freetype-2.7.1/=unpacked-tar2=/src/ftbench.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftbench.c 2017-05-11 16:36:47.000000000 +0000 @@ -0,0 +1,1321 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2002-2016 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* ftbench: bench some common FreeType call paths */ +/* */ +/****************************************************************************/ + + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* we want to use extensions to `time.h' if available */ +#endif + +#include +#include +#include +#include +#include + +#include FT_FREETYPE_H +#include FT_GLYPH_H +#include FT_CACHE_H +#include FT_CACHE_CHARMAP_H +#include FT_CACHE_IMAGE_H +#include FT_CACHE_SMALL_BITMAPS_H +#include FT_SYNTHESIS_H +#include FT_ADVANCES_H +#include FT_OUTLINE_H +#include FT_BBOX_H +#include FT_MODULE_H +#include FT_CFF_DRIVER_H +#include FT_TRUETYPE_DRIVER_H +#include FT_LCD_FILTER_H + +#ifdef UNIX +#include +#else +#include "mlgetopt.h" +#endif + +#include "common.h" + + + typedef struct btimer_t_ { + double t0; + double total; + + } btimer_t; + + + typedef int + (*bcall_t)( btimer_t* timer, + FT_Face face, + void* user_data ); + + + typedef struct btest_t_ { + const char* title; + bcall_t bench; + int cache_first; + void* user_data; + + } btest_t; + + + typedef struct bcharset_t_ + { + FT_Int size; + FT_ULong* code; + + } bcharset_t; + + + static FT_Error + get_face( FT_Face* face ); + + + /* + * Globals + */ + +#define CACHE_SIZE 1024 +#define BENCH_TIME 2.0f +#define FACE_SIZE 10 + + + static FT_Library lib; + static FTC_Manager cache_man; + static FTC_CMapCache cmap_cache; + static FTC_ImageCache image_cache; + static FTC_SBitCache sbit_cache; + static FTC_ImageTypeRec font_type; + + + enum { + FT_BENCH_LOAD_GLYPH, + FT_BENCH_LOAD_ADVANCES, + FT_BENCH_RENDER, + FT_BENCH_GET_GLYPH, + FT_BENCH_GET_CBOX, + FT_BENCH_CMAP, + FT_BENCH_CMAP_ITER, + FT_BENCH_NEW_FACE, + FT_BENCH_EMBOLDEN, + FT_BENCH_GET_BBOX, + N_FT_BENCH + }; + + + static const char* bench_desc[] = + { + "load a glyph (FT_Load_Glyph)", + "load advance widths (FT_Get_Advances)", + "render a glyph (FT_Render_Glyph)", + "load a glyph (FT_Get_Glyph)", + "get glyph cbox (FT_Glyph_Get_CBox)", + "get glyph indices (FT_Get_Char_Index)", + "iterate CMap (FT_Get_{First,Next}_Char)", + "open a new face (FT_New_Face)", + "embolden (FT_GlyphSlot_Embolden)", + "get glyph bbox (FT_Outline_Get_BBox)", + NULL + }; + + + static int preload; + static char* filename; + + static unsigned int first_index; + + static FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL; + static FT_Int32 load_flags = FT_LOAD_DEFAULT; + + static unsigned int tt_interpreter_versions[3]; + static int num_tt_interpreter_versions; + static unsigned int dflt_tt_interpreter_version; + + static unsigned int cff_hinting_engines[2]; + static int num_cff_hinting_engines; + static unsigned int dflt_cff_hinting_engine; + + static char cff_hinting_engine_names[2][10] = { "freetype", + "adobe" }; + + + /* + * Dummy face requester (the face object is already loaded) + */ + + static FT_Error + face_requester( FTC_FaceID face_id, + FT_Library library, + FT_Pointer request_data, + FT_Face* aface ) + { + FT_UNUSED( face_id ); + FT_UNUSED( library ); + + *aface = (FT_Face)request_data; + + return FT_Err_Ok; + } + + + /* + * timer in milliseconds + */ + + static double + get_time( void ) + { +#if defined _POSIX_TIMERS && _POSIX_TIMERS > 0 + struct timespec tv; + + +#ifdef _POSIX_CPUTIME + clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &tv ); +#else + clock_gettime( CLOCK_REALTIME, &tv ); +#endif /* _POSIX_CPUTIME */ + + return 1E6 * (double)tv.tv_sec + 1E-3 * (double)tv.tv_nsec; +#else + /* clock() accuracy has improved since glibc 2.18 */ + return 1E6 * (double)clock() / (double)CLOCKS_PER_SEC; +#endif /* _POSIX_TIMERS */ + } + +#define TIMER_START( timer ) ( timer )->t0 = get_time() +#define TIMER_STOP( timer ) ( timer )->total += get_time() - ( timer )->t0 +#define TIMER_GET( timer ) ( timer )->total +#define TIMER_RESET( timer ) ( timer )->total = 0 + + + /* + * Bench code + */ + + static void + benchmark( FT_Face face, + btest_t* test, + int max_iter, + double max_time ) + { + int n, done; + btimer_t timer, elapsed; + + + if ( test->cache_first ) + { + if ( !cache_man ) + { + printf( " %-25s no cache manager\n", test->title ); + + return; + } + + TIMER_RESET( &timer ); + test->bench( &timer, face, test->user_data ); + } + + printf( " %-25s ", test->title ); + fflush( stdout ); + + TIMER_RESET( &timer ); + TIMER_RESET( &elapsed ); + + for ( n = 0, done = 0; !max_iter || n < max_iter; n++ ) + { + TIMER_START( &elapsed ); + + done += test->bench( &timer, face, test->user_data ); + + TIMER_STOP( &elapsed ); + + if ( TIMER_GET( &elapsed ) > 1E6 * max_time ) + break; + } + + if ( done ) + printf( "%5.3f us/op\n", TIMER_GET( &timer ) / (double)done ); + else + printf( "no error-free calls\n" ); + } + + + /* + * Various tests + */ + + static int + test_load( btimer_t* timer, + FT_Face face, + void* user_data ) + { + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + TIMER_START( timer ); + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( !FT_Load_Glyph( face, i, load_flags ) ) + done++; + } + + TIMER_STOP( timer ); + + return done; + } + + + static int + test_load_advances( btimer_t* timer, + FT_Face face, + void* user_data ) + { + int done = 0; + FT_Fixed* advances; + FT_ULong flags = *((FT_ULong*)user_data); + + + advances = (FT_Fixed *)calloc( sizeof ( FT_Fixed ), + (size_t)face->num_glyphs ); + + TIMER_START( timer ); + + FT_Get_Advances( face, + first_index, + (unsigned int)face->num_glyphs - first_index, + (FT_Int32)flags, + advances ); + done += face->num_glyphs - (int)first_index; + + TIMER_STOP( timer ); + + free( advances ); + + return done; + } + + + static int + test_render( btimer_t* timer, + FT_Face face, + void* user_data ) + { + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( FT_Load_Glyph( face, i, load_flags ) ) + continue; + + TIMER_START( timer ); + if ( !FT_Render_Glyph( face->glyph, render_mode ) ) + done++; + TIMER_STOP( timer ); + } + + return done; + } + + + static int + test_embolden( btimer_t* timer, + FT_Face face, + void* user_data ) + { + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( FT_Load_Glyph( face, i, load_flags ) ) + continue; + + TIMER_START( timer ); + FT_GlyphSlot_Embolden( face->glyph ); + done++; + TIMER_STOP( timer ); + } + + return done; + } + + + static int + test_get_glyph( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FT_Glyph glyph; + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( FT_Load_Glyph( face, i, load_flags ) ) + continue; + + TIMER_START( timer ); + if ( !FT_Get_Glyph( face->glyph, &glyph ) ) + { + FT_Done_Glyph( glyph ); + done++; + } + TIMER_STOP( timer ); + } + + return done; + } + + + static int + test_get_cbox( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FT_Glyph glyph; + FT_BBox bbox; + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( FT_Load_Glyph( face, i, load_flags ) ) + continue; + + if ( FT_Get_Glyph( face->glyph, &glyph ) ) + continue; + + TIMER_START( timer ); + FT_Glyph_Get_CBox( glyph, FT_GLYPH_BBOX_PIXELS, &bbox ); + TIMER_STOP( timer ); + + FT_Done_Glyph( glyph ); + done++; + } + + return done; + } + + + static int + test_get_bbox( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FT_BBox bbox; + unsigned int i; + int done = 0; + FT_Matrix rot30 = { 0xDDB4, -0x8000, 0x8000, 0xDDB4 }; + + FT_UNUSED( user_data ); + + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + FT_Outline* outline; + + + if ( FT_Load_Glyph( face, i, load_flags ) ) + continue; + + outline = &face->glyph->outline; + + /* rotate outline by 30 degrees */ + FT_Outline_Transform( outline, &rot30 ); + + TIMER_START( timer ); + FT_Outline_Get_BBox( outline, &bbox ); + TIMER_STOP( timer ); + + done++; + } + + return done; + } + + + static int + test_get_char_index( btimer_t* timer, + FT_Face face, + void* user_data ) + { + bcharset_t* charset = (bcharset_t*)user_data; + int i, done = 0; + + + TIMER_START( timer ); + + for ( i = 0; i < charset->size; i++ ) + { + if ( FT_Get_Char_Index(face, charset->code[i]) ) + done++; + } + + TIMER_STOP( timer ); + + return done; + } + + + static int + test_cmap_cache( btimer_t* timer, + FT_Face face, + void* user_data ) + { + bcharset_t* charset = (bcharset_t*)user_data; + int i, done = 0; + + FT_UNUSED( face ); + + + if ( !cmap_cache ) + { + if ( FTC_CMapCache_New( cache_man, &cmap_cache ) ) + return 0; + } + + TIMER_START( timer ); + + for ( i = 0; i < charset->size; i++ ) + { + if ( FTC_CMapCache_Lookup( cmap_cache, + font_type.face_id, + 0, + charset->code[i] ) ) + done++; + } + + TIMER_STOP( timer ); + + return done; + } + + + static int + test_image_cache( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FT_Glyph glyph; + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + if ( !image_cache ) + { + if ( FTC_ImageCache_New( cache_man, &image_cache ) ) + return 0; + } + + TIMER_START( timer ); + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( !FTC_ImageCache_Lookup( image_cache, + &font_type, + i, + &glyph, + NULL ) ) + done++; + } + + TIMER_STOP( timer ); + + return done; + } + + + static int + test_sbit_cache( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FTC_SBit glyph; + unsigned int i; + int done = 0; + + FT_UNUSED( user_data ); + + + if ( !sbit_cache ) + { + if ( FTC_SBitCache_New( cache_man, &sbit_cache ) ) + return 0; + } + + TIMER_START( timer ); + + for ( i = first_index; i < (unsigned int)face->num_glyphs; i++ ) + { + if ( !FTC_SBitCache_Lookup( sbit_cache, + &font_type, + i, + &glyph, + NULL ) ) + done++; + } + + TIMER_STOP( timer ); + + return done; + } + + + static int + test_cmap_iter( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FT_UInt idx; + FT_ULong charcode; + + FT_UNUSED( user_data ); + + + TIMER_START( timer ); + + charcode = FT_Get_First_Char( face, &idx ); + while ( idx != 0 ) + charcode = FT_Get_Next_Char( face, charcode, &idx ); + + TIMER_STOP( timer ); + + return 1; + } + + + static int + test_new_face( btimer_t* timer, + FT_Face face, + void* user_data ) + { + FT_Face bench_face; + + FT_UNUSED( face ); + FT_UNUSED( user_data ); + + + TIMER_START( timer ); + + if ( !get_face( &bench_face ) ) + FT_Done_Face( bench_face ); + + TIMER_STOP( timer ); + + return 1; + } + + + /* + * main + */ + + static void + get_charset( FT_Face face, + bcharset_t* charset ) + { + FT_ULong charcode; + FT_UInt gindex; + int i; + + + charset->code = (FT_ULong*)calloc( (size_t)face->num_glyphs, + sizeof ( FT_ULong ) ); + if ( !charset->code ) + return; + + if ( face->charmap ) + { + i = 0; + charcode = FT_Get_First_Char( face, &gindex ); + + /* certain fonts contain a broken charmap that will map character */ + /* codes to out-of-bounds glyph indices. Take care of that here. */ + /* */ + while ( gindex && i < face->num_glyphs ) + { + if ( gindex >= first_index ) + charset->code[i++] = charcode; + charcode = FT_Get_Next_Char( face, charcode, &gindex ); + } + } + else + { + unsigned int j; + + + /* no charmap, do an identity mapping */ + for ( i = 0, j = first_index; + j < (unsigned int)face->num_glyphs; + i++, j++ ) + charset->code[i] = j; + } + + charset->size = i; + } + + + static FT_Error + get_face( FT_Face* face ) + { + static unsigned char* memory_file = NULL; + static size_t memory_size; + int face_index = 0; + FT_Error error; + + + if ( preload ) + { + if ( !memory_file ) + { + FILE* file = fopen( filename, "rb" ); + + + if ( file == NULL ) + { + fprintf( stderr, "couldn't find or open `%s'\n", filename ); + + return 1; + } + + fseek( file, 0, SEEK_END ); + memory_size = (size_t)ftell( file ); + fseek( file, 0, SEEK_SET ); + + memory_file = (FT_Byte*)malloc( memory_size ); + if ( memory_file == NULL ) + { + fprintf( stderr, + "couldn't allocate memory to pre-load font file\n" ); + + return 1; + } + + if ( fread( memory_file, 1, memory_size, file ) != memory_size ) + { + fprintf( stderr, "read error\n" ); + free( memory_file ); + memory_file = NULL; + + return 1; + } + } + + error = FT_New_Memory_Face( lib, + memory_file, + (FT_Long)memory_size, + face_index, + face ); + } + else + error = FT_New_Face( lib, filename, face_index, face ); + + if ( error ) + fprintf( stderr, "couldn't load font resource\n"); + + return error; + } + + + static void + usage( void ) + { + int i; + char interpreter_versions[32]; + char hinting_engines[32]; + + + /* we expect that at least one interpreter version is available */ + if ( num_tt_interpreter_versions == 2 ) + sprintf(interpreter_versions, + "%d and %d", + tt_interpreter_versions[0], + tt_interpreter_versions[1] ); + else + sprintf(interpreter_versions, + "%d, %d, and %d", + tt_interpreter_versions[0], + tt_interpreter_versions[1], + tt_interpreter_versions[2] ); + + /* we expect that at least one hinting engine is available */ + if ( num_cff_hinting_engines == 1 ) + sprintf(hinting_engines, + "`%s'", + cff_hinting_engine_names[cff_hinting_engines[0]] ); + else + sprintf(hinting_engines, + "`%s' and `%s'", + cff_hinting_engine_names[cff_hinting_engines[0]], + cff_hinting_engine_names[cff_hinting_engines[1]] ); + + + fprintf( stderr, + "\n" + "ftbench: run FreeType benchmarks\n" + "--------------------------------\n" + "\n" + "Usage: ftbench [options] fontname\n" + "\n" + " -C Compare with cached version (if available).\n" + " -c N Use at most N iterations for each test\n" + " (0 means time limited).\n" + " -f L Use hex number L as load flags (see `FT_LOAD_XXX').\n" + " -H NAME Use CFF hinting engine NAME.\n" + " Available versions are %s; default is `%s'.\n" + " -I VER Use TT interpreter version VER.\n" + " Available versions are %s; default is version %d.\n" + " -i IDX Start with index IDX (default is 0).\n" + " -l N Set LCD filter to N\n" + " 0: none, 1: default, 2: light, 16: legacy\n" + " -m M Set maximum cache size to M KiByte (default is %d).\n", + hinting_engines, + cff_hinting_engine_names[dflt_cff_hinting_engine], + interpreter_versions, + dflt_tt_interpreter_version, + CACHE_SIZE ); + fprintf( stderr, + " -p Preload font file in memory.\n" + " -r N Set render mode to N\n" + " 0: normal, 1: light, 2: mono, 3: LCD, 4: LCD vertical\n" + " (default is 0).\n" + " -s S Use S ppem as face size (default is %dppem).\n" + " If set to zero, don't call FT_Set_Pixel_Sizes.\n" + " Use value 0 with option `-f 1' or something similar to\n" + " load the glyphs unscaled, otherwise errors will show up.\n", + FACE_SIZE ); + fprintf( stderr, + " -t T Use at most T seconds per bench (default is %.0f).\n" + "\n" + " -b tests Perform chosen tests (default is all):\n", + BENCH_TIME ); + + for ( i = 0; i < N_FT_BENCH; i++ ) + { + if ( !bench_desc[i] ) + break; + + fprintf( stderr, + " %c %s\n", 'a' + i, bench_desc[i] ); + } + + fprintf( stderr, + "\n" + " -v Show version.\n" + "\n" ); + + exit( 1 ); + } + + +#define TEST( x ) ( !test_string || strchr( test_string, (x) ) ) + + + int + main( int argc, + char** argv ) + { + FT_Face face; + FT_Error error; + + unsigned long max_bytes = CACHE_SIZE * 1024; + char* test_string = NULL; + unsigned int size = FACE_SIZE; + int max_iter = 0; + double max_time = BENCH_TIME; + int compare_cached = 0; + size_t i; + int j; + + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + unsigned int engines[2] = { FT_CFF_HINTING_FREETYPE, + FT_CFF_HINTING_ADOBE }; + int version; + char *engine; + + + if ( FT_Init_FreeType( &lib ) ) + { + fprintf( stderr, "could not initialize font library\n" ); + + return 1; + } + + + /* collect all available versions, then set again the default */ + FT_Property_Get( lib, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( j = 0; j < 3; j++ ) + { + error = FT_Property_Set( lib, + "truetype", + "interpreter-version", &versions[j] ); + if ( !error ) + tt_interpreter_versions[num_tt_interpreter_versions++] = versions[j]; + } + FT_Property_Set( lib, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + + FT_Property_Get( lib, + "cff", + "hinting-engine", &dflt_cff_hinting_engine ); + for ( j = 0; j < 2; j++ ) + { + error = FT_Property_Set( lib, + "cff", + "hinting-engine", &engines[j] ); + if ( !error ) + cff_hinting_engines[num_cff_hinting_engines++] = engines[j]; + } + FT_Property_Set( lib, + "cff", + "hinting-engine", &dflt_cff_hinting_engine ); + + + version = (int)dflt_tt_interpreter_version; + engine = cff_hinting_engine_names[dflt_cff_hinting_engine]; + + while ( 1 ) + { + int opt; + + + opt = getopt( argc, argv, "b:Cc:f:H:I:i:l:m:pr:s:t:v" ); + + if ( opt == -1 ) + break; + + switch ( opt ) + { + case 'b': + test_string = optarg; + break; + + case 'C': + compare_cached = 1; + break; + + case 'c': + max_iter = atoi( optarg ); + if ( max_iter < 0 ) + max_iter = -max_iter; + break; + + case 'f': + load_flags = strtol( optarg, NULL, 16 ); + break; + + case 'H': + engine = optarg; + + for ( j = 0; j < num_cff_hinting_engines; j++ ) + { + if ( !strcmp( engine, cff_hinting_engine_names[j] ) ) + { + FT_Property_Set( lib, + "cff", + "hinting-engine", &j ); + break; + } + } + + if ( j == num_cff_hinting_engines ) + fprintf( stderr, + "warning: couldn't set CFF hinting engine\n" ); + break; + + case 'I': + version = atoi( optarg ); + + for ( j = 0; j < num_tt_interpreter_versions; j++ ) + { + if ( version == (int)tt_interpreter_versions[j] ) + { + FT_Property_Set( lib, + "truetype", + "interpreter-version", &version ); + break; + } + } + + if ( j == num_tt_interpreter_versions ) + fprintf( stderr, + "warning: couldn't set TT interpreter version\n" ); + break; + + case 'i': + { + int fi = atoi( optarg ); + + + if ( fi > 0 ) + first_index = (unsigned int)fi; + } + break; + + case 'l': + { + int filter = atoi( optarg ); + + + switch ( filter ) + { + case FT_LCD_FILTER_NONE: + case FT_LCD_FILTER_DEFAULT: + case FT_LCD_FILTER_LIGHT: + case FT_LCD_FILTER_LEGACY1: + case FT_LCD_FILTER_LEGACY: + FT_Library_SetLcdFilter( lib, (FT_LcdFilter)filter ); + } + } + break; + + case 'm': + { + int mb = atoi( optarg ); + + + if ( mb > 0 ) + max_bytes = (unsigned int)mb * 1024; + } + break; + + case 'p': + preload = 1; + break; + + case 'r': + { + int rm = atoi( optarg ); + + + if ( rm < 0 || rm >= FT_RENDER_MODE_MAX ) + render_mode = FT_RENDER_MODE_NORMAL; + else + render_mode = (FT_Render_Mode)rm; + } + break; + + case 's': + { + int sz = atoi( optarg ); + + + /* value 0 is special */ + if ( sz < 0 ) + size = 1; + else + size = (unsigned int)sz; + } + break; + + case 't': + max_time = atof( optarg ); + if ( max_time < 0 ) + max_time = -max_time; + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( lib, &major, &minor, &patch ); + + printf( "ftbench (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + default: + usage(); + break; + } + } + + argc -= optind; + argv += optind; + + if ( argc != 1 ) + usage(); + + filename = *argv; + + if ( get_face( &face ) ) + goto Exit; + + if ( size ) + { + if ( FT_IS_SCALABLE( face ) ) + { + if ( FT_Set_Pixel_Sizes( face, size, size ) ) + { + fprintf( stderr, "failed to set pixel size to %d\n", size ); + + return 1; + } + } + else + { + size = (unsigned int)face->available_sizes[0].size >> 6; + fprintf( stderr, + "using size of first bitmap strike (%dpx)\n", size ); + FT_Select_Size( face, 0 ); + } + } + + FTC_Manager_New( lib, + 0, + 0, + max_bytes, + face_requester, + face, + &cache_man ); + + font_type.face_id = (FTC_FaceID)1; + font_type.width = size; + font_type.height = size; + font_type.flags = load_flags; + + printf( "\n" + "ftbench results for font `%s'\n" + "---------------------------", + filename ); + for ( i = 0; i < strlen( filename ); i++ ) + putchar( '-' ); + putchar( '\n' ); + + printf( "\n" + "family: %s\n" + " style: %s\n" + "\n", + face->family_name, + face->style_name ); + + if ( max_iter ) + printf( "number of iterations for each test: at most %d\n", + max_iter ); + printf( "number of seconds for each test: %s%f\n", + max_iter ? "at most " : "", + max_time ); + + printf( "\n" + "starting glyph index: %d\n" + "face size: %dppem\n" + "font preloading into memory: %s\n", + first_index, + size, + preload ? "yes" : "no" ); + + printf( "\n" + "load flags: 0x%X\n" + "render mode: %d\n", + load_flags, + render_mode ); + printf( "\n" + "CFF hinting engine set to `%s'\n" + "TrueType interpreter set to version %d\n" + "maximum cache size: %ldKiByte\n", + engine, + version, + max_bytes / 1024 ); + + printf( "\n" + "executing tests:\n" ); + + for ( j = 0; j < N_FT_BENCH; j++ ) + { + btest_t test; + FT_ULong flags; + + + if ( !TEST( 'a' + j ) ) + continue; + + test.title = NULL; + test.bench = NULL; + test.cache_first = 0; + test.user_data = NULL; + + switch ( j ) + { + case FT_BENCH_LOAD_GLYPH: + test.title = "Load"; + test.bench = test_load; + benchmark( face, &test, max_iter, max_time ); + + if ( compare_cached ) + { + test.cache_first = 1; + + test.title = "Load (image cached)"; + test.bench = test_image_cache; + benchmark( face, &test, max_iter, max_time ); + + test.title = "Load (sbit cached)"; + test.bench = test_sbit_cache; + if ( size ) + benchmark( face, &test, max_iter, max_time ); + else + printf( " %-25s disabled (size = 0)\n", test.title ); + } + break; + + case FT_BENCH_LOAD_ADVANCES: + test.user_data = &flags; + + test.title = "Load_Advances (Normal)"; + test.bench = test_load_advances; + flags = FT_LOAD_DEFAULT; + benchmark( face, &test, max_iter, max_time ); + + test.title = "Load_Advances (Fast)"; + test.bench = test_load_advances; + flags = FT_LOAD_TARGET_LIGHT; + benchmark( face, &test, max_iter, max_time ); + + test.title = "Load_Advances (Unscaled)"; + test.bench = test_load_advances; + flags = FT_LOAD_NO_SCALE; + benchmark( face, &test, max_iter, max_time ); + break; + + case FT_BENCH_RENDER: + test.title = "Render"; + test.bench = test_render; + if ( size ) + benchmark( face, &test, max_iter, max_time ); + else + printf( " %-25s disabled (size = 0)\n", test.title ); + break; + + case FT_BENCH_GET_GLYPH: + test.title = "Get_Glyph"; + test.bench = test_get_glyph; + benchmark( face, &test, max_iter, max_time ); + break; + + case FT_BENCH_GET_CBOX: + test.title = "Get_CBox"; + test.bench = test_get_cbox; + benchmark( face, &test, max_iter, max_time ); + break; + + case FT_BENCH_GET_BBOX: + test.title = "Get_BBox"; + test.bench = test_get_bbox; + benchmark( face, &test, max_iter, max_time ); + break; + + case FT_BENCH_CMAP: + { + bcharset_t charset; + + + get_charset( face, &charset ); + if ( charset.code ) + { + test.user_data = (void*)&charset; + + + test.title = "Get_Char_Index"; + test.bench = test_get_char_index; + + benchmark( face, &test, max_iter, max_time ); + + if ( compare_cached ) + { + test.cache_first = 1; + + test.title = "Get_Char_Index (cached)"; + test.bench = test_cmap_cache; + benchmark( face, &test, max_iter, max_time ); + } + + free( charset.code ); + } + } + break; + + case FT_BENCH_CMAP_ITER: + test.title = "Iterate CMap"; + test.bench = test_cmap_iter; + benchmark( face, &test, max_iter, max_time ); + break; + + case FT_BENCH_NEW_FACE: + test.title = "New_Face"; + test.bench = test_new_face; + benchmark( face, &test, max_iter, max_time ); + break; + + case FT_BENCH_EMBOLDEN: + test.title = "Embolden"; + test.bench = test_embolden; + if ( size ) + benchmark( face, &test, max_iter, max_time ); + else + printf( " %-25s disabled (size = 0)\n", test.title ); + break; + } + } + + Exit: + /* The following is a bit subtle: When we call FTC_Manager_Done, this + * normally destroys all FT_Face objects that the cache might have + * created by calling the face requester. + * + * However, this little benchmark uses a tricky face requester that + * doesn't create a new FT_Face through FT_New_Face but simply passes a + * pointer to the one that was previously created. + * + * If the cache manager has been used before, the call to + * FTC_Manager_Done discards our single FT_Face. + * + * In the case where no cache manager is in place, or if no test was + * run, the call to FT_Done_FreeType releases any remaining FT_Face + * object anyway. + */ + if ( cache_man ) + FTC_Manager_Done( cache_man ); + + FT_Done_FreeType( lib ); + + return 0; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftchkwd.c freetype-2.8/=unpacked-tar2=/src/ftchkwd.c --- freetype-2.7.1/=unpacked-tar2=/src/ftchkwd.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftchkwd.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,201 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality font engine */ +/* */ +/* Copyright 2003, 2011, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* ftchkwd */ +/* */ +/* NOTE: This is just a test program that is used to show off and */ +/* debug the current engine. */ +/* */ +/****************************************************************************/ + +#include +#include FT_FREETYPE_H + +#include +#include +#include + + + FT_Error error; + + + static void + Usage( char* name ) + { + printf( "ftchkwd: test fixed font width -- part of the FreeType project\n" ); + printf( "---------------------------------------------------------------------\n" ); + printf( "\n" ); + printf( "Usage: %s fontname[.ttf|.ttc] [fontname2..]\n", name ); + printf( "\n" ); + + exit( 1 ); + } + + + static void + Panic( const char* message ) + { + fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); + exit(1); + } + + + static const char* + file_basename( const char* pathname ) + { + const char* base = pathname; + const char* p = pathname; + + + while ( *p ) + { + if ( *p == '/' || *p == '\\' ) + base = p + 1; + + p++; + } + + return base; + } + + + static void + check_face( FT_Face face, + const char* filepathname, + int idx ) + { + int face_has_fixed_flag = FT_IS_FIXED_WIDTH(face); + int face_max_advance = face->max_advance_width; + int num_proportional = 0; + int n; + + FT_UNUSED( idx ); + + + printf( "%15s : %20s : ", + file_basename( filepathname ), + face->family_name ? face->family_name : "UNKNOWN FAMILY" ); + + for ( n = 0; n < face->num_glyphs; n++ ) + { + /* load the glyph outline */ + error = FT_Load_Glyph( face, n, FT_LOAD_NO_SCALE ); + if ( error ) + continue; + + if ( face->glyph->metrics.horiAdvance != face_max_advance ) + num_proportional++; + } + + if ( num_proportional > 0 ) + { + if ( face_has_fixed_flag ) + printf( "KO! Tagged as fixed, but has %d `proportional' glyphs", + num_proportional ); + else + printf( "OK (proportional)" ); + } + else + { + if ( face_has_fixed_flag ) + printf( "OK (fixed-width)" ); + else + printf( "KO! Tagged as proportional but has fixed width" ); + } + printf( "\n" ); + } + + + int + main( int argc, + char** argv ) + { + FT_Face face; + FT_Library library; + + int i, file_index; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + char* fname; + + + execname = argv[0]; + + if ( argc < 2 ) + Usage( execname ); + + error = FT_Init_FreeType( &library ); + if ( error ) + Panic( "Could not create library object" ); + + /* Now check all files */ + for ( file_index = 1; file_index < argc; file_index++ ) + { + fname = argv[file_index]; + + /* try to open the file with no extra extension first */ + error = FT_New_Face( library, fname, 0, &face ); + if ( !error ) + goto Success; + + if ( error == FT_Err_Unknown_File_Format ) + { + fprintf( stderr, "%s: unknown format\n", fname ); + continue; + } + + /* Ok, we could not load the file. Try to add an extension to */ + /* its name if possible. */ + + i = strlen( fname ); + while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) + { + if ( fname[i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, fname, 1024 ); + strncpy( alt_filename, fname, 1024 ); + +#ifndef macintosh + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } +#endif + + /* Load face */ + error = FT_New_Face( library, filename, 0, &face ); + if ( error ) + { + if ( error == FT_Err_Unknown_File_Format ) + printf( "unknown format\n" ); + else + printf( "could not find/open file (error: %d)\n", error ); + continue; + } + + Success: + check_face( face, fname, face->face_index ); + + FT_Done_Face( face ); + } + + FT_Done_FreeType( library ); + exit( 0 ); /* for safety reasons */ + + return 0; /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftcommon.c freetype-2.8/=unpacked-tar2=/src/ftcommon.c --- freetype-2.7.1/=unpacked-tar2=/src/ftcommon.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftcommon.c 2017-05-02 07:28:37.000000000 +0000 @@ -0,0 +1,1442 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2005-2009, 2011-2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* ftcommon.c - common routines for the graphic FreeType demo programs. */ +/* */ +/****************************************************************************/ + + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* we use `strcasecmp' */ +#endif + +#include +#include FT_FREETYPE_H + +#include FT_CACHE_H +#include FT_CACHE_MANAGER_H + +#include FT_BITMAP_H +#include FT_FONT_FORMATS_H + +#include "common.h" +#include "ftcommon.h" + +#include +#include +#include +#include + + +#ifdef _WIN32 +#define strcasecmp _stricmp +#endif + + + FT_Error error; + + +#undef NODEBUG + +#ifndef NODEBUG + + void + LogMessage( const char* fmt, + ... ) + { + va_list ap; + + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } + +#endif /* NODEBUG */ + + + /* PanicZ */ + void + PanicZ( const char* message ) + { + fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); + exit( 1 ); + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** DISPLAY-SPECIFIC DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + FTDemo_Display* + FTDemo_Display_New( grPixelMode mode, + int width, + int height ) + { + FTDemo_Display* display; + grSurface* surface; + grBitmap bit; + + + display = (FTDemo_Display *)malloc( sizeof ( FTDemo_Display ) ); + if ( !display ) + return NULL; + + if ( mode != gr_pixel_mode_gray && + mode != gr_pixel_mode_rgb24 ) + return NULL; + + grInitDevices(); + + bit.mode = mode; + bit.width = width; + bit.rows = height; + bit.grays = 256; + + surface = grNewSurface( 0, &bit ); + + if ( !surface ) + { + free( display ); + return NULL; + } + + display->surface = surface; + display->bitmap = &surface->bitmap; + + display->fore_color = grFindColor( display->bitmap, + 0x00, 0x00, 0x00, 0xff ); + display->back_color = grFindColor( display->bitmap, + 0xff, 0xff, 0xff, 0xff ); + display->warn_color = grFindColor( display->bitmap, + 0xff, 0x00, 0x00, 0xff ); + + return display; + } + + + void + FTDemo_Display_Done( FTDemo_Display* display ) + { + if ( !display ) + return; + + grDoneBitmap( display->bitmap ); + grDoneSurface( display->surface ); + + grDoneDevices(); + + free( display ); + } + + + void + FTDemo_Display_Clear( FTDemo_Display* display ) + { + grBitmap* bit = display->bitmap; + int pitch = bit->pitch; + + + if ( pitch < 0 ) + pitch = -pitch; + + if ( bit->mode == gr_pixel_mode_gray ) + memset( bit->buffer, + display->back_color.value, + (unsigned int)( pitch * bit->rows ) ); + else + { + unsigned char* p = bit->buffer; + int i; + + + for ( i = 0; i < pitch; i += 3, p += 3 ) + { + p[0] = display->back_color.chroma[0]; + p[1] = display->back_color.chroma[1]; + p[2] = display->back_color.chroma[2]; + } + + for ( i = 1; i < bit->rows; i++, p += pitch ) + memcpy( p, p - pitch, (size_t)pitch ); + } + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FREETYPE-SPECIFIC DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + +#define FLOOR( x ) ( (x) & -64 ) +#define CEIL( x ) ( ( (x) + 63 ) & -64 ) +#define ROUND( x ) ( ( (x) + 32 ) & -64 ) +#define TRUNC( x ) ( (x) >> 6 ) + + + /*************************************************************************/ + /* */ + /* The face requester is a function provided by the client application */ + /* to the cache manager, whose role is to translate an `abstract' face */ + /* ID into a real FT_Face object. */ + /* */ + /* In this program, the face IDs are simply pointers to TFont objects. */ + /* */ + static FT_Error + my_face_requester( FTC_FaceID face_id, + FT_Library lib, + FT_Pointer request_data, + FT_Face* aface ) + { + PFont font = (PFont)face_id; + + FT_UNUSED( request_data ); + + + if ( font->file_address != NULL ) + error = FT_New_Memory_Face( lib, + (const FT_Byte*)font->file_address, + (FT_Long)font->file_size, + font->face_index, + aface ); + else + error = FT_New_Face( lib, + font->filepathname, + font->face_index, + aface ); + if ( !error ) + { + const char* format = FT_Get_Font_Format( *aface ); + + + if ( !strcmp( format, "Type 1" ) ) + { + char orig[5]; + char* suffix = (char*)strrchr( font->filepathname, '.' ); + int has_extension = suffix && + ( strcasecmp( suffix, ".pfa" ) == 0 || + strcasecmp( suffix, ".pfb" ) == 0 ); + + + if ( has_extension ) + memcpy( orig, suffix, 5 ); + else + /* we have already allocated four more bytes */ + suffix = (char*)font->filepathname + strlen( font->filepathname ); + + memcpy( suffix, ".afm", 5 ); + if ( FT_Attach_File( *aface, font->filepathname ) ) + { + memcpy( suffix, ".pfm", 5 ); + FT_Attach_File( *aface, font->filepathname ); + } + + if ( has_extension ) + memcpy( suffix, orig, 5 ); + } + + if ( (*aface)->charmaps ) + (*aface)->charmap = (*aface)->charmaps[font->cmap_index]; + } + + return error; + } + + + FTDemo_Handle* + FTDemo_New( void ) + { + FTDemo_Handle* handle; + + + handle = (FTDemo_Handle *)malloc( sizeof ( FTDemo_Handle ) ); + if ( !handle ) + return NULL; + + memset( handle, 0, sizeof ( FTDemo_Handle ) ); + + error = FT_Init_FreeType( &handle->library ); + if ( error ) + PanicZ( "could not initialize FreeType" ); + + error = FTC_Manager_New( handle->library, 0, 0, 0, + my_face_requester, 0, &handle->cache_manager ); + if ( error ) + PanicZ( "could not initialize cache manager" ); + + error = FTC_SBitCache_New( handle->cache_manager, &handle->sbits_cache ); + if ( error ) + PanicZ( "could not initialize small bitmaps cache" ); + + error = FTC_ImageCache_New( handle->cache_manager, &handle->image_cache ); + if ( error ) + PanicZ( "could not initialize glyph image cache" ); + + error = FTC_CMapCache_New( handle->cache_manager, &handle->cmap_cache ); + if ( error ) + PanicZ( "could not initialize charmap cache" ); + + FT_Bitmap_New( &handle->bitmap ); + + FT_Stroker_New( handle->library, &handle->stroker ); + + handle->encoding = FT_ENCODING_NONE; + + handle->hinted = 1; + handle->use_sbits = 1; + handle->autohint = 0; + handle->lcd_mode = LCD_MODE_AA; + handle->color = 1; + + handle->use_sbits_cache = 1; + + /* string_init */ + memset( handle->string, 0, sizeof ( TGlyph ) * MAX_GLYPHS ); + handle->string_length = 0; + handle->string_reload = 1; + + return handle; + } + + + void + FTDemo_Done( FTDemo_Handle* handle ) + { + int i; + + + if ( !handle ) + return; + + for ( i = 0; i < handle->max_fonts; i++ ) + { + if ( handle->fonts[i] ) + { + if ( handle->fonts[i]->filepathname ) + free( (void*)handle->fonts[i]->filepathname ); + free( handle->fonts[i] ); + } + } + free( handle->fonts ); + + /* string_done */ + for ( i = 0; i < MAX_GLYPHS; i++ ) + { + PGlyph glyph = handle->string + i; + + + if ( glyph->image ) + FT_Done_Glyph( glyph->image ); + } + + FT_Stroker_Done( handle->stroker ); + FT_Bitmap_Done( handle->library, &handle->bitmap ); + FTC_Manager_Done( handle->cache_manager ); + FT_Done_FreeType( handle->library ); + + free( handle ); + } + + + FT_Error + FTDemo_Install_Font( FTDemo_Handle* handle, + const char* filepath, + FT_Bool outline_only, + FT_Bool no_instances ) + { + static char filename[1024 + 5]; + long i, num_faces; + unsigned int len; + FT_Face face; + + + len = strlen( filepath ); + if ( len > 1024 ) + len = 1024; + + strncpy( filename, filepath, len ); + filename[len] = 0; + + /* We use a conservative approach here, at the cost of calling */ + /* `FT_New_Face' quite often. The idea is that our demo programs */ + /* should be able to try all faces and named instances of a font, */ + /* expecting that some faces don't work for various reasons, e.g., */ + /* a broken subfont, or an unsupported NFNT bitmap font in a Mac */ + /* dfont resource that holds more than a single font. */ + + error = FT_New_Face( handle->library, filename, -1, &face ); + if ( error ) + return error; + num_faces = face->num_faces; + FT_Done_Face( face ); + + /* allocate new font object(s) */ + for ( i = 0; i < num_faces; i++ ) + { + PFont font; + long j, instance_count; + + + error = FT_New_Face( handle->library, filename, -( i + 1 ), &face ); + if ( error ) + continue; + instance_count = no_instances ? 0 : face->style_flags >> 16; + FT_Done_Face( face ); + + /* load face with and without named instances */ + for ( j = 0; j < instance_count + 1; j++ ) + { + error = FT_New_Face( handle->library, + filename, + ( j << 16 ) + i, + &face ); + if ( error ) + continue; + + if ( outline_only && !FT_IS_SCALABLE( face ) ) + { + FT_Done_Face( face ); + continue; + } + + if ( handle->encoding != FT_ENCODING_NONE ) + { + error = FT_Select_Charmap( face, (FT_Encoding)handle->encoding ); + if ( error ) + { + FT_Done_Face( face ); + continue; + } + } + + font = (PFont)malloc( sizeof ( *font ) ); + + /* We allocate four more bytes since we want to attach an AFM */ + /* or PFM file for Type 1 fonts (if available). Such fonts */ + /* always have the extension `.afm' or `.pfm'. */ + font->filepathname = (char*)malloc( strlen( filename ) + 4 + 1 ); + strcpy( (char*)font->filepathname, filename ); + + font->face_index = ( j << 16 ) + i; + font->cmap_index = face->charmap ? FT_Get_Charmap_Index( face->charmap ) + : 0; + + if ( handle->preload ) + { + FILE* file = fopen( filename, "rb" ); + size_t file_size; + + + if ( file == NULL ) /* shouldn't happen */ + { + free( font ); + return FT_Err_Invalid_Argument; + } + + fseek( file, 0, SEEK_END ); + file_size = (size_t)ftell( file ); + fseek( file, 0, SEEK_SET ); + + if ( file_size <= 0 ) + { + free( font ); + fclose( file ); + return FT_Err_Invalid_Stream_Operation; + } + + font->file_address = malloc( file_size ); + if ( !font->file_address ) + { + free( font ); + fclose( file ); + return FT_Err_Out_Of_Memory; + } + + if ( fread( font->file_address, 1, file_size, file ) != file_size ) + { + free( font->file_address ); + free( font ); + fclose( file ); + return FT_Err_Invalid_Stream_Read; + } + + font->file_size = file_size; + + fclose( file ); + } + else + { + font->file_address = NULL; + font->file_size = 0; + } + + switch ( handle->encoding ) + { + case FT_ENCODING_NONE: + font->num_indices = face->num_glyphs; + break; + + case FT_ENCODING_UNICODE: + font->num_indices = 0x110000L; + break; + + case FT_ENCODING_ADOBE_LATIN_1: + case FT_ENCODING_ADOBE_STANDARD: + case FT_ENCODING_ADOBE_EXPERT: + case FT_ENCODING_ADOBE_CUSTOM: + case FT_ENCODING_APPLE_ROMAN: + font->num_indices = 0x100L; + break; + + /* some fonts use range 0x00-0x100, others have 0xF000-0xF0FF */ + case FT_ENCODING_MS_SYMBOL: + font->num_indices = 0x10000L; + + default: + font->num_indices = 0x10000L; + } + + FT_Done_Face( face ); + face = NULL; + + if ( handle->max_fonts == 0 ) + { + handle->max_fonts = 16; + handle->fonts = (PFont*)calloc( (size_t)handle->max_fonts, + sizeof ( PFont ) ); + } + else if ( handle->num_fonts >= handle->max_fonts ) + { + handle->max_fonts *= 2; + handle->fonts = (PFont*)realloc( handle->fonts, + (size_t)handle->max_fonts * + sizeof ( PFont ) ); + + memset( &handle->fonts[handle->num_fonts], 0, + (size_t)( handle->max_fonts - handle->num_fonts ) * + sizeof ( PFont ) ); + } + + handle->fonts[handle->num_fonts++] = font; + } + } + + return FT_Err_Ok; + } + + + void + FTDemo_Set_Current_Font( FTDemo_Handle* handle, + PFont font ) + { + handle->current_font = font; + handle->scaler.face_id = (FTC_FaceID)font; + + handle->string_reload = 1; + } + + + void + FTDemo_Set_Current_Size( FTDemo_Handle* handle, + int pixel_size ) + { + if ( pixel_size > 0xFFFF ) + pixel_size = 0xFFFF; + + handle->scaler.width = (FT_UInt)pixel_size; + handle->scaler.height = (FT_UInt)pixel_size; + handle->scaler.pixel = 1; /* activate integer format */ + handle->scaler.x_res = 0; + handle->scaler.y_res = 0; + + handle->string_reload = 1; + } + + + void + FTDemo_Set_Current_Charsize( FTDemo_Handle* handle, + int char_size, + int resolution ) + { + /* in 26.6 format, corresponding to (almost) 0x4000ppem */ + if ( char_size > 0xFFFFF ) + char_size = 0xFFFFF; + + handle->scaler.width = (FT_UInt)char_size; + handle->scaler.height = (FT_UInt)char_size; + handle->scaler.pixel = 0; /* activate 26.6 format */ + handle->scaler.x_res = (FT_UInt)resolution; + handle->scaler.y_res = (FT_UInt)resolution; + + handle->string_reload = 1; + } + + + void + FTDemo_Set_Preload( FTDemo_Handle* handle, + int preload ) + { + handle->preload = !!preload; + } + + + void + FTDemo_Update_Current_Flags( FTDemo_Handle* handle ) + { + FT_Int32 flags, target; + + + flags = FT_LOAD_DEFAULT; /* really 0 */ + + if ( handle->autohint ) + flags |= FT_LOAD_FORCE_AUTOHINT; + + if ( !handle->use_sbits ) + flags |= FT_LOAD_NO_BITMAP; + + if ( handle->hinted ) + { + target = 0; + + switch ( handle->lcd_mode ) + { + case LCD_MODE_MONO: + target = FT_LOAD_TARGET_MONO; + break; + + case LCD_MODE_LIGHT: + case LCD_MODE_LIGHT_SUBPIXEL: + target = FT_LOAD_TARGET_LIGHT; + break; + + case LCD_MODE_RGB: + case LCD_MODE_BGR: + target = FT_LOAD_TARGET_LCD; + break; + + case LCD_MODE_VRGB: + case LCD_MODE_VBGR: + target = FT_LOAD_TARGET_LCD_V; + break; + + default: + target = FT_LOAD_TARGET_NORMAL; + } + + flags |= target; + } + else + { + flags |= FT_LOAD_NO_HINTING; + + if ( handle->lcd_mode == LCD_MODE_MONO ) + flags |= FT_LOAD_MONOCHROME; + } + + if ( handle->color ) + flags |= FT_LOAD_COLOR; + + handle->load_flags = flags; + handle->string_reload = 1; + } + + + FT_UInt + FTDemo_Get_Index( FTDemo_Handle* handle, + FT_UInt32 charcode ) + { + FTC_FaceID face_id = handle->scaler.face_id; + PFont font = handle->current_font; + + + return FTC_CMapCache_Lookup( handle->cmap_cache, face_id, + font->cmap_index, charcode ); + } + + + FT_Error + FTDemo_Get_Size( FTDemo_Handle* handle, + FT_Size* asize ) + { + FT_Size size; + + + error = FTC_Manager_LookupSize( handle->cache_manager, + &handle->scaler, + &size ); + + if ( !error ) + *asize = size; + + return error; + } + + + FT_Error + FTDemo_Glyph_To_Bitmap( FTDemo_Handle* handle, + FT_Glyph glyf, + grBitmap* target, + int* left, + int* top, + int* x_advance, + int* y_advance, + FT_Glyph* aglyf ) + { + FT_BitmapGlyph bitmap; + FT_Bitmap* source; + + + *aglyf = NULL; + + error = FT_Err_Ok; + + if ( glyf->format == FT_GLYPH_FORMAT_OUTLINE ) + { + FT_Render_Mode render_mode; + + + switch ( handle->lcd_mode ) + { + case LCD_MODE_MONO: + render_mode = FT_RENDER_MODE_MONO; + break; + + case LCD_MODE_LIGHT: + case LCD_MODE_LIGHT_SUBPIXEL: + render_mode = FT_RENDER_MODE_LIGHT; + break; + + case LCD_MODE_RGB: + case LCD_MODE_BGR: + render_mode = FT_RENDER_MODE_LCD; + break; + + case LCD_MODE_VRGB: + case LCD_MODE_VBGR: + render_mode = FT_RENDER_MODE_LCD_V; + break; + + default: + render_mode = FT_RENDER_MODE_NORMAL; + } + + /* render the glyph to a bitmap, don't destroy original */ + error = FT_Glyph_To_Bitmap( &glyf, render_mode, NULL, 0 ); + if ( error ) + return error; + + *aglyf = glyf; + } + + if ( glyf->format != FT_GLYPH_FORMAT_BITMAP ) + PanicZ( "invalid glyph format returned!" ); + + bitmap = (FT_BitmapGlyph)glyf; + source = &bitmap->bitmap; + + target->rows = (int)source->rows; + target->width = (int)source->width; + target->pitch = source->pitch; + target->buffer = source->buffer; + target->grays = source->num_grays; + + switch ( source->pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + target->mode = gr_pixel_mode_mono; + break; + + case FT_PIXEL_MODE_GRAY: + target->mode = gr_pixel_mode_gray; + target->grays = source->num_grays; + break; + + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + (void)FT_Bitmap_Convert( handle->library, source, &handle->bitmap, 1 ); + target->pitch = handle->bitmap.pitch; + target->buffer = handle->bitmap.buffer; + target->mode = gr_pixel_mode_gray; + target->grays = handle->bitmap.num_grays; + break; + + case FT_PIXEL_MODE_LCD: + target->mode = handle->lcd_mode == LCD_MODE_RGB + ? gr_pixel_mode_lcd + : gr_pixel_mode_lcd2; + target->grays = source->num_grays; + break; + + case FT_PIXEL_MODE_LCD_V: + target->mode = handle->lcd_mode == LCD_MODE_VRGB + ? gr_pixel_mode_lcdv + : gr_pixel_mode_lcdv2; + target->grays = source->num_grays; + break; + + case FT_PIXEL_MODE_BGRA: + target->mode = gr_pixel_mode_bgra; + target->grays = source->num_grays; + break; + + default: + return FT_Err_Invalid_Glyph_Format; + } + + *left = bitmap->left; + *top = bitmap->top; + + *x_advance = ( glyf->advance.x + 0x8000 ) >> 16; + *y_advance = ( glyf->advance.y + 0x8000 ) >> 16; + + return error; + } + + + FT_Error + FTDemo_Index_To_Bitmap( FTDemo_Handle* handle, + FT_ULong Index, + grBitmap* target, + int* left, + int* top, + int* x_advance, + int* y_advance, + FT_Glyph* aglyf ) + { + unsigned int width, height; + + + *aglyf = NULL; + *x_advance = 0; + + /* use the SBits cache to store small glyph bitmaps; this is a lot */ + /* more memory-efficient */ + /* */ + + width = handle->scaler.width; + height = handle->scaler.height; + if ( handle->use_sbits_cache && !handle->scaler.pixel ) + { + width = ( ( width * handle->scaler.x_res + 36 ) / 72 ) >> 6; + height = ( ( height * handle->scaler.y_res + 36 ) / 72 ) >> 6; + } + + if ( handle->use_sbits_cache && width < 48 && height < 48 ) + { + FTC_SBit sbit; + FT_Bitmap source; + + + error = FTC_SBitCache_LookupScaler( handle->sbits_cache, + &handle->scaler, + (FT_ULong)handle->load_flags, + Index, + &sbit, + NULL ); + if ( error ) + goto Exit; + + if ( sbit->buffer ) + { + target->rows = sbit->height; + target->width = sbit->width; + target->pitch = sbit->pitch; + target->buffer = sbit->buffer; + target->grays = sbit->max_grays + 1; + + switch ( sbit->format ) + { + case FT_PIXEL_MODE_MONO: + target->mode = gr_pixel_mode_mono; + break; + + case FT_PIXEL_MODE_GRAY: + target->mode = gr_pixel_mode_gray; + break; + + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + source.rows = sbit->height; + source.width = sbit->width; + source.pitch = sbit->pitch; + source.buffer = sbit->buffer; + source.pixel_mode = sbit->format; + + (void)FT_Bitmap_Convert( handle->library, &source, + &handle->bitmap, 1 ); + + target->pitch = handle->bitmap.pitch; + target->buffer = handle->bitmap.buffer; + target->mode = gr_pixel_mode_gray; + target->grays = handle->bitmap.num_grays; + break; + + case FT_PIXEL_MODE_LCD: + target->mode = handle->lcd_mode == LCD_MODE_RGB + ? gr_pixel_mode_lcd + : gr_pixel_mode_lcd2; + break; + + case FT_PIXEL_MODE_LCD_V: + target->mode = handle->lcd_mode == LCD_MODE_VRGB + ? gr_pixel_mode_lcdv + : gr_pixel_mode_lcdv2; + break; + + case FT_PIXEL_MODE_BGRA: + target->mode = gr_pixel_mode_bgra; + break; + + default: + return FT_Err_Invalid_Glyph_Format; + } + + *left = sbit->left; + *top = sbit->top; + *x_advance = sbit->xadvance; + *y_advance = sbit->yadvance; + + goto Exit; + } + } + + /* otherwise, use an image cache to store glyph outlines, and render */ + /* them on demand. we can thus support very large sizes easily.. */ + { + FT_Glyph glyf; + + + error = FTC_ImageCache_LookupScaler( handle->image_cache, + &handle->scaler, + (FT_ULong)handle->load_flags, + Index, + &glyf, + NULL ); + + if ( !error ) + error = FTDemo_Glyph_To_Bitmap( handle, glyf, target, left, top, + x_advance, y_advance, aglyf ); + } + + Exit: + /* don't accept a `missing' character with zero or negative width */ + if ( Index == 0 && *x_advance <= 0 ) + *x_advance = 1; + + return error; + } + + + FT_Error + FTDemo_Draw_Index( FTDemo_Handle* handle, + FTDemo_Display* display, + unsigned int gindex, + int* pen_x, + int* pen_y ) + { + int left, top, x_advance, y_advance; + grBitmap bit3; + FT_Glyph glyf; + + + error = FTDemo_Index_To_Bitmap( handle, + gindex, + &bit3, + &left, &top, + &x_advance, &y_advance, + &glyf ); + if ( error ) + return error; + + /* now render the bitmap into the display surface */ + grBlitGlyphToBitmap( display->bitmap, &bit3, *pen_x + left, + *pen_y - top, display->fore_color ); + + if ( glyf ) + FT_Done_Glyph( glyf ); + + *pen_x += x_advance + 1; + + return FT_Err_Ok; + } + + + FT_Error + FTDemo_Draw_Glyph_Color( FTDemo_Handle* handle, + FTDemo_Display* display, + FT_Glyph glyph, + int* pen_x, + int* pen_y, + grColor color ) + { + int left, top, x_advance, y_advance; + grBitmap bit3; + FT_Glyph glyf; + + + error = FTDemo_Glyph_To_Bitmap( handle, glyph, &bit3, &left, &top, + &x_advance, &y_advance, &glyf ); + if ( error ) + { + FT_Done_Glyph( glyph ); + + return error; + } + + /* now render the bitmap into the display surface */ + grBlitGlyphToBitmap( display->bitmap, &bit3, *pen_x + left, + *pen_y - top, color ); + + if ( glyf ) + FT_Done_Glyph( glyf ); + + *pen_x += x_advance + 1; + + return FT_Err_Ok; + } + + + FT_Error + FTDemo_Draw_Glyph( FTDemo_Handle* handle, + FTDemo_Display* display, + FT_Glyph glyph, + int* pen_x, + int* pen_y ) + { + return FTDemo_Draw_Glyph_Color( handle, display, + glyph, pen_x, pen_y, + display->fore_color ); + } + + + FT_Error + FTDemo_Draw_Slot( FTDemo_Handle* handle, + FTDemo_Display* display, + FT_GlyphSlot slot, + int* pen_x, + int* pen_y ) + { + FT_Glyph glyph; + + + error = FT_Get_Glyph( slot, &glyph ); + if ( error ) + return error; + + error = FTDemo_Draw_Glyph( handle, display, glyph, pen_x, pen_y ); + if ( !error ) + FT_Done_Glyph( glyph ); + + return error; + } + + + void + FTDemo_String_Set( FTDemo_Handle* handle, + const char* string ) + { + const char* p = string; + const char* end = p + strlen( string ); + unsigned long codepoint; + int ch; + int expect; + PGlyph glyph = handle->string; + + + handle->string_length = 0; + codepoint = expect = 0; + + for (;;) + { + ch = utf8_next( &p, end ); + if ( ch < 0 ) + break; + + codepoint = (unsigned long)ch; + + if ( handle->encoding != FT_ENCODING_NONE ) + glyph->glyph_index = FTDemo_Get_Index( handle, codepoint ); + else + glyph->glyph_index = codepoint; + + glyph++; + handle->string_length++; + + if ( handle->string_length >= MAX_GLYPHS ) + break; + } + + handle->string_reload = 1; + } + + + static FT_Error + string_load( FTDemo_Handle* handle ) + { + int n; + FT_Size size; + FT_Face face; + FT_Pos prev_rsb_delta = 0; + + + error = FTDemo_Get_Size( handle, &size ); + if ( error ) + return error; + + face = size->face; + + for ( n = 0; n < handle->string_length; n++ ) + { + PGlyph glyph = handle->string + n; + + + /* clear existing image if there is one */ + if ( glyph->image ) + { + FT_Done_Glyph( glyph->image ); + glyph->image = NULL; + } + + /* load the glyph and get the image */ + if ( !FT_Load_Glyph( face, glyph->glyph_index, + handle->load_flags ) && + !FT_Get_Glyph( face->glyph, &glyph->image ) ) + { + FT_Glyph_Metrics* metrics = &face->glyph->metrics; + + + /* note that in vertical layout, y-positive goes downwards */ + + glyph->vvector.x = metrics->vertBearingX - metrics->horiBearingX; + glyph->vvector.y = -metrics->vertBearingY - metrics->horiBearingY; + + glyph->vadvance.x = 0; + glyph->vadvance.y = -metrics->vertAdvance; + + if ( handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) + glyph->delta = face->glyph->lsb_delta - face->glyph->rsb_delta; + else + { + if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) + glyph->delta = -1 * 64; + else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) + glyph->delta = 1 * 64; + else + glyph->delta = 0; + + prev_rsb_delta = face->glyph->rsb_delta; + } + } + } + + return FT_Err_Ok; + } + + + static FT_Error + string_render_prepare( FTDemo_Handle* handle, + FTDemo_String_Context* sc, + FT_Vector* advances ) + { + FT_Face face; + FT_Size size; + PGlyph glyph; + FT_Pos track_kern = 0; + FT_UInt prev_index = 0; + FT_Vector* prev_advance = NULL; + FT_Vector extent = { 0, 0 }; + FT_Int i; + + + error = FTDemo_Get_Size( handle, &size ); + if ( error ) + return error; + + face = size->face; + + if ( !sc->vertical && sc->kerning_degree ) + { + /* this function needs and returns points, not pixels */ + if ( FT_Get_Track_Kerning( face, + (FT_Fixed)handle->scaler.width << 10, + -sc->kerning_degree, + &track_kern ) ) + track_kern = 0; + else + track_kern = (FT_Pos)( + ( track_kern / 1024.0 * handle->scaler.x_res ) / + 72.0 ); + } + + for ( i = 0; i < handle->string_length; i++ ) + { + glyph = handle->string + i; + + if ( !glyph->image ) + continue; + + if ( sc->vertical ) + advances[i] = glyph->vadvance; + else + { + advances[i] = glyph->image->advance; + advances[i].x >>= 10; + advances[i].y >>= 10; + + if ( handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) + advances[i].x += glyph->delta; + + if ( prev_advance ) + { + prev_advance->x += track_kern; + + if ( sc->kerning_mode ) + { + FT_Vector kern; + + + FT_Get_Kerning( face, prev_index, glyph->glyph_index, + FT_KERNING_UNFITTED, &kern ); + + prev_advance->x += kern.x; + prev_advance->y += kern.y; + + if ( handle->lcd_mode != LCD_MODE_LIGHT_SUBPIXEL && + sc->kerning_mode > KERNING_MODE_NORMAL ) + prev_advance->x += glyph->delta; + } + } + } + + if ( prev_advance ) + { + if ( handle->lcd_mode != LCD_MODE_LIGHT_SUBPIXEL && + handle->hinted ) + { + prev_advance->x = ROUND( prev_advance->x ); + prev_advance->y = ROUND( prev_advance->y ); + } + + extent.x += prev_advance->x; + extent.y += prev_advance->y; + } + + prev_index = glyph->glyph_index; + prev_advance = advances + i; + } + + if ( prev_advance ) + { + if ( handle->lcd_mode != LCD_MODE_LIGHT_SUBPIXEL && + handle->hinted ) + { + prev_advance->x = ROUND( prev_advance->x ); + prev_advance->y = ROUND( prev_advance->y ); + } + + extent.x += prev_advance->x; + extent.y += prev_advance->y; + } + + /* store the extent in the last slot */ + i = handle->string_length - 1; + advances[i] = extent; + + return FT_Err_Ok; + } + + + FT_Error + FTDemo_String_Draw( FTDemo_Handle* handle, + FTDemo_Display* display, + FTDemo_String_Context* sc, + int x, + int y ) + { + int n; + FT_Vector pen, advances[MAX_GLYPHS]; + FT_Size size; + FT_Face face; + + + if ( !sc || + x < 0 || + y < 0 || + x > display->bitmap->width || + y > display->bitmap->rows ) + return FT_Err_Invalid_Argument; + + error = FTDemo_Get_Size( handle, &size ); + if ( error ) + return error; + + face = size->face; + + if ( handle->string_reload ) + { + error = string_load( handle ); + if ( error ) + return error; + + handle->string_reload = 0; + } + + error = string_render_prepare( handle, sc, advances ); + if ( error ) + return error; + + /* change to Cartesian coordinates */ + y = display->bitmap->rows - y; + + /* get the extent, which we store in the last slot */ + pen = advances[handle->string_length - 1]; + + pen.x = FT_MulFix( pen.x, sc->center ); + pen.y = FT_MulFix( pen.y, sc->center ); + + /* XXX sbits */ + /* get pen position */ + if ( sc->matrix && FT_IS_SCALABLE( face ) ) + { + FT_Vector_Transform( &pen, sc->matrix ); + + pen.x = ( x << 6 ) - pen.x; + pen.y = ( y << 6 ) - pen.y; + } + else + { + pen.x = ROUND( ( x << 6 ) - pen.x ); + pen.y = ROUND( ( y << 6 ) - pen.y ); + } + + for ( n = 0; n < handle->string_length; n++ ) + { + PGlyph glyph = handle->string + n; + FT_Glyph image; + FT_BBox bbox; + + + if ( !glyph->image ) + continue; + + /* copy image */ + error = FT_Glyph_Copy( glyph->image, &image ); + if ( error ) + continue; + + if ( image->format != FT_GLYPH_FORMAT_BITMAP ) + { + if ( sc->vertical ) + error = FT_Glyph_Transform( image, NULL, &glyph->vvector ); + + if ( !error ) + error = FT_Glyph_Transform( image, sc->matrix, &pen ); + + if ( error ) + { + FT_Done_Glyph( image ); + continue; + } + } + else + { + FT_BitmapGlyph bitmap = (FT_BitmapGlyph)image; + + + if ( sc->vertical ) + { + bitmap->left += ( glyph->vvector.x + pen.x ) >> 6; + bitmap->top += ( glyph->vvector.y + pen.y ) >> 6; + } + else + { + bitmap->left += pen.x >> 6; + bitmap->top += pen.y >> 6; + } + } + + if ( sc->matrix ) + FT_Vector_Transform( advances + n, sc->matrix ); + + pen.x += advances[n].x; + pen.y += advances[n].y; + + FT_Glyph_Get_CBox( image, FT_GLYPH_BBOX_PIXELS, &bbox ); + +#if 0 + if ( n == 0 ) + { + fprintf( stderr, "bbox = [%ld %ld %ld %ld]\n", + bbox.xMin, bbox.yMin, bbox.xMax, bbox.yMax ); + } +#endif + + /* check bounding box; if it is completely outside the */ + /* display surface, we don't need to render it */ + if ( bbox.xMax > 0 && + bbox.yMax > 0 && + bbox.xMin < display->bitmap->width && + bbox.yMin < display->bitmap->rows ) + { + int left, top, dummy1, dummy2; + grBitmap bit3; + FT_Glyph glyf; + + + error = FTDemo_Glyph_To_Bitmap( handle, image, &bit3, &left, &top, + &dummy1, &dummy2, &glyf ); + if ( !error ) + { + /* change back to the usual coordinates */ + top = display->bitmap->rows - top; + + /* now render the bitmap into the display surface */ + grBlitGlyphToBitmap( display->bitmap, &bit3, left, top, + display->fore_color ); + + if ( glyf ) + FT_Done_Glyph( glyf ); + } + } + + FT_Done_Glyph( image ); + } + + return error; + } + + + unsigned long + FTDemo_Make_Encoding_Tag( const char* s ) + { + int i; + unsigned long l = 0; + + + for ( i = 0; i < 4; i++ ) + { + if ( !s[i] ) + break; + l <<= 8; + l += (unsigned long)s[i]; + } + + return l; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftcommon.h freetype-2.8/=unpacked-tar2=/src/ftcommon.h --- freetype-2.7.1/=unpacked-tar2=/src/ftcommon.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftcommon.h 2017-05-01 09:01:02.000000000 +0000 @@ -0,0 +1,345 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2005, 2006, 2009, 2011-2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* ftcommon.h - common routines for the graphic FreeType demo programs. */ +/* */ +/****************************************************************************/ + +#ifndef FT_COMMON_H_ +#define FT_COMMON_H_ + + +#include +#include FT_FREETYPE_H + +#include FT_CACHE_H +#include FT_CACHE_MANAGER_H + +#include FT_GLYPH_H +#include FT_STROKER_H +#include FT_BITMAP_H + +#include +#include + + extern FT_Error error; + + /* forward declarations */ + extern void PanicZ( const char* message ); + +#undef NODEBUG + +#ifndef NODEBUG + +#define LOG( x ) LogMessage##x + + + void + LogMessage( const char* fmt, ... ); + +#else /* !DEBUG */ + +#define LOG( x ) /* */ + +#endif + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** DISPLAY-SPECIFIC DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /* default window dimensions */ +#define DIM_X 640 +#define DIM_Y 480 + + /* baseline distance between header lines */ +#define HEADER_HEIGHT 12 + + /* default gamma setting */ +#define GAMMA 1.8 + +#include "graph.h" +#include "grobjs.h" +#include "grfont.h" + + typedef struct + { + grSurface* surface; + grBitmap* bitmap; + grColor fore_color; + grColor back_color; + grColor warn_color; + + } FTDemo_Display; + + + FTDemo_Display* + FTDemo_Display_New( grPixelMode mode, + int width, + int height ); + + + void + FTDemo_Display_Done( FTDemo_Display* display ); + + + /* fill the bitmap with background color */ + void + FTDemo_Display_Clear( FTDemo_Display* display ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FREETYPE-SPECIFIC DEFINITIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define MAX_GLYPHS 512 /* at most 512 glyphs in the string */ +#define MAX_GLYPH_BYTES 150000 /* 150kB for the glyph image cache */ + + + typedef struct TGlyph_ + { + FT_UInt glyph_index; + FT_Glyph image; /* the glyph image */ + + FT_Pos delta; /* delta caused by hinting */ + FT_Vector vvector; /* vert. origin => hori. origin */ + FT_Vector vadvance; /* vertical advance */ + + } TGlyph, *PGlyph; + + /* this simple record is used to model a given `installed' face */ + typedef struct TFont_ + { + const char* filepathname; + int face_index; + int cmap_index; + int num_indices; + void* file_address; /* for preloaded files */ + size_t file_size; + + } TFont, *PFont; + + enum { + LCD_MODE_MONO = 0, + LCD_MODE_AA, + LCD_MODE_LIGHT, + LCD_MODE_LIGHT_SUBPIXEL, + LCD_MODE_RGB, + LCD_MODE_BGR, + LCD_MODE_VRGB, + LCD_MODE_VBGR, + N_LCD_MODES + }; + + enum { + KERNING_DEGREE_NONE = 0, + KERNING_DEGREE_LIGHT, + KERNING_DEGREE_MEDIUM, + KERNING_DEGREE_TIGHT, + N_KERNING_DEGREES + }; + + enum { + KERNING_MODE_NONE = 0, /* 0: no kerning; */ + KERNING_MODE_NORMAL, /* 1: `kern' values */ + KERNING_MODE_SMART, /* 2: `kern' + side bearing errors */ + N_KERNING_MODES + }; + + typedef struct + { + int kerning_mode; + int kerning_degree; + FT_Fixed center; /* 0..1 */ + int vertical; /* displayed vertically? */ + FT_Matrix* matrix; /* string transformation */ + + } FTDemo_String_Context; + + typedef struct + { + FT_Library library; /* the FreeType library */ + FTC_Manager cache_manager; /* the cache manager */ + FTC_ImageCache image_cache; /* the glyph image cache */ + FTC_SBitCache sbits_cache; /* the glyph small bitmaps cache */ + FTC_CMapCache cmap_cache; /* the charmap cache */ + + PFont* fonts; /* installed fonts */ + int num_fonts; + int max_fonts; + + int use_sbits_cache; /* toggle sbits cache */ + + /* use FTDemo_Set_Current_XXX to set the following two fields */ + PFont current_font; /* selected font */ + FTC_ScalerRec scaler; + FT_Int32 load_flags; + + /* call FTDemo_Update_Current_Flags after setting any of the following fields */ + int hinted; /* is glyph hinting active? */ + int use_sbits; /* do we use embedded bitmaps? */ + int autohint; /* force auto-hinting */ + int lcd_mode; /* mono, aa, light, vrgb, ... */ + int preload; /* force font file preloading */ + int color; /* load color bitmaps */ + + /* don't touch the following fields! */ + + /* used for string rendering */ + TGlyph string[MAX_GLYPHS]; + int string_length; + int string_reload; + + unsigned long encoding; + FT_Stroker stroker; + FT_Bitmap bitmap; /* used as bitmap conversion buffer */ + + } FTDemo_Handle; + + + FTDemo_Handle* + FTDemo_New( void ); + + + void + FTDemo_Done( FTDemo_Handle* handle ); + + + /* install a font */ + FT_Error + FTDemo_Install_Font( FTDemo_Handle* handle, + const char* filepath, + FT_Bool outline_only, + FT_Bool no_instances ); + + + void + FTDemo_Set_Preload( FTDemo_Handle* handle, + int preload ); + + void + FTDemo_Set_Current_Font( FTDemo_Handle* handle, + PFont font ); + + void + FTDemo_Set_Current_Size( FTDemo_Handle* handle, + int pixel_size ); + + void + FTDemo_Set_Current_Charsize( FTDemo_Handle* handle, + int point_size, + int res ); + + void + FTDemo_Update_Current_Flags( FTDemo_Handle* handle ); + + + /* charcode => glyph index of current font */ + FT_UInt + FTDemo_Get_Index( FTDemo_Handle* handle, + FT_UInt32 charcode ); + + + /* get FT_Size of current font */ + FT_Error + FTDemo_Get_Size( FTDemo_Handle* handle, + FT_Size* asize ); + + + /* convert a FT_Glyph to a grBitmap (don't free target->buffer) */ + /* if aglyf != NULL, you should FT_Glyph_Done the aglyf */ + FT_Error + FTDemo_Glyph_To_Bitmap( FTDemo_Handle* handle, + FT_Glyph glyf, + grBitmap* target, + int* left, + int* top, + int* x_advance, + int* y_advance, + FT_Glyph* aglyf ); + + /* get a grBitmap from glyph index (don't free target->buffer) */ + /* if aglyf != NULL, you should FT_Glyph_Done the aglyf */ + FT_Error + FTDemo_Index_To_Bitmap( FTDemo_Handle* handle, + FT_ULong Index, + grBitmap* target, + int* left, + int* top, + int* x_advance, + int* y_advance, + FT_Glyph* aglyf ); + + + /* given glyph index, draw a glyph on the display */ + FT_Error + FTDemo_Draw_Index( FTDemo_Handle* handle, + FTDemo_Display* display, + unsigned int gindex, + int* pen_x, + int* pen_y); + + + /* given FT_Glyph, draw a glyph on the display */ + FT_Error + FTDemo_Draw_Glyph( FTDemo_Handle* handle, + FTDemo_Display* display, + FT_Glyph glyph, + int* pen_x, + int* pen_y); + + FT_Error + FTDemo_Draw_Glyph_Color( FTDemo_Handle* handle, + FTDemo_Display* display, + FT_Glyph glyph, + int* pen_x, + int* pen_y, + grColor color ); + + /* given FT_GlyphSlot, draw a glyph on the display */ + FT_Error + FTDemo_Draw_Slot( FTDemo_Handle* handle, + FTDemo_Display* display, + FT_GlyphSlot slot, + int* pen_x, + int* pen_y); + + + /* set the string to be drawn */ + void + FTDemo_String_Set( FTDemo_Handle* handle, + const char* string ); + + + /* draw a string centered at (center_x, center_y) -- */ + /* note that handle->use_sbits_cache is not supported */ + FT_Error + FTDemo_String_Draw( FTDemo_Handle* handle, + FTDemo_Display* display, + FTDemo_String_Context* sc, + int center_x, + int center_y ); + + + /* make a FT_Encoding tag from a string */ + unsigned long + FTDemo_Make_Encoding_Tag( const char* s ); + + +#endif /* FTCOMMON_H_ */ + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftdiff.1 freetype-2.8/=unpacked-tar2=/src/ftdiff.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftdiff.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftdiff.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,70 @@ +.TH FTDIFF 1 "May 2017" "FreeType 2.8" +. +. +.SH NAME +. +ftdiff \- compare font hinting modes +. +. +.SH SYNOPSIS +. +.B ftdiff +.RI [ options ] +.IR font \ .\|.\|. +. +. +.SH DESCRIPTION +. +.B ftdiff +displays text in three columns, using the font or fonts given on the command +line, and applies different FreeType hinting modes to each column. +. +.TP +.B font +The font file(s) to display. +For Type\ 1 font files, +.B ftdiff +also tries to attach the corresponding metrics file (with extension `.afm' +or `.pfm'). +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI \-w \ w +Set the window width to +.I w +pixels (default: 640px). +. +.TP +.BI \-h \ h +Set the window height to +.I h +pixels (default: 480px). +. +.TP +.BI \-r \ r +Use resolution +.I r +dpi (default: 72dpi). +. +.TP +.BI \-s \ s +Set character size to +.I s +points (default: 16pt). +. +.TP +.BI \-f \ textfile +Change displayed text, using text in +.I textfile +(in UTF-8 encoding). +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftdiff.c freetype-2.8/=unpacked-tar2=/src/ftdiff.c --- freetype-2.7.1/=unpacked-tar2=/src/ftdiff.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftdiff.c 2017-05-02 04:22:55.000000000 +0000 @@ -0,0 +1,1647 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2007-2014 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* FTDiff - a simple viewer to compare different hinting modes. */ +/* */ +/* Press ? when running this program to have a list of key-bindings. */ +/* */ +/****************************************************************************/ + + +#include "ftcommon.h" +#include "common.h" +#include "mlgetopt.h" + +#include FT_OUTLINE_H +#include FT_LCD_FILTER_H +#include FT_CFF_DRIVER_H +#include FT_TRUETYPE_DRIVER_H + + /* showing driver name -- the two internal header files */ + /* shouldn't be used in normal programs */ +#include FT_MODULE_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DRIVER_H + +#include +#include +#include +#include + + + static void + usage( char* execname ) + { + fprintf( stderr, + "\n" + "ftdiff: compare font hinting modes -- part of the FreeType project\n" + "------------------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] font ...\n" + "\n", + execname ); + fprintf( stderr, + " font The font file(s) to display.\n" + " For Type 1 font files, ftdiff also tries to attach\n" + " the corresponding metrics file (with extension\n" + " `.afm' or `.pfm').\n" + "\n" ); + fprintf( stderr, + " -w W Set the window width to W pixels (default: %dpx).\n" + " -h H Set the window height to H pixels (default: %dpx).\n" + "\n", + DIM_X, DIM_Y ); + fprintf( stderr, + " -r R Use resolution R dpi (default: 72dpi).\n" + " -s S Set character size to S points (default: 16pt).\n" + " -f TEXTFILE Change displayed text, using text in TEXTFILE\n" + " (in UTF-8 encoding).\n" + "\n" + " -v Show version." + "\n" ); + + exit( 1 ); + } + + + static void + panic( const char* fmt, + ... ) + { + va_list args; + + + va_start( args, fmt ); + vfprintf( stderr, fmt, args ); + va_end( args ); + exit( 1 ); + } + + + /** DISPLAY ABSTRACTION **/ + + typedef enum DisplayMode_ + { + DISPLAY_MODE_MONO = 0, + DISPLAY_MODE_GRAY, + DISPLAY_MODE_LCD + + } DisplayMode; + + + typedef void + (*Display_drawFunc)( void* disp, + DisplayMode mode, + int x, + int y, + int width, + int height, + int pitch, + void* buffer ); + + typedef void + (*Display_textFunc)( void* disp, + int x, + int y, + const char* msg ); + + + typedef struct DisplayRec_ + { + void* disp; + Display_drawFunc disp_draw; + Display_textFunc disp_text; + + } DisplayRec, *Display; + + + static const char* default_text = + "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet" + " dui. Nam sapien. Fusce vestibulum ornare metus. Maecenas ligula orci," + " consequat vitae, dictum nec, lacinia non, elit. Aliquam iaculis" + " molestie neque. Maecenas suscipit felis ut pede convallis malesuada." + " Aliquam erat volutpat. Nunc pulvinar condimentum nunc. Donec ac sem vel" + " leo bibendum aliquam. Pellentesque habitant morbi tristique senectus et" + " netus et malesuada fames ac turpis egestas.\n" + "\n" + "Sed commodo. Nulla ut libero sit amet justo varius blandit. Mauris vitae" + " nulla eget lorem pretium ornare. Proin vulputate erat porta risus." + " Vestibulum malesuada, odio at vehicula lobortis, nisi metus hendrerit" + " est, vitae feugiat quam massa a ligula. Aenean in tellus. Praesent" + " convallis. Nullam vel lacus. Aliquam congue erat non urna mollis" + " faucibus. Morbi vitae mauris faucibus quam condimentum ornare. Quisque" + " sit amet augue. Morbi ullamcorper mattis enim. Aliquam erat volutpat." + " Morbi nec felis non enim pulvinar lobortis. Ut libero. Nullam id orci" + " quis nisl dapibus rutrum. Suspendisse consequat vulputate leo. Aenean" + " non orci non tellus iaculis vestibulum. Sed neque.\n" + "\n"; + + + /***********************************************************************/ + /***********************************************************************/ + /***** *****/ + /***** T E X T R E N D E R I N G *****/ + /***** *****/ + /***********************************************************************/ + /***********************************************************************/ + + typedef enum HintMode_ + { + HINT_MODE_UNHINTED, + HINT_MODE_AUTOHINT, + HINT_MODE_AUTOHINT_LIGHT, + HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL, + HINT_MODE_BYTECODE, + HINT_MODE_MAX + + } HintMode; + + static const char* const render_mode_names[HINT_MODE_MAX] = + { + "unhinted", + "auto-hinter", + "light auto-hinter", + "light auto-hinter (subp.)", + "native hinter" + }; + +#define HINTING_ENGINE_MAX 2 + + /** RENDER STATE **/ + + typedef struct ColumnStateRec_ + { + int use_cboxes; + int use_kerning; + int use_deltas; + int use_lcd_filter; + FT_LcdFilter lcd_filter; + HintMode hint_mode; + DisplayMode disp_mode; + + int use_custom_lcd_filter; + unsigned char filter_weights[5]; + int fw_index; + + unsigned int cff_hinting_engine; + unsigned int tt_interpreter_versions[3]; + int num_tt_interpreter_versions; + int tt_interpreter_version_idx; + FT_Bool warping; + + } ColumnStateRec, *ColumnState; + + + typedef struct FontFaceRec_ + { + const char* filepath; + char* family_name; + char* style_name; + int index; + + } FontFaceRec, *FontFace; + + + typedef struct RenderStateRec_ + { + FT_Library library; + const char* text; + unsigned int resolution; + double char_size; + int col; + ColumnStateRec columns[3]; + FontFace faces; + unsigned int num_faces; + int face_index; + const char* filepath; + const char* filename; + FT_Face face; + FT_Size size; + char** files; + DisplayRec display; + char filepath0[1024]; + + } RenderStateRec, *RenderState; + + + static void + render_state_init( RenderState state, + Display display, + FT_Library library ) + { + FT_UInt cff_hinting_engine; + FT_Bool warping; + + unsigned int tt_interpreter_versions[3] = { 0, 0, 0 }; + int num_tt_interpreter_versions = 0; + int tt_interpreter_version_idx = 0; + + unsigned int dflt_tt_interpreter_version; + int i; + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + + + memset( state, 0, sizeof ( *state ) ); + + state->library = library; + + state->text = default_text; + state->filepath = state->filepath0; + state->filename = ""; + state->filepath0[0] = 0; + state->resolution = 72; + state->char_size = 16; + state->display = display[0]; + + /* get the default value as compiled into FreeType */ + FT_Property_Get( library, + "cff", + "hinting-engine", &cff_hinting_engine ); + + /* collect all available versions, then set again the default */ + FT_Property_Get( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( i = 0; i < 3; i++ ) + { + error = FT_Property_Set( library, + "truetype", + "interpreter-version", &versions[i] ); + if ( !error ) + tt_interpreter_versions[num_tt_interpreter_versions++] = versions[i]; + if ( versions[i] == dflt_tt_interpreter_version ) + tt_interpreter_version_idx = i; + } + FT_Property_Set( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + + FT_Property_Get( library, + "autofitter", + "warping", &warping ); + + state->columns[0].use_cboxes = 0; + state->columns[0].use_kerning = 1; + state->columns[0].use_deltas = 1; + state->columns[0].use_lcd_filter = 1; + state->columns[0].lcd_filter = FT_LCD_FILTER_DEFAULT; + state->columns[0].hint_mode = HINT_MODE_BYTECODE; + state->columns[0].cff_hinting_engine = cff_hinting_engine; + + state->columns[0].tt_interpreter_versions[0] = + tt_interpreter_versions[0]; + state->columns[0].tt_interpreter_versions[1] = + tt_interpreter_versions[1]; + state->columns[0].tt_interpreter_versions[2] = + tt_interpreter_versions[2]; + state->columns[0].num_tt_interpreter_versions = + num_tt_interpreter_versions; + state->columns[0].tt_interpreter_version_idx = + tt_interpreter_version_idx; + + state->columns[0].warping = warping; + state->columns[0].use_custom_lcd_filter = 0; + state->columns[0].fw_index = 2; + /* freetype default filter weights */ + memcpy( state->columns[0].filter_weights, "\x08\x4D\x56\x4D\x08", 5 ); + + state->columns[1] = state->columns[0]; + state->columns[1].hint_mode = HINT_MODE_AUTOHINT; + state->columns[1].use_custom_lcd_filter = 1; + + state->columns[2] = state->columns[0]; + state->columns[2].hint_mode = HINT_MODE_UNHINTED; + + state->col = 1; + } + + + static void + render_state_done( RenderState state ) + { + if ( state->filepath != state->filepath0 ) + { + free( (char*)state->filepath ); + state->filepath = state->filepath0; + } + state->filepath0[0] = 0; + state->filename = 0; + + if ( state->face ) + { + FT_Done_Face( state->face ); + state->face = NULL; + state->size = NULL; + } + + if ( state->library ) + { + FT_Done_FreeType( state->library ); + state->library = NULL; + } + } + + + static void + render_state_set_resolution( RenderState state, + unsigned int resolution ) + { + state->resolution = resolution; + } + + + static void + render_state_set_size( RenderState state, + double char_size ) + { + state->char_size = char_size; + } + + + static void + render_state_set_face_index( RenderState state, + int idx ) + { + state->face_index = idx; + } + + + static void + _render_state_rescale( RenderState state ) + { + if ( state->size ) + FT_Set_Char_Size( state->face, 0, + (FT_F26Dot6)( state->char_size * 64.0 ), + 0, state->resolution ); + } + + + static void + render_state_set_files( RenderState state, + char** files, + char* execname ) + { + FontFace faces = NULL; + unsigned int num_faces = 0; + unsigned int max_faces = 0; + + + state->files = files; + for ( ; files[0] != NULL; files++ ) + { + FT_Face face; + + int num_subfonts; + int count; + + + error = FT_New_Face( state->library, files[0], -1, &face ); + if ( error ) + { + fprintf( stderr, + "ftdiff: could not open font file `%s'\n", + files[0] ); + continue; + } + + num_subfonts = face->num_faces; + + FT_Done_Face( face ); + + for ( count = 0; count < num_subfonts; count++ ) + { + char* fn; + char* family_name; + char* sn; + char* style_name; + + + error = FT_New_Face( state->library, files[0], count, &face ); + if ( error ) + { + fprintf( stderr, + "ftdiff: Opening `%s' failed with code 0x%X, skipping\n", + files[0], error ); + break; + } + + if ( !FT_IS_SCALABLE( face ) ) + { + fprintf( stderr, + "ftdiff: font `%s' is not scalable, skipping\n", + files[0] ); + goto Done; + } + + if ( num_faces >= max_faces ) + { + max_faces += ( max_faces >> 1 ) + 8; + faces = (FontFace)realloc( faces, + max_faces * sizeof ( faces[0] ) ); + if ( faces == NULL ) + panic( "ftdiff: not enough memory\n" ); + } + + if ( face->family_name ) + fn = face->family_name; + else + fn = (char*)"(unknown family)"; + family_name = (char*)malloc( strlen( fn ) + 1 ); + if ( family_name == NULL ) + panic( "ftdiff: not enough memory\n" ); + strcpy( family_name, fn ); + + if ( face->style_name ) + sn = face->style_name; + else + sn = (char*)"(unknown style)"; + style_name = (char*)malloc( strlen( sn ) + 1 ); + if ( style_name == NULL ) + panic( "ftdiff: not enough memory\n" ); + strcpy( style_name, sn ); + + faces[num_faces].filepath = files[0]; + faces[num_faces].index = count; + faces[num_faces].family_name = family_name; + faces[num_faces].style_name = style_name; + num_faces++; + + Done: + FT_Done_Face( face ); + } + } + + state->faces = faces; + state->num_faces = num_faces; + + if ( num_faces == 0 ) + { + fprintf( stderr, "ftdiff: no input font files!\n" ); + usage( execname ); + } + + state->face_index = 0; + } + + + static int + render_state_set_file( RenderState state ) + { + const char* filepath; + + + filepath = state->faces[state->face_index].filepath; + + if ( state->face ) + { + FT_Done_Face( state->face ); + state->face = NULL; + state->size = NULL; + } + + if ( filepath != NULL && filepath[0] != 0 ) + { + error = FT_New_Face( state->library, + filepath, + state->faces[state->face_index].index, + &state->face ); + if ( error ) + return -1; + + { + unsigned int len = strlen( filepath ); + char* p; + + + if ( len + 1 > sizeof ( state->filepath0 ) ) + { + state->filepath = (const char*)malloc( len + 1 ); + if ( state->filepath == NULL ) + { + state->filepath = state->filepath0; + return -1; + } + } + memcpy( (char*)state->filepath, filepath, len + 1 ); + p = (char*)strrchr( state->filepath, '\\' ); + if ( p == NULL ) + p = (char*)strrchr( state->filepath, '/' ); + + state->filename = p ? p + 1 : state->filepath; + } + + state->size = state->face->size; + } + + return 0; + } + + + /** RENDERING **/ + + static void + render_state_draw( RenderState state, + const char* text, + int idx, + int x, + int y, + int width, + int height ) + { + ColumnState column = &state->columns[idx]; + const char* p = text; + const char* p_end = p + strlen( text ); + long load_flags = FT_LOAD_DEFAULT; + FT_Face face; + int left = x; + int right = x + width; + int bottom = y + height; + int line_height; + FT_UInt prev_glyph = 0; + FT_Pos prev_rsb_delta = 0; + FT_Pos x_origin = x << 6; + HintMode rmode = column->hint_mode; + FT_Bool warping = column->warping; + FT_Bool have_0x0A = 0; + FT_Bool have_0x0D = 0; + + + /* no need to check for errors: the values used here are always valid */ + FT_Property_Set( state->library, + "cff", + "hinting-engine", + &column->cff_hinting_engine ); + FT_Property_Set( state->library, + "truetype", + "interpreter-version", + &column->tt_interpreter_versions + [column->tt_interpreter_version_idx] ); + FT_Property_Set( state->library, + "autofitter", + "warping", + &column->warping ); + + /* changing a property is in most cases a global operation; */ + /* we are on the safe side if we reload the face completely */ + /* (this is something a normal program doesn't need to do) */ + render_state_set_file( state ); + _render_state_rescale( state ); + + face = state->face; + + if ( column->use_lcd_filter ) + FT_Library_SetLcdFilter( face->glyph->library, column->lcd_filter ); + + if ( column->use_custom_lcd_filter ) + FT_Library_SetLcdFilterWeights( face->glyph->library, + column->filter_weights ); + + y += state->size->metrics.ascender / 64; + line_height = state->size->metrics.height / 64; + + if ( rmode == HINT_MODE_AUTOHINT ) + load_flags = FT_LOAD_FORCE_AUTOHINT; + + if ( rmode == HINT_MODE_AUTOHINT_LIGHT || + rmode == HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL ) + load_flags = FT_LOAD_TARGET_LIGHT; + + if ( rmode == HINT_MODE_UNHINTED ) + load_flags |= FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; + + while ( 1 ) + { + int ch; + FT_UInt gindex; + FT_GlyphSlot slot = face->glyph; + FT_Bitmap* map = &slot->bitmap; + FT_Long xmax; + + + ch = utf8_next( &p, p_end ); + if ( ch < 0 ) + { + p = text; + ch = utf8_next( &p, p_end ); + } + + /* handle newlines */ + if ( ch == 0x0A ) + { + if ( have_0x0D ) + { + have_0x0A = 0; + have_0x0D = 0; + } + else + { + have_0x0A = 1; + + x_origin = left << 6; + y += line_height; + prev_rsb_delta = 0; + if ( y >= bottom ) + break; + } + + continue; + } + else if ( ch == 0x0D ) + { + if ( have_0x0A ) + { + have_0x0A = 0; + have_0x0D = 0; + } + else + { + have_0x0D = 1; + + x_origin = left << 6; + y += line_height; + prev_rsb_delta = 0; + if ( y >= bottom ) + break; + } + + continue; + } + else + { + have_0x0A = 0; + have_0x0D = 0; + } + + gindex = FT_Get_Char_Index( state->face, (FT_ULong)ch ); + error = FT_Load_Glyph( face, gindex, load_flags ); + + if ( error ) + continue; + + if ( column->use_kerning && gindex != 0 && prev_glyph != 0 ) + { + FT_Vector vec; + FT_UInt kerning_mode = FT_KERNING_DEFAULT; + + + if ( rmode == HINT_MODE_UNHINTED ) + kerning_mode = FT_KERNING_UNFITTED; + + FT_Get_Kerning( face, prev_glyph, gindex, kerning_mode, &vec ); + + x_origin += vec.x; + } + + if ( rmode != HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL && + column->use_deltas ) + { + if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) + x_origin -= 64; + else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) + x_origin += 64; + } + prev_rsb_delta = face->glyph->rsb_delta; + + /* implement sub-pixel positioning for */ + /* un-hinted and (second) light hinting mode */ + if ( ( rmode == HINT_MODE_UNHINTED || + rmode == HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL ) && + slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + FT_Pos shift = x_origin & 63; + + + FT_Outline_Translate( &slot->outline, shift, 0 ); + } + + if ( column->use_cboxes ) + { + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + FT_BBox cbox; + + + FT_Outline_Get_CBox( &slot->outline, &cbox ); + xmax = ( x_origin + cbox.xMax + 63 ) >> 6; + } + else + xmax = ( x_origin >> 6 ) + + slot->bitmap_left + (FT_Long)slot->bitmap.width; + } + else + { + if ( rmode == HINT_MODE_UNHINTED || + rmode == HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL ) + xmax = slot->linearHoriAdvance >> 10; + else + xmax = slot->advance.x; + + xmax += x_origin; + xmax >>= 6; + xmax -= 1; + } + + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + FT_Render_Glyph( slot, + column->use_lcd_filter ? FT_RENDER_MODE_LCD + : FT_RENDER_MODE_NORMAL ); + + if ( xmax >= right ) + { + x = left; + y += line_height; + if ( y >= bottom ) + break; + + x_origin = x << 6; + prev_rsb_delta = 0; + } + + { + DisplayMode mode = DISPLAY_MODE_MONO; + + + if ( slot->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ) + mode = DISPLAY_MODE_GRAY; + else if ( slot->bitmap.pixel_mode == FT_PIXEL_MODE_LCD ) + mode = DISPLAY_MODE_LCD; + + state->display.disp_draw( state->display.disp, mode, + ( x_origin >> 6 ) + slot->bitmap_left, + y - slot->bitmap_top, + (int)map->width, (int)map->rows, + map->pitch, map->buffer ); + } + if ( rmode == HINT_MODE_UNHINTED || + rmode == HINT_MODE_AUTOHINT_LIGHT_SUBPIXEL ) + x_origin += slot->linearHoriAdvance >> 10; + else + x_origin += slot->advance.x; + + prev_glyph = gindex; + } + + /* display footer on this column */ + { + FT_Module module = &state->face->driver->root; + void* disp = state->display.disp; + + const char* extra; + const char* msg; + char temp[64]; + + + extra = ""; + if ( rmode == HINT_MODE_BYTECODE ) + { + if ( !strcmp( module->clazz->module_name, "cff" ) ) + { + switch ( column->cff_hinting_engine ) + { + case FT_CFF_HINTING_FREETYPE: + extra = " (CFF FT)"; + break; + case FT_CFF_HINTING_ADOBE: + extra = " (CFF Adobe)"; + break; + } + } + + else if ( !strcmp( module->clazz->module_name, "truetype" ) ) + { + switch ( column->tt_interpreter_versions[ + column->tt_interpreter_version_idx] ) + { + case TT_INTERPRETER_VERSION_35: + extra = " (TT v35)"; + break; + case TT_INTERPRETER_VERSION_38: + extra = " (TT v38)"; + break; + case TT_INTERPRETER_VERSION_40: + extra = " (TT v40)"; + break; + } + } + } + else if ( rmode == HINT_MODE_AUTOHINT_LIGHT ) + extra = warping ? " (+warp)" : " (-warp)"; + + sprintf( temp, "%s%s", + render_mode_names[column->hint_mode], extra ); + state->display.disp_text( disp, left, + bottom + 5, temp ); + + if ( column->use_lcd_filter ) + msg = "LCD rendering"; + else + msg = "gray rendering"; + state->display.disp_text( disp, left, + bottom + HEADER_HEIGHT + 5, msg ); + + if ( column->use_lcd_filter ) + { + if ( column->use_custom_lcd_filter ) + { + int fwi = column->fw_index; + unsigned char* fw = column->filter_weights; + + + sprintf( temp, + "%s0x%02X%s0x%02X%s0x%02X%s0x%02X%s0x%02X%s", + fwi == 0 ? "[" : " ", + fw[0], + fwi == 0 ? "]" : ( fwi == 1 ? "[" : " " ), + fw[1], + fwi == 1 ? "]" : ( fwi == 2 ? "[" : " " ), + fw[2], + fwi == 2 ? "]" : ( fwi == 3 ? "[" : " " ), + fw[3], + fwi == 3 ? "]" : ( fwi == 4 ? "[" : " " ), + fw[4], + fwi == 4 ? "]" : " " ); + state->display.disp_text( disp, left, + bottom + 2 * HEADER_HEIGHT + 5, temp ); + } + else + { + switch ( column->lcd_filter ) + { + case FT_LCD_FILTER_NONE: + msg = "LCD without filtering"; + break; + case FT_LCD_FILTER_DEFAULT: + msg = "default LCD filter"; + break; + case FT_LCD_FILTER_LIGHT: + msg = "light LCD filter"; + break; + default: + msg = "legacy LCD filter"; + } + state->display.disp_text( disp, left, + bottom + 2 * HEADER_HEIGHT + 5, msg ); + } + } + else + { + msg = ""; + state->display.disp_text( disp, left, + bottom + 2 * HEADER_HEIGHT + 5, msg ); + } + + sprintf( temp, "%s %s %s", + column->use_kerning ? "+kern" + : "-kern", + column->use_deltas ? "+delta" + : "-delta", + column->use_cboxes ? "glyph boxes" + : "adv. widths" ); + state->display.disp_text( disp, left, + bottom + 3 * HEADER_HEIGHT + 5, temp ); + + if ( state->col == idx ) + state->display.disp_text( disp, left, + bottom + 4 * HEADER_HEIGHT + 5, + "************************" ); + } + } + + + /***********************************************************************/ + /***********************************************************************/ + /***** *****/ + /***** D I S P L A Y *****/ + /***** *****/ + /***********************************************************************/ + /***********************************************************************/ + +#include "graph.h" +#include "grobjs.h" +#include "grfont.h" + + typedef struct ADisplayRec_ + { + int width; + int height; + grSurface* surface; + grBitmap* bitmap; + grColor fore_color; + grColor back_color; + double gamma; + + } ADisplayRec, *ADisplay; + + + static int + adisplay_init( ADisplay display, + grPixelMode mode, + int width, + int height ) + { + grSurface* surface; + grBitmap bit; + + + if ( mode != gr_pixel_mode_gray && + mode != gr_pixel_mode_rgb24 ) + return -1; + + grInitDevices(); + + bit.mode = mode; + bit.width = width; + bit.rows = height; + bit.grays = 256; + + surface = grNewSurface( 0, &bit ); + + if ( !surface ) + return -1; + + display->width = width; + display->height = height; + display->surface = surface; + display->bitmap = &surface->bitmap; + display->gamma = GAMMA; + + grSetGlyphGamma( display->gamma ); + + memset( &display->fore_color, 0, sizeof( grColor ) ); + memset( &display->back_color, 0xff, sizeof( grColor ) ); + + return 0; + } + + + static void + adisplay_clear( ADisplay display ) + { + grBitmap* bit = display->bitmap; + int pitch = bit->pitch; + + + if ( pitch < 0 ) + pitch = -pitch; + + if ( bit->mode == gr_pixel_mode_gray ) + memset( bit->buffer, + display->back_color.value, + (unsigned int)( pitch * bit->rows ) ); + else + { + unsigned char* p = bit->buffer; + int i, j; + + + for ( i = 0; i < bit->rows; i++ ) + { + for ( j = 0; j < bit->width; j++ ) + memcpy( p + 3 * j, display->back_color.chroma, 3 ); + + p += pitch; + } + } + } + + + static void + adisplay_done( ADisplay display ) + { + grDoneBitmap( display->bitmap ); + grDoneSurface( display->surface ); + + display->bitmap = NULL; + display->surface = NULL; + + grDoneDevices(); + } + + + static void + adisplay_draw_glyph( void* _display, + DisplayMode mode, + int x, + int y, + int width, + int height, + int pitch, + void* buffer ) + { + ADisplay display = (ADisplay)_display; + grBitmap glyph; + + + glyph.width = width; + glyph.rows = height; + glyph.pitch = pitch; + glyph.buffer = (unsigned char*)buffer; + glyph.grays = 256; + glyph.mode = gr_pixel_mode_mono; + + if ( mode == DISPLAY_MODE_GRAY ) + glyph.mode = gr_pixel_mode_gray; + else if ( mode == DISPLAY_MODE_LCD ) + glyph.mode = gr_pixel_mode_lcd; + + grBlitGlyphToBitmap( display->bitmap, &glyph, + x, y, display->fore_color ); + } + + + static void + adisplay_draw_text( void* _display, + int x, + int y, + const char* msg ) + { + ADisplay adisplay = (ADisplay)_display; + + + grWriteCellString( adisplay->bitmap, x, y, msg, + adisplay->fore_color ); + } + + + static void + adisplay_change_gamma( ADisplay display, + double delta ) + { + /* use epsilons */ + display->gamma += delta; + if ( display->gamma > 2.9999 ) + display->gamma = 3.0; + else if ( display->gamma < 0.0001 ) + display->gamma = 0.0; + + grSetGlyphGamma( display->gamma ); + } + + + static void + event_help( RenderState state ) + { + char buf[256]; + char version[64]; + + const char* format; + FT_Int major, minor, patch; + + ADisplay display = (ADisplay)state->display.disp; + grEvent dummy_event; + + + FT_Library_Version( state->library, &major, &minor, &patch ); + + format = patch ? "%d.%d.%d" : "%d.%d"; + sprintf( version, format, major, minor, patch ); + + adisplay_clear( display ); + grSetLineHeight( 10 ); + grGotoxy( 0, 0 ); + grSetMargin( 2, 1 ); + grGotobitmap( display->bitmap ); + + sprintf( buf, + "FreeType Hinting Mode Comparator - part of the FreeType %s test suite", + version ); + + grWriteln( buf ); + grLn(); + grWriteln( "This program displays text using various hinting algorithms." ); + grLn(); + grWriteln( "Use the following keys:" ); + grLn(); + grWriteln( " F1, ? display this help screen" ); + grLn(); + grWriteln( " p, n select previous/next font" ); + grLn(); + grWriteln( " global parameters:" ); + grLn(); + grWriteln( " Up, Down adjust pointsize by 0.5 unit" ); + grWriteln( " PgUp, PgDn adjust pointsize by 5 units" ); + grWriteln( " g, v adjust gamma value" ); + grLn(); + grWriteln( " 1, 2, 3 select left, middle, or right column" ); + grWriteln( " Left, Right switch between columns" ); + grLn(); + grWriteln( " per-column parameters:" ); + grLn(); + grWriteln( " d toggle lsb/rsb deltas" ); + grWriteln( " h cycle hinting mode" ); + grWriteln( " H cycle hinting engine (if CFF or TTF)" ); + grWriteln( " w toggle warping (if light auto-hinting" ); + grWriteln( " k toggle kerning (only from `kern' table)" ); + grWriteln( " r toggle rendering mode" ); + grWriteln( " x toggle layout mode" ); + grLn(); + grWriteln( " l change LCD filter type" ); + grWriteln( " [, ] select custom LCD filter weight" ); + grWriteln( " -, +(=) adjust selected custom LCD filter weight"); + grLn(); + grWriteln( "press any key to exit this help screen" ); + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, gr_event_key, &dummy_event ); + } + + + static void + event_change_gamma( RenderState state, + double delta ) + { + ADisplay display = (ADisplay)state->display.disp; + + + adisplay_change_gamma( display, delta ); + } + + + static void + event_change_size( RenderState state, + double delta ) + { + double char_size = state->char_size; + + + char_size += delta; + if ( char_size < 6.0 ) + char_size = 6.0; + else if ( char_size > 300.0 ) + char_size = 300.0; + + render_state_set_size( state, char_size ); + } + + + static void + event_change_face_index( RenderState state, + int idx ) + { + if ( idx < 0 ) + idx = 0; + + if ( idx >= (int)state->num_faces ) + idx = (int)state->num_faces - 1; + + render_state_set_face_index( state, idx ); + } + + + static int + process_event( RenderState state, + grEvent* event ) + { + int ret = 0; + ColumnState column = &state->columns[state->col]; + + + switch ( event->key ) + { + case grKeyEsc: + case grKEY( 'q' ): + ret = 1; + break; + + case grKeyF1: + case grKEY( '?' ): + event_help( state ); + break; + + case grKeyLeft: + if ( --state->col < 0 ) + state->col = 2; + break; + + case grKeyRight: + if ( ++state->col > 2 ) + state->col = 0; + break; + + case grKeyUp: + event_change_size( state, 0.5 ); + break; + + case grKeyDown: + event_change_size( state, -0.5 ); + break; + + case grKeyPageUp: + event_change_size( state, 5. ); + break; + + case grKeyPageDown: + event_change_size( state, -5. ); + break; + + case grKEY( '1' ): + state->col = 0; + break; + + case grKEY( '2' ): + state->col = 1; + break; + + case grKEY( '3' ): + state->col = 2; + break; + + case grKEY( 'd' ): + column->use_deltas = !column->use_deltas; + break; + + case grKEY( 'g' ): + event_change_gamma( state, 0.1 ); + break; + + case grKEY( 'h' ): + column->hint_mode = + (HintMode)( ( column->hint_mode + 1 ) % HINT_MODE_MAX ); + break; + + case grKEY( 'H' ): + { + FT_Module module = &state->face->driver->root; + + + if ( column->hint_mode == HINT_MODE_BYTECODE ) + { + if ( !strcmp( module->clazz->module_name, "cff" ) ) + { + FT_UInt new_cff_hinting_engine; + + + new_cff_hinting_engine = + ( column->cff_hinting_engine + 1 ) % HINTING_ENGINE_MAX; + + error = FT_Property_Set( state->library, + "cff", + "hinting-engine", + &new_cff_hinting_engine ); + if ( !error ) + column->cff_hinting_engine = new_cff_hinting_engine; + } + else if ( !strcmp( module->clazz->module_name, "truetype" ) ) + { + column->tt_interpreter_version_idx += 1; + column->tt_interpreter_version_idx %= + column->num_tt_interpreter_versions; + + FT_Property_Set( state->library, + "truetype", + "interpreter-version", + &column->tt_interpreter_versions[ + column->tt_interpreter_version_idx] ); + } + } + } + break; + + case grKEY( 'w' ): + { + FT_Bool new_warping_state = !column->warping; + + + error = FT_Property_Set( state->library, + "autofitter", + "warping", + &new_warping_state ); + if ( !error ) + column->warping = new_warping_state; + } + break; + + case grKEY( 'k' ): + column->use_kerning = !column->use_kerning; + break; + + case grKEY( 'l' ): + switch ( column->lcd_filter ) + { + case FT_LCD_FILTER_NONE: + column->lcd_filter = FT_LCD_FILTER_DEFAULT; + break; + + case FT_LCD_FILTER_DEFAULT: + if ( !column->use_custom_lcd_filter ) + column->use_custom_lcd_filter = 1; + else + { + column->use_custom_lcd_filter = 0; + column->lcd_filter = FT_LCD_FILTER_LIGHT; + } + break; + + case FT_LCD_FILTER_LIGHT: + column->lcd_filter = FT_LCD_FILTER_LEGACY; + break; + + case FT_LCD_FILTER_LEGACY: + column->lcd_filter = FT_LCD_FILTER_NONE; + break; + + default: /* to satisfy picky compilers */ + break; + } + break; + + case grKEY( 'n' ): + event_change_face_index( state, state->face_index + 1 ); + break; + + case grKEY( 'p' ): + event_change_face_index( state, state->face_index - 1 ); + break; + + case grKEY( 'r' ): + column->use_lcd_filter = !column->use_lcd_filter; + break; + + case grKEY( 'v' ): + event_change_gamma( state, -0.1 ); + break; + + case grKEY( 'x' ): + column->use_cboxes = !column->use_cboxes; + break; + + case grKEY( '[' ): + if ( !column->use_custom_lcd_filter ) + break; + + column->fw_index--; + if ( column->fw_index < 0 ) + column->fw_index = 4; + break; + + case grKEY( ']' ): + if ( !column->use_custom_lcd_filter ) + break; + + column->fw_index++; + if ( column->fw_index > 4 ) + column->fw_index = 0; + break; + + case grKEY( '-' ): + if ( !column->use_custom_lcd_filter ) + break; + + column->filter_weights[column->fw_index]--; + break; + + case grKEY( '+' ): + case grKEY( '=' ): + if ( !column->use_custom_lcd_filter ) + break; + + column->filter_weights[column->fw_index]++; + break; + + default: + break; + } + + return ret; + } + + + static void + write_global_info( RenderState state ) + { + ADisplay adisplay = (ADisplay)state->display.disp; + char gamma[] = "sRGB"; + char buf[256]; + + FontFace face = &state->faces[state->face_index]; + const char* basename; + + + basename = ft_basename( state->filename ); + sprintf( buf, "%.50s %.50s (file `%.100s')", + face->family_name, + face->style_name, + basename ); + grWriteCellString( adisplay->bitmap, 0, 5, + buf, adisplay->fore_color ); + + if ( adisplay->gamma != 0.0 ) + sprintf( gamma, "%.1f", adisplay->gamma ); + sprintf( buf, "%.1fpt (%dppem) at %ddpi, gamma: %s", + state->char_size, + (int)(state->char_size * state->resolution / 72 + 0.5), + state->resolution, + gamma ); + grWriteCellString( adisplay->bitmap, 0, 5 + HEADER_HEIGHT, + buf, adisplay->fore_color ); + + } + + + int + main( int argc, + char** argv ) + { + FT_Library library; + + ADisplayRec adisplay[1]; + RenderStateRec state[1]; + DisplayRec display[1]; + int width = DIM_X; + int height = DIM_Y; + int resolution = -1; + double size = -1; + const char* textfile = NULL; + char* text = (char*)default_text; + + char* execname; + int option; + + + execname = ft_basename( argv[0] ); + + if ( FT_Init_FreeType( &library ) != 0 ) + panic( "could not initialize FreeType\n" ); + + while ( 1 ) + { + option = getopt( argc, argv, "f:h:r:s:vw:" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'f': + textfile = optarg; + break; + + case 'h': + height = atoi( optarg ); + if ( height < 1 ) + usage( execname ); + break; + + case 'r': + resolution = atoi( optarg ); + break; + + case 's': + size = atof( optarg ); + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( library, &major, &minor, &patch ); + + printf( "ftdiff (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + case 'w': + width = atoi( optarg ); + if ( width < 1 ) + usage( execname ); + break; + + default: + usage( execname ); + break; + } + } + + argc -= optind; + argv += optind; + + if ( argc < 1 ) + usage( execname ); + + /* Read Text File, if any */ + if ( textfile != NULL ) + { + FILE* tfile = fopen( textfile, "r" ); + + + if ( tfile == NULL ) + fprintf( stderr, "could not read textfile '%s'\n", textfile ); + else + { + int tsize; + + + fseek( tfile, 0, SEEK_END ); + tsize = ftell( tfile ); + + fseek( tfile, 0, SEEK_SET ); + text = (char*)malloc( (unsigned int)( tsize + 1 ) ); + + if ( text != NULL ) + { + fread( text, (unsigned int)tsize, 1, tfile ); + text[tsize] = 0; + } + else + { + fprintf( stderr, "not enough memory to read `%s'\n", textfile ); + text = (char *)default_text; + } + + fclose( tfile ); + } + } + + /* Initialize display */ + if ( adisplay_init( adisplay, gr_pixel_mode_rgb24, + width, height ) < 0 ) + { + fprintf( stderr, "could not initialize display! Aborting.\n" ); + exit( 1 ); + } + display->disp = adisplay; + display->disp_draw = adisplay_draw_glyph; + display->disp_text = adisplay_draw_text; + + render_state_init( state, display, library ); + + if ( resolution > 0 ) + render_state_set_resolution( state, (unsigned int)resolution ); + + if ( size > 0.0 ) + render_state_set_size( state, size ); + + render_state_set_files( state, argv, execname ); + + grSetTitle( adisplay->surface, "FreeType Text Proofer, press ? for help" ); + + for (;;) + { + grEvent event; + + int border_width; + + int column_x_start[3]; + int column_y_start; + + int column_height; + int column_width; + + + adisplay_clear( adisplay ); + + /* We have this layout: */ + /* */ + /* | n ----x---- n n ----x---- n n ----x---- n | */ + /* */ + /* w = 6 * n + 3 * x */ + + border_width = 10; /* n */ + column_width = ( width - 6 * border_width ) / 3; /* x */ + + column_x_start[0] = border_width; + column_x_start[1] = 3 * border_width + column_width; + column_x_start[2] = 5 * border_width + 2 * column_width; + + column_y_start = 10 + 2 * HEADER_HEIGHT; + column_height = height - 8 * HEADER_HEIGHT - 5; + + render_state_draw( state, text, 0, + column_x_start[0], column_y_start, + column_width, column_height ); + render_state_draw( state, text, 1, + column_x_start[1], column_y_start, + column_width, column_height ); + render_state_draw( state, text, 2, + column_x_start[2], column_y_start, + column_width, column_height ); + + write_global_info( state ); + grRefreshSurface( adisplay->surface ); + grListenSurface( adisplay->surface, 0, &event ); + if ( process_event( state, &event ) ) + break; + } + + render_state_done( state ); + adisplay_done( adisplay ); + exit( 0 ); /* for safety reasons */ + + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftdump.1 freetype-2.8/=unpacked-tar2=/src/ftdump.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftdump.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftdump.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,47 @@ +.TH FTDUMP 1 "May 2017" "FreeType 2.8" +. +. +.SH NAME +. +ftdump \- simple font dumper +. +. +.SH SYNOPSIS +. +.B ftdump +.RI [ options ] +.I fontname +. +. +.SH DESCRIPTION +. +.B ftdump +lists information about a font file that is relevant for FreeType. +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.B \-n +Print SFNT name tables. +. +.TP +.B \-p +Print TrueType programs. +. +.TP +.B \-u +Emit UTF-8. +. +.TP +.B \-V +Be verbose. +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftdump.c freetype-2.8/=unpacked-tar2=/src/ftdump.c --- freetype-2.7.1/=unpacked-tar2=/src/ftdump.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftdump.c 2017-04-16 05:10:18.000000000 +0000 @@ -0,0 +1,886 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2000, 2003-2007, 2010, 2012-2013 */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/****************************************************************************/ + + +#include +#include FT_FREETYPE_H +#include FT_SFNT_NAMES_H +#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_TABLES_H +#include FT_TRUETYPE_TAGS_H +#include FT_MULTIPLE_MASTERS_H + + /* the following header shouldn't be used in normal programs */ +#include FT_INTERNAL_DEBUG_H + + /* showing driver name */ +#include FT_MODULE_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DRIVER_H + +#include "common.h" +#include "output.h" +#include "mlgetopt.h" + +#include +#include +#include + + + static FT_Error error; + + static int comma_flag = 0; + static int verbose = 0; + static int name_tables = 0; + static int bytecode = 0; + static int utf8 = 0; + + + /* PanicZ */ + static void + PanicZ( FT_Library library, + const char* message ) + { + FT_Done_FreeType( library ); + + fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); + exit( 1 ); + } + + + static void + Print_Comma( const char* message ) + { + if ( comma_flag ) + printf( ", " ); + + printf( "%s", message ); + comma_flag = 1; + } + + + static void + usage( FT_Library library, + char* execname ) + { + FT_Done_FreeType( library ); + + fprintf( stderr, + "\n" + "ftdump: simple font dumper -- part of the FreeType project\n" + "-----------------------------------------------------------\n" + "\n" + "Usage: %s [options] fontname\n" + "\n", + execname ); + + fprintf( stderr, + " -n Print SFNT name tables.\n" + " -p Print TrueType programs.\n" + " -u Emit UTF8.\n" + " -V Be verbose.\n" + "\n" + " -v Show version.\n" + "\n" ); + + exit( 1 ); + } + + + static void + Print_Name( FT_Face face ) + { + const char* ps_name; + + + printf( "font name entries\n" ); + + /* XXX: Foundry? Copyright? Version? ... */ + + printf( " family: %s\n", face->family_name ); + printf( " style: %s\n", face->style_name ); + + ps_name = FT_Get_Postscript_Name( face ); + if ( ps_name == NULL ) + ps_name = "UNAVAILABLE"; + + printf( " postscript: %s\n", ps_name ); + } + + + static void + Print_Type( FT_Face face ) + { + FT_Module module; + + + printf( "font type entries\n" ); + + module = &face->driver->root; + printf( " FreeType driver: %s\n", module->clazz->module_name ); + + /* Is it better to dump all sfnt tag names? */ + printf( " sfnt wrapped: %s\n", + FT_IS_SFNT( face ) ? (char *)"yes" : (char *)"no" ); + + /* isScalable? */ + comma_flag = 0; + printf( " type: " ); + if ( FT_IS_SCALABLE( face ) ) + { + Print_Comma( "scalable" ); + if ( FT_HAS_MULTIPLE_MASTERS( face ) ) + Print_Comma( "multiple masters" ); + } + if ( FT_HAS_FIXED_SIZES( face ) ) + Print_Comma( "fixed size" ); + printf( "\n" ); + + /* Direction */ + comma_flag = 0; + printf( " direction: " ); + if ( FT_HAS_HORIZONTAL( face ) ) + Print_Comma( "horizontal" ); + + if ( FT_HAS_VERTICAL( face ) ) + Print_Comma( "vertical" ); + + printf( "\n" ); + + printf( " fixed width: %s\n", + FT_IS_FIXED_WIDTH( face ) ? (char *)"yes" : (char *)"no" ); + + printf( " glyph names: %s\n", + FT_HAS_GLYPH_NAMES( face ) ? (char *)"yes" : (char *)"no" ); + + if ( FT_IS_SCALABLE( face ) ) + { + printf( " EM size: %d\n", face->units_per_EM ); + printf( " global BBox: (%ld,%ld):(%ld,%ld)\n", + face->bbox.xMin, face->bbox.yMin, + face->bbox.xMax, face->bbox.yMax ); + printf( " ascent: %d\n", face->ascender ); + printf( " descent: %d\n", face->descender ); + printf( " text height: %d\n", face->height ); + } + } + + static const char* + platform_id( int id ) + { + switch ( id ) + { + case TT_PLATFORM_APPLE_UNICODE: + return "Apple (Unicode)"; + case TT_PLATFORM_MACINTOSH: + return "Macintosh"; + case TT_PLATFORM_ISO: + return "ISO (deprecated)"; + case TT_PLATFORM_MICROSOFT: + return "Microsoft"; + case TT_PLATFORM_CUSTOM: + return "custom"; + case TT_PLATFORM_ADOBE: + return "Adobe"; + + default: + return "UNKNOWN"; + } + } + + +#define XEXPAND( x ) #x +#define EXPAND( x ) XEXPAND( x ) + +#define NAME_ID( tag, description ) \ + case TT_NAME_ID_ ## tag: \ + return description " (ID " EXPAND( TT_NAME_ID_ ## tag ) ")" + + + static const char* + name_id( int id ) + { + switch ( id ) + { + NAME_ID( COPYRIGHT, "copyright" ); + NAME_ID( FONT_FAMILY, "font family" ); + NAME_ID( FONT_SUBFAMILY, "font subfamily" ); + NAME_ID( UNIQUE_ID, "unique font identifier" ); + NAME_ID( FULL_NAME, "full name" ); + NAME_ID( VERSION_STRING, "version string" ); + NAME_ID( PS_NAME, "PostScript name" ); + NAME_ID( TRADEMARK, "trademark" ); + + /* the following values are from the OpenType spec */ + NAME_ID( MANUFACTURER, "manufacturer" ); + NAME_ID( DESIGNER, "designer" ); + NAME_ID( DESCRIPTION, "description" ); + NAME_ID( VENDOR_URL, "vendor URL" ); + NAME_ID( DESIGNER_URL, "designer URL" ); + NAME_ID( LICENSE, "license" ); + NAME_ID( LICENSE_URL, "license URL" ); + /* number 15 is reserved */ + NAME_ID( TYPOGRAPHIC_FAMILY, "typographic family" ); + NAME_ID( TYPOGRAPHIC_SUBFAMILY, "typographic subfamily" ); + NAME_ID( MAC_FULL_NAME, "Mac full name" ); + + /* the following code is new as of 2000-01-21 */ + NAME_ID( SAMPLE_TEXT, "sample text" ); + + /* this is new in OpenType 1.3 */ + NAME_ID( CID_FINDFONT_NAME, "CID `findfont' name" ); + + /* this is new in OpenType 1.5 */ + NAME_ID( WWS_FAMILY, "WWS family name" ); + NAME_ID( WWS_SUBFAMILY, "WWS subfamily name" ); + + /* this is new in OpenType 1.7 */ + NAME_ID( LIGHT_BACKGROUND, "light background palette" ); + NAME_ID( DARK_BACKGROUND, "dark background palette" ); + + /* this is new in OpenType 1.8 */ + NAME_ID( VARIATIONS_PREFIX, "variations PostScript name prefix" ); + + default: + return NULL; + } + } + + + static void + Print_Sfnt_Names( FT_Face face ) + { + FT_SfntName name; + FT_UInt num_names, i; + + + printf( "font string entries\n" ); + + num_names = FT_Get_Sfnt_Name_Count( face ); + for ( i = 0; i < num_names; i++ ) + { + error = FT_Get_Sfnt_Name( face, i, &name ); + if ( error == FT_Err_Ok ) + { + const char* NameID = name_id( name.name_id ); + const char* PlatformID = platform_id( name.platform_id ); + + + if ( NameID ) + printf( " %-15s [%s]", NameID, PlatformID ); + else + printf( " Name ID %-5d [%s]", name.name_id, PlatformID ); + + switch ( name.platform_id ) + { + case TT_PLATFORM_APPLE_UNICODE: + fputs( ":\n", stdout ); + switch ( name.encoding_id ) + { + case TT_APPLE_ID_DEFAULT: + case TT_APPLE_ID_UNICODE_1_1: + case TT_APPLE_ID_ISO_10646: + case TT_APPLE_ID_UNICODE_2_0: + put_unicode_be16( name.string, name.string_len, 6, utf8 ); + break; + + default: + printf( "{unsupported Unicode encoding %d}", name.encoding_id ); + break; + } + break; + + case TT_PLATFORM_MACINTOSH: + if ( name.language_id != TT_MAC_LANGID_ENGLISH ) + printf( " (language=%u)", name.language_id ); + fputs( ":\n", stdout ); + + switch ( name.encoding_id ) + { + case TT_MAC_ID_ROMAN: + /* FIXME: convert from MacRoman to ASCII/ISO8895-1/whatever */ + /* (MacRoman is mostly like ISO8895-1 but there are */ + /* differences) */ + put_ascii( name.string, name.string_len, 6 ); + break; + + default: + printf( " [data in encoding %d]", name.encoding_id ); + break; + } + + break; + + case TT_PLATFORM_ISO: + fputs( ":\n", stdout ); + switch ( name.encoding_id ) + { + case TT_ISO_ID_7BIT_ASCII: + case TT_ISO_ID_8859_1: + put_ascii( name.string, name.string_len, 6 ); + break; + + case TT_ISO_ID_10646: + put_unicode_be16( name.string, name.string_len, 6, utf8 ); + break; + + default: + printf( "{unsupported encoding %d}", name.encoding_id ); + break; + } + break; + + case TT_PLATFORM_MICROSOFT: + if ( name.language_id != TT_MS_LANGID_ENGLISH_UNITED_STATES ) + printf( " (language=0x%04x)", name.language_id ); + fputs( ":\n", stdout ); + + switch ( name.encoding_id ) + { + /* TT_MS_ID_SYMBOL_CS is Unicode, similar to PID/EID=3/1 */ + case TT_MS_ID_SYMBOL_CS: + case TT_MS_ID_UNICODE_CS: + put_unicode_be16( name.string, name.string_len, 6, utf8 ); + break; + + default: + printf( "{unsupported encoding %d}", name.encoding_id ); + break; + } + + break; + + default: + printf( "{unsupported platform}" ); + break; + } + + printf( "\n" ); + } + } + } + + + static void + Print_Fixed( FT_Face face ) + { + int i; + + + /* num_fixed_size */ + printf( "fixed size\n" ); + + /* available size */ + for ( i = 0; i < face->num_fixed_sizes; i++ ) + { + FT_Bitmap_Size* bsize = face->available_sizes + i; + + + printf( " %3d: height %d, width %d\n", + i, bsize->height, bsize->width ); + printf( " size %.3f, x_ppem %.3f, y_ppem %.3f\n", + bsize->size / 64.0, + bsize->x_ppem / 64.0, bsize->y_ppem / 64.0 ); + } + } + + + static void + Print_Charmaps( FT_Face face ) + { + int i, active = -1; + + + if ( face->charmap ) + active = FT_Get_Charmap_Index( face->charmap ); + + /* CharMaps */ + printf( "charmaps\n" ); + + for( i = 0; i < face->num_charmaps; i++ ) + { + FT_Long format = FT_Get_CMap_Format( face->charmaps[i] ); + FT_ULong lang_id = FT_Get_CMap_Language_ID( face->charmaps[i] ); + + + if ( format >= 0 ) + printf( " %d: format %2ld, platform %u, encoding %2u", + i, + format, + face->charmaps[i]->platform_id, + face->charmaps[i]->encoding_id ); + else + printf( " %d: synthetic, platform %u, encoding %2u", + i, + face->charmaps[i]->platform_id, + face->charmaps[i]->encoding_id ); + + if ( lang_id == 0xFFFFFFFFUL ) + printf( " (Unicode Variation Sequences)" ); + else + printf( " language %lu", + lang_id ); + + if ( i == active ) + printf( " (active)" ); + + printf ( "\n" ); + + if ( verbose ) + { + FT_ULong charcode; + FT_UInt gindex; + + + FT_Set_Charmap( face, face->charmaps[i] ); + + charcode = FT_Get_First_Char( face, &gindex ); + while ( gindex ) + { + printf( " 0x%04lx => %d\n", charcode, gindex ); + charcode = FT_Get_Next_Char( face, charcode, &gindex ); + } + printf( "\n" ); + } + } + } + + + static void + Print_MM_Axes( FT_Face face ) + { + FT_MM_Var* mm; + FT_Multi_Master dummy; + FT_UInt is_GX, i, num_names; + + + /* MM or GX axes */ + error = FT_Get_Multi_Master( face, &dummy ); + is_GX = error ? 1 : 0; + + printf( "%s axes\n", is_GX ? "GX" : "MM" ); + + error = FT_Get_MM_Var( face, &mm ); + if ( error ) + { + printf( " Can't access axis data (error code %d)\n", error ); + return; + } + + num_names = FT_Get_Sfnt_Name_Count( face ); + + for ( i = 0; i < mm->num_axis; i++ ) + { + FT_SfntName name; + + + name.string = NULL; + + if ( is_GX ) + { + FT_UInt strid = mm->axis[i].strid; + FT_UInt j; + + + /* iterate over all name entries */ + /* to find an English entry for `strid' */ + + for ( j = 0; j < num_names; j++ ) + { + error = FT_Get_Sfnt_Name( face, j, &name ); + if ( error ) + continue; + + if ( name.name_id == strid ) + { + /* XXX we don't have support for Apple's new `ltag' table yet, */ + /* thus we ignore TT_PLATFORM_APPLE_UNICODE */ + if ( ( name.platform_id == TT_PLATFORM_MACINTOSH && + name.language_id == TT_MAC_LANGID_ENGLISH ) || + ( name.platform_id == TT_PLATFORM_MICROSOFT && + ( name.language_id & 0xFF ) + == TT_MS_LANGID_ENGLISH_GENERAL ) ) + break; + } + } + } + + if ( name.string ) + { + if ( name.platform_id == TT_PLATFORM_MACINTOSH ) + put_ascii( name.string, name.string_len, 3 ); + else + put_unicode_be16( name.string, name.string_len, 3, utf8 ); + } + else + printf( " %s", mm->axis[i].name ); + + printf( ": [%g;%g], default %g\n", + mm->axis[i].minimum / 65536.0, + mm->axis[i].maximum / 65536.0, + mm->axis[i].def / 65536.0 ); + } + + free( mm ); + } + + + static void + Print_Bytecode( FT_Byte* buffer, + FT_UShort length, + char* tag ) + { + FT_UShort i; + int j = 0; /* status counter */ + + + for ( i = 0; i < length; i++ ) + { + if ( ( i & 15 ) == 0 ) + printf( "\n%s:%04hx ", tag, i ); + + if ( j == 0 ) + { + printf( " %02x", (FT_UInt)buffer[i] ); + + if ( buffer[i] == 0x40 ) + j = -1; + else if ( buffer[i] == 0x41 ) + j = -2; + else if ( 0xB0 <= buffer[i] && buffer[i] <= 0xB7 ) + j = buffer[i] - 0xAF; + else if ( 0xB8 <= buffer[i] && buffer[i] <= 0xBF ) + j = 2 * ( buffer[i] - 0xB7 ); + } + else + { + printf( "_%02x", (FT_UInt)buffer[i] ); + + if ( j == -1 ) + j = buffer[i]; + else if ( j == -2 ) + j = 2 * buffer[i]; + else + j--; + } + } + printf( "\n" ); + } + + + static void + Print_Programs( FT_Face face ) + { + FT_ULong length = 0; + FT_UShort i; + FT_Byte* buffer = NULL; + FT_Byte* offset = NULL; + + TT_Header* head; + TT_MaxProfile* maxp; + + + error = FT_Load_Sfnt_Table( face, TTAG_fpgm, 0, NULL, &length ); + if ( error || length == 0 ) + goto Prep; + + buffer = (FT_Byte*)malloc( length ); + if ( buffer == NULL ) + goto Exit; + + error = FT_Load_Sfnt_Table( face, TTAG_fpgm, 0, buffer, &length ); + if ( error ) + goto Exit; + + printf( "font program" ); + Print_Bytecode( buffer, (FT_UShort)length, (char*)"fpgm" ); + + Prep: + length = 0; + + error = FT_Load_Sfnt_Table( face, TTAG_prep, 0, NULL, &length ); + if ( error || length == 0 ) + goto Glyf; + + buffer = (FT_Byte*)realloc( buffer, length ); + if ( buffer == NULL ) + goto Exit; + + error = FT_Load_Sfnt_Table( face, TTAG_prep, 0, buffer, &length ); + if ( error ) + goto Exit; + + printf( "\ncontrol value program" ); + Print_Bytecode( buffer, (FT_UShort)length, (char*)"prep" ); + + Glyf: + length = 0; + + error = FT_Load_Sfnt_Table( face, TTAG_glyf, 0, NULL, &length ); + if ( error || length == 0 ) + goto Exit; + + buffer = (FT_Byte*)realloc( buffer, length ); + if ( buffer == NULL ) + goto Exit; + + error = FT_Load_Sfnt_Table( face, TTAG_glyf, 0, buffer, &length ); + if ( error ) + goto Exit; + + length = 0; + + error = FT_Load_Sfnt_Table( face, TTAG_loca, 0, NULL, &length ); + if ( error || length == 0 ) + goto Exit; + + offset = (FT_Byte*)malloc( length ); + if ( offset == NULL ) + goto Exit; + + error = FT_Load_Sfnt_Table( face, TTAG_loca, 0, offset, &length ); + if ( error ) + goto Exit; + + head = (TT_Header*)FT_Get_Sfnt_Table( face, FT_SFNT_HEAD ); + maxp = (TT_MaxProfile*)FT_Get_Sfnt_Table( face, FT_SFNT_MAXP ); + + for ( i = 0; i < maxp->numGlyphs; i++ ) + { + FT_UInt32 loc; + FT_UInt16 len; + char tag[5]; + + + if ( head->Index_To_Loc_Format ) + loc = (FT_UInt32)offset[4 * i ] << 24 | + (FT_UInt32)offset[4 * i + 1] << 16 | + (FT_UInt32)offset[4 * i + 2] << 8 | + (FT_UInt32)offset[4 * i + 3]; + else + loc = (FT_UInt32)offset[2 * i ] << 9 | + (FT_UInt32)offset[2 * i + 1] << 1; + + len = (FT_UInt16)( buffer[loc] << 8 | buffer[loc + 1] ); + + loc += 10; + + if ( (FT_Int16)len < 0 ) /* composite */ + { + FT_UShort flags; + + + do + { + flags = (FT_UInt16)( buffer[loc] << 8 | buffer[loc + 1] ); + + loc += 4; + + loc += flags & FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS ? 4 : 2; + + loc += flags & FT_SUBGLYPH_FLAG_SCALE ? 2 + : flags & FT_SUBGLYPH_FLAG_XY_SCALE ? 4 + : flags & FT_SUBGLYPH_FLAG_2X2 ? 8 : 0; + } while ( flags & 0x20 ); /* more components */ + + if ( ( flags & 0x100 ) == 0 ) + continue; + } + else + loc += 2 * len; + + len = (FT_UInt16)( buffer[loc] << 8 | buffer[loc + 1] ); + + if ( len == 0 ) + continue; + + loc += 2; + + sprintf( tag, "%04hx", i ); + printf("\nglyf program %hd (%.4s)", i, tag ); + Print_Bytecode( buffer + loc, len, tag ); + } + + Exit: + free( buffer ); + free( offset ); + } + + + int + main( int argc, + char* argv[] ) + { + int i, file; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + int num_faces; + int option; + + FT_Library library; /* the FreeType library */ + FT_Face face; /* the font face */ + + + execname = ft_basename( argv[0] ); + + /* Initialize engine */ + error = FT_Init_FreeType( &library ); + if ( error ) + PanicZ( library, "Could not initialize FreeType library" ); + + while ( 1 ) + { + option = getopt( argc, argv, "npuvV" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'n': + name_tables = 1; + break; + + case 'p': + bytecode = 1; + break; + + case 'u': + utf8 = 1; + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( library, &major, &minor, &patch ); + + printf( "ftdump (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + case 'V': + verbose = 1; + break; + + default: + usage( library, execname ); + break; + } + } + + argc -= optind; + argv += optind; + + if ( argc != 1 ) + usage( library, execname ); + + file = 0; + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, argv[file], 1024 ); + strncpy( alt_filename, argv[file], 1024 ); + + /* try to load the file name as is, first */ + error = FT_New_Face( library, argv[file], 0, &face ); + if ( !error ) + goto Success; + +#ifndef macintosh + i = (int)strlen( argv[file] ); + while ( i > 0 && argv[file][i] != '\\' && argv[file][i] != '/' ) + { + if ( argv[file][i] == '.' ) + i = 0; + i--; + } + + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } +#endif + + /* Load face */ + error = FT_New_Face( library, filename, 0, &face ); + if ( error ) + PanicZ( library, "Could not open face." ); + + Success: + num_faces = face->num_faces; + FT_Done_Face( face ); + + printf( "There %s %d %s in this file.\n", + num_faces == 1 ? (char *)"is" : (char *)"are", + num_faces, + num_faces == 1 ? (char *)"face" : (char *)"faces" ); + + for ( i = 0; i < num_faces; i++ ) + { + error = FT_New_Face( library, filename, i, &face ); + if ( error ) + PanicZ( library, "Could not open face." ); + + printf( "\n----- Face number: %d -----\n\n", i ); + Print_Name( face ); + printf( "\n" ); + Print_Type( face ); + + printf( " glyph count: %ld\n", face->num_glyphs ); + + if ( name_tables && FT_IS_SFNT( face ) ) + { + printf( "\n" ); + Print_Sfnt_Names( face ); + } + + if ( bytecode && FT_IS_SFNT( face ) ) + { + printf( "\n" ); + Print_Programs( face ); + } + + if ( face->num_fixed_sizes ) + { + printf( "\n" ); + Print_Fixed( face ); + } + + if ( face->num_charmaps ) + { + printf( "\n" ); + Print_Charmaps( face ); + } + + if ( FT_HAS_MULTIPLE_MASTERS( face ) ) + { + printf( "\n" ); + Print_MM_Axes( face ); + } + + FT_Done_Face( face ); + } + + FT_Done_FreeType( library ); + + exit( 0 ); /* for safety reasons */ + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftgamma.1 freetype-2.8/=unpacked-tar2=/src/ftgamma.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftgamma.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftgamma.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,42 @@ +.TH FTGAMMA 1 "May 2017" "FreeType 2.8" +. +. +.SH NAME +. +ftgamma \- screen gamma calibration helper +. +. +.SH SYNOPSIS +. +.B ftgamma +. +. +.SH DESCRIPTION +. +The +.B ftgamma +demo program opens a window showing series of gray stripes filled with +solid color and checkered pattern of pixels. Your monitor's gamma value +roughly corresponds to the horizontal position where the solid and checkered +stripes are equally bright when seen from some distance. Three brightness +targets are explored: 33%, 50%, and 67%. If the input-output curve of your +monitor does not follow ideal power law relationship, you might observe +slightly different gamma values at different brightness levels. It is also +possible to examine gamma values for basic colors. +. +.PP +Two alternative patterns relevant to font rendering are also provided, +where slightly slanted lines are rendered using grayscale and subpixel +anti-aliasing. In the grayscale case, the correct gamma helps to achieve +uniform perceived thickness of the lines. The gamma value that corresponds +to vanishing moiré pattern is ideal for anti-aliased font rendering. +In the subpixel case, the correct gamma removes color fringes that remain +even after LCD filtering. +. +.PP +This program does not have any options. +. +.PP +This program is part of the FreeType demos package. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftgamma.c freetype-2.8/=unpacked-tar2=/src/ftgamma.c --- freetype-2.7.1/=unpacked-tar2=/src/ftgamma.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftgamma.c 2017-03-23 11:16:47.000000000 +0000 @@ -0,0 +1,429 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2004-2016 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* ftgamma - gamma matcher */ +/* */ +/****************************************************************************/ + + +#include "ftcommon.h" +#include + + + static FTDemo_Display* display; + + static grBitmap bit1 = { 300, 600, 600, gr_pixel_mode_gray, 256, NULL }; + static grBitmap bit2 = { 288, 600, 600, gr_pixel_mode_gray, 256, NULL }; + static int status = 0; + + + static void + do_ptrn( grBitmap* bitmap, + int x, + int y, + int w, + int h ) + { + int pitch = bitmap->pitch; + int i, j, k; + double p[4]; + + unsigned char* line; + + for ( i = 0; i < h; i++ ) + { + for ( k = 0; k < 4; k++) + { + j = 2 * i + 1 + ( k - 4 ) * h / 2; + if ( j > h ) + j -= 2 * h; + if ( j < -h ) + j += 2 * h; + if ( j < 0 ) + j = -j; + j -= h / 4; + if ( j < 0 ) + j = 0; + if ( j > h / 2 ) + j = h / 2; + + p[k] = 2. * j / h; + } + + line = bitmap->buffer + ( y + i ) * pitch + x; + for ( j = 0, k = 0; j < w; j++ ) + { + line[j] = (unsigned char)( 0.5 + + 255. * pow ( p[k], + 1. / (1. + 2. * j / w ) ) ); + k++; + if ( k == 4 ) + k = 0; + } + } + } + + + static FT_Error + GammaPtrn( grBitmap* bitmap ) + { + int x = 0; + int y = 0; + int h = ( bitmap->rows - 2 * y ) / 2; + int w = bitmap->width - 2 * x; + + + do_ptrn( bitmap, x, y, w, h ); + do_ptrn( bitmap, x, y+=h, w, h ); + + return 0; + } + + + static void + do_fill( grBitmap* bitmap, + int x, + int y, + int w, + int h, + int back, + int fore ) + { + int pitch = bitmap->pitch; + int i; + double b, f; + + unsigned char* line = bitmap->buffer + y*pitch + x; + + + if ( back == 0 || back == 255 ) + for ( i = 0; i < w; i++ ) + line[i + ( i & 1 ) * pitch] = (unsigned char)back; + else + for ( b = back / 255., i = 0; i < w; i++ ) + line[i + ( i & 1 ) * pitch] = + (unsigned char)( 0.5 + 255. * pow ( b, 1. / (1. + 2. * i / w ) ) ); + + if ( fore == 0 || fore == 255 ) + for ( i = 0; i < w; i++ ) + line[i + ( ~i & 1 ) * pitch] = (unsigned char)fore; + else + for ( f = fore / 255., i = 0; i < w; i++ ) + line[i + ( ~i & 1 ) * pitch] = + (unsigned char)( 0.5 + 255. * pow ( f, 1. / (1. + 2. * i / w ) ) ); + + for ( i = 2; i < h; i += 2 ) + { + memcpy( line + i * pitch, line, (size_t)w ); + memcpy( line + i * pitch + pitch, line + pitch, (size_t)w ); + } + } + + + static FT_Error + GammaGrid( grBitmap* bitmap ) + { + int x = 0; + int y = 0; + int h = ( bitmap->rows - 2 * y ) / 15; + int w = bitmap->width - 2 * x; + + + do_fill( bitmap, x, y, w, h, 85, 255 ); + do_fill( bitmap, x, y+=h, w, h, 170, 170 ); + do_fill( bitmap, x, y+=h, w, h, 85, 255 ); + do_fill( bitmap, x, y+=h, w, h, 170, 170 ); + do_fill( bitmap, x, y+=h, w, h, 85, 255 ); + + do_fill( bitmap, x, y+=h, w, h, 0, 255 ); + do_fill( bitmap, x, y+=h, w, h, 127, 127 ); + do_fill( bitmap, x, y+=h, w, h, 0, 255 ); + do_fill( bitmap, x, y+=h, w, h, 127, 127 ); + do_fill( bitmap, x, y+=h, w, h, 0, 255 ); + + do_fill( bitmap, x, y+=h, w, h, 0, 170 ); + do_fill( bitmap, x, y+=h, w, h, 85, 85 ); + do_fill( bitmap, x, y+=h, w, h, 0, 170 ); + do_fill( bitmap, x, y+=h, w, h, 85, 85 ); + do_fill( bitmap, x, y+=h, w, h, 0, 170 ); + + return 0; + } + + + static void + event_help( void ) + { + grEvent dummy_event; + + + FTDemo_Display_Clear( display ); + grSetLineHeight( 10 ); + grGotoxy( 0, 0 ); + grSetMargin( 2, 1 ); + grGotobitmap( display->bitmap ); + + + grWriteln( "FreeType Gamma Matcher" ); + grLn(); + grWriteln( "Use the following keys:" ); + grLn(); + grWriteln( "F1, ? display this help screen" ); + grLn(); + grWriteln( "space cycle through color"); + grWriteln( "tab alternate patterns"); + grWriteln( "G show gamma ramp" ); + grLn(); + grLn(); + grWriteln( "press any key to exit this help screen" ); + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, gr_event_key, &dummy_event ); + } + + + static void + event_color_change( void ) + { + static int i = 7; + unsigned char r = i & 4 ? 0xff : 0; + unsigned char g = i & 2 ? 0xff : 0; + unsigned char b = i & 1 ? 0xff : 0; + + + display->back_color = grFindColor( display->bitmap, 0, 0, 0, 0xff ); + display->fore_color = grFindColor( display->bitmap, r, g, b, 0xff ); + + i++; + if ( ( i & 0x7 ) == 0 ) + i = 1; + } + + + static void + event_gamma_grid( void ) + { + grEvent dummy_event; + int g; + int yside = 11; + int xside = 10; + int levels = 17; + int gammas = 30; + int x_0 = ( display->bitmap->width - levels * xside ) / 2; + int y_0 = ( display->bitmap->rows - gammas * ( yside + 1 ) ) / 2; + int pitch = display->bitmap->pitch; + + + FTDemo_Display_Clear( display ); + grGotobitmap( display->bitmap ); + + if ( pitch < 0 ) + pitch = -pitch; + + memset( display->bitmap->buffer, + 100, + (unsigned int)( pitch * display->bitmap->rows ) ); + + grWriteCellString( display->bitmap, 0, 0, "Gamma grid", + display->fore_color ); + + + for ( g = 1; g <= gammas; g++ ) + { + double ggamma = 0.1 * g; + char temp[6]; + int y = y_0 + ( yside + 1 ) * ( g - 1 ); + int nx, ny; + + unsigned char* line = display->bitmap->buffer + + y * display->bitmap->pitch; + + + if ( display->bitmap->pitch < 0 ) + line -= display->bitmap->pitch * ( display->bitmap->rows - 1 ); + + line += x_0 * 3; + + grSetPixelMargin( x_0 - 32, y + ( yside - 8 ) / 2 ); + grGotoxy( 0, 0 ); + + sprintf( temp, "%.1f", ggamma ); + grWrite( temp ); + + for ( ny = 0; ny < yside; ny++, line += display->bitmap->pitch ) + { + unsigned char* dst = line; + + + for ( nx = 0; nx < levels; nx++, dst += 3 * xside ) + { + double p = nx / (double)( levels - 1 ); + int gm = (int)( 255.0 * pow( p, ggamma ) + 0.5 ); + + + memset( dst, gm, (unsigned int)( xside * 3 ) ); + } + } + } + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, gr_event_key, &dummy_event ); + } + + + static void + Render_Bitmap( grBitmap* out, + grBitmap* in, + int x, + int y, + grColor color, + int lcd ) + { + int pitch = out->pitch; + int i, ii, j; + + unsigned char* src; + unsigned char* dst; + + + if ( color.chroma[0] == 255 ) + for ( src = in->buffer, i = 0; i < in->rows; i++ ) + { + ii = ( i + 24 * lcd ) % in->rows; + dst = out->buffer + ( y + ii ) * pitch + 3 * x; + for ( j = 0; j < in->width; j++, src++, dst += 3 ) + *dst = *src; + } + + if ( color.chroma[1] == 255 ) + for ( src = in->buffer, i = 0; i < in->rows; i++ ) + { + ii = ( i + 12 * lcd ) % in->rows; + dst = out->buffer + ( y + ii ) * pitch + 3 * x + 1; + for ( j = 0; j < in->width; j++, src++, dst += 3 ) + *dst = *src; + } + + if ( color.chroma[2] == 255 ) + for ( src = in->buffer, i = 0; i < in->rows; i++ ) + { + ii = ( i + 0 * lcd ) % in->rows; + dst = out->buffer + ( y + ii ) * pitch + 3 * x + 2; + for ( j = 0; j < in->width; j++, src++, dst += 3 ) + *dst = *src; + } + } + + + static int + Process_Event( grEvent* event ) + { + int ret = 0; + + switch ( event->key ) + { + case grKeyEsc: + case grKEY( 'q' ): + ret = 1; + break; + + case grKeyF1: + case grKEY( '?' ): + event_help(); + break; + + case grKeySpace: + event_color_change(); + break; + + case grKeyTab: + status++; + if ( status > 2 ) + status = 0; + break; + + case grKEY( 'G' ): + event_gamma_grid(); + break; + + default: + break; + } + + return ret; + } + + + int + main( void ) + { + grEvent event; + char buf[4]; + int i; + + display = FTDemo_Display_New( gr_pixel_mode_rgb24, DIM_X, DIM_Y ); + if ( !display ) + { + PanicZ( "could not allocate display surface" ); + } + + grSetTitle( display->surface, "FreeType Gamma Matcher - press ? for help" ); + + grNewBitmap( bit1.mode, bit1.grays, bit1.width, bit1.rows, &bit1 ); + GammaGrid( &bit1 ); + + grNewBitmap( bit2.mode, bit2.grays, bit2.width, bit2.rows, &bit2 ); + GammaPtrn( &bit2 ); + + event_color_change(); + + do + { + FTDemo_Display_Clear( display ); + + switch ( status ) + { + case 0: + grWriteCellString( display->bitmap, 236, 75, "Solid-Checkered Pattern", + display->fore_color ); + Render_Bitmap( display->bitmap, &bit1, 20, 90, display->fore_color, 0 ); + break; + case 1: + grWriteCellString( display->bitmap, 236, 75, "Grayscale Anti-Aliasing", + display->fore_color ); + Render_Bitmap( display->bitmap, &bit2, 20, 96, display->fore_color, 0 ); + break; + case 2: + grWriteCellString( display->bitmap, 236, 75, "Subpixel Anti-Aliasing", + display->fore_color ); + Render_Bitmap( display->bitmap, &bit2, 20, 96, display->fore_color, 1 ); + break; + } + + for ( i = 0; i <= 10; i++ ) + { + sprintf( buf, "%.1f", 1. + .2 * i ); + grWriteCellString( display->bitmap, 9 + i * 60, 395, buf, + display->fore_color ); + } + + grWriteCellString( display->bitmap, DIM_X / 2 - 20, 410, "Gamma", + display->fore_color ); + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, 0, &event ); + } while ( Process_Event( &event ) == 0 ); + + FTDemo_Display_Done( display ); + + exit( 0 ); /* for safety reasons */ + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftgrid.1 freetype-2.8/=unpacked-tar2=/src/ftgrid.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftgrid.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftgrid.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,77 @@ +.TH FTGRID 1 "May 2017" "Freetype 2.8" +. +. +.SH NAME +. +ftgrid \- simple glyph grid viewer +. +. +.SH SYNOPSIS +. +.B ftgrid +.RI [ options ] +.I pt font .\|.\|. +. +. +.SH DESCRIPTION +. +.B ftgrid +displays the glyphs of a font as outlines right before the conversion +from outlines to pixels take place. +It also displays the resulting bitmap. +It is possible to interactively change hinting and rendering options, +thus visualizing the applied distortions to the outlines. +. +.TP +.B pt +The point size for the given resolution. +If resolution is 72dpi, this directly gives the ppem value (pixels per EM). +. +.TP +.B font +The font file(s) to display. +For Type 1 font files, +.B ftgrid +also tries to attach the corresponding metrics file (with extension `.afm' +or `.pfm'). +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI \-w \ w +Set the window width to +.I w +pixels (default: 640px). +. +.TP +.BI \-h \ h +Set the window height to +.I h +pixels (default: 480px). +. +.TP +.BI \-r \ r +Use resolution +.I r +dpi (default: 72dpi). +. +.TP +.BI \-f \ index +Specify first index to display (default: 0). +. +.TP +.BI "\-d\ \(dq" "axis1\ axis2\ .\|.\|." \(dq +For Multiple Master or GX fonts, specify design coordinates for each axis at +start-up. +If this option is given, no named instances are shown. +Ignored for all other font formats. +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftgrid.c freetype-2.8/=unpacked-tar2=/src/ftgrid.c --- freetype-2.7.1/=unpacked-tar2=/src/ftgrid.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftgrid.c 2017-05-02 05:52:48.000000000 +0000 @@ -0,0 +1,2055 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2000, 2003-2007, 2009-2014 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* FTGrid - a simple viewer to show glyph outlines on a grid */ +/* */ +/* Press ? when running this program to have a list of key-bindings */ +/* */ +/****************************************************************************/ + + +#include "ftcommon.h" +#include "common.h" +#include "output.h" +#include "mlgetopt.h" +#include + + /* the following header shouldn't be used in normal programs */ +#include FT_INTERNAL_DEBUG_H + + /* showing driver name */ +#include FT_MODULE_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DRIVER_H + +#include FT_STROKER_H +#include FT_SYNTHESIS_H +#include FT_LCD_FILTER_H +#include FT_CFF_DRIVER_H +#include FT_TRUETYPE_DRIVER_H +#include FT_MULTIPLE_MASTERS_H +#include FT_SFNT_NAMES_H +#include FT_TRUETYPE_IDS_H +#include FT_TRIGONOMETRY_H + +#define MAXPTSIZE 500 /* dtp */ +#define MAX_MM_AXES 32 + +#ifdef _WIN32 +#define snprintf _snprintf +#endif + +#define N_CFF_HINTING_ENGINES 2 + + +#ifdef FT_DEBUG_AUTOFIT + /* these variables, structures, and declarations are for */ + /* communication with the debugger in the autofit module; */ + /* normal programs don't need this */ + struct AF_GlyphHintsRec_; + typedef struct AF_GlyphHintsRec_* AF_GlyphHints; + + extern int _af_debug_disable_horz_hints; + extern int _af_debug_disable_vert_hints; + extern int _af_debug_disable_blue_hints; + extern AF_GlyphHints _af_debug_hints; + +#ifdef __cplusplus + extern "C" { +#endif + extern void + af_glyph_hints_dump_segments( AF_GlyphHints hints, + FT_Bool to_stdout ); + extern void + af_glyph_hints_dump_points( AF_GlyphHints hints, + FT_Bool to_stdout ); + extern void + af_glyph_hints_dump_edges( AF_GlyphHints hints, + FT_Bool to_stdout ); + extern FT_Error + af_glyph_hints_get_num_segments( AF_GlyphHints hints, + FT_Int dimension, + FT_Int* num_segments ); + extern FT_Error + af_glyph_hints_get_segment_offset( AF_GlyphHints hints, + FT_Int dimension, + FT_Int idx, + FT_Pos *offset, + FT_Bool *is_blue, + FT_Pos *blue_offset ); +#ifdef __cplusplus + } +#endif + +#endif /* FT_DEBUG_AUTOFIT */ + + +#define BUFSIZE 256 + +#define DO_BITMAP 1 +#define DO_OUTLINE 2 +#define DO_DOTS 4 +#define DO_DOTNUMBERS 8 + + typedef struct GridStatusRec_ + { + int width; + int height; + + int ptsize; + int res; + int Num; /* glyph index */ + int font_index; + + FT_F26Dot6 scale; + int x_origin; + int y_origin; + + FT_F26Dot6 scale_0; + int x_origin_0; + int y_origin_0; + + int disp_width; + int disp_height; + grBitmap* disp_bitmap; + + grColor axis_color; + grColor grid_color; + grColor outline_color; + grColor on_color; + grColor off_color; + grColor segment_color; + grColor blue_color; + + int work; + int do_horz_hints; + int do_vert_hints; + int do_blue_hints; + int do_segment; + + FT_LcdFilter lcd_filter; + double gamma; + const char* header; + char header_buffer[BUFSIZE]; + + FT_Stroker stroker; + + unsigned int cff_hinting_engine; + unsigned int tt_interpreter_versions[3]; + int num_tt_interpreter_versions; + int tt_interpreter_version_idx; + FT_Bool warping; + + FT_MM_Var* mm; + char* axis_name[MAX_MM_AXES]; + FT_Fixed design_pos[MAX_MM_AXES]; + FT_Fixed requested_pos[MAX_MM_AXES]; + FT_UInt requested_cnt; + FT_UInt current_axis; + FT_UInt used_num_axis; + + } GridStatusRec, *GridStatus; + + static GridStatusRec status; + + + static void + grid_status_init( GridStatus st ) + { + st->width = DIM_X; + st->height = DIM_Y; + + st->scale = 64; + st->x_origin = 0; + st->y_origin = 0; + + st->work = DO_BITMAP | DO_OUTLINE | DO_DOTS; + st->do_horz_hints = 1; + st->do_vert_hints = 1; + st->do_blue_hints = 1; + st->do_segment = 0; + + st->Num = 0; + st->lcd_filter = FT_LCD_FILTER_DEFAULT; + st->gamma = GAMMA; + st->header = NULL; + + st->mm = NULL; + st->current_axis = 0; + } + + + static void + grid_status_display( GridStatus st, + FTDemo_Display* display ) + { + st->disp_width = display->bitmap->width; + st->disp_height = display->bitmap->rows; + st->disp_bitmap = display->bitmap; + + st->axis_color = grFindColor( display->bitmap, 0, 0, 0, 255 ); /* black */ + st->grid_color = grFindColor( display->bitmap, 192, 192, 192, 255 ); /* gray */ + st->outline_color = grFindColor( display->bitmap, 255, 0, 0, 255 ); /* red */ + st->on_color = grFindColor( display->bitmap, 255, 0, 0, 255 ); /* red */ + st->off_color = grFindColor( display->bitmap, 0, 128, 0, 255 ); /* dark green */ + st->segment_color = grFindColor( display->bitmap, 64, 255, 128, 64 ); /* light green */ + st->blue_color = grFindColor( display->bitmap, 64, 64, 255, 64 ); /* light blue */ + } + + + static void + grid_status_rescale_initial( GridStatus st, + FTDemo_Handle* handle ) + { + FT_Size size; + FT_Error err = FTDemo_Get_Size( handle, &size ); + FT_F26Dot6 margin = 4; + + + if ( !err ) + { + FT_Face face = size->face; + + int xmin = FT_MulFix( face->bbox.xMin, size->metrics.x_scale ); + int ymin = FT_MulFix( face->bbox.yMin, size->metrics.y_scale ); + int xmax = FT_MulFix( face->bbox.xMax, size->metrics.x_scale ); + int ymax = FT_MulFix( face->bbox.yMax, size->metrics.y_scale ); + + FT_F26Dot6 x_scale, y_scale; + + + xmin &= ~63; + ymin &= ~63; + xmax = ( xmax + 63 ) & ~63; + ymax = ( ymax + 63 ) & ~63; + + if ( xmax - xmin ) + x_scale = st->disp_width * ( 64 - 2 * margin ) / ( xmax - xmin ); + else + x_scale = 64; + + if ( ymax - ymin ) + y_scale = st->disp_height * ( 64 - 2 * margin ) / ( ymax - ymin ); + else + y_scale = 64; + + if ( x_scale <= y_scale ) + st->scale = x_scale; + else + st->scale = y_scale; + + st->x_origin = st->disp_width * margin - xmin * st->scale; + st->y_origin = st->disp_height * ( 64 - margin ) + ymin * st->scale; + } + else + { + st->scale = 64; + st->x_origin = st->disp_width * margin; + st->y_origin = st->disp_height * ( 64 - margin ); + } + + st->x_origin >>= 6; + st->y_origin >>= 6; + + st->scale_0 = st->scale; + st->x_origin_0 = st->x_origin; + st->y_origin_0 = st->y_origin; + } + + + static void + grid_status_draw_grid( GridStatus st ) + { + int x_org = st->x_origin; + int y_org = st->y_origin; + FT_F26Dot6 xy_incr = st->scale; + + + if ( xy_incr >= 2 ) + { + int x2 = x_org; + int y2 = y_org; + + + for ( ; x2 < st->disp_width; x2 += xy_incr ) + grFillVLine( st->disp_bitmap, x2, 0, + st->disp_height, st->grid_color ); + + for ( x2 = x_org - xy_incr; x2 >= 0; x2 -= xy_incr ) + grFillVLine( st->disp_bitmap, x2, 0, + st->disp_height, st->grid_color ); + + for ( ; y2 < st->disp_height; y2 += xy_incr ) + grFillHLine( st->disp_bitmap, 0, y2, + st->disp_width, st->grid_color ); + + for ( y2 = y_org - xy_incr; y2 >= 0; y2 -= xy_incr ) + grFillHLine( st->disp_bitmap, 0, y2, + st->disp_width, st->grid_color ); + } + + grFillVLine( st->disp_bitmap, x_org, 0, + st->disp_height, st->axis_color ); + grFillHLine( st->disp_bitmap, 0, y_org, + st->disp_width, st->axis_color ); + } + + +#ifdef FT_DEBUG_AUTOFIT + + static void + grid_hint_draw_segment( GridStatus st, + AF_GlyphHints hints ) + { + FT_Int dimension; + int x_org = st->x_origin; + int y_org = st->y_origin; + + + for ( dimension = 1; dimension >= 0; dimension-- ) + { + FT_Int num_seg; + FT_Int count; + + + af_glyph_hints_get_num_segments( hints, dimension, &num_seg ); + + for ( count = 0; count < num_seg; count++ ) + { + int pos; + FT_Pos offset; + FT_Bool is_blue; + FT_Pos blue_offset; + + + af_glyph_hints_get_segment_offset( hints, dimension, + count, &offset, + &is_blue, &blue_offset); + + if ( dimension == 0 ) /* AF_DIMENSION_HORZ is 0 */ + { + pos = x_org + ( ( offset * st->scale ) >> 6 ); + grFillVLine( st->disp_bitmap, pos, 0, + st->disp_height, st->segment_color ); + } + else + { + pos = y_org - ( ( offset * st->scale ) >> 6 ); + + if ( is_blue ) + { + int blue_pos = y_org - ( ( blue_offset * st->scale ) >> 6 ); + + + if ( blue_pos == pos ) + grFillHLine( st->disp_bitmap, 0, blue_pos, + st->disp_width, st->blue_color ); + else + { + grFillHLine( st->disp_bitmap, 0, blue_pos, + st->disp_width, st->blue_color ); + grFillHLine( st->disp_bitmap, 0, pos, + st->disp_width, st->segment_color ); + } + } + else + grFillHLine( st->disp_bitmap, 0, pos, + st->disp_width, st->segment_color ); + } + } + } + } + +#endif /* FT_DEBUG_AUTOFIT */ + + + static void + ft_bitmap_draw( FT_Bitmap* bitmap, + int x, + int y, + FTDemo_Display* display, + grColor color ) + { + grBitmap gbit; + + + gbit.width = (int)bitmap->width; + gbit.rows = (int)bitmap->rows; + gbit.pitch = bitmap->pitch; + gbit.buffer = bitmap->buffer; + + switch ( bitmap->pixel_mode ) + { + case FT_PIXEL_MODE_GRAY: + gbit.mode = gr_pixel_mode_gray; + gbit.grays = 256; + break; + + case FT_PIXEL_MODE_MONO: + gbit.mode = gr_pixel_mode_mono; + gbit.grays = 2; + break; + + case FT_PIXEL_MODE_LCD: + gbit.mode = gr_pixel_mode_lcd; + gbit.grays = 256; + break; + + case FT_PIXEL_MODE_LCD_V: + gbit.mode = gr_pixel_mode_lcdv; + gbit.grays = 256; + break; + + default: + return; + } + + grBlitGlyphToBitmap( display->bitmap, &gbit, x, y, color ); + } + + + static void + ft_outline_draw( FT_Outline* outline, + double scale, + int pen_x, + int pen_y, + FTDemo_Handle* handle, + FTDemo_Display* display, + grColor color ) + { + FT_Outline transformed; + FT_BBox cbox; + FT_Bitmap bitm; + + + FT_Outline_New( handle->library, + (FT_UInt)outline->n_points, + outline->n_contours, + &transformed ); + + FT_Outline_Copy( outline, &transformed ); + + if ( scale != 1. ) + { + int nn; + + + for ( nn = 0; nn < transformed.n_points; nn++ ) + { + FT_Vector* vec = &transformed.points[nn]; + + + vec->x = (FT_F26Dot6)( vec->x * scale ); + vec->y = (FT_F26Dot6)( vec->y * scale ); + } + } + + FT_Outline_Get_CBox( &transformed, &cbox ); + cbox.xMin &= ~63; + cbox.yMin &= ~63; + cbox.xMax = ( cbox.xMax + 63 ) & ~63; + cbox.yMax = ( cbox.yMax + 63 ) & ~63; + + bitm.width = (unsigned int)( ( cbox.xMax - cbox.xMin ) >> 6 ); + bitm.rows = (unsigned int)( ( cbox.yMax - cbox.yMin ) >> 6 ); + bitm.pitch = (int)bitm.width; + bitm.num_grays = 256; + bitm.pixel_mode = FT_PIXEL_MODE_GRAY; + bitm.buffer = (unsigned char*)calloc( (unsigned int)bitm.pitch, + bitm.rows ); + + FT_Outline_Translate( &transformed, -cbox.xMin, -cbox.yMin ); + FT_Outline_Get_Bitmap( handle->library, &transformed, &bitm ); + + ft_bitmap_draw( &bitm, + pen_x + ( cbox.xMin >> 6 ), + pen_y - ( cbox.yMax >> 6 ), + display, + color ); + + free( bitm.buffer ); + FT_Outline_Done( handle->library, &transformed ); + } + + + static void + ft_outline_new_circle( FT_Outline* outline, + FT_F26Dot6 radius, + FTDemo_Handle* handle ) + { + char* tag; + FT_Vector* vec; + FT_F26Dot6 disp = (FT_F26Dot6)( radius * 0.5523 ); + /* so that Bézier curve touches circle at 0, 45, and 90 degrees */ + + + FT_Outline_New( handle->library, 12, 1, outline ); + outline->n_points = 12; + outline->n_contours = 1; + outline->contours[0] = outline->n_points - 1; + + vec = outline->points; + tag = outline->tags; + + vec->x = radius; vec->y = 0; vec++; *tag++ = FT_CURVE_TAG_ON; + vec->x = radius; vec->y = disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = disp; vec->y = radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = 0; vec->y = radius; vec++; *tag++ = FT_CURVE_TAG_ON; + vec->x = -disp; vec->y = radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = -radius; vec->y = disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = -radius; vec->y = 0; vec++; *tag++ = FT_CURVE_TAG_ON; + vec->x = -radius; vec->y = -disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = -disp; vec->y = -radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = 0; vec->y = -radius; vec++; *tag++ = FT_CURVE_TAG_ON; + vec->x = disp; vec->y = -radius; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + vec->x = radius; vec->y = -disp; vec++; *tag++ = FT_CURVE_TAG_CUBIC; + } + + + static void + circle_draw( FT_F26Dot6 center_x, + FT_F26Dot6 center_y, + FT_F26Dot6 radius, + FTDemo_Handle* handle, + FTDemo_Display* display, + grColor color ) + { + FT_Outline outline; + + + ft_outline_new_circle( &outline, radius, handle ); + /* subpixel adjustment considering downward direction of y-axis */ + FT_Outline_Translate( &outline, center_x & 63, -( center_y & 63 ) ); + + ft_outline_draw( &outline, 1., ( center_x >> 6 ), ( center_y >> 6 ), + handle, display, color ); + + FT_Outline_Done( handle->library, &outline ); + } + + + static void + bitmap_scale( grBitmap* bit, + FT_F26Dot6 scale ) + { + unsigned char* s = bit->buffer; + unsigned char* t; + unsigned char* line; + int pitch; + int width; + int i, j, k; + + pitch = bit->pitch > 0 ? bit->pitch + : -bit->pitch; + width = bit->width; + + t = (unsigned char*)malloc( (size_t)( pitch * bit->rows * + scale * scale ) ); + if ( !t ) + return; + + line = t; + + switch( bit->mode ) + { + case gr_pixel_mode_mono: + for ( i = 0; i < bit->rows; i++ ) + { + for ( j = 0; j < pitch * scale * 8; j++ ) + if ( s[i * pitch + j / scale / 8] & ( 0x80 >> ( j / scale & 7 ) ) ) + line[j / 8] |= 0x80 >> ( j & 7 ); + else + line[j / 8] &= ~( 0x80 >> ( j & 7 ) ); + + for ( k = 1; k < scale; k++, line += pitch * scale ) + memcpy( line + pitch * scale, line, (size_t)( pitch * scale ) ); + line += pitch * scale; + } + break; + + case gr_pixel_mode_gray: + for ( i = 0; i < bit->rows; i++ ) + { + for ( j = 0; j < pitch; j++ ) + memset( line + j * scale, s[i * pitch + j], (size_t)scale ); + + for ( k = 1; k < scale; k++, line += pitch * scale ) + memcpy( line + pitch * scale, line, (size_t)( pitch * scale ) ); + line += pitch * scale; + } + break; + + case gr_pixel_mode_lcd: + case gr_pixel_mode_lcd2: + for ( i = 0; i < bit->rows; i++ ) + { + for ( j = 0; j < width; j += 3 ) + for ( k = 0; k < scale; k++ ) + { + line[j * scale + 3 * k ] = s[i * pitch + j ]; + line[j * scale + 3 * k + 1] = s[i * pitch + j + 1]; + line[j * scale + 3 * k + 2] = s[i * pitch + j + 2]; + } + + for ( k = 1; k < scale; k++, line += pitch * scale ) + memcpy( line + pitch * scale, line, (size_t)( pitch * scale ) ); + line += pitch * scale; + } + break; + + case gr_pixel_mode_lcdv: + case gr_pixel_mode_lcdv2: + for ( i = 0; i < bit->rows; i += 3 ) + { + for ( j = 0; j < pitch; j++ ) + { + memset( line + j * scale, + s[i * pitch + j], (size_t)scale ); + memset( line + j * scale + pitch * scale, + s[i * pitch + pitch + j], (size_t)scale ); + memset( line + j * scale + 2 * pitch * scale, + s[i * pitch + 2 * pitch + j], (size_t)scale ); + } + + for ( k = 1; k < scale; k++, line += 3 * pitch * scale ) + memcpy( line + 3 * pitch * scale, + line, + (size_t)( 3 * pitch * scale ) ); + line += 3 * pitch * scale; + } + break; + + default: + return; + } + + bit->buffer = t; + bit->rows *= scale; + bit->width *= scale; + bit->pitch *= scale; + } + + + static void + grid_status_draw_outline( GridStatus st, + FTDemo_Handle* handle, + FTDemo_Display* display ) + { + FT_Size size; + FT_GlyphSlot slot; + FT_F26Dot6 scale = st->scale; + int ox = st->x_origin; + int oy = st->y_origin; + + + if ( st->stroker == NULL ) + { + FT_Stroker_New( handle->library, &st->stroker ); + + FT_Stroker_Set( st->stroker, 32, FT_STROKER_LINECAP_BUTT, + FT_STROKER_LINEJOIN_BEVEL, 0x20000 ); + } + + FTDemo_Get_Size( handle, &size ); + +#ifdef FT_DEBUG_AUTOFIT + /* Draw segment before drawing glyph. */ + if ( status.do_segment ) + { + /* Force hinting first in order to collect segment info. */ + _af_debug_disable_horz_hints = 0; + _af_debug_disable_vert_hints = 0; + + if ( !FT_Load_Glyph( size->face, (FT_UInt)st->Num, + FT_LOAD_DEFAULT | + FT_LOAD_NO_BITMAP | + FT_LOAD_FORCE_AUTOHINT | + FT_LOAD_TARGET_NORMAL ) ) + grid_hint_draw_segment( &status, _af_debug_hints ); + } + + _af_debug_disable_horz_hints = !st->do_horz_hints; + _af_debug_disable_vert_hints = !st->do_vert_hints; + _af_debug_disable_blue_hints = !st->do_blue_hints; +#endif + + if ( FT_Load_Glyph( size->face, (FT_UInt)st->Num, + handle->load_flags | FT_LOAD_NO_BITMAP ) ) + return; + + /* show advance width */ + grFillVLine( st->disp_bitmap, + st->x_origin + + ( ( size->face->glyph->metrics.horiAdvance + + size->face->glyph->lsb_delta - + size->face->glyph->rsb_delta ) * + st->scale >> 6 ), + 0, + st->disp_height, + st->axis_color ); + + + slot = size->face->glyph; + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + FT_Glyph glyph; + FT_Outline* gimage = &slot->outline; + int nn; + + + /* render scaled bitmap */ + if ( st->work & DO_BITMAP ) + { + int left, top, x_advance, y_advance; + grBitmap bitg; + FT_Glyph glyf; + + + FT_Get_Glyph( slot, &glyph ); + error = FTDemo_Glyph_To_Bitmap( handle, glyph, &bitg, &left, &top, + &x_advance, &y_advance, &glyf); + + if ( !error ) + { + bitmap_scale( &bitg, scale ); + + grBlitGlyphToBitmap( display->bitmap, &bitg, + ox + left * scale, oy - top * scale, + st->axis_color ); + + free( bitg.buffer ); + + if ( glyf ) + FT_Done_Glyph( glyf ); + } + + FT_Done_Glyph( glyph ); + } + + /* scale the outline */ + for ( nn = 0; nn < gimage->n_points; nn++ ) + { + FT_Vector* vec = &gimage->points[nn]; + + + /* half-pixel shift hints the stroked path */ + vec->x = vec->x * scale + 32; + vec->y = vec->y * scale - 32; + } + + /* stroke then draw it */ + if ( st->work & DO_OUTLINE ) + { + FT_Get_Glyph( slot, &glyph ); + FT_Glyph_Stroke( &glyph, st->stroker, 1 ); + + error = FTDemo_Draw_Glyph_Color( handle, display, glyph, &ox, &oy, + st->outline_color ); + if ( !error ) + FT_Done_Glyph( glyph ); + } + + /* draw the points... */ + if ( st->work & DO_DOTS ) + { + for ( nn = 0; nn < gimage->n_points; nn++ ) + circle_draw( + st->x_origin * 64 + gimage->points[nn].x, + st->y_origin * 64 - gimage->points[nn].y, + 128, + handle, + display, + ( gimage->tags[nn] & FT_CURVE_TAG_ON ) ? st->on_color + : st->off_color ); + } + + /* ... and point numbers */ + if ( st->work & DO_DOTNUMBERS ) + { + FT_Vector* points = gimage->points; + FT_Short* contours = gimage->contours; + char* tags = gimage->tags; + short c, n; + char number_string[10]; + size_t number_string_len = sizeof ( number_string ); + + FT_Long octant_x[8] = { 1024, 724, 0, -724, -1024, -724, 0, 724 }; + FT_Long octant_y[8] = { 0, 724, 1024, 724, 0, -724, -1024, -724 }; + + + c = 0; + n = 0; + for ( ; c < gimage->n_contours; c++ ) + { + for (;;) + { + short prev, next; + FT_Vector in, out, middle; + FT_Fixed in_len, out_len, middle_len; + int num_digits; + + + /* find previous and next point in outline */ + if ( c == 0 ) + { + if ( contours[c] == 0 ) + { + prev = 0; + next = 0; + } + else + { + prev = n > 0 ? n - 1 + : contours[c]; + next = n < contours[c] ? n + 1 + : 0; + } + } + else + { + prev = n > ( contours[c - 1] + 1 ) ? n - 1 + : contours[c]; + next = n < contours[c] ? n + 1 + : contours[c - 1] + 1; + } + + /* get vectors to previous and next point and normalize them; */ + /* we use 16.16 format to improve the computation precision */ + in.x = ( points[prev].x - points[n].x ) * 1024; + in.y = ( points[prev].y - points[n].y ) * 1024; + + out.x = ( points[next].x - points[n].x ) * 1024; + out.y = ( points[next].y - points[n].y ) * 1024; + + in_len = FT_Vector_Length( &in ); + out_len = FT_Vector_Length( &out ); + + if ( in_len ) + { + in.x = FT_DivFix( in.x, in_len ); + in.y = FT_DivFix( in.y, in_len ); + } + if ( out_len ) + { + out.x = FT_DivFix( out.x, out_len ); + out.y = FT_DivFix( out.y, out_len ); + } + + middle.x = in.x + out.x; + middle.y = in.y + out.y; + /* we use a delta of 1 << 13 (corresponding to 1/8px) */ + if ( ( middle.x < 4096 ) && ( middle.x > -4096 ) && + ( middle.y < 4096 ) && ( middle.y > -4096 ) ) + { + /* in case of vectors in almost exactly opposite directions, */ + /* use a vector orthogonal to them */ + middle.x = out.y; + middle.y = -out.x; + + if ( ( middle.x < 4096 ) && ( middle.x > -4096 ) && + ( middle.y < 4096 ) && ( middle.y > -4096 ) ) + { + /* use direction based on point index for the offset */ + /* if we still don't have a good value */ + middle.x = octant_x[n % 8]; + middle.y = octant_y[n % 8]; + } + } + + /* normalize `middle' vector (which is never zero) and */ + /* convert it back to 26.6 format, this time using a */ + /* length of 8 pixels to get some distance between the */ + /* point and the number */ + middle_len = FT_Vector_Length( &middle ); + middle.x = FT_DivFix( middle.x, middle_len ) >> 7; + middle.y = FT_DivFix( middle.y, middle_len ) >> 7; + + num_digits = snprintf( number_string, + number_string_len, + "%d", n ); + + /* we now position the point number in the opposite */ + /* direction of the `middle' vector, adding some offset */ + /* since the string drawing function expects the upper */ + /* left corner of the number string (the font size is 8x8 */ + /* pixels) */ + grWriteCellString( display->bitmap, + st->x_origin + + ( ( points[n].x - middle.x ) >> 6 ) - + ( middle.x > 0 ? ( num_digits - 1 ) * 8 + 2 + : 2 ), + st->y_origin - + ( ( ( points[n].y - middle.y ) >> 6 ) + + 8 / 2 ), + number_string, + ( tags[n] & FT_CURVE_TAG_ON ) + ? st->on_color + : st->off_color ); + + n++; + if ( n > contours[c] ) + break; + } + } + } + } + } + + + static FTDemo_Display* display; + static FTDemo_Handle* handle; + +#if 0 + static const unsigned char* Text = (unsigned char*) + "The quick brown fox jumps over the lazy dog 0123456789 " + "\342\352\356\373\364\344\353\357\366\374\377\340\371\351\350\347 " + "&#~\"\'(-`_^@)=+\260 ABCDEFGHIJKLMNOPQRSTUVWXYZ " + "$\243^\250*\265\371%!\247:/;.,?<>"; +#endif + + + static void + Fatal( const char* message ) + { + FTDemo_Display_Done( display ); + FTDemo_Done( handle ); + PanicZ( message ); + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** REST OF THE APPLICATION/PROGRAM *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + event_help( void ) + { + char buf[BUFSIZE]; + char version[64]; + + const char* format; + FT_Int major, minor, patch; + + grEvent dummy_event; + + + FT_Library_Version( handle->library, &major, &minor, &patch ); + + format = patch ? "%d.%d.%d" : "%d.%d"; + sprintf( version, format, major, minor, patch ); + + FTDemo_Display_Clear( display ); + grSetLineHeight( 10 ); + grGotoxy( 0, 0 ); + grSetMargin( 2, 1 ); + grGotobitmap( display->bitmap ); + + sprintf( buf, + "FreeType Glyph Grid Viewer - part of the FreeType %s test suite", + version ); + + grWriteln( buf ); + grLn(); + grWriteln( "Use the following keys:" ); + grLn(); + /* |----------------------------------| |----------------------------------| */ +#ifdef FT_DEBUG_AUTOFIT + grWriteln( "F1, ? display this help screen if autohinting: " ); + grWriteln( " H toggle horiz. hinting " ); + grWriteln( "i, k move grid up/down V toggle vert. hinting " ); + grWriteln( "j, l move grid left/right B toggle blue zone hinting" ); + grWriteln( "PgUp, PgDn zoom in/out grid s toggle segment drawing " ); + grWriteln( "SPC reset zoom and position (unfitted, with blues) " ); + grWriteln( " 1 dump edge hints " ); + grWriteln( "p, n previous/next font 2 dump segment hints " ); + grWriteln( " 3 dump point hints " ); +#else + grWriteln( "F1, ? display this help screen i, k move grid up/down " ); + grWriteln( " j, l move grid left/right " ); + grWriteln( "p, n previous/next font PgUp, PgDn zoom in/out grid " ); + grWriteln( " SPC reset zoom and position " ); +#endif /* FT_DEBUG_AUTOFIT */ + grWriteln( "Up, Down adjust size by 0.5pt if not auto-hinting: " ); + grWriteln( " H cycle through hinting " ); + grWriteln( "Left, Right adjust index by 1 engines (if available) " ); + grWriteln( "F7, F8 adjust index by 10 if light auto-hinting: " ); + grWriteln( "F9, F10 adjust index by 100 w toggle warping " ); + grWriteln( "F11, F12 adjust index by 1000 (if available) " ); + grWriteln( " " ); + grWriteln( "h toggle hinting b toggle bitmap " ); + grWriteln( "f toggle forced auto- d toggle dot display " ); + grWriteln( " hinting (if hinting) o toggle outline display " ); + grWriteln( " D toggle dotnumber display" ); + grWriteln( " " ); + grWriteln( "F5, F6 cycle through if Multiple Master or GX font: " ); + grWriteln( " anti-aliasing modes F2 cycle through axes " ); + grWriteln( "L cycle through LCD F3, F4 adjust current axis by " ); + grWriteln( " filters 1/50th of its range " ); + grWriteln( "g, v adjust gamma value " ); + grWriteln( " q, ESC quit ftgrid " ); + /* |----------------------------------| |----------------------------------| */ + grLn(); + grLn(); + grWriteln( "press any key to exit this help screen" ); + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, gr_event_key, &dummy_event ); + } + + + static void + event_cff_hinting_engine_change( int delta ) + { + int new_cff_hinting_engine = 0; + + + if ( delta ) + new_cff_hinting_engine = + ( (int)status.cff_hinting_engine + + delta + + N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; + + error = FT_Property_Set( handle->library, + "cff", + "hinting-engine", + &new_cff_hinting_engine ); + + if ( !error ) + { + /* Resetting the cache is perhaps a bit harsh, but I'm too */ + /* lazy to walk over all loaded fonts to check whether they */ + /* are of type CFF, then unloading them explicitly. */ + FTC_Manager_Reset( handle->cache_manager ); + status.cff_hinting_engine = (FT_UInt)new_cff_hinting_engine; + } + + sprintf( status.header_buffer, "CFF engine changed to %s", + status.cff_hinting_engine == FT_CFF_HINTING_FREETYPE + ? "FreeType" : "Adobe" ); + + status.header = (const char *)status.header_buffer; + } + + + static void + event_tt_interpreter_version_change( void ) + { + status.tt_interpreter_version_idx += 1; + status.tt_interpreter_version_idx %= status.num_tt_interpreter_versions; + + error = FT_Property_Set( handle->library, + "truetype", + "interpreter-version", + &status.tt_interpreter_versions[ + status.tt_interpreter_version_idx] ); + + if ( !error ) + { + /* Resetting the cache is perhaps a bit harsh, but I'm too */ + /* lazy to walk over all loaded fonts to check whether they */ + /* are of type TTF, then unloading them explicitly. */ + FTC_Manager_Reset( handle->cache_manager ); + } + + sprintf( status.header_buffer, + "TrueType engine changed to version %d", + status.tt_interpreter_versions[ + status.tt_interpreter_version_idx]); + + status.header = (const char *)status.header_buffer; + } + + + static void + event_warping_change( void ) + { + if ( handle->lcd_mode == LCD_MODE_LIGHT ) + { + FT_Bool new_warping_state = !status.warping; + + + error = FT_Property_Set( handle->library, + "autofitter", + "warping", + &new_warping_state ); + + if ( !error ) + { + /* Resetting the cache is perhaps a bit harsh, but I'm too */ + /* lazy to walk over all loaded fonts to check whether they */ + /* are auto-hinted, then unloading them explicitly. */ + FTC_Manager_Reset( handle->cache_manager ); + status.warping = new_warping_state; + } + + status.header = status.warping ? "warping enabled" + : "warping disabled"; + } + else + status.header = "need light anti-aliasing mode to toggle warping"; + } + + + static void + event_gamma_change( double delta ) + { + status.gamma += delta; + + if ( status.gamma > 3.0 ) + status.gamma = 3.0; + else if ( status.gamma < 0.0 ) + status.gamma = 0.0; + + grSetGlyphGamma( status.gamma ); + + if ( status.gamma == 0.0 ) + sprintf( status.header_buffer, "gamma changed to sRGB mode" ); + else + sprintf( status.header_buffer, "gamma changed to %.1f", status.gamma ); + + status.header = (const char *)status.header_buffer; + } + + + static void + event_grid_reset( GridStatus st ) + { + st->x_origin = st->x_origin_0; + st->y_origin = st->y_origin_0; + st->scale = st->scale_0; + } + + + static void + event_grid_translate( int dx, + int dy ) + { + status.x_origin += 32 * dx; + status.y_origin += 32 * dy; + } + + + static void + event_grid_zoom( double zoom ) + { + FT_F26Dot6 scale_old = status.scale; + + + status.scale *= zoom; + + /* avoid same zoom value due to truncation */ + /* to integer in above multiplication */ + if ( status.scale == scale_old && zoom > 1.0 ) + status.scale++; + + sprintf( status.header_buffer, "zoom level %.0f%%", + status.scale * 100.0 / status.scale_0 ); + + status.header = (const char *)status.header_buffer; + } + + + static void + event_lcd_mode_change( int delta ) + { + const char* lcd_mode = NULL; + + + handle->lcd_mode = ( handle->lcd_mode + + delta + + N_LCD_MODES ) % N_LCD_MODES; + + switch ( handle->lcd_mode ) + { + case LCD_MODE_MONO: + lcd_mode = "monochrome"; + break; + case LCD_MODE_AA: + lcd_mode = "normal AA"; + break; + case LCD_MODE_LIGHT: + lcd_mode = "light AA"; + break; + case LCD_MODE_LIGHT_SUBPIXEL: + lcd_mode = "light AA (subpixel positioning)"; + break; + case LCD_MODE_RGB: + lcd_mode = "LCD (horiz. RGB)"; + break; + case LCD_MODE_BGR: + lcd_mode = "LCD (horiz. BGR)"; + break; + case LCD_MODE_VRGB: + lcd_mode = "LCD (vert. RGB)"; + break; + case LCD_MODE_VBGR: + lcd_mode = "LCD (vert. BGR)"; + break; + } + + if ( delta ) + FTC_Manager_Reset( handle->cache_manager ); + + sprintf( status.header_buffer, "rendering mode changed to %s", + lcd_mode ); + + status.header = (const char *)status.header_buffer; + + FTDemo_Update_Current_Flags( handle ); + } + + + static void + event_lcd_filter_change( void ) + { + if ( handle->lcd_mode >= LCD_MODE_RGB ) + { + const char* lcd_filter = NULL; + + + switch( status.lcd_filter ) + { + case FT_LCD_FILTER_DEFAULT: + status.lcd_filter = FT_LCD_FILTER_LIGHT; + break; + case FT_LCD_FILTER_LIGHT: + status.lcd_filter = FT_LCD_FILTER_LEGACY1; + break; + case FT_LCD_FILTER_LEGACY1: + status.lcd_filter = FT_LCD_FILTER_NONE; + break; + case FT_LCD_FILTER_NONE: + default: + status.lcd_filter = FT_LCD_FILTER_DEFAULT; + break; + } + + switch ( status.lcd_filter ) + { + case FT_LCD_FILTER_DEFAULT: + lcd_filter = "default"; + break; + case FT_LCD_FILTER_LIGHT: + lcd_filter = "light"; + break; + case FT_LCD_FILTER_LEGACY1: + lcd_filter = "legacy"; + break; + case FT_LCD_FILTER_NONE: + default: + lcd_filter = "none"; + break; + } + + sprintf( status.header_buffer, "LCD filter changed to %s", + lcd_filter ); + + status.header = (const char *)status.header_buffer; + + FT_Library_SetLcdFilter( handle->library, status.lcd_filter ); + } + else + status.header = "need LCD mode to change filter"; + } + + + static void + event_size_change( int delta ) + { + status.ptsize += delta; + + if ( status.ptsize < 1 * 64 ) + status.ptsize = 1 * 64; + else if ( status.ptsize > MAXPTSIZE * 64 ) + status.ptsize = MAXPTSIZE * 64; + + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + } + + + static void + event_index_change( int delta ) + { + int num_indices = handle->current_font->num_indices; + + + status.Num += delta; + + if ( status.Num < 0 ) + status.Num = 0; + else if ( status.Num >= num_indices ) + status.Num = num_indices - 1; + } + + + static void + event_axis_change( int delta ) + { + FT_Error err; + FT_Size size; + FT_Var_Axis* a; + FT_Fixed pos; + + + err = FTDemo_Get_Size( handle, &size ); + if ( err ) + return; + + if ( !status.mm ) + return; + + a = status.mm->axis + status.current_axis; + pos = status.design_pos[status.current_axis]; + + /* + * Normalize i. Changing by 20 is all very well for PostScript fonts, + * which tend to have a range of ~1000 per axis, but it's not useful + * for mac fonts, which have a range of ~3. And it's rather extreme + * for optical size even in PS. + */ + pos += FT_MulDiv( delta, a->maximum - a->minimum, 1000 ); + if ( pos < a->minimum ) + pos = a->minimum; + if ( pos > a->maximum ) + pos = a->maximum; + + status.design_pos[status.current_axis] = pos; + + (void)FT_Set_Var_Design_Coordinates( size->face, + status.used_num_axis, + status.design_pos ); + } + + + static void + event_font_change( int delta ) + { + FT_Error err; + FT_Size size; + FT_UInt n, num_names; + FT_Int instance_index; + FT_Multi_Master dummy; + int num_indices, is_GX; + + + if ( status.font_index + delta >= handle->num_fonts || + status.font_index + delta < 0 ) + return; + + status.font_index += delta; + + FTDemo_Set_Current_Font( handle, handle->fonts[status.font_index] ); + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + FTDemo_Update_Current_Flags( handle ); + + num_indices = handle->current_font->num_indices; + + if ( status.Num >= num_indices ) + status.Num = num_indices - 1; + + err = FTDemo_Get_Size( handle, &size ); + if ( err ) + return; + + free( status.mm ); + err = FT_Get_MM_Var( size->face, &status.mm ); + if ( err ) + return; + + if ( status.mm->num_axis >= MAX_MM_AXES ) + { + fprintf( stderr, "only handling first %d GX axes (of %d)\n", + MAX_MM_AXES, status.mm->num_axis ); + status.used_num_axis = MAX_MM_AXES; + } + else + status.used_num_axis = status.mm->num_axis; + + err = FT_Get_Multi_Master( size->face, &dummy ); + is_GX = err ? 1 : 0; + + num_names = FT_Get_Sfnt_Name_Count( size->face ); + + /* in `face_index', the instance index starts with value 1 */ + instance_index = ( size->face->face_index >> 16 ) - 1; + + for ( n = 0; n < MAX_MM_AXES; n++ ) + { + free( status.axis_name[n] ); + status.axis_name[n] = NULL; + } + + for ( n = 0; n < status.used_num_axis; n++ ) + { + if ( status.requested_cnt ) + { + status.design_pos[n] = n < status.requested_cnt + ? status.requested_pos[n] + : status.mm->axis[n].def; + if ( status.design_pos[n] < status.mm->axis[n].minimum ) + status.design_pos[n] = status.mm->axis[n].minimum; + else if ( status.design_pos[n] > status.mm->axis[n].maximum ) + status.design_pos[n] = status.mm->axis[n].maximum; + } + else if ( FT_IS_NAMED_INSTANCE( size->face ) ) + status.design_pos[n] = status.mm->namedstyle[instance_index]. + coords[n]; + else + status.design_pos[n] = status.mm->axis[n].def; + + if ( is_GX ) + { + FT_SfntName name; + FT_UInt strid, j; + + + name.string = NULL; + strid = status.mm->axis[n].strid; + + /* iterate over all name entries */ + /* to find an English entry for `strid' */ + + for ( j = 0; j < num_names; j++ ) + { + error = FT_Get_Sfnt_Name( size->face, j, &name ); + if ( error ) + continue; + + if ( name.name_id == strid ) + { + /* XXX we don't have support for Apple's new `ltag' table yet, */ + /* thus we ignore TT_PLATFORM_APPLE_UNICODE */ + if ( ( name.platform_id == TT_PLATFORM_MACINTOSH && + name.language_id == TT_MAC_LANGID_ENGLISH ) || + ( name.platform_id == TT_PLATFORM_MICROSOFT && + ( name.language_id & 0xFF ) + == TT_MS_LANGID_ENGLISH_GENERAL ) ) + break; + } + } + + if ( name.string ) + { + FT_UInt len; + char* s; + + + if ( name.platform_id == TT_PLATFORM_MACINTOSH ) + { + len = put_ascii_string_size( name.string, name.string_len, 0 ); + s = (char*)malloc( len ); + if ( s ) + { + put_ascii_string( s, name.string, name.string_len, 0 ); + status.axis_name[n] = s; + } + } + else + { + len = put_unicode_be16_string_size( name.string, + name.string_len, + 0, + 0 ); + s = (char*)malloc( len ); + if ( s ) + { + put_unicode_be16_string( s, + name.string, + name.string_len, + 0, + 0 ); + status.axis_name[n] = s; + } + } + } + } + } + + (void)FT_Set_Var_Design_Coordinates( size->face, + status.used_num_axis, + status.design_pos ); + } + + + static int + Process_Event( grEvent* event ) + { + int ret = 0; + + + status.header = NULL; + + switch ( event->key ) + { + case grKeyEsc: + case grKEY( 'q' ): + ret = 1; + break; + + case grKeyF1: + case grKEY( '?' ): + event_help(); + break; + + case grKEY( 'f' ): + handle->autohint = !handle->autohint; + status.header = handle->autohint ? "forced auto-hinting is now on" + : "forced auto-hinting is now off"; + + FTDemo_Update_Current_Flags( handle ); + break; + +#ifdef FT_DEBUG_AUTOFIT + case grKEY( '1' ): + if ( handle->hinted && + ( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT || + handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) ) + { + status.header = "dumping glyph edges to stdout"; + af_glyph_hints_dump_edges( _af_debug_hints, 1 ); + } + break; + + case grKEY( '2' ): + if ( handle->hinted && + ( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT || + handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) ) + { + status.header = "dumping glyph segments to stdout"; + af_glyph_hints_dump_segments( _af_debug_hints, 1 ); + } + break; + + case grKEY( '3' ): + if ( handle->hinted && + ( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT || + handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) ) + { + status.header = "dumping glyph points to stdout"; + af_glyph_hints_dump_points( _af_debug_hints, 1 ); + } + break; +#endif /* FT_DEBUG_AUTOFIT */ + + case grKEY( 'L' ): + event_lcd_filter_change(); + break; + + case grKEY( 'g' ): + event_gamma_change( 0.1 ); + break; + + case grKEY( 'v' ): + event_gamma_change( -0.1 ); + break; + + case grKEY( 'n' ): + event_font_change( 1 ); + break; + + case grKEY( 'h' ): + handle->hinted = !handle->hinted; + status.header = handle->hinted ? "glyph hinting is now active" + : "glyph hinting is now ignored"; + + FTC_Manager_Reset( handle->cache_manager ); + FTDemo_Update_Current_Flags( handle ); + break; + + case grKEY( 'd' ): + status.work ^= DO_DOTS; + break; + + case grKEY( 'D' ): + status.work ^= DO_DOTNUMBERS; + break; + + case grKEY( 'o' ): + status.work ^= DO_OUTLINE; + break; + + case grKEY( 'b' ): + status.work ^= DO_BITMAP; + break; + + case grKEY( 'p' ): + event_font_change( -1 ); + break; + + case grKEY( 'H' ): + if ( !( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT || + handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) ) + { + FT_Face face; + FT_Module module; + + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + if ( !error ) + { + module = &face->driver->root; + + if ( !strcmp( module->clazz->module_name, "cff" ) ) + event_cff_hinting_engine_change( 1 ); + else if ( !strcmp( module->clazz->module_name, "truetype" ) ) + event_tt_interpreter_version_change(); + } + } +#ifdef FT_DEBUG_AUTOFIT + else + { + status.do_horz_hints = !status.do_horz_hints; + status.header = status.do_horz_hints ? "horizontal hinting enabled" + : "horizontal hinting disabled"; + } +#endif + break; + + case grKEY( 'w' ): + event_warping_change(); + break; + +#ifdef FT_DEBUG_AUTOFIT + case grKEY( 'V' ): + if ( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT || + handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) + { + status.do_vert_hints = !status.do_vert_hints; + status.header = status.do_vert_hints ? "vertical hinting enabled" + : "vertical hinting disabled"; + } + else + status.header = "need autofit mode to toggle vertical hinting"; + break; + + case grKEY( 'B' ): + if ( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT || + handle->lcd_mode == LCD_MODE_LIGHT_SUBPIXEL ) + { + status.do_blue_hints = !status.do_blue_hints; + status.header = status.do_blue_hints ? "blue zone hinting enabled" + : "blue zone hinting disabled"; + } + else + status.header = "need autofit mode to toggle blue zone hinting"; + break; + + case grKEY( 's' ): + status.do_segment = !status.do_segment; + status.header = status.do_segment ? "segment drawing enabled" + : "segment drawing disabled"; + break; +#endif /* FT_DEBUG_AUTOFIT */ + + case grKeyLeft: event_index_change( -1 ); break; + case grKeyRight: event_index_change( 1 ); break; + case grKeyF7: event_index_change( -10 ); break; + case grKeyF8: event_index_change( 10 ); break; + case grKeyF9: event_index_change( -100 ); break; + case grKeyF10: event_index_change( 100 ); break; + case grKeyF11: event_index_change( -1000 ); break; + case grKeyF12: event_index_change( 1000 ); break; + + case grKeyUp: event_size_change( 32 ); break; + case grKeyDown: event_size_change( -32 ); break; + + case grKEY( ' ' ): event_grid_reset( &status ); +#if 0 + status.do_horz_hints = 1; + status.do_vert_hints = 1; + status.do_blue_hints = 1; +#endif + break; + + case grKEY( 'i' ): event_grid_translate( 0, -1 ); break; + case grKEY( 'k' ): event_grid_translate( 0, 1 ); break; + case grKEY( 'j' ): event_grid_translate( -1, 0 ); break; + case grKEY( 'l' ): event_grid_translate( 1, 0 ); break; + + case grKeyPageUp: event_grid_zoom( 1.25 ); break; + case grKeyPageDown: event_grid_zoom( 1 / 1.25 ); break; + + case grKeyF2: if ( status.mm ) + { + status.current_axis++; + status.current_axis %= status.used_num_axis; + } + break; + + case grKeyF3: event_axis_change( -20 ); break; + case grKeyF4: event_axis_change( 20 ); break; + + case grKeyF5: event_lcd_mode_change( -1 ); break; + case grKeyF6: event_lcd_mode_change( 1 ); break; + + default: + ; + } + + return ret; + } + + + static void + write_header( FT_Error error_code ) + { + FT_Face face; + const char* basename; + const char* format; + + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + if ( error ) + Fatal( "can't access font file" ); + + if ( !status.header ) + { + basename = ft_basename( handle->current_font->filepathname ); + + switch ( error_code ) + { + case FT_Err_Ok: + sprintf( status.header_buffer, "%.50s %.50s (file `%.100s')", + face->family_name, face->style_name, basename ); + break; + + case FT_Err_Invalid_Pixel_Size: + sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", + basename ); + break; + + case FT_Err_Invalid_PPem: + sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", + basename ); + break; + + default: + sprintf( status.header_buffer, "File `%.100s': error 0x%04x", + basename, (FT_UShort)error_code ); + break; + } + + status.header = (const char *)status.header_buffer; + } + + grWriteCellString( display->bitmap, 0, 0, status.header, + display->fore_color ); + + if ( status.mm ) + { + format = " %s axis: %.02f, %gpt, glyph %d"; + snprintf( status.header_buffer, BUFSIZE, format, + status.axis_name[status.current_axis] + ? status.axis_name[status.current_axis] + : status.mm->axis[status.current_axis].name, + status.design_pos[status.current_axis] / 65536.0, + status.ptsize / 64.0, + status.Num ); + } + else + { + format = " %gpt, glyph %d"; + snprintf( status.header_buffer, BUFSIZE, format, + status.ptsize / 64.0, + status.Num ); + } + + if ( FT_HAS_GLYPH_NAMES( face ) ) + { + char* p; + unsigned int format_len, gindex, size; + + + size = strlen( status.header_buffer ); + p = status.header_buffer + size; + size = BUFSIZE - size; + + format = ": "; + format_len = strlen( format ); + + if ( size >= format_len + 2 ) + { + gindex = (unsigned int)status.Num; + + strcpy( p, format ); + if ( FT_Get_Glyph_Name( face, gindex, + p + format_len, size - format_len ) ) + *p = '\0'; + } + } + + status.header = (const char *)status.header_buffer; + grWriteCellString( display->bitmap, 0, HEADER_HEIGHT, + status.header_buffer, display->fore_color ); + + grRefreshSurface( display->surface ); + } + + + static void + usage( char* execname ) + { + fprintf( stderr, + "\n" + "ftgrid: simple glyph grid viewer -- part of the FreeType project\n" + "----------------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] pt font ...\n" + "\n", + execname ); + fprintf( stderr, + " pt The point size for the given resolution.\n" + " If resolution is 72dpi, this directly gives the\n" + " ppem value (pixels per EM).\n" ); + fprintf( stderr, + " font The font file(s) to display.\n" + " For Type 1 font files, ftgrid also tries to attach\n" + " the corresponding metrics file (with extension\n" + " `.afm' or `.pfm').\n" + "\n" ); + fprintf( stderr, + " -w W Set the window width to W pixels (default: %dpx).\n" + " -h H Set the window height to H pixels (default: %dpx).\n" + "\n", + DIM_X, DIM_Y ); + fprintf( stderr, + " -r R Use resolution R dpi (default: 72dpi).\n" + " -f index Specify first index to display (default: 0).\n" + " -d \"axis1 axis2 ...\"\n" + " Specify the design coordinates for each\n" + " Multiple Master axis at start-up.\n" + "\n" + " -v Show version." + "\n" ); + + exit( 1 ); + } + + + static void + parse_cmdline( int* argc, + char** argv[] ) + { + char* execname; + int option; + + + execname = ft_basename( (*argv)[0] ); + + while ( 1 ) + { + option = getopt( *argc, *argv, "d:f:h:r:vw:" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'd': + { + FT_UInt cnt; + FT_Fixed* pos = status.requested_pos; + char* s = optarg; + + + for ( cnt = 0; cnt < MAX_MM_AXES && *s; cnt++ ) + { + pos[cnt] = (FT_Fixed)( strtod( s, &s ) * 65536.0 ); + + while ( *s == ' ' ) + ++s; + } + + status.requested_cnt = cnt; + } + break; + + case 'f': + status.Num = atoi( optarg ); + break; + + case 'h': + status.height = atoi( optarg ); + if ( status.height < 1 ) + usage( execname ); + break; + + case 'r': + status.res = atoi( optarg ); + if ( status.res < 1 ) + usage( execname ); + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( handle->library, &major, &minor, &patch ); + + printf( "ftgrid (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + case 'w': + status.width = atoi( optarg ); + if ( status.width < 1 ) + usage( execname ); + break; + + default: + usage( execname ); + break; + } + } + + *argc -= optind; + *argv += optind; + + if ( *argc <= 1 ) + usage( execname ); + + status.ptsize = (int)( atof( *argv[0] ) * 64.0 ); + if ( status.ptsize == 0 ) + status.ptsize = 64 * 10; + + if ( status.res <= 0 ) + status.res = 72; + + (*argc)--; + (*argv)++; + } + + + int + main( int argc, + char* argv[] ) + { + grEvent event; + int n; + unsigned int dflt_tt_interpreter_version; + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + + + /* initialize engine */ + handle = FTDemo_New(); + + grid_status_init( &status ); + parse_cmdline( &argc, &argv ); + + /* get the default value as compiled into FreeType */ + FT_Property_Get( handle->library, + "cff", + "hinting-engine", &status.cff_hinting_engine ); + + /* collect all available versions, then set again the default */ + FT_Property_Get( handle->library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( n = 0; n < 3; n++ ) + { + error = FT_Property_Set( handle->library, + "truetype", + "interpreter-version", &versions[n] ); + if ( !error ) + status.tt_interpreter_versions[ + status.num_tt_interpreter_versions++] = versions[n]; + if ( versions[n] == dflt_tt_interpreter_version ) + status.tt_interpreter_version_idx = n; + } + FT_Property_Set( handle->library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + + FT_Property_Get( handle->library, + "autofitter", + "warping", &status.warping ); + + FT_Library_SetLcdFilter( handle->library, status.lcd_filter ); + + display = FTDemo_Display_New( gr_pixel_mode_rgb24, + status.width, status.height ); + if ( !display ) + Fatal( "could not allocate display surface" ); + + grid_status_display( &status, display ); + + grSetTitle( display->surface, + "FreeType Glyph Grid Viewer - press ? for help" ); + + for ( ; argc > 0; argc--, argv++ ) + { + error = FTDemo_Install_Font( handle, argv[0], 1, + status.requested_cnt ? 1 : 0 ); + if ( error == FT_Err_Invalid_Argument ) + fprintf( stderr, "skipping font `%s' without outlines\n", + argv[0] ); + } + + if ( handle->num_fonts == 0 ) + Fatal( "could not find/open any font file" ); + + printf( "ptsize =%g\n", status.ptsize / 64.0 ); + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + FTDemo_Update_Current_Flags( handle ); + + event_font_change( 0 ); + + grid_status_rescale_initial( &status, handle ); + + for ( ;; ) + { + FTDemo_Display_Clear( display ); + + grid_status_draw_grid( &status ); + + if ( status.work ) + grid_status_draw_outline( &status, handle, display ); + + write_header( 0 ); + + grListenSurface( display->surface, 0, &event ); + if ( Process_Event( &event ) ) + break; + } + + printf( "Execution completed successfully.\n" ); + + for ( n = 0; n < MAX_MM_AXES; n++ ) + free( status.axis_name[n] ); + free( status.mm ); + + FT_Stroker_Done( status.stroker ); + FTDemo_Display_Done( display ); + FTDemo_Done( handle ); + + exit( 0 ); /* for safety reasons */ + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftinspect.cpp freetype-2.8/=unpacked-tar2=/src/ftinspect.cpp --- freetype-2.7.1/=unpacked-tar2=/src/ftinspect.cpp 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftinspect.cpp 2017-05-11 18:53:09.000000000 +0000 @@ -0,0 +1,2756 @@ +// ftinspect.cpp + +// Copyright (C) 2016 by Werner Lemberg. + +#include "ftinspect.h" + +#include +#include +#include +#include + +#define VERSION "X.Y.Z" + + +///////////////////////////////////////////////////////////////////////////// +// +// FaceID +// +///////////////////////////////////////////////////////////////////////////// + +FaceID::FaceID() +: fontIndex(-1), + faceIndex(-1), + namedInstanceIndex(-1) +{ + // empty +} + + +FaceID::FaceID(int fontIdx, + int faceIdx, + int namedInstanceIdx) +: fontIndex(fontIdx), + faceIndex(faceIdx), + namedInstanceIndex(namedInstanceIdx) +{ + // empty +} + + +bool +FaceID::operator<(const FaceID& other) const +{ + bool ret = false; + + if (fontIndex < other.fontIndex) + ret = true; + else if (fontIndex == other.fontIndex) + { + if (faceIndex < other.faceIndex) + ret = true; + else if (faceIndex == other.faceIndex) + { + if (namedInstanceIndex < other.namedInstanceIndex) + ret = true; + } + } + + return ret; +} + + +// The face requester is a function provided by the client application to +// the cache manager to translate an `abstract' face ID into a real +// `FT_Face' object. +// +// We use a map: `faceID' is the value, and its associated key gives the +// font, face, and named instance indices. Getting a key from a value is +// slow, but this must be done only once, since `faceRequester' is only +// called if the font is not yet in the cache. + +FT_Error +faceRequester(FTC_FaceID ftcFaceID, + FT_Library library, + FT_Pointer requestData, + FT_Face* faceP) +{ + MainGUI* gui = static_cast(requestData); + + // `ftcFaceID' is actually an integer + // -> first convert pointer to same-width integer, then discard superfluous + // bits (e.g., on x86_64 where pointers are wider than int) + int val = static_cast(reinterpret_cast(ftcFaceID)); + // make sure this does not cause information loss + Q_ASSERT_X(sizeof(void*) >= sizeof(int), + "faceRequester", + "Pointer size must be at least the size of int" + " in order to treat FTC_FaceID correctly"); + + const FaceID& faceID = gui->engine->faceIDMap.key(val); + + // this is the only place where we have to check the validity of the font + // index; note that the validity of both the face and named instance index + // is checked by FreeType itself + if (faceID.fontIndex < 0 + || faceID.fontIndex >= gui->fontList.size()) + return FT_Err_Invalid_Argument; + + QString& font = gui->fontList[faceID.fontIndex]; + int faceIndex = faceID.faceIndex; + + if (faceID.namedInstanceIndex > 0) + faceIndex += faceID.namedInstanceIndex << 16; + + return FT_New_Face(library, + qPrintable(font), + faceIndex, + faceP); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// Engine +// +///////////////////////////////////////////////////////////////////////////// + +Engine::Engine(MainGUI* g) +{ + gui = g; + ftSize = NULL; + // we reserve value 0 for the `invalid face ID' + faceCounter = 1; + + FT_Error error; + + error = FT_Init_FreeType(&library); + if (error) + { + // XXX error handling + } + + error = FTC_Manager_New(library, 0, 0, 0, + faceRequester, gui, &cacheManager); + if (error) + { + // XXX error handling + } + + error = FTC_SBitCache_New(cacheManager, &sbitsCache); + if (error) + { + // XXX error handling + } + + error = FTC_ImageCache_New(cacheManager, &imageCache); + if (error) + { + // XXX error handling + } + + // query engines and check for alternatives + + // CFF + error = FT_Property_Get(library, + "cff", + "hinting-engine", + &cffHintingEngineDefault); + if (error) + { + // no CFF engine + cffHintingEngineDefault = -1; + cffHintingEngineOther = -1; + } + else + { + int engines[] = + { + FT_CFF_HINTING_FREETYPE, + FT_CFF_HINTING_ADOBE + }; + + int i; + for (i = 0; i < 2; i++) + if (cffHintingEngineDefault == engines[i]) + break; + + cffHintingEngineOther = engines[(i + 1) % 2]; + + error = FT_Property_Set(library, + "cff", + "hinting-engine", + &cffHintingEngineOther); + if (error) + cffHintingEngineOther = -1; + + // reset + FT_Property_Set(library, + "cff", + "hinting-engine", + &cffHintingEngineDefault); + } + + // TrueType + error = FT_Property_Get(library, + "truetype", + "interpreter-version", + &ttInterpreterVersionDefault); + if (error) + { + // no TrueType engine + ttInterpreterVersionDefault = -1; + ttInterpreterVersionOther = -1; + ttInterpreterVersionOther1 = -1; + } + else + { + int interpreters[] = + { + TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 + }; + + int i; + for (i = 0; i < 3; i++) + if (ttInterpreterVersionDefault == interpreters[i]) + break; + + ttInterpreterVersionOther = interpreters[(i + 1) % 3]; + + error = FT_Property_Set(library, + "truetype", + "interpreter-version", + &ttInterpreterVersionOther); + if (error) + ttInterpreterVersionOther = -1; + + ttInterpreterVersionOther1 = interpreters[(i + 2) % 3]; + + error = FT_Property_Set(library, + "truetype", + "interpreter-version", + &ttInterpreterVersionOther1); + if (error) + ttInterpreterVersionOther1 = -1; + + // reset + FT_Property_Set(library, + "truetype", + "interpreter-version", + &ttInterpreterVersionDefault); + } + + // auto-hinter + error = FT_Property_Get(library, + "autofitter", + "warping", + &doWarping); + if (error) + { + // no warping + haveWarping = 0; + doWarping = 0; + } + else + { + haveWarping = 1; + doWarping = 0; // we don't do warping by default + + FT_Property_Set(library, + "autofitter", + "warping", + &doWarping); + } +} + + +Engine::~Engine() +{ + FTC_Manager_Done(cacheManager); + FT_Done_FreeType(library); +} + + +int +Engine::numberOfFaces(int fontIndex) +{ + FT_Face face; + int numFaces = -1; + + // search triplet (fontIndex, 0, 0) + FTC_FaceID ftcFaceID = reinterpret_cast + (faceIDMap.value(FaceID(fontIndex, + 0, + 0))); + if (ftcFaceID) + { + // found + if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) + numFaces = face->num_faces; + } + else + { + // not found; try to load triplet (fontIndex, 0, 0) + ftcFaceID = reinterpret_cast(faceCounter); + faceIDMap.insert(FaceID(fontIndex, 0, 0), + faceCounter++); + + if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) + numFaces = face->num_faces; + else + { + faceIDMap.remove(FaceID(fontIndex, 0, 0)); + faceCounter--; + } + } + + return numFaces; +} + + +int +Engine::numberOfNamedInstances(int fontIndex, + int faceIndex) +{ + FT_Face face; + // we return `n' named instances plus one; + // instance index 0 represents a face without a named instance selected + int numNamedInstances = -1; + + // search triplet (fontIndex, faceIndex, 0) + FTC_FaceID ftcFaceID = reinterpret_cast + (faceIDMap.value(FaceID(fontIndex, + faceIndex, + 0))); + if (ftcFaceID) + { + // found + if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) + numNamedInstances = static_cast((face->style_flags >> 16) + 1); + } + else + { + // not found; try to load triplet (fontIndex, faceIndex, 0) + ftcFaceID = reinterpret_cast(faceCounter); + faceIDMap.insert(FaceID(fontIndex, faceIndex, 0), + faceCounter++); + + if (!FTC_Manager_LookupFace(cacheManager, ftcFaceID, &face)) + numNamedInstances = static_cast((face->style_flags >> 16) + 1); + else + { + faceIDMap.remove(FaceID(fontIndex, faceIndex, 0)); + faceCounter--; + } + } + + return numNamedInstances; +} + + +int +Engine::loadFont(int fontIndex, + int faceIndex, + int namedInstanceIndex) +{ + int numGlyphs = -1; + fontType = FontType_Other; + + update(); + + // search triplet (fontIndex, faceIndex, namedInstanceIndex) + scaler.face_id = reinterpret_cast + (faceIDMap.value(FaceID(fontIndex, + faceIndex, + namedInstanceIndex))); + if (scaler.face_id) + { + // found + if (!FTC_Manager_LookupSize(cacheManager, &scaler, &ftSize)) + numGlyphs = ftSize->face->num_glyphs; + } + else + { + // not found; try to load triplet + // (fontIndex, faceIndex, namedInstanceIndex) + scaler.face_id = reinterpret_cast(faceCounter); + faceIDMap.insert(FaceID(fontIndex, + faceIndex, + namedInstanceIndex), + faceCounter++); + + if (!FTC_Manager_LookupSize(cacheManager, &scaler, &ftSize)) + numGlyphs = ftSize->face->num_glyphs; + else + { + faceIDMap.remove(FaceID(fontIndex, + faceIndex, + namedInstanceIndex)); + faceCounter--; + } + } + + if (numGlyphs < 0) + { + ftSize = NULL; + curFamilyName = QString(); + curStyleName = QString(); + } + else + { + curFamilyName = QString(ftSize->face->family_name); + curStyleName = QString(ftSize->face->style_name); + + FT_Module module = &ftSize->face->driver->root; + const char* moduleName = module->clazz->module_name; + + // XXX cover all available modules + if (!strcmp(moduleName, "cff")) + fontType = FontType_CFF; + else if (!strcmp(moduleName, "truetype")) + fontType = FontType_TrueType; + } + + return numGlyphs; +} + + +void +Engine::removeFont(int fontIndex) +{ + // we iterate over all triplets that contain the given font index + // and remove them + QMap::iterator iter + = faceIDMap.lowerBound(FaceID(fontIndex, 0, 0)); + + for (;;) + { + if (iter == faceIDMap.end()) + break; + + FaceID faceID = iter.key(); + if (faceID.fontIndex != fontIndex) + break; + + FTC_FaceID ftcFaceID = reinterpret_cast(iter.value()); + FTC_Manager_RemoveFaceID(cacheManager, ftcFaceID); + + iter = faceIDMap.erase(iter); + } +} + + +const QString& +Engine::currentFamilyName() +{ + return curFamilyName; +} + + +const QString& +Engine::currentStyleName() +{ + return curStyleName; +} + + +QString +Engine::glyphName(int index) +{ + QString name; + + if (index < 0) + throw std::runtime_error("Invalid glyph index"); + + if (ftSize && FT_HAS_GLYPH_NAMES(ftSize->face)) + { + char buffer[256]; + if (!FT_Get_Glyph_Name(ftSize->face, + static_cast(index), + buffer, + sizeof(buffer))) + name = QString(buffer); + } + + return name; +} + + +FT_Outline* +Engine::loadOutline(int glyphIndex) +{ + update(); + + if (glyphIndex < 0) + throw std::runtime_error("Invalid glyph index"); + + FT_Glyph glyph; + + // XXX handle bitmap fonts + + // the `scaler' object is set up by the + // `update' and `loadFont' methods + if (FTC_ImageCache_LookupScaler(imageCache, + &scaler, + loadFlags | FT_LOAD_NO_BITMAP, + static_cast(glyphIndex), + &glyph, + NULL)) + { + // XXX error handling? + return NULL; + } + + if (glyph->format != FT_GLYPH_FORMAT_OUTLINE) + return NULL; + + FT_OutlineGlyph outlineGlyph = reinterpret_cast(glyph); + + return &outlineGlyph->outline; +} + + +void +Engine::setCFFHintingMode(int mode) +{ + int index = gui->hintingModesCFFHash.key(mode); + + FT_Error error = FT_Property_Set(library, + "cff", + "hinting-engine", + &index); + if (!error) + { + // reset the cache + FTC_Manager_Reset(cacheManager); + } +} + + +void +Engine::setTTInterpreterVersion(int mode) +{ + int index = gui->hintingModesTrueTypeHash.key(mode); + + FT_Error error = FT_Property_Set(library, + "truetype", + "interpreter-version", + &index); + if (!error) + { + // reset the cache + FTC_Manager_Reset(cacheManager); + } +} + + +void +Engine::update() +{ + // Spinbox value cannot become negative + dpi = static_cast(gui->dpiSpinBox->value()); + + if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px) + { + pixelSize = gui->sizeDoubleSpinBox->value(); + pointSize = pixelSize * 72.0 / dpi; + } + else + { + pointSize = gui->sizeDoubleSpinBox->value(); + pixelSize = pointSize * dpi / 72.0; + } + + doHinting = gui->hintingCheckBox->isChecked(); + + doAutoHinting = gui->autoHintingCheckBox->isChecked(); + doHorizontalHinting = gui->horizontalHintingCheckBox->isChecked(); + doVerticalHinting = gui->verticalHintingCheckBox->isChecked(); + doBlueZoneHinting = gui->blueZoneHintingCheckBox->isChecked(); + showSegments = gui->segmentDrawingCheckBox->isChecked(); + doWarping = gui->warpingCheckBox->isChecked(); + + gamma = gui->gammaSlider->value(); + + loadFlags = FT_LOAD_DEFAULT; + if (doAutoHinting) + loadFlags |= FT_LOAD_FORCE_AUTOHINT; + loadFlags |= FT_LOAD_NO_BITMAP; // XXX handle bitmap fonts also + + int index = gui->antiAliasingComboBoxx->currentIndex(); + + if (doHinting) + { + unsigned long target; + + if (index == MainGUI::AntiAliasing_None) + target = FT_LOAD_TARGET_MONO; + else + { + switch (index) + { + case MainGUI::AntiAliasing_Light: + target = FT_LOAD_TARGET_LIGHT; + break; + + case MainGUI::AntiAliasing_LCD: + case MainGUI::AntiAliasing_LCD_BGR: + target = FT_LOAD_TARGET_LCD; + break; + + case MainGUI::AntiAliasing_LCD_Vertical: + case MainGUI::AntiAliasing_LCD_Vertical_BGR: + target = FT_LOAD_TARGET_LCD_V; + break; + + default: + target = FT_LOAD_TARGET_NORMAL; + } + } + + loadFlags |= target; + } + else + { + loadFlags |= FT_LOAD_NO_HINTING; + + if (index == MainGUI::AntiAliasing_None) + loadFlags |= FT_LOAD_MONOCHROME; + } + + // XXX handle color fonts also + + scaler.pixel = 0; // use 26.6 format + + if (gui->unitsComboBox->currentIndex() == MainGUI::Units_px) + { + scaler.width = static_cast(pixelSize * 64.0); + scaler.height = static_cast(pixelSize * 64.0); + scaler.x_res = 0; + scaler.y_res = 0; + } + else + { + scaler.width = static_cast(pointSize * 64.0); + scaler.height = static_cast(pointSize * 64.0); + scaler.x_res = dpi; + scaler.y_res = dpi; + } +} + + +///////////////////////////////////////////////////////////////////////////// +// +// Grid +// +///////////////////////////////////////////////////////////////////////////// + +Grid::Grid(const QPen& gridP, + const QPen& axisP) +: gridPen(gridP), + axisPen(axisP) +{ + // empty +} + + +QRectF +Grid::boundingRect() const +{ + // XXX fix size + + // no need to take care of pen width + return QRectF(-100, -100, + 200, 200); +} + + +// XXX call this in a `myQDraphicsView::drawBackground' derived method +// to always fill the complete viewport + +void +Grid::paint(QPainter* painter, + const QStyleOptionGraphicsItem* option, + QWidget*) +{ + const qreal lod = option->levelOfDetailFromTransform( + painter->worldTransform()); + + painter->setPen(gridPen); + + // don't mark pixel center with a cross if magnification is too small + if (lod > 20) + { + int halfLength = 1; + + // cf. QSpinBoxx + if (lod > 640) + halfLength = 6; + else if (lod > 320) + halfLength = 5; + else if (lod > 160) + halfLength = 4; + else if (lod > 80) + halfLength = 3; + else if (lod > 40) + halfLength = 2; + + for (qreal x = -100; x < 100; x++) + for (qreal y = -100; y < 100; y++) + { + painter->drawLine(QLineF(x + 0.5, y + 0.5 - halfLength / lod, + x + 0.5, y + 0.5 + halfLength / lod)); + painter->drawLine(QLineF(x + 0.5 - halfLength / lod, y + 0.5, + x + 0.5 + halfLength / lod, y + 0.5)); + } + } + + // don't draw grid if magnification is too small + if (lod >= 5) + { + // XXX fix size + for (int x = -100; x <= 100; x++) + painter->drawLine(x, -100, + x, 100); + for (int y = -100; y <= 100; y++) + painter->drawLine(-100, y, + 100, y); + } + + painter->setPen(axisPen); + + painter->drawLine(0, -100, + 0, 100); + painter->drawLine(-100, 0, + 100, 0); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// GlyphOutline +// +///////////////////////////////////////////////////////////////////////////// + +extern "C" { + +// vertical font coordinates are bottom-up, +// while Qt uses top-down + +static int +moveTo(const FT_Vector* to, + void* user) +{ + QPainterPath* path = static_cast(user); + + path->moveTo(qreal(to->x) / 64, + -qreal(to->y) / 64); + + return 0; +} + + +static int +lineTo(const FT_Vector* to, + void* user) +{ + QPainterPath* path = static_cast(user); + + path->lineTo(qreal(to->x) / 64, + -qreal(to->y) / 64); + + return 0; +} + + +static int +conicTo(const FT_Vector* control, + const FT_Vector* to, + void* user) +{ + QPainterPath* path = static_cast(user); + + path->quadTo(qreal(control->x) / 64, + -qreal(control->y) / 64, + qreal(to->x) / 64, + -qreal(to->y) / 64); + + return 0; +} + + +static int +cubicTo(const FT_Vector* control1, + const FT_Vector* control2, + const FT_Vector* to, + void* user) +{ + QPainterPath* path = static_cast(user); + + path->cubicTo(qreal(control1->x) / 64, + -qreal(control1->y) / 64, + qreal(control2->x) / 64, + -qreal(control2->y) / 64, + qreal(to->x) / 64, + -qreal(to->y) / 64); + + return 0; +} + + +static FT_Outline_Funcs outlineFuncs = +{ + moveTo, + lineTo, + conicTo, + cubicTo, + 0, // no shift + 0 // no delta +}; + +} // extern "C" + + +GlyphOutline::GlyphOutline(const QPen& outlineP, + FT_Outline* outln) +: outlinePen(outlineP), + outline(outln) +{ + FT_BBox cbox; + + qreal halfPenWidth = outlinePen.widthF(); + + FT_Outline_Get_CBox(outline, &cbox); + + bRect.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth, + -qreal(cbox.yMax) / 64 - halfPenWidth, + qreal(cbox.xMax) / 64 + halfPenWidth, + -qreal(cbox.yMin) / 64 + halfPenWidth); +} + + +QRectF +GlyphOutline::boundingRect() const +{ + return bRect; +} + + +void +GlyphOutline::paint(QPainter* painter, + const QStyleOptionGraphicsItem*, + QWidget*) +{ + painter->setPen(outlinePen); + + QPainterPath path; + FT_Outline_Decompose(outline, &outlineFuncs, &path); + + painter->drawPath(path); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// GlyphPoints +// +///////////////////////////////////////////////////////////////////////////// + +GlyphPoints::GlyphPoints(const QPen& onP, + const QPen& offP, + FT_Outline* outln) +: onPen(onP), + offPen(offP), + outline(outln) +{ + FT_BBox cbox; + + qreal halfPenWidth = qMax(onPen.widthF(), offPen.widthF()) / 2; + + FT_Outline_Get_CBox(outline, &cbox); + + bRect.setCoords(qreal(cbox.xMin) / 64 - halfPenWidth, + -qreal(cbox.yMax) / 64 - halfPenWidth, + qreal(cbox.xMax) / 64 + halfPenWidth, + -qreal(cbox.yMin) / 64 + halfPenWidth); +} + + +QRectF +GlyphPoints::boundingRect() const +{ + return bRect; +} + + +void +GlyphPoints::paint(QPainter* painter, + const QStyleOptionGraphicsItem* option, + QWidget*) +{ + const qreal lod = option->levelOfDetailFromTransform( + painter->worldTransform()); + + // don't draw points if magnification is too small + if (lod >= 5) + { + // we want the same dot size regardless of the scaling; + // for good optical results, the pen widths should be uneven integers + + // interestingly, using `drawPoint' doesn't work as expected: + // the larger the zoom, the more horizontally stretched the dot appears +#if 0 + qreal origOnPenWidth = onPen.widthF(); + qreal origOffPenWidth = offPen.widthF(); + + onPen.setWidthF(origOnPenWidth / lod); + offPen.setWidthF(origOffPenWidth / lod); + + for (int i = 0; i < outline->n_points; i++) + { + if (outline->tags[i] & FT_CURVE_TAG_ON) + painter->setPen(onPen); + else + painter->setPen(offPen); + + painter->drawPoint(QPointF(qreal(outline->points[i].x) / 64, + -qreal(outline->points[i].y) / 64)); + } + + onPen.setWidthF(origOnPenWidth); + offPen.setWidthF(origOffPenWidth); +#else + QBrush onBrush(onPen.color()); + QBrush offBrush(offPen.color()); + + painter->setPen(Qt::NoPen); + + qreal onRadius = onPen.widthF() / lod; + qreal offRadius = offPen.widthF() / lod; + + for (int i = 0; i < outline->n_points; i++) + { + if (outline->tags[i] & FT_CURVE_TAG_ON) + { + painter->setBrush(onBrush); + painter->drawEllipse(QPointF(qreal(outline->points[i].x) / 64, + -qreal(outline->points[i].y) / 64), + onRadius, + onRadius); + } + else + { + painter->setBrush(offBrush); + painter->drawEllipse(QPointF(qreal(outline->points[i].x) / 64, + -qreal(outline->points[i].y) / 64), + offRadius, + offRadius); + } + } +#endif + } +} + + +///////////////////////////////////////////////////////////////////////////// +// +// GlyphPointNumbers +// +///////////////////////////////////////////////////////////////////////////// + +GlyphPointNumbers::GlyphPointNumbers(const QPen& onP, + const QPen& offP, + FT_Outline* outln) +: onPen(onP), + offPen(offP), + outline(outln) +{ + FT_BBox cbox; + + FT_Outline_Get_CBox(outline, &cbox); + + // XXX fix bRect size + bRect.setCoords(qreal(cbox.xMin) / 64, + -qreal(cbox.yMax) / 64, + qreal(cbox.xMax) / 64, + -qreal(cbox.yMin) / 64); +} + + +QRectF +GlyphPointNumbers::boundingRect() const +{ + return bRect; +} + + +void +GlyphPointNumbers::paint(QPainter* painter, + const QStyleOptionGraphicsItem* option, + QWidget*) +{ + const qreal lod = option->levelOfDetailFromTransform( + painter->worldTransform()); + + // don't draw point numbers if magnification is too small + if (lod >= 10) + { + QFont font = painter->font(); + + // the following doesn't work correctly with scaling; + // it seems that Qt doesn't allow arbitrarily small font sizes + // that get magnified later on +#if 0 + // we want the same text size regardless of the scaling + font.setPointSizeF(font.pointSizeF() / lod); + painter->setFont(font); +#else + font.setPointSizeF(font.pointSizeF() * 3 / 4); + painter->setFont(font); + + QBrush onBrush(onPen.color()); + QBrush offBrush(offPen.color()); + + painter->scale(1 / lod, 1 / lod); +#endif + + FT_Vector* points = outline->points; + FT_Short* contours = outline->contours; + char* tags = outline->tags; + + QVector2D octants[8] = { QVector2D(1, 0), + QVector2D(0.707f, -0.707f), + QVector2D(0, -1), + QVector2D(-0.707f, -0.707f), + QVector2D(-1, 0), + QVector2D(-0.707f, 0.707f), + QVector2D(0, 1), + QVector2D(0.707f, 0.707f) }; + + + short ptIdx = 0; + for (int contIdx = 0; contIdx < outline->n_contours; contIdx++ ) + { + for (;;) + { + short prevIdx, nextIdx; + + // find previous and next point in outline + if (contIdx == 0) + { + if (contours[contIdx] == 0) + { + prevIdx = 0; + nextIdx = 0; + } + else + { + prevIdx = ptIdx > 0 ? ptIdx - 1 + : contours[contIdx]; + nextIdx = ptIdx < contours[contIdx] ? ptIdx + 1 + : 0; + } + } + else + { + prevIdx = ptIdx > (contours[contIdx - 1] + 1) ? ptIdx - 1 + : contours[contIdx]; + nextIdx = ptIdx < contours[contIdx] ? ptIdx + 1 + : contours[contIdx - 1] + 1; + } + + // get vectors to previous and next point and normalize them; + QVector2D in(static_cast(points[prevIdx].x + - points[ptIdx].x) / 64, + -static_cast(points[prevIdx].y + - points[ptIdx].y) / 64); + QVector2D out(static_cast(points[nextIdx].x + - points[ptIdx].x) / 64, + -static_cast(points[nextIdx].y + - points[ptIdx].y) / 64); + + in = in.normalized(); + out = out.normalized(); + + QVector2D middle = in + out; + // check whether vector is very small, using a threshold of 1/8px + if (qAbs(middle.x()) < 1.0f / 8 + && qAbs(middle.y()) < 1.0f / 8) + { + // in case of vectors in almost exactly opposite directions, + // use a vector orthogonal to them + middle.setX(out.y()); + middle.setY(-out.x()); + + if (qAbs(middle.x()) < 1.0f / 8 + && qAbs(middle.y()) < 1.0f / 8) + { + // use direction based on point index for the offset + // if we still don't have a good value + middle = octants[ptIdx % 8]; + } + } + + // normalize `middle' vector (which is never zero), + // then multiply by 8 to get some distance between + // the point and the number + middle = middle.normalized() * 8; + + // we now position the point number in the opposite + // direction of the `middle' vector, + QString number = QString::number(ptIdx); + +#if 0 + // this fails, see comment above + int size = 10000; + qreal x = qreal(points[ptIdx].x) / 64 - middle.x() / lod; + qreal y = -qreal(points[ptIdx].y) / 64 - middle.y() / lod; + QPointF corner(x, y); + int flags = middle.x() > 0 ? Qt::AlignRight + : Qt::AlignLeft; + if (flags == Qt::AlignRight) + corner.rx() -= size; + QRectF posRect(corner, QSizeF(size, size)); + + if (tags[ptIdx] & FT_CURVE_TAG_ON) + painter->setPen(onPen); + else + painter->setPen(offPen); + + painter->drawText(posRect, flags, number); +#else + // convert text string to a path object + QPainterPath path; + path.addText(QPointF(0, 0), font, number); + QRectF ctrlPtRect = path.controlPointRect(); + + qreal x = static_cast(points[ptIdx].x) / 64 * lod + - static_cast(middle.x()); + qreal y = -static_cast(points[ptIdx].y) / 64 * lod + - static_cast(middle.y()); + + qreal heuristicOffset = 2; + if (middle.x() > 0) + path.translate(x - ctrlPtRect.width() - heuristicOffset, + y + ctrlPtRect.height() / 2); + else + path.translate(x, + y + ctrlPtRect.height() / 2); + + painter->fillPath(path, + tags[ptIdx] & FT_CURVE_TAG_ON ? onBrush + : offBrush); +#endif + + ptIdx++; + if (ptIdx > contours[contIdx]) + break; + } + } + } +} + + +///////////////////////////////////////////////////////////////////////////// +// +// GlyphBitmap +// +///////////////////////////////////////////////////////////////////////////// + +GlyphBitmap::GlyphBitmap(FT_Outline* outline, + FT_Library lib, + FT_Pixel_Mode pxlMode, + const QVector& monoColorTbl, + const QVector& grayColorTbl) +: library(lib), + pixelMode(pxlMode), + monoColorTable(monoColorTbl), + grayColorTable(grayColorTbl) +{ + // make a copy of the outline since we are going to manipulate it + FT_Outline_New(library, + static_cast(outline->n_points), + outline->n_contours, + &transformed); + FT_Outline_Copy(outline, &transformed); + + FT_BBox cbox; + FT_Outline_Get_CBox(outline, &cbox); + + cbox.xMin &= ~63; + cbox.yMin &= ~63; + cbox.xMax = (cbox.xMax + 63) & ~63; + cbox.yMax = (cbox.yMax + 63) & ~63; + + // we shift the outline to the origin for rendering later on + FT_Outline_Translate(&transformed, -cbox.xMin, -cbox.yMin); + + bRect.setCoords(cbox.xMin / 64, -cbox.yMax / 64, + cbox.xMax / 64, -cbox.yMin / 64); +} + + +GlyphBitmap::~GlyphBitmap() +{ + FT_Outline_Done(library, &transformed); +} + + +QRectF +GlyphBitmap::boundingRect() const +{ + return bRect; +} + + +void +GlyphBitmap::paint(QPainter* painter, + const QStyleOptionGraphicsItem* option, + QWidget*) +{ + FT_Bitmap bitmap; + + int height = static_cast(ceil(bRect.height())); + int width = static_cast(ceil(bRect.width())); + QImage::Format format = QImage::Format_Indexed8; + + // XXX cover LCD and color + if (pixelMode == FT_PIXEL_MODE_MONO) + format = QImage::Format_Mono; + + QImage image(QSize(width, height), format); + + if (pixelMode == FT_PIXEL_MODE_MONO) + image.setColorTable(monoColorTable); + else + image.setColorTable(grayColorTable); + + image.fill(0); + + bitmap.rows = static_cast(height); + bitmap.width = static_cast(width); + bitmap.buffer = image.bits(); + bitmap.pitch = image.bytesPerLine(); + bitmap.pixel_mode = pixelMode; + + FT_Error error = FT_Outline_Get_Bitmap(library, + &transformed, + &bitmap); + if (error) + { + // XXX error handling + return; + } + + // `drawImage' doesn't work as expected: + // the larger the zoom, the more the pixel rectangle positions + // deviate from the grid lines +#if 0 + painter->drawImage(QPoint(bRect.left(), bRect.top()), + image.convertToFormat( + QImage::Format_ARGB32_Premultiplied)); +#else + const qreal lod = option->levelOfDetailFromTransform( + painter->worldTransform()); + + painter->setPen(Qt::NoPen); + + for (int x = 0; x < image.width(); x++) + for (int y = 0; y < image.height(); y++) + { + // be careful not to lose the alpha channel + QRgb p = image.pixel(x, y); + painter->fillRect(QRectF(x + bRect.left() - 1 / lod / 2, + y + bRect.top() - 1 / lod / 2, + 1 + 1 / lod, + 1 + 1 / lod), + QColor(qRed(p), + qGreen(p), + qBlue(p), + qAlpha(p))); + } +#endif +} + + +///////////////////////////////////////////////////////////////////////////// +// +// MainGUI +// +///////////////////////////////////////////////////////////////////////////// + +MainGUI::MainGUI() +{ + engine = NULL; + + fontWatcher = new QFileSystemWatcher; + // if the current input file is invalid we retry once a second to load it + timer = new QTimer; + timer->setInterval(1000); + + setGraphicsDefaults(); + createLayout(); + createConnections(); + createActions(); + createMenus(); + createStatusBar(); + + readSettings(); + + setUnifiedTitleAndToolBarOnMac(true); +} + + +MainGUI::~MainGUI() +{ + // empty +} + + +void +MainGUI::update(Engine* e) +{ + engine = e; +} + + +// overloading + +void +MainGUI::closeEvent(QCloseEvent* event) +{ + writeSettings(); + event->accept(); +} + + +void +MainGUI::about() +{ + QMessageBox::about( + this, + tr("About ftinspect"), + tr("

This is ftinspect version %1
" + " Copyright %2 2016
" + " by Werner Lemberg <wl@gnu.org>

" + "" + "

ftinspect shows how a font gets rendered" + " by FreeType, allowing control over virtually" + " all rendering parameters.

" + "" + "

License:" + " FreeType" + " License (FTL) or" + " GNU" + " GPLv2

") + .arg(VERSION) + .arg(QChar(0xA9))); +} + + +void +MainGUI::aboutQt() +{ + QApplication::aboutQt(); +} + + +void +MainGUI::loadFonts() +{ + int oldSize = fontList.size(); + + QStringList files = QFileDialog::getOpenFileNames( + this, + tr("Load one or more fonts"), + QDir::homePath(), + "", + NULL, + QFileDialog::ReadOnly); + + // XXX sort data, uniquify elements + fontList.append(files); + + // if we have new fonts, set the current index to the first new one + if (oldSize < fontList.size()) + currentFontIndex = oldSize; + + showFont(); +} + + +void +MainGUI::closeFont() +{ + if (currentFontIndex < fontList.size()) + { + engine->removeFont(currentFontIndex); + fontWatcher->removePath(fontList[currentFontIndex]); + fontList.removeAt(currentFontIndex); + } + + // show next font after deletion, i.e., retain index if possible + if (fontList.size()) + { + if (currentFontIndex >= fontList.size()) + currentFontIndex = fontList.size() - 1; + } + else + currentFontIndex = 0; + + showFont(); +} + + +void +MainGUI::watchCurrentFont() +{ + timer->stop(); + showFont(); +} + + +void +MainGUI::showFont() +{ + // we do lazy computation of FT_Face objects + + if (currentFontIndex < fontList.size()) + { + QString& font = fontList[currentFontIndex]; + QFileInfo fileInfo(font); + QString fontName = fileInfo.fileName(); + + if (fileInfo.exists()) + { + // Qt's file watcher doesn't handle symlinks; + // we thus fall back to polling + if (fileInfo.isSymLink()) + { + fontName.prepend(""); + fontName.append(""); + timer->start(); + } + else + fontWatcher->addPath(font); + } + else + { + // On Unix-like systems, the symlink's target gets opened; this + // implies that deletion of a symlink doesn't make `engine->loadFont' + // fail since it operates on a file handle pointing to the target. + // For this reason, we remove the font to enforce a reload. + engine->removeFont(currentFontIndex); + } + + fontFilenameLabel->setText(fontName); + } + else + fontFilenameLabel->clear(); + + currentNumberOfFaces + = engine->numberOfFaces(currentFontIndex); + currentNumberOfNamedInstances + = engine->numberOfNamedInstances(currentFontIndex, + currentFaceIndex); + currentNumberOfGlyphs + = engine->loadFont(currentFontIndex, + currentFaceIndex, + currentNamedInstanceIndex); + + if (currentNumberOfGlyphs < 0) + { + // there might be various reasons why the current + // (file, face, instance) triplet is invalid or missing; + // we thus start our timer to periodically test + // whether the font starts working + if (currentFontIndex < fontList.size()) + timer->start(); + } + + fontNameLabel->setText(QString("%1 %2") + .arg(engine->currentFamilyName()) + .arg(engine->currentStyleName())); + + checkCurrentFontIndex(); + checkCurrentFaceIndex(); + checkCurrentNamedInstanceIndex(); + checkHinting(); + adjustGlyphIndex(0); + + drawGlyph(); +} + + +void +MainGUI::checkHinting() +{ + if (hintingCheckBox->isChecked()) + { + if (engine->fontType == Engine::FontType_CFF) + { + for (int i = 0; i < hintingModeComboBoxx->count(); i++) + { + if (hintingModesCFFHash.key(i, -1) != -1) + hintingModeComboBoxx->setItemEnabled(i, true); + else + hintingModeComboBoxx->setItemEnabled(i, false); + } + + hintingModeComboBoxx->setCurrentIndex(currentCFFHintingMode); + } + else if (engine->fontType == Engine::FontType_TrueType) + { + for (int i = 0; i < hintingModeComboBoxx->count(); i++) + { + if (hintingModesTrueTypeHash.key(i, -1) != -1) + hintingModeComboBoxx->setItemEnabled(i, true); + else + hintingModeComboBoxx->setItemEnabled(i, false); + } + + hintingModeComboBoxx->setCurrentIndex(currentTTInterpreterVersion); + } + else + { + hintingModeLabel->setEnabled(false); + hintingModeComboBoxx->setEnabled(false); + } + + for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++) + hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i], + false); + + autoHintingCheckBox->setEnabled(true); + checkAutoHinting(); + } + else + { + hintingModeLabel->setEnabled(false); + hintingModeComboBoxx->setEnabled(false); + + autoHintingCheckBox->setEnabled(false); + horizontalHintingCheckBox->setEnabled(false); + verticalHintingCheckBox->setEnabled(false); + blueZoneHintingCheckBox->setEnabled(false); + segmentDrawingCheckBox->setEnabled(false); + warpingCheckBox->setEnabled(false); + + antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, false); + } + + drawGlyph(); +} + + +void +MainGUI::checkHintingMode() +{ + int index = hintingModeComboBoxx->currentIndex(); + + if (engine->fontType == Engine::FontType_CFF) + { + engine->setCFFHintingMode(index); + currentCFFHintingMode = index; + } + else if (engine->fontType == Engine::FontType_TrueType) + { + engine->setTTInterpreterVersion(index); + currentTTInterpreterVersion = index; + } + + // this enforces reloading of the font + showFont(); +} + + +void +MainGUI::checkAutoHinting() +{ + if (autoHintingCheckBox->isChecked()) + { + hintingModeLabel->setEnabled(false); + hintingModeComboBoxx->setEnabled(false); + + horizontalHintingCheckBox->setEnabled(true); + verticalHintingCheckBox->setEnabled(true); + blueZoneHintingCheckBox->setEnabled(true); + segmentDrawingCheckBox->setEnabled(true); + if (engine->haveWarping) + warpingCheckBox->setEnabled(true); + + antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, true); + } + else + { + if (engine->fontType == Engine::FontType_CFF + || engine->fontType == Engine::FontType_TrueType) + { + hintingModeLabel->setEnabled(true); + hintingModeComboBoxx->setEnabled(true); + } + + horizontalHintingCheckBox->setEnabled(false); + verticalHintingCheckBox->setEnabled(false); + blueZoneHintingCheckBox->setEnabled(false); + segmentDrawingCheckBox->setEnabled(false); + warpingCheckBox->setEnabled(false); + + antiAliasingComboBoxx->setItemEnabled(AntiAliasing_Light, false); + + if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_Light) + antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal); + } + + drawGlyph(); +} + + +void +MainGUI::checkAntiAliasing() +{ + int index = antiAliasingComboBoxx->currentIndex(); + + if (index == AntiAliasing_None + || index == AntiAliasing_Normal + || index == AntiAliasing_Light) + { + lcdFilterLabel->setEnabled(false); + lcdFilterComboBox->setEnabled(false); + } + else + { + lcdFilterLabel->setEnabled(true); + lcdFilterComboBox->setEnabled(true); + } + + drawGlyph(); +} + + +void +MainGUI::checkLcdFilter() +{ + int index = lcdFilterComboBox->currentIndex(); + FT_Library_SetLcdFilter(engine->library, lcdFilterHash.key(index)); +} + + +void +MainGUI::checkShowPoints() +{ + if (showPointsCheckBox->isChecked()) + showPointNumbersCheckBox->setEnabled(true); + else + showPointNumbersCheckBox->setEnabled(false); + + drawGlyph(); +} + + +void +MainGUI::checkUnits() +{ + int index = unitsComboBox->currentIndex(); + + if (index == Units_px) + { + dpiLabel->setEnabled(false); + dpiSpinBox->setEnabled(false); + sizeDoubleSpinBox->setSingleStep(1); + sizeDoubleSpinBox->setValue(qRound(sizeDoubleSpinBox->value())); + } + else + { + dpiLabel->setEnabled(true); + dpiSpinBox->setEnabled(true); + sizeDoubleSpinBox->setSingleStep(0.5); + } + + drawGlyph(); +} + + +void +MainGUI::adjustGlyphIndex(int delta) +{ + // only adjust current glyph index if we have a valid font + if (currentNumberOfGlyphs > 0) + { + currentGlyphIndex += delta; + currentGlyphIndex = qBound(0, + currentGlyphIndex, + currentNumberOfGlyphs - 1); + } + + QString upperHex = QString::number(currentGlyphIndex, 16).toUpper(); + glyphIndexLabel->setText(QString("%1 (0x%2)") + .arg(currentGlyphIndex) + .arg(upperHex)); + glyphNameLabel->setText(engine->glyphName(currentGlyphIndex)); + + drawGlyph(); +} + + +void +MainGUI::checkCurrentFontIndex() +{ + if (fontList.size() < 2) + { + previousFontButton->setEnabled(false); + nextFontButton->setEnabled(false); + } + else if (currentFontIndex == 0) + { + previousFontButton->setEnabled(false); + nextFontButton->setEnabled(true); + } + else if (currentFontIndex >= fontList.size() - 1) + { + previousFontButton->setEnabled(true); + nextFontButton->setEnabled(false); + } + else + { + previousFontButton->setEnabled(true); + nextFontButton->setEnabled(true); + } +} + + +void +MainGUI::checkCurrentFaceIndex() +{ + if (currentNumberOfFaces < 2) + { + previousFaceButton->setEnabled(false); + nextFaceButton->setEnabled(false); + } + else if (currentFaceIndex == 0) + { + previousFaceButton->setEnabled(false); + nextFaceButton->setEnabled(true); + } + else if (currentFaceIndex >= currentNumberOfFaces - 1) + { + previousFaceButton->setEnabled(true); + nextFaceButton->setEnabled(false); + } + else + { + previousFaceButton->setEnabled(true); + nextFaceButton->setEnabled(true); + } +} + + +void +MainGUI::checkCurrentNamedInstanceIndex() +{ + if (currentNumberOfNamedInstances < 2) + { + previousNamedInstanceButton->setEnabled(false); + nextNamedInstanceButton->setEnabled(false); + } + else if (currentNamedInstanceIndex == 0) + { + previousNamedInstanceButton->setEnabled(false); + nextNamedInstanceButton->setEnabled(true); + } + else if (currentNamedInstanceIndex >= currentNumberOfNamedInstances - 1) + { + previousNamedInstanceButton->setEnabled(true); + nextNamedInstanceButton->setEnabled(false); + } + else + { + previousNamedInstanceButton->setEnabled(true); + nextNamedInstanceButton->setEnabled(true); + } +} + + +void +MainGUI::previousFont() +{ + if (currentFontIndex > 0) + { + currentFontIndex--; + currentFaceIndex = 0; + currentNamedInstanceIndex = 0; + showFont(); + } +} + + +void +MainGUI::nextFont() +{ + if (currentFontIndex < fontList.size() - 1) + { + currentFontIndex++; + currentFaceIndex = 0; + currentNamedInstanceIndex = 0; + showFont(); + } +} + + +void +MainGUI::previousFace() +{ + if (currentFaceIndex > 0) + { + currentFaceIndex--; + currentNamedInstanceIndex = 0; + showFont(); + } +} + + +void +MainGUI::nextFace() +{ + if (currentFaceIndex < currentNumberOfFaces - 1) + { + currentFaceIndex++; + currentNamedInstanceIndex = 0; + showFont(); + } +} + + +void +MainGUI::previousNamedInstance() +{ + if (currentNamedInstanceIndex > 0) + { + currentNamedInstanceIndex--; + showFont(); + } +} + + +void +MainGUI::nextNamedInstance() +{ + if (currentNamedInstanceIndex < currentNumberOfNamedInstances - 1) + { + currentNamedInstanceIndex++; + showFont(); + } +} + + +void +MainGUI::zoom() +{ + int scale = zoomSpinBox->value(); + + QTransform transform; + transform.scale(scale, scale); + + // we want horizontal and vertical 1px lines displayed with full pixels; + // we thus have to shift the coordinate system accordingly, using a value + // that represents 0.5px (i.e., half the 1px line width) after the scaling + qreal shift = 0.5 / scale; + transform.translate(shift, shift); + + glyphView->setTransform(transform); +} + + +void +MainGUI::setGraphicsDefaults() +{ + // color tables (with suitable opacity values) for converting + // FreeType's pixmaps to something Qt understands + monoColorTable.append(QColor(Qt::transparent).rgba()); + monoColorTable.append(QColor(Qt::black).rgba()); + + for (int i = 0xFF; i >= 0; i--) + grayColorTable.append(qRgba(i, i, i, 0xFF - i)); + + // XXX make this user-configurable + + axisPen.setColor(Qt::black); + axisPen.setWidth(0); + blueZonePen.setColor(QColor(64, 64, 255, 64)); // light blue + blueZonePen.setWidth(0); + gridPen.setColor(Qt::lightGray); + gridPen.setWidth(0); + offPen.setColor(Qt::darkGreen); + offPen.setWidth(3); + onPen.setColor(Qt::red); + onPen.setWidth(3); + outlinePen.setColor(Qt::red); + outlinePen.setWidth(0); + segmentPen.setColor(QColor(64, 255, 128, 64)); // light green + segmentPen.setWidth(0); +} + + +void +MainGUI::drawGlyph() +{ + // the call to `engine->loadOutline' updates FreeType's load flags + + if (!engine) + return; + + if (currentGlyphBitmapItem) + { + glyphScene->removeItem(currentGlyphBitmapItem); + delete currentGlyphBitmapItem; + + currentGlyphBitmapItem = NULL; + } + + if (currentGlyphOutlineItem) + { + glyphScene->removeItem(currentGlyphOutlineItem); + delete currentGlyphOutlineItem; + + currentGlyphOutlineItem = NULL; + } + + if (currentGlyphPointsItem) + { + glyphScene->removeItem(currentGlyphPointsItem); + delete currentGlyphPointsItem; + + currentGlyphPointsItem = NULL; + } + + if (currentGlyphPointNumbersItem) + { + glyphScene->removeItem(currentGlyphPointNumbersItem); + delete currentGlyphPointNumbersItem; + + currentGlyphPointNumbersItem = NULL; + } + + FT_Outline* outline = engine->loadOutline(currentGlyphIndex); + if (outline) + { + if (showBitmapCheckBox->isChecked()) + { + // XXX support LCD + FT_Pixel_Mode pixelMode = FT_PIXEL_MODE_GRAY; + if (antiAliasingComboBoxx->currentIndex() == AntiAliasing_None) + pixelMode = FT_PIXEL_MODE_MONO; + + currentGlyphBitmapItem = new GlyphBitmap(outline, + engine->library, + pixelMode, + monoColorTable, + grayColorTable); + glyphScene->addItem(currentGlyphBitmapItem); + } + + if (showOutlinesCheckBox->isChecked()) + { + currentGlyphOutlineItem = new GlyphOutline(outlinePen, outline); + glyphScene->addItem(currentGlyphOutlineItem); + } + + if (showPointsCheckBox->isChecked()) + { + currentGlyphPointsItem = new GlyphPoints(onPen, offPen, outline); + glyphScene->addItem(currentGlyphPointsItem); + + if (showPointNumbersCheckBox->isChecked()) + { + currentGlyphPointNumbersItem = new GlyphPointNumbers(onPen, + offPen, + outline); + glyphScene->addItem(currentGlyphPointNumbersItem); + } + } + } + + glyphScene->update(); +} + + +// XXX distances are specified in pixels, +// making the layout dependent on the output device resolution +void +MainGUI::createLayout() +{ + // left side + fontFilenameLabel = new QLabel; + + hintingCheckBox = new QCheckBox(tr("Hinting")); + + hintingModeLabel = new QLabel(tr("Hinting Mode")); + hintingModeLabel->setAlignment(Qt::AlignRight); + hintingModeComboBoxx = new QComboBoxx; + hintingModeComboBoxx->insertItem(HintingMode_TrueType_v35, + tr("TrueType v35")); + hintingModeComboBoxx->insertItem(HintingMode_TrueType_v38, + tr("TrueType v38")); + hintingModeComboBoxx->insertItem(HintingMode_TrueType_v40, + tr("TrueType v40")); + hintingModeComboBoxx->insertItem(HintingMode_CFF_FreeType, + tr("CFF (FreeType)")); + hintingModeComboBoxx->insertItem(HintingMode_CFF_Adobe, + tr("CFF (Adobe)")); + hintingModeLabel->setBuddy(hintingModeComboBoxx); + + autoHintingCheckBox = new QCheckBox(tr("Auto-Hinting")); + horizontalHintingCheckBox = new QCheckBox(tr("Horizontal Hinting")); + verticalHintingCheckBox = new QCheckBox(tr("Vertical Hinting")); + blueZoneHintingCheckBox = new QCheckBox(tr("Blue-Zone Hinting")); + segmentDrawingCheckBox = new QCheckBox(tr("Segment Drawing")); + warpingCheckBox = new QCheckBox(tr("Warping")); + + antiAliasingLabel = new QLabel(tr("Anti-Aliasing")); + antiAliasingLabel->setAlignment(Qt::AlignRight); + antiAliasingComboBoxx = new QComboBoxx; + antiAliasingComboBoxx->insertItem(AntiAliasing_None, + tr("None")); + antiAliasingComboBoxx->insertItem(AntiAliasing_Normal, + tr("Normal")); + antiAliasingComboBoxx->insertItem(AntiAliasing_Light, + tr("Light")); + antiAliasingComboBoxx->insertItem(AntiAliasing_LCD, + tr("LCD (RGB)")); + antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_BGR, + tr("LCD (BGR)")); + antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical, + tr("LCD (vert. RGB)")); + antiAliasingComboBoxx->insertItem(AntiAliasing_LCD_Vertical_BGR, + tr("LCD (vert. BGR)")); + antiAliasingLabel->setBuddy(antiAliasingComboBoxx); + + lcdFilterLabel = new QLabel(tr("LCD Filter")); + lcdFilterLabel->setAlignment(Qt::AlignRight); + lcdFilterComboBox = new QComboBox; + lcdFilterComboBox->insertItem(LCDFilter_Default, tr("Default")); + lcdFilterComboBox->insertItem(LCDFilter_Light, tr("Light")); + lcdFilterComboBox->insertItem(LCDFilter_None, tr("None")); + lcdFilterComboBox->insertItem(LCDFilter_Legacy, tr("Legacy")); + lcdFilterLabel->setBuddy(lcdFilterComboBox); + + int width; + // make all labels have the same width + width = hintingModeLabel->minimumSizeHint().width(); + width = qMax(antiAliasingLabel->minimumSizeHint().width(), width); + width = qMax(lcdFilterLabel->minimumSizeHint().width(), width); + hintingModeLabel->setMinimumWidth(width); + antiAliasingLabel->setMinimumWidth(width); + lcdFilterLabel->setMinimumWidth(width); + + // ensure that all items in combo boxes fit completely; + // also make all combo boxes have the same width + width = hintingModeComboBoxx->minimumSizeHint().width(); + width = qMax(antiAliasingComboBoxx->minimumSizeHint().width(), width); + width = qMax(lcdFilterComboBox->minimumSizeHint().width(), width); + hintingModeComboBoxx->setMinimumWidth(width); + antiAliasingComboBoxx->setMinimumWidth(width); + lcdFilterComboBox->setMinimumWidth(width); + + gammaLabel = new QLabel(tr("Gamma")); + gammaLabel->setAlignment(Qt::AlignRight); + gammaSlider = new QSlider(Qt::Horizontal); + gammaSlider->setRange(0, 30); // in 1/10th + gammaSlider->setTickPosition(QSlider::TicksBelow); + gammaSlider->setTickInterval(5); + gammaLabel->setBuddy(gammaSlider); + + showBitmapCheckBox = new QCheckBox(tr("Show Bitmap")); + showPointsCheckBox = new QCheckBox(tr("Show Points")); + showPointNumbersCheckBox = new QCheckBox(tr("Show Point Numbers")); + showOutlinesCheckBox = new QCheckBox(tr("Show Outlines")); + + infoLeftLayout = new QHBoxLayout; + infoLeftLayout->addWidget(fontFilenameLabel); + + hintingModeLayout = new QHBoxLayout; + hintingModeLayout->addWidget(hintingModeLabel); + hintingModeLayout->addWidget(hintingModeComboBoxx); + + horizontalHintingLayout = new QHBoxLayout; + horizontalHintingLayout->addSpacing(20); // XXX px + horizontalHintingLayout->addWidget(horizontalHintingCheckBox); + + verticalHintingLayout = new QHBoxLayout; + verticalHintingLayout->addSpacing(20); // XXX px + verticalHintingLayout->addWidget(verticalHintingCheckBox); + + blueZoneHintingLayout = new QHBoxLayout; + blueZoneHintingLayout->addSpacing(20); // XXX px + blueZoneHintingLayout->addWidget(blueZoneHintingCheckBox); + + segmentDrawingLayout = new QHBoxLayout; + segmentDrawingLayout->addSpacing(20); // XXX px + segmentDrawingLayout->addWidget(segmentDrawingCheckBox); + + warpingLayout = new QHBoxLayout; + warpingLayout->addSpacing(20); // XXX px + warpingLayout->addWidget(warpingCheckBox); + + antiAliasingLayout = new QHBoxLayout; + antiAliasingLayout->addWidget(antiAliasingLabel); + antiAliasingLayout->addWidget(antiAliasingComboBoxx); + + lcdFilterLayout = new QHBoxLayout; + lcdFilterLayout->addWidget(lcdFilterLabel); + lcdFilterLayout->addWidget(lcdFilterComboBox); + + gammaLayout = new QHBoxLayout; + gammaLayout->addWidget(gammaLabel); + gammaLayout->addWidget(gammaSlider); + + pointNumbersLayout = new QHBoxLayout; + pointNumbersLayout->addSpacing(20); // XXX px + pointNumbersLayout->addWidget(showPointNumbersCheckBox); + + generalTabLayout = new QVBoxLayout; + generalTabLayout->addWidget(hintingCheckBox); + generalTabLayout->addLayout(hintingModeLayout); + generalTabLayout->addWidget(autoHintingCheckBox); + generalTabLayout->addLayout(horizontalHintingLayout); + generalTabLayout->addLayout(verticalHintingLayout); + generalTabLayout->addLayout(blueZoneHintingLayout); + generalTabLayout->addLayout(segmentDrawingLayout); + generalTabLayout->addLayout(warpingLayout); + generalTabLayout->addSpacing(20); // XXX px + generalTabLayout->addStretch(1); + generalTabLayout->addLayout(antiAliasingLayout); + generalTabLayout->addLayout(lcdFilterLayout); + generalTabLayout->addSpacing(20); // XXX px + generalTabLayout->addStretch(1); + generalTabLayout->addLayout(gammaLayout); + generalTabLayout->addSpacing(20); // XXX px + generalTabLayout->addStretch(1); + generalTabLayout->addWidget(showBitmapCheckBox); + generalTabLayout->addWidget(showPointsCheckBox); + generalTabLayout->addLayout(pointNumbersLayout); + generalTabLayout->addWidget(showOutlinesCheckBox); + + generalTabWidget = new QWidget; + generalTabWidget->setLayout(generalTabLayout); + + mmgxTabWidget = new QWidget; + + tabWidget = new QTabWidget; + tabWidget->addTab(generalTabWidget, tr("General")); + tabWidget->addTab(mmgxTabWidget, tr("MM/GX")); + + leftLayout = new QVBoxLayout; + leftLayout->addLayout(infoLeftLayout); + leftLayout->addWidget(tabWidget); + + // we don't want to expand the left side horizontally; + // to change the policy we have to use a widget wrapper + leftWidget = new QWidget; + leftWidget->setLayout(leftLayout); + + QSizePolicy leftWidgetPolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + leftWidgetPolicy.setHorizontalStretch(0); + leftWidgetPolicy.setVerticalPolicy(leftWidget->sizePolicy().verticalPolicy()); + leftWidgetPolicy.setHeightForWidth(leftWidget->sizePolicy().hasHeightForWidth()); + + leftWidget->setSizePolicy(leftWidgetPolicy); + + // right side + glyphIndexLabel = new QLabel; + glyphNameLabel = new QLabel; + fontNameLabel = new QLabel; + + glyphScene = new QGraphicsScene; + glyphScene->addItem(new Grid(gridPen, axisPen)); + + currentGlyphBitmapItem = NULL; + currentGlyphOutlineItem = NULL; + currentGlyphPointsItem = NULL; + currentGlyphPointNumbersItem = NULL; + drawGlyph(); + + glyphView = new QGraphicsViewx; + glyphView->setRenderHint(QPainter::Antialiasing, true); + glyphView->setDragMode(QGraphicsView::ScrollHandDrag); + glyphView->setOptimizationFlags(QGraphicsView::DontSavePainterState); + glyphView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); + glyphView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse); + glyphView->setScene(glyphScene); + + sizeLabel = new QLabel(tr("Size ")); + sizeLabel->setAlignment(Qt::AlignRight); + sizeDoubleSpinBox = new QDoubleSpinBox; + sizeDoubleSpinBox->setAlignment(Qt::AlignRight); + sizeDoubleSpinBox->setDecimals(1); + sizeDoubleSpinBox->setRange(1, 500); + sizeLabel->setBuddy(sizeDoubleSpinBox); + + unitsComboBox = new QComboBox; + unitsComboBox->insertItem(Units_px, "px"); + unitsComboBox->insertItem(Units_pt, "pt"); + + dpiLabel = new QLabel(tr("DPI ")); + dpiLabel->setAlignment(Qt::AlignRight); + dpiSpinBox = new QSpinBox; + dpiSpinBox->setAlignment(Qt::AlignRight); + dpiSpinBox->setRange(10, 600); + dpiLabel->setBuddy(dpiSpinBox); + + toStartButtonx = new QPushButtonx("|<"); + toM1000Buttonx = new QPushButtonx("-1000"); + toM100Buttonx = new QPushButtonx("-100"); + toM10Buttonx = new QPushButtonx("-10"); + toM1Buttonx = new QPushButtonx("-1"); + toP1Buttonx = new QPushButtonx("+1"); + toP10Buttonx = new QPushButtonx("+10"); + toP100Buttonx = new QPushButtonx("+100"); + toP1000Buttonx = new QPushButtonx("+1000"); + toEndButtonx = new QPushButtonx(">|"); + + zoomLabel = new QLabel(tr("Zoom Factor")); + zoomLabel->setAlignment(Qt::AlignRight); + zoomSpinBox = new QSpinBoxx; + zoomSpinBox->setAlignment(Qt::AlignRight); + zoomSpinBox->setRange(1, 1000 - 1000 % 64); + zoomSpinBox->setKeyboardTracking(false); + zoomLabel->setBuddy(zoomSpinBox); + + previousFontButton = new QPushButton(tr("Previous Font")); + nextFontButton = new QPushButton(tr("Next Font")); + previousFaceButton = new QPushButton(tr("Previous Face")); + nextFaceButton = new QPushButton(tr("Next Face")); + previousNamedInstanceButton = new QPushButton(tr("Previous Named Instance")); + nextNamedInstanceButton = new QPushButton(tr("Next Named Instance")); + + infoRightLayout = new QGridLayout; + infoRightLayout->addWidget(glyphIndexLabel, 0, 0); + infoRightLayout->addWidget(glyphNameLabel, 0, 1); + infoRightLayout->addWidget(fontNameLabel, 0, 2); + + navigationLayout = new QHBoxLayout; + navigationLayout->setSpacing(0); + navigationLayout->addStretch(1); + navigationLayout->addWidget(toStartButtonx); + navigationLayout->addWidget(toM1000Buttonx); + navigationLayout->addWidget(toM100Buttonx); + navigationLayout->addWidget(toM10Buttonx); + navigationLayout->addWidget(toM1Buttonx); + navigationLayout->addWidget(toP1Buttonx); + navigationLayout->addWidget(toP10Buttonx); + navigationLayout->addWidget(toP100Buttonx); + navigationLayout->addWidget(toP1000Buttonx); + navigationLayout->addWidget(toEndButtonx); + navigationLayout->addStretch(1); + + sizeLayout = new QHBoxLayout; + sizeLayout->addStretch(2); + sizeLayout->addWidget(sizeLabel); + sizeLayout->addWidget(sizeDoubleSpinBox); + sizeLayout->addWidget(unitsComboBox); + sizeLayout->addStretch(1); + sizeLayout->addWidget(dpiLabel); + sizeLayout->addWidget(dpiSpinBox); + sizeLayout->addStretch(1); + sizeLayout->addWidget(zoomLabel); + sizeLayout->addWidget(zoomSpinBox); + sizeLayout->addStretch(2); + + fontLayout = new QGridLayout; + fontLayout->setColumnStretch(0, 2); + fontLayout->addWidget(nextFontButton, 0, 1); + fontLayout->addWidget(previousFontButton, 1, 1); + fontLayout->setColumnStretch(2, 1); + fontLayout->addWidget(nextFaceButton, 0, 3); + fontLayout->addWidget(previousFaceButton, 1, 3); + fontLayout->setColumnStretch(4, 1); + fontLayout->addWidget(nextNamedInstanceButton, 0, 5); + fontLayout->addWidget(previousNamedInstanceButton, 1, 5); + fontLayout->setColumnStretch(6, 2); + + rightLayout = new QVBoxLayout; + rightLayout->addLayout(infoRightLayout); + rightLayout->addWidget(glyphView); + rightLayout->addLayout(navigationLayout); + rightLayout->addSpacing(10); // XXX px + rightLayout->addLayout(sizeLayout); + rightLayout->addSpacing(10); // XXX px + rightLayout->addLayout(fontLayout); + + // for symmetry with the left side use a widget also + rightWidget = new QWidget; + rightWidget->setLayout(rightLayout); + + // the whole thing + ftinspectLayout = new QHBoxLayout; + ftinspectLayout->addWidget(leftWidget); + ftinspectLayout->addWidget(rightWidget); + + ftinspectWidget = new QWidget; + ftinspectWidget->setLayout(ftinspectLayout); + setCentralWidget(ftinspectWidget); + setWindowTitle("ftinspect"); +} + + +void +MainGUI::createConnections() +{ + connect(hintingCheckBox, SIGNAL(clicked()), + SLOT(checkHinting())); + + connect(hintingModeComboBoxx, SIGNAL(currentIndexChanged(int)), + SLOT(checkHintingMode())); + connect(antiAliasingComboBoxx, SIGNAL(currentIndexChanged(int)), + SLOT(checkAntiAliasing())); + connect(lcdFilterComboBox, SIGNAL(currentIndexChanged(int)), + SLOT(checkLcdFilter())); + + connect(autoHintingCheckBox, SIGNAL(clicked()), + SLOT(checkAutoHinting())); + connect(showBitmapCheckBox, SIGNAL(clicked()), + SLOT(drawGlyph())); + connect(showPointsCheckBox, SIGNAL(clicked()), + SLOT(checkShowPoints())); + connect(showPointNumbersCheckBox, SIGNAL(clicked()), + SLOT(drawGlyph())); + connect(showOutlinesCheckBox, SIGNAL(clicked()), + SLOT(drawGlyph())); + + connect(sizeDoubleSpinBox, SIGNAL(valueChanged(double)), + SLOT(drawGlyph())); + connect(unitsComboBox, SIGNAL(currentIndexChanged(int)), + SLOT(checkUnits())); + connect(dpiSpinBox, SIGNAL(valueChanged(int)), + SLOT(drawGlyph())); + + connect(zoomSpinBox, SIGNAL(valueChanged(int)), + SLOT(zoom())); + + connect(previousFontButton, SIGNAL(clicked()), + SLOT(previousFont())); + connect(nextFontButton, SIGNAL(clicked()), + SLOT(nextFont())); + connect(previousFaceButton, SIGNAL(clicked()), + SLOT(previousFace())); + connect(nextFaceButton, SIGNAL(clicked()), + SLOT(nextFace())); + connect(previousNamedInstanceButton, SIGNAL(clicked()), + SLOT(previousNamedInstance())); + connect(nextNamedInstanceButton, SIGNAL(clicked()), + SLOT(nextNamedInstance())); + + glyphNavigationMapper = new QSignalMapper; + connect(glyphNavigationMapper, SIGNAL(mapped(int)), + SLOT(adjustGlyphIndex(int))); + + connect(toStartButtonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toM1000Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toM100Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toM10Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toM1Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toP1Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toP10Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toP100Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toP1000Buttonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + connect(toEndButtonx, SIGNAL(clicked()), + glyphNavigationMapper, SLOT(map())); + + glyphNavigationMapper->setMapping(toStartButtonx, -0x10000); + glyphNavigationMapper->setMapping(toM1000Buttonx, -1000); + glyphNavigationMapper->setMapping(toM100Buttonx, -100); + glyphNavigationMapper->setMapping(toM10Buttonx, -10); + glyphNavigationMapper->setMapping(toM1Buttonx, -1); + glyphNavigationMapper->setMapping(toP1Buttonx, 1); + glyphNavigationMapper->setMapping(toP10Buttonx, 10); + glyphNavigationMapper->setMapping(toP100Buttonx, 100); + glyphNavigationMapper->setMapping(toP1000Buttonx, 1000); + glyphNavigationMapper->setMapping(toEndButtonx, 0x10000); + + connect(fontWatcher, SIGNAL(fileChanged(const QString&)), + SLOT(watchCurrentFont())); + connect(timer, SIGNAL(timeout()), + SLOT(watchCurrentFont())); +} + + +void +MainGUI::createActions() +{ + loadFontsAct = new QAction(tr("&Load Fonts"), this); + loadFontsAct->setShortcuts(QKeySequence::Open); + connect(loadFontsAct, SIGNAL(triggered()), SLOT(loadFonts())); + + closeFontAct = new QAction(tr("&Close Font"), this); + closeFontAct->setShortcuts(QKeySequence::Close); + connect(closeFontAct, SIGNAL(triggered()), SLOT(closeFont())); + + exitAct = new QAction(tr("E&xit"), this); + exitAct->setShortcuts(QKeySequence::Quit); + connect(exitAct, SIGNAL(triggered()), SLOT(close())); + + aboutAct = new QAction(tr("&About"), this); + connect(aboutAct, SIGNAL(triggered()), SLOT(about())); + + aboutQtAct = new QAction(tr("About &Qt"), this); + connect(aboutQtAct, SIGNAL(triggered()), SLOT(aboutQt())); +} + + +void +MainGUI::createMenus() +{ + menuFile = menuBar()->addMenu(tr("&File")); + menuFile->addAction(loadFontsAct); + menuFile->addAction(closeFontAct); + menuFile->addAction(exitAct); + + menuHelp = menuBar()->addMenu(tr("&Help")); + menuHelp->addAction(aboutAct); + menuHelp->addAction(aboutQtAct); +} + + +void +MainGUI::createStatusBar() +{ + statusBar()->showMessage(""); +} + + +void +MainGUI::clearStatusBar() +{ + statusBar()->clearMessage(); + statusBar()->setStyleSheet(""); +} + + +void +MainGUI::setDefaults() +{ + // set up mappings between property values and combo box indices + hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_35] = HintingMode_TrueType_v35; + hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_38] = HintingMode_TrueType_v38; + hintingModesTrueTypeHash[TT_INTERPRETER_VERSION_40] = HintingMode_TrueType_v40; + + hintingModesCFFHash[FT_CFF_HINTING_FREETYPE] = HintingMode_CFF_FreeType; + hintingModesCFFHash[FT_CFF_HINTING_ADOBE] = HintingMode_CFF_Adobe; + + lcdFilterHash[FT_LCD_FILTER_DEFAULT] = LCDFilter_Default; + lcdFilterHash[FT_LCD_FILTER_LIGHT] = LCDFilter_Light; + lcdFilterHash[FT_LCD_FILTER_NONE] = LCDFilter_None; + lcdFilterHash[FT_LCD_FILTER_LEGACY] = LCDFilter_Legacy; + + // make copies and remove existing elements... + QHash hmTTHash = hintingModesTrueTypeHash; + if (hmTTHash.contains(engine->ttInterpreterVersionDefault)) + hmTTHash.remove(engine->ttInterpreterVersionDefault); + if (hmTTHash.contains(engine->ttInterpreterVersionOther)) + hmTTHash.remove(engine->ttInterpreterVersionOther); + if (hmTTHash.contains(engine->ttInterpreterVersionOther1)) + hmTTHash.remove(engine->ttInterpreterVersionOther1); + + QHash hmCFFHash = hintingModesCFFHash; + if (hmCFFHash.contains(engine->cffHintingEngineDefault)) + hmCFFHash.remove(engine->cffHintingEngineDefault); + if (hmCFFHash.contains(engine->cffHintingEngineOther)) + hmCFFHash.remove(engine->cffHintingEngineOther); + + // ... to construct a list of always disabled hinting mode combo box items + hintingModesAlwaysDisabled = hmTTHash.values(); + hintingModesAlwaysDisabled += hmCFFHash.values(); + + for (int i = 0; i < hintingModesAlwaysDisabled.size(); i++) + hintingModeComboBoxx->setItemEnabled(hintingModesAlwaysDisabled[i], + false); + + // the next four values always non-negative + currentFontIndex = 0; + currentFaceIndex = 0; + currentNamedInstanceIndex = 0; + currentGlyphIndex = 0; + + currentCFFHintingMode + = hintingModesCFFHash[engine->cffHintingEngineDefault]; + currentTTInterpreterVersion + = hintingModesTrueTypeHash[engine->ttInterpreterVersionDefault]; + + hintingCheckBox->setChecked(true); + + antiAliasingComboBoxx->setCurrentIndex(AntiAliasing_Normal); + lcdFilterComboBox->setCurrentIndex(LCDFilter_Light); + + horizontalHintingCheckBox->setChecked(true); + verticalHintingCheckBox->setChecked(true); + blueZoneHintingCheckBox->setChecked(true); + + showBitmapCheckBox->setChecked(true); + showOutlinesCheckBox->setChecked(true); + + gammaSlider->setValue(18); // 1.8 + sizeDoubleSpinBox->setValue(20); + dpiSpinBox->setValue(96); + zoomSpinBox->setValue(20); + + checkHinting(); + checkHintingMode(); + checkAutoHinting(); + checkAntiAliasing(); + checkLcdFilter(); + checkShowPoints(); + checkUnits(); + checkCurrentFontIndex(); + checkCurrentFaceIndex(); + checkCurrentNamedInstanceIndex(); + adjustGlyphIndex(0); + zoom(); +} + + +void +MainGUI::readSettings() +{ + QSettings settings; +// QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); +// QSize size = settings.value("size", QSize(400, 400)).toSize(); +// resize(size); +// move(pos); +} + + +void +MainGUI::writeSettings() +{ + QSettings settings; +// settings.setValue("pos", pos()); +// settings.setValue("size", size()); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// QGraphicsViewx +// +///////////////////////////////////////////////////////////////////////////// + +QGraphicsViewx::QGraphicsViewx() +: lastBottomLeftPointInitialized(false) +{ + // empty +} + + +void +QGraphicsViewx::scrollContentsBy(int dx, + int dy) +{ + QGraphicsView::scrollContentsBy(dx, dy); + lastBottomLeftPoint = viewport()->rect().bottomLeft(); +} + + +void +QGraphicsViewx::resizeEvent(QResizeEvent* event) +{ + QGraphicsView::resizeEvent(event); + + // XXX I don't know how to properly initialize this value, + // thus the hack with the boolean + if (!lastBottomLeftPointInitialized) + { + lastBottomLeftPoint = viewport()->rect().bottomLeft(); + lastBottomLeftPointInitialized = true; + } + + QPointF currentBottomLeftPoint = viewport()->rect().bottomLeft(); + int verticalPosition = verticalScrollBar()->value(); + verticalScrollBar()->setValue(static_cast( + verticalPosition + - (currentBottomLeftPoint.y() + - lastBottomLeftPoint.y()))); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// QSpinBoxx +// +///////////////////////////////////////////////////////////////////////////// + +// we want to mark the center of a pixel square with a single dot or a small +// cross; starting with a certain magnification we thus only use even values +// so that we can do that symmetrically + +int +QSpinBoxx::valueFromText(const QString& text) const +{ + int val = QSpinBox::valueFromText(text); + + if (val > 640) + val = val - (val % 64); + else if (val > 320) + val = val - (val % 32); + else if (val > 160) + val = val - (val % 16); + else if (val > 80) + val = val - (val % 8); + else if (val > 40) + val = val - (val % 4); + else if (val > 20) + val = val - (val % 2); + + return val; +} + + +void +QSpinBoxx::stepBy(int steps) +{ + int val = value(); + + if (steps > 0) + { + for (int i = 0; i < steps; i++) + { + if (val >= 640) + val = val + 64; + else if (val >= 320) + val = val + 32; + else if (val >= 160) + val = val + 16; + else if (val >= 80) + val = val + 8; + else if (val >= 40) + val = val + 4; + else if (val >= 20) + val = val + 2; + else + val++; + } + } + else if (steps < 0) + { + for (int i = 0; i < -steps; i++) + { + if (val > 640) + val = val - 64; + else if (val > 320) + val = val - 32; + else if (val > 160) + val = val - 16; + else if (val > 80) + val = val - 8; + else if (val > 40) + val = val - 4; + else if (val > 20) + val = val - 2; + else + val--; + } + } + + setValue(val); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// QComboBoxx +// +///////////////////////////////////////////////////////////////////////////// + +void +QComboBoxx::setItemEnabled(int index, + bool enable) +{ + const QStandardItemModel* itemModel = + qobject_cast(model()); + QStandardItem* item = itemModel->item(index); + + if (enable) + { + item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + item->setData(QVariant(), + Qt::TextColorRole); + } + else + { + item->setFlags(item->flags() + & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled)); + // clear item data in order to use default color; + // this visually greys out the item + item->setData(palette().color(QPalette::Disabled, QPalette::Text), + Qt::TextColorRole); + } +} + + +///////////////////////////////////////////////////////////////////////////// +// +// QPushButtonx +// +///////////////////////////////////////////////////////////////////////////// + +// code derived from Qt 4.8.7, function `QPushButton::sizeHint', +// file `src/gui/widgets/qpushbutton.cpp' + +QPushButtonx::QPushButtonx(const QString &text, + QWidget *parent) +: QPushButton(text, parent) +{ + QStyleOptionButton opt; + opt.initFrom(this); + QString s(this->text()); + QFontMetrics fm = fontMetrics(); + QSize sz = fm.size(Qt::TextShowMnemonic, s); + opt.rect.setSize(sz); + + sz = style()->sizeFromContents(QStyle::CT_PushButton, + &opt, + sz, + this); + setFixedWidth(sz.width()); +} + + +///////////////////////////////////////////////////////////////////////////// +// +// main +// +///////////////////////////////////////////////////////////////////////////// + +int +main(int argc, + char** argv) +{ + QApplication app(argc, argv); + app.setApplicationName("ftinspect"); + app.setApplicationVersion(VERSION); + app.setOrganizationName("FreeType"); + app.setOrganizationDomain("freetype.org"); + + MainGUI gui; + Engine engine(&gui); + + gui.update(&engine); + gui.setDefaults(); + + gui.show(); + + return app.exec(); +} + + +// end of ftinspect.cpp diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftinspect.h freetype-2.8/=unpacked-tar2=/src/ftinspect.h --- freetype-2.7.1/=unpacked-tar2=/src/ftinspect.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftinspect.h 2017-05-11 17:48:55.000000000 +0000 @@ -0,0 +1,563 @@ +// ftinspect.h + +#ifndef FTINSPECT_H_ +#define FTINSPECT_H_ + +#include +#include FT_FREETYPE_H +#include FT_CACHE_H +#include FT_CFF_DRIVER_H +#include FT_LCD_FILTER_H +#include FT_MODULE_H +#include FT_OUTLINE_H +#include FT_TRUETYPE_DRIVER_H + +// internal FreeType header files; only available in the source code bundle +#include FT_INTERNAL_DRIVER_H +#include FT_INTERNAL_OBJECTS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class MainGUI; + + +// This structure is used to map the (font, face, instance) index triplet to +// abstract IDs (generated by a running number stored in MainGUI's +// `faceCounter' member). +// +// Qt's `QMap' class needs an implementation of the `<' operator. + +struct FaceID +{ + int fontIndex; + int faceIndex; + int namedInstanceIndex; + + FaceID(); + FaceID(int, int, int); + bool operator<(const FaceID& other) const; +}; + + +// FreeType specific data. + +class Engine +{ +public: + Engine(MainGUI*); + ~Engine(); + + const QString& currentFamilyName(); + const QString& currentStyleName(); + QString glyphName(int); + int numberOfFaces(int); + int numberOfNamedInstances(int, int); + int loadFont(int, int, int); // returns number of glyphs + FT_Outline* loadOutline(int); + void removeFont(int); + void setCFFHintingMode(int); + void setTTInterpreterVersion(int); + void update(); + + friend class MainGUI; + friend FT_Error faceRequester(FTC_FaceID, + FT_Library, + FT_Pointer, + FT_Face*); + + // XXX cover all available modules + enum FontType + { + FontType_CFF, + FontType_TrueType, + FontType_Other + }; + +private: + MainGUI* gui; + + int faceCounter; // a running number used to initialize `faceIDMap' + QMap faceIDMap; + + QString curFamilyName; + QString curStyleName; + + FT_Library library; + FTC_Manager cacheManager; + FTC_ImageCache imageCache; + FTC_SBitCache sbitsCache; + + FTC_ScalerRec scaler; + FT_Size ftSize; + + int cffHintingEngineDefault; + int cffHintingEngineOther; + + int ttInterpreterVersionDefault; + int ttInterpreterVersionOther; + int ttInterpreterVersionOther1; + + int fontType; + + int haveWarping; + + double pointSize; + double pixelSize; + unsigned int dpi; + + bool doHinting; + bool doAutoHinting; + bool doHorizontalHinting; + bool doVerticalHinting; + bool doBlueZoneHinting; + bool showSegments; + bool doWarping; + + double gamma; + + unsigned long loadFlags; +}; + + +class Grid +: public QGraphicsItem +{ +public: + Grid(const QPen&, + const QPen&); + QRectF boundingRect() const; + void paint(QPainter*, + const QStyleOptionGraphicsItem*, + QWidget*); + +private: + QPen gridPen; + QPen axisPen; +}; + + +class GlyphOutline +: public QGraphicsItem +{ +public: + GlyphOutline(const QPen&, + FT_Outline*); + QRectF boundingRect() const; + void paint(QPainter*, + const QStyleOptionGraphicsItem*, + QWidget*); + +private: + QPen outlinePen; + FT_Outline* outline; + QRectF bRect; +}; + + +class GlyphPoints +: public QGraphicsItem +{ +public: + GlyphPoints(const QPen&, + const QPen&, + FT_Outline*); + QRectF boundingRect() const; + void paint(QPainter*, + const QStyleOptionGraphicsItem*, + QWidget*); + +private: + QPen onPen; + QPen offPen; + FT_Outline* outline; + QRectF bRect; +}; + + +class GlyphPointNumbers +: public QGraphicsItem +{ +public: + GlyphPointNumbers(const QPen&, + const QPen&, + FT_Outline*); + QRectF boundingRect() const; + void paint(QPainter*, + const QStyleOptionGraphicsItem*, + QWidget*); + +private: + QPen onPen; + QPen offPen; + FT_Outline* outline; + QRectF bRect; +}; + + +class GlyphBitmap +: public QGraphicsItem +{ +public: + GlyphBitmap(FT_Outline*, + FT_Library, + FT_Pixel_Mode, + const QVector&, + const QVector&); + ~GlyphBitmap(); + QRectF boundingRect() const; + void paint(QPainter*, + const QStyleOptionGraphicsItem*, + QWidget*); + +private: + FT_Outline transformed; + FT_Library library; + unsigned char pixelMode; + const QVector& monoColorTable; + const QVector& grayColorTable; + QRectF bRect; +}; + + +// we want to anchor the view at the bottom left corner +// while the windows gets resized +class QGraphicsViewx +: public QGraphicsView +{ + Q_OBJECT + +public: + QGraphicsViewx(); + +protected: + void resizeEvent(QResizeEvent*); + void scrollContentsBy(int, int); + +private: + QPointF lastBottomLeftPoint; + bool lastBottomLeftPointInitialized; +}; + + +// we want to have our own `stepBy' function for the zoom spin box +class QSpinBoxx +: public QSpinBox +{ + Q_OBJECT + +public: + void stepBy(int); + int valueFromText(const QString&) const; +}; + + +// we want to grey out items in a combo box; +// since Qt doesn't provide a function for this we derive a class +class QComboBoxx +: public QComboBox +{ + Q_OBJECT + +public: + void setItemEnabled(int, bool); +}; + + +// we want buttons that are horizontally as small as possible +class QPushButtonx +: public QPushButton +{ + Q_OBJECT + +public: + QPushButtonx(const QString&, QWidget* = 0); + virtual ~QPushButtonx(){} +}; + + +class MainGUI +: public QMainWindow +{ + Q_OBJECT + +public: + MainGUI(); + ~MainGUI(); + + void setDefaults(); + void update(Engine*); + + friend class Engine; + friend FT_Error faceRequester(FTC_FaceID, + FT_Library, + FT_Pointer, + FT_Face*); + +protected: + void closeEvent(QCloseEvent*); + +private slots: + void about(); + void aboutQt(); + void adjustGlyphIndex(int); + void checkAntiAliasing(); + void checkAutoHinting(); + void checkCurrentFaceIndex(); + void checkCurrentFontIndex(); + void checkCurrentNamedInstanceIndex(); + void checkHinting(); + void checkHintingMode(); + void checkLcdFilter(); + void checkShowPoints(); + void checkUnits(); + void closeFont(); + void drawGlyph(); + void loadFonts(); + void nextFace(); + void nextFont(); + void nextNamedInstance(); + void previousFace(); + void previousFont(); + void previousNamedInstance(); + void watchCurrentFont(); + void zoom(); + +private: + Engine* engine; + + QStringList fontList; + int currentFontIndex; + + int currentNumberOfFaces; + int currentFaceIndex; + + int currentNumberOfNamedInstances; + int currentNamedInstanceIndex; + + int currentNumberOfGlyphs; + int currentGlyphIndex; + + int currentCFFHintingMode; + int currentTTInterpreterVersion; + + // layout related stuff + GlyphOutline *currentGlyphOutlineItem; + GlyphPoints *currentGlyphPointsItem; + GlyphPointNumbers *currentGlyphPointNumbersItem; + GlyphBitmap *currentGlyphBitmapItem; + + QAction *aboutAct; + QAction *aboutQtAct; + QAction *closeFontAct; + QAction *exitAct; + QAction *loadFontsAct; + + QCheckBox *autoHintingCheckBox; + QCheckBox *blueZoneHintingCheckBox; + QCheckBox *hintingCheckBox; + QCheckBox *horizontalHintingCheckBox; + QCheckBox *segmentDrawingCheckBox; + QCheckBox *showBitmapCheckBox; + QCheckBox *showOutlinesCheckBox; + QCheckBox *showPointNumbersCheckBox; + QCheckBox *showPointsCheckBox; + QCheckBox *verticalHintingCheckBox; + QCheckBox *warpingCheckBox; + + QComboBoxx *antiAliasingComboBoxx; + QComboBoxx *hintingModeComboBoxx; + QComboBox *lcdFilterComboBox; + QComboBox *unitsComboBox; + + QDoubleSpinBox *sizeDoubleSpinBox; + + QFileSystemWatcher *fontWatcher; + + QGraphicsScene *glyphScene; + QGraphicsViewx *glyphView; + + QGridLayout *fontLayout; + QGridLayout *infoRightLayout; + + QHash hintingModesTrueTypeHash; + QHash hintingModesCFFHash; + QHash lcdFilterHash; + + QHBoxLayout *antiAliasingLayout; + QHBoxLayout *blueZoneHintingLayout; + QHBoxLayout *ftinspectLayout; + QHBoxLayout *gammaLayout; + QHBoxLayout *hintingModeLayout; + QHBoxLayout *horizontalHintingLayout; + QHBoxLayout *infoLeftLayout; + QHBoxLayout *lcdFilterLayout; + QHBoxLayout *navigationLayout; + QHBoxLayout *pointNumbersLayout; + QHBoxLayout *segmentDrawingLayout; + QHBoxLayout *sizeLayout; + QHBoxLayout *verticalHintingLayout; + QHBoxLayout *warpingLayout; + + QLabel *antiAliasingLabel; + QLabel *dpiLabel; + QLabel *fontFilenameLabel; + QLabel *fontNameLabel; + QLabel *gammaLabel; + QLabel *glyphIndexLabel; + QLabel *glyphNameLabel; + QLabel *hintingModeLabel; + QLabel *lcdFilterLabel; + QLabel *sizeLabel; + QLabel *zoomLabel; + + QList hintingModesAlwaysDisabled; + + QLocale *locale; + + QMenu *menuFile; + QMenu *menuHelp; + + QPen axisPen; + QPen blueZonePen; + QPen gridPen; + QPen offPen; + QPen onPen; + QPen outlinePen; + QPen segmentPen; + + QPushButton *nextFaceButton; + QPushButton *nextFontButton; + QPushButton *nextNamedInstanceButton; + QPushButton *previousFaceButton; + QPushButton *previousFontButton; + QPushButton *previousNamedInstanceButton; + + QPushButtonx *toEndButtonx; + QPushButtonx *toM1000Buttonx; + QPushButtonx *toM100Buttonx; + QPushButtonx *toM10Buttonx; + QPushButtonx *toM1Buttonx; + QPushButtonx *toP1000Buttonx; + QPushButtonx *toP100Buttonx; + QPushButtonx *toP10Buttonx; + QPushButtonx *toP1Buttonx; + QPushButtonx *toStartButtonx; + + QSignalMapper *glyphNavigationMapper; + + QSlider *gammaSlider; + + QSpinBox *dpiSpinBox; + QSpinBoxx *zoomSpinBox; + + QTabWidget *tabWidget; + + QTimer *timer; + + QVBoxLayout *generalTabLayout; + QVBoxLayout *leftLayout; + QVBoxLayout *rightLayout; + + QVector grayColorTable; + QVector monoColorTable; + + QWidget *ftinspectWidget; + QWidget *generalTabWidget; + QWidget *leftWidget; + QWidget *rightWidget; + QWidget *mmgxTabWidget; + + enum AntiAliasing + { + AntiAliasing_None, + AntiAliasing_Normal, + AntiAliasing_Light, + AntiAliasing_LCD, + AntiAliasing_LCD_BGR, + AntiAliasing_LCD_Vertical, + AntiAliasing_LCD_Vertical_BGR + }; + enum HintingMode + { + HintingMode_TrueType_v35, + HintingMode_TrueType_v38, + HintingMode_TrueType_v40, + HintingMode_CFF_FreeType, + HintingMode_CFF_Adobe, + }; + enum LCDFilter + { + LCDFilter_Default, + LCDFilter_Light, + LCDFilter_None, + LCDFilter_Legacy + }; + enum Units + { + Units_px, + Units_pt + }; + + void createActions(); + void createConnections(); + void createLayout(); + void createMenus(); + void clearStatusBar(); + void createStatusBar(); + void readSettings(); + void setGraphicsDefaults(); + void showFont(); + void writeSettings(); +}; + + +#endif // FTINSPECT_H_ + + +// end of ftinspect.h diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftinspect.pro freetype-2.8/=unpacked-tar2=/src/ftinspect.pro --- freetype-2.7.1/=unpacked-tar2=/src/ftinspect.pro 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftinspect.pro 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,28 @@ +QMAKE_CXXFLAGS += -isystem ../../freetype2/include + +# To avoid conflicts with the FreeType version compiled into or used by Qt, +# we use the static library. +# +# You should adapt this to your setup. +unix|macx { + LIBS += ../../freetype2/objs/.libs/libfreetype.a + + CONFIG += link_pkgconfig + PKGCONFIG += libpng harfbuzz zlib bzip2 +} +win32 { + LIBS += ../../freetyp2/objs/vc2010/freetype28.lib + LIBS += -lpng -lharfbuzz -lz -lbz2 -lm +} + +CONFIG += qt debug + +# we need access to internal FreeType header files +DEFINES += FT2_BUILD_LIBRARY + +SOURCES += ftinspect.cpp +HEADERS += ftinspect.h + +TARGET = ftinspect + +QT += widgets diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftlint.1 freetype-2.8/=unpacked-tar2=/src/ftlint.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftlint.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftlint.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,27 @@ +.TH FTLINT 1 "May 2017" "Freetype 2.8" +. +. +.SH NAME +. +ftlint \- simple font tester +. +. +.SH SYNOPSIS +. +.B ftlint +.I ppem +.IR fontname [ .ttf | .ttc "] .\|.\|." +. +. +.SH DESCRIPTION +. +.B ftlint +opens the given font(s), loads and renders all glyphs at the given ppem +value, and reports failing glyphs if there are less than ten fails, or the +number of fails only if there are more fails. +. +.PP +This program does not have any options. +It is part of the FreeType demos package. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftlint.c freetype-2.8/=unpacked-tar2=/src/ftlint.c --- freetype-2.7.1/=unpacked-tar2=/src/ftlint.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftlint.c 2015-10-09 07:14:19.000000000 +0000 @@ -0,0 +1,202 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality font engine */ +/* */ +/* Copyright 1996-1998, 2001, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* ftlint: a simple font tester. This program tries to load all the */ +/* glyphs of a given font. */ +/* */ +/* NOTE: This is just a test program that is used to show off and */ +/* debug the current engine. */ +/* */ +/****************************************************************************/ + +#include +#include FT_FREETYPE_H + +#include +#include +#include + + +#define xxTEST_PSNAMES + + + static FT_Error error; + + static FT_Library library; + static FT_Face face; + + static unsigned int num_glyphs; + static int ptsize; + + static int Fail; + + + static void + Usage( char* name ) + { + printf( "ftlint: simple font tester -- part of the FreeType project\n" ); + printf( "----------------------------------------------------------\n" ); + printf( "\n" ); + printf( "Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n", name ); + printf( "\n" ); + + exit( 1 ); + } + + + static void + Panic( const char* message ) + { + fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); + exit(1); + } + + + int + main( int argc, + char** argv ) + { + int i, file_index; + unsigned int id; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + char* fname; + + + execname = argv[0]; + + if ( argc < 3 ) + Usage( execname ); + + if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) + Usage( execname ); + + error = FT_Init_FreeType( &library ); + if (error) Panic( "Could not create library object" ); + + /* Now check all files */ + for ( file_index = 2; file_index < argc; file_index++ ) + { + fname = argv[file_index]; + + /* try to open the file with no extra extension first */ + error = FT_New_Face( library, fname, 0, &face ); + if (!error) + { + printf( "%s: ", fname ); + goto Success; + } + + + if ( error == FT_Err_Unknown_File_Format ) + { + printf( "unknown format\n" ); + continue; + } + + /* ok, we could not load the file, try to add an extension to */ + /* its name if possible.. */ + + i = (int)strlen( fname ); + while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) + { + if ( fname[i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, fname, 1024 ); + strncpy( alt_filename, fname, 1024 ); + +#ifndef macintosh + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } +#endif + i = (int)strlen( filename ); + fname = filename; + + while ( i >= 0 ) +#ifndef macintosh + if ( filename[i] == '/' || filename[i] == '\\' ) +#else + if ( filename[i] == ':' ) +#endif + { + fname = filename + i + 1; + i = -1; + } + else + i--; + + printf( "%s: ", fname ); + + /* Load face */ + error = FT_New_Face( library, filename, 0, &face ); + if (error) + { + if (error == FT_Err_Unknown_File_Format) + printf( "unknown format\n" ); + else + printf( "could not find/open file (error: %d)\n", error ); + continue; + } + if (error) Panic( "Could not open file" ); + + Success: + num_glyphs = (unsigned int)face->num_glyphs; + +#ifdef TEST_PSNAMES + { + const char* ps_name = FT_Get_Postscript_Name( face ); + + printf( "[%s] ", ps_name ? ps_name : "." ); + } +#endif + + error = FT_Set_Char_Size( face, ptsize << 6, ptsize << 6, 72, 72 ); + if (error) Panic( "Could not set character size" ); + + Fail = 0; + { + for ( id = 0; id < num_glyphs; id++ ) + { + error = FT_Load_Glyph( face, id, FT_LOAD_DEFAULT ); + if (error) + { + if ( Fail < 10 ) + printf( "glyph %4u: 0x%04x\n" , id, error ); + Fail++; + } + } + } + + if ( Fail == 0 ) + printf( "OK.\n" ); + else + if ( Fail == 1 ) + printf( "1 fail.\n" ); + else + printf( "%d fails.\n", Fail ); + + FT_Done_Face( face ); + } + + FT_Done_FreeType(library); + exit( 0 ); /* for safety reasons */ + + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftmemchk.c freetype-2.8/=unpacked-tar2=/src/ftmemchk.c --- freetype-2.7.1/=unpacked-tar2=/src/ftmemchk.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftmemchk.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,346 @@ +/* ftmemchk.c */ + +#include +#include FT_FREETYPE_H +#include FT_MODULE_H +#include +#include +#include + + FT_Error error; + + FT_Library library; + FT_Face face; + + unsigned int num_glyphs; + int ptsize; + + int Fail; + int Num; + + + + +/****************************************************************************/ +/****************************************************************************/ +/****************************************************************************/ +/****************************************************************************/ + +/* Our own memory allocator. To check that a single block isn't freed */ +/* several time, we simply do not call "free".. */ + +#define MAX_RECORDED_BLOCKS 1638400 +#define CHECK_DUPLICATES + +typedef struct MyBlock +{ + void* base; + long size; + +} MyBlock; + +static MyBlock my_blocks[ MAX_RECORDED_BLOCKS ]; +static int num_my_blocks = 0; + + +/* record a new block in the table, check for duplicates too */ +static +void record_my_block( void* base, long size ) +{ + if (size <= 0) + { + fprintf( stderr, "adding a block with non-positive length - should not happen \n" ); + exit(1); + } + + if ( num_my_blocks < MAX_RECORDED_BLOCKS ) + { + MyBlock* block; + +#ifdef CHECK_DUPLICATES + MyBlock* limit; + block = my_blocks; + limit = block + num_my_blocks; + for ( ; block < limit; block++ ) + { + if ( block->base == base && block->size != 0 ) + { + fprintf( stderr, "duplicate memory block at %08lx\n", (long)block->base ); + exit(1); + } + } +#endif + + block = my_blocks + num_my_blocks++; + block->base = base; + block->size = size; + } + else + { + fprintf( stderr, "Too many memory blocks -- test exited !!\n" ); + exit(1); + } +} + +/* forget a block, and check that it isn't part of our table already */ +static +void forget_my_block( void* base ) +{ + MyBlock* block = my_blocks + num_my_blocks-1; + + /* we scan in reverse, because transient blocks are always located */ + /* at the end of the table.. (it supposedly faster then..) */ + for ( ; block >= my_blocks; block-- ) + { + if ( block->base == base ) + { + if (block->size > 0) + { + block->size = 0; + return; + } + else + { + fprintf( stderr, "Block at %p released twice \n", base ); + exit(1); + } + } + } + fprintf( stderr, "Trying to release an unallocated block at %p\n", + base ); + exit(1); +} + + +FT_CALLBACK_DEF( void* ) my_alloc( FT_Memory memory, + long size ) +{ + void* p = malloc(size); + if (p) + record_my_block(p,size); + + memory=memory; + return p; +} + + +FT_CALLBACK_DEF( void ) my_free( FT_Memory memory, + void* block ) +{ + memory=memory; + forget_my_block(block); + /* free(block); WE DO NOT REALLY FREE THE BLOCK */ +} + + +FT_CALLBACK_DEF( void* ) my_realloc( FT_Memory memory, + long cur_size, + long new_size, + void* block ) +{ + void* p; + + p = my_alloc( memory, new_size ); + if (p) + { + long size; + + size = cur_size; + if (new_size < size) + size = new_size; + + memcpy( p, block, size ); + my_free( memory, block ); + } + + return p; +} + + + +static FT_Memory my_memory( void ) +{ + FT_Memory memory; + + memory = (FT_Memory)my_alloc( 0, sizeof(*memory) ); + if (!memory) + { + fprintf( stderr, "Unable to allocate debug memory manager !?!\n" ); + exit(2); + } + + memory->user = 0; + memory->alloc = my_alloc; + memory->free = my_free; + memory->realloc = my_realloc; + + return memory; +} + +static void dump_mem( void ) +{ + MyBlock* block = my_blocks + num_my_blocks-1; + int bad = 0; + + printf( "total allocated blocks = %d\n", num_my_blocks ); + + /* we scan in reverse, because transient blocks are always located */ + /* at the end of the table.. (it supposedly faster then..) */ + for ( ; block >= my_blocks; block-- ) + { + if (block->size > 0) + { + fprintf( stderr, "%p (%6ld bytes) leaked !!\n", block->base, (long)block->size ); + bad = 1; + } + } + if (!bad) + fprintf( stderr, "no leaked memory block\n\n" ); +} + +/****************************************************************************/ +/****************************************************************************/ +/****************************************************************************/ +/****************************************************************************/ + + + static void Usage( char* name ) + { + printf( "ftmemchk: simple memory tester -- part of the FreeType project\n" ); + printf( "--------------------------------------------------------------\n" ); + printf( "\n" ); + printf( "Usage: %s ppem fontname[.ttf|.ttc] [fontname2..]\n", name ); + printf( "\n" ); + + exit( 1 ); + } + + + static void Panic( const char* message ) + { + fprintf( stderr, "%s\n error code = 0x%04x\n", message, error ); + exit(1); + } + + +int main( int argc, char** argv ) +{ + int i, file_index; + unsigned int id; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + char* fname; + + execname = argv[0]; + + if ( argc < 3 ) + Usage( execname ); + + if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) + Usage( execname ); + + /* Create a new library with our own memory manager */ + error = FT_New_Library( my_memory(), &library ); + if (error) Panic( "Could not create library object" ); + + /* the new library has no drivers in it, add the default ones */ + /* (implemented in ftinit.c).. */ + FT_Add_Default_Modules(library); + + + /* Now check all files */ + for ( file_index = 2; file_index < argc; file_index++ ) + { + fname = argv[file_index]; + i = strlen( fname ); + while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) + { + if ( fname[i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, fname, 1024 ); + strncpy( alt_filename, fname, 1024 ); + +#ifndef macintosh + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } +#endif + i = strlen( filename ); + fname = filename; + + while ( i >= 0 ) +#ifndef macintosh + if ( filename[i] == '/' || filename[i] == '\\' ) +#else + if ( filename[i] == ':' ) +#endif + { + fname = filename + i + 1; + i = -1; + } + else + i--; + + printf( "%s: ", fname ); + + /* Load face */ + error = FT_New_Face( library, filename, 0, &face ); + if (error) + { + if (error == FT_Err_Invalid_File_Format) + printf( "unknown format\n" ); + else + printf( "could not find/open file (error: %d)\n", error ); + continue; + } + if (error) Panic( "Could not open file" ); + + num_glyphs = face->num_glyphs; + + error = FT_Set_Char_Size( face, ptsize << 6, ptsize << 6, 72, 72 ); + if (error) Panic( "Could not set character size" ); + + Fail = 0; + { + for ( id = 0; id < num_glyphs; id++ ) + { + error = FT_Load_Glyph( face, id, FT_LOAD_RENDER ); + if (error) + { + if ( Fail < 10 ) + printf( "glyph %4u: 0x%04x\n" , id, error ); + Fail++; + } + } + } + + if ( Fail == 0 ) + printf( "OK.\n" ); + else + if ( Fail == 1 ) + printf( "1 fail.\n" ); + else + printf( "%d fails.\n", Fail ); + + FT_Done_Face( face ); + } + + FT_Done_FreeType(library); + + dump_mem(); + + exit( 0 ); /* for safety reasons */ + return 0; /* never reached */ +} + + + diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftmulti.1 freetype-2.8/=unpacked-tar2=/src/ftmulti.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftmulti.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftmulti.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,80 @@ +.TH FTMULTI 1 "May 2017" "Freetype 2.8" +. +. +.SH NAME +. +ftmulti \- multiple masters font viewer +. +. +.SH SYNOPSIS +. +.B ftmulti +.RI [ options ] +.I pt +.IR fontname \ .\|.\|. +. +. +.SH DESCRIPTION +. +.B ftmulti +is an interactive viewer for multiple masters and GX fonts. +. +.TP +.B pt +The point size for the given resolution. +If resolution is 72dpi, this directly gives the ppem value (pixels per EM). +. +.TP +.B font +The font file(s) to display. +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI \-w \ w +Set the window width to +.I w +pixels (default: 640px). +. +.TP +.BI \-h \ h +Set the window height to +.I h +pixels (default: 480px). +. +.TP +.BI \-e \ encoding +Specify encoding tag (default: no encoding). +Common values: +.B unic +(Unicode), +.B symb +(symbol), +.B ADOB +(Adobe standard), +.B ADBC +(Adobe custom). +. +.TP +.BI \-r \ r +Use resolution +.I r +dpi (default: 72 dpi). +. +.TP +.BI \-f \ index +Specify first glyph index to display. +. +.TP +.BI "\-d\ \(dq" "axis1\ axis2\ .\|.\|." \(dq +Specify the design coordinates for each Multiple Master axis at start-up. +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftmulti.c freetype-2.8/=unpacked-tar2=/src/ftmulti.c --- freetype-2.7.1/=unpacked-tar2=/src/ftmulti.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftmulti.c 2017-04-09 19:26:32.000000000 +0000 @@ -0,0 +1,1155 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2000, 2003-2005, 2010-2014 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* FTMulti- a simple multiple masters font viewer */ +/* */ +/* Press ? when running this program to have a list of key-bindings */ +/* */ +/****************************************************************************/ + +#include +#include FT_FREETYPE_H +#include FT_FONT_FORMATS_H +#include FT_MODULE_H +#include FT_TRUETYPE_DRIVER_H +#include FT_CFF_DRIVER_H +#include FT_MULTIPLE_MASTERS_H + +#include "common.h" +#include "mlgetopt.h" + +#include +#include +#include +#include + +#include "graph.h" +#include "grfont.h" + +#define DIM_X 640 +#define DIM_Y 480 + +#define MAXPTSIZE 500 /* dtp */ +#define MAX_MM_AXES 6 + +#define N_CFF_HINTING_ENGINES 2 + + + static char Header[256]; + static char* new_header = NULL; + + static const unsigned char* Text = (unsigned char*) + "The quick brown fox jumps over the lazy dog 0123456789 " + "\342\352\356\373\364\344\353\357\366\374\377\340\371\351\350\347 " + "&#~\"\'(-`_^@)=+\260 ABCDEFGHIJKLMNOPQRSTUVWXYZ " + "$\243^\250*\265\371%!\247:/;.,?<>"; + + static FT_Library library; /* the FreeType library */ + static FT_Face face; /* the font face */ + static FT_Size size; /* the font size */ + static FT_GlyphSlot glyph; /* the glyph slot */ + + static unsigned long encoding = FT_ENCODING_NONE; + + static unsigned int cff_hinting_engine; + static unsigned int tt_interpreter_versions[3]; + static unsigned int num_tt_interpreter_versions; + static unsigned int tt_interpreter_version_idx; + + static const char* font_format; + + static FT_Error error; /* error returned by FreeType? */ + + static grSurface* surface; /* current display surface */ + static grBitmap bit; /* current display bitmap */ + + static int width = DIM_X; /* window width */ + static int height = DIM_Y; /* window height */ + + static int num_glyphs; /* number of glyphs */ + static int ptsize; /* current point size */ + + static int hinted = 1; /* is glyph hinting active? */ + static int antialias = 1; /* is anti-aliasing active? */ + static int use_sbits = 1; /* do we use embedded bitmaps? */ + static int Num; /* current first glyph index */ + + static int res = 72; + + static grColor fore_color = { 255 }; + + static int Fail; + + static int graph_init = 0; + + static int render_mode = 1; + + static FT_MM_Var *multimaster = NULL; + static FT_Fixed design_pos [MAX_MM_AXES]; + static FT_Fixed requested_pos[MAX_MM_AXES]; + static unsigned int requested_cnt = 0; + static unsigned int used_num_axis = 0; + + +#define DEBUGxxx + +#ifdef DEBUG +#define LOG( x ) LogMessage##x +#else +#define LOG( x ) /* empty */ +#endif + + +#ifdef DEBUG + static void + LogMessage( const char* fmt, ... ) + { + va_list ap; + + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + } +#endif + + + /* PanicZ */ + static void + PanicZ( const char* message ) + { + fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); + exit( 1 ); + } + + + static unsigned long + make_tag( char *s ) + { + int i; + unsigned long l = 0; + + + for ( i = 0; i < 4; i++ ) + { + if ( !s[i] ) + break; + l <<= 8; + l += (unsigned long)s[i]; + } + + return l; + } + + + static void + parse_design_coords( char *s ) + { + for ( requested_cnt = 0; requested_cnt < MAX_MM_AXES && *s; + requested_cnt++ ) + { + requested_pos[requested_cnt] = (FT_Fixed)( strtod( s, &s ) * 65536.0 ); + + while ( *s==' ' ) + ++s; + } + } + + + /* Clears the Bit bitmap/pixmap */ + static void + Clear_Display( void ) + { + long bitmap_size = (long)bit.pitch * bit.rows; + + + if ( bitmap_size < 0 ) + bitmap_size = -bitmap_size; + memset( bit.buffer, 0, (unsigned long)bitmap_size ); + } + + + /* Initialize the display bitmap named `bit' */ + static void + Init_Display( void ) + { + grInitDevices(); + + bit.mode = gr_pixel_mode_gray; + bit.width = width; + bit.rows = height; + bit.grays = 256; + + surface = grNewSurface( 0, &bit ); + if ( !surface ) + PanicZ( "could not allocate display surface\n" ); + + graph_init = 1; + } + + + /* Render a single glyph with the `grays' component */ + static FT_Error + Render_Glyph( int x_offset, + int y_offset ) + { + grBitmap bit3; + FT_Pos x_top, y_top; + + + /* first, render the glyph image into a bitmap */ + if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) + { + error = FT_Render_Glyph( glyph, antialias ? FT_RENDER_MODE_NORMAL + : FT_RENDER_MODE_MONO ); + if ( error ) + return error; + } + + /* now blit it to our display screen */ + bit3.rows = (int)glyph->bitmap.rows; + bit3.width = (int)glyph->bitmap.width; + bit3.pitch = glyph->bitmap.pitch; + bit3.buffer = glyph->bitmap.buffer; + + switch ( glyph->bitmap.pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + bit3.mode = gr_pixel_mode_mono; + bit3.grays = 0; + break; + + case FT_PIXEL_MODE_GRAY: + bit3.mode = gr_pixel_mode_gray; + bit3.grays = glyph->bitmap.num_grays; + } + + /* Then, blit the image to the target surface */ + x_top = x_offset + glyph->bitmap_left; + y_top = y_offset - glyph->bitmap_top; + + grBlitGlyphToBitmap( &bit, &bit3, x_top, y_top, fore_color ); + + return 0; + } + + + static void + Reset_Scale( int pointSize ) + { + (void)FT_Set_Char_Size( face, + pointSize << 6, pointSize << 6, + (FT_UInt)res, (FT_UInt)res ); + } + + + static FT_Error + LoadChar( unsigned int idx, + int hint ) + { + int flags; + + + flags = FT_LOAD_DEFAULT; + + if ( !hint ) + flags |= FT_LOAD_NO_HINTING; + + if ( !use_sbits ) + flags |= FT_LOAD_NO_BITMAP; + + return FT_Load_Glyph( face, idx, flags ); + } + + + static FT_Error + Render_All( unsigned int first_glyph, + int pt_size ) + { + FT_F26Dot6 start_x, start_y, step_y, x, y; + unsigned int i; + + + start_x = 4; + start_y = pt_size + ( used_num_axis > MAX_MM_AXES / 2 ? 52 : 44 ); + + step_y = size->metrics.y_ppem + 10; + + x = start_x; + y = start_y; + + i = first_glyph; + +#if 0 + while ( i < first_glyph + 1 ) +#else + while ( i < (unsigned int)num_glyphs ) +#endif + { + if ( !( error = LoadChar( i, hinted ) ) ) + { +#ifdef DEBUG + if ( i <= first_glyph + 6 ) + { + LOG(( "metrics[%02d] = [%x %x]\n", + i, + glyph->metrics.horiBearingX, + glyph->metrics.horiAdvance )); + + if ( i == first_glyph + 6 ) + LOG(( "-------------------------\n" )); + } +#endif + + Render_Glyph( x, y ); + + x += ( ( glyph->metrics.horiAdvance + 32 ) >> 6 ) + 1; + + if ( x + size->metrics.x_ppem > bit.width ) + { + x = start_x; + y += step_y; + + if ( y >= bit.rows ) + return FT_Err_Ok; + } + } + else + Fail++; + + i++; + } + + return FT_Err_Ok; + } + + + static FT_Error + Render_Text( unsigned int first_glyph, + int pt_size ) + { + FT_F26Dot6 start_x, start_y, step_y, x, y; + unsigned int i; + + const unsigned char* p; + + + start_x = 4; + start_y = pt_size + ( used_num_axis > MAX_MM_AXES / 2 ? 52 : 44 ); + + step_y = size->metrics.y_ppem + 10; + + x = start_x; + y = start_y; + + i = first_glyph; + p = Text; + while ( i > 0 && *p ) + { + p++; + i--; + } + + while ( *p ) + { + if ( !( error = LoadChar( FT_Get_Char_Index( face, + (unsigned char)*p ), + hinted ) ) ) + { +#ifdef DEBUG + if ( i <= first_glyph + 6 ) + { + LOG(( "metrics[%02d] = [%x %x]\n", + i, + glyph->metrics.horiBearingX, + glyph->metrics.horiAdvance )); + + if ( i == first_glyph + 6 ) + LOG(( "-------------------------\n" )); + } +#endif + + Render_Glyph( x, y ); + + x += ( ( glyph->metrics.horiAdvance + 32 ) >> 6 ) + 1; + + if ( x + size->metrics.x_ppem > bit.width ) + { + x = start_x; + y += step_y; + + if ( y >= bit.rows ) + return FT_Err_Ok; + } + } + else + Fail++; + + i++; + p++; + } + + return FT_Err_Ok; + } + + + static void + Help( void ) + { + char buf[256]; + char version[64]; + + const char* format; + FT_Int major, minor, patch; + + grEvent dummy_event; + + + FT_Library_Version( library, &major, &minor, &patch ); + + format = patch ? "%d.%d.%d" : "%d.%d"; + sprintf( version, format, major, minor, patch ); + + Clear_Display(); + grSetLineHeight( 10 ); + grGotoxy( 0, 0 ); + grSetMargin( 2, 1 ); + grGotobitmap( &bit ); + + sprintf( buf, + "FreeType MM Glyph Viewer - part of the FreeType %s test suite", + version ); + + grWriteln( buf ); + grLn(); + grWriteln( "This program displays all glyphs from one or several" ); + grWriteln( "Multiple Masters or GX font files, with the FreeType library." ); + grLn(); + grWriteln( "Use the following keys:"); + grLn(); + grWriteln( "? display this help screen" ); + grWriteln( "a toggle anti-aliasing" ); + grWriteln( "h toggle outline hinting" ); + grWriteln( "b toggle embedded bitmaps" ); + grWriteln( "space toggle rendering mode" ); + grLn(); + grWriteln( "p, n previous/next font" ); + grLn(); + grWriteln( "H cycle through hinting engines (if available)" ); + grLn(); + grWriteln( "Up, Down change pointsize by 1 unit" ); + grWriteln( "PgUp, PgDn change pointsize by 10 units" ); + grLn(); + grWriteln( "Left, Right adjust index by 1" ); + grWriteln( "F7, F8 adjust index by 10" ); + grWriteln( "F9, F10 adjust index by 100" ); + grWriteln( "F11, F12 adjust index by 1000" ); + grLn(); + grWriteln( "F1, F2 adjust first axis by 1/50th of its range" ); + grWriteln( "F3, F4 adjust second axis by 1/50th of its range" ); + grWriteln( "F5, F6 adjust third axis by 1/50th of its range" ); + grWriteln( "1, 2 adjust fourth axis by 1/50th of its range" ); + grWriteln( "3, 4 adjust fifth axis by 1/50th of its range" ); + grWriteln( "5, 6 adjust sixth axis by 1/50th of its range" ); + grLn(); + grLn(); + grWriteln( "press any key to exit this help screen" ); + + grRefreshSurface( surface ); + grListenSurface( surface, gr_event_key, &dummy_event ); + } + + + static void + cff_hinting_engine_change( int delta ) + { + int new_cff_hinting_engine = 0; + + + if ( delta ) + new_cff_hinting_engine = + ( (int)cff_hinting_engine + + delta + + N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; + + error = FT_Property_Set( library, + "cff", + "hinting-engine", + &new_cff_hinting_engine ); + if ( !error ) + cff_hinting_engine = (FT_UInt)new_cff_hinting_engine; + } + + + static void + tt_interpreter_version_change( void ) + { + tt_interpreter_version_idx += 1; + tt_interpreter_version_idx %= num_tt_interpreter_versions; + + FT_Property_Set( library, + "truetype", + "interpreter-version", + &tt_interpreter_versions[tt_interpreter_version_idx] ); + } + + + static int + Process_Event( grEvent* event ) + { + int i; + unsigned int axis; + + + switch ( event->key ) + { + case grKeyEsc: /* ESC or q */ + case grKEY( 'q' ): + return 0; + + case grKEY( '?' ): + Help(); + return 1; + + /* mode keys */ + + case grKEY( 'a' ): + antialias = !antialias; + new_header = antialias ? (char *)"anti-aliasing is now on" + : (char *)"anti-aliasing is now off"; + return 1; + + case grKEY( 'b' ): + use_sbits = !use_sbits; + new_header = use_sbits + ? (char *)"embedded bitmaps are now used if available" + : (char *)"embedded bitmaps are now ignored"; + return 1; + + case grKEY( 'n' ): + case grKEY( 'p' ): + return (int)event->key; + + case grKEY( 'h' ): + hinted = !hinted; + new_header = hinted ? (char *)"glyph hinting is now active" + : (char *)"glyph hinting is now ignored"; + break; + + case grKEY( ' ' ): + render_mode ^= 1; + new_header = render_mode ? (char *)"rendering all glyphs in font" + : (char *)"rendering test text string"; + break; + + case grKEY( 'H' ): + if ( !strcmp( font_format, "CFF" ) ) + cff_hinting_engine_change( 1 ); + else if ( !strcmp( font_format, "TrueType" ) ) + tt_interpreter_version_change(); + break; + + /* MM related keys */ + + case grKeyF1: + i = -20; + axis = 0; + goto Do_Axis; + + case grKeyF2: + i = 20; + axis = 0; + goto Do_Axis; + + case grKeyF3: + i = -20; + axis = 1; + goto Do_Axis; + + case grKeyF4: + i = 20; + axis = 1; + goto Do_Axis; + + case grKeyF5: + i = -20; + axis = 2; + goto Do_Axis; + + case grKeyF6: + i = 20; + axis = 2; + goto Do_Axis; + + case grKEY( '1' ): + i = -20; + axis = 3; + goto Do_Axis; + + case grKEY( '2' ): + i = 20; + axis = 3; + goto Do_Axis; + + case grKEY( '3' ): + i = -20; + axis = 4; + goto Do_Axis; + + case grKEY( '4' ): + i = 20; + axis = 4; + goto Do_Axis; + + case grKEY( '5' ): + i = -20; + axis = 5; + goto Do_Axis; + + case grKEY( '6' ): + i = 20; + axis = 5; + goto Do_Axis; + + /* scaling related keys */ + + case grKeyPageUp: + i = 10; + goto Do_Scale; + + case grKeyPageDown: + i = -10; + goto Do_Scale; + + case grKeyUp: + i = 1; + goto Do_Scale; + + case grKeyDown: + i = -1; + goto Do_Scale; + + /* glyph index related keys */ + + case grKeyLeft: + i = -1; + goto Do_Glyph; + + case grKeyRight: + i = 1; + goto Do_Glyph; + + case grKeyF7: + i = -10; + goto Do_Glyph; + + case grKeyF8: + i = 10; + goto Do_Glyph; + + case grKeyF9: + i = -100; + goto Do_Glyph; + + case grKeyF10: + i = 100; + goto Do_Glyph; + + case grKeyF11: + i = -1000; + goto Do_Glyph; + + case grKeyF12: + i = 1000; + goto Do_Glyph; + + default: + ; + } + return 1; + + Do_Axis: + if ( axis < used_num_axis ) + { + FT_Var_Axis* a = multimaster->axis + axis; + FT_Fixed pos = design_pos[axis]; + + + /* + * Normalize i. Changing by 20 is all very well for PostScript fonts, + * which tend to have a range of ~1000 per axis, but it's not useful + * for mac fonts, which have a range of ~3. And it's rather extreme + * for optical size even in PS. + */ + pos += FT_MulDiv( i, a->maximum - a->minimum, 1000 ); + if ( pos < a->minimum ) + pos = a->minimum; + if ( pos > a->maximum ) + pos = a->maximum; + + design_pos[axis] = pos; + + /* for MM fonts, round the design coordinates to integers, */ + /* otherwise round to two decimal digits to make the PS name short */ + if ( !FT_IS_SFNT( face ) ) + design_pos[axis] = FT_RoundFix( design_pos[axis] ); + else + { + double x; + + + x = design_pos[axis] / 65536.0 * 100.0; + x += x < 0.0 ? -0.5 : 0.5; + x = (int)x; + x = x / 100.0 * 65536.0; + x += x < 0.0 ? -0.5 : 0.5; + + design_pos[axis] = (int)x; + } + + FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos ); + } + return 1; + + Do_Scale: + ptsize += i; + if ( ptsize < 1 ) + ptsize = 1; + if ( ptsize > MAXPTSIZE ) + ptsize = MAXPTSIZE; + return 1; + + Do_Glyph: + Num += i; + if ( Num < 0 ) + Num = 0; + if ( Num >= num_glyphs ) + Num = num_glyphs - 1; + return 1; + } + + + static void + usage( char* execname ) + { + fprintf( stderr, + "\n" + "ftmulti: multiple masters font viewer - part of FreeType\n" + "--------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] pt font ...\n" + "\n", + execname ); + fprintf( stderr, + " pt The point size for the given resolution.\n" + " If resolution is 72dpi, this directly gives the\n" + " ppem value (pixels per EM).\n" ); + fprintf( stderr, + " font The font file(s) to display.\n" + "\n" ); + fprintf( stderr, + " -w W Set window width to W pixels (default: %dpx).\n" + " -h H Set window height to H pixels (default: %dpx).\n" + "\n", + DIM_X, DIM_Y ); + fprintf( stderr, + " -e encoding Specify encoding tag (default: no encoding).\n" + " Common values: `unic' (Unicode), `symb' (symbol),\n" + " `ADOB' (Adobe standard), `ADBC' (Adobe custom).\n" + " -r R Use resolution R dpi (default: 72dpi).\n" + " -f index Specify first glyph index to display.\n" + " -d \"axis1 axis2 ...\"\n" + " Specify the design coordinates for each\n" + " Multiple Master axis at start-up.\n" + "\n" + " -v Show version." + "\n" ); + + exit( 1 ); + } + + + int + main( int argc, + char* argv[] ) + { + int old_ptsize, orig_ptsize, file; + int first_glyph = 0; + int XisSetup = 0; + char* execname; + int option; + int file_loaded; + + unsigned int n; + + grEvent event; + + unsigned int dflt_tt_interpreter_version; + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + + + execname = ft_basename( argv[0] ); + + /* Initialize engine */ + error = FT_Init_FreeType( &library ); + if ( error ) + PanicZ( "Could not initialize FreeType library" ); + + /* get the default value as compiled into FreeType */ + FT_Property_Get( library, + "cff", + "hinting-engine", &cff_hinting_engine ); + + /* collect all available versions, then set again the default */ + FT_Property_Get( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( n = 0; n < 3; n++ ) + { + error = FT_Property_Set( library, + "truetype", + "interpreter-version", &versions[n] ); + if ( !error ) + tt_interpreter_versions[ + num_tt_interpreter_versions++] = versions[n]; + if ( versions[n] == dflt_tt_interpreter_version ) + tt_interpreter_version_idx = n; + } + FT_Property_Set( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + + while ( 1 ) + { + option = getopt( argc, argv, "d:e:f:h:r:vw:" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'd': + parse_design_coords( optarg ); + break; + + case 'e': + encoding = make_tag( optarg ); + break; + + case 'f': + first_glyph = atoi( optarg ); + break; + + case 'h': + height = atoi( optarg ); + if ( height < 1 ) + usage( execname ); + break; + + case 'r': + res = atoi( optarg ); + if ( res < 1 ) + usage( execname ); + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( library, &major, &minor, &patch ); + + printf( "ftmulti (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + case 'w': + width = atoi( optarg ); + if ( width < 1 ) + usage( execname ); + break; + + default: + usage( execname ); + break; + } + } + + argc -= optind; + argv += optind; + + if ( argc <= 1 ) + usage( execname ); + + if ( sscanf( argv[0], "%d", &orig_ptsize ) != 1 ) + orig_ptsize = 64; + + file = 1; + + NewFile: + ptsize = orig_ptsize; + hinted = 1; + file_loaded = 0; + + /* Load face */ + error = FT_New_Face( library, argv[file], 0, &face ); + if ( error ) + { + face = NULL; + goto Display_Font; + } + + font_format = FT_Get_Font_Format( face ); + + if ( encoding != FT_ENCODING_NONE ) + { + error = FT_Select_Charmap( face, (FT_Encoding)encoding ); + if ( error ) + goto Display_Font; + } + + /* retrieve multiple master information */ + error = FT_Get_MM_Var( face, &multimaster ); + if ( error ) + { + multimaster = NULL; + goto Display_Font; + } + + /* if the user specified a position, use it, otherwise */ + /* set the current position to the median of each axis */ + if ( multimaster->num_axis > MAX_MM_AXES ) + { + fprintf( stderr, "only handling first %d GX axes (of %d)\n", + MAX_MM_AXES, multimaster->num_axis ); + used_num_axis = MAX_MM_AXES; + } + else + used_num_axis = multimaster->num_axis; + + for ( n = 0; n < used_num_axis; n++ ) + { + design_pos[n] = n < requested_cnt ? requested_pos[n] + : multimaster->axis[n].def; + if ( design_pos[n] < multimaster->axis[n].minimum ) + design_pos[n] = multimaster->axis[n].minimum; + else if ( design_pos[n] > multimaster->axis[n].maximum ) + design_pos[n] = multimaster->axis[n].maximum; + + /* for MM fonts, round the design coordinates to integers */ + if ( !FT_IS_SFNT( face ) ) + design_pos[n] = FT_RoundFix( design_pos[n] ); + } + + error = FT_Set_Var_Design_Coordinates( face, used_num_axis, design_pos ); + if ( error ) + goto Display_Font; + + file_loaded++; + + Reset_Scale( ptsize ); + + num_glyphs = face->num_glyphs; + glyph = face->glyph; + size = face->size; + + Display_Font: + /* initialize graphics if needed */ + if ( !XisSetup ) + { + XisSetup = 1; + Init_Display(); + } + + grSetTitle( surface, "FreeType Glyph Viewer - press ? for help" ); + old_ptsize = ptsize; + + if ( file_loaded >= 1 ) + { + Fail = 0; + Num = first_glyph; + + if ( Num >= num_glyphs ) + Num = num_glyphs - 1; + + if ( Num < 0 ) + Num = 0; + } + + for ( ;; ) + { + int key; + + + Clear_Display(); + + if ( file_loaded >= 1 ) + { + switch ( render_mode ) + { + case 0: + Render_Text( (unsigned int)Num, ptsize ); + break; + + default: + Render_All( (unsigned int)Num, ptsize ); + } + + sprintf( Header, "%.50s %.50s (file %.100s)", + face->family_name, + face->style_name, + ft_basename( argv[file] ) ); + + if ( !new_header ) + new_header = Header; + + grWriteCellString( &bit, 0, 0, new_header, fore_color ); + new_header = NULL; + + sprintf( Header, "PS name: %s", + FT_Get_Postscript_Name( face ) ); + grWriteCellString( &bit, 0, 16, Header, fore_color ); + + sprintf( Header, "axes:" ); + { + unsigned int limit = used_num_axis > MAX_MM_AXES / 2 + ? MAX_MM_AXES / 2 + : used_num_axis; + + + for ( n = 0; n < limit; n++ ) + { + char temp[100]; + + + sprintf( temp, " %.50s: %.02f", + multimaster->axis[n].name, + design_pos[n] / 65536.0 ); + strncat( Header, temp, + sizeof ( Header ) - strlen( Header ) - 1 ); + } + } + grWriteCellString( &bit, 0, 24, Header, fore_color ); + + if ( used_num_axis > MAX_MM_AXES / 2 ) + { + unsigned int limit = used_num_axis; + + + sprintf( Header, " " ); + + for ( n = MAX_MM_AXES / 2; n < limit; n++ ) + { + char temp[100]; + + + sprintf( temp, " %.50s: %.02f", + multimaster->axis[n].name, + design_pos[n] / 65536.0 ); + strncat( Header, temp, + sizeof ( Header ) - strlen( Header ) - 1 ); + } + + grWriteCellString( &bit, 0, 32, Header, fore_color ); + } + + { + unsigned int tt_ver = tt_interpreter_versions[ + tt_interpreter_version_idx]; + + + sprintf( Header, "at %d points, first glyph = %d, format = %s", + ptsize, + Num, + strcmp( font_format, "CFF" ) + ? ( tt_ver == TT_INTERPRETER_VERSION_35 + ? "TrueType (v35)" + : ( tt_ver == TT_INTERPRETER_VERSION_38 + ? "TrueType (v38)" + : "TrueType (v40)" ) ) + : ( cff_hinting_engine == FT_CFF_HINTING_FREETYPE + ? "CFF (FreeType)" + : "CFF (Adobe)" ) ); + } + } + else + { + sprintf( Header, "%.100s: not an MM font file, or could not be opened", + ft_basename( argv[file] ) ); + } + + grWriteCellString( &bit, 0, 8, Header, fore_color ); + grRefreshSurface( surface ); + + grListenSurface( surface, 0, &event ); + if ( !( key = Process_Event( &event ) ) ) + goto End; + + if ( key == 'n' ) + { + if ( file_loaded >= 1 ) + FT_Done_Face( face ); + + if ( file < argc - 1 ) + file++; + + goto NewFile; + } + + if ( key == 'p' ) + { + if ( file_loaded >= 1 ) + FT_Done_Face( face ); + + if ( file > 1 ) + file--; + + goto NewFile; + } + + if ( key == 'H' ) + { + /* enforce reloading */ + if ( file_loaded >= 1 ) + FT_Done_Face( face ); + + goto NewFile; + } + + if ( ptsize != old_ptsize ) + { + Reset_Scale( ptsize ); + + old_ptsize = ptsize; + } + } + + End: + grDoneSurface( surface ); + grDoneDevices(); + + free ( multimaster ); + FT_Done_Face ( face ); + FT_Done_FreeType( library ); + + printf( "Execution completed successfully.\n" ); + printf( "Fails = %d\n", Fail ); + + exit( 0 ); /* for safety reasons */ + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftpatchk.c freetype-2.8/=unpacked-tar2=/src/ftpatchk.c --- freetype-2.7.1/=unpacked-tar2=/src/ftpatchk.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftpatchk.c 2015-10-09 07:14:19.000000000 +0000 @@ -0,0 +1,59 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2007 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* FTpatchk - a simple program that tests whether patented hinting is */ +/* necessary. */ +/* */ +/****************************************************************************/ + + +#include +#include + +#include +#include FT_FREETYPE_H + + + int + main( int argc, + char* argv[] ) + { + FT_Error error; + FT_Library library; + + + error = FT_Init_FreeType( &library ); + if ( error ) + { + fprintf( stderr, "could not create FreeType instance\n" ); + exit( 1 ); + } + + for ( ; argc > 1; argc--, argv++ ) + { + FT_Face face; + + + error = FT_New_Face( library, argv[1], 0, &face ); + if ( error ) + { + fprintf( stderr, "could not open as a valid font: `%s'\n", argv[1] ); + continue; + } + printf( "%-50s %s\n", argv[1], + FT_Face_CheckTrueTypePatents( face ) + ? "uses patented opcodes" + : "doesn't use patented opcodes" ); + } + + exit( 0 ); + return 0; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftsbit.c freetype-2.8/=unpacked-tar2=/src/ftsbit.c --- freetype-2.7.1/=unpacked-tar2=/src/ftsbit.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftsbit.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,314 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-1998, 2001, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* ftsbit: a _very_ simple embedded bitmap dumper for FreeType 1.x. */ +/* */ +/* NOTE: This is just a test program that is used to show off and */ +/* debug the current engine. */ +/* */ +/****************************************************************************/ + + +#include +#include +#include + +#include +#include FT_FREETYPE_H + + +#ifdef HAVE_LIBINTL_H + +#ifdef HAVE_LOCALE_H +#include +#endif + +#include +#include "ftxerr18.h" + +#else /* !HAVE_LIBINTL */ + +#define gettext( x ) ( x ) + + /* We ignore error message strings with this function */ + + static char* TT_ErrToString18( FT_Error error ) + { + static char temp[32]; + + sprintf( temp, "0x%04lx", error ); + return temp; + } + +#endif /* !HAVE_LIBINTL */ + + + FT_Error error; + FT_Library engine; + FT_Resource resource; + + FT_Face face; + FT_Size instance; + FT_GlyphSlot glyph; + + unsigned int num_glyphs; + int ptsize; + + int Fail; + int Num; + + + + static void Usage( char* name ) + { + printf( gettext( "ftsbit: simple TrueType 'sbit' dumper -- part of the FreeType project\n" ) ); + printf( "---------------------------------------------------------------------\n" ); + printf( "\n" ); + printf( gettext( "Usage: %s ppem fontname (index)* (index1-index2)*\n\n" ), name ); + printf( gettext( " or %s -a ppem fontname (dumps all glyphs)\n" ), name ); + printf( "\n" ); + + exit( EXIT_FAILURE ); + } + + + + static + void dump_bitmap( FT_GlyphSlot glyph, int glyph_index ) + { + /* Dump the resulting bitmap */ + { + int y; + unsigned char* line = (unsigned char*)glyph->bitmap.buffer; + + printf( "glyph index %d = %dx%d pixels, ", + glyph_index, glyph->bitmap.rows, glyph->bitmap.width ); + + printf( "advance = %d, minBearing = [%d,%d]\n", + glyph->metrics.horiAdvance >> 6, + glyph->metrics.horiBearingX >> 6, + glyph->metrics.horiBearingY >> 6 ); + + for ( y = 0; y < glyph->bitmap.rows; y++, line += glyph->bitmap.cols ) + { + unsigned char* ptr = line; + int x; + unsigned char mask = 0x80; + + for ( x = 0; x < glyph->bitmap.width; x++ ) + { + printf( "%c", (ptr[0] & mask) ? '*' : '.' ); + mask >>= 1; + if (mask == 0) + { + mask = 0x80; + ptr++; + } + } + + printf( "\n" ); + } + } + } + + + + static + void dump_range( FT_GlyphSlot glyph, + int first_glyph, + int last_glyph ) + { + int i; + + for ( i = first_glyph; i <= last_glyph; i++ ) + { + error = FT_Load_Glyph( glyph, + instance, + (unsigned short)i, + FT_LOAD_NO_OUTLINE, + 0 ); + if (error) + { + printf( " no bitmap for glyph %d\n", i ); + printf( gettext( "FreeType error message: %s\n" ), + TT_ErrToString18( error ) ); + continue; + } + + dump_bitmap(glyph,i); + } + } + + + + + int main( int argc, char** argv ) + { + int i; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + char* fname; + int dump_all = 0; + + +#ifdef HAVE_LIBINTL_H + setlocale( LC_ALL, "" ); + bindtextdomain( "freetype", LOCALEDIR ); + textdomain( "freetype" ); +#endif + + execname = argv[0]; + + if ( argc < 3 ) + Usage( execname ); + + if ( argv[1][0] == '-' && + argv[1][1] == 'a' ) + { + argv++; + argc--; + dump_all = 1; + } + + if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) + Usage( execname ); + + /* Initialize engine */ + if ( (error = FT_Init_FreeType( &engine )) ) + { + fprintf( stderr, gettext( "Error while initializing engine\n" ) ); + goto Failure; + } + + /* Now check all files */ + fname = argv[2]; + i = strlen( fname ); + while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) + { + if ( fname[i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, fname, 1024 ); + strncpy( alt_filename, fname, 1024 ); + + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } + + /* Load face */ + error = FT_New_Resource( engine, filename, &resource ); + if (error) + { + strcpy( filename, alt_filename ); + error = FT_New_Resource( engine, alt_filename, &resource ); + } + + i = strlen( filename ); + fname = filename; + + while ( i >= 0 ) + if ( filename[i] == '/' || filename[i] == '\\' ) + { + fname = filename + i + 1; + i = -1; + } + else + i--; + + if ( error ) + { + printf( gettext( "Could not find or open file.\n" ) ); + goto Failure; + } + + error = FT_New_Face( resource, 0, &face ); + if (error) + { + printf( gettext( "Could not create face object.\n " ) ); + goto Failure; + } + + /* get face properties */ + num_glyphs = face->num_glyphs; + + /* create instance */ + error = FT_New_Size( face, &instance ); + if ( error ) + { + printf( gettext( "Could not create instance.\n" ) ); + goto Failure; + } + + error = FT_Set_Pixel_Sizes( instance, ptsize, ptsize ); + if (error) + { + printf( gettext( "Could not set character size.\n" ) ); + goto Failure; + } + + glyph = face->slot; + + if (dump_all) + dump_range( glyph, 0, num_glyphs-1 ); + else + { + for ( i = 3; i < argc; i++ ) + { + /* check for range in argument string */ + int range_check = 0; + char* base = argv[i]; + char* cur = base; + int first, last; + + while (*cur) + { + if (*cur == '-') + { + range_check = 1; + break; + } + cur++; + } + + if (range_check) + { + if ( sscanf( argv[i], "%d-%d", &first, &last ) != 2 ) + Usage( execname ); + + dump_range( glyph, first, last ); + } + else + { + if ( sscanf( argv[i], "%d", &first ) != 1 ) + Usage( execname ); + + dump_range( glyph, first, first ); + } + } + } + + FT_Done_FreeType( engine ); + exit( EXIT_SUCCESS ); /* for safety reasons */ + + return 0; /* never reached */ + + Failure: + printf( gettext( "FreeType error message: %s\n" ), + TT_ErrToString18( error ) ); + exit( EXIT_FAILURE ); + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftstring.1 freetype-2.8/=unpacked-tar2=/src/ftstring.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftstring.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftstring.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,82 @@ +.TH FTSTRING 1 "May 2017" "Freetype 2.8" +. +. +.SH NAME +. +ftstring \- string viewer +. +. +.SH SYNOPSIS +. +.B ftstring +.RI [ options ] +.I pt font .\|.\|. +. +. +.SH DESCRIPTION +. +.B ftstring +displays a text string with the given font, allowing to change +various rendering and display options interactively. +. +.TP +.B pt +The point size for the given resolution. +If resolution is 72dpi, this directly gives the ppem value (pixels per EM). +. +.TP +.B font +The font file(s) to display. +For Type 1 font files, +.B ftstring +also tries to attach the corresponding metrics file (with extension `.afm' +or `.pfm'). +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI \-w \ w +Set the window width to +.I w +pixels (default: 640px). +. +.TP +.BI \-h \ h +Set the window height to +.I h +pixels (default: 480px). +. +.TP +.BI \-r \ r +Use resolution +.I r +dpi (default: 72dpi). +. +.TP +.BI \-e \ enc +Specify encoding tag (default: no encoding). +Common values: +.B unic +(Unicode), +.B symb +(symbol), +.B ADOB +(Adobe standard), +.B ADBC +(Adobe custom). +. +.TP +.BI \-m \ text +Use +.I text +for rendering. +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftstring.c freetype-2.8/=unpacked-tar2=/src/ftstring.c --- freetype-2.7.1/=unpacked-tar2=/src/ftstring.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftstring.c 2017-05-02 06:31:12.000000000 +0000 @@ -0,0 +1,835 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2007, 2009-2016 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* ftstring.c - simple text string display */ +/* */ +/****************************************************************************/ + + +#include "ftcommon.h" +#include "common.h" +#include "mlgetopt.h" + +#include +#include +#include +#include +#include + +#include FT_LCD_FILTER_H + +#define CELLSTRING_HEIGHT 8 +#define MAXPTSIZE 500 /* dtp */ + + + static const char* Sample[] = + { + "The quick brown fox jumps over the lazy dog", + + /* Luís argüia à Júlia que «brações, fé, chá, óxido, pôr, zângão» */ + /* eram palavras do português */ + "Lu\u00EDs arg\u00FCia \u00E0 J\u00FAlia que \u00ABbra\u00E7\u00F5es, " + "f\u00E9, ch\u00E1, \u00F3xido, p\u00F4r, z\u00E2ng\u00E3o\u00BB eram " + "palavras do portugu\u00EAs", + + /* Ο καλÏμνιος σφουγγαÏάς ψιθÏÏισε πως θα βουτήξει χωÏίς να διστάζει */ + "\u039F \u03BA\u03B1\u03BB\u03CD\u03BC\u03BD\u03B9\u03BF\u03C2 \u03C3" + "\u03C6\u03BF\u03C5\u03B3\u03B3\u03B1\u03C1\u03AC\u03C2 \u03C8\u03B9" + "\u03B8\u03CD\u03C1\u03B9\u03C3\u03B5 \u03C0\u03C9\u03C2 \u03B8\u03B1 " + "\u03B2\u03BF\u03C5\u03C4\u03AE\u03BE\u03B5\u03B9 \u03C7\u03C9\u03C1" + "\u03AF\u03C2 \u03BD\u03B1 \u03B4\u03B9\u03C3\u03C4\u03AC\u03B6\u03B5" + "\u03B9", + + /* Съешь ещё Ñтих мÑгких французÑких булок да выпей же чаю */ + "\u0421\u044A\u0435\u0448\u044C \u0435\u0449\u0451 \u044D\u0442\u0438" + "\u0445 \u043C\u044F\u0433\u043A\u0438\u0445 \u0444\u0440\u0430\u043D" + "\u0446\u0443\u0437\u0441\u043A\u0438\u0445 \u0431\u0443\u043B\u043E" + "\u043A \u0434\u0430 \u0432\u044B\u043F\u0435\u0439 \u0436\u0435 " + "\u0447\u0430\u044E", + + /* 天地玄黃,宇宙洪è’。日月盈昃,辰宿列張。寒來暑往,秋收冬è—。*/ + "\u5929\u5730\u7384\u9EC3\uFF0C\u5B87\u5B99\u6D2A\u8352\u3002\u65E5" + "\u6708\u76C8\u6603\uFF0C\u8FB0\u5BBF\u5217\u5F35\u3002\u5BD2\u4F86" + "\u6691\u5F80\uFF0C\u79CB\u6536\u51AC\u85CF\u3002", + + /* ã„ã‚ã¯ã«ã»ã¸ã¨ ã¡ã‚Šã¬ã‚‹ã‚’ ã‚ã‹ã‚ˆãŸã‚Œã ã¤ã­ãªã‚‰ã‚€ */ + /* ã†ã‚ã®ãŠãã‚„ã¾ ã‘ãµã“ãˆã¦ ã‚ã•ãゆã‚ã¿ã— ã‚‘ã²ã‚‚ã›ã™ */ + "\u3044\u308D\u306F\u306B\u307B\u3078\u3068 \u3061\u308A\u306C\u308B" + "\u3092 \u308F\u304B\u3088\u305F\u308C\u305D \u3064\u306D\u306A\u3089" + "\u3080 \u3046\u3090\u306E\u304A\u304F\u3084\u307E \u3051\u3075\u3053" + "\u3048\u3066 \u3042\u3055\u304D\u3086\u3081\u307F\u3057 \u3091\u3072" + "\u3082\u305B\u3059", + + /* í‚¤ìŠ¤ì˜ ê³ ìœ ì¡°ê±´ì€ ìž…ìˆ ë¼ë¦¬ 만나야 하고 특별한 ê¸°ìˆ ì€ í•„ìš”ì¹˜ 않다 */ + "\uD0A4\uC2A4\uC758 \uACE0\uC720\uC870\uAC74\uC740 \uC785\uC220\uB07C" + "\uB9AC \uB9CC\uB098\uC57C \uD558\uACE0 \uD2B9\uBCC4\uD55C \uAE30" + "\uC220\uC740 \uD544\uC694\uCE58 \uC54A\uB2E4" + }; + + enum + { + RENDER_MODE_STRING, + RENDER_MODE_KERNCMP, + N_RENDER_MODES + }; + + static struct status_ + { + int width; + int height; + + int render_mode; + unsigned long encoding; + int res; + int ptsize; /* current point size */ + double gamma; + int angle; + const char* text; + + FTDemo_String_Context sc; + + FT_Byte gamma_ramp[256]; /* for show only */ + FT_Matrix trans_matrix; + int font_index; + char* header; + char header_buffer[256]; + + } status = { DIM_X, DIM_Y, + RENDER_MODE_STRING, FT_ENCODING_UNICODE, 72, 48, GAMMA, 0, NULL, + { 0, 0, 0, 0, NULL }, + { 0 }, { 0, 0, 0, 0 }, 0, NULL, { 0 } }; + + static FTDemo_Display* display; + static FTDemo_Handle* handle; + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** E V E N T H A N D L I N G ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + static void + event_help( void ) + { + char buf[256]; + char version[64]; + + const char* format; + FT_Int major, minor, patch; + + grEvent dummy_event; + + + FT_Library_Version( handle->library, &major, &minor, &patch ); + + format = patch ? "%d.%d.%d" : "%d.%d"; + sprintf( version, format, major, minor, patch ); + + FTDemo_Display_Clear( display ); + grSetLineHeight( 10 ); + grGotoxy( 0, 0 ); + grSetMargin( 2, 1 ); + grGotobitmap( display->bitmap ); + + sprintf( buf, + "FreeType String Viewer - part of the FreeType %s test suite", + version ); + + grWriteln( buf ); + grLn(); + grWriteln( "This program is used to display a string of text using" ); + grWriteln( "the new convenience API of the FreeType 2 library." ); + grLn(); + grWriteln( "Use the following keys :" ); + grLn(); + grWriteln( " F1 or ? : display this help screen" ); + grLn(); + grWriteln( " b : toggle embedded bitmaps (and disable rotation)" ); + grWriteln( " f : toggle forced auto-hinting" ); + grWriteln( " h : toggle outline hinting" ); + grLn(); + grWriteln( " 1-2 : select rendering mode" ); + grWriteln( " l : cycle through anti-aliasing modes" ); + grWriteln( " k : cycle through kerning modes" ); + grWriteln( " t : cycle through kerning degrees" ); + grWriteln( " Space : cycle through color" ); + grWriteln( " Tab : cycle through sample strings" ); + grWriteln( " V : toggle vertical rendering" ); + grLn(); + grWriteln( " g : increase gamma by 0.1" ); + grWriteln( " v : decrease gamma by 0.1" ); + grLn(); + grWriteln( " n : next font" ); + grWriteln( " p : previous font" ); + grLn(); + grWriteln( " Up : increase pointsize by 1 unit" ); + grWriteln( " Down : decrease pointsize by 1 unit" ); + grWriteln( " Page Up : increase pointsize by 10 units" ); + grWriteln( " Page Down : decrease pointsize by 10 units" ); + grLn(); + grWriteln( " Right : rotate counter-clockwise" ); + grWriteln( " Left : rotate clockwise" ); + grWriteln( " F7 : big rotate counter-clockwise" ); + grWriteln( " F8 : big rotate clockwise" ); + grLn(); + grWriteln( "press any key to exit this help screen" ); + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, gr_event_key, &dummy_event ); + } + + + static void + event_font_change( int delta ) + { + if ( status.font_index + delta >= handle->num_fonts || + status.font_index + delta < 0 ) + return; + + status.font_index += delta; + + FTDemo_Set_Current_Font( handle, handle->fonts[status.font_index] ); + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + FTDemo_Update_Current_Flags( handle ); + + FTDemo_String_Set( handle, status.text ); + } + + + static void + event_angle_change( int delta ) + { + double radian; + FT_Fixed cosinus; + FT_Fixed sinus; + + + status.angle += delta; + + if ( status.angle <= -180 ) + status.angle += 360; + if ( status.angle > 180 ) + status.angle -= 360; + + if ( status.angle == 0 ) + { + status.sc.matrix = NULL; + + return; + } + + status.sc.matrix = &status.trans_matrix; + + radian = status.angle * 3.14159265 / 180.0; + cosinus = (FT_Fixed)( cos( radian ) * 65536.0 ); + sinus = (FT_Fixed)( sin( radian ) * 65536.0 ); + + status.trans_matrix.xx = cosinus; + status.trans_matrix.yx = sinus; + status.trans_matrix.xy = -sinus; + status.trans_matrix.yy = cosinus; + } + + + static void + event_lcdmode_change( void ) + { + const char *lcd_mode; + + + handle->lcd_mode++; + + switch ( handle->lcd_mode ) + { + case LCD_MODE_AA: + lcd_mode = " normal AA"; + break; + case LCD_MODE_LIGHT: + lcd_mode = " light AA"; + break; + case LCD_MODE_LIGHT_SUBPIXEL: + lcd_mode = " light AA (subpixel positioning)"; + break; + case LCD_MODE_RGB: + lcd_mode = " LCD (horiz. RGB)"; + break; + case LCD_MODE_BGR: + lcd_mode = " LCD (horiz. BGR)"; + break; + case LCD_MODE_VRGB: + lcd_mode = " LCD (vert. RGB)"; + break; + case LCD_MODE_VBGR: + lcd_mode = " LCD (vert. BGR)"; + break; + default: + handle->lcd_mode = LCD_MODE_MONO; + lcd_mode = " monochrome"; + } + + sprintf( status.header_buffer, "mode changed to %s", lcd_mode ); + status.header = status.header_buffer; + } + + + static void + event_color_change( void ) + { + static int i = 0; + unsigned char r = i & 4 ? 0xff : 0; + unsigned char g = i & 2 ? 0xff : 0; + unsigned char b = i & 1 ? 0xff : 0; + + + display->back_color = grFindColor( display->bitmap, r, g, b, 0xff ); + display->fore_color = grFindColor( display->bitmap, ~r, ~g, ~b, 0xff ); + + i++; + } + + + static void + event_text_change( void ) + { + static int i = 0; + + status.text = Sample[i]; + + i++; + if ( i >= (int)( sizeof( Sample ) / sizeof( Sample[0] ) ) ) + i = 0; + } + + static void + event_gamma_change( double delta ) + { + int i; + + + status.gamma += delta; + + if ( status.gamma > 3.0 ) + status.gamma = 3.0; + else if ( status.gamma < 0.1 ) + status.gamma = 0.1; + + grSetGlyphGamma( status.gamma ); + + for ( i = 0; i < 256; i++ ) + status.gamma_ramp[i] = (FT_Byte)( pow( (double)i / 255., status.gamma ) + * 255. + 0.5 ); + } + + + static void + event_size_change( int delta ) + { + status.ptsize += delta; + + if ( status.ptsize < 1 * 64 ) + status.ptsize = 1 * 64; + else if ( status.ptsize > MAXPTSIZE * 64 ) + status.ptsize = MAXPTSIZE * 64; + + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + } + + + static void + event_render_mode_change( int delta ) + { + if ( delta ) + { + status.render_mode = ( status.render_mode + delta ) % N_RENDER_MODES; + + if ( status.render_mode < 0 ) + status.render_mode += N_RENDER_MODES; + } + + switch ( status.render_mode ) + { + case RENDER_MODE_STRING: + status.header = NULL; + break; + + case RENDER_MODE_KERNCMP: + status.header = (char *)"Kerning comparison"; + break; + } + } + + + static int + Process_Event( grEvent* event ) + { + FTDemo_String_Context* sc = &status.sc; + int ret = 0; + + + if ( event->key >= '1' && event->key < '1' + N_RENDER_MODES ) + { + status.render_mode = event->key - '1'; + event_render_mode_change( 0 ); + + return ret; + } + + switch ( event->key ) + { + case grKeyEsc: + case grKEY( 'q' ): + ret = 1; + break; + + case grKeyF1: + case grKEY( '?' ): + event_help(); + break; + + case grKEY( 'b' ): + handle->use_sbits = !handle->use_sbits; + status.header = handle->use_sbits + ? (char *)"embedded bitmaps are now used when available" + : (char *)"embedded bitmaps are now ignored"; + + FTDemo_Update_Current_Flags( handle ); + break; + + case grKEY( 'f' ): + handle->autohint = !handle->autohint; + status.header = handle->autohint + ? (char *)"forced auto-hinting is now on" + : (char *)"forced auto-hinting is now off"; + + FTDemo_Update_Current_Flags( handle ); + break; + + case grKEY( 'h' ): + handle->hinted = !handle->hinted; + status.header = handle->hinted + ? (char *)"glyph hinting is now active" + : (char *)"glyph hinting is now ignored"; + + FTDemo_Update_Current_Flags( handle ); + break; + + case grKEY( 'l' ): + event_lcdmode_change(); + + FTDemo_Update_Current_Flags( handle ); + break; + + case grKEY( 'k' ): + sc->kerning_mode = ( sc->kerning_mode + 1 ) % N_KERNING_MODES; + status.header = + sc->kerning_mode == KERNING_MODE_SMART + ? (char *)"pair kerning and side bearing correction is now active" + : sc->kerning_mode == KERNING_MODE_NORMAL + ? (char *)"pair kerning is now active" + : (char *)"pair kerning is now ignored"; + break; + + case grKEY( 't' ): + sc->kerning_degree = ( sc->kerning_degree + 1 ) % N_KERNING_DEGREES; + status.header = + sc->kerning_degree == KERNING_DEGREE_NONE + ? (char *)"no track kerning" + : sc->kerning_degree == KERNING_DEGREE_LIGHT + ? (char *)"light track kerning active" + : sc->kerning_degree == KERNING_DEGREE_MEDIUM + ? (char *)"medium track kerning active" + : (char *)"tight track kerning active"; + break; + + case grKeySpace: + event_color_change(); + break; + + case grKeyTab: + event_text_change(); + FTDemo_String_Set( handle, status.text ); + break; + + case grKEY( 'V' ): + sc->vertical = !sc->vertical; + status.header = sc->vertical + ? (char *)"using vertical layout" + : (char *)"using horizontal layout"; + break; + + case grKEY( 'g' ): + event_gamma_change( 0.1 ); + break; + + case grKEY( 'v' ): + event_gamma_change( -0.1 ); + break; + + case grKEY( 'n' ): + event_font_change( 1 ); + break; + + case grKEY( 'p' ): + event_font_change( -1 ); + break; + + case grKeyUp: event_size_change( 64 ); break; + case grKeyDown: event_size_change( -64 ); break; + case grKeyPageUp: event_size_change( 640 ); break; + case grKeyPageDown: event_size_change( -640 ); break; + + case grKeyLeft: event_angle_change( -3 ); break; + case grKeyRight: event_angle_change( 3 ); break; + case grKeyF7: event_angle_change( -30 ); break; + case grKeyF8: event_angle_change( 30 ); break; + + default: + break; + } + + return ret; + } + + + static void + gamma_ramp_draw( FT_Byte gamma_ramp[256], + grBitmap* bitmap ) + { + int i, x, y; + int bpp = bitmap->pitch / bitmap->width; + FT_Byte* p = (FT_Byte*)bitmap->buffer; + + + if ( bitmap->pitch < 0 ) + p += -bitmap->pitch * ( bitmap->rows - 1 ); + + x = ( bitmap->width - 256 ) / 2; + y = ( bitmap->rows + 256 ) / 2; + + for (i = 0; i < 256; i++) + p[bitmap->pitch * ( y - i ) + bpp * ( x + gamma_ramp[i] )] ^= 0xFF; + } + + + static void + write_header( FT_Error error_code ) + { + FT_Face face; + const char* basename; + + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + if ( error ) + PanicZ( "can't access font file" ); + + if ( !status.header ) + { + basename = ft_basename( handle->current_font->filepathname ); + + switch ( error_code ) + { + case FT_Err_Ok: + sprintf( status.header_buffer, + "%.50s %.50s (file `%.100s')", face->family_name, + face->style_name, basename ); + break; + + case FT_Err_Invalid_Pixel_Size: + sprintf( status.header_buffer, "Invalid pixel size (file `%.100s')", + basename ); + break; + + case FT_Err_Invalid_PPem: + sprintf( status.header_buffer, "Invalid ppem value (file `%.100s')", + basename ); + break; + + default: + sprintf( status.header_buffer, "File `%.100s': error 0x%04x", basename, + (FT_UShort)error_code ); + break; + } + + status.header = status.header_buffer; + } + + grWriteCellString( display->bitmap, 0, 0, + status.header, display->fore_color ); + + sprintf( status.header_buffer, "at %g points, angle = %d, gamma = %g", + status.ptsize / 64.0, status.angle, status.gamma ); + grWriteCellString( display->bitmap, 0, CELLSTRING_HEIGHT, + status.header_buffer, display->fore_color ); + + grRefreshSurface( display->surface ); + } + + + static void + usage( char* execname ) + { + fprintf( stderr, + "\n" + "ftstring: string viewer -- part of the FreeType project\n" + "-------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] pt font ...\n" + "\n", + execname ); + fprintf( stderr, + " pt The point size for the given resolution.\n" + " If resolution is 72dpi, this directly gives the\n" + " ppem value (pixels per EM).\n" ); + fprintf( stderr, + " font The font file(s) to display.\n" + " For Type 1 font files, ftstring also tries to attach\n" + " the corresponding metrics file (with extension\n" + " `.afm' or `.pfm').\n" + "\n" ); + fprintf( stderr, + " -w W Set the window width to W pixels (default: %dpx).\n" + " -h H Set the window height to H pixels (default: %dpx).\n" + "\n", + DIM_X, DIM_Y ); + fprintf( stderr, + " -r R Use resolution R dpi (default: 72dpi).\n" + " -e enc Specify encoding tag (default: no encoding).\n" + " Common values: `unic' (Unicode), `symb' (symbol),\n" + " `ADOB' (Adobe standard), `ADBC' (Adobe custom).\n" + " -m text Use `text' for rendering.\n" + "\n" + " -v Show version.\n" + "\n" ); + + exit( 1 ); + } + + + static void + parse_cmdline( int* argc, + char*** argv ) + { + char* execname; + int option; + + + execname = ft_basename( (*argv)[0] ); + + while ( 1 ) + { + option = getopt( *argc, *argv, "e:h:m:r:vw:" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'e': + status.encoding = FTDemo_Make_Encoding_Tag( optarg ); + break; + + case 'h': + status.height = atoi( optarg ); + if ( status.height < 1 ) + usage( execname ); + break; + + case 'm': + if ( *argc < 3 ) + usage( execname ); + status.text = optarg; + break; + + case 'r': + status.res = atoi( optarg ); + if ( status.res < 1 ) + usage( execname ); + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( handle->library, &major, &minor, &patch ); + + printf( "ftstring (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + case 'w': + status.width = atoi( optarg ); + if ( status.width < 1 ) + usage( execname ); + break; + + default: + usage( execname ); + break; + } + } + + *argc -= optind; + *argv += optind; + + if ( *argc <= 1 ) + usage( execname ); + + status.ptsize = (int)( atof( *argv[0] ) * 64.0 ); + if ( status.ptsize == 0 ) + status.ptsize = 64; + + (*argc)--; + (*argv)++; + } + + + int + main( int argc, + char** argv ) + { + grEvent event; + + + /* Initialize engine */ + handle = FTDemo_New(); + + parse_cmdline( &argc, &argv ); + + FT_Library_SetLcdFilter( handle->library, FT_LCD_FILTER_LIGHT ); + + handle->encoding = status.encoding; + handle->use_sbits = 0; + FTDemo_Update_Current_Flags( handle ); + + for ( ; argc > 0; argc--, argv++ ) + { + error = FTDemo_Install_Font( handle, argv[0], 0, 0 ); + + if ( error ) + { + fprintf( stderr, "failed to install %s", argv[0] ); + if ( error == FT_Err_Invalid_CharMap_Handle ) + fprintf( stderr, ": missing valid charmap\n" ); + else + fprintf( stderr, "\n" ); + } + } + + if ( handle->num_fonts == 0 ) + PanicZ( "could not open any font file" ); + + display = FTDemo_Display_New( gr_pixel_mode_rgb24, + status.width, status.height ); + + if ( !display ) + PanicZ( "could not allocate display surface" ); + + grSetTitle( display->surface, + "FreeType String Viewer - press ? for help" ); + + status.header = NULL; + + if ( !status.text ) + event_text_change(); + + event_color_change(); + event_gamma_change( 0 ); + event_font_change( 0 ); + + do + { + FTDemo_Display_Clear( display ); + + gamma_ramp_draw( status.gamma_ramp, display->bitmap ); + + switch ( status.render_mode ) + { + case RENDER_MODE_STRING: + status.sc.center = 1L << 15; + error = FTDemo_String_Draw( handle, display, + &status.sc, + display->bitmap->width / 2, + display->bitmap->rows / 2 ); + break; + + case RENDER_MODE_KERNCMP: + { + FTDemo_String_Context sc = status.sc; + FT_Int x, y; + FT_Int height; + + + x = 55; + + height = ( status.ptsize * status.res / 72 + 32 ) >> 6; + if ( height < CELLSTRING_HEIGHT ) + height = CELLSTRING_HEIGHT; + + /* First line: none */ + sc.center = 0; + sc.kerning_mode = 0; + sc.kerning_degree = 0; + sc.vertical = 0; + sc.matrix = NULL; + + y = CELLSTRING_HEIGHT * 2 + display->bitmap->rows / 4 + height; + grWriteCellString( display->bitmap, 5, + y - ( height + CELLSTRING_HEIGHT ) / 2, + "none", display->fore_color ); + error = FTDemo_String_Draw( handle, display, &sc, x, y ); + + /* Second line: track kern only */ + sc.kerning_degree = status.sc.kerning_degree; + + y += height; + grWriteCellString( display->bitmap, 5, + y - ( height + CELLSTRING_HEIGHT ) / 2, + "track", display->fore_color ); + error = FTDemo_String_Draw( handle, display, &sc, x, y ); + + /* Third line: track kern + pair kern */ + sc.kerning_mode = status.sc.kerning_mode; + + y += height; + grWriteCellString( display->bitmap, 5, + y - ( height + CELLSTRING_HEIGHT ) / 2, + "both", display->fore_color ); + error = FTDemo_String_Draw( handle, display, &sc, x, y ); + } + break; + } + + write_header( error ); + + status.header = 0; + grListenSurface( display->surface, 0, &event ); + } while ( !Process_Event( &event ) ); + + printf( "Execution completed successfully.\n" ); + + FTDemo_Display_Done( display ); + FTDemo_Done( handle ); + exit( 0 ); /* for safety reasons */ + + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/fttimer.c freetype-2.8/=unpacked-tar2=/src/fttimer.c --- freetype-2.7.1/=unpacked-tar2=/src/fttimer.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/fttimer.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,351 @@ +/****************************************************************************/ +/* */ +/* The FreeType project - a Free and Portable Quality TrueType Renderer. */ +/* */ +/* Copyright 1996-1998, 2003, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* fttimer: A simple performance benchmark. Now with graylevel rendering */ +/* with the '-g' option. */ +/* */ +/* Be aware that the timer program benchmarks different things */ +/* in each release of the FreeType library. Thus, performance */ +/* should only be compared between similar release numbers. */ +/* */ +/* */ +/* NOTE: This is just a test program that is used to show off and */ +/* debug the current engine. In no way does it shows the final */ +/* high-level interface that client applications will use. */ +/* */ +/****************************************************************************/ + +#include +#include FT_FREETYPE_H +#include FT_GLYPH_H + +#include +#include +#include +#include /* for clock() */ + + /* SunOS 4.1.* does not define CLOCKS_PER_SEC, so include */ + /* to get the HZ macro which is the equivalent. */ +#if defined( __sun__ ) && !defined( SVR4 ) && !defined( __SVR4 ) +#include +#define CLOCKS_PER_SEC HZ +#endif + +#define CHARSIZE 400 /* character point size */ +#define MAX_GLYPHS 512 /* Maximum number of glyphs rendered at one time */ + + char Header[128]; + + FT_Error error; + FT_Library library; + + FT_Face face; + + int num_glyphs; + FT_Glyph glyphs[MAX_GLYPHS]; + + int tab_glyphs; + int cur_glyph; + + int pixel_size = CHARSIZE; + int repeat_count = 1; + + int Fail; + int Num; + + short antialias = 1; /* smooth fonts with gray levels */ + short force_low; + + + static void + Panic( const char* message ) + { + fprintf( stderr, "%s\n", message ); + exit( 1 ); + } + + + /*******************************************************************/ + /* */ + /* Get_Time: */ + /* */ + /* Returns the current time in milliseconds. */ + /* */ + /*******************************************************************/ + + static long + Get_Time( void ) + { + return clock() * 10000 / CLOCKS_PER_SEC; + } + + + /*******************************************************************/ + /* */ + /* LoadChar: */ + /* */ + /* Loads a glyph into memory. */ + /* */ + /*******************************************************************/ + + static FT_Error + LoadChar( int idx ) + { + FT_Glyph glyph; + + + /* load the glyph in the glyph slot */ + error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || + FT_Get_Glyph ( face->glyph, &glyph ); + if ( !error ) + glyphs[cur_glyph++] = glyph; + + return error; + } + + + /*******************************************************************/ + /* */ + /* ConvertRaster: */ + /* */ + /* Performs scan conversion. */ + /* */ + /*******************************************************************/ + + static FT_Error + ConvertRaster( int idx ) + { + FT_Glyph bitmap; + + + bitmap = glyphs[idx]; + if ( bitmap->format == FT_GLYPH_FORMAT_BITMAP ) + error = 0; /* we already have a (embedded) bitmap */ + else + { + error = FT_Glyph_To_Bitmap( &bitmap, + antialias ? FT_RENDER_MODE_NORMAL + : FT_RENDER_MODE_MONO, + 0, + 0 ); + if ( !error ) + FT_Done_Glyph( bitmap ); + } + + return error; + } + + + static void + Usage( void ) + { + fprintf( stderr, "fttimer: simple performance timer -- part of the FreeType project\n" ); + fprintf( stderr, "-----------------------------------------------------------------\n\n" ); + fprintf( stderr, "Usage: fttimer [options] fontname[.ttf|.ttc]\n\n" ); + fprintf( stderr, "options:\n"); + fprintf( stderr, " -r : repeat count to be used (default is 1)\n" ); + fprintf( stderr, " -s : character pixel size (default is 600)\n" ); + fprintf( stderr, " -m : render monochrome glyphs (default is anti-aliased)\n" ); + fprintf( stderr, " -a : use smooth anti-aliaser\n" ); + fprintf( stderr, " -l : force low quality even at small sizes\n" ); + + exit( 1 ); + } + + + int + main( int argc, + char** argv ) + { + int i, total, base, rendered_glyphs; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + + long t, t0, tz0; + + + antialias = 1; + force_low = 0; + + while ( argc > 1 && argv[1][0] == '-' ) + { + switch ( argv[1][1] ) + { + case 'm': + antialias = 0; + break; + + case 'l': + force_low = 1; + break; + + case 's': + argc--; + argv++; + if ( argc < 2 || + sscanf( argv[1], "%d", &pixel_size ) != 1 ) + Usage(); + break; + + case 'r': + argc--; + argv++; + if ( argc < 2 || + sscanf( argv[1], "%d", &repeat_count ) != 1 ) + Usage(); + if ( repeat_count < 1 ) + repeat_count = 1; + break; + + default: + fprintf( stderr, "Unknown argument `%s'\n", argv[1] ); + Usage(); + break; + } + + argc--; + argv++; + } + + if ( argc != 2 ) + Usage(); + + i = strlen( argv[1] ); + while ( i > 0 && argv[1][i] != '\\' ) + { + if ( argv[1][i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, argv[1], 1024 ); + strncpy( alt_filename, argv[1], 1024 ); + + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } + + /* Initialize engine */ + + if ( ( error = FT_Init_FreeType( &library ) ) != 0 ) + Panic( "Error while initializing engine" ); + + /* Load face */ + + error = FT_New_Face( library, filename, 0, &face ); + if ( error == FT_Err_Cannot_Open_Stream ) + Panic( "Could not find/open font resource" ); + else if ( error ) + Panic( "Error while opening font resource" ); + + /* get face properties and allocate preload arrays */ + + num_glyphs = face->num_glyphs; + + tab_glyphs = MAX_GLYPHS; + if ( tab_glyphs > num_glyphs ) + tab_glyphs = num_glyphs; + + /* create size */ + + error = FT_Set_Pixel_Sizes( face, pixel_size, pixel_size ); + if ( error ) + Panic( "Could not reset instance" ); + + Num = 0; + Fail = 0; + + total = num_glyphs; + base = 0; + + rendered_glyphs = 0; + + t0 = 0; /* Initial time */ + + tz0 = Get_Time(); + + while ( total > 0 ) + { + int repeat; + + + /* First, preload 'tab_glyphs' in memory */ + cur_glyph = 0; + + printf( "loading %d glyphs", tab_glyphs ); + + for ( Num = 0; Num < tab_glyphs; Num++ ) + { + error = LoadChar( base + Num ); + if ( error ) + Fail++; + + total--; + } + + base += tab_glyphs; + + if ( tab_glyphs > total ) + tab_glyphs = total; + + printf( ", rendering... " ); + + /* Now, render the loaded glyphs */ + + t = Get_Time(); + + for ( repeat = 0; repeat < repeat_count; repeat++ ) + { + for ( Num = 0; Num < cur_glyph; Num++ ) + { + if ( ( error = ConvertRaster( Num ) ) != 0 ) + Fail++; + else + rendered_glyphs++; + } + } + + t = Get_Time() - t; + if ( t < 0 ) + t += 1000 * 60 * 60; + + printf( " = %f s\n", (double)t / 10000 ); + t0 += t; + + /* Now free all loaded outlines */ + for ( Num = 0; Num < cur_glyph; Num++ ) + FT_Done_Glyph( glyphs[Num] ); + } + + tz0 = Get_Time() - tz0; + + FT_Done_Face( face ); + + printf( "\n" ); + printf( "rendered glyphs = %d\n", rendered_glyphs ); + printf( "render time = %f s\n", (double)t0 / 10000 ); + printf( "fails = %d\n", Fail ); + printf( "average glyphs/s = %f\n", + (double)rendered_glyphs / t0 * 10000 ); + + printf( "total timing = %f s\n", (double)tz0 / 10000 ); + printf( "Fails = %d\n", Fail ); + + FT_Done_FreeType( library ); + + exit( 0 ); /* for safety reasons */ + + return 0; /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/fttry.c freetype-2.8/=unpacked-tar2=/src/fttry.c --- freetype-2.7.1/=unpacked-tar2=/src/fttry.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/fttry.c 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,180 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-1998, 2001, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* ftlint: a simple TrueType instruction tester. */ +/* */ +/* NOTE: This is just a test program that is used to show off and */ +/* debug the current engine. */ +/* */ +/****************************************************************************/ + + +#include +#include FT_FREETYPE_H + +#include +#include +#include + + +#define DUMP_NAME + +#define gettext( x ) ( x ) + + + FT_Error error; + + FT_Library library; + FT_Face face; + + unsigned int num_glyphs; + int ptsize; + + int Fail; + int Num; + + + static void + Usage( char* name ) + { + printf( "fttry: simple TrueType instruction tester -- part of the FreeType project\n" ); + printf( "--------------------------------------------------------------------------\n" ); + printf( "\n" ); + printf( "Usage: %s ppem glyph fontname [fontname2..]\n\n", name ); + printf( " or %s -u glyph fontname [fontname2..]\n", name ); + printf( " to load an unscaled glyph\n\n" ); + + exit( 1 ); + } + + + static void + Panic( const char* message ) + { + fprintf( stderr, + "%s\n error code = 0x%04x\n", message, error ); + exit( 1 ); + } + + + int + main( int argc, + char** argv ) + { + int i, file_index, glyph_index; + char filename[1024 + 4]; + char alt_filename[1024 + 4]; + char* execname; + char* fname; + int load_unscaled = 0; + + + execname = argv[0]; + + if ( argc < 3 ) + Usage( execname ); + + if ( argv[1][0] == '-' && + argv[1][1] == 'u' ) + load_unscaled = 1; + else + { + if ( sscanf( argv[1], "%d", &ptsize ) != 1 ) + Usage( execname ); + } + argc--; + argv++; + + if ( sscanf( argv[1], "%d", &glyph_index ) != 1 ) + Usage( execname ); + + error = FT_Init_FreeType( &library ); + if ( error ) + Panic( "Could not create library object" ); + + /* Now check all files */ + for ( file_index = 2; file_index < argc; file_index++ ) + { + fname = argv[file_index]; + i = strlen( fname ); + while ( i > 0 && fname[i] != '\\' && fname[i] != '/' ) + { + if ( fname[i] == '.' ) + i = 0; + i--; + } + + filename[1024] = '\0'; + alt_filename[1024] = '\0'; + + strncpy( filename, fname, 1024 ); + strncpy( alt_filename, fname, 1024 ); + + if ( i >= 0 ) + { + strncpy( filename + strlen( filename ), ".ttf", 4 ); + strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 ); + } + + i = strlen( filename ); + fname = filename; + + while ( i >= 0 ) + if ( filename[i] == '/' || filename[i] == '\\' ) + { + fname = filename + i + 1; + i = -1; + } + else + i--; + + printf( "%s: ", fname ); + + /* Load face */ + error = FT_New_Face( library, filename, 0, &face ); + if ( error ) + Panic( "Could not create face object" ); + + num_glyphs = face->num_glyphs; + + error = FT_Set_Char_Size( face, ptsize << 6, 0, 0, 0 ); + if ( error ) + Panic( "Could not set character size" ); + +#ifdef DUMP_NAME + { + char name[1024]; + + error = FT_Get_Glyph_Name( face, glyph_index, name, 1024 ); + if ( error ) + printf( "no glyph name available\n" ); + else + printf( "glyph name = '%s'\n", name ); + } + +#endif + + error = FT_Load_Glyph( face, + glyph_index, + load_unscaled ? FT_LOAD_NO_SCALE + : FT_LOAD_DEFAULT ); + if ( error == 0 ) + printf( "OK.\n" ); + else + printf( "Fail with error 0x%04x\n", error ); + + FT_Done_Face( face ); + } + + FT_Done_FreeType(library); + exit( 0 ); /* for safety reasons */ + + return 0; /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftvalid.1 freetype-2.8/=unpacked-tar2=/src/ftvalid.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftvalid.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftvalid.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,170 @@ +.TH FTVALID 1 "May 2017" "FreeType 2.8" +. +. +.SH NAME +. +ftvalid \- font layout table validator +. +. +.SH SYNOPSIS +. +.B ftvalid +.RI [ options ] +.I fontfile +. +. +.SH DESCRIPTION +. +.B ftvalid +is an OpenType layout table validator. +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI \-f \ index +Select font index (default: 0). +. +.TP +.BI \-t \ validator +Select validator. +Available validators are +.BR ot , +.BR gx , +and +.BR ckern . +. +.IP +Note that the availability of validators depends on +compile-time options of FreeType (this is, whether the modules +`otvalid' and `gxvalid' are compiled into the library). +. +.TP +.BI \-T \ tbls +[ot, gx] Select sfnt table name tags to be validated. +Use `:' to separate tags. +. +.IP +Supported tables in ot validator are +.BR BASE , +.BR GDEF , +.BR GPOS , +.BR GSUB , +.BR JSTF , +and +.BR MATH . +. +.IP +Supported tables in gx validator are +.BR feat , +.BR mort , +.BR morx , +.BR bsln , +.BR just , +.BR kern , +.BR opbd , +.BR trak , +.BR prop , +and +.BR lcar . +. +.IP +Example: +.B \-T \(dqfeat:morx\(dq +. +.TP +.BI \-T \ dialect +[ckern] Select classic kern dialect for validation. +Use `:' to separate dialect names. +If more than one dialect is specified, all dialects are accepted when +validating. +. +.IP +Supported dialects in ckern validator are +.B ms +and +.BR apple . +. +.TP +.BI \-l +List the layout-related SFNT tables available in the font file. +The selected validator (with option +.BR \-t ) +affects the list. +. +.IP +ckern is applicable to `kern' table only. +Option +.B \-L +lists dialects supported in ckern validator only if `kern' table is +available in the font file. +. +.TP +.BI \-V \ level +Validation level. +Possible values are +.B 0 +(default), +.B 1 +(tight), and +.B 2 +(paranoid). +. +.TP +.B \-v +Show version. +. +. +.SH ENVIRONMENT VARIABLES +. +.TP +.B FT2_DEBUG +You can specify +.RI ` component : level ' +pairs for tracing. +.I level +must be in the range [1,7]. +. +.IP +Available components for ot validator are +.BR otvmodule , +.BR otvcommon , +.BR otvbase , +.BR otvgdef , +.BR otvgpos , +.BR otvgsub , +and +.BR otvjstf . +. +.IP +Available components for gx validator are +.BR gxvmodule , +.BR gxvcommon , +.BR gxvfeat , +.BR gxvmort , +.BR gxvmorx , +.BR gxvbsln , +.BR gxvjust , +.BR gxvkern , +.BR gxvopbd , +.BR gxvtrak , +.BR gxvprop , +and +.BR gxvlcar . +.IP +Available component for ckern validator is +.B gxvkern +only. +. +.IP +Example: +.B FT2_DEBUG=\(dqotvcommon:5 gxvkern:7\(dq +. +.IP +.B FT2_DEBUG +only works if tracing support is compiled into FreeType. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftvalid.c freetype-2.8/=unpacked-tar2=/src/ftvalid.c --- freetype-2.7.1/=unpacked-tar2=/src/ftvalid.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftvalid.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,899 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality font engine */ +/* */ +/* Copyright 2005-2007, 2013 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* ftvalid: Validates layout related tables of OpenType and */ +/* TrueTypeGX/AAT. This program calls `FT_OpenType_Validate', */ +/* `FT_TrueTypeGX_Validate' or `FT_ClassicKern_Validate' on a */ +/* given file, and reports the validation result. */ +/* */ +/* */ +/* written by YAMATO Masatake and SUZUKI Toshiya. */ +/* */ +/****************************************************************************/ + + +#include + +#include FT_FREETYPE_H +#include FT_TRUETYPE_TABLES_H +#include FT_TRUETYPE_TAGS_H + +#include FT_OPENTYPE_VALIDATE_H +#include FT_GX_VALIDATE_H + + /* the following four header files shouldn't be used in normal programs */ +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_VALIDATE_H +#include FT_INTERNAL_MEMORY_H +#include FT_INTERNAL_OBJECTS_H + +#include "common.h" +#include "mlgetopt.h" + + +#include +#include +#include + + + static char* execname; + + typedef enum + { + OT_VALIDATE = 0, + GX_VALIDATE, + CKERN_VALIDATE, + + LAST_VALIDATE + + } ValidatorType; + static ValidatorType validator; + + + typedef struct TableSpecRec_ + { + FT_UInt tag; + FT_UInt validation_flag; + + } TableSpecRec, *TableSpec; + +#define MAKE_TABLE_SPEC( x ) { TTAG_##x, FT_VALIDATE_##x } + + static TableSpecRec ot_table_spec[] = + { + MAKE_TABLE_SPEC( BASE ), + MAKE_TABLE_SPEC( GDEF ), + MAKE_TABLE_SPEC( GPOS ), + MAKE_TABLE_SPEC( GSUB ), + MAKE_TABLE_SPEC( JSTF ), + MAKE_TABLE_SPEC( MATH ), + }; +#define N_OT_TABLE_SPEC ( sizeof ( ot_table_spec ) / sizeof ( TableSpecRec ) ) + + static TableSpecRec gx_table_spec[] = + { + MAKE_TABLE_SPEC( feat ), + MAKE_TABLE_SPEC( mort ), + MAKE_TABLE_SPEC( morx ), + MAKE_TABLE_SPEC( bsln ), + MAKE_TABLE_SPEC( just ), + MAKE_TABLE_SPEC( kern ), + MAKE_TABLE_SPEC( opbd ), + MAKE_TABLE_SPEC( trak ), + MAKE_TABLE_SPEC( prop ), + MAKE_TABLE_SPEC( lcar ), + }; +#define N_GX_TABLE_SPEC ( sizeof ( gx_table_spec ) / sizeof ( TableSpecRec ) ) + + + typedef struct ValidatorRec_ + { + ValidatorType type; + const char* symbol; + + const char* unimplemented_message; + int (* is_implemented)( FT_Library library ); + + FT_Error (* run) ( FT_Face face, + const char* tables, + int validation_level ); + int (* list_tables) ( FT_Face face ); + + TableSpec table_spec; + unsigned int n_table_spec; + + } ValidatorRec, *Validator; + + static int is_ot_validator_implemented ( FT_Library library ); + static int is_gx_validator_implemented ( FT_Library library ); + static int is_ckern_validator_implemented ( FT_Library library ); + + static FT_Error run_ot_validator ( FT_Face face, + const char* tables, + int validation_level ); + static FT_Error run_gx_validator ( FT_Face face, + const char* tables, + int validation_level ); + static FT_Error run_ckern_validator ( FT_Face face, + const char* dialect_request, + int validation_level ); + + static int list_ot_tables ( FT_Face face ); + static int list_gx_tables ( FT_Face face ); + static int list_ckern_tables ( FT_Face face ); + + + static ValidatorRec validators[] = + { + { + OT_VALIDATE, + "ot", + ( "FT_OpenType_Validate" + " is disabled! Recompile FreeType 2 with " + "otvalid" + " module enabled.\n" ), + is_ot_validator_implemented, + run_ot_validator, + list_ot_tables, + ot_table_spec, + N_OT_TABLE_SPEC, + }, + { + GX_VALIDATE, + "gx", + ( "FT_TrueTypeGX_Validate" + " is disabled! Recompile FreeType 2 with " + "gxvalid" + " module enabled.\n" ), + is_gx_validator_implemented, + run_gx_validator, + list_gx_tables, + gx_table_spec, + N_GX_TABLE_SPEC, + }, + { + CKERN_VALIDATE, + "ckern", + ( "FT_ClassicKern_Validate" + " is disabled! Recompile FreeType 2 with " + "gxvalid" /* NOTE: classic kern validator is in gxvalid. */ + " module enabled.\n" ), + is_ckern_validator_implemented, + run_ckern_validator, + list_ckern_tables, + NULL, + 0, + }, + }; + + + static void + panic( int error, + const char* message ) + { + fprintf( stderr, "%s\n error = 0x%04x\n", message, error ); + exit( 1 ); + } + + + static char* + make_tag_chararray ( char chararray[4], + FT_UInt tag ) + { + chararray[0] = (char)( ( tag >> 24 ) & 0xFF ); + chararray[1] = (char)( ( tag >> 16 ) & 0xFF ); + chararray[2] = (char)( ( tag >> 8 ) & 0xFF ); + chararray[3] = (char)( ( tag >> 0 ) & 0xFF ); + return chararray; + } + + + static void + print_tag ( FILE* stream, + FT_UInt tag ) + { + char buffer[5]; + + + buffer[4] = '\0'; + fprintf( stream, "%s", make_tag_chararray( buffer, tag ) ); + } + + + /* To initialize the internal variable, call this + function with FT_Library variable. Then call + with NULL. The print messages is printed if + call with NULL. */ + static void + print_usage( FT_Library library_initializer ) + { + unsigned int i, j; + Validator v; + static FT_Library library; + + if (library_initializer) + { + library = library_initializer; + return ; + } + + fprintf( stderr, + "\n" + "ftvalid: layout table validator -- part of the FreeType project\n" + "---------------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] fontfile\n" + "\n", + execname ); + + fprintf( stderr, + "Options:\n" + "\n" ); + + fprintf( stderr, + " -f index Select font index (default: 0).\n" + "\n" ); + + fprintf( stderr, + " -t validator Select validator.\n" + " Available validators:\n" + " " ); + for ( i = 0; i < LAST_VALIDATE; i++ ) + { + v = &validators[i]; + fprintf( stderr, " %s%s", + v->symbol, + v->is_implemented( library ) ? "" + : " (NOT COMPILED IN)" ); + } + fprintf( stderr, + "\n" + "\n" ); + + fprintf( stderr, + " -T tbls [ot, gx] Select sfnt table name tags to be validated.\n" + " Use `:' to separate tags.\n" + "\n" ); + for ( i = 0; i < LAST_VALIDATE; i++ ) + { + v = &validators[i]; + + if ( v->n_table_spec == 0 ) + continue; + + fprintf( stderr, + " Supported tables in %s validator:\n" + " ", + v->symbol ); + for ( j = 0; j < v->n_table_spec; j++ ) + { + fprintf( stderr, " " ); + print_tag( stderr, v->table_spec[j].tag ); + } + fprintf( stderr, + "\n" + "\n" ); + } + fprintf( stderr, + " Example: -T \"feat:morx\"\n" + "\n" ); + + fprintf( stderr, + " -T dialect [ckern] Select classic kern dialect for validation.\n" + " Use `:' to separate dialect names.\n" + " If more than one dialect is specified,\n" + " all dialects are accepted when validating.\n" + "\n" + " Supported dialects in ckern validator:\n" + " ms apple\n" + "\n" ); + + fprintf( stderr, + " -l List the layout-related SFNT tables\n" + " available in the font file.\n" + " The selected validator (with option `-t')\n" + " affects the list.\n" + "\n" + " ckern is applicable to `kern' table only.\n" + " Option `-l' lists dialects supported in ckern validator\n" + " only if `kern' table is available in the font file.\n" + "\n" ); + + fprintf( stderr, + " -V level Validation level. Possible values:\n" + " 0 (default), 1 (tight), 2 (paranoid)\n" + "\n" ); + + fprintf( stderr, + " -v Show version." + "\n" ); + + fprintf( stderr, + "-------------------------------------------------------------------\n" + "\n" ); + + fprintf( stderr, + "`FT2_DEBUG' environment variable:\n" + "\n" + " You can specify `component:level' pairs for tracing.\n" + " `level' must be in the range [1,7].\n" + " Available components for ot validator:\n" + " otvmodule otvcommon otvbase otvgdef otvgpos otvgsub otvjstf\n" + " Available components for gx validator:\n" + " gxvmodule gxvcommon gxvfeat gxvmort gxvmorx gxvbsln gxvjust\n" + " gxvkern gxvopbd gxvtrak gxvprop gxvlcar\n" + " Available components for ckern validator:\n" + " gxvkern\n" + "\n" + " Example:\n" + "\n" + " FT2_DEBUG=\"otvcommon:5 gxvkern:7\"\n" + "\n" + "FT2_DEBUG only works if tracing support is compiled into FreeType 2\n" + "\n" ); + + exit( 1 ); + } + + + static FT_Error + try_load( FT_Face face, + FT_ULong tag ) + { + FT_ULong length; + + + length = 0; + return FT_Load_Sfnt_Table( face, tag, 0, NULL, &length ); + } + + + static FT_UInt + find_validation_flag( FT_UInt tag, + const TableSpecRec spec[], + int spec_count ) + { + int i; + + + for ( i = 0; i < spec_count; i++ ) + { + if ( tag == spec[i].tag ) + return spec[i].validation_flag; + } + + fprintf( stderr, "*** Wrong table name: " ); + print_tag( stderr, tag ); + fprintf( stderr, "\n" ); + + print_usage( NULL ); + + return 0; + } + + + static FT_UInt + parse_table_specs( const char* tables, + const TableSpecRec spec[], + int spec_count ) + { + FT_UInt validation_flags; + size_t len; + + unsigned int i; + char tag[4]; + + + validation_flags = 0; + + len = strlen( tables ); + if (( len % 5 ) != 4 ) + { + fprintf( stderr, "*** Wrong length of table names\n" ); + print_usage( NULL ); + } + + for ( i = 0; i < len; i++ ) + { + if ( ( ( i % 5 ) == 4 ) ) + { + if ( tables[i] != ':' ) + { + fprintf( stderr, "*** Wrong table separator: %c\n", tables[i] ); + print_usage( NULL ); + } + i++; + } + + tag[i % 5] = tables[i]; + if ( ( i % 5 ) == 3 ) + validation_flags |= find_validation_flag( FT_MAKE_TAG( tag[0], + tag[1], + tag[2], + tag[3] ), + spec, + spec_count ); + } + + return validation_flags; + } + + + static FT_UInt + list_face_tables( FT_Face face, + const TableSpecRec spec[], + int spec_count ) + { + FT_Error error; + + FT_UInt validation_flags; + int i; + FT_UInt tag; + + + validation_flags = 0; + + for ( i = 0; i < spec_count; i++ ) + { + tag = spec[i].tag; + error = try_load( face, tag ); + if ( error == 0 ) + validation_flags |= spec[i].validation_flag; + } + return validation_flags; + } + + + static FT_UInt + make_table_specs( FT_Face face, + const char* request, + const TableSpecRec spec[], + int spec_count ) + { + if ( request == NULL || request[0] == '\0' ) + return list_face_tables ( face, spec, spec_count ); + else + return parse_table_specs ( request, spec, spec_count ); + } + + + static int + print_tables( FILE* stream, + FT_UInt validation_flags, + const TableSpecRec spec[], + int spec_count ) + { + int i; + int n_print; + + + for ( i = 0, n_print = 0; i < spec_count; i++ ) + { + if ( spec[i].validation_flag & validation_flags ) + { + if ( n_print != 0 ) + fprintf( stream, "%c", ':' ); + print_tag( stream, spec[i].tag ); + n_print++; + } + } + + fprintf( stream, "\n" ); + + return !n_print; + } + + + static void + report_header( FT_UInt validation_flags, + const TableSpecRec spec[], + int spec_count ) + { + printf( "[%s:%s] validation targets: ", + execname, validators[validator].symbol ); + print_tables( stdout, validation_flags, spec, spec_count ); + printf( "-------------------------------------------------------------------\n" ); + } + + + static void + report_result( FT_Bytes data[], + FT_UInt validation_flags, + const TableSpecRec spec[], + int spec_count ) + { + int i; + int n_passes; + int n_targets; + + + for ( i = 0, n_passes = 0, n_targets = 0; i < spec_count; i++ ) + { + if ( spec[i].validation_flag & validation_flags ) + { + n_targets++; + + if ( data[i] != NULL ) + { + printf( "[%s:%s] ", execname, validators[validator].symbol ); + print_tag( stdout, spec[i].tag ); + printf( "%s", "...pass\n" ); + n_passes++; + } + } + } + + if ( n_passes == 0 && n_targets != 0 ) + { + printf( "[%s:%s] layout tables are invalid.\n", + execname, validators[validator].symbol ); + printf( "[%s:%s] set FT2_DEBUG environment variable to\n", + execname, validators[validator].symbol ); + printf( "[%s:%s] know the validation detail.\n", + execname, validators[validator].symbol ); + } + } + + + /* + * OpenType related functions + */ + static int + is_ot_validator_implemented( FT_Library library ) + { + FT_Module mod; + + mod = FT_Get_Module( library, "otvalid" ); + return mod? 1: 0; + } + + static FT_Error + run_ot_validator( FT_Face face, + const char* tables, + int validation_level ) + { + FT_UInt validation_flags; + FT_Error error; + FT_Bytes data[N_OT_TABLE_SPEC]; + unsigned int i; + + + validation_flags = (FT_UInt)validation_level; + validation_flags |= make_table_specs( face, tables, ot_table_spec, + N_OT_TABLE_SPEC ); + + for ( i = 0; i < N_OT_TABLE_SPEC; i++ ) + data[i] = NULL; + + report_header( validation_flags, ot_table_spec, N_OT_TABLE_SPEC ); + + error = FT_OpenType_Validate( + face, + validation_flags, + &data[0], &data[1], &data[2], &data[3], &data[4] ); + + report_result( data, validation_flags, ot_table_spec, N_OT_TABLE_SPEC ); + + for ( i = 0; i < N_OT_TABLE_SPEC; i++ ) + FT_OpenType_Free( face, data[i] ); + + return error; + } + + + static int + list_ot_tables( FT_Face face ) + { + FT_UInt validation_flags; + + + validation_flags = list_face_tables( face, ot_table_spec, + N_OT_TABLE_SPEC ); + return print_tables( stdout, validation_flags, ot_table_spec, + N_OT_TABLE_SPEC ); + } + + + /* + * TrueTypeGX related functions + */ + static int + is_gx_validator_implemented( FT_Library library ) + { + FT_Module mod; + + mod = FT_Get_Module( library, "gxvalid" ); + return mod? 1: 0; + } + + static FT_Error + run_gx_validator( FT_Face face, + const char* tables, + int validation_level ) + { + FT_UInt validation_flags; + FT_Error error; + FT_Bytes data[N_GX_TABLE_SPEC]; + unsigned int i; + + + validation_flags = (FT_UInt)validation_level; + validation_flags |= make_table_specs( face, tables, gx_table_spec, + N_GX_TABLE_SPEC ); + + for ( i = 0; i < N_GX_TABLE_SPEC; i++ ) + data[i] = NULL; + + report_header( validation_flags, gx_table_spec, N_GX_TABLE_SPEC ); + + error = FT_TrueTypeGX_Validate( + face, + validation_flags, + data, + N_GX_TABLE_SPEC ); + + report_result( data, validation_flags, gx_table_spec, N_GX_TABLE_SPEC ); + + for ( i = 0; i < N_GX_TABLE_SPEC; i++ ) + FT_TrueTypeGX_Free( face, data[i] ); + + return error; + } + + + static int + list_gx_tables ( FT_Face face ) + { + FT_UInt validation_flags; + + validation_flags = list_face_tables( face, gx_table_spec, + N_GX_TABLE_SPEC ); + return print_tables( stdout, validation_flags, gx_table_spec, + N_GX_TABLE_SPEC ); + } + + + /* + * Classic kern related functions + */ + static int + is_ckern_validator_implemented( FT_Library library ) + { + FT_Module mod; + + mod = FT_Get_Module( library, "gxvalid" ); + return mod? 1: 0; + } + + + static FT_Error + run_ckern_validator( FT_Face face, + const char* dialect_request, + int validation_level ) + { + FT_UInt validation_flags; + FT_Error error; + FT_Bytes data; + + + if ( dialect_request == NULL ) + dialect_request = "ms:apple"; + + + validation_flags = (FT_UInt)validation_level; + + if ( strcmp( dialect_request, "ms:apple" ) == 0 || + strcmp( dialect_request, "apple:ms" ) == 0 ) + validation_flags |= FT_VALIDATE_MS | FT_VALIDATE_APPLE; + else if ( strcmp( dialect_request, "ms" ) == 0 ) + validation_flags |= FT_VALIDATE_MS; + else if ( strcmp( dialect_request, "apple" ) == 0 ) + validation_flags |= FT_VALIDATE_APPLE; + else + { + fprintf( stderr, "Wrong classic kern dialect: %s\n", dialect_request ); + print_usage( NULL ); + } + + printf( "[%s:%s] validation targets: %s...", + execname, validators[validator].symbol, dialect_request ); + + + error = FT_ClassicKern_Validate( + face, + validation_flags, + &data ); + + + if ( data ) + printf( "pass\n" ); + else if ( data == NULL && error ) + printf( "fail\n" ); + else + printf( "no kern\n" ); + + FT_ClassicKern_Free( face, data ); + + return error; + } + + static int + list_ckern_tables ( FT_Face face ) + { + FT_Error error; + + error = try_load( face, TTAG_kern ); + if ( error == 0 ) + printf( "ms:apple\n" ); + return 0; + } + + /* + * Main driver + */ + + int + main( int argc, + char** argv ) + { + FT_Library library; + FT_Error error; + + char* fontfile; + int option; + + + char* tables; + int dump_table_list; + + int validation_level; + + int font_index = 0; + + + execname = ft_basename( argv[0] ); + + error = FT_Init_FreeType( &library ); + if ( error ) + panic ( error, "Could not initialize FreeType library" ); + + /* Initialize print_usage internal variable */ + print_usage( library ); + + + /* + * Parsing options + */ + validator = OT_VALIDATE; + tables = NULL; + dump_table_list = 0; + validation_level = FT_VALIDATE_DEFAULT; + + while ( 1 ) + { + option = getopt( argc, argv, "f:lt:T:vV:" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 't': + { + int i; + + validator = LAST_VALIDATE; + for ( i = 0; i < LAST_VALIDATE; i++ ) + { + if ( strcmp( optarg, validators[i].symbol ) == 0 ) + { + validator = (ValidatorType)i; + break; + } + } + if ( validator == LAST_VALIDATE ) + { + fprintf( stderr, "*** Unknown validator name: %s\n", optarg ); + print_usage( NULL ); + } + } + break; + + case 'T': + tables = optarg; + break; + + case 'l': + dump_table_list = 1; + break; + + case 'V': + validation_level = atoi( optarg ); + if ( validation_level < 0 || + validation_level > FT_VALIDATE_PARANOID ) + { + fprintf( stderr, "*** Validation level is out of range: %d\n", + validation_level ); + print_usage( NULL ); + } + break; + + case 'f': + font_index = atoi( optarg ); + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( library, &major, &minor, &patch ); + + printf( "ftvalid (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + default: + print_usage( NULL ); + break; + } + } + + argc -= optind; + argv += optind; + + if ( argc == 0 ) + { + fprintf(stderr, "*** Font file is not specified.\n"); + print_usage( NULL ); + } + else if ( argc > 1 ) + { + fprintf(stderr, "*** Too many font files.\n"); + print_usage( NULL ); + } + + fontfile = argv[0]; + + /* + * Run a validator + */ + { + FT_Face face; + FT_Error status; + + status = 0; + + if ( !validators[validator].is_implemented( library ) ) + panic( FT_Err_Unimplemented_Feature, + validators[validator].unimplemented_message ); + + + /* TODO: Multiple faces in a font file? */ + error = FT_New_Face( library, fontfile, font_index, &face ); + if ( error ) + panic( error, "Could not open face." ); + + if ( dump_table_list ) + validators[validator].list_tables( face ); + else + status = validators[validator].run( face, tables, validation_level ); + + FT_Done_Face( face ); + FT_Done_FreeType( library ); + + return (int)status; + } + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftview.1 freetype-2.8/=unpacked-tar2=/src/ftview.1 --- freetype-2.7.1/=unpacked-tar2=/src/ftview.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftview.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,94 @@ +.TH FTVIEW 1 "May 2017" "FreeType 2.8" +. +. +.SH NAME +. +ftview \- simple glyph viewer +. +. +.SH SYNOPSIS +. +.B ftview +.RI [ options ] +.I pt font +. +. +.SH DESCRIPTION +. +.B ftview +displays all glyphs of a font, allowing changes of various rendering +and hinting parameters interactively. +. +.TP +.B pt +The point size for the given resolution. +If resolution is 72dpi, this directly gives the ppem value (pixels per EM). +. +.TP +.B font +The font file(s) to display. +For Type 1 font files, ftview also tries to attach the corresponding metrics +file (with extension `.afm' or `.pfm'). +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI \-w \ w +Set the window width to +.I w +pixels (default: 640px). +. +.TP +.BI \-h \ h +Set the window height to +.I h +pixels (default: 480px). +. +.TP +.BI \-r \ r +Use resolution +.I r +dpi (default: 72dpi). +. +.TP +.BI \-f \ index +Specify first index to display (default: 0). +. +.TP +.BI \-e \ enc +Specify encoding tag (default: no encoding). +Common values: +.B unic +(Unicode), +.B symb +(symbol), +.B ADOB +(Adobe standard), +.B ADBC +(Adobe custom). +. +.TP +.BI \-m \ text +Use +.I text +for rendering. +. +.TP +.BI \-l \ mode +Set start-up rendering mode (0 <= +.I mode +<= 5). +. +.TP +.B \-p +Preload file in memory to simulate memory-mapping. +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ftview.c freetype-2.8/=unpacked-tar2=/src/ftview.c --- freetype-2.7.1/=unpacked-tar2=/src/ftview.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ftview.c 2017-05-11 16:31:16.000000000 +0000 @@ -0,0 +1,2075 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2000, 2003-2007, 2009-2014 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* FTView - a simple font viewer. */ +/* */ +/* This is a new version using the MiGS graphics subsystem for */ +/* blitting and display. */ +/* */ +/* Press ? when running this program to have a list of key-bindings. */ +/* */ +/****************************************************************************/ + + +#include "ftcommon.h" +#include "common.h" +#include "mlgetopt.h" +#include + + /* the following header shouldn't be used in normal programs */ +#include FT_INTERNAL_DEBUG_H + + /* showing driver name */ +#include FT_MODULE_H +#include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DRIVER_H + +#include FT_STROKER_H +#include FT_SYNTHESIS_H +#include FT_LCD_FILTER_H +#include FT_CFF_DRIVER_H +#include FT_TRUETYPE_DRIVER_H + + +#define MAXPTSIZE 500 /* dtp */ + +#ifdef CEIL +#undef CEIL +#endif +#define CEIL( x ) ( ( (x) + 63 ) >> 6 ) + +#define START_X 18 * 8 +#define START_Y 3 * HEADER_HEIGHT + +#define INIT_SIZE( size, start_x, start_y, step_y, x, y ) \ + do { \ + start_x = START_X; \ + start_y = CEIL( size->metrics.ascender - \ + size->metrics.descender ) + START_Y; \ + step_y = CEIL( size->metrics.height ) + 4; \ + \ + x = start_x; \ + y = start_y; \ + } while ( 0 ) + +#define X_TOO_LONG( x, slot, display ) \ + ( (x) + ( (slot)->metrics.horiAdvance >> 6 ) > \ + (display)->bitmap->width - 3 ) +#define Y_TOO_LONG( y, size, display ) \ + ( (y) >= (display)->bitmap->rows ) + +#ifdef _WIN32 +#define snprintf _snprintf +#endif + + +#define N_CFF_HINTING_ENGINES 2 + + + /* omit LCD_MODE_LIGHT_SUBPIXEL; we don't need it in this application */ + static int lcd_modes[] = + { + LCD_MODE_MONO, + LCD_MODE_AA, + LCD_MODE_LIGHT, + LCD_MODE_RGB, + LCD_MODE_BGR, + LCD_MODE_VRGB, + LCD_MODE_VBGR + }; + +#define N_LCD_IDXS ( (int)( sizeof ( lcd_modes ) / sizeof ( int ) ) ) + + + enum + { + RENDER_MODE_ALL = 0, + RENDER_MODE_FANCY, + RENDER_MODE_STROKE, + RENDER_MODE_TEXT, + RENDER_MODE_WATERFALL, + N_RENDER_MODES + }; + + static struct status_ + { + int update; + + int width; + int height; + int render_mode; + unsigned long encoding; + + int res; + int ptsize; /* current point size, 26.6 format */ + int lcd_idx; + double gamma; + double xbold_factor; + double ybold_factor; + double radius; + double slant; + + unsigned int cff_hinting_engine; + unsigned int tt_interpreter_versions[3]; + int num_tt_interpreter_versions; + int tt_interpreter_version_idx; + FT_Bool warping; + + int font_idx; + int offset; /* as selected by the user */ + int topleft; /* as displayed by ftview */ + int num_fails; + int preload; + + int lcd_filter; + unsigned char filter_weights[5]; + int fw_idx; + + } status = { 1, + DIM_X, DIM_Y, RENDER_MODE_ALL, FT_ENCODING_NONE, + 72, 48, 1, GAMMA, 0.04, 0.04, 0.02, 0.22, + 0, { 0 }, 0, 0, 0, /* default values are set at runtime */ + 0, 0, 0, 0, 0, + FT_LCD_FILTER_DEFAULT, { 0x08, 0x4D, 0x56, 0x4D, 0x08 }, 2 }; + + + static FTDemo_Display* display; + static FTDemo_Handle* handle; + + static unsigned long FT_ENC_TAG( FT_ENCODING_OTHER, 'o', 't', 'h', 'e' ); + + + /* + In UTF-8 encoding: + + The quick brown fox jumps over the lazy dog + 0123456789 + âêîûôäëïöüÿàùéèç + &#~"'(-`_^@)=+° + ABCDEFGHIJKLMNOPQRSTUVWXYZ + $£^¨*µù%!§:/;.,?<> + + The trailing space is for `looping' in case `Text' gets displayed more + than once. + */ + static const char* Text = + "The quick brown fox jumps over the lazy dog" + " 0123456789" + " \303\242\303\252\303\256\303\273\303\264" + "\303\244\303\253\303\257\303\266\303\274\303\277" + "\303\240\303\271\303\251\303\250\303\247" + " &#~\"\'(-`_^@)=+\302\260" + " ABCDEFGHIJKLMNOPQRSTUVWXYZ" + " $\302\243^\302\250*\302\265\303\271%!\302\247:/;.,?<> "; + + + static void + Fatal( const char* message ) + { + FTDemo_Display_Done( display ); + FTDemo_Done( handle ); + PanicZ( message ); + } + + + static FT_Error + Render_Stroke( int num_indices, + int offset ) + { + int start_x, start_y, step_y, x, y; + int i, have_topleft; + FT_Size size; + FT_Face face; + FT_GlyphSlot slot; + + FT_Fixed radius; + + + error = FTDemo_Get_Size( handle, &size ); + + if ( error ) + { + /* probably a non-existent bitmap font size */ + return error; + } + + INIT_SIZE( size, start_x, start_y, step_y, x, y ); + face = size->face; + slot = face->glyph; + + radius = (FT_Fixed)( + status.radius * ( status.ptsize * status.res / 72 ) ); + + FT_Stroker_Set( handle->stroker, radius, + FT_STROKER_LINECAP_ROUND, + FT_STROKER_LINEJOIN_ROUND, + 0 ); + + have_topleft = 0; + + for ( i = offset; i < num_indices; i++ ) + { + FT_UInt glyph_idx; + + + if ( status.encoding == FT_ENCODING_NONE ) + glyph_idx = (FT_UInt)i; + else + glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); + + error = FT_Load_Glyph( face, glyph_idx, + handle->load_flags | FT_LOAD_NO_BITMAP ); + + if ( !error && slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + FT_Glyph glyph; + + + error = FT_Get_Glyph( slot, &glyph ); + if ( error ) + goto Next; + + error = FT_Glyph_Stroke( &glyph, handle->stroker, 1 ); + if ( error ) + { + FT_Done_Glyph( glyph ); + goto Next; + } + + if ( X_TOO_LONG( x, slot, display ) ) + { + x = start_x; + y += step_y; + + if ( Y_TOO_LONG( y, size, display ) ) + break; + } + + error = FTDemo_Draw_Glyph( handle, display, glyph, &x, &y ); + + FT_Done_Glyph( glyph ); + + if ( error ) + goto Next; + + if ( !have_topleft ) + { + have_topleft = 1; + status.topleft = i; + } + } + else + Next: + status.num_fails++; + } + + return error; + } + + + static FT_Error + Render_Fancy( int num_indices, + int offset ) + { + int start_x, start_y, step_y, x, y; + int i, have_topleft; + FT_Size size; + FT_Face face; + FT_GlyphSlot slot; + + FT_Matrix shear; + FT_Pos xstr, ystr; + + + error = FTDemo_Get_Size( handle, &size ); + + if ( error ) + { + /* probably a non-existent bitmap font size */ + return error; + } + + INIT_SIZE( size, start_x, start_y, step_y, x, y ); + face = size->face; + slot = face->glyph; + + /***************************************************************/ + /* */ + /* 2*2 affine transformation matrix, 16.16 fixed float format */ + /* */ + /* Shear matrix: */ + /* */ + /* | x' | | 1 k | | x | x' = x + ky */ + /* | | = | | * | | <==> */ + /* | y' | | 0 1 | | y | y' = y */ + /* */ + /* outline' shear outline */ + /* */ + /***************************************************************/ + + shear.xx = 1 << 16; + shear.xy = (FT_Fixed)( status.slant * ( 1 << 16 ) ); + shear.yx = 0; + shear.yy = 1 << 16; + + ystr = status.ptsize * status.res / 72; + xstr = (FT_Pos)( status.xbold_factor * ystr ); + ystr = (FT_Pos)( status.ybold_factor * ystr ); + + have_topleft = 0; + + for ( i = offset; i < num_indices; i++ ) + { + FT_UInt glyph_idx; + + + if ( status.encoding == FT_ENCODING_NONE ) + glyph_idx = (FT_UInt)i; + else + glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); + + error = FT_Load_Glyph( face, glyph_idx, handle->load_flags ); + if ( error ) + goto Next; + + /* this is essentially the code of function */ + /* `FT_GlyphSlot_Embolden' */ + + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) + { + FT_Outline_Transform( &slot->outline, &shear ); + + error = FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); + /* ignore error */ + } + else if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) + { + /* round to full pixels */ + xstr &= ~63; + ystr &= ~63; + + error = FT_GlyphSlot_Own_Bitmap( slot ); + if ( error ) + goto Next; + + error = FT_Bitmap_Embolden( slot->library, &slot->bitmap, + xstr, ystr ); + if ( error ) + goto Next; + } + else + goto Next; + + if ( slot->advance.x ) + slot->advance.x += xstr; + + if ( slot->advance.y ) + slot->advance.y += ystr; + + slot->metrics.width += xstr; + slot->metrics.height += ystr; + slot->metrics.horiAdvance += xstr; + slot->metrics.vertAdvance += ystr; + + if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) + slot->bitmap_top += ystr >> 6; + + if ( X_TOO_LONG( x, slot, display ) ) + { + x = start_x; + y += step_y; + + if ( Y_TOO_LONG( y, size, display ) ) + break; + } + + error = FTDemo_Draw_Slot( handle, display, slot, &x, &y ); + + if ( error ) + goto Next; + + if ( !have_topleft ) + { + have_topleft = 1; + status.topleft = i; + } + + continue; + + Next: + status.num_fails++; + } + + return error; + } + + + static FT_Error + Render_All( int num_indices, + int offset ) + { + int start_x, start_y, step_y, x, y; + int i, have_topleft; + FT_Size size; + FT_Face face; + FT_GlyphSlot slot; + + + error = FTDemo_Get_Size( handle, &size ); + + if ( error ) + { + /* probably a non-existent bitmap font size */ + return error; + } + + INIT_SIZE( size, start_x, start_y, step_y, x, y ); + face = size->face; + slot = face->glyph; + + have_topleft = 0; + + for ( i = offset; i < num_indices; i++ ) + { + FT_UInt glyph_idx; + + + if ( status.encoding == FT_ENCODING_NONE ) + glyph_idx = (FT_UInt)i; + else + glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)i ); + + error = FT_Load_Glyph( face, glyph_idx, handle->load_flags ); + if ( error ) + goto Next; + + if ( X_TOO_LONG( x, slot, display ) ) + { + x = start_x; + y += step_y; + + if ( Y_TOO_LONG( y, size, display ) ) + break; + } + + error = FTDemo_Draw_Slot( handle, display, slot, &x, &y ); + + if ( error ) + goto Next; + + if ( !have_topleft ) + { + have_topleft = 1; + status.topleft = i; + } + + continue; + + Next: + status.num_fails++; + } + + return FT_Err_Ok; + } + + +#undef X_TOO_LONG +#define X_TOO_LONG( x, size, display ) \ + ( (x) + ( (size)->metrics.max_advance >> 6 ) > \ + (display)->bitmap->width ) + + + static FT_Error + Render_Text( int num_indices, + int offset ) + { + int start_x, start_y, step_y, x, y; + FT_Size size; + int have_topleft; + + const char* p; + const char* pEnd; + int ch; + + + error = FTDemo_Get_Size( handle, &size ); + if ( error ) + { + /* probably a non-existent bitmap font size */ + return error; + } + + INIT_SIZE( size, start_x, start_y, step_y, x, y ); + + p = Text; + pEnd = p + strlen( Text ); + + while ( offset-- ) + { + ch = utf8_next( &p, pEnd ); + if ( ch < 0 ) + { + p = Text; + ch = utf8_next( &p, pEnd ); + } + } + + have_topleft = 0; + + while ( num_indices-- ) + { + FT_UInt glyph_idx; + + + ch = utf8_next( &p, pEnd ); + if ( ch < 0 ) + { + p = Text; + ch = utf8_next( &p, pEnd ); + + /* not a single character of the text string could be displayed */ + if ( !have_topleft ) + return error; + } + + glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)ch ); + + error = FTDemo_Draw_Index( handle, display, glyph_idx, &x, &y ); + + if ( error ) + goto Next; + + if ( !have_topleft ) + { + have_topleft = 1; + status.topleft = ch; + } + + /* Draw_Index adds one pixel space */ + x--; + + if ( X_TOO_LONG( x, size, display ) ) + { + x = start_x; + y += step_y; + + if ( Y_TOO_LONG( y, size, display ) ) + break; + } + + continue; + + Next: + status.num_fails++; + } + + return FT_Err_Ok; + } + + + static FT_Error + Render_Waterfall( int first_size, + int offset ) + { + int start_x, start_y, step_y, x, y; + int pt_size, max_size = 100000; + FT_Size size; + FT_Face face; + int have_topleft, start; + + char text[256]; + const char* p; + const char* pEnd; + + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + if ( error ) + { + /* can't access the font file: do not render anything */ + fprintf( stderr, "can't access font file %p\n", + (void*)handle->scaler.face_id ); + return 0; + } + + if ( !FT_IS_SCALABLE( face ) ) + { + int i; + + + max_size = 0; + for ( i = 0; i < face->num_fixed_sizes; i++ ) + if ( face->available_sizes[i].height >= max_size / 64 ) + max_size = face->available_sizes[i].height * 64; + } + + start_x = START_X; + start_y = START_Y; + + have_topleft = 0; + + for ( pt_size = first_size; pt_size < max_size; pt_size += 64 ) + { + int first = offset; + int ch; + + + FTDemo_Set_Current_Charsize( handle, pt_size, status.res ); + + error = FTDemo_Get_Size( handle, &size ); + if ( error ) + { + /* probably a non-existent bitmap font size */ + continue; + } + + step_y = ( size->metrics.height >> 6 ) + 1; + + x = start_x; + y = start_y + ( size->metrics.ascender >> 6 ); + + start_y += step_y; + + if ( y >= display->bitmap->rows ) + break; + + p = Text; + pEnd = p + strlen( Text ); + + while ( first-- ) + { + ch = utf8_next( &p, pEnd ); + if ( ch < 0 ) + { + p = Text; + ch = utf8_next( &p, pEnd ); + } + } + + start = snprintf( text, 256, "%g: ", pt_size / 64.0 ); + snprintf( text + start, (unsigned int)( 256 - start ), "%s", p ); + + p = text; + pEnd = p + strlen( text ); + + while ( 1 ) + { + FT_UInt glyph_idx; + const char* oldp; + + + oldp = p; + ch = utf8_next( &p, pEnd ); + if ( ch < 0 ) + { + /* end of the text (or invalid UTF-8); continue to next size */ + break; + } + + glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)ch ); + + error = FTDemo_Draw_Index( handle, display, glyph_idx, &x, &y ); + + if ( error ) + goto Next; + + /* `topleft' should be the first character after the size string */ + if ( oldp - text == start && !have_topleft ) + { + have_topleft = 1; + status.topleft = ch; + } + + /* Draw_Index adds one pixel space */ + x--; + + if ( X_TOO_LONG( x, size, display ) ) + break; + + continue; + + Next: + status.num_fails++; + } + } + + FTDemo_Set_Current_Charsize( handle, first_size, status.res ); + + return FT_Err_Ok; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** REST OF THE APPLICATION/PROGRAM *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + event_help( void ) + { + char buf[256]; + char version[64]; + + const char* format; + FT_Int major, minor, patch; + + grEvent dummy_event; + + + FT_Library_Version( handle->library, &major, &minor, &patch ); + + format = patch ? "%d.%d.%d" : "%d.%d"; + sprintf( version, format, major, minor, patch ); + + FTDemo_Display_Clear( display ); + grSetLineHeight( 10 ); + grGotoxy( 0, 0 ); + grSetMargin( 2, 1 ); + grGotobitmap( display->bitmap ); + + sprintf( buf, + "FreeType Glyph Viewer - part of the FreeType %s test suite", + version ); + + grWriteln( buf ); + grLn(); + grWriteln( "Use the following keys:" ); + grLn(); + /* |----------------------------------| |----------------------------------| */ + grWriteln( "F1, ? display this help screen " ); + grWriteln( " " ); + grWriteln( "render modes: anti-aliasing modes: " ); + grWriteln( " 1 all glyphs A monochrome " ); + grWriteln( " 2 all glyphs fancy B normal " ); + grWriteln( " (emboldened / slanted) C light " ); + grWriteln( " 3 all glyphs stroked D horizontal RGB (LCD) " ); + grWriteln( " 4 text string E horizontal BGR (LCD) " ); + grWriteln( " 5 waterfall F vertical RGB (LCD) " ); + grWriteln( " space cycle forwards G vertical BGR (LCD) " ); + grWriteln( " backspace cycle backwards k, l cycle back and forth " ); + grWriteln( " " ); + grWriteln( "b toggle embedded bitmaps x, X adjust horizontal " ); + grWriteln( "c toggle color glyphs emboldening (in mode 2)" ); + grWriteln( "K toggle cache modes y, Y adjust vertical " ); + grWriteln( " emboldening (in mode 2)" ); + grWriteln( "p, n previous/next font s, S adjust slanting " ); + grWriteln( " (in mode 2) " ); + grWriteln( "Up, Down adjust size by 1 unit r, R adjust stroking radius " ); + grWriteln( "PgUp, PgDn adjust size by 10 units (in mode 3) " ); + grWriteln( " " ); + grWriteln( "Left, Right adjust index by 1 L cycle through " ); + grWriteln( "F7, F8 adjust index by 16 LCD filtering " ); + grWriteln( "F9, F10 adjust index by 256 [, ] select custom LCD " ); + grWriteln( "F11, F12 adjust index by 4096 filter weight " ); + grWriteln( " (if custom filtering) " ); + grWriteln( "h toggle hinting -, +(=) adjust selected custom " ); + grWriteln( "H cycle through hinting LCD filter weight " ); + grWriteln( " engines (if available) " ); + grWriteln( "f toggle forced auto- g, v adjust gamma value " ); + grWriteln( " hinting (if hinting) " ); + grWriteln( "w toggle warping (in light Tab cycle through charmaps " ); + grWriteln( " AA mode, if available) " ); + grWriteln( " " ); + grWriteln( " q, ESC quit ftview " ); + /* |----------------------------------| |----------------------------------| */ + grLn(); + grLn(); + grWriteln( "press any key to exit this help screen" ); + + grRefreshSurface( display->surface ); + grListenSurface( display->surface, gr_event_key, &dummy_event ); + } + + + static int + event_cff_hinting_engine_change( unsigned int delta ) + { + unsigned int new_cff_hinting_engine = 0; + + + if ( delta ) + new_cff_hinting_engine = + ( status.cff_hinting_engine + + delta + + N_CFF_HINTING_ENGINES ) % N_CFF_HINTING_ENGINES; + + error = FT_Property_Set( handle->library, + "cff", + "hinting-engine", + &new_cff_hinting_engine ); + + if ( !error ) + { + /* Resetting the cache is perhaps a bit harsh, but I'm too */ + /* lazy to walk over all loaded fonts to check whether they */ + /* are of type CFF, then unloading them explicitly. */ + FTC_Manager_Reset( handle->cache_manager ); + status.cff_hinting_engine = new_cff_hinting_engine; + return 1; + } + + return 0; + } + + + static int + event_tt_interpreter_version_change( void ) + { + status.tt_interpreter_version_idx += 1; + status.tt_interpreter_version_idx %= status.num_tt_interpreter_versions; + + error = FT_Property_Set( handle->library, + "truetype", + "interpreter-version", + &status.tt_interpreter_versions[ + status.tt_interpreter_version_idx] ); + + if ( !error ) + { + /* Resetting the cache is perhaps a bit harsh, but I'm too */ + /* lazy to walk over all loaded fonts to check whether they */ + /* are of type TTF, then unloading them explicitly. */ + FTC_Manager_Reset( handle->cache_manager ); + return 1; + } + + return 0; + } + + + static int + event_warping_change( void ) + { + if ( handle->lcd_mode == LCD_MODE_LIGHT ) + { + FT_Bool new_warping_state = !status.warping; + + + error = FT_Property_Set( handle->library, + "autofitter", + "warping", + &new_warping_state ); + + if ( !error ) + { + /* Resetting the cache is perhaps a bit harsh, but I'm too */ + /* lazy to walk over all loaded fonts to check whether they */ + /* are auto-hinted, then unloading them explicitly. */ + FTC_Manager_Reset( handle->cache_manager ); + status.warping = new_warping_state; + return 1; + } + } + + return 0; + } + + + static void + event_gamma_change( double delta ) + { + status.gamma += delta; + + if ( status.gamma > 3.0 ) + status.gamma = 3.0; + else if ( status.gamma < 0.0 ) + status.gamma = 0.0; + + grSetGlyphGamma( status.gamma ); + } + + + static int + event_bold_change( double xdelta, + double ydelta ) + { + double old_xbold_factor = status.xbold_factor; + double old_ybold_factor = status.ybold_factor; + + + status.xbold_factor += xdelta; + status.ybold_factor += ydelta; + + if ( status.xbold_factor > 0.1 ) + status.xbold_factor = 0.1; + else if ( status.xbold_factor < -0.1 ) + status.xbold_factor = -0.1; + + if ( status.ybold_factor > 0.1 ) + status.ybold_factor = 0.1; + else if ( status.ybold_factor < -0.1 ) + status.ybold_factor = -0.1; + + return ( old_xbold_factor == status.xbold_factor && + old_ybold_factor == status.ybold_factor ) ? 0 : 1; + } + + + static int + event_radius_change( double delta ) + { + double old_radius = status.radius; + + + status.radius += delta; + + if ( status.radius > 0.05 ) + status.radius = 0.05; + else if ( status.radius < 0.0 ) + status.radius = 0.0; + + return old_radius == status.radius ? 0 : 1; + } + + + static int + event_slant_change( double delta ) + { + double old_slant = status.slant; + + + status.slant += delta; + + if ( status.slant > 1.0 ) + status.slant = 1.0; + else if ( status.slant < -1.0 ) + status.slant = -1.0; + + return old_slant == status.slant ? 0 : 1; + } + + + static int + event_size_change( int delta ) + { + int old_ptsize = status.ptsize; + + + status.ptsize += delta; + + if ( status.ptsize < 64 * 1 ) + status.ptsize = 1 * 64; + else if ( status.ptsize > MAXPTSIZE * 64 ) + status.ptsize = MAXPTSIZE * 64; + + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + + return old_ptsize == status.ptsize ? 0 : 1; + } + + + static int + event_index_change( int delta ) + { + int old_offset = status.offset; + int num_indices = handle->current_font->num_indices; + + + status.offset += delta; + + if ( status.offset < 0 ) + status.offset = 0; + else if ( status.offset >= num_indices ) + status.offset = num_indices - 1; + + return old_offset == status.offset ? 0 : 1; + } + + + static void + event_render_mode_change( int delta ) + { + if ( delta ) + status.render_mode = ( status.render_mode + + delta + + N_RENDER_MODES ) % N_RENDER_MODES; + } + + + static int + event_encoding_change( void ) + { + PFont font = handle->fonts[status.font_idx]; + FT_Face face; + + + if ( status.encoding != FT_ENCODING_NONE ) + font->cmap_index++; + else + font->cmap_index = 0; + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + + if ( font->cmap_index < face->num_charmaps ) + { + status.encoding = face->charmaps[font->cmap_index]->encoding; + status.offset = 0x20; + + if ( status.encoding == FT_ENCODING_NONE ) /* OTHER, really */ + status.encoding = FT_ENCODING_OTHER; + } + else + { + status.encoding = FT_ENCODING_NONE; + status.offset = 0; + } + + switch ( status.encoding ) + { + case FT_ENCODING_NONE: + font->num_indices = face->num_glyphs; + break; + + case FT_ENCODING_UNICODE: + font->num_indices = 0x110000L; + break; + + case FT_ENCODING_ADOBE_LATIN_1: + case FT_ENCODING_ADOBE_STANDARD: + case FT_ENCODING_ADOBE_EXPERT: + case FT_ENCODING_ADOBE_CUSTOM: + case FT_ENCODING_APPLE_ROMAN: + font->num_indices = 0x100L; + break; + + /* some fonts use range 0x00-0x100, others have 0xF000-0xF0FF */ + case FT_ENCODING_MS_SYMBOL: + default: + font->num_indices = 0x10000L; + } + + return 1; + } + + + static int + event_font_change( int delta ) + { + int num_indices; + + + if ( status.font_idx + delta >= handle->num_fonts || + status.font_idx + delta < 0 ) + return 0; + + status.font_idx += delta; + + FTDemo_Set_Current_Font( handle, handle->fonts[status.font_idx] ); + FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res ); + FTDemo_Update_Current_Flags( handle ); + + num_indices = handle->current_font->num_indices; + + if ( status.offset >= num_indices ) + status.offset = num_indices - 1; + + return 1; + } + + + static int + Process_Event( grEvent* event ) + { + int ret = 0; + + + status.update = 0; + + if ( status.render_mode == (int)( event->key - '1' ) ) + return ret; + if ( event->key >= '1' && event->key < '1' + N_RENDER_MODES ) + { + status.render_mode = event->key - '1'; + event_render_mode_change( 0 ); + status.update = 1; + return ret; + } + + if ( event->key >= 'A' && + event->key < 'A' + N_LCD_IDXS ) + { + int lcd_idx = (int)( event->key - 'A' ); + + + if ( status.lcd_idx == lcd_idx ) + return ret; + + handle->lcd_mode = lcd_modes[lcd_idx]; + FTDemo_Update_Current_Flags( handle ); + status.update = 1; + status.lcd_idx = lcd_idx; + return ret; + } + + switch ( event->key ) + { + case grKeyEsc: + case grKEY( 'q' ): + ret = 1; + break; + + case grKeyF1: + case grKEY( '?' ): + event_help(); + status.update = 1; + break; + + case grKEY( 'b' ): + handle->use_sbits = !handle->use_sbits; + FTDemo_Update_Current_Flags( handle ); + status.update = 1; + break; + + case grKEY( 'c' ): + handle->color = !handle->color; + FTDemo_Update_Current_Flags( handle ); + status.update = 1; + break; + + case grKEY( 'K' ): + handle->use_sbits_cache = !handle->use_sbits_cache; + status.update = 1; + break; + + case grKEY( 'f' ): + if ( handle->hinted ) + { + handle->autohint = !handle->autohint; + FTDemo_Update_Current_Flags( handle ); + status.update = 1; + } + break; + + case grKEY( 'h' ): + handle->hinted = !handle->hinted; + FTDemo_Update_Current_Flags( handle ); + status.update = 1; + break; + + case grKEY( 'H' ): + if ( !handle->autohint && + handle->lcd_mode != LCD_MODE_LIGHT ) + { + FT_Face face; + FT_Module module; + + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + if ( !error ) + { + module = &face->driver->root; + + if ( !strcmp( module->clazz->module_name, "cff" ) ) + status.update = event_cff_hinting_engine_change( 1 ); + else if ( !strcmp( module->clazz->module_name, "truetype" ) ) + status.update = event_tt_interpreter_version_change(); + } + } + break; + + case grKEY( 'l' ): + case grKEY( 'k' ): + status.lcd_idx = + ( status.lcd_idx + + ( event->key == grKEY( 'l' ) ? 1 : -1 ) + + N_LCD_IDXS ) % N_LCD_IDXS; + + handle->lcd_mode = lcd_modes[status.lcd_idx]; + FTDemo_Update_Current_Flags( handle ); + status.update = 1; + break; + + case grKEY( 'w' ): + status.update = event_warping_change(); + break; + + case grKeySpace: + event_render_mode_change( 1 ); + status.update = 1; + break; + + case grKeyBackSpace: + event_render_mode_change( -1 ); + status.update = 1; + break; + + case grKeyTab: + status.update = event_encoding_change(); + break; + + case grKEY( 's' ): + if ( status.render_mode == RENDER_MODE_FANCY ) + status.update = event_slant_change( 0.02 ); + break; + + case grKEY( 'S' ): + if ( status.render_mode == RENDER_MODE_FANCY ) + status.update = event_slant_change( -0.02 ); + break; + + case grKEY( 'r' ): + if ( status.render_mode == RENDER_MODE_STROKE ) + status.update = event_radius_change( 0.005 ); + break; + + case grKEY( 'R' ): + if ( status.render_mode == RENDER_MODE_STROKE ) + status.update = event_radius_change( -0.005 ); + break; + + case grKEY( 'x' ): + if ( status.render_mode == RENDER_MODE_FANCY ) + status.update = event_bold_change( 0.005, 0.0 ); + break; + + case grKEY( 'X' ): + if ( status.render_mode == RENDER_MODE_FANCY ) + status.update = event_bold_change( -0.005, 0.0 ); + break; + + case grKEY( 'y' ): + if ( status.render_mode == RENDER_MODE_FANCY ) + status.update = event_bold_change( 0.0, 0.005 ); + break; + + case grKEY( 'Y' ): + if ( status.render_mode == RENDER_MODE_FANCY ) + status.update = event_bold_change( 0.0, -0.005 ); + break; + + case grKEY( 'g' ): + event_gamma_change( 0.1 ); + status.update = 1; + break; + + case grKEY( 'v' ): + event_gamma_change( -0.1 ); + status.update = 1; + break; + + case grKEY( 'n' ): + status.update = event_font_change( 1 ); + break; + + case grKEY( 'p' ): + status.update = event_font_change( -1 ); + break; + + case grKeyUp: + status.update = event_size_change( 64 ); + break; + case grKeyDown: + status.update = event_size_change( -64 ); + break; + case grKeyPageUp: + status.update = event_size_change( 640 ); + break; + case grKeyPageDown: + status.update = event_size_change( -640 ); + break; + + case grKeyLeft: + status.update = event_index_change( -1 ); + break; + case grKeyRight: + status.update = event_index_change( 1 ); + break; + case grKeyF7: + status.update = event_index_change( -0x10 ); + break; + case grKeyF8: + status.update = event_index_change( 0x10 ); + break; + case grKeyF9: + status.update = event_index_change( -0x100 ); + break; + case grKeyF10: + status.update = event_index_change( 0x100 ); + break; + case grKeyF11: + status.update = event_index_change( -0x1000 ); + break; + case grKeyF12: + status.update = event_index_change( 0x1000 ); + break; + + default: + break; + } + + if ( handle->lcd_mode < LCD_MODE_RGB ) + return ret; + + switch ( event->key ) + { + case grKEY( 'L' ): + FTC_Manager_RemoveFaceID( handle->cache_manager, + handle->scaler.face_id ); + + status.lcd_filter++; + switch ( status.lcd_filter ) + { + case FT_LCD_FILTER_NONE: + case FT_LCD_FILTER_DEFAULT: + case FT_LCD_FILTER_LIGHT: + case FT_LCD_FILTER_LEGACY1: + FT_Library_SetLcdFilter( handle->library, + (FT_LcdFilter)status.lcd_filter ); + break; + default: + FT_Library_SetLcdFilterWeights( handle->library, + status.filter_weights ); + status.lcd_filter = -1; + } + + status.update = 1; + break; + + case grKEY( '[' ): + if ( status.lcd_filter < 0 ) + { + status.fw_idx--; + if ( status.fw_idx < 0 ) + status.fw_idx = 4; + status.update = 1; + } + break; + + case grKEY( ']' ): + if ( status.lcd_filter < 0 ) + { + status.fw_idx++; + if ( status.fw_idx > 4 ) + status.fw_idx = 0; + status.update = 1; + } + break; + + case grKEY( '-' ): + if ( status.lcd_filter < 0 ) + { + FTC_Manager_RemoveFaceID( handle->cache_manager, + handle->scaler.face_id ); + + status.filter_weights[status.fw_idx]--; + FT_Library_SetLcdFilterWeights( handle->library, + status.filter_weights ); + status.update = 1; + } + break; + + case grKEY( '+' ): + case grKEY( '=' ): + if ( status.lcd_filter < 0 ) + { + FTC_Manager_RemoveFaceID( handle->cache_manager, + handle->scaler.face_id ); + + status.filter_weights[status.fw_idx]++; + FT_Library_SetLcdFilterWeights( handle->library, + status.filter_weights ); + status.update = 1; + } + break; + + default: + break; + } + + return ret; + } + + + static void + write_header( FT_Error error_code ) + { + FT_Face face; + char buf[256]; + const char* basename; + const char* format; + + int line = 0, x; + + + error = FTC_Manager_LookupFace( handle->cache_manager, + handle->scaler.face_id, &face ); + if ( error ) + Fatal( "can't access font file" ); + + /* font and file name */ + basename = ft_basename( handle->current_font->filepathname ); + sprintf( buf, "%.50s %.50s (file `%.100s')", + face->family_name, face->style_name, basename ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* pt and dpi */ + x = sprintf( buf, "%gpt at %ddpi ", + status.ptsize / 64.0, status.res ); + grWriteCellString( display->bitmap, 0, line * HEADER_HEIGHT, + buf, display->fore_color ); + + if ( error_code == FT_Err_Ok ) + { + /* ppem */ + if ( face->face_flags & FT_FACE_FLAG_SCALABLE ) + sprintf( buf, "(%.4gppem)", + FT_MulFix( face->units_per_EM, + face->size->metrics.y_scale ) / 64.0 ); + else + sprintf( buf, "(%dppem)", + face->size->metrics.y_ppem ); + grWriteCellString( display->bitmap, 8 * x , (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + else + { + /* errors */ + switch ( error_code ) + { + case FT_Err_Invalid_Pixel_Size: + sprintf( buf, "Invalid pixel size" ); + break; + case FT_Err_Invalid_PPem: + sprintf( buf, "Invalid ppem value" ); + break; + default: + sprintf( buf, "error 0x%04x", + (FT_UShort)error_code ); + } + grWriteCellString( display->bitmap, 8 * x, (line++) * HEADER_HEIGHT, + buf, display->warn_color ); + } + + /* char code, glyph index, glyph name */ + if ( status.encoding == FT_ENCODING_UNICODE || + status.render_mode == RENDER_MODE_TEXT || + status.render_mode == RENDER_MODE_WATERFALL ) + sprintf( buf, "top left charcode: U+%04X (glyph idx %d)", + status.topleft, + FTDemo_Get_Index( handle, (FT_UInt32)status.topleft ) ); + else if ( status.encoding == FT_ENCODING_NONE ) + sprintf( buf, "top left glyph idx: %d", + status.topleft ); + else + sprintf( buf, "top left charcode: 0x%X (glyph idx %d)", + status.topleft, + FTDemo_Get_Index( handle, (FT_UInt32)status.topleft ) ); + + if ( FT_HAS_GLYPH_NAMES( face ) ) + { + char* p; + unsigned int format_len, glyph_idx, size; + + + size = strlen( buf ); + p = buf + size; + size = 256 - size; + + format = ", name: "; + format_len = strlen( format ); + + if ( size >= format_len + 2 ) + { + glyph_idx = (unsigned int)status.topleft; + if ( status.encoding != FT_ENCODING_NONE || + status.render_mode == RENDER_MODE_TEXT || + status.render_mode == RENDER_MODE_WATERFALL ) + glyph_idx = FTDemo_Get_Index( handle, (FT_UInt32)status.topleft ); + + strcpy( p, format ); + if ( FT_Get_Glyph_Name( face, glyph_idx, + p + format_len, size - format_len ) ) + *p = '\0'; + } + } + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + line++; + + if ( face->face_index >> 16 ) + { + sprintf( buf, "instance %ld/%ld", + face->face_index >> 16, + face->style_flags >> 16 ); + + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + else + line++; + + /* encoding */ + if ( !( status.render_mode == RENDER_MODE_TEXT || + status.render_mode == RENDER_MODE_WATERFALL ) ) + { + const char* encoding = NULL; + + + switch ( status.encoding ) + { + case FT_ENCODING_NONE: + encoding = "glyph order"; + break; + case FT_ENCODING_MS_SYMBOL: + encoding = "MS Symbol"; + break; + case FT_ENCODING_UNICODE: + encoding = "Unicode"; + break; + case FT_ENCODING_SJIS: + encoding = "SJIS"; + break; + case FT_ENCODING_PRC: + encoding = "PRC"; + break; + case FT_ENCODING_BIG5: + encoding = "Big5"; + break; + case FT_ENCODING_WANSUNG: + encoding = "Wansung"; + break; + case FT_ENCODING_JOHAB: + encoding = "Johab"; + break; + case FT_ENCODING_ADOBE_STANDARD: + encoding = "Adobe Standard"; + break; + case FT_ENCODING_ADOBE_EXPERT: + encoding = "Adobe Expert"; + break; + case FT_ENCODING_ADOBE_CUSTOM: + encoding = "Adobe Custom"; + break; + case FT_ENCODING_ADOBE_LATIN_1: + encoding = "Latin 1"; + break; + case FT_ENCODING_OLD_LATIN_2: + encoding = "Latin 2"; + break; + case FT_ENCODING_APPLE_ROMAN: + encoding = "Apple Roman"; + break; + default: + encoding = "Other"; + } + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + encoding, display->fore_color ); + } + + /* render mode */ + { + const char* render_mode = NULL; + + + switch ( status.render_mode ) + { + case RENDER_MODE_ALL: + render_mode = "all glyphs"; + break; + case RENDER_MODE_FANCY: + render_mode = "fancy"; + break; + case RENDER_MODE_STROKE: + render_mode = "stroked"; + break; + case RENDER_MODE_TEXT: + render_mode = "text string"; + break; + case RENDER_MODE_WATERFALL: + render_mode = "waterfall"; + break; + } + sprintf( buf, "%d: %s", + status.render_mode + 1, + render_mode ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + + if ( status.render_mode == RENDER_MODE_FANCY ) + { + /* x emboldening */ + sprintf( buf, " x: % .3f", + status.xbold_factor ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* y emboldening */ + sprintf( buf, " y: % .3f", + status.ybold_factor ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* slanting */ + sprintf( buf, " s: % .3f", + status.slant ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + + if ( status.render_mode == RENDER_MODE_STROKE ) + { + /* stroking radius */ + sprintf( buf, " radius: %.3f", + status.radius ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + + line++; + + /* anti-aliasing */ + { + const char* lcd_mode; + + + switch ( handle->lcd_mode ) + { + case LCD_MODE_AA: + lcd_mode = "normal AA"; + break; + case LCD_MODE_LIGHT: + lcd_mode = "light AA"; + break; + case LCD_MODE_RGB: + lcd_mode = "LCD (horiz. RGB)"; + break; + case LCD_MODE_BGR: + lcd_mode = "LCD (horiz. BGR)"; + break; + case LCD_MODE_VRGB: + lcd_mode = "LCD (vert. RGB)"; + break; + case LCD_MODE_VBGR: + lcd_mode = "LCD (vert. BGR)"; + break; + default: + handle->lcd_mode = 0; + lcd_mode = "monochrome"; + } + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + lcd_mode, display->fore_color ); + } + + /* hinting */ + sprintf( buf, "hinting: %s", + handle->hinted ? "on" : "off" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + if ( handle->hinted ) + { + /* auto-hinting */ + sprintf( buf, " forced auto: %s", + ( handle->autohint || + handle->lcd_mode == LCD_MODE_LIGHT ) ? "on" : "off" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + + if ( !handle->autohint && + handle->lcd_mode != LCD_MODE_LIGHT ) + { + /* hinting engine */ + + FT_Module module = &face->driver->root; + const char* hinting_engine = NULL; + + + if ( !strcmp( module->clazz->module_name, "cff" ) ) + { + switch ( status.cff_hinting_engine ) + { + case FT_CFF_HINTING_FREETYPE: + hinting_engine = "FreeType"; + break; + case FT_CFF_HINTING_ADOBE: + hinting_engine = "Adobe"; + break; + } + } + + else if ( !strcmp( module->clazz->module_name, "truetype" ) ) + { + switch ( status.tt_interpreter_versions[ + status.tt_interpreter_version_idx] ) + { + case TT_INTERPRETER_VERSION_35: + hinting_engine = "v35"; + break; + case TT_INTERPRETER_VERSION_38: + hinting_engine = "v38"; + break; + case TT_INTERPRETER_VERSION_40: + hinting_engine = "v40"; + break; + } + } + + if ( hinting_engine ) + { + sprintf( buf, "engine: %s", + hinting_engine ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + } + + if ( handle->lcd_mode == LCD_MODE_LIGHT ) + { + sprintf( buf, "warping: %s", + status.warping ? "on" : "off" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + + line++; + + /* embedded bitmaps */ + sprintf( buf, "bitmaps: %s", + handle->use_sbits ? "on" : "off" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* embedded color bitmaps */ + sprintf( buf, "color bitmaps: %s", + handle->color ? "on" : "off" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* cache */ + sprintf( buf, "cache: %s", + handle->use_sbits_cache ? "on" : "off" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* gamma */ + if ( status.gamma == 0.0 ) + sprintf( buf, "gamma: sRGB mode" ); + else + sprintf( buf, "gamma: %.1f", status.gamma ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + line++; + + /* LCD filtering */ + if ( handle->lcd_mode >= LCD_MODE_RGB ) + { + sprintf( buf, "filter: %s", + status.lcd_filter == 0 ? "none" : + status.lcd_filter == 1 ? "default" : + status.lcd_filter == 2 ? "light" : + status.lcd_filter == 3 ? "legacy" : "custom" ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + + /* custom LCD filter settings */ + if ( status.lcd_filter < 0 ) + { + int fwi = status.fw_idx; + unsigned char* fw = status.filter_weights; + int i; + + + for ( i = 0; i < 5; i++ ) + { + sprintf( buf, + " %s0x%02X%s", + fwi == i ? "[" : " ", + fw[i], + fwi == i ? "]" : " " ); + grWriteCellString( display->bitmap, 0, (line++) * HEADER_HEIGHT, + buf, display->fore_color ); + } + } + } + + grRefreshSurface( display->surface ); + } + + + static void + usage( char* execname ) + { + fprintf( stderr, + "\n" + "ftview: simple glyph viewer -- part of the FreeType project\n" + "-----------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] pt font ...\n" + "\n", + execname ); + fprintf( stderr, + " pt The point size for the given resolution.\n" + " If resolution is 72dpi, this directly gives the\n" + " ppem value (pixels per EM).\n" ); + fprintf( stderr, + " font The font file(s) to display.\n" + " For Type 1 font files, ftview also tries to attach\n" + " the corresponding metrics file (with extension\n" + " `.afm' or `.pfm').\n" + "\n" ); + fprintf( stderr, + " -w W Set the window width to W pixels (default: %dpx).\n" + " -h H Set the window height to H pixels (default: %dpx).\n" + "\n", + DIM_X, DIM_Y ); + fprintf( stderr, + " -r R Use resolution R dpi (default: 72dpi).\n" + " -f index Specify first index to display (default: 0).\n" + " -e enc Specify encoding tag (default: no encoding).\n" + " Common values: `unic' (Unicode), `symb' (symbol),\n" + " `ADOB' (Adobe standard), `ADBC' (Adobe custom).\n" + " -m text Use `text' for rendering.\n" ); + fprintf( stderr, + " -l mode Set start-up rendering mode (0 <= mode <= %d).\n", + N_LCD_IDXS ); + fprintf( stderr, + " -p Preload file in memory to simulate memory-mapping.\n" + "\n" + " -v Show version.\n" + "\n" ); + + exit( 1 ); + } + + + static void + parse_cmdline( int* argc, + char** argv[] ) + { + char* execname; + int option; + + + execname = ft_basename( (*argv)[0] ); + + while ( 1 ) + { + option = getopt( *argc, *argv, "e:f:h:l:m:pr:vw:" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'e': + status.encoding = FTDemo_Make_Encoding_Tag( optarg ); + break; + + case 'f': + status.offset = atoi( optarg ); + break; + + case 'h': + status.height = atoi( optarg ); + if ( status.height < 1 ) + usage( execname ); + break; + + case 'l': + status.lcd_idx = atoi( optarg ); + if ( status.lcd_idx < 0 || status.lcd_idx > N_LCD_IDXS ) + { + fprintf( stderr, "argument to `l' must be between 0 and %d\n", + N_LCD_IDXS ); + exit( 3 ); + } + break; + + case 'm': + Text = optarg; + status.render_mode = RENDER_MODE_TEXT; + break; + + case 'p': + status.preload = 1; + break; + + case 'r': + status.res = atoi( optarg ); + if ( status.res < 1 ) + usage( execname ); + break; + + case 'v': + { + FT_Int major, minor, patch; + + + FT_Library_Version( handle->library, &major, &minor, &patch ); + + printf( "ftview (FreeType) %d.%d", major, minor ); + if ( patch ) + printf( ".%d", patch ); + printf( "\n" ); + exit( 0 ); + } + /* break; */ + + case 'w': + status.width = atoi( optarg ); + if ( status.width < 1 ) + usage( execname ); + break; + + default: + usage( execname ); + break; + } + } + + *argc -= optind; + *argv += optind; + + if ( *argc <= 1 ) + usage( execname ); + + status.ptsize = (int)( atof( *argv[0] ) * 64.0 ); + if ( status.ptsize == 0 ) + status.ptsize = 64 * 10; + + (*argc)--; + (*argv)++; + } + + + int + main( int argc, + char* argv[] ) + { + grEvent event; + unsigned int dflt_tt_interpreter_version; + int i; + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + + + /* Initialize engine */ + handle = FTDemo_New(); + + parse_cmdline( &argc, &argv ); + + FT_Library_SetLcdFilter( handle->library, FT_LCD_FILTER_DEFAULT ); + + /* get the default value as compiled into FreeType */ + FT_Property_Get( handle->library, + "cff", + "hinting-engine", &status.cff_hinting_engine ); + + /* collect all available versions, then set again the default */ + FT_Property_Get( handle->library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( i = 0; i < 3; i++ ) + { + error = FT_Property_Set( handle->library, + "truetype", + "interpreter-version", &versions[i] ); + if ( !error ) + status.tt_interpreter_versions[ + status.num_tt_interpreter_versions++] = versions[i]; + if ( versions[i] == dflt_tt_interpreter_version ) + status.tt_interpreter_version_idx = i; + } + FT_Property_Set( handle->library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + + FT_Property_Get( handle->library, + "autofitter", + "warping", &status.warping ); + + handle->encoding = status.encoding; + + if ( status.preload ) + FTDemo_Set_Preload( handle, 1 ); + + for ( ; argc > 0; argc--, argv++ ) + FTDemo_Install_Font( handle, argv[0], 0, 0 ); + + if ( handle->num_fonts == 0 ) + Fatal( "could not find/open any font file" ); + + display = FTDemo_Display_New( gr_pixel_mode_rgb24, + status.width, status.height ); + if ( !display ) + Fatal( "could not allocate display surface" ); + + grSetTitle( display->surface, + "FreeType Glyph Viewer - press ? for help" ); + + status.num_fails = 0; + + event_font_change( 0 ); + + handle->lcd_mode = lcd_modes[status.lcd_idx]; + + FTDemo_Update_Current_Flags( handle ); + + do + { + if ( !status.update ) + goto Listen; + + FTDemo_Display_Clear( display ); + + switch ( status.render_mode ) + { + case RENDER_MODE_ALL: + error = Render_All( handle->current_font->num_indices, + status.offset ); + break; + + case RENDER_MODE_FANCY: + error = Render_Fancy( handle->current_font->num_indices, + status.offset ); + break; + + case RENDER_MODE_STROKE: + error = Render_Stroke( handle->current_font->num_indices, + status.offset ); + break; + + case RENDER_MODE_TEXT: + error = Render_Text( -1, status.offset ); + break; + + case RENDER_MODE_WATERFALL: + error = Render_Waterfall( status.ptsize, status.offset ); + break; + } + + write_header( error ); + + Listen: + grListenSurface( display->surface, 0, &event ); + } while ( Process_Event( &event ) == 0 ); + + printf( "Execution completed successfully.\n" ); + printf( "Fails = %d\n", status.num_fails ); + + FTDemo_Display_Done( display ); + FTDemo_Done( handle ); + exit( 0 ); /* for safety reasons */ + + /* return 0; */ /* never reached */ + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/gbench.c freetype-2.8/=unpacked-tar2=/src/gbench.c --- freetype-2.7.1/=unpacked-tar2=/src/gbench.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/gbench.c 2015-09-25 05:43:17.000000000 +0000 @@ -0,0 +1,750 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality font engine */ +/* */ +/* Copyright 2006 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* gbench is a small program used to benchmark a new algorithm */ +/* performing gamma-corrected alpha-blending. */ +/* */ +/* EXPERIMENTAL: The numbers given here do not correspond to */ +/* typical usage patterns yet, and the algorithm */ +/* can still be tuned. */ +/* */ +/****************************************************************************/ + + +#include +#include +#include +#include +#include + + /* + * gbench is a small program used to benchmark a new algorithm + * performing gamma-corrected alpha-blending. + * + * EXPERIMENTAL: the numbers given here do not correspond to + * typical usage patterns yet, and the algorithm + * can still be tuned + * + */ + +#ifdef UNIX +#include +#endif +#include "gbench.h" + +#define xxCACHE + + static int use_gamma = 0; + static unsigned char gamma_ramp[256]; + static unsigned char gamma_ramp_inv[256]; + + +#define ALGO_KEY_COUNT 256 +#define ALGO_GRADE_BITS 5 +#define ALGO_GRADE_COUNT (1 << ALGO_GRADE_BITS) +#define ALGO_GRADE_INDEX(x) ((x) >> (8-ALGO_GRADE_BITS)) + + typedef struct CKeyRec_ + { + int background; + int foreground; + unsigned char* grades; + + } CKeyRec, *CKey; + + static CKeyRec ckeys [ ALGO_KEY_COUNT ]; + static unsigned char cgrades[ ALGO_KEY_COUNT * ALGO_GRADE_COUNT * 3 ]; + + static chits = 0; + static cmiss1 = 0; + static cmiss2 = 0; + + + /* clear the cache + */ + static void + cclear( void ) + { + int nn; + + for ( nn = 0; nn < ALGO_KEY_COUNT; nn++ ) + ckeys[nn].grades = NULL; + } + + /* recompute the grade levels of a given key + */ + static void + ckey_reset( CKey key ) + { + int back = key->background; + int fore = key->foreground; + unsigned char* gr = key->grades; + int nn; + + int r1,g1,b1,r2,g2,b2; + + r1 = (unsigned char)( back >> 16 ); + g1 = (unsigned char)( back >> 8 ); + b1 = (unsigned char)( back ); + + r2 = (unsigned char)( fore >> 16 ); + g2 = (unsigned char)( fore >> 8 ); + b2 = (unsigned char)( fore ); + + gr[0] = r1; + gr[1] = g1; + gr[2] = b1; + + gr[3] = r2; + gr[4] = g2; + gr[5] = b2; + + gr += 6; + + if ( use_gamma ) + { + r1 = gamma_ramp_inv[r1]; + g1 = gamma_ramp_inv[g1]; + b1 = gamma_ramp_inv[b1]; + + r2 = gamma_ramp_inv[r2]; + g2 = gamma_ramp_inv[g2]; + b2 = gamma_ramp_inv[b2]; + } + + for ( nn = 1; nn < ALGO_GRADE_COUNT-1; nn++ ) + { + int r = r1 + ((r2-r1)*nn)/(ALGO_GRADE_COUNT-1); + int g = g1 + ((g2-g1)*nn)/(ALGO_GRADE_COUNT-1); + int b = b1 + ((b2-b1)*nn)/(ALGO_GRADE_COUNT-1); + + if ( use_gamma ) + { + r = gamma_ramp[r]; + g = gamma_ramp[g]; + b = gamma_ramp[b]; + } + + gr[0] = (unsigned char)r; + gr[1] = (unsigned char)g; + gr[2] = (unsigned char)b; + + gr += 3; + } + cmiss2 ++; + } + + /* lookup the grades of a given (background,foreground) couple + */ + static const unsigned char* + clookup( int background, + int foreground ) + { + int index, index0; + CKey key; + + cmiss1++; + + index0 = ( background + foreground*7 ) % ALGO_KEY_COUNT; + index = index0; + do + { + key = ckeys + index; + + if ( key->grades == NULL ) + goto NewNode; + + if ( key->background == background && + key->foreground == foreground ) + goto Exit; + + index = (index+1) % ALGO_KEY_COUNT; + } + while ( index != index0 ); + + /* the cache is full, clear it completely + */ + cclear(); + + NewNode: + key->background = background; + key->foreground = foreground; + key->grades = cgrades + index0*(3*ALGO_GRADE_COUNT); + + ckey_reset( key ); + + Exit: + return (const unsigned char*)key->grades; + } + + + + void + ggamma_set( double gamma ) + { + int ii; + double gamma_inv = 1.0f / gamma; + + cclear(); + + for ( ii = 0; ii < 256; ii++ ) + gamma_ramp[ii] = (unsigned char)( pow( (double)ii/255.0f, gamma )*255 ); + + for ( ii = 0; ii < 256; ii++ ) + gamma_ramp_inv[ii] = (unsigned char)( pow( (double)ii/255.0f, gamma_inv ) * 255.0f ); + + use_gamma = (gamma != 1.0f); + } + + + + static void + gblitter_blitrgb24_gray_direct( GBlitter blitter, + int color ) + { + unsigned char r = (unsigned char)(color >> 16); + unsigned char g = (unsigned char)(color >> 8); + unsigned char b = (unsigned char)(color); + + int h = blitter->height; + unsigned char* src_line = blitter->src_line; + unsigned char* dst_line = blitter->dst_line; + + if ( use_gamma ) + { + int r1 = gamma_ramp_inv[r]; + int g1 = gamma_ramp_inv[g]; + int b1 = gamma_ramp_inv[b]; + + do + { + unsigned char* src = src_line + (blitter->src_x); + unsigned char* dst = dst_line + (blitter->dst_x*3); + int w = blitter->width; + + do + { + int a = src[0]; + + if ( a < 2 ) + { + /* nothing */ + } + else if ( a >= 254 ) + { + dst[0] = r; + dst[1] = g; + dst[2] = b; + } + else + { + int r0 = dst[0]; + int g0 = dst[1]; + int b0 = dst[2]; + + r0 = gamma_ramp_inv[r0]; + g0 = gamma_ramp_inv[g0]; + b0 = gamma_ramp_inv[b0]; + + a = a + (a >> 7); + + r0 += (r1 - r0)*a/256; + g0 += (g1 - g0)*a/256; + b0 += (b1 - b0)*a/256; + + r0 = gamma_ramp[r0]; + g0 = gamma_ramp[g0]; + b0 = gamma_ramp[b0]; + + dst[0] = (unsigned char)r0; + dst[1] = (unsigned char)g0; + dst[2] = (unsigned char)b0; + } + + src += 1; + dst += 3; + } + while (--w > 0); + + src_line += blitter->src_incr; + dst_line += blitter->dst_incr; + } + while (--h > 0); + + return; + } + + do + { + unsigned char* src = src_line + (blitter->src_x); + unsigned char* dst = dst_line + (blitter->dst_x*3); + int w = blitter->width; + + do + { + int a = src[0]; + + if ( a < 2 ) + { + /* nothing */ + } + else if ( a >= 254 ) + { + dst[0] = r; + dst[1] = g; + dst[2] = b; + } + else + { + int r0 = dst[0]; + int g0 = dst[1]; + int b0 = dst[2]; + + a = a + (a >> 7); + + r0 += (r - r0)*a/256; + g0 += (g - g0)*a/256; + b0 += (b - b0)*a/256; + + dst[0] = (unsigned char)r0; + dst[1] = (unsigned char)g0; + dst[2] = (unsigned char)b0; + } + + src += 1; + dst += 3; + } + while (--w > 0); + + src_line += blitter->src_incr; + dst_line += blitter->dst_incr; + } + while (--h > 0); + } + + + static void + gblitter_blitrgb24_gray_cache( GBlitter blitter, + int color ) + { + unsigned char r = (unsigned char)(color >> 16); + unsigned char g = (unsigned char)(color >> 8); + unsigned char b = (unsigned char)(color); + + int back = -1; + const unsigned char* grades = NULL; + + int h = blitter->height; + unsigned char* src_line = blitter->src_line; + unsigned char* dst_line = blitter->dst_line; + + do + { + unsigned char* src = src_line + (blitter->src_x); + unsigned char* dst = dst_line + (blitter->dst_x*3); + int w = blitter->width; + + do + { + int a = src[0]; + + if ( a < 2 ) + { + /* nothing */ + } + else if ( a >= 254 ) + { + dst[0] = r; + dst[1] = g; + dst[2] = b; + } + else + { + int back0 = ((int)dst[0] << 16) | ((int)dst[1] << 8) | dst[2]; + const unsigned char* g; + + if ( back0 != back ) + { + grades = clookup( back0, color ); + back = back0; + } + else + chits++; + + g = grades + ALGO_GRADE_INDEX(a)*3; + + dst[0] = g[0]; + dst[1] = g[1]; + dst[2] = g[2]; + } + + src += 1; + dst += 3; + } + while (--w > 0); + + src_line += blitter->src_incr; + dst_line += blitter->dst_incr; + } + while (--h > 0); + } + + + + int + gblitter_init_rgb24( GBlitter blitter, + GBitmap src, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + void* dst_buffer, + int dst_pitch ) + { + int width = src->width; + int height = src->height; + int delta; + int src_x = 0; + int src_y = 0; + + if ( dst_x < 0 ) + { + width += dst_x; + src_x = -dst_x; + dst_x = 0; + } + + delta = dst_x + width - dst_width; + if ( delta > 0 ) + width -= delta; + + if ( dst_y < 0 ) + { + height += dst_y; + src_y = -dst_y; + dst_y = 0; + } + + delta = dst_y + height - dst_height; + if ( delta > 0 ) + height -= delta; + + if ( width <= 0 || height <= 0 ) + { + blitter->width = 0; + blitter->height = 0; + blitter->blit = NULL; + + return 1; + } + + blitter->width = width; + blitter->height = height; + + blitter->src_x = src_x; + blitter->src_line = src->buffer + src_y*src->pitch; + blitter->src_incr = src->pitch; + + blitter->dst_x = dst_x; + blitter->dst_line = (unsigned char*)dst_buffer + dst_y*dst_pitch; + blitter->dst_incr = dst_pitch; + + return 0; + } + + + +#include +#include +#include +#include + +#ifdef UNIX +#include +#endif + +typedef int (*bench_t)( int arg ); + +#define BENCH_TIME 3.0f + +double +get_time(void) +{ +#ifdef UNIX + struct timeval tv; + + gettimeofday(&tv, NULL); + return (double)tv.tv_sec + (double)tv.tv_usec / 1E6; +#else + /* clock() has an awful precision (~10ms) under Linux 2.4 + glibc 2.2 */ + return (double)clock() / (double)CLOCKS_PER_SEC; +#endif +} + + +double bench_time = BENCH_TIME; + +static void +bench( bench_t bench_func, + int bench_arg, + const char* title, + int max) +{ + int i, n, done; + double t0, delta; + + printf("%-30s : ", title); + fflush(stdout); + + n = 0; + done = 0; + t0 = get_time(); + do + { + if (!(*bench_func)( bench_arg ) ) + done++; + n++; + delta = get_time() - t0; + } + while ((!max || n < max) && delta < bench_time); + + printf("%5.3f us/op\n", delta * 1E6 / (double)done); +} + + + +/* this is un-hinted "W" in Times New Roman + * this glyph is very fuzzy + */ +static const unsigned char glyph_data[18*14] = +{ + 0x4a, 0x91, 0x94, 0x93, 0x5a, 0x00, 0x4c, 0x92, 0x94, 0x94, 0x67, 0x0b, 0x00, + 0x00, 0x61, 0x92, 0x93, 0x50, + 0x00, 0x65, 0xff, 0xbb, 0x00, 0x00, 0x00, 0x65, 0xff, 0xd5, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xa4, 0x7f, 0x00, + 0x00, 0x08, 0xf0, 0xe6, 0x01, 0x00, 0x00, 0x02, 0xe4, 0xf1, 0x05, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x10, 0x00, + 0x00, 0x00, 0x9c, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x4b, 0x00, 0x00, + 0x00, 0x1d, 0xae, 0x00, 0x00, + 0x00, 0x00, 0x41, 0xff, 0x99, 0x00, 0x00, 0x00, 0x82, 0xff, 0xa6, 0x00, 0x00, + 0x00, 0x74, 0x57, 0x00, 0x00, + 0x00, 0x00, 0x01, 0xe3, 0xed, 0x05, 0x00, 0x00, 0xcd, 0xd9, 0xf4, 0x0b, 0x00, + 0x00, 0xc1, 0x0a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x89, 0xff, 0x4d, 0x00, 0x33, 0xa1, 0x7a, 0xff, 0x5b, 0x00, + 0x25, 0xa6, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2e, 0xff, 0xa7, 0x00, 0x8c, 0x46, 0x20, 0xfe, 0xb6, 0x00, + 0x7d, 0x4e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd2, 0xf5, 0x0d, 0xca, 0x03, 0x00, 0xc4, 0xfb, 0x15, + 0xc4, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x77, 0xff, 0x98, 0x90, 0x00, 0x00, 0x69, 0xff, 0x98, + 0x9d, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1d, 0xfe, 0xff, 0x35, 0x00, 0x00, 0x13, 0xfa, 0xff, + 0x45, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xd9, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xe9, + 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x57, 0x94, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x00, 0x00, 0x08, 0x19, + 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static const GBitmapRec glyph = +{ + 18, + 14, + 18, + (unsigned char*) glyph_data, + GBITMAP_FORMAT_GRAY +}; + +#define SIZE_X 640 +#define SIZE_Y 480 + + +static unsigned char buffer[ SIZE_X*3*SIZE_Y ]; + +unsigned long seed = 0; + +unsigned long my_rand( void ) +{ + seed = seed * 1103515245 + 12345; + return ((seed >>16) & 32767); +} + + +#define RAND(n) ((unsigned int)my_rand() % (n)) + +static int +do_glyph( int arg ) +{ + GBlitterRec blit; + int dst_x = RAND(SIZE_X); + int dst_y = RAND(SIZE_Y); + int color = 0xFFFFFF; /* draw white exclusively */ + + if ( gblitter_init_rgb24( &blit, + (GBitmap)&glyph, + dst_x, + dst_y, + SIZE_X, + SIZE_Y, + buffer, + SIZE_X*3 ) ) + return 1; + + if ( arg ) + gblitter_blitrgb24_gray_cache( &blit, color ); + else + gblitter_blitrgb24_gray_direct( &blit, color ); + + + return 0; +} + + + +static int +do_glyph_color( int arg ) +{ + GBlitterRec blit; + int dst_x = RAND(SIZE_X); + int dst_y = RAND(SIZE_Y); + int r = RAND(256); + int g = RAND(256); + int b = RAND(256); + int color = (r << 16) | (g << 8) | b; /* draw in colors */ + + if ( gblitter_init_rgb24( &blit, + (GBitmap)&glyph, + dst_x, + dst_y, + SIZE_X, + SIZE_Y, + buffer, + SIZE_X*3 ) ) + return 1; + + if ( arg ) + gblitter_blitrgb24_gray_cache( &blit, color ); + else + gblitter_blitrgb24_gray_direct( &blit, color ); + + return 0; +} + + +static void +dump_cache_stats( void ) +{ + printf( "hits = %ld, miss1 = %ld, miss2 = %ld, hitrate=%.2f%%, miss2rate=%.2f%%\n", + chits, cmiss1, cmiss2, (double)chits*100.0 / (chits+cmiss1), (double)cmiss2*100.0 / (double)cmiss1 ); +} + + +void usage(void) +{ + fprintf( stderr, + "gbench: graphics glyph blending benchmark\n" + "-----------------------------------------\n\n" + "Usage: gbench [options]\n\n" + "options:\n" ); + fprintf( stderr, + " -t : max time per bench in seconds (default is %.0f)\n", BENCH_TIME ); + fprintf( stderr, + " -s seed : specify random seed\n" ); + fprintf( stderr, + " -g gamma : specify gamma\n" ); + exit( 1 ); +} + +#define TEST(x) (!tests || strchr(tests, x)) + +int +main(int argc, + char** argv) +{ + char* tests = NULL; + int size; + double gamma = 1.0; + + while (argc > 1 && argv[1][0] == '-') + { + switch (argv[1][1]) + { + case 't': + argc--; + argv++; + if (argc < 1 || + sscanf(argv[1], "%lf", &bench_time) != 1) + usage(); + break; + + case 'g': + argc--; + argv++; + if (argc < 1 || + sscanf(argv[1], "%lf", &gamma) != 1) + usage(); + break; + + + case 's': + if ( argc < 1 ) + usage(); + + seed = (unsigned long)atol( argv[1] ); + argc -= 2; + argv += 2; + break; + +#if 0 + case 'b': + argc--; + argv++; + if (argc < 2) + usage(); + tests = argv[1]; + break; +#endif + + default: + fprintf(stderr, "Unknown argument `%s'\n\n", argv[1]); + usage(); + break; + } + + argc--; + argv++; + } + + if ( argc != 1 ) + usage(); + + ggamma_set( gamma ); + + memset( buffer, 0, sizeof(buffer) ); + if (TEST('a')) bench( do_glyph, 0, "direct white glyph", 0 ); + + chits = cmiss1 = cmiss2 = 0; + memset( buffer, 0, sizeof(buffer) ); + if (TEST('b')) bench( do_glyph, 1, "cache white glyph", 0 ); + dump_cache_stats(); + + memset( buffer, 0, sizeof(buffer) ); + if (TEST('c')) bench( do_glyph_color, 0, "direct color glyph", 0 ); + + chits = cmiss1 = cmiss2 = 0; + memset( buffer, 0, sizeof(buffer) ); + if (TEST('d')) bench( do_glyph_color, 1, "cache color glyph", 0 ); + dump_cache_stats(); + + return 0; +} + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/gbench.h freetype-2.8/=unpacked-tar2=/src/gbench.h --- freetype-2.7.1/=unpacked-tar2=/src/gbench.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/gbench.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,86 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality font engine */ +/* */ +/* Copyright 2006 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* gbench is a small program used to benchmark a new algorithm */ +/* performing gamma-corrected alpha-blending. */ +/* */ +/****************************************************************************/ + + +#ifndef GBENCH_H_ +#define GBENCH_H_ + + typedef enum + { + GBITMAP_FORMAT_NONE = 0, + GBITMAP_FORMAT_RGB24, + GBITMAP_FORMAT_GRAY, + GBITMAP_FORMAT_RGB, + GBITMAP_FORMAT_BGR, + GBITMAP_FORMAT_RGBV, + GBITMAP_FORMAT_BGRV, + + GBITMAP_FORMAT_MAX + + } GBitmapFormat; + + + typedef struct GBitmapRec_ + { + int width; + int height; + int pitch; + unsigned char* buffer; + GBitmapFormat format; + + } GBitmapRec, *GBitmap; + + + typedef struct GBlitterRec_* GBlitter; + + typedef void (*GBlitterFunc)( GBlitter blitter, + int color ); + + typedef struct GBlitterRec_ + { + int width; + int height; + + int src_x; + unsigned char* src_line; + int src_incr; + + int dst_x; + unsigned char* dst_line; + int dst_incr; + + GBlitterFunc blit; + + } GBlitterRec; + + + extern void + ggamma_set( double gamma ); + + extern int + gblitter_init_rgb24( GBlitter blitter, + GBitmap src, + int dst_x, + int dst_y, + int dst_width, + int dst_height, + void* dst_buffer, + int dst_pitch ); + +#define gblitter_blit(b,c) (b)->blit( (b), (c) ) + + +#endif /* GBENCH_H_ */ + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/Jamfile freetype-2.8/=unpacked-tar2=/src/Jamfile --- freetype-2.7.1/=unpacked-tar2=/src/Jamfile 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/Jamfile 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,55 @@ +# FreeType 2 src Jamfile (c) 2001, 2003, 2004, 2005, 2007 David Turner +# + +SubDir FT2DEMO_TOP src ; + +SubDirHdrs $(FT2_INCLUDE) ; +SubDirHdrs [ FT2DEMO_SubDir src ] ; +SubDirHdrs [ FT2DEMO_SubDir graph ] ; + +COMMON_LIB = $(LIBPREFIX)ft2common$(SUFLIB) ; + +Library $(COMMON_LIB) : ftcommon.c common.c ; + + +if $(UNIX) +{ + CCDEFS += UNIX ; + LINKLIBS += -lm ; +} + +PROGRAMS = ftbench ftlint ftdump fttimer ftchkwd ftvalid ftpatchk ; +GRAPHIC_PROGRAMS = ftview ftmulti ftstring ftgamma ftgrid ftdiff ; +{ + local t ; + + for t in $(PROGRAMS) $(GRAPHIC_PROGRAMS) + { + Main $(t) : $(t).c ; + LinkLibraries $(t) : $(COMMON_LIB) $(FT2_LIB) ; + } + + for t in $(GRAPHIC_PROGRAMS) + { + LINKLIBS on $(t)$(SUFEXE) = $(LINKLIBS) $(GRAPH_LINKLIBS) ; + LinkLibraries $(t) : $(GRAPH_LIB) ; + } +} + + +# Compile bytecode debugger when needed. Define the environment +# variable FT2_DEBUG_TT to enable this one before calling "jam" +# +if $(FT2_DEBUG_TT) +{ + if $(UNIX) { DEFINES += UNIX ; } + SubDirHdrs $(FT2_INCLUDE)/../src/truetype ; + + LinkLibraries ttdebug : $(FT2_LIB) ; + Main ttdebug : ttdebug.c ; +} + +Main gbench : gbench.c ; + + +# end of src Jamfile diff -Nru freetype-2.7.1/=unpacked-tar2=/src/mlgetopt.c freetype-2.8/=unpacked-tar2=/src/mlgetopt.c --- freetype-2.7.1/=unpacked-tar2=/src/mlgetopt.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/mlgetopt.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,166 @@ +/* + * This is a cheap replacement for getopt() because that routine is not + * available on some platforms and behaves differently on other platforms. + * This code was written from scratch without looking at any other + * implementation. + * + * This code is hereby expressly placed in the public domain. + * mleisher@crl.nmsu.edu (Mark Leisher) + * 10 October 1997 + * + * Last update 2009-03-11. + */ + +#include "mlgetopt.h" + +#include +#include +#include +#include + +#ifdef __STDC__ +#define CONST const +#else +#define CONST +#endif + + /* + * Externals visible to programs. + */ + + int opterr = 1; + int optind = 1; + char* optarg; + + /* + * Internal variables that are used to detect when the global values + * need to be reset. + */ + + static int cmdac; + static CONST char* cmdname; + static char* CONST* cmdav; + + int +#ifdef __STDC__ + getopt( int ac, char* const* av, const char* pat ) +#else + getopt( ac, av, pat ) + int ac; + char** av; + char* pat; +#endif + { + int opt; + CONST char* p; + CONST char* pp; + + /* + * If there is no pattern, indicate the parsing is done. + */ + if ( pat == 0 || *pat == 0 ) + return -1; + + /* + * Always reset the option argument to NULL. + */ + optarg = 0; + + /* + * If the number of arguments or argument list do not match the last + * values seen, reset the internal pointers and the globals. + */ + if ( ac != cmdac || av != cmdav ) + { + optind = 1; + cmdac = ac; + cmdav = av; + + /* + * Determine the command name in case it is needed for warning + * messages. + */ + for ( cmdname = 0, p = av[0]; *p; p++ ) + { + if ( *p == '/' || *p == '\\' ) + cmdname = p; + } + /* + * Skip the path separator if the name was assigned. + */ + if ( cmdname ) + cmdname++; + else + cmdname = av[0]; + } + + /* + * If the next index is greater than or equal to the number of + * arguments, then the command line is done. + */ + if ( optind >= ac ) + return -1; + + /* + * Test the next argument for one of three cases: + * 1. The next argument does not have an initial '-'. + * 2. The next argument is '-'. + * 3. The next argument is '--'. + * + * In either of these cases, command line processing is done. + */ + if ( av[optind][0] != '-' || + strcmp( av[optind], "-" ) == 0 || + strcmp( av[optind], "--" ) == 0 ) + return -1; + + /* + * Point at the next command line argument and increment the + * command line index. + */ + p = av[optind++]; + + /* + * Look for the first character of the command line option. + */ + for ( opt = *(p + 1), pp = pat; *pp && *pp != opt; pp++ ) + ; + + /* + * If nothing in the pattern was recognized, then issue a warning + * and return a '?'. + */ + if ( *pp == 0 ) + { + if ( opterr ) + fprintf( stderr, "%s: invalid option -- %c\n", cmdname, opt ); + return '?'; + } + + /* + * If the option expects an argument, get it. + */ + if ( *(pp + 1) == ':' && (optarg = av[optind]) == 0 ) + { + /* + * If the option argument is NULL, issue a warning and return a '?'. + */ + if ( opterr ) + fprintf( stderr, "%s: option requires an argument -- %c\n", + cmdname, opt ); + opt = '?'; + } + else if ( optarg ) + /* + * Increment the option index past the argument. + */ + optind++; + + /* + * Return the option character. + */ + return opt; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/mlgetopt.h freetype-2.8/=unpacked-tar2=/src/mlgetopt.h --- freetype-2.7.1/=unpacked-tar2=/src/mlgetopt.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/mlgetopt.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * This is a cheap replacement for getopt() because that routine is not + * available on some platforms and behaves differently on other platforms. + * + * This code is hereby expressly placed in the public domain. + * mleisher@crl.nmsu.edu (Mark Leisher) + * 10 October 1997 + */ + +#ifndef MLGETOPT_H_ +#define MLGETOPT_H_ + +#ifdef VMS +#define getopt local_getopt +#define optind local_optind +#define opterr local_opterr +#endif + +#ifdef __cplusplus + extern "C" { +#endif + + extern int opterr; + extern int optind; + extern char* optarg; + + extern int getopt( +#ifdef __STDC__ + int argc, + char* const* argv, + const char* pattern +#endif + ); + +#ifdef __cplusplus + } +#endif + +#endif /* MLGETOPT_H_ */ + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/output.c freetype-2.8/=unpacked-tar2=/src/output.c --- freetype-2.7.1/=unpacked-tar2=/src/output.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/output.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,426 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2015 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* output.c - string output routines for the FreeType demo programs. */ +/* */ +/****************************************************************************/ + + +#include "output.h" + + + static char hexdigit[16] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + }; + + + void + put_ascii_string( char* out, + FT_Byte* string, + FT_UInt string_len, + FT_UInt indent ) + { + FT_UInt i, j; + + + for ( j = 0; j < indent; j++ ) + *out++ = ' '; + *out++ = '"'; + + for ( i = 0; i < string_len; i++ ) + { + switch ( string[i] ) + { + case '\n': + *out++ = '\\'; + *out++ = 'n'; + *out++ = '"'; + + if ( i + 1 < string_len ) + { + *out++ = '\n'; + for ( j = 0; j < indent; j++ ) + *out++ = ' '; + *out++ = '"'; + } + break; + + case '\r': + *out++ = '\\'; + *out++ = 'r'; + break; + + case '\t': + *out++ = '\\'; + *out++ = 't'; + break; + + case '\\': + *out++ = '\\'; + *out++ = '\\'; + break; + + case '"': + *out++ = '\\'; + *out++ = '"'; + break; + + default: + if ( string[i] < 0x80 ) + *out++ = (char)string[i]; + else + { + *out++ = '\\'; + *out++ = 'x'; + *out++ = hexdigit[string[i] >> 4]; + *out++ = hexdigit[string[i] & 0xF]; + } + break; + } + } + if ( string[i - 1] != '\n' ) + *out++ = '"'; + + *out++ = '\0'; + } + + + FT_UInt + put_ascii_string_size( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent ) + { + FT_UInt i, len = 0; + + + /* the code formatting follows `put_ascii_string' */ + + len += indent; + len += 1; + + for ( i = 0; i < string_len; i++ ) + { + switch ( string[i] ) + { + case '\n': + len += 3; + + if ( i + 1 < string_len ) + { + len += 1; + len += indent; + len += 1; + } + break; + + case '\r': + case '\t': + case '\\': + case '"': + len += 2; + break; + + default: + if ( string[i] < 0x80 ) + len += 1; + else + len += 4; + break; + } + } + if ( string[i - 1] != '\n' ) + len += 1; + + len += 1; + + return len; + } + + + void + put_ascii( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent ) + { + FT_UInt len; + char* s; + + + len = put_ascii_string_size( string, string_len, indent ); + s = (char*)malloc( len ); + if ( !s ) + printf( "allocation error for name string" ); + else + { + put_ascii_string( s, string, string_len, indent ); + fputs( s, stdout ); + free( s ); + } + } + + + void + put_unicode_be16_string( char* out, + FT_Byte* string, + FT_UInt string_len, + FT_UInt indent, + FT_Int as_utf8 ) + { + FT_Int ch = 0; + FT_UInt i, j; + + + for ( j = 0; j < indent; j++ ) + *out++ = ' '; + *out++ = '"'; + + for ( i = 0; i < string_len; i += 2 ) + { + ch = ( string[i] << 8 ) | string[i + 1]; + + switch ( ch ) + { + case '\n': + *out++ = '\\'; + *out++ = 'n'; + *out++ = '"'; + + if ( i + 2 < string_len ) + { + *out++ = '\n'; + for ( j = 0; j < indent; j++ ) + *out++ = ' '; + *out++ = '"'; + } + continue; + + case '\r': + *out++ = '\\'; + *out++ = 'r'; + continue; + + case '\t': + *out++ = '\\'; + *out++ = 't'; + continue; + + case '\\': + *out++ = '\\'; + *out++ = '\\'; + continue; + + case '"': + *out++ = '\\'; + *out++ = '"'; + continue; + + default: + break; + } + + if ( as_utf8 ) + { + /* + * UTF-8 encoding + * + * 0x00000080 - 0x000007FF: + * 110xxxxx 10xxxxxx + * + * 0x00000800 - 0x0000FFFF: + * 1110xxxx 10xxxxxx 10xxxxxx + */ + + if ( ch < 0x80 ) + *out++ = (char)ch; + else if ( ch < 0x800 ) + { + *out++ = (char)( 0xC0 | ( (FT_UInt)ch >> 6 ) ); + *out++ = (char)( 0x80 | ( (FT_UInt)ch & 0x3F ) ); + } + else + { + /* we don't handle surrogates */ + *out++ = (char)( 0xE0 | ( (FT_UInt)ch >> 12 ) ); + *out++ = (char)( 0x80 | ( ( (FT_UInt)ch >> 6 ) & 0x3F ) ); + *out++ = (char)( 0x80 | ( (FT_UInt)ch & 0x3F ) ); + } + + continue; + } + + switch ( ch ) + { + case 0x00A9: + *out++ = '('; + *out++ = 'c'; + *out++ = ')'; + continue; + + case 0x00AE: + *out++ = '('; + *out++ = 'r'; + *out++ = ')'; + continue; + + case 0x2013: + *out++ = '-'; + *out++ = '-'; + continue; + + case 0x2019: + *out++ = '\''; + continue; + + case 0x2122: + *out++ = '('; + *out++ = 't'; + *out++ = 'm'; + *out++ = ')'; + continue; + + default: + if ( ch < 128 ) + *out++ = (char)ch; + else + { + *out++ = '\\'; + *out++ = 'U'; + *out++ = '+'; + *out++ = hexdigit[( string[i] >> 12 ) & 0xF]; + *out++ = hexdigit[( string[i] >> 8 ) & 0xF]; + *out++ = hexdigit[( string[i] >> 4 ) & 0xF]; + *out++ = hexdigit[ string[i] & 0xF]; + } + continue; + } + } + + if ( ch != '\n' ) + *out++ = '"'; + + *out++ = '\0'; + } + + + FT_UInt + put_unicode_be16_string_size( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent, + FT_Int as_utf8 ) + { + FT_Int ch = 0; + FT_UInt i, len = 0; + + + /* the code formatting follows `put_unicode_be16_string' */ + + len += indent; + len += 1; + + for ( i = 0; i < string_len; i += 2 ) + { + ch = ( string[i] << 8 ) | string[i + 1]; + + switch ( ch ) + { + case '\n': + len += 3; + + if ( i + 2 < string_len ) + { + len += 1; + len += indent; + len += 1; + } + continue; + + case '\r': + case '\t': + case '\\': + case '"': + len += 2; + continue; + + default: + break; + } + + if ( as_utf8 ) + { + if ( ch < 0x80 ) + len += 1; + else if ( ch < 0x800 ) + len += 2; + else + len += 3; + + continue; + } + + switch ( ch ) + { + case 0x00A9: + case 0x00AE: + len += 3; + continue; + + case 0x2013: + len += 2; + continue; + + case 0x2019: + len += 1; + continue; + + case 0x2122: + len += 4; + continue; + + default: + if ( ch < 128 ) + len += 1; + else + len += 7; + continue; + } + } + + if ( ch != '\n' ) + len += 1; + + len += 1; + + return len; + } + + + void + put_unicode_be16( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent, + FT_Int utf8 ) + { + FT_UInt len; + char* s; + + + len = put_unicode_be16_string_size( string, string_len, indent, utf8 ); + s = (char*)malloc( len ); + if ( !s ) + printf( "allocation error for name string" ); + else + { + put_unicode_be16_string( s, string, string_len, indent, utf8 ); + fputs( s, stdout ); + free( s ); + } + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/output.h freetype-2.8/=unpacked-tar2=/src/output.h --- freetype-2.7.1/=unpacked-tar2=/src/output.h 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/output.h 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,61 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 2015 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* output.h - string output routines for the FreeType demo programs. */ +/* */ +/****************************************************************************/ + + +#ifndef OUTPUT_H_ +#define OUTPUT_H_ + + +#include +#include FT_FREETYPE_H + + + void + put_ascii_string( char* out, + FT_Byte* string, + FT_UInt string_len, + FT_UInt indent ); + + FT_UInt + put_ascii_string_size( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent ); + + void + put_ascii( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent ); + + + void + put_unicode_be16_string( char* out, + FT_Byte* string, + FT_UInt string_len, + FT_UInt indent, + FT_Int as_utf8 ); + + FT_UInt + put_unicode_be16_string_size( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent, + FT_Int as_utf8 ); + + void + put_unicode_be16( FT_Byte* string, + FT_UInt string_len, + FT_UInt indent, + FT_Int as_utf8 ); + + +#endif /* OUTPUT_H_ */ + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/testname.c freetype-2.8/=unpacked-tar2=/src/testname.c --- freetype-2.7.1/=unpacked-tar2=/src/testname.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/testname.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,62 @@ +#include +#include +#include + +#include +#include FT_FREETYPE_H + + + int main( int argc, + char* argv[] ) + { + FT_Library font_library; + FT_Face font_face; + FT_Bitmap bitmap; + FT_GlyphSlot cur_glyph; + FT_Glyph_Metrics glyph_metrics; + + int glyph_ind; + int num_chars; + char char_name[256]; + + + if (argc != 2) + exit( 1 ); + if ( FT_Init_FreeType( &font_library ) ) + exit( 1 ); + if ( FT_New_Face( font_library, argv[1], 0 , &font_face ) ) + exit( 1 ); + if ( FT_Set_Char_Size( font_face , 0 , 768 , 300 , 300 ) ) + exit( 1 ); + + num_chars = (int)font_face->num_glyphs; + FT_Set_Transform( font_face , NULL , NULL ); + + for ( glyph_ind = 0 ; glyph_ind < num_chars; glyph_ind++ ) + { + if ( FT_Load_Glyph( font_face, glyph_ind, FT_LOAD_DEFAULT ) ) + exit( 1 ); + cur_glyph = font_face->glyph; + if ( cur_glyph->format != FT_GLYPH_FORMAT_BITMAP ) + if ( FT_Render_Glyph( font_face->glyph, FT_RENDER_MODE_MONO ) ) + exit( 1 ); + if ( FT_Get_Glyph_Name( font_face, glyph_ind, char_name, 16 ) ) + exit( 1 ); + + bitmap = cur_glyph->bitmap; + glyph_metrics = cur_glyph->metrics; + + printf( "Glyph %d name %s %ld %ld %ld %d %d\n", + glyph_ind, + char_name, + glyph_metrics.horiBearingX / 64, + glyph_metrics.horiBearingY / 64, + glyph_metrics.horiAdvance / 64, + bitmap.width , bitmap.rows ); + } + + return 0; + } + + +/* END */ diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ttdebug.1 freetype-2.8/=unpacked-tar2=/src/ttdebug.1 --- freetype-2.7.1/=unpacked-tar2=/src/ttdebug.1 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ttdebug.1 2017-05-12 09:44:46.000000000 +0000 @@ -0,0 +1,51 @@ +.TH TTDEBUG 1 "May 2017" "FreeType 2.8" +. +. +.SH NAME +. +ttdebug \- a TrueType bytecode debugger +. +. +.SH SYNOPSIS +. +.B ttdebug +.RI [ options ] +.I index size font +. +. +.SH DESCRIPTION +. +.B ttdebug +is an interactive TrueType bytecode debugger working in a terminal. +Its spartanic interface faintly resembles debuggers like +.BR gdb . +. +.PP +For the specified +.IR font , +a glyph with the given +.I index +and +.I size +is loaded, making it possible to trace the bytecode execution step by step. +. +.PP +This program is part of the FreeType demos package. +. +. +.SH OPTIONS +. +.TP +.BI "\-I " ver +Use TrueType interpreter version +.IR ver . +Available versions are depending on compilation options of FreeType; +call +.B ttdebug +without an argument to get the actual list. +. +.TP +.B \-v +Show version. +. +.\" eof diff -Nru freetype-2.7.1/=unpacked-tar2=/src/ttdebug.c freetype-2.8/=unpacked-tar2=/src/ttdebug.c --- freetype-2.7.1/=unpacked-tar2=/src/ttdebug.c 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/src/ttdebug.c 2016-10-08 16:48:22.000000000 +0000 @@ -0,0 +1,2088 @@ +/****************************************************************************/ +/* */ +/* The FreeType project -- a free and portable quality TrueType renderer. */ +/* */ +/* Copyright 1996-2002, 2007, 2011, 2013, 2014 by */ +/* D. Turner, R.Wilhelm, and W. Lemberg */ +/* */ +/* */ +/* ttdebug - a simple TrueType debugger for the console. */ +/* */ +/****************************************************************************/ + + +#include +#include + +#ifdef UNIX + +#ifndef HAVE_POSIX_TERMIOS + +#include +#include + +#else /* HAVE_POSIX_TERMIOS */ + +#ifndef HAVE_TCGETATTR +#define HAVE_TCGETATTR +#endif + +#ifndef HAVE_TCSETATTR +#define HAVE_TCSETATTR +#endif + +#include + +#endif /* HAVE_POSIX_TERMIOS */ + +#endif /* UNIX */ + + + /* Define the `getch()' function. On Unix systems, it is an alias */ + /* for `getchar()', and the debugger front end must ensure that the */ + /* `stdin' file descriptor is not in line-by-line input mode. */ +#ifndef UNIX +#include +#else +#define getch getchar +#endif + + +#include +#include FT_FREETYPE_H +#include "common.h" +#include "mlgetopt.h" + +#include FT_TRUETYPE_DRIVER_H + + /* The following header shouldn't be used in normal programs. */ + /* `freetype2/src/truetype' must be in the current include path. */ +#include "ttobjs.h" +#include "ttdriver.h" +#include "ttinterp.h" +#include "tterrors.h" + + +#define Quit -1 +#define Restart -2 + + + static FT_Library library; /* root library object */ + static FT_Memory memory; /* system object */ + static FT_Driver driver; /* truetype driver */ + static TT_Face face; /* truetype face */ + static TT_Size size; /* truetype size */ + static TT_GlyphSlot glyph; /* truetype glyph slot */ + + static unsigned int tt_interpreter_versions[3]; + static int num_tt_interpreter_versions; + static unsigned int dflt_tt_interpreter_version; + + static FT_Bool use_float = 0; /* number format */ + + static FT_Error error; + + + typedef char ByteStr[2]; + typedef char WordStr[4]; + typedef char LongStr[8]; + typedef char DebugStr[128]; + + static DebugStr tempStr; + + + typedef struct Storage_ + { + FT_Bool initialized; + FT_Long value; + + } Storage; + + + typedef struct Breakpoint_ + { + FT_Long IP; + FT_Int range; + + } Breakpoint; + + /* right now, we support a single breakpoint only */ + static Breakpoint breakpoint; + + +#undef PACK +#define PACK( x, y ) ( ( x << 4 ) | y ) + + static const FT_Byte Pop_Push_Count[256] = + { + /* Opcodes are gathered in groups of 16. */ + /* Please keep the spaces as they are. */ + + /* SVTCA y */ PACK( 0, 0 ), + /* SVTCA x */ PACK( 0, 0 ), + /* SPvTCA y */ PACK( 0, 0 ), + /* SPvTCA x */ PACK( 0, 0 ), + /* SFvTCA y */ PACK( 0, 0 ), + /* SFvTCA x */ PACK( 0, 0 ), + /* SPvTL // */ PACK( 2, 0 ), + /* SPvTL + */ PACK( 2, 0 ), + /* SFvTL // */ PACK( 2, 0 ), + /* SFvTL + */ PACK( 2, 0 ), + /* SPvFS */ PACK( 2, 0 ), + /* SFvFS */ PACK( 2, 0 ), + /* GPV */ PACK( 0, 2 ), + /* GFV */ PACK( 0, 2 ), + /* SFvTPv */ PACK( 0, 0 ), + /* ISECT */ PACK( 5, 0 ), + + /* SRP0 */ PACK( 1, 0 ), + /* SRP1 */ PACK( 1, 0 ), + /* SRP2 */ PACK( 1, 0 ), + /* SZP0 */ PACK( 1, 0 ), + /* SZP1 */ PACK( 1, 0 ), + /* SZP2 */ PACK( 1, 0 ), + /* SZPS */ PACK( 1, 0 ), + /* SLOOP */ PACK( 1, 0 ), + /* RTG */ PACK( 0, 0 ), + /* RTHG */ PACK( 0, 0 ), + /* SMD */ PACK( 1, 0 ), + /* ELSE */ PACK( 0, 0 ), + /* JMPR */ PACK( 1, 0 ), + /* SCvTCi */ PACK( 1, 0 ), + /* SSwCi */ PACK( 1, 0 ), + /* SSW */ PACK( 1, 0 ), + + /* DUP */ PACK( 1, 2 ), + /* POP */ PACK( 1, 0 ), + /* CLEAR */ PACK( 0, 0 ), + /* SWAP */ PACK( 2, 2 ), + /* DEPTH */ PACK( 0, 1 ), + /* CINDEX */ PACK( 1, 1 ), + /* MINDEX */ PACK( 1, 0 ), + /* AlignPTS */ PACK( 2, 0 ), + /* INS_$28 */ PACK( 0, 0 ), + /* UTP */ PACK( 1, 0 ), + /* LOOPCALL */ PACK( 2, 0 ), + /* CALL */ PACK( 1, 0 ), + /* FDEF */ PACK( 1, 0 ), + /* ENDF */ PACK( 0, 0 ), + /* MDAP[0] */ PACK( 1, 0 ), + /* MDAP[1] */ PACK( 1, 0 ), + + /* IUP[0] */ PACK( 0, 0 ), + /* IUP[1] */ PACK( 0, 0 ), + /* SHP[0] */ PACK( 0, 0 ), + /* SHP[1] */ PACK( 0, 0 ), + /* SHC[0] */ PACK( 1, 0 ), + /* SHC[1] */ PACK( 1, 0 ), + /* SHZ[0] */ PACK( 1, 0 ), + /* SHZ[1] */ PACK( 1, 0 ), + /* SHPIX */ PACK( 1, 0 ), + /* IP */ PACK( 0, 0 ), + /* MSIRP[0] */ PACK( 2, 0 ), + /* MSIRP[1] */ PACK( 2, 0 ), + /* AlignRP */ PACK( 0, 0 ), + /* RTDG */ PACK( 0, 0 ), + /* MIAP[0] */ PACK( 2, 0 ), + /* MIAP[1] */ PACK( 2, 0 ), + + /* NPushB */ PACK( 0, 0 ), + /* NPushW */ PACK( 0, 0 ), + /* WS */ PACK( 2, 0 ), + /* RS */ PACK( 1, 1 ), + /* WCvtP */ PACK( 2, 0 ), + /* RCvt */ PACK( 1, 1 ), + /* GC[0] */ PACK( 1, 1 ), + /* GC[1] */ PACK( 1, 1 ), + /* SCFS */ PACK( 2, 0 ), + /* MD[0] */ PACK( 2, 1 ), + /* MD[1] */ PACK( 2, 1 ), + /* MPPEM */ PACK( 0, 1 ), + /* MPS */ PACK( 0, 1 ), + /* FlipON */ PACK( 0, 0 ), + /* FlipOFF */ PACK( 0, 0 ), + /* DEBUG */ PACK( 1, 0 ), + + /* LT */ PACK( 2, 1 ), + /* LTEQ */ PACK( 2, 1 ), + /* GT */ PACK( 2, 1 ), + /* GTEQ */ PACK( 2, 1 ), + /* EQ */ PACK( 2, 1 ), + /* NEQ */ PACK( 2, 1 ), + /* ODD */ PACK( 1, 1 ), + /* EVEN */ PACK( 1, 1 ), + /* IF */ PACK( 1, 0 ), + /* EIF */ PACK( 0, 0 ), + /* AND */ PACK( 2, 1 ), + /* OR */ PACK( 2, 1 ), + /* NOT */ PACK( 1, 1 ), + /* DeltaP1 */ PACK( 1, 0 ), + /* SDB */ PACK( 1, 0 ), + /* SDS */ PACK( 1, 0 ), + + /* ADD */ PACK( 2, 1 ), + /* SUB */ PACK( 2, 1 ), + /* DIV */ PACK( 2, 1 ), + /* MUL */ PACK( 2, 1 ), + /* ABS */ PACK( 1, 1 ), + /* NEG */ PACK( 1, 1 ), + /* FLOOR */ PACK( 1, 1 ), + /* CEILING */ PACK( 1, 1 ), + /* ROUND[0] */ PACK( 1, 1 ), + /* ROUND[1] */ PACK( 1, 1 ), + /* ROUND[2] */ PACK( 1, 1 ), + /* ROUND[3] */ PACK( 1, 1 ), + /* NROUND[0] */ PACK( 1, 1 ), + /* NROUND[1] */ PACK( 1, 1 ), + /* NROUND[2] */ PACK( 1, 1 ), + /* NROUND[3] */ PACK( 1, 1 ), + + /* WCvtF */ PACK( 2, 0 ), + /* DeltaP2 */ PACK( 1, 0 ), + /* DeltaP3 */ PACK( 1, 0 ), + /* DeltaCn[0] */ PACK( 1, 0 ), + /* DeltaCn[1] */ PACK( 1, 0 ), + /* DeltaCn[2] */ PACK( 1, 0 ), + /* SROUND */ PACK( 1, 0 ), + /* S45Round */ PACK( 1, 0 ), + /* JROT */ PACK( 2, 0 ), + /* JROF */ PACK( 2, 0 ), + /* ROFF */ PACK( 0, 0 ), + /* INS_$7B */ PACK( 0, 0 ), + /* RUTG */ PACK( 0, 0 ), + /* RDTG */ PACK( 0, 0 ), + /* SANGW */ PACK( 1, 0 ), + /* AA */ PACK( 1, 0 ), + + /* FlipPT */ PACK( 0, 0 ), + /* FlipRgON */ PACK( 2, 0 ), + /* FlipRgOFF */ PACK( 2, 0 ), + /* INS_$83 */ PACK( 0, 0 ), + /* INS_$84 */ PACK( 0, 0 ), + /* ScanCTRL */ PACK( 1, 0 ), + /* SDVPTL[0] */ PACK( 2, 0 ), + /* SDVPTL[1] */ PACK( 2, 0 ), + /* GetINFO */ PACK( 1, 1 ), + /* IDEF */ PACK( 1, 0 ), + /* ROLL */ PACK( 3, 3 ), + /* MAX */ PACK( 2, 1 ), + /* MIN */ PACK( 2, 1 ), + /* ScanTYPE */ PACK( 1, 0 ), + /* InstCTRL */ PACK( 2, 0 ), + /* INS_$8F */ PACK( 0, 0 ), + + /* INS_$90 */ PACK( 0, 0 ), + /* INS_$91 */ PACK( 0, 0 ), + /* INS_$92 */ PACK( 0, 0 ), + /* INS_$93 */ PACK( 0, 0 ), + /* INS_$94 */ PACK( 0, 0 ), + /* INS_$95 */ PACK( 0, 0 ), + /* INS_$96 */ PACK( 0, 0 ), + /* INS_$97 */ PACK( 0, 0 ), + /* INS_$98 */ PACK( 0, 0 ), + /* INS_$99 */ PACK( 0, 0 ), + /* INS_$9A */ PACK( 0, 0 ), + /* INS_$9B */ PACK( 0, 0 ), + /* INS_$9C */ PACK( 0, 0 ), + /* INS_$9D */ PACK( 0, 0 ), + /* INS_$9E */ PACK( 0, 0 ), + /* INS_$9F */ PACK( 0, 0 ), + + /* INS_$A0 */ PACK( 0, 0 ), + /* INS_$A1 */ PACK( 0, 0 ), + /* INS_$A2 */ PACK( 0, 0 ), + /* INS_$A3 */ PACK( 0, 0 ), + /* INS_$A4 */ PACK( 0, 0 ), + /* INS_$A5 */ PACK( 0, 0 ), + /* INS_$A6 */ PACK( 0, 0 ), + /* INS_$A7 */ PACK( 0, 0 ), + /* INS_$A8 */ PACK( 0, 0 ), + /* INS_$A9 */ PACK( 0, 0 ), + /* INS_$AA */ PACK( 0, 0 ), + /* INS_$AB */ PACK( 0, 0 ), + /* INS_$AC */ PACK( 0, 0 ), + /* INS_$AD */ PACK( 0, 0 ), + /* INS_$AE */ PACK( 0, 0 ), + /* INS_$AF */ PACK( 0, 0 ), + + /* PushB[0] */ PACK( 0, 1 ), + /* PushB[1] */ PACK( 0, 2 ), + /* PushB[2] */ PACK( 0, 3 ), + /* PushB[3] */ PACK( 0, 4 ), + /* PushB[4] */ PACK( 0, 5 ), + /* PushB[5] */ PACK( 0, 6 ), + /* PushB[6] */ PACK( 0, 7 ), + /* PushB[7] */ PACK( 0, 8 ), + /* PushW[0] */ PACK( 0, 1 ), + /* PushW[1] */ PACK( 0, 2 ), + /* PushW[2] */ PACK( 0, 3 ), + /* PushW[3] */ PACK( 0, 4 ), + /* PushW[4] */ PACK( 0, 5 ), + /* PushW[5] */ PACK( 0, 6 ), + /* PushW[6] */ PACK( 0, 7 ), + /* PushW[7] */ PACK( 0, 8 ), + + /* MDRP[00] */ PACK( 1, 0 ), + /* MDRP[01] */ PACK( 1, 0 ), + /* MDRP[02] */ PACK( 1, 0 ), + /* MDRP[03] */ PACK( 1, 0 ), + /* MDRP[04] */ PACK( 1, 0 ), + /* MDRP[05] */ PACK( 1, 0 ), + /* MDRP[06] */ PACK( 1, 0 ), + /* MDRP[07] */ PACK( 1, 0 ), + /* MDRP[08] */ PACK( 1, 0 ), + /* MDRP[09] */ PACK( 1, 0 ), + /* MDRP[10] */ PACK( 1, 0 ), + /* MDRP[11] */ PACK( 1, 0 ), + /* MDRP[12] */ PACK( 1, 0 ), + /* MDRP[13] */ PACK( 1, 0 ), + /* MDRP[14] */ PACK( 1, 0 ), + /* MDRP[15] */ PACK( 1, 0 ), + + /* MDRP[16] */ PACK( 1, 0 ), + /* MDRP[17] */ PACK( 1, 0 ), + /* MDRP[18] */ PACK( 1, 0 ), + /* MDRP[19] */ PACK( 1, 0 ), + /* MDRP[20] */ PACK( 1, 0 ), + /* MDRP[21] */ PACK( 1, 0 ), + /* MDRP[22] */ PACK( 1, 0 ), + /* MDRP[23] */ PACK( 1, 0 ), + /* MDRP[24] */ PACK( 1, 0 ), + /* MDRP[25] */ PACK( 1, 0 ), + /* MDRP[26] */ PACK( 1, 0 ), + /* MDRP[27] */ PACK( 1, 0 ), + /* MDRP[28] */ PACK( 1, 0 ), + /* MDRP[29] */ PACK( 1, 0 ), + /* MDRP[30] */ PACK( 1, 0 ), + /* MDRP[31] */ PACK( 1, 0 ), + + /* MIRP[00] */ PACK( 2, 0 ), + /* MIRP[01] */ PACK( 2, 0 ), + /* MIRP[02] */ PACK( 2, 0 ), + /* MIRP[03] */ PACK( 2, 0 ), + /* MIRP[04] */ PACK( 2, 0 ), + /* MIRP[05] */ PACK( 2, 0 ), + /* MIRP[06] */ PACK( 2, 0 ), + /* MIRP[07] */ PACK( 2, 0 ), + /* MIRP[08] */ PACK( 2, 0 ), + /* MIRP[09] */ PACK( 2, 0 ), + /* MIRP[10] */ PACK( 2, 0 ), + /* MIRP[11] */ PACK( 2, 0 ), + /* MIRP[12] */ PACK( 2, 0 ), + /* MIRP[13] */ PACK( 2, 0 ), + /* MIRP[14] */ PACK( 2, 0 ), + /* MIRP[15] */ PACK( 2, 0 ), + + /* MIRP[16] */ PACK( 2, 0 ), + /* MIRP[17] */ PACK( 2, 0 ), + /* MIRP[18] */ PACK( 2, 0 ), + /* MIRP[19] */ PACK( 2, 0 ), + /* MIRP[20] */ PACK( 2, 0 ), + /* MIRP[21] */ PACK( 2, 0 ), + /* MIRP[22] */ PACK( 2, 0 ), + /* MIRP[23] */ PACK( 2, 0 ), + /* MIRP[24] */ PACK( 2, 0 ), + /* MIRP[25] */ PACK( 2, 0 ), + /* MIRP[26] */ PACK( 2, 0 ), + /* MIRP[27] */ PACK( 2, 0 ), + /* MIRP[28] */ PACK( 2, 0 ), + /* MIRP[29] */ PACK( 2, 0 ), + /* MIRP[30] */ PACK( 2, 0 ), + /* MIRP[31] */ PACK( 2, 0 ) + }; + + + static const FT_String* OpStr[256] = + { + "SVTCA y", /* set vectors to coordinate axis y */ + "SVTCA x", /* set vectors to coordinate axis x */ + "SPVTCA y", /* set proj. vec. to coord. axis y */ + "SPVTCA x", /* set proj. vec. to coord. axis x */ + "SFVTCA y", /* set free. vec. to coord. axis y */ + "SFVTCA x", /* set free. vec. to coord. axis x */ + "SPVTL ||", /* set proj. vec. parallel to segment */ + "SPVTL +", /* set proj. vec. normal to segment */ + "SFVTL ||", /* set free. vec. parallel to segment */ + "SFVTL +", /* set free. vec. normal to segment */ + "SPVFS", /* set proj. vec. from stack */ + "SFVFS", /* set free. vec. from stack */ + "GPV", /* get projection vector */ + "GFV", /* get freedom vector */ + "SFVTPV", /* set free. vec. to proj. vec. */ + "ISECT", /* compute intersection */ + + "SRP0", /* set reference point 0 */ + "SRP1", /* set reference point 1 */ + "SRP2", /* set reference point 2 */ + "SZP0", /* set zone pointer 0 */ + "SZP1", /* set zone pointer 1 */ + "SZP2", /* set zone pointer 2 */ + "SZPS", /* set all zone pointers */ + "SLOOP", /* set loop counter */ + "RTG", /* round to grid */ + "RTHG", /* round to half-grid */ + "SMD", /* set minimum distance */ + "ELSE", /* else */ + "JMPR", /* jump relative */ + "SCVTCI", /* set CVT cut-in */ + "SSWCI", /* set single width cut-in */ + "SSW", /* set single width */ + + "DUP", /* */ + "POP", /* */ + "CLEAR", /* */ + "SWAP", /* */ + "DEPTH", /* */ + "CINDEX", /* */ + "MINDEX", /* */ + "AlignPTS", /* */ + "INS_$28", + "UTP", /* */ + "LOOPCALL", /* */ + "CALL", /* */ + "FDEF", /* */ + "ENDF", /* */ + "MDAP[0]", /* */ + "MDAP[1]", /* */ + + "IUP[0]", /* */ + "IUP[1]", /* */ + "SHP[0]", /* */ + "SHP[1]", /* */ + "SHC[0]", /* */ + "SHC[1]", /* */ + "SHZ[0]", /* */ + "SHZ[1]", /* */ + "SHPIX", /* */ + "IP", /* */ + "MSIRP[0]", /* */ + "MSIRP[1]", /* */ + "AlignRP", /* */ + "RTDG", /* */ + "MIAP[0]", /* */ + "MIAP[1]", /* */ + + "NPushB", /* */ + "NPushW", /* */ + "WS", /* */ + "RS", /* */ + "WCvtP", /* */ + "RCvt", /* */ + "GC[0]", /* */ + "GC[1]", /* */ + "SCFS", /* */ + "MD[0]", /* */ + "MD[1]", /* */ + "MPPEM", /* */ + "MPS", /* */ + "FlipON", /* */ + "FlipOFF", /* */ + "DEBUG", /* */ + + "LT", /* */ + "LTEQ", /* */ + "GT", /* */ + "GTEQ", /* */ + "EQ", /* */ + "NEQ", /* */ + "ODD", /* */ + "EVEN", /* */ + "IF", /* */ + "EIF", /* */ + "AND", /* */ + "OR", /* */ + "NOT", /* */ + "DeltaP1", /* */ + "SDB", /* */ + "SDS", /* */ + + "ADD", /* */ + "SUB", /* */ + "DIV", /* */ + "MUL", /* */ + "ABS", /* */ + "NEG", /* */ + "FLOOR", /* */ + "CEILING", /* */ + "ROUND[0]", /* */ + "ROUND[1]", /* */ + "ROUND[2]", /* */ + "ROUND[3]", /* */ + "NROUND[0]", /* */ + "NROUND[1]", /* */ + "NROUND[2]", /* */ + "NROUND[3]", /* */ + + "WCvtF", /* */ + "DeltaP2", /* */ + "DeltaP3", /* */ + "DeltaC1", /* */ + "DeltaC2", /* */ + "DeltaC3", /* */ + "SROUND", /* */ + "S45Round", /* */ + "JROT", /* */ + "JROF", /* */ + "ROFF", /* */ + "INS_$7B", + "RUTG", /* */ + "RDTG", /* */ + "SANGW", /* */ + "AA", /* */ + + "FlipPT", /* */ + "FlipRgON", /* */ + "FlipRgOFF", /* */ + "INS_$83", + "INS_$84", + "ScanCTRL", /* */ + "SDPVTL[0]", /* */ + "SDPVTL[1]", /* */ + "GetINFO", /* */ + "IDEF", /* */ + "ROLL", /* */ + "MAX", /* */ + "MIN", /* */ + "ScanTYPE", /* */ + "InstCTRL", /* */ + "INS_$8F", + + "INS_$90", + "INS_$91", + "INS_$92", + "INS_$93", + "INS_$94", + "INS_$95", + "INS_$96", + "INS_$97", + "INS_$98", + "INS_$99", + "INS_$9A", + "INS_$9B", + "INS_$9C", + "INS_$9D", + "INS_$9E", + "INS_$9F", + + "INS_$A0", + "INS_$A1", + "INS_$A2", + "INS_$A3", + "INS_$A4", + "INS_$A5", + "INS_$A6", + "INS_$A7", + "INS_$A8", + "INS_$A9", + "INS_$AA", + "INS_$AB", + "INS_$AC", + "INS_$AD", + "INS_$AE", + "INS_$AF", + + "PushB[0]", /* */ + "PushB[1]", /* */ + "PushB[2]", /* */ + "PushB[3]", /* */ + "PushB[4]", /* */ + "PushB[5]", /* */ + "PushB[6]", /* */ + "PushB[7]", /* */ + "PushW[0]", /* */ + "PushW[1]", /* */ + "PushW[2]", /* */ + "PushW[3]", /* */ + "PushW[4]", /* */ + "PushW[5]", /* */ + "PushW[6]", /* */ + "PushW[7]", /* */ + + "MDRP[G]", /* */ + "MDRP[B]", /* */ + "MDRP[W]", /* */ + "MDRP[?]", /* */ + "MDRP[rG]", /* */ + "MDRP[rB]", /* */ + "MDRP[rW]", /* */ + "MDRP[r?]", /* */ + "MDRP[mG]", /* */ + "MDRP[mB]", /* */ + "MDRP[mW]", /* */ + "MDRP[m?]", /* */ + "MDRP[mrG]", /* */ + "MDRP[mrB]", /* */ + "MDRP[mrW]", /* */ + "MDRP[mr?]", /* */ + "MDRP[pG]", /* */ + "MDRP[pB]", /* */ + + "MDRP[pW]", /* */ + "MDRP[p?]", /* */ + "MDRP[prG]", /* */ + "MDRP[prB]", /* */ + "MDRP[prW]", /* */ + "MDRP[pr?]", /* */ + "MDRP[pmG]", /* */ + "MDRP[pmB]", /* */ + "MDRP[pmW]", /* */ + "MDRP[pm?]", /* */ + "MDRP[pmrG]", /* */ + "MDRP[pmrB]", /* */ + "MDRP[pmrW]", /* */ + "MDRP[pmr?]", /* */ + + "MIRP[G]", /* */ + "MIRP[B]", /* */ + "MIRP[W]", /* */ + "MIRP[?]", /* */ + "MIRP[rG]", /* */ + "MIRP[rB]", /* */ + "MIRP[rW]", /* */ + "MIRP[r?]", /* */ + "MIRP[mG]", /* */ + "MIRP[mB]", /* */ + "MIRP[mW]", /* */ + "MIRP[m?]", /* */ + "MIRP[mrG]", /* */ + "MIRP[mrB]", /* */ + "MIRP[mrW]", /* */ + "MIRP[mr?]", /* */ + "MIRP[pG]", /* */ + "MIRP[pB]", /* */ + + "MIRP[pW]", /* */ + "MIRP[p?]", /* */ + "MIRP[prG]", /* */ + "MIRP[prB]", /* */ + "MIRP[prW]", /* */ + "MIRP[pr?]", /* */ + "MIRP[pmG]", /* */ + "MIRP[pmB]", /* */ + "MIRP[pmW]", /* */ + "MIRP[pm?]", /* */ + "MIRP[pmrG]", /* */ + "MIRP[pmrB]", /* */ + "MIRP[pmrW]", /* */ + "MIRP[pmr?]" /* */ + }; + + + /********************************************************************* + * + * Init_Keyboard: Set the input file descriptor to char-by-char + * mode on Unix. + * + *********************************************************************/ + +#ifdef UNIX + + static struct termios old_termio; + + + static void + Init_Keyboard( void ) + { + struct termios termio; + + +#ifndef HAVE_TCGETATTR + ioctl( 0, TCGETS, &old_termio ); +#else + tcgetattr( 0, &old_termio ); +#endif + + termio = old_termio; + +#if 0 + termio.c_lflag &= (tcflag_t)~( ICANON + ECHO + ECHOE + ECHOK + ECHONL + ECHOKE ); +#else + termio.c_lflag &= (tcflag_t)~( ICANON + ECHO + ECHOE + ECHOK + ECHONL ); +#endif + +#ifndef HAVE_TCSETATTR + ioctl( 0, TCSETS, &termio ); +#else + tcsetattr( 0, TCSANOW, &termio ); +#endif + } + + + static void + Reset_Keyboard( void ) + { +#ifndef HAVE_TCSETATTR + ioctl( 0, TCSETS, &old_termio ); +#else + tcsetattr( 0, TCSANOW, &old_termio ); +#endif + } + +#else /* !UNIX */ + + static void + Init_Keyboard( void ) + { + } + + static void + Reset_Keyboard( void ) + { + } + +#endif /* !UNIX */ + + + static void + Abort( const char* message ) + { + fprintf( stderr, "%s\n error code = 0x%04x.\n", message, error ); + Reset_Keyboard(); + exit( 1 ); + } + + + /****************************************************************** + * + * Function: Calc_Length + * + * Description: Compute the length in bytes of current opcode. + * + *****************************************************************/ + +#define CUR (*exc) + + + static void + Calc_Length( TT_ExecContext exc ) + { + CUR.opcode = CUR.code[CUR.IP]; + + switch ( CUR.opcode ) + { + case 0x40: + if ( CUR.IP + 1 >= CUR.codeSize ) + Abort( "code range overflow!" ); + + CUR.length = CUR.code[CUR.IP + 1] + 2; + break; + + case 0x41: + if ( CUR.IP + 1 >= CUR.codeSize ) + Abort( "code range overflow!" ); + + CUR.length = CUR.code[CUR.IP + 1] * 2 + 2; + break; + + case 0xB0: + case 0xB1: + case 0xB2: + case 0xB3: + case 0xB4: + case 0xB5: + case 0xB6: + case 0xB7: + CUR.length = CUR.opcode - 0xB0 + 2; + break; + + case 0xB8: + case 0xB9: + case 0xBA: + case 0xBB: + case 0xBC: + case 0xBD: + case 0xBE: + case 0xBF: + CUR.length = ( CUR.opcode - 0xB8 ) * 2 + 3; + break; + + default: + CUR.length = 1; + break; + } + + /* make sure result is in range */ + + if ( CUR.IP + CUR.length > CUR.codeSize ) + Abort( "code range overflow!" ); + } + + + /* Disassemble the current line. */ + /* */ + static const FT_String* + Cur_U_Line( TT_ExecContext exc ) + { + FT_String s[32]; + FT_Int op, i, n; + + + op = CUR.code[CUR.IP]; + + sprintf( tempStr, "%s", OpStr[op] ); + + if ( op == 0x40 ) + { + n = CUR.code[CUR.IP + 1]; + sprintf( s, "(%d)", n ); + strncat( tempStr, s, 8 ); + + /* limit output */ + if ( n > 20 ) + n = 20; + + for ( i = 0; i < n; i++ ) + { + sprintf( s, " $%02x", (unsigned)CUR.code[CUR.IP + i + 2] ); + strncat( tempStr, s, 8 ); + } + } + else if ( op == 0x41 ) + { + n = CUR.code[CUR.IP + 1]; + sprintf( s, "(%d)", n ); + strncat( tempStr, s, 8 ); + + /* limit output */ + if ( n > 20 ) + n = 20; + + for ( i = 0; i < n; i++ ) + { + sprintf( s, " $%02x%02x", + (unsigned)CUR.code[CUR.IP + i * 2 + 2], + (unsigned)CUR.code[CUR.IP + i * 2 + 3] ); + strncat( tempStr, s, 8 ); + } + } + else if ( ( op & 0xF8 ) == 0xB0 ) + { + n = op - 0xB0; + + for ( i = 0; i <= n; i++ ) + { + sprintf( s, " $%02x", (unsigned)CUR.code[CUR.IP + i + 1] ); + strncat( tempStr, s, 8 ); + } + } + else if ( ( op & 0xF8 ) == 0xB8 ) + { + n = op - 0xB8; + + for ( i = 0; i <= n; i++ ) + { + sprintf( s, " $%02x%02x", + (unsigned)CUR.code[CUR.IP + i * 2 + 1], + (unsigned)CUR.code[CUR.IP + i * 2 + 2] ); + strncat( tempStr, s, 8 ); + } + } + else if ( op == 0x39 ) /* IP */ + { + sprintf( s, " rp1=%d, rp2=%d", CUR.GS.rp1, CUR.GS.rp2 ); + strncat( tempStr, s, 31 ); + } + + return (FT_String*)tempStr; + } + + + /* we have to track the `WS' opcode specially so that we are able */ + /* to properly handle uninitialized storage area values */ + static void + handle_WS( TT_ExecContext exc, + Storage* storage ) + { + if ( CUR.opcode == 0x42 && CUR.top >= 2 ) + { + FT_ULong idx = (FT_ULong)CUR.stack[CUR.top - 2]; + FT_Long value = (FT_Long) CUR.stack[CUR.top - 1]; + + + if ( idx < CUR.storeSize ) + { + storage[idx].initialized = 1; + storage[idx].value = value; + } + } + } + + + static void + display_changed_points( TT_GlyphZoneRec* prev, + TT_GlyphZoneRec* curr, + FT_Bool is_twilight ) + { + FT_Int A; + + + for ( A = 0; A < curr->n_points; A++ ) + { + FT_Int diff = 0; + + + if ( prev->org[A].x != curr->org[A].x ) + diff |= 1; + if ( prev->org[A].y != curr->org[A].y ) + diff |= 2; + if ( prev->cur[A].x != curr->cur[A].x ) + diff |= 4; + if ( prev->cur[A].y != curr->cur[A].y ) + diff |= 8; + if ( prev->tags[A] != curr->tags[A] ) + diff |= 16; + + if ( diff ) + { + const FT_String* temp; + + + printf( "%3d%s ", A, is_twilight ? "T" : " " ); + printf( "%6ld,%6ld ", curr->orus[A].x, curr->orus[A].y ); + + if ( diff & 16 ) + temp = "(%c%c%c)"; + else + temp = " %c%c%c "; + printf( temp, + prev->tags[A] & FT_CURVE_TAG_ON ? 'P' : 'C', + prev->tags[A] & FT_CURVE_TAG_TOUCH_X ? 'X' : ' ', + prev->tags[A] & FT_CURVE_TAG_TOUCH_Y ? 'Y' : ' ' ); + + if ( diff & 1 ) + temp = use_float ? "(%8.2f)" : "(%8ld)"; + else + temp = use_float ? " %8.2f " : " %8ld "; + if ( use_float ) + printf( temp, prev->org[A].x / 64.0 ); + else + printf( temp, prev->org[A].x ); + + if ( diff & 2 ) + temp = use_float ? "(%8.2f)" : "(%8ld)"; + else + temp = use_float ? " %8.2f " : " %8ld "; + if ( use_float ) + printf( temp, prev->org[A].y / 64.0 ); + else + printf( temp, prev->org[A].y ); + + if ( diff & 4 ) + temp = use_float ? "(%8.2f)" : "(%8ld)"; + else + temp = use_float ? " %8.2f " : " %8ld "; + if ( use_float ) + printf( temp, prev->cur[A].x / 64.0 ); + else + printf( temp, prev->cur[A].x ); + + if ( diff & 8 ) + temp = use_float ? "(%8.2f)" : "(%8ld)"; + else + temp = use_float ? " %8.2f " : " %8ld "; + if ( use_float ) + printf( temp, prev->cur[A].y / 64.0 ); + else + printf( temp, prev->cur[A].y ); + + printf( "\n" ); + + printf( " " ); + + if ( diff & 16 ) + temp = "(%c%c%c)"; + else + temp = " "; + printf( temp, + curr->tags[A] & FT_CURVE_TAG_ON ? 'P' : 'C', + curr->tags[A] & FT_CURVE_TAG_TOUCH_X ? 'X' : ' ', + curr->tags[A] & FT_CURVE_TAG_TOUCH_Y ? 'Y' : ' ' ); + + if ( diff & 1 ) + temp = use_float ? "[%8.2f]" : "[%8ld]"; + else + temp = " "; + if ( use_float ) + printf( temp, curr->org[A].x / 64.0 ); + else + printf( temp, curr->org[A].x ); + + if ( diff & 2 ) + temp = use_float ? "[%8.2f]" : "[%8ld]"; + else + temp = " "; + if ( use_float ) + printf( temp, curr->org[A].y / 64.0 ); + else + printf( temp, curr->org[A].y ); + + if ( diff & 4 ) + temp = use_float ? "[%8.2f]" : "[%8ld]"; + else + temp = " "; + if ( use_float ) + printf( temp, curr->cur[A].x / 64.0 ); + else + printf( temp, curr->cur[A].x ); + + if ( diff & 8 ) + temp = use_float ? "[%8.2f]" : "[%8ld]"; + else + temp = " "; + if ( use_float ) + printf( temp, curr->cur[A].y / 64.0 ); + else + printf( temp, curr->cur[A].y ); + + printf( "\n" ); + } + } + } + + + static void + show_points_table( TT_GlyphZoneRec* zone, + const FT_String* code_range, + int n_points, + FT_Bool is_twilight ) + { + int A; + + + if ( code_range[0] == 'g' ) + { + printf( "%s points\n" + "\n", + is_twilight ? "twilight" : "glyph" ); + printf( " idx " + "orig. unscaled " + " orig. scaled " + " current scaled " + "tags\n" ); + printf( "-----" + "----------------" + "--------------------" + "--------------------" + "----\n" ); + } + else + printf( "Not yet in `glyf' program.\n" ); + + for ( A = 0; A < n_points; A++ ) + { + printf( "%3d%s ", + A, + is_twilight + ? "T" + : ( A >= n_points - 4 ) + ? "F" + : " " ); + printf( "(%5ld,%5ld) - ", + zone->orus[A].x, zone->orus[A].y ); + if ( use_float ) + { + printf( "(%7.2f,%7.2f) - ", + zone->org[A].x / 64.0, zone->org[A].y / 64.0 ); + printf( "(%7.2f,%7.2f) - ", + zone->cur[A].x / 64.0, zone->cur[A].y / 64.0 ); + } + else + { + printf( "(%7ld,%7ld) - ", + zone->org[A].x, zone->org[A].y ); + printf( "(%7ld,%7ld) - ", + zone->cur[A].x, zone->cur[A].y ); + } + printf( "%c%c%c\n", + zone->tags[A] & FT_CURVE_TAG_ON ? 'P' : 'C', + zone->tags[A] & FT_CURVE_TAG_TOUCH_X ? 'X' : ' ', + zone->tags[A] & FT_CURVE_TAG_TOUCH_Y ? 'Y' : ' ' ); + } + printf( "\n" ); + } + + + static FT_Error + RunIns( TT_ExecContext exc ) + { + FT_Int key; + + FT_Bool really_leave; + + FT_String ch, oldch = '\0'; + + FT_Long last_IP = 0; + FT_Int last_range = 0; + + TT_GlyphZoneRec pts; + TT_GlyphZoneRec twilight; + TT_GlyphZoneRec save_pts; + TT_GlyphZoneRec save_twilight; + + FT_Long* save_cvt; + + Storage* storage; + Storage* save_storage; + + const FT_String* code_range; + + const FT_String* round_str[8] = + { + "to half-grid", + "to grid", + "to double grid", + "down to grid", + "up to grid", + "off", + "super", + "super 45" + }; + + + error = FT_Err_Ok; + + pts = CUR.pts; + twilight = CUR.twilight; + + save_pts.n_points = pts.n_points; + save_pts.n_contours = pts.n_contours; + + save_pts.org = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * + save_pts.n_points ); + save_pts.cur = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * + save_pts.n_points ); + save_pts.tags = (FT_Byte*)malloc( save_pts.n_points ); + + save_twilight.n_points = twilight.n_points; + save_twilight.n_contours = twilight.n_contours; + + save_twilight.org = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * + save_twilight.n_points ); + save_twilight.cur = (FT_Vector*)malloc( 2 * sizeof( FT_F26Dot6 ) * + save_twilight.n_points ); + save_twilight.tags = (FT_Byte*)malloc( save_twilight.n_points ); + + save_cvt = (FT_Long*)malloc( sizeof ( FT_Long ) * CUR.cvtSize ); + + /* set everything to zero in Storage Area */ + storage = (Storage*)calloc( CUR.storeSize, sizeof ( Storage ) ); + save_storage = (Storage*)calloc( CUR.storeSize, sizeof ( Storage ) ); + + CUR.instruction_trap = 1; + + switch ( CUR.curRange ) + { + case tt_coderange_glyph: + code_range = "glyf"; + break; + + case tt_coderange_cvt: + code_range = "prep"; + break; + + default: + code_range = "fpgm"; + } + + printf( "Entering `%s' table.\n" + "\n", code_range ); + + really_leave = 0; + + do + { + if ( CUR.IP < CUR.codeSize ) + { + Calc_Length( exc ); + + CUR.args = CUR.top - ( Pop_Push_Count[CUR.opcode] >> 4 ); + + /* `args' is the top of the stack once arguments have been popped. */ + /* One can also interpret it as the index of the last argument. */ + + /* Print the current line. We use an 80-columns console with the */ + /* following formatting: */ + /* */ + /* [loc]:[addr] [opcode] [disassembly] [a][b]|[c][d] */ + + { + char temp[90]; + int n, col, pop; + int args = CUR.args; + + + sprintf( temp, "%78c\n", ' ' ); + + /* first letter of location */ + switch ( CUR.curRange ) + { + case tt_coderange_glyph: + temp[0] = 'g'; + break; + + case tt_coderange_cvt: + temp[0] = 'c'; + break; + + default: + temp[0] = 'f'; + } + + /* current IP */ + sprintf( temp + 1, "%04lx: %02x %-36.36s", + CUR.IP, + CUR.opcode, + Cur_U_Line( &CUR ) ); + + strncpy( temp + 46, " (", 2 ); + + args = CUR.top - 1; + pop = Pop_Push_Count[CUR.opcode] >> 4; + col = 48; + + /* special case for IP */ + if ( CUR.opcode == 0x39 ) + pop = CUR.GS.loop; + + for ( n = 6; n > 0; n-- ) + { + int num_chars; + + + if ( pop == 0 ) + temp[col - 1] = temp[col - 1] == '(' ? ' ' : ')'; + + if ( args < CUR.top && args >= 0 ) + { + /* we display signed hexadecimal numbers, which */ + /* is easier to read and needs less space */ + long val = (signed long)CUR.stack[args]; + + + num_chars = sprintf( temp + col, "%s%04lx", + val < 0 ? "-" : "", + val < 0 ? -val : val ); + if ( col + num_chars >= 78 ) + break; + } + else + num_chars = 0; + + temp[col + num_chars] = ' '; + col += num_chars + 1; + + pop--; + args--; + } + + for ( n = col; n < 78; n++ ) + temp[n] = ' '; + + temp[78] = '\n'; + temp[79] = '\0'; + printf( "%s", temp ); + } + + /* First, check for empty stack and overflow */ + if ( CUR.args < 0 ) + { + printf( "ERROR: Too Few Arguments.\n" ); + error = TT_Err_Too_Few_Arguments; + goto LErrorLabel_; + } + + CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 ); + + /* `new_top' is the new top of the stack, after the instruction's */ + /* execution. `top' will be set to `new_top' after the 'case'. */ + + if ( CUR.new_top > CUR.stackSize ) + { + printf( "ERROR: Stack overflow.\n" ); + error = TT_Err_Stack_Overflow; + goto LErrorLabel_; + } + } + else + { + if ( CUR.curRange == tt_coderange_glyph ) + { + if ( !really_leave ) + { + printf( "End of `glyf' program reached.\n" ); + really_leave = 1; + } + else + { + really_leave = 0; + goto LErrorLabel_; + } + } + else + { + printf( "\n" ); + goto LErrorLabel_; + } + } + + if ( breakpoint.IP == CUR.IP && + breakpoint.range == CUR.curRange ) + printf( "Hit breakpoint.\n" ); + + key = 0; + do + { + /* read keyboard */ + ch = (FT_String)getch(); + + switch ( ch ) + { + /* Help - show keybindings */ + case '?': + case 'h': + printf( + "ttdebug Help\n" + "\n" + "Q quit debugger V show vector info\n" + "R restart debugger G show graphics state\n" + "c continue to next code range P show points zone\n" + "n skip to next instruction T show twilight zone\n" + "s step into S show storage area\n" + "f finish current function C show CVT data\n" + "l show last bytecode instruction F toggle floating/fixed\n" + "b toggle breakpoint at curr. pos. point format\n" + "p toggle breakpoint at prev. pos. B show backtrace\n" + "\n" + "\n" + " Format of point changes:\n" + "\n" + " idx orus.x orus.y tags org.x org.y cur.x cur.y\n" + "\n" + " The first line gives the values before the instruction,\n" + " the second line the changes after the instruction,\n" + " indicated by parentheses and brackets for emphasis.\n" + "\n" + " A `T', `F', `S', or `C' appended to the index indicates\n" + " a twilight point, a phantom point, a storage location,\n" + " or data from the Control Value Table (CVT), respectively.\n" + "\n" + " Possible tag values are `P' (on curve), `C' (control point),\n" + " `X' (touched horizontally), and `Y' (touched vertically).\n" + "\n" ); + break; + + /* Toggle between floating and fixed point format */ + case 'F': + use_float = !use_float; + printf( "Use %s point format for displaying values.\n", + use_float ? "floating" : "fixed" ); + printf( "\n" ); + break; + + /* Show vectors */ + case 'V': + if ( use_float ) + { + /* 2.14 numbers */ + printf( "freedom (%.5f, %.5f)\n", + CUR.GS.freeVector.x / 16384.0, + CUR.GS.freeVector.y / 16384.0 ); + printf( "projection (%.5f, %.5f)\n", + CUR.GS.projVector.x / 16384.0, + CUR.GS.projVector.y / 16384.0 ); + printf( "dual (%.5f, %.5f)\n", + CUR.GS.dualVector.x / 16384.0, + CUR.GS.dualVector.y / 16384.0 ); + printf( "\n" ); + } + else + { + printf( "freedom ($%04hx, $%04hx)\n", + CUR.GS.freeVector.x, + CUR.GS.freeVector.y ); + printf( "projection ($%04hx, $%04hx)\n", + CUR.GS.projVector.x, + CUR.GS.projVector.y ); + printf( "dual ($%04hx, $%04hx)\n", + CUR.GS.dualVector.x, + CUR.GS.dualVector.y ); + printf( "\n" ); + } + break; + + /* Show graphics state */ + case 'G': + { + int version; + + + /* this doesn't really belong to the graphics state, */ + /* but I consider it a good place to show */ + FT_Property_Get( library, + "truetype", + "interpreter-version", &version ); + printf( "hinting engine version: %d\n" + "\n", + version ); + } + + printf( "rounding state %s\n", + round_str[CUR.GS.round_state] ); + if ( use_float ) + { + /* 26.6 numbers */ + printf( "minimum distance %.2f\n", + CUR.GS.minimum_distance / 64.0 ); + printf( "CVT cut-in %.2f\n", + CUR.GS.control_value_cutin / 64.0 ); + } + else + { + printf( "minimum distance $%04lx\n", + CUR.GS.minimum_distance ); + printf( "CVT cut-in $%04lx\n", + CUR.GS.control_value_cutin ); + } + printf( "ref. points 0,1,2 %d, %d, %d\n", + CUR.GS.rp0, CUR.GS.rp1, CUR.GS.rp2 ); + printf( "\n" ); + break; + + /* Show CVT */ + case 'C': + { + if ( code_range[0] == 'f' ) + printf( "Not yet in `prep' or `glyf' program.\n" ); + else + { + FT_ULong i; + + + printf( "Control Value Table (CVT) data\n" + "\n" ); + printf( " idx value \n" + "-------------------------\n" ); + + for ( i = 0; i < CUR.cvtSize; i++ ) + printf( "%3ldC %8ld (%8.2f)\n", + i, CUR.cvt[i], CUR.cvt[i] / 64.0 ); + printf( "\n" ); + } + } + break; + + /* Show Storage Area */ + case 'S': + { + if ( code_range[0] == 'f' ) + printf( "Not yet in `prep' or `glyf' program.\n" ); + else + { + FT_ULong i; + + + printf( "Storage Area\n" + "\n" ); + printf( " idx value \n" + "-------------------------\n" ); + + for ( i = 0; i < CUR.storeSize; i++ ) + { + if ( storage[i].initialized ) + printf( "%3ldS %8ld (%8.2f)\n", + i, + storage[i].value, + storage[i].value / 64.0 ); + else + printf( "%3ldS \n", + i ); + } + printf( "\n" ); + } + } + break; + + /* Show glyph points table */ + case 'P': + show_points_table( &pts, code_range, pts.n_points, 0 ); + break; + + /* Show twilight points table */ + case 'T': + show_points_table( &twilight, code_range, twilight.n_points, 1 ); + break; + + /* Show backtrace */ + case 'B': + if ( CUR.callTop <= 0 ) + printf( "At top level.\n" ); + else + { + FT_Int i; + + + printf( "Function call backtrace\n" + "\n" ); + printf( " idx loopcount start end caller\n" + "----------------------------------------\n" ); + + for ( i = CUR.callTop; i > 0; i-- ) + { + TT_CallRec *rec = &CUR.callStack[i - 1]; + + + printf( " %3d %4ld f%04lx f%04lx %c%04lx\n", + rec->Def->opc, + rec->Cur_Count, + rec->Def->start, + rec->Def->end, + rec->Caller_Range == tt_coderange_font + ? 'f' + : ( rec->Caller_Range == tt_coderange_cvt + ? 'c' + : 'g' ), + rec->Caller_IP - 1 ); + } + printf( "\n" ); + } + break; + + default: + key = 1; + } + } while ( !key ); + + FT_MEM_COPY( save_pts.org, + pts.org, + pts.n_points * sizeof ( FT_Vector ) ); + FT_MEM_COPY( save_pts.cur, + pts.cur, + pts.n_points * sizeof ( FT_Vector ) ); + FT_MEM_COPY( save_pts.tags, + pts.tags, + pts.n_points ); + + FT_MEM_COPY( save_twilight.org, + twilight.org, + twilight.n_points * sizeof ( FT_Vector ) ); + FT_MEM_COPY( save_twilight.cur, + twilight.cur, + twilight.n_points * sizeof ( FT_Vector ) ); + FT_MEM_COPY( save_twilight.tags, + twilight.tags, + twilight.n_points ); + + FT_MEM_COPY( save_cvt, + CUR.cvt, + CUR.cvtSize * sizeof ( FT_Long ) ); + + FT_MEM_COPY( save_storage, + storage, + CUR.storeSize * sizeof ( Storage ) ); + + /* a return indicates the last command */ + if ( ch == '\r' || ch == '\n' ) + ch = oldch; + + switch ( ch ) + { + /* quit debugger */ + case 'Q': + /* without the pedantic hinting flag, */ + /* FreeType ignores bytecode errors in `glyf' programs */ + CUR.pedantic_hinting = 1; + error = Quit; + goto LErrorLabel_; + + /* restart debugger */ + case 'R': + /* without the pedantic hinting flag, */ + /* FreeType ignores bytecode errors in `glyf' programs */ + CUR.pedantic_hinting = 1; + error = Restart; + goto LErrorLabel_; + + /* continue */ + case 'c': + if ( CUR.IP < CUR.codeSize ) + { + last_IP = CUR.IP; + last_range = CUR.curRange; + + /* loop execution until we reach end of current code range */ + /* or hit the breakpoint's position */ + while ( CUR.IP < CUR.codeSize ) + { + handle_WS( exc, storage ); + if ( ( error = TT_RunIns( exc ) ) != 0 ) + goto LErrorLabel_; + + if ( CUR.IP == breakpoint.IP && + CUR.curRange == breakpoint.range ) + break; + } + } + break; + + /* finish current function or hit breakpoint */ + case 'f': + oldch = ch; + + if ( CUR.IP < CUR.codeSize ) + { + if ( code_range[0] == 'f' ) + { + printf( "Not yet in `prep' or `glyf' program.\n" ); + break; + } + + if ( CUR.curRange != tt_coderange_font ) + { + printf( "Not in a function.\n" ); + break; + } + + last_IP = CUR.IP; + last_range = CUR.curRange; + + while ( 1 ) + { + Calc_Length( exc ); /* this updates CUR.opcode also */ + + /* we are done if we see the current function's ENDF opcode */ + if ( CUR.opcode == 0x2d ) + goto Step_into; + + if ( CUR.opcode == 0x2a || CUR.opcode == 0x2b ) + { + FT_Long next_IP; + + + /* loop execution until we reach the next opcode */ + next_IP = CUR.IP + CUR.length; + while ( CUR.IP != next_IP ) + { + handle_WS( exc, storage ); + if ( ( error = TT_RunIns( exc ) ) != 0 ) + goto LErrorLabel_; + + if ( CUR.IP == breakpoint.IP && + CUR.curRange == breakpoint.range ) + break; + } + + printf( "\n" ); + } + else + { + handle_WS( exc, storage ); + if ( ( error = TT_RunIns( exc ) ) != 0 ) + goto LErrorLabel_; + } + + if ( CUR.IP == breakpoint.IP && + CUR.curRange == breakpoint.range ) + break; + } + } + break; + + /* step over or hit breakpoint */ + case 'n': + if ( CUR.IP < CUR.codeSize ) + { + FT_Long next_IP; + FT_Int saved_range; + + + /* `step over' is equivalent to `step into' except if */ + /* the current opcode is a CALL or LOOPCALL */ + if ( CUR.opcode != 0x2a && CUR.opcode != 0x2b ) + goto Step_into; + + last_IP = CUR.IP; + last_range = CUR.curRange; + + /* otherwise, loop execution until we reach the next opcode */ + saved_range = CUR.curRange; + next_IP = CUR.IP + CUR.length; + while ( !( CUR.IP == next_IP && CUR.curRange == saved_range ) ) + { + handle_WS( exc, storage ); + if ( ( error = TT_RunIns( exc ) ) != 0 ) + goto LErrorLabel_; + + if ( CUR.IP == breakpoint.IP && + CUR.curRange == breakpoint.range ) + break; + } + } + + oldch = ch; + break; + + /* step into */ + case 's': + if ( CUR.IP < CUR.codeSize ) + { + Step_into: + last_IP = CUR.IP; + last_range = CUR.curRange; + + handle_WS( exc, storage ); + if ( ( error = TT_RunIns( exc ) ) != 0 ) + goto LErrorLabel_; + } + + oldch = ch; + break; + + /* toggle breakpoint at current position */ + case 'b': + if ( breakpoint.IP == CUR.IP && + breakpoint.range == CUR.curRange ) + { + breakpoint.IP = 0; + breakpoint.range = 0; + + printf( "Breakpoint removed.\n" ); + } + else + { + breakpoint.IP = CUR.IP; + breakpoint.range = CUR.curRange; + + printf( "Breakpoint set.\n" ); + } + + oldch = ch; + break; + + /* toggle breakpoint at previous position */ + case 'p': + if ( last_IP == 0 && last_range == 0 ) + printf( "No previous position yet to set breakpoint.\n" ); + else + { + if ( breakpoint.IP == last_IP && + breakpoint.range == last_range ) + { + breakpoint.IP = 0; + breakpoint.range = 0; + + printf( "Breakpoint removed from previous position.\n" ); + } + else + { + breakpoint.IP = last_IP; + breakpoint.range = last_range; + + printf( "Breakpoint set to previous position (%c%04lx).\n", + last_range == tt_coderange_font + ? 'f' + : ( last_range == tt_coderange_cvt + ? 'c' + : 'g' ), + last_IP ); + } + } + + oldch = ch; + break; + + /* show last bytecode instruction */ + case 'l': + oldch = ch; + break; + + default: + printf( "Unknown command. Press ? or h for help.\n" ); + oldch = '\0'; + break; + } + + display_changed_points(&save_pts, &pts, 0); + display_changed_points(&save_twilight, &twilight, 1); + + { + FT_ULong i; + + + for ( i = 0; i < CUR.cvtSize; i++ ) + if ( save_cvt[i] != CUR.cvt[i] ) + { + printf( "%3ldC %8ld (%8.2f)\n", + i, save_cvt[i], save_cvt[i] / 64.0 ); + printf( " %8ld (%8.2f)\n", + CUR.cvt[i], CUR.cvt[i] / 64.0 ); + } + + for ( i = 0; i < CUR.storeSize; i++ ) + if ( save_storage[i].initialized != storage[i].initialized || + save_storage[i].value != storage[i].value ) + { + printf( "%3ldS %8ld (%8.2f)\n", + i, save_storage[i].value, save_storage[i].value / 64.0 ); + printf( " %8ld (%8.2f)\n", + storage[i].value, storage[i].value / 64.0 ); + } + } + + } while ( 1 ); + + LErrorLabel_: + free( save_pts.org ); + free( save_pts.cur ); + free( save_pts.tags ); + + free( save_twilight.org ); + free( save_twilight.cur ); + free( save_twilight.tags ); + + free( save_cvt ); + + free( storage ); + free( save_storage ); + + if ( error && error != Quit && error != Restart ) + Abort( "error during execution" ); + return error; + } + + + static void + Usage( char* execname ) + { + char versions[32]; + + + /* we expect that at least one interpreter version is available */ + if ( num_tt_interpreter_versions == 2 ) + sprintf(versions, "%d and %d", + tt_interpreter_versions[0], + tt_interpreter_versions[1] ); + else + sprintf(versions, "%d, %d, and %d", + tt_interpreter_versions[0], + tt_interpreter_versions[1], + tt_interpreter_versions[2] ); + + fprintf( stderr, + "\n" + "ttdebug: simple TTF debugger -- part of the FreeType project\n" + "------------------------------------------------------------\n" + "\n" ); + fprintf( stderr, + "Usage: %s [options] idx size font\n" + "\n", execname ); + fprintf( stderr, + " idx The index of the glyph to debug.\n" + " size The size of the glyph in pixels (ppem).\n" + " font The TrueType font file to debug.\n" + "\n" + " -I ver Use TT interpreter version VER.\n" + " Available versions are %s; default is version %d.\n" + " -v Show version.\n" + "\n" + "While running, press the `?' key for help.\n" + "\n", + versions, + dflt_tt_interpreter_version ); + + exit( 1 ); + } + + + static char* file_name; + static unsigned int glyph_index; + static int glyph_size; + + + int + main( int argc, + char** argv ) + { + char* execname; + int option; + char version_string[64]; + + int i; + unsigned int versions[3] = { TT_INTERPRETER_VERSION_35, + TT_INTERPRETER_VERSION_38, + TT_INTERPRETER_VERSION_40 }; + int version; + + int tmp; + + + /* init library, read face object, get driver, create size */ + error = FT_Init_FreeType( &library ); + if ( error ) + Abort( "could not initialize FreeType library" ); + + memory = library->memory; + driver = (FT_Driver)FT_Get_Module( library, "truetype" ); + if ( !driver ) + Abort( "could not find the TrueType driver in FreeType 2\n" ); + + { + FT_Int major, minor, patch; + int offset; + + + FT_Library_Version( library, &major, &minor, &patch ); + + offset = snprintf( version_string, 64, + "ttdebug (FreeType) %d.%d", + major, minor ); + if ( patch ) + offset = snprintf( version_string + offset, (size_t)( 64 - offset ), + ".%d", + patch ); + } + + /* collect all available versions, then set again the default */ + FT_Property_Get( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + for ( i = 0; i < 3; i++ ) + { + error = FT_Property_Set( library, + "truetype", + "interpreter-version", &versions[i] ); + if ( !error ) + tt_interpreter_versions[num_tt_interpreter_versions++] = versions[i]; + } + FT_Property_Set( library, + "truetype", + "interpreter-version", &dflt_tt_interpreter_version ); + + execname = ft_basename( argv[0] ); + + while ( 1 ) + { + option = getopt( argc, argv, "I:v" ); + + if ( option == -1 ) + break; + + switch ( option ) + { + case 'I': + version = atoi( optarg ); + + if ( version < 0 ) + { + printf( "invalid TrueType interpreter version = %d\n", version ); + Usage( execname ); + } + + for ( i = 0; i < num_tt_interpreter_versions; i++ ) + { + if ( (unsigned int)version == tt_interpreter_versions[i] ) + { + FT_Property_Set( library, + "truetype", + "interpreter-version", &version ); + break; + } + } + + if ( i == num_tt_interpreter_versions ) + { + printf( "invalid TrueType interpreter version = %d\n", version ); + Usage( execname ); + } + break; + + case 'v': + printf( "%s\n", version_string ); + exit( 0 ); + /* break; */ + + default: + Usage( execname ); + break; + } + } + + argc -= optind; + argv += optind; + + if ( argc < 3 ) + Usage( execname ); + + /* get glyph index */ + if ( sscanf( argv[0], "%d", &tmp ) != 1 || tmp < 0 ) + { + printf( "invalid glyph index = %s\n", argv[1] ); + Usage( execname ); + } + glyph_index = (unsigned int)tmp; + + /* get glyph size */ + if ( sscanf( argv[1], "%d", &glyph_size ) != 1 || glyph_size < 0 ) + { + printf( "invalid glyph size = %s\n", argv[1] ); + Usage( execname ); + } + + /* get file name */ + file_name = argv[2]; + + Init_Keyboard(); + + FT_Set_Debug_Hook( library, + FT_DEBUG_HOOK_TRUETYPE, + (FT_DebugHook_Func)RunIns ); + + printf( "%s\n" + "press key `h' or `?' for help\n" + "\n", version_string ); + + while ( !error ) + { + error = FT_New_Face( library, file_name, 0, (FT_Face*)&face ); + if ( error ) + Abort( "could not open input font file" ); + + /* find driver and check format */ + if ( face->root.driver != driver ) + { + error = FT_Err_Invalid_File_Format; + Abort( "this is not a TrueType font" ); + } + + size = (TT_Size)face->root.size; + + error = FT_Set_Char_Size( (FT_Face)face, + glyph_size << 6, + glyph_size << 6, + 72, + 72 ); + if ( error ) + Abort( "could not set character size" ); + + glyph = (TT_GlyphSlot)face->root.glyph; + + /* now load glyph */ + error = FT_Load_Glyph( (FT_Face)face, + (FT_UInt)glyph_index, + FT_LOAD_NO_BITMAP ); + if ( error && error != Quit && error != Restart ) + Abort( "could not load glyph" ); + if ( error == Restart ) + error = FT_Err_Ok; + + FT_Done_Face( (FT_Face)face ); + } + + Reset_Keyboard(); + + FT_Done_FreeType( library ); + + return 0; + } + + +/* End */ diff -Nru freetype-2.7.1/=unpacked-tar2=/vms_make.com freetype-2.8/=unpacked-tar2=/vms_make.com --- freetype-2.7.1/=unpacked-tar2=/vms_make.com 1970-01-01 00:00:00.000000000 +0000 +++ freetype-2.8/=unpacked-tar2=/vms_make.com 2015-09-25 05:59:28.000000000 +0000 @@ -0,0 +1,315 @@ +$!---------------vms_make.com for Freetype2 demos ------------------------------ +$! make Freetype2 under OpenVMS +$! +$! In case of problems with the build you might want to contact me at +$! zinser@zinser.no-ip.info (preferred) or +$! zinser@sysdev.deutsche-boerse.com (Work) +$! +$!------------------------------------------------------------------------------ +$! +$ on error then goto err_exit +$! +$! Just some general constants +$! +$ Make = "" +$ true = 1 +$ false = 0 +$! +$! Setup variables holding "config" information +$! +$ name = "FT2demos" +$ optfile = name + ".opt" +$ ccopt = "/name=(as_is,short)/float=ieee" +$ lopts = "" +$! +$! Check for MMK/MMS +$! +$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" +$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" +$! +$! Which command parameters were given +$! +$ gosub check_opts +$! +$! Create option file +$! +$ open/write optf 'optfile' +$ If f$getsyi("HW_MODEL") .gt. 1024 +$ Then +$ write optf "[-.freetype2.lib]freetype2shr.exe/share" +$ else +$ write optf "[-.freetype2.lib]freetype.olb/lib" +$ endif +$ gosub check_create_vmslib +$ write optf "sys$share:decw$xlibshr.exe/share" +$ close optf +$! +$ gosub crea_mms +$ 'Make' +$ purge/nolog descrip.mms +$! +$ exit +$! +$ERR_LIB: +$ write sys$output "Error reading config file [-.freetype2]vmslib.dat" +$ goto err_exit +$FT2_ERR: +$ write sys$output "Could not locate Freetype 2 include files" +$ goto err_exit +$ERR_EXIT: +$ set message/facil/ident/sever/text +$ close/nolog optf +$ close/nolog out +$ close/nolog libdata +$ write sys$output "Exiting..." +$ exit 2 +$!------------------------------------------------------------------------------ +$! +$! If MMS/MMK are available dump out the descrip.mms if required +$! +$CREA_MMS: +$ write sys$output "Creating descrip.mms..." +$ create descrip.mms +$ open/append out descrip.mms +$ copy sys$input: out +$ deck +# This file is part of the FreeType project. +# +# DESCRIP.MMS: Make file for OpenVMS using MMS or MMK +# Created by Martin P.J. Zinser +# (zinser@decus.de (preferred) or zinser@sysdev.deutsche-boerse.com (work)) +$EOD +$ write out "CCOPT = ", ccopt +$ write out "LOPTS = ", lopts +$ copy sys$input: out +$ deck + +.FIRST + + define freetype [-.freetype2.include.freetype] + +CC = cc + +# location of src for Test programs +SRCDIR = [.src] +GRAPHSRC = [.graph] +GRX11SRC = [.graph.x11] +OBJDIR = [.obj] + +# include paths +INCLUDES = /include=([-.freetype2.include],[.graph]) + +GRAPHOBJ = $(OBJDIR)grblit.obj, \ + $(OBJDIR)grobjs.obj, \ + $(OBJDIR)grfont.obj, \ + $(OBJDIR)grinit.obj, \ + $(OBJDIR)grdevice.obj,\ + $(OBJDIR)grx11.obj, \ + $(OBJDIR)gblender.obj, \ + $(OBJDIR)gblblit.obj + +# C flags +CFLAGS = $(CCOPT)$(INCLUDES)/obj=$(OBJDIR) + +ALL : ftchkwd.exe ftdump.exe ftlint.exe ftmemchk.exe ftmulti.exe ftview.exe \ + ftstring.exe fttimer.exe ftbench.exe testname.exe + + +ftbench.exe : $(OBJDIR)ftbench.obj,$(OBJDIR)common.obj + link $(LOPTS) $(OBJDIR)ftbench.obj,$(OBJDIR)common.obj,- + []ft2demos.opt/opt +ftchkwd.exe : $(OBJDIR)ftchkwd.obj,$(OBJDIR)common.obj + link $(LOPTS) $(OBJDIR)ftchkwd.obj,$(OBJDIR)common.obj,- + []ft2demos.opt/opt +ftdump.exe : $(OBJDIR)ftdump.obj,$(OBJDIR)common.obj + link $(LOPTS) $(OBJDIR)ftdump.obj,common.obj,[]ft2demos.opt/opt +ftlint.exe : $(OBJDIR)ftlint.obj + link $(LOPTS) $(OBJDIR)ftlint.obj,[]ft2demos.opt/opt +ftmemchk.exe : $(OBJDIR)ftmemchk.obj + link $(LOPTS) $(OBJDIR)ftmemchk.obj,[]ft2demos.opt/opt +ftmulti.exe : $(OBJDIR)ftmulti.obj,$(OBJDIR)common.obj,$(GRAPHOBJ) + link $(LOPTS) $(OBJDIR)ftmulti.obj,common.obj,$(GRAPHOBJ),[]ft2demos.opt/opt +ftview.exe : $(OBJDIR)ftview.obj,$(OBJDIR)common.obj,$(GRAPHOBJ) + link $(LOPTS) $(OBJDIR)ftview.obj,common.obj,$(GRAPHOBJ),[]ft2demos.opt/opt +ftstring.exe : $(OBJDIR)ftstring.obj,$(OBJDIR)common.obj,$(GRAPHOBJ) + link $(LOPTS) $(OBJDIR)ftstring.obj,common.obj,$(GRAPHOBJ),[]ft2demos.opt/opt +fttimer.exe : $(OBJDIR)fttimer.obj + link $(LOPTS) $(OBJDIR)fttimer.obj,[]ft2demos.opt/opt +testname.exe : $(OBJDIR)testname.obj + link $(LOPTS) $(OBJDIR)testname.obj,[]ft2demos.opt/opt + +$(OBJDIR)common.obj : $(SRCDIR)common.c , $(SRCDIR)common.h +$(OBJDIR)ftbench.obj : $(SRCDIR)ftbench.c +$(OBJDIR)ftchkwd.obj : $(SRCDIR)ftchkwd.c +$(OBJDIR)ftlint.obj : $(SRCDIR)ftlint.c +$(OBJDIR)ftmemchk.obj : $(SRCDIR)ftmemchk.c +$(OBJDIR)ftdump.obj : $(SRCDIR)ftdump.c +$(OBJDIR)testname.obj : $(SRCDIR)testname.c +$(OBJDIR)ftview.obj : $(SRCDIR)ftview.c +$(OBJDIR)grblit.obj : $(GRAPHSRC)grblit.c +$(OBJDIR)grobjs.obj : $(GRAPHSRC)grobjs.c +$(OBJDIR)grfont.obj : $(GRAPHSRC)grfont.c +$(OBJDIR)gblender.obj : $(GRAPHSRC)gblender.c +$(OBJDIR)gblblit.obj : $(GRAPHSRC)gblblit.c +$(OBJDIR)grinit.obj : $(GRAPHSRC)grinit.c + set def $(GRAPHSRC) + $(CC)$(CCOPT)/include=([.x11],[])/define=(DEVICE_X11)/obj=[-.obj] grinit.c + set def [-] +$(OBJDIR)grx11.obj : $(GRX11SRC)grx11.c + set def $(GRX11SRC) + $(CC)$(CCOPT)/obj=[--.obj]/include=([-]) grx11.c + set def [--] +$(OBJDIR)grdevice.obj : $(GRAPHSRC)grdevice.c +$(OBJDIR)ftmulti.obj : $(SRCDIR)ftmulti.c +$(OBJDIR)ftstring.obj : $(SRCDIR)ftstring.c +$(OBJDIR)fttimer.obj : $(SRCDIR)fttimer.c + +CLEAN : + delete $(OBJDIR)*.obj;*,[]ft2demos.opt;* +# EOF +$ eod +$ close out +$ return +$!------------------------------------------------------------------------------ +$! +$! Check commandline options and set symbols accordingly +$! +$ CHECK_OPTS: +$ i = 1 +$ OPT_LOOP: +$ if i .lt. 9 +$ then +$ cparm = f$edit(p'i',"upcase") +$ if cparm .eqs. "DEBUG" +$ then +$ ccopt = ccopt + "/noopt/deb" +$ lopts = lopts + "/deb" +$ endif +$! if cparm .eqs. "link $(LOPTS)" then link only = true +$ if f$locate("LOPTS",cparm) .lt. f$length(cparm) +$ then +$ start = f$locate("=",cparm) + 1 +$ len = f$length(cparm) - start +$ lopts = lopts + f$extract(start,len,cparm) +$ endif +$ if f$locate("CCOPT",cparm) .lt. f$length(cparm) +$ then +$ start = f$locate("=",cparm) + 1 +$ len = f$length(cparm) - start +$ ccopt = ccopt + f$extract(start,len,cparm) +$ endif +$ i = i + 1 +$ goto opt_loop +$ endif +$ return +$!------------------------------------------------------------------------------ +$! +$! Take care of driver file with information about external libraries +$! +$! Version history +$! 0.01 20040220 First version to receive a number +$! 0.02 20040229 Echo current procedure name; use general error exit handler +$! Remove xpm hack -> Replaced by more general dnsrl handling +$! ---> Attention slightly changed version to take into account special +$! Situation for Freetype2 demos +$CHECK_CREATE_VMSLIB: +$! +$ if f$search("[-.freetype2]VMSLIB.DAT") .eqs. "" +$ then +$ write sys$output "Freetype2 driver file [-.freetype2]vmslib.dat not found." +$ write sys$output "Either Ft2demos have been installed in the wrong location" +$ write sys$output "or Freetype2 has not yet been configured." +$ write sys$output "Exiting..." +$ goto err_exit +$ endif +$! +$! Init symbols used to hold CPP definitions and include path +$! +$ libdefs = "" +$ libincs = "" +$! +$! Open data file with location of libraries +$! +$ open/read/end=end_lib/err=err_lib libdata [-.freetype2]VMSLIB.DAT +$LIB_LOOP: +$ read/end=end_lib libdata libline +$ libline = f$edit(libline, "UNCOMMENT,COLLAPSE") +$ if libline .eqs. "" then goto LIB_LOOP ! Comment line +$ libname = f$edit(f$element(0,"#",libline),"UPCASE") +$ write sys$output "Processing ''libname' setup ..." +$ libloc = f$element(1,"#",libline) +$ libsrc = f$element(2,"#",libline) +$ testinc = f$element(3,"#",libline) +$ cppdef = f$element(4,"#",libline) +$ old_cpp = f$locate("=1",cppdef) +$ if old_cpp.lt.f$length(cppdef) then cppdef = f$extract(0,old_cpp,cppdef) +$ if f$search("''libloc'").eqs. "" +$ then +$ write sys$output "Can not find library ''libloc' - Skipping ''libname'" +$ goto LIB_LOOP +$ endif +$ libsrc_elem = 0 +$ libsrc_found = false +$LIBSRC_LOOP: +$ libsrcdir = f$element(libsrc_elem,",",libsrc) +$ if (libsrcdir .eqs. ",") then goto END_LIBSRC +$ if f$search("''libsrcdir'''testinc'") .nes. "" then libsrc_found = true +$ libsrc_elem = libsrc_elem + 1 +$ goto LIBSRC_LOOP +$END_LIBSRC: +$ if .not. libsrc_found +$ then +$ write sys$output "Can not find includes at ''libsrc' - Skipping ''libname'" +$ goto LIB_LOOP +$ endif +$ if (cppdef .nes. "") then libdefs = libdefs + cppdef + "," +$ libincs = libincs + "," + libsrc +$ lqual = "/lib" +$ libtype = f$edit(f$parse(libloc,,,"TYPE"),"UPCASE") +$ if f$locate("EXE",libtype) .lt. f$length(libtype) then lqual = "/share" +$ write optf libloc , lqual +$ if (f$trnlnm("topt") .nes. "") then write topt libloc , lqual +$! +$! Nasty hack to get the freetype includes to work +$! +$ ft2def = false +$ if ((libname .eqs. "FREETYPE") .and. - + (f$locate("FREETYPE2",cppdef) .lt. f$length(cppdef))) +$ then +$ if ((f$search("freetype:freetype.h") .nes. "") .and. - + (f$search("freetype:[internal]ftobjs.h") .nes. "")) +$ then +$ write sys$output "Will use local definition of freetype logical" +$ else +$ ft2elem = 0 +$FT2_LOOP: +$ ft2srcdir = f$element(ft2elem,",",libsrc) +$ if f$search("''ft2srcdir'''testinc'") .nes. "" +$ then +$ if f$search("''ft2srcdir'internal.dir") .nes. "" +$ then +$ ft2dev = f$parse("''ft2srcdir'",,,"device","no_conceal") +$ ft2dir = f$parse("''ft2srcdir'",,,"directory","no_conceal") +$ ft2conc = f$locate("][",ft2dir) +$ ft2len = f$length(ft2dir) +$ if ft2conc .lt. ft2len +$ then +$ ft2dir = f$extract(0,ft2conc,ft2dir) + - + f$extract(ft2conc+2,ft2len-2,ft2dir) +$ endif +$ ft2dir = ft2dir - "]" + ".]" +$ define freetype 'ft2dev''ft2dir','ft2srcdir' +$ ft2def = true +$ else +$ goto ft2_err +$ endif +$ else +$ ft2elem = ft2elem + 1 +$ goto ft2_loop +$ endif +$ endif +$ endif +$ goto LIB_LOOP +$END_LIB: +$ close libdata +$ return diff -Nru freetype-2.7.1/=unpacked-tar3=/autogen.sh freetype-2.8/=unpacked-tar3=/autogen.sh --- freetype-2.7.1/=unpacked-tar3=/autogen.sh 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/autogen.sh 2017-03-30 10:20:23.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2005-2016 by +# Copyright 2005-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/include/config/ftconfig.h freetype-2.8/=unpacked-tar3=/builds/amiga/include/config/ftconfig.h --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/include/config/ftconfig.h 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/include/config/ftconfig.h 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Amiga-specific configuration file (specification only). */ /* */ -/* Copyright 2005-2016 by */ +/* Copyright 2005-2017 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/include/config/ftmodule.h freetype-2.8/=unpacked-tar3=/builds/amiga/include/config/ftmodule.h --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/include/config/ftmodule.h 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/include/config/ftmodule.h 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType module selection. */ /* */ -/* Copyright 2005-2016 by */ +/* Copyright 2005-2017 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/makefile freetype-2.8/=unpacked-tar3=/builds/amiga/makefile --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/makefile 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/makefile 2017-03-30 10:20:23.000000000 +0000 @@ -5,7 +5,7 @@ # -# Copyright 2005-2016 by +# Copyright 2005-2017 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/makefile.os4 freetype-2.8/=unpacked-tar3=/builds/amiga/makefile.os4 --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/makefile.os4 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/makefile.os4 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ # -# Copyright 2005-2016 by +# Copyright 2005-2017 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/README freetype-2.8/=unpacked-tar3=/builds/amiga/README --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/README 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/README 2017-03-30 10:20:23.000000000 +0000 @@ -1,7 +1,7 @@ README for the builds/amiga subdirectory. -Copyright 2005-2016 by +Copyright 2005-2017 by Werner Lemberg and Detlef Würkner. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/smakefile freetype-2.8/=unpacked-tar3=/builds/amiga/smakefile --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/smakefile 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/smakefile 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 2005-2016 by +# Copyright 2005-2017 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/src/base/ftdebug.c freetype-2.8/=unpacked-tar3=/builds/amiga/src/base/ftdebug.c --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/src/base/ftdebug.c 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/src/base/ftdebug.c 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for amiga (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/amiga/src/base/ftsystem.c freetype-2.8/=unpacked-tar3=/builds/amiga/src/base/ftsystem.c --- freetype-2.7.1/=unpacked-tar3=/builds/amiga/src/base/ftsystem.c 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/amiga/src/base/ftsystem.c 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/ansi/ansi-def.mk freetype-2.8/=unpacked-tar3=/builds/ansi/ansi-def.mk --- freetype-2.7.1/=unpacked-tar3=/builds/ansi/ansi-def.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/ansi/ansi-def.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/ansi/ansi.mk freetype-2.8/=unpacked-tar3=/builds/ansi/ansi.mk --- freetype-2.7.1/=unpacked-tar3=/builds/ansi/ansi.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/ansi/ansi.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/beos/beos-def.mk freetype-2.8/=unpacked-tar3=/builds/beos/beos-def.mk --- freetype-2.7.1/=unpacked-tar3=/builds/beos/beos-def.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/beos/beos-def.mk 2017-03-30 10:20:23.000000000 +0000 @@ -5,7 +5,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/beos/beos.mk freetype-2.8/=unpacked-tar3=/builds/beos/beos.mk --- freetype-2.7.1/=unpacked-tar3=/builds/beos/beos.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/beos/beos.mk 2017-03-30 10:20:23.000000000 +0000 @@ -2,7 +2,7 @@ # FreeType 2 configuration rules for a BeOS system # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/beos/detect.mk freetype-2.8/=unpacked-tar3=/builds/beos/detect.mk --- freetype-2.7.1/=unpacked-tar3=/builds/beos/detect.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/beos/detect.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/cmake/iOS.cmake freetype-2.8/=unpacked-tar3=/builds/cmake/iOS.cmake --- freetype-2.7.1/=unpacked-tar3=/builds/cmake/iOS.cmake 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/cmake/iOS.cmake 2017-03-30 10:20:23.000000000 +0000 @@ -1,6 +1,6 @@ # iOS.cmake # -# Copyright 2014-2016 by +# Copyright 2014-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by David Wimsey diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/cmake/testbuild.sh freetype-2.8/=unpacked-tar3=/builds/cmake/testbuild.sh --- freetype-2.7.1/=unpacked-tar3=/builds/cmake/testbuild.sh 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/cmake/testbuild.sh 2017-03-30 10:20:23.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh -e -# Copyright 2015-2016 by +# Copyright 2015-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/ansi-cc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/ansi-cc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/ansi-cc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/ansi-cc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/bcc-dev.mk freetype-2.8/=unpacked-tar3=/builds/compiler/bcc-dev.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/bcc-dev.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/bcc-dev.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/bcc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/bcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/bcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/bcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/emx.mk freetype-2.8/=unpacked-tar3=/builds/compiler/emx.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/emx.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/emx.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 2003-2016 by +# Copyright 2003-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/gcc-dev.mk freetype-2.8/=unpacked-tar3=/builds/compiler/gcc-dev.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/gcc-dev.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/gcc-dev.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/gcc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/gcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/gcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/gcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/intelc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/intelc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/intelc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/intelc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/unix-lcc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/unix-lcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/unix-lcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/unix-lcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/visualage.mk freetype-2.8/=unpacked-tar3=/builds/compiler/visualage.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/visualage.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/visualage.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/visualc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/visualc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/visualc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/visualc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/watcom.mk freetype-2.8/=unpacked-tar3=/builds/compiler/watcom.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/watcom.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/watcom.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/compiler/win-lcc.mk freetype-2.8/=unpacked-tar3=/builds/compiler/win-lcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/compiler/win-lcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/compiler/win-lcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/detect.mk freetype-2.8/=unpacked-tar3=/builds/detect.mk --- freetype-2.7.1/=unpacked-tar3=/builds/detect.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/detect.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/dos/detect.mk freetype-2.8/=unpacked-tar3=/builds/dos/detect.mk --- freetype-2.7.1/=unpacked-tar3=/builds/dos/detect.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/dos/detect.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-def.mk freetype-2.8/=unpacked-tar3=/builds/dos/dos-def.mk --- freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-def.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/dos/dos-def.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-emx.mk freetype-2.8/=unpacked-tar3=/builds/dos/dos-emx.mk --- freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-emx.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/dos/dos-emx.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 2003-2016 by +# Copyright 2003-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-gcc.mk freetype-2.8/=unpacked-tar3=/builds/dos/dos-gcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-gcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/dos/dos-gcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-wat.mk freetype-2.8/=unpacked-tar3=/builds/dos/dos-wat.mk --- freetype-2.7.1/=unpacked-tar3=/builds/dos/dos-wat.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/dos/dos-wat.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 2003-2016 by +# Copyright 2003-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/exports.mk freetype-2.8/=unpacked-tar3=/builds/exports.mk --- freetype-2.7.1/=unpacked-tar3=/builds/exports.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/exports.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 2005-2016 by +# Copyright 2005-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/freetype.mk freetype-2.8/=unpacked-tar3=/builds/freetype.mk --- freetype-2.7.1/=unpacked-tar3=/builds/freetype.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/freetype.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/link_dos.mk freetype-2.8/=unpacked-tar3=/builds/link_dos.mk --- freetype-2.7.1/=unpacked-tar3=/builds/link_dos.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/link_dos.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/link_std.mk freetype-2.8/=unpacked-tar3=/builds/link_std.mk --- freetype-2.7.1/=unpacked-tar3=/builds/link_std.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/link_std.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/mac/ftmac.c freetype-2.8/=unpacked-tar3=/builds/mac/ftmac.c --- freetype-2.7.1/=unpacked-tar3=/builds/mac/ftmac.c 2016-12-17 21:56:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/mac/ftmac.c 2017-03-30 10:20:23.000000000 +0000 @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/modules.mk freetype-2.8/=unpacked-tar3=/builds/modules.mk --- freetype-2.7.1/=unpacked-tar3=/builds/modules.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/modules.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/os2/detect.mk freetype-2.8/=unpacked-tar3=/builds/os2/detect.mk --- freetype-2.7.1/=unpacked-tar3=/builds/os2/detect.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/os2/detect.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/os2/os2-def.mk freetype-2.8/=unpacked-tar3=/builds/os2/os2-def.mk --- freetype-2.7.1/=unpacked-tar3=/builds/os2/os2-def.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/os2/os2-def.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/os2/os2-dev.mk freetype-2.8/=unpacked-tar3=/builds/os2/os2-dev.mk --- freetype-2.7.1/=unpacked-tar3=/builds/os2/os2-dev.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/os2/os2-dev.mk 2017-03-30 10:20:23.000000000 +0000 @@ -5,7 +5,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/os2/os2-gcc.mk freetype-2.8/=unpacked-tar3=/builds/os2/os2-gcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/os2/os2-gcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/os2/os2-gcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/symbian/bld.inf freetype-2.8/=unpacked-tar3=/builds/symbian/bld.inf --- freetype-2.7.1/=unpacked-tar3=/builds/symbian/bld.inf 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/symbian/bld.inf 2017-03-30 10:20:23.000000000 +0000 @@ -2,7 +2,7 @@ // FreeType 2 project for the symbian platform // -// Copyright 2008-2016 by +// Copyright 2008-2017 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/symbian/freetype.mmp freetype-2.8/=unpacked-tar3=/builds/symbian/freetype.mmp --- freetype-2.7.1/=unpacked-tar3=/builds/symbian/freetype.mmp 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/symbian/freetype.mmp 2017-03-30 10:20:23.000000000 +0000 @@ -2,7 +2,7 @@ // FreeType 2 makefile for the symbian platform // -// Copyright 2008-2016 by +// Copyright 2008-2017 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/toplevel.mk freetype-2.8/=unpacked-tar3=/builds/toplevel.mk --- freetype-2.7.1/=unpacked-tar3=/builds/toplevel.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/toplevel.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/config.guess freetype-2.8/=unpacked-tar3=/builds/unix/config.guess --- freetype-2.7.1/=unpacked-tar3=/builds/unix/config.guess 2016-12-30 20:17:23.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/config.guess 2017-05-13 10:46:01.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-10-02' +timestamp='2017-03-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -837,10 +837,11 @@ UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -1343,6 +1344,9 @@ NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-?:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/config.sub freetype-2.8/=unpacked-tar3=/builds/unix/config.sub --- freetype-2.7.1/=unpacked-tar3=/builds/unix/config.sub 2016-12-30 20:17:23.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/config.sub 2017-05-13 10:46:01.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-11-19' +timestamp='2017-04-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -67,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -263,7 +263,7 @@ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ @@ -315,6 +315,7 @@ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -388,7 +389,7 @@ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ @@ -446,6 +447,7 @@ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -948,6 +950,9 @@ nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1243,6 +1248,9 @@ basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none @@ -1409,7 +1417,7 @@ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/configure freetype-2.8/=unpacked-tar3=/builds/unix/configure --- freetype-2.7.1/=unpacked-tar3=/builds/unix/configure 2016-12-30 20:17:23.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/configure 2017-05-13 10:46:01.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for FreeType 2.7.1. +# Generated by GNU Autoconf 2.69 for FreeType 2.8. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='FreeType' PACKAGE_TARNAME='freetype' -PACKAGE_VERSION='2.7.1' -PACKAGE_STRING='FreeType 2.7.1' +PACKAGE_VERSION='2.8' +PACKAGE_STRING='FreeType 2.8' PACKAGE_BUGREPORT='freetype@nongnu.org' PACKAGE_URL='' @@ -1329,7 +1329,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures FreeType 2.7.1 to adapt to many kinds of systems. +\`configure' configures FreeType 2.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1394,7 +1394,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of FreeType 2.7.1:";; + short | recursive ) echo "Configuration of FreeType 2.8:";; esac cat <<\_ACEOF @@ -1541,7 +1541,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -FreeType configure 2.7.1 +FreeType configure 2.8 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2139,7 +2139,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by FreeType $as_me 2.7.1, which was +It was created by FreeType $as_me 2.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2495,7 +2495,7 @@ # Don't forget to update `docs/VERSIONS.TXT'! -version_info='19:0:13' +version_info='20:0:14' ft_version=`echo $version_info | tr : .` @@ -15017,7 +15017,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by FreeType $as_me 2.7.1, which was +This file was extended by FreeType $as_me 2.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15083,7 +15083,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -FreeType config.status 2.7.1 +FreeType config.status 2.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/configure.ac freetype-2.8/=unpacked-tar3=/builds/unix/configure.ac --- freetype-2.7.1/=unpacked-tar3=/builds/unix/configure.ac 2016-12-30 20:17:20.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/configure.ac 2017-05-13 10:45:59.000000000 +0000 @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright 2001-2016 by +# Copyright 2001-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -11,13 +11,13 @@ # indicate that you have read the license and understand and accept it # fully. -AC_INIT([FreeType], [2.7.1], [freetype@nongnu.org], [freetype]) +AC_INIT([FreeType], [2.8], [freetype@nongnu.org], [freetype]) AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='19:0:13' +version_info='20:0:14' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/configure.raw freetype-2.8/=unpacked-tar3=/builds/unix/configure.raw --- freetype-2.7.1/=unpacked-tar3=/builds/unix/configure.raw 2016-12-30 20:14:35.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/configure.raw 2017-05-13 04:28:40.000000000 +0000 @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright 2001-2016 by +# Copyright 2001-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -17,7 +17,7 @@ # Don't forget to update `docs/VERSIONS.TXT'! -version_info='19:0:13' +version_info='20:0:14' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/detect.mk freetype-2.8/=unpacked-tar3=/builds/unix/detect.mk --- freetype-2.7.1/=unpacked-tar3=/builds/unix/detect.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/detect.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/freetype2.m4 freetype-2.8/=unpacked-tar3=/builds/unix/freetype2.m4 --- freetype-2.7.1/=unpacked-tar3=/builds/unix/freetype2.m4 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/freetype2.m4 2017-03-30 10:20:23.000000000 +0000 @@ -1,7 +1,7 @@ # Configure paths for FreeType2 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor # -# Copyright 2001-2016 by +# Copyright 2001-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/freetype-config.in freetype-2.8/=unpacked-tar3=/builds/unix/freetype-config.in --- freetype-2.7.1/=unpacked-tar3=/builds/unix/freetype-config.in 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/freetype-config.in 2017-03-30 10:20:23.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright 2000-2016 by +# Copyright 2000-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -12,11 +12,55 @@ LC_ALL=C export LC_ALL -prefix="%prefix%" -exec_prefix="%exec_prefix%" -exec_prefix_set="no" -includedir="%includedir%" -libdir="%libdir%" + +# if `pkg-config' is available, use values from `freetype2.pc' +pkg-config --version >/dev/null 2>&1 +if test $? -eq 0 ; then + # note that option `--variable' is not affected by the + # PKG_CONFIG_SYSROOT_DIR environment variable + if test "x$SYSROOT" != "x" ; then + PKG_CONFIG_SYSROOT_DIR="$SYSROOT" + export PKG_CONFIG_SYSROOT_DIR + fi + + prefix=`pkg-config --variable prefix freetype2` + exec_prefix=`pkg-config --variable exec_prefix freetype2` + + includedir=`pkg-config --variable includedir freetype2` + libdir=`pkg-config --variable libdir freetype2` + + version=`pkg-config --modversion freetype2` + + cflags=`pkg-config --cflags freetype2` + dynamic_libs=`pkg-config --libs freetype2` + static_libs=`pkg-config --static --libs freetype2` +else + prefix="%prefix%" + exec_prefix="%exec_prefix%" + + includedir="%includedir%" + libdir="%libdir%" + + version=%ft_version% + + cflags="-I${SYSROOT}$includedir/freetype2" + dynamic_libs="-lfreetype" + static_libs="%LIBSSTATIC_CONFIG%" + if test "${SYSROOT}$libdir" != "/usr/lib" && + test "${SYSROOT}$libdir" != "/usr/lib64" ; then + libs_L="-L${SYSROOT}$libdir" + fi +fi + +orig_prefix=$prefix +orig_exec_prefix=$exec_prefix + +orig_includedir=$includedir +orig_libdir=$libdir + +include_suffix=`echo $includedir | sed "s|$prefix||"` +lib_suffix=`echo $libdir | sed "s|$exec_prefix||"` + usage() { @@ -39,14 +83,17 @@ library --static make command line options display flags for static linking + --help display this help and exit EOF exit $1 } + if test $# -eq 0 ; then usage 1 1>&2 fi + while test $# -gt 0 ; do case "$1" in -*=*) @@ -74,8 +121,8 @@ echo_exec_prefix=yes ;; --version) - echo %ft_version% - exit 0 + echo_version=yes + break ;; --ftversion) echo_ft_version=yes @@ -92,6 +139,9 @@ --static) show_static=yes ;; + --help) + usage 0 + ;; *) usage 1 1>&2 ;; @@ -99,12 +149,27 @@ shift done + if test "$local_prefix" = "yes" ; then if test "$exec_prefix_set" != "yes" ; then exec_prefix=$prefix fi fi +if test "$local_prefix" = "yes" ; then + includedir=${prefix}${include_suffix} + if test "$exec_prefix_set" = "yes" ; then + libdir=${exec_prefix}${lib_suffix} + else + libdir=${prefix}${lib_suffix} + fi +fi + + +if test "$echo_version" = "yes" ; then + echo $version +fi + if test "$echo_prefix" = "yes" ; then echo ${SYSROOT}$prefix fi @@ -113,15 +178,6 @@ echo ${SYSROOT}$exec_prefix fi -if test "$exec_prefix_set" = "yes" ; then - libdir=$exec_prefix/lib -else - if test "$local_prefix" = "yes" ; then - includedir=$prefix/include - libdir=$prefix/lib - fi -fi - if test "$echo_ft_version" = "yes" ; then major=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \ | grep FREETYPE_MAJOR \ @@ -136,26 +192,20 @@ fi if test "$echo_cflags" = "yes" ; then - echo -I${SYSROOT}$includedir/freetype2 + echo $cflags | sed "s|$orig_includedir/freetype2|$includedir/freetype2|" fi if test "$echo_libs" = "yes" ; then - libs="-lfreetype" - staticlibs="%LIBSSTATIC_CONFIG%" if test "$show_static" = "yes" ; then - libs="$staticlibs" - fi - if test "${SYSROOT}$libdir" != "/usr/lib" && - test "${SYSROOT}$libdir" != "/usr/lib64"; then - echo -L${SYSROOT}$libdir $libs + libs="$libs_L $static_libs" else - echo $libs + libs="$libs_L $dynamic_libs" fi + echo $libs | sed "s|$orig_libdir|$libdir|" fi if test "$echo_libtool" = "yes" ; then - convlib="libfreetype.la" - echo ${SYSROOT}$libdir/$convlib + echo ${SYSROOT}$libdir/libfreetype.la fi # EOF diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/ftconfig.in freetype-2.8/=unpacked-tar3=/builds/unix/ftconfig.in --- freetype-2.7.1/=unpacked-tar3=/builds/unix/ftconfig.in 2016-12-22 09:35:20.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/ftconfig.in 2017-05-12 05:50:18.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* UNIX-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -365,6 +365,15 @@ #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/ft-munmap.m4 freetype-2.8/=unpacked-tar3=/builds/unix/ft-munmap.m4 --- freetype-2.7.1/=unpacked-tar3=/builds/unix/ft-munmap.m4 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/ft-munmap.m4 2017-03-30 10:20:23.000000000 +0000 @@ -1,6 +1,6 @@ ## FreeType specific autoconf tests # -# Copyright 2002-2016 by +# Copyright 2002-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/ftsystem.c freetype-2.8/=unpacked-tar3=/builds/unix/ftsystem.c --- freetype-2.7.1/=unpacked-tar3=/builds/unix/ftsystem.c 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/ftsystem.c 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Unix-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/install.mk freetype-2.8/=unpacked-tar3=/builds/unix/install.mk --- freetype-2.7.1/=unpacked-tar3=/builds/unix/install.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/install.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/pkg.m4 freetype-2.8/=unpacked-tar3=/builds/unix/pkg.m4 --- freetype-2.7.1/=unpacked-tar3=/builds/unix/pkg.m4 2015-09-25 05:58:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/pkg.m4 2017-03-30 10:20:23.000000000 +0000 @@ -53,7 +53,7 @@ # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place +# only at the first occurrence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-cc.in freetype-2.8/=unpacked-tar3=/builds/unix/unix-cc.in --- freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-cc.in 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/unix-cc.in 2017-03-30 10:20:23.000000000 +0000 @@ -2,7 +2,7 @@ # FreeType 2 template for Unix-specific compiler definitions # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -99,7 +99,7 @@ # export symbols # CCraw_build := @CC_BUILD@ # native CC of building system -E_BUILD := @EXEEXT_BUILD@ # extension for exexutable on building system +E_BUILD := @EXEEXT_BUILD@ # extension for executable on building system EXPORTS_LIST := $(OBJ_DIR)/ftexport.sym CCexe := $(CCraw_build) # used to compile `apinames' only diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/unixddef.mk freetype-2.8/=unpacked-tar3=/builds/unix/unixddef.mk --- freetype-2.7.1/=unpacked-tar3=/builds/unix/unixddef.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/unixddef.mk 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-def.in freetype-2.8/=unpacked-tar3=/builds/unix/unix-def.in --- freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-def.in 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/unix-def.in 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -111,7 +111,7 @@ $< \ > $@.tmp chmod +x $@.tmp - chmod a-w $@.tmp + chmod go-w $@.tmp mv $@.tmp $@ # To support directory names with spaces (as might easily happen on Windows diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-dev.mk freetype-2.8/=unpacked-tar3=/builds/unix/unix-dev.mk --- freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-dev.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/unix-dev.mk 2017-03-30 10:20:23.000000000 +0000 @@ -6,7 +6,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-lcc.mk freetype-2.8/=unpacked-tar3=/builds/unix/unix-lcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/unix/unix-lcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/unix-lcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -6,7 +6,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/unix/unix.mk freetype-2.8/=unpacked-tar3=/builds/unix/unix.mk --- freetype-2.7.1/=unpacked-tar3=/builds/unix/unix.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/unix/unix.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/vms/ftconfig.h freetype-2.8/=unpacked-tar3=/builds/vms/ftconfig.h --- freetype-2.7.1/=unpacked-tar3=/builds/vms/ftconfig.h 2016-12-22 09:36:02.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/vms/ftconfig.h 2017-05-12 05:49:56.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* VMS-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -306,6 +306,15 @@ #endif +#ifdef _WIN64 + /* only 64bit Windows uses the LLP64 data model, i.e., */ + /* 32bit integers, 64bit pointers */ +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x) +#else +#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x) +#endif + + /*************************************************************************/ /* */ /* miscellaneous */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/vms/ftsystem.c freetype-2.8/=unpacked-tar3=/builds/vms/ftsystem.c --- freetype-2.7.1/=unpacked-tar3=/builds/vms/ftsystem.c 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/vms/ftsystem.c 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/wince/ftdebug.c freetype-2.8/=unpacked-tar3=/builds/wince/ftdebug.c --- freetype-2.7.1/=unpacked-tar3=/builds/wince/ftdebug.c 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/wince/ftdebug.c 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for WinCE (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/wince/vc2005-ce/freetype.vcproj freetype-2.8/=unpacked-tar3=/builds/wince/vc2005-ce/freetype.vcproj --- freetype-2.7.1/=unpacked-tar3=/builds/wince/vc2005-ce/freetype.vcproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/wince/vc2005-ce/freetype.vcproj 2017-05-13 04:28:40.000000000 +0000 @@ -21,7 +21,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -201,7 +201,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -261,7 +261,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -341,7 +341,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -381,7 +381,7 @@ - + @@ -401,7 +401,7 @@ - + @@ -421,7 +421,7 @@ - + @@ -441,7 +441,7 @@ - + @@ -461,7 +461,7 @@ - + @@ -481,7 +481,7 @@ - + @@ -501,7 +501,7 @@ - + @@ -521,7 +521,7 @@ - + @@ -541,7 +541,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -581,7 +581,7 @@ - + @@ -601,7 +601,7 @@ - + @@ -621,7 +621,7 @@ - + @@ -641,7 +641,7 @@ - + @@ -661,7 +661,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -701,7 +701,7 @@ - + @@ -721,7 +721,7 @@ - + @@ -741,7 +741,7 @@ - + @@ -758,7 +758,7 @@ - + diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/wince/vc2005-ce/index.html freetype-2.8/=unpacked-tar3=/builds/wince/vc2005-ce/index.html --- freetype-2.7.1/=unpacked-tar3=/builds/wince/vc2005-ce/index.html 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/wince/vc2005-ce/index.html 2017-05-13 04:28:40.000000000 +0000 @@ -21,14 +21,14 @@
  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/wince/vc2008-ce/freetype.vcproj freetype-2.8/=unpacked-tar3=/builds/wince/vc2008-ce/freetype.vcproj --- freetype-2.7.1/=unpacked-tar3=/builds/wince/vc2008-ce/freetype.vcproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/wince/vc2008-ce/freetype.vcproj 2017-05-13 04:28:40.000000000 +0000 @@ -88,7 +88,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/detect.mk freetype-2.8/=unpacked-tar3=/builds/windows/detect.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/detect.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/detect.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/ftdebug.c freetype-2.8/=unpacked-tar3=/builds/windows/ftdebug.c --- freetype-2.7.1/=unpacked-tar3=/builds/windows/ftdebug.c 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/ftdebug.c 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for Win32 (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2005/freetype.vcproj freetype-2.8/=unpacked-tar3=/builds/windows/vc2005/freetype.vcproj --- freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2005/freetype.vcproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/vc2005/freetype.vcproj 2017-05-13 04:28:40.000000000 +0000 @@ -16,7 +16,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -101,7 +101,7 @@ - + diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2005/index.html freetype-2.8/=unpacked-tar3=/builds/windows/vc2005/index.html --- freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2005/index.html 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/vc2005/index.html 2017-05-13 04:28:40.000000000 +0000 @@ -11,14 +11,14 @@

    This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2008/freetype.vcproj freetype-2.8/=unpacked-tar3=/builds/windows/vc2008/freetype.vcproj --- freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2008/freetype.vcproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/vc2008/freetype.vcproj 2017-05-13 04:28:40.000000000 +0000 @@ -70,7 +70,7 @@ /> This directory contains project files for Visual C++, named freetype.vcproj, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2010/freetype.vcxproj freetype-2.8/=unpacked-tar3=/builds/windows/vc2010/freetype.vcxproj --- freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2010/freetype.vcxproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/vc2010/freetype.vcxproj 2017-05-13 04:28:40.000000000 +0000 @@ -191,18 +191,18 @@ - freetype271d - freetype271d - freetype271MTd - freetype271MTd - freetype271STd - freetype271STd - freetype271 - freetype271 - freetype271MT - freetype271MT - freetype271ST - freetype271ST + freetype28d + freetype28d + freetype28MTd + freetype28MTd + freetype28STd + freetype28STd + freetype28 + freetype28 + freetype28MT + freetype28MT + freetype28ST + freetype28ST diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2010/index.html freetype-2.8/=unpacked-tar3=/builds/windows/vc2010/index.html --- freetype-2.7.1/=unpacked-tar3=/builds/windows/vc2010/index.html 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/vc2010/index.html 2017-05-13 04:28:40.000000000 +0000 @@ -12,16 +12,16 @@

    This directory contains a project file for Visual C++ (VS.NET 2010 or newer), named freetype.vcxproj, and Visual Studio, called freetype.sln. It compiles the following libraries from the -FreeType 2.7.1 sources:

    +FreeType 2.8 sources:

      -    freetype271.lib    - release build
      -    freetype271d.lib   - debug build
      -    freetype271ST.lib  - release build; single threaded
      -    freetype271STd.lib - debug build;   single threaded
      -    freetype271MT.lib  - release build; multi-threaded
      -    freetype271MTd.lib - debug build;   multi-threaded
      + freetype28.lib - release build + freetype28d.lib - debug build + freetype28ST.lib - release build; single threaded + freetype28STd.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MTd.lib - debug build; multi-threaded

    Both Win32 and x64 builds are supported.

    @@ -39,7 +39,7 @@ directory.

    Customization of the FreeType library is done by editing the -ftoptions.h header file in the top-level devel path. +ftoption.h header file in the top-level devel path. Alternatively, you may copy the file to another directory and change the include directory in freetype.users.props.

    diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/visualc/freetype.dsp freetype-2.8/=unpacked-tar3=/builds/windows/visualc/freetype.dsp --- freetype-2.7.1/=unpacked-tar3=/builds/windows/visualc/freetype.dsp 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/visualc/freetype.dsp 2017-05-13 04:28:40.000000000 +0000 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype271ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype28ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28ST_D.lib" !ENDIF diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/visualc/freetype.vcproj freetype-2.8/=unpacked-tar3=/builds/windows/visualc/freetype.vcproj --- freetype-2.7.1/=unpacked-tar3=/builds/windows/visualc/freetype.vcproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/visualc/freetype.vcproj 2017-05-13 04:28:40.000000000 +0000 @@ -69,7 +69,7 @@ /> This directory contains project files for Visual C++, named freetype.dsp, and Visual Studio, called freetype.sln. It -compiles the following libraries from the FreeType 2.7.1 sources:

    +compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/visualce/freetype.dsp freetype-2.8/=unpacked-tar3=/builds/windows/visualce/freetype.dsp --- freetype-2.7.1/=unpacked-tar3=/builds/windows/visualce/freetype.dsp 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/visualce/freetype.dsp 2017-05-13 04:28:40.000000000 +0000 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" @@ -78,7 +78,7 @@ # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" @@ -102,8 +102,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT_D.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" @@ -126,8 +126,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"lib\freetype271.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271MT.lib" +# ADD BASE LIB32 /nologo /out:"lib\freetype28.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" @@ -151,8 +151,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype271ST.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype28ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" @@ -177,8 +177,8 @@ # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype271_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype271ST_D.lib" +# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype28_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype28ST_D.lib" !ENDIF diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/visualce/freetype.vcproj freetype-2.8/=unpacked-tar3=/builds/windows/visualce/freetype.vcproj --- freetype-2.7.1/=unpacked-tar3=/builds/windows/visualce/freetype.vcproj 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/visualce/freetype.vcproj 2017-05-13 04:28:40.000000000 +0000 @@ -87,7 +87,7 @@ /> PPC/SP WM6 (Windows Mobile 6) -It compiles the following libraries from the FreeType 2.7.1 sources:

    +It compiles the following libraries from the FreeType 2.8 sources:

      -    freetype271.lib     - release build; single threaded
      -    freetype271_D.lib   - debug build;   single threaded
      -    freetype271MT.lib   - release build; multi-threaded
      -    freetype271MT_D.lib - debug build;   multi-threaded
      + freetype28.lib - release build; single threaded + freetype28_D.lib - debug build; single threaded + freetype28MT.lib - release build; multi-threaded + freetype28MT_D.lib - debug build; multi-threaded

    Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-bccd.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-bccd.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-bccd.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-bccd.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-bcc.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-bcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-bcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-bcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-dev.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-dev.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-dev.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-dev.mk 2017-03-30 10:20:23.000000000 +0000 @@ -5,7 +5,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-gcc.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-gcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-gcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-gcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-icc.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-icc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-icc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-icc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-intl.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-intl.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-intl.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-intl.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-lcc.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-lcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-lcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-lcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-mingw32.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-mingw32.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-mingw32.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-mingw32.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-vcc.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-vcc.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-vcc.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-vcc.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-wat.mk freetype-2.8/=unpacked-tar3=/builds/windows/w32-wat.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/w32-wat.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/w32-wat.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/builds/windows/win32-def.mk freetype-2.8/=unpacked-tar3=/builds/windows/win32-def.mk --- freetype-2.7.1/=unpacked-tar3=/builds/windows/win32-def.mk 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/builds/windows/win32-def.mk 2017-03-30 10:20:23.000000000 +0000 @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog freetype-2.8/=unpacked-tar3=/ChangeLog --- freetype-2.7.1/=unpacked-tar3=/ChangeLog 2016-12-30 20:13:40.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog 2017-05-13 04:28:58.000000000 +0000 @@ -1,4 +1,2020 @@ -2016-09-08 Werner Lemberg +2017-05-13 Werner Lemberg + + * Version 2.8 released. + ======================= + + + Tag sources with `VER-2-8'. + + * docs/VERSION.TXT: Add entry for version 2.8. + * docs/CHANGES: Updated. + + * README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj, + builds/windows/vc2005/index.html, + builds/windows/vc2008/freetype.vcproj, + builds/windows/vc2008/index.html, + builds/windows/vc2010/freetype.vcxproj, + builds/windows/vc2010/index.html, + builds/windows/visualc/freetype.dsp, + builds/windows/visualc/freetype.vcproj, + builds/windows/visualc/index.html, + builds/windows/visualce/freetype.dsp, + builds/windows/visualce/freetype.vcproj, + builds/windows/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.7.1/2.8/, s/271/28/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 8. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 20:0:14. + * CMakeLists.txt (VERSION_MINOR): Set to 8. + (VERSION_PATCH): Set to 0. + +2017-05-12 Hin-Tak Leung + + Fix `FT_UINT_TO_POINTER' macro for Windows. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER) [_WIN64]: + Fix definition. + +2017-05-11 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [truetype] Add tricky font `DFGirl-W6-WIN-BF' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + +2017-05-07 Roy Tam + Werner Lemberg + + [truetype] More tricky fonts (mainly from Dynalab). + + * src/truetype/ttobjs.c (tt_check_trickyness_family, + tt_check_trickyness_sfnt_ids): Add them. + +2017-05-07 Werner Lemberg + + [truetype] Add tricky font `DLCHayMedium' (from Dynalab). + + Reported by Roy Tam . + + * src/truetype/ttobjs.c (tt_check_trickyness_family): Implement it. + +2017-05-03 Werner Lemberg + + */*: s/backwards compatibility/backward compatibility/. + +2017-05-03 Sascha Brawer + Werner Lemberg + Werner Lemberg + + [autofit] Add blue-zone support for Sundanese script. + + This essentially moves the Sundanese script from the `Indic' hinter + to the `Latin' hinter. + + * src/autofit/afblue.dat: Add blue zone data for Sundanese. + + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Sundanese standard character and move + data out of AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afranges.c: Move Sundanese data out of + AF_CONFIG_OPTION_INDIC block. + + * src/autofit/afstyles.h: Update Sundanese data; in particular, use + AF_WRITING_SYSTEM_LATIN. + +2017-05-03 Sascha Brawer + Werner Lemberg + + [truetype] Make `IUP' gvar deltas do the same as Apple (#50832). + + When points are not touched by gvar interpolation deltas, FreeType + gave a slightly different result than Apple's CoreText. + + The OpenType working group will update the specification to document + the following behaviour: If the two points with deltas to the `left' + and `right' of the untouched point have the same coordinate, then + the inferred delta for the untouched point should be zero. + + * src/truetype/ttgxvar.c (tt_delta_interpolate): Implement new + behaviour. + +2017-05-02 Werner Lemberg + + [autofit] Remove `slight' auto-hint mode again. + + A poll on freetype-devel favoured changes directly applied to + `light'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT, + FT_RENDER_MODE_SLIGHT): Removed. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2.c + (af_latin2_hints_init): Revert change from 2017-04-22. + + * src/autofit/afloader.c (af_loader_load_glyph) Remove references to + FT_RENDER_MODE_SLIGHT. + [AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics + unconditionally. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from + 2017-04-22. + + * src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22. + + * src/pshinter/pshalgo.c (ps_hints_apply): Revert change from + 2017-04-22. + + * src/smooth/ftsmooth.c (ft_smooth_render): Revert change from + 2017-04-22. + + * docs/CHANGES: Updated. + +2017-04-30 Werner Lemberg + + [autofit] Fix metrics computation. + + Problem reported by Markus Trippelsdorf and + Nikolaus Waxweiler . + + * src/base/ftobjs.c (FT_Request_Size): Trigger recomputation of + auto-hinter metrics. Without this change, multiple size changing + calls for a single face fail. + +2017-04-29 Werner Lemberg + + * src/truetype/ttdriver.c (tt_size_request): Properly check `error'. + + Reported by Earnestly in + + http://lists.nongnu.org/archive/html/freetype/2017-04/msg00031.html + +2017-04-27 Werner Lemberg + + Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option. + + * include/freetype/config/ftoption.h + (AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by + default. + + * src/autofit/afloader.c (af_loader_load_glyph): Use + AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code. + +2017-04-26 Werner Lemberg + + * include/freetype/freetype.h (FT_Render_Mode): Fix order. + + This retains backward compatibility. + + Noted by Alexei. + +2017-04-22 Werner Lemberg + + [truetype] Do linear scaling for FT_LOAD_NO_HINTING (#50470). + + * src/truetype/ttobs.h (TT_SizeRec): Add field `hinted_metrics' to + hold hinted metrics. + Make `metrics' a pointer so that `tt_glyph_load' can easily switch + between metrics. + + * src/truetype/ttdriver.c (tt_size_request): Updated. + (tt_glyph_load): Use top-level metrics if FT_LOAD_NO_HINTING is + used. + + * src/truetype/ttgload.c (TT_Hint_Glyph, TT_Process_Simple_Glyph, + TT_Process_Composite_Component, load_truetype_glyph, + compute_glyph_metrics, TT_Load_Glyph): Updated. + + * src/truetype/ttinterp.c (TT_Load_Context): Updated. + + * src/truetype/ttobjs.c (tt_size_reset): Updated. + + * src/truetype/ttsubpix.c (sph_set_tweaks): Updated. + +2017-04-22 Werner Lemberg + + Add new `slight' auto-hinting mode. + + This mode uses fractional advance widths and doesn't scale glyphs + horizontally, only applying vertical scaling and hinting. + + At the same time, the behaviour of the `light' auto-hinter gets + restored for backward compatibility: Both vertical and horizontal + scaling is again based on rounded metrics values (this was changed + in a commit from 2017-03-30 as a side effect). To be more precise, + the behaviour is restored for TrueType fonts only; for other font + formats like Type 1, this is a new feature of the `light' hinting + mode. + + * include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro. + (FT_RENDER_MODE_SLIGHT): New render mode. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add + `autohint_mode' and `autohint_metrics' fields. + + * src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c + (af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init): + Updated. + + * src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use + `autohint_metrics'. + (af_loader_load_glyph): s/internal/slot_internal/. + Initialize `autohint_metrics' and `autohint_mode' depending on + current auto-hint mode. + Use `autohint_metrics'. + Updated. + + * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated. + + * src/base/ftobjs.c (FT_Load_Glyph): Updated. + (FT_New_Size): Allocate `internal' object. + + * src/pshinter/pshalgo.c (ps_hints_apply): Updated. + + * src/smooth/ftsmooth.c (ft_smooth_render): Updated. + +2017-04-22 Werner Lemberg + + Introduce `FT_Size_InternalRec' structure. + + We are going to extend this later on. + + * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New + structure with a single field `module_data'. + + * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of + `FT_Size' structure. + + * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. + (cff_size_init, cff_size_select, cff_size_request): Use + `size->internal->module_data' instead of `size->internal'. + + * src/cif/cidobjs.c (cid_size_done, cid_size_init, + cid_size_request): Use `size->internal->module_data' instead of + `size->internal'. + + * src/psaux/psobjs.c (t1_builder_ini): Use + `size->internal->module_data' instead of `size->internal'. + + * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): + Use `size->internal->module_data' instead of `size->internal'. + +2017-04-21 Alexei Podtelezhnikov + + * src/smooth/ftsmooth.h: Remove unused guards and declaration. + +2017-04-16 Hin-Tak Leung + + Fix tracing messages. + + * src/base/ftobjs.c (FT_Face_GetCharVariantIndex, + FT_Face_GetCharVariantIsDefault, FT_Face_GetVariantsOfChar): Print + correct function name. + +2017-04-08 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [autofit] Fix invalid character range description (#50745). + + Also reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034 + + * src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in + recent commit. + +2017-04-07 Werner Lemberg + + [ftfuzzer] Fix clang warnings. + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Add + casts. + +2017-04-06 Sascha Brawer + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + Werner Lemberg + + [autofit] Add support for Adlam script. + + * src/autofit/afblue.dat: Add blue zone data for Adlam. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Adlam standard characters. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data. + +2017-04-06 Sascha Brawer + + [autofit] Add support for Ol Chiki script. + + * src/autofit/afblue.dat: Add blue zone data for Ol Chiki. + * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. + + * src/autofit/afscript.h: Add Ol Chiki standard character. + + * src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data. + +2017-04-03 Werner Lemberg + + [truetype] Avoid reexecution of `fpgm' and `prep' in case of error. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=981 + + * include/freetype/fterrdef.h (FT_Err_DEF_In_Glyf_Bytecode): New + error code. + + * src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Prohibit execution + of these two opcodes in `glyf' bytecode. + (TT_RunIns): Don't enforce reexecution of `fpgm' and `prep' bytecode + in case of error since function tables can no longer be modified + (due to the changes in `Ins_FDEF' and `Ins_IDEF'). This change can + enormously speed up handling of broken fonts. + +2017-04-02 Alexei Podtelezhnikov + + [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'. + + * src/autofit/aflatin.c (af_latin_hints_init): Updated. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + +2017-04-01 Werner Lemberg + + * src/truetype/ttgload.c: Include FT_CONFIG_CONFIG_H. + + Otherwise FT_UINT_TO_POINTER might not be defined. + + Problem reported by Alexei. + +2017-03-31 Alexei Podtelezhnikov + + [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'. + + * include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it. + * src/autofit/afcjk.c (af_cjk_hints_init): Updated. + * src/autofit/aflatin.c (af_latin_hints_init): Ditto. + * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto. + +2017-03-31 Werner Lemberg + + * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. + + Allow CFFs containing a single font to have an empty font name. + + Problem reported by å¼µä¿ŠèŠ <418092625@qq.com> in + + http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html + +2017-03-30 Werner Lemberg + + * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. + + Requested by Dave Arnold. + +2017-03-30 Werner Lemberg + + [truetype] Fix HVAR and VVAR handling (#50678). + + * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Handle + glyph indices larger than `mapCount' as described in the + specification. + +2017-03-30 Werner Lemberg + + [truetype] Allow linear scaling for unhinted rendering (#50470). + + * src/truetype/ttdriver.c (tt_size_request): Revert change from + 2011-07-16; the intended metrics fix seems now to be implemented in + a different way, making the patch unnecessary. Note that this + change was usually patched out by all major GNU/Linux distributions + due to heavy side effects. + + * src/truetype/ttgload.c (compute_glyph_metrics, TT_Load_Glyph): + Refer to the metrics of the `TT_Size' object. + +2017-03-29 Werner Lemberg + + [truetype] Fix thinko related to PS name of default named instance. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): `strid' and `psid' are + name ID values, not indices into the array of name entries. + +2017-03-27 Werner Lemberg + + [cid, truetype] Don't use `index' as a variable name. + + At least on FreeBSD there is a global declaration of `index' in file + `/usr/include/strings.h'. + + * src/cff/cf2intrp.c, src/truetype/ttgload.c: s/index/idx/ where + appropriate. + +2017-03-27 Wojciech Mamrak + + [sfnt] Minor improvement for handling kern tables. + + * src/sfnt/ttkern.c (tt_face_load_kern): Don't check for + cross-stream kerning tables since we reject format 2 tables later + on anyways. + Modify code for limit test... + (tt_face_get_kerning): ... to avoid a limit test here. + +2017-03-27 Werner Lemberg + + [pcf] Fix compiler warnings. + + Reported by Alexander Hedges . + + * src/pcf/pcfdrivr.c (pcf_property_set, pcf_property_get): Tag + `property_name' with `FT_UNUSED' where necessary. + +2017-03-26 Werner Lemberg + + * src/psaux/psobjs.c (t1_builder_close_contour): Add safety guard. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=941 + +2017-03-23 Werner Lemberg + + [psaux] Better protect `flex' handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=935 + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Since there is not a single flex operator but a + series of subroutine calls, malformed fonts can call arbitrary other + operators after the start of a flex, possibly adding points. For + this reason we have to check the available number of points before + inserting a point. + +2017-03-23 Werner Lemberg + + [sfnt] Fix check for default named instance. + + * src/sfnt/sfobjs.c (sfnt_init_face): A `fixed' number needs four + bytes, not two... + +2017-03-23 Werner Lemberg + + Make MM fonts work (again). + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Ignore + return value of `ft_face_get_mvar_service'; instead, check whether a + service is actually returned. + +2017-03-20 Werner Lemberg + + [truetype] Some variable renamings. + + Too much local variables holding different structures were called + `metrics'. + + * src/truetype/ttdriver.c (tt_size_select): s/metrics/size_metrics/. + + * src/truetype/ttgload.c (tt_get_metrics_incr_overrides, + compute_glyph_metrics): s/metrics/incr_metrics/. + (load_sbit_image): s/metrics/sbit_metrics/. + + * src/truetype/ttobjs.c (tt_size_run_fpgm): s/metrics/size_metrics/. + (tt_size_init_bytecode): s/metrics/tt_metrics/. + (tt_size_reset): s/metrics/size_metrics/. + +2017-03-20 Werner Lemberg + + [sfnt] Don't add instances to non-variation fonts. + + * src/sfnt/sfobjs.c (sfnt_init_face): Fix it. + +2017-03-20 Werner Lemberg + + * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578). + +2017-03-18 Werner Lemberg + + Introduce FT_UINT_TO_POINTER macro (#50560). + + We have to make a separate case for Windows 64's LLP64 data model. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro. + + * src/truetype/ttgload.c (load_truetype_glyph): Use it. + +2017-03-18 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573). + + The problematic font that exceeds the old limit is Lato-Regular, + version 2.007, containing bytecode generated by a buggy version of + ttfautohint. + +2017-03-18 Werner Lemberg + + [truetype] Another limitation for bytecode loop count maximum. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=900 + + * src/truetype/ttinterp.c (TT_RunIns): Limit `loopcall_counter_max' + by number of glyphs also. + +2017-03-18 Werner Lemberg + + [ftfuzzer] Minor improvement. + + * src/tools/ftfuzzer/ftfuzzer.cc: Don't set intermediate axis if + bitmap strikes are active. + +2017-03-18 Werner Lemberg + + Improve `make multi'. + + * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. + + * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. + + * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/sfnt/pngshim.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. + + * src/sfnt/ttbdf.c: Avoid empty source file. + * src/sfnt/ttpost.c: Guard file with + TT_CONFIG_OPTION_POSTSCRIPT_NAMES. + * src/sfnt/ttsbit.c: Guard file with + TT_CONFIG_OPTION_EMBEDDED_BITMAPS. + + * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty + source file. + + * src/truetype/ttsubpix.c: Guard file with + TT_USE_BYTECODE_INTERPRETER also. + + * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. + + * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, + src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, + src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, + src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, + src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, + src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort + entries. + +2017-03-17 Werner Lemberg + + Fixes for conditional compilation. + + * src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h' + earlier. + + * src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into + TT_CONFIG_OPTION_GX_VAR_SUPPORT block. + (sfnt_done_face): Protect some code with + TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler + warning. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable + into TT_USE_BYTECODE_INTERPRETER block. + + (tt_loader_init): Put `error' variable into + TT_USE_BYTECODE_INTERPRETER block. + +2017-03-17 Werner Lemberg + + Fix preprocessor warning. + + * devel/ftoption.h, include/freetype/config/ftoption.h: Test whether + TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined before checking its + value. + +2017-03-17 Werner Lemberg + + `make multi' fixes; compiler warnings. + + * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. + + * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + + * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. + (get_win_string, get_apple_string): Initialize `result'. + +2017-03-17 Dave Arnold + + [cff] Fix potential bugs in default NDV for CFF2. + + * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend + vector when `lenNDV' is zero; don't rely on zero-init. + Save `lenNDV' as part of cache key even when `lenNDV' is zero. + +2017-03-17 Dave Arnold + + [cff] Fix CFF2 stack allocation. + + * src/cff/cffparse.c (cff_parser_init) add 1 for operator. + +2017-03-16 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_done_blend): Free `vvar_table'. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=883 + +2017-03-15 Werner Lemberg + + Remove clang compiler warnings (#50548). + + * include/freetype/internal/tttypes.h (TT_FaceRec): Make + `var_postscript_prefix_len' unsigned. + + * src/autofit/afwarp.c (af_warper_compute_line_best): Remove + redundant assignment. + + * src/cff/cffload.c (cff_subfont_load): Add casts. + + * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. + + * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' + keyword. + Add casts. + (fixed2float): Add cast. + (sfnt_get_var_ps_name): Make `p' always initialized. + Add casts. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts. + +2017-03-15 Werner Lemberg + + [ftfuzzer] Limit number of tested faces and instances. + + This is inspired by the discussion in and analysis of + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=859 + + * src/tools/ftfuzzer/ftfuzzer.cc (LLVMFuzzerTestOneInput): Use only + up to 20 face indices. + Use only up to 20 instance indices. + +2017-03-15 Werner Lemberg + + * src/tools/ftfuzzer/ftfuzzer.cc: Improve readability; formatting. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [3/3]. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * include/freetype/internal/tttypes.h (TT_FaceRec): New fields + `var_postscript_prefix' and `var_postscript_prefix_len'. + + * src/sfnt/sfdriver.c: Include FT_TRUETYPE_IDS_H. + (sfnt_is_alphanumeric): New wrapperfunction for `ft_isalnum'. + (get_win_string, get_apple_string): Remove `const' from return + value. + (MAX_VALUE_DESCRIPTOR_LEN, MAX_PS_NAME_LEN): New macros. + (hexdigits): New array. + (sfnt_get_var_ps_name): New function, implementing Adobe TechNote + 5902 to construct a PS name for a variation font instance. + (sfnt_get_ps_name): Call `sfnt_get_var_ps_name' for font instances. + + * src/sfnt/sfobjs.c (sfnt_done_face): Updated. + + * src/truetype/ttgxvar.c (tt_set_mm_blend): Reset + `face->postscript_name' to trigger recalculation for new instance + parameters. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [2/3]. + + * src/sfnt/sfdriver.c (fix2float) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: + New function to find the shortest representation of a 16.16 + fractional number. + +2017-03-14 Werner Lemberg + + [sfnt] Implement PS names for font instances [1/3]. + + Add 128bit MurmurHash 3 function. + + Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. + + * src/sfnt/sfdriver.c (ROTL32): New macro. + (fmix32, murmur_hash_3_128): New functions. + +2017-03-13 Werner Lemberg + + [truetype] Ignore invalid MVAR tags. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=838 + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Ignore value and emit + warning for invalid tags. + (tt_apply_mvar): Ignore invalid tags. + +2017-03-12 Werner Lemberg + + [truetype] Store and use design coordinates also. + + * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): + Add `normalizedcoords' argument. + + * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store + the design coordinates of the current instance. + Updated. + + * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... + (tt_set_mm_blend): ... New function. + Convert data in `normalizedcoords' array to `coords' array on + demand. + (TT_Set_Var_Design): Store argument data in `coords' array. + (TT_Get_Var_Design): Get data from `coords' array. + (tt_get_var_blend): Updated. + (tt_done_blend): Updated. + + * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. + + * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. + + * src/cff/cffobjs.c (cff_face_init): Updated. + +2017-03-12 Werner Lemberg + + src/truetype/ttgxvar.[ch]: s/avar_checked/avar_loaded/. + +2017-03-08 Werner Lemberg + + [sfnt] Another fix for buggy variation fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=759 + + * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of + instances to zero for `CFF' fonts table, ensure that there is no + `CFF2' present also (which gets priority). + +2017-03-07 Werner Lemberg + + [sfnt] Improve handling for buggy variation fonts. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=738 + + * src/sfnt/sfobjs.c (sfnt_init_face): While setting number of + instances to zero for `CFF' fonts table, ensure that there is no + `glyf' table present also (which gets priority). + +2017-03-06 Werner Lemberg + + [sfnt, truetype] Always provide default instance. + + As documented in the OpenType specification, an entry for the + default instance may be omitted in the named instance table. In + particular this means that even if there is no named instance table + in the font we actually do have a named instance, namely the default + instance. + + For consistency, we always want the default instance in our list of + named instances. If it is missing, we try to synthesize it. + + * src/sfnt/sfobjs.c (sfnt_init_face): Check whether the default + instance is in the table of named instances. Otherwise adjust + number of instances. + + * src/truetype/ttgxvar.c: Include FT_TRUETYPE_IDS_H. + (TT_Get_MM_Var): Use `face->root.style_flags' as the number of named + instances. + Sythesize a named instance entry if necessary. + (tt_done_blend): Free `normalized_stylecoords'. + +2017-03-05 Werner Lemberg + + [sfnt] Remove redundant code. + + * src/sfnt/sfobjs.c (sfnt_init_face): Remove second test for + `num_instances', which will always succeed. + +2017-03-04 Werner Lemberg + + [sfnt] Add `get_name_id' service. + + * include/freetype/internal/sfnt.h (TT_Get_Name_ID_Func): New + typedef. + (SFNT_Interface): Add `get_name_id' field. + (FT_DEFINE_SFNT_INTERFACE): Updated. + + * src/sfnt/sfdriver.c (search_name_id): Rename to... + (sfnt_get_name_id): ... this. + (sfnt_get_ps_name, sfnt_interface): Udpated. + +2017-03-04 Werner Lemberg + + [truetype] Make `TT_Set_MM_Blend' set named instance index. + + * src/truetype/ttgxvar.h (GX_Blend): New array + `normalized_stylecoords'. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Allocate and fill + `normalized_stylecoords'. + (TT_Set_MM_Blend): Check instance tuple and adjust `face_index' + accordingly. + +2017-03-02 Werner Lemberg + + [truetype] Split off designer/normalized conversion routines. + + * src/truetype/ttgxvar.c (TT_Set_Var_Design): Split off conversion + code designer->normalized coordinates to... + (ft_var_to_normalized): ... New function. + (TT_Get_Var_Design): Split off conversion code normalized->designer + coordinates to... + (ft_var_to_design): ... New function. + +2017-02-28 Werner Lemberg + + [sfnt] Further generalize `sfnt_get_ps_name'; report invalid data. + + * src/sfnt/sfdriver.c (sfnt_ps_map): New array. + (sfnt_is_postscript): New function. + (char_type_func): New typedef. + (get_win_string, get_apple_string): Add argument to specify + character checking function. + Add argument whether argument checking failures should be reported. + Update callers. + (search_name_id): Fix return value. + +2017-02-23 Werner Lemberg + + [sfnt] Split off another bit of `sfnt_get_ps_name'. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some + functionality into... + (search_name_id): ... New function. + +2017-02-23 Werner Lemberg + + [sfnt] Modularize `sfnt_get_ps_name'. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Split off some + functionality into... + (IS_WIN, IS_APPLE): ... New macros. + (get_win_string, get_apple_string): ... New functions. + +2017-02-23 Werner Lemberg + + [truetype] Minor improvement. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Remove unnecessary tests. + +2017-02-23 Werner Lemberg + + * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/. + + For orthogonality with other structure field names. + + Update all users. + +2017-02-22 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_hline): Improve code. + +2017-02-20 Dominik Röttsches + + Fix some `ttnameid.h' entries (#50313). + + * include/freetype/ttnameid.h: + s/TT_MS_LANGID_SPANISH_INTERNATIONAL_SORT/TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT/, + s/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIA/TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN/. + +2017-02-20 Werner Lemberg + + [cff] Finish support for `random' operator. + + * src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field. + + * src/cff/cffobjs.c: Updated. + (cff_driver_init): Initialize random seed value. + + * src/cff/cffload.c (cff_random): New function. + (cff_subfont_load): Add `face' argument. + Update all callers. + Initialize random number generator with a proper seed value. + (cff_font_load): Add `face' argument. + Update all callers. + + * src/cff/cffload.h: Updated. + + * src/cff/cf2intrp.c (CF2_FIXME): Removed. + (cf2_interpT2CharString) : Implement opcode. + + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't + initialize random seed value. + : Use new random seed framework. + +2017-02-20 Werner Lemberg + + [cff] Sanitize `initialRandomSeed'. + + * src/cff/cffload.c (cff_load_private_dict): Make + `initial_random_seed' value always positive. + +2017-02-20 Werner Lemberg + + [cff] Introduce `random-seed' property (2/2). + + * src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'. + (open_face): Initialize `face->internal->random_seed'. + (FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'. + + * src/cff/cffdrivr.c (cff_property_set): Handle `random-seed' + property. + +2017-02-20 Werner Lemberg + + [cff] Introduce `random-seed' property (1/2). + + We need this for support of the `random' operator. + + * include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New + field `random_seed'. + + * src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'. + +2017-02-17 Werner Lemberg + + Remove clang warnings. + + * src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static' + keyword. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): + Initialize some variables. + +2017-02-16 Nikolaus Waxweiler + Werner Lemberg + + Add face property for stem darkening. + + * include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New + macro. + + * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add + `no_stem_darkening' field. + + * src/autofit/afloader.c (af_loader_load_glyph), + src/autofit/afmodule.c (af_property_set): Updated. + + * src/base/ftobjs.c: Include FT_AUTOHINTER_H. + (ft_open_face_internal): Updated. + (FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING. + + * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated. + + * src/cff/cffdrivr.c (cff_property_set): Updated. + +2017-02-16 Nikolaus Waxweiler + Werner Lemberg + + Add face property for LCD filter weights. + + * include/freetype/ftlcdfil.h (FT_PARAM_TAG_LCD_FILTER_WEIGHTS, + FT_LCD_FILTER_FIVE_TAPS): New macros. + (FT_LcdFiveTapFilter): New typedef. + + * include/freetype/ftobjs.h (FT_Face_InternalRec) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add `lcd_weights' field. + (FT_Bitmap_LcdFilterFunc): Change third argument to weights array. + (ft_lcd_filter_fir): New prototype. + (FT_LibraryRec): Updated. + + * src/base/ftlcdfil.c (_ft_lcd_filter_fir): Renamed to... + (ft_lcd_filter_fir): ... this base function. + Updated. + (_ft_lcd_filter_legacy): Updated. + (FT_Library_SetLcdFilterWeights, FT_Library_SetLcdFilter): Updated. + + * src/base/ftobjs.c (ft_open_face_internal): Updated. + (FT_Face_Properties): Handle FT_PARAM_TAG_LCD_FILTER_WEIGHTS. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic) + [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Handle LCD weights from + `FT_Face_Internal'. + +2017-02-14 Nikolaus Waxweiler + Werner Lemberg + + Add new function `FT_Face_Properties'. + + This commit provides the framework, to be filled with something + useful in the next commits. + + * include/freetype/freetype.h (FT_Face_Properties): Declare. + + * src/base/ftobjs.c (FT_Face_Properties): New function. + +2017-02-13 Werner Lemberg + + [autofit] Prevent overlapping blue zones. + + Problem reported as + + https://github.com/google/fonts/issues/632 + + The font in question (Nunito) has values 705 and 713 for the + reference and overshoot values, respectively, of the first blue + zone. Blue zone 2, however, has value 710 for both the reference + and overshoot. At 12ppem, reference and overshoot of blue zone 0 + becomes 8px, while blue zone 2 becomes 9px. + + A peculiarity of this font is that the tops of isolated vertical + stems like `N' have a slight overshoot also. The auto-hinter tries + to find the nearest blue zone using the *original* coordinates. For + vertical stems, this is value 713. For normal horizontal tops like + in character `E', this is value 710. Since value 713 is mapped to + 8px but value 710 to 9px, `N' and similar characters are one pixel + higher than `E', which looks very bad. + + This commit sanitizes blue zones to avoid such a behaviour. + + * src/autofit/aflatin.c (af_latin_sort_blue): New function. + (af_latin_metrics_init_blues): Sort blue values and remove overlaps. + +2017-02-12 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_sweep): Improve code. + +2017-02-06 Werner Lemberg + + [truetype] Implement `VVAR' table support. + + * src/truetype/ttgxvar.h (GX_HVarTable): Renamed to... + (GX_HVVarTable): ...This. + (GX_Blend): Add fields for `VVAR' table handling. + Other minor updates. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Renamed to... + (ft_var_load_hvvar): ...This. + Handle VVAR loading also (controlled by an additional parameter). + (tt_hadvance_adjust): Renamed to... + (tt_hvadvance_adjust): ...This. + Handle application of advance height also (controlled by an + additional parameter). + (tt_hadvance_adjust, tt_vadvance_adjust): Wrappers for + `tt_hvadvance_adjust'. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Updated. + +2017-02-05 Werner Lemberg + + [autofit] Use better blue zone characters for lowercase latin. + + The number of lowercase characters for computing the top flat blue + zone value was too small (in most cases only `x' and `z'). If one + of the two characters has a large serif, say, it can happen that + FreeType must select between two different values, having a 50% + chance to use the wrong one. As a result, rendering at larger PPEM + values could yield uneven lowercase glyph heights. + + Problem reported by Christoph Koeberlin . + + * src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced + with... + (AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM): + ... New, extended sets. + (AF_BLUE_STRINGSET_LATN): Updated. + + * src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated. + +2017-02-04 Werner Lemberg + + Make `freetype-config' a wrapper of `pkg-config' if possible. + + Based on ideas taken from + + http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-multilib.patch + http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/tree/freetype-2.5.3-freetype-config-prefix.patch + + * builds/unix/freetype-config.in: Rewritten. Use `pkg-config' to + set output variables if program is available. + + * docs/CHANGES, docs/freetype-config.1: Updated. + +2017-02-04 Werner Lemberg + + * builds/unix/unix-def.in (freetype-config): Fix permissions. + +2017-02-03 Werner Lemberg + + * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. + +2017-02-03 Werner Lemberg + + * include/freetype/ftgasp.h (FT_GASP_SYMMETRIC_GRIDFIT): Fix value. + + Reported by Behdad. + +2017-02-02 Werner Lemberg + + [truetype] Fix MVAR post-action handling. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=509 + + * src/truetype/ttobjs.c (tt_size_reset): Do nothing for CFF2. This + is important to make `tt_size_reset_iterator' (called in + `tt_apply_mvar') always work. + +2017-02-02 Werner Lemberg + + Make compilation with FT_CONFIG_OPTION_PIC work again. + + All code committed here is guarded with `FT_CONFIG_OPTION_PIC'. + + * include/freetype/internal/services/svmetric.h + (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon. + + * src/autofit/aflatin.c (af_latin_hints_compute_edges, + af_latin_hint_edges): Provide `globals' variable. + + * src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing + variable. + + * src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET, + AF_STYLE_CLASSES_GET): Redefine. + + * src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo. + + * src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it. + + * src/cff/cffpic.h (CffModulePIC): Fix typo. + +2017-01-31 Alexei Podtelezhnikov + + * src/smooth/ftgrays.c (gray_render_scanline): Improve code. + +2017-01-31 Werner Lemberg + + [cff] Provide metrics variation service interface (#50196). + + Only now I've got an OTF with an HVAR table for testing... + + The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the + metrics variations interface. However, this didn't work with + `FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'. + + * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for + metric service functions from the `truetype' module. + (cff_service_metrics_variations): New service. + (cff_services): Updated. + + * src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro. + [FT_CONFIG_OPTION_PIC]: Synchronize code. + + * src/sfnt/sfobjs.c (sfnt_init_face): Replace call to + FT_FACE_FIND_GLOBAL_SERVICE with `ft_module_get_service' to always + load the service from the `truetype' module. + +2017-01-31 Werner Lemberg + + Add framework to support services with 9 functions. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC9): + New macro. + +2017-01-31 Werner Lemberg + + [base] Fix error handing in MM functions. + + * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, + FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): + Implement it. + +2017-01-31 Werner Lemberg + + [truetype] Fix sanity check for `gvar' table (#50184). + + * src/truetype/ttgxvar.c (ft_var_load_gvar): There might be missing + variation data for some glyphs. + +2017-01-31 Werner Lemberg + + [autofit] Avoid uninitialized jumps (#50191). + + * src/autofit/afcjk.c (af_cjk_metrics_check_digits), + src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize + `advance'. + +2017-01-27 Werner Lemberg + + s/GB2312/PRC/. + + * include/freetype/freetype.h (FT_ENCODING_PRC): New enum value. + (FT_ENCODING_GB2312): Deprecated. + + * include/freetype/ttnameid.h (TT_MS_ID_PRC): New macro. + (TT_MS_ID_GB2312): Deprecated. + + * src/sfnt/sfobjs.c (sfnt_find_encoding): Updated. + + * docs/CHANGES: Updated. + +2017-01-26 Werner Lemberg + + [base] Add `FT_Get_Sfnt_LangTag' function. + + * include/freetype/ftsnames.h (FT_SfntLangTag): New structure. + (FT_Get_Sfnt_LangTag): New declaration. + + * src/base/ftsnames.c (FT_Get_Sfnt_LangTag): New funtion. + + * docs/CHANGES: Updated. + +2017-01-26 Werner Lemberg + + [sfnt] Support `name' table format 1. + + * include/freetype/internal/tttypes.h (TT_LangTagRec): New + structure. + (TT_NameTableRec): Add fields `numLangTagRecords' and `langTags'. + + * src/sfnt/ttload.c (tt_face_load_name): Add support for language + tags. + Reduce array size of name strings in case of invalid entries. + (tt_face_free_name): Updated. + + * docs/CHANGES: Updated. + +2017-01-25 Werner Lemberg + + [sfnt] s/TT_NameEntry/TT_Name/. + + * include/freetype/internal/tttypes.h (TT_NameEntryRec): Renamed + to... + (TT_NameRec): This. + (TT_NameTableRec): Updated. + + * src/base/ftsnames.c (FT_Get_Sfnt_Name): Updated. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Updated. + + * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, + tt_name_entry_ascii_from_other): Renamed to... + (tt_name_ascii_from_utf16, tt_name_entry_ascii_from_other): This, + respectively. + (TT_NameEntry_ConvertFunc): Renamed to... + (TT_Name_ConvertFunc): This. + (tt_face_get_name): Updated. + + * src/sfnt/ttload.c (tt_face_load_name, tt_face_free_name): + Updated. + +2017-01-24 Werner Lemberg + + [sfnt] Fix Postscript name service for symbol fonts. + + * src/sfnt/sfdriver.c (sfnt_get_ps_name): Accept PID/EID=3/0 + entries also. + +2017-01-24 Werner Lemberg + + [truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family. + + * include/freetype/ftsnames.h + (FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY, + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros. + (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, + FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated. + + * include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY, + TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros. + (TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY): + Deprecated. + + * src/sfnt/sfobjs.c (sfnt_load_face): Updated. + + * docs/CHANGES: Updated. + +2017-01-23 Werner Lemberg + + [base] Add `FT_Set_Default_Properties' (#49187). + + * include/freetype/ftmodapi.h: Add declaration. + + * src/base/ftinit.c (ft_set_default_properties): Renamed to... + (FT_Set_Default_Properties): ... this. + (FT_Init_FreeType): Updated. + + * docs/CHANGES: Updated. + +2017-01-23 Werner Lemberg + + [truetype] Minor updates for OpenType 1.8.1. + + * src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been + removed from the specification; it is now reserved. + + * src/truetype/ttgxvar.c (ft_var_load_mvar): Updated. + (GX_FVar_Head): Remove `countSizePairs'; the corresponding data + field in the `MVAR' table is now reserved. + (fvar_fields): Updated. + +2017-01-23 Werner Lemberg + + [truetype] Avoid segfault for invalid variation data. + + * src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Assure + `itemCount' is not zero. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=441 + +2017-01-20 Werner Lemberg + + * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits. + +2017-01-17 Werner Lemberg + + * include/freetype/ttnameid.h: Updated to OpenType 1.8.1. + + (TT_APPLE_ID_FULL_UNICODE): New macro. + + (TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC, + TT_MS_LANGID_UPPER_SORBIAN_GERMANY, + TT_MS_LANGID_LOWER_SORBIAN_GERMANY, TT_MS_LANGID_IRISH_IRELAND, + TT_MS_LANGID_INUKTITUT_CANADA_LATIN, TT_MS_LANGID_BASHKIR_RUSSIA, + TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG, + TT_MS_LANGID_GREENLANDIC_GREENLAND, TT_MS_LANGID_MAPUDUNGUN_CHILE, + TT_MS_LANGID_MOHAWK_MOHAWK, TT_MS_LANGID_BRETON_FRANCE, + TT_MS_LANGID_OCCITAN_FRANCE, TT_MS_LANGID_CORSICAN_FRANCE, + TT_MS_LANGID_ALSATIAN_FRANCE, TT_MS_LANGID_YAKUT_RUSSIA, + TT_MS_LANGID_KICHE_GUATEMALA, TT_MS_LANGID_KINYARWANDA_RWANDA, + TT_MS_LANGID_WOLOF_SENEGAL, TT_MS_LANGID_DARI_AFGHANISTAN): New + macros. + + (TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC): Fix value. + + (TT_MS_LANGID_GERMAN_LIECHTENSTEIN, TT_MS_LANGID_CATALAN_CATALAN, + TT_MS_LANGID_CHINESE_MACAO, TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT, + TT_MS_LANGID_KOREAN_KOREA, TT_MS_LANGID_ROMANSH_SWITZERLAND, + TT_MS_LANGID_SLOVENIAN_SLOVENIA, TT_MS_LANGID_BASQUE_BASQUE, + TT_MS_LANGID_SETSWANA_SOUTH_AFRICA, + TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA, + TT_MS_LANGID_ISIZULU_SOUTH_AFRICA, TT_MS_LANGID_KAZAKH_KAZAKHSTAN, + TT_MS_LANGID_KYRGYZ_KYRGYZSTAN, TT_MS_LANGID_KISWAHILI_KENYA, + TT_MS_LANGID_TATAR_RUSSIA, TT_MS_LANGID_ODIA_INDIA, + TT_MS_LANGID_MONGOLIAN_PRC, TT_MS_LANGID_TIBETAN_PRC, + TT_MS_LANGID_WELSH_UNITED_KINGDOM, TT_MS_LANGID_GALICIAN_GALICIAN, + TT_MS_LANGID_SINHALA_SRI_LANKA, TT_MS_LANGID_TAMAZIGHT_ALGERIA, + TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA, TT_MS_LANGID_YI_PRC, + TT_MS_LANGID_UIGHUR_PRC): New aliases. + + Remove commented out code. + + (TT_NAME_ID_LIGHT_BACKGROUND, TT_NAME_ID_DARK_BACKGROUND, + TT_NAME_ID_VARIATIONS_PREFIX): New macros. + + (HAVE_LIMIT_ON_IDENTS): Remove macro (which was useless since many + years), use guarded long macros by default and define short versions + as aliases for the long ones. + +2017-01-15 Werner Lemberg + + * src/truetype/ttgxvar.c (tt_apply_var): Handle underline parameters + also. + +2017-01-11 Werner Lemberg + + * src/base/ftobjs.c (ft_open_face_internal): Improve tracing. + +2017-01-11 Werner Lemberg + + [truetype] Actually use metrics variation service. + + * src/base/ftmm.c: Include FT_SERVICE_METRICS_VARIATIONS_H. + (ft_face_get_mvar_service): New auxiliary function to look up + metrics variation service. + (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, + FT_Set_Var_Blend_Coordinates): Call metrics variation service. + + * src/truetype/ttobjs.c (tt_face_init): Use metrics variations for + named instances. + +2017-01-11 Werner Lemberg + + [truetype] Provide metrics variation service. + + * include/freetype/internal/services/svmetric.h + (FT_Metrics_Adjust_Func): Reduce number of necessary parameters. + + * src/truetype/ttgxvar.c: Include FT_LIST_H. + (tt_size_reset_iterator): New auxiliary function for... + (tt_apply_var): New function. + + * src/truetype/ttgxvar.h: Updated. + + * src/truetype/ttdriver.c (tt_service_metrics_variations): Add + `tt_apply_mvar'. + + * include/freetype/internal/ftserv.h (FT_ServiceCache): Add metrics + variation service. + +2017-01-11 Werner Lemberg + + [truetype] Parse `MVAR' table. + + * src/truetype/ttgxvar.h (MVAR_TAG_XXX): New macros for MVAR tags. + (GX_Value, GX_MVarTable): New structures. + (GX_Blend): Add it. + + * src/truetype/ttgxvar.c (GX_VALUE_SIZE, GX_VALUE_CASE, + GX_GASP_CASE): New macros. + (ft_var_get_value_pointer): New auxiliary function to get a pointer + to a value from various SFNT tables already stored in `TT_Face'. + (ft_var_load_mvar): New function. + (TT_Get_MM_Var): Call it. + (tt_done_blend): Updated. + +2017-01-11 Werner Lemberg + + [truetype] More preparations for MVAR support. + + * src/truetype/ttobjs.c (tt_size_reset): Add argument to make + function only recompute ascender, descender, and height. + + * src/truetype/ttobjs.h: Updated. + + * src/truetype/ttdriver.c (tt_size_select, tt_size_request): + Updated. + +2017-01-09 Werner Lemberg + + [pcf] Disable long family names by default. + + * include/freetype/config/ftoption.h + (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): Comment out. + +2017-01-09 Werner Lemberg + + [pcf] Make long family names configurable. + + The change from 2016-09-29 was too radical (except for people using + the openSuSE GNU/Linux distribution). To ameliorate the situation, + PCF_CONFIG_OPTION_LONG_FAMILY_NAMES gets introduced which controls + the feature; if set, a new PCF property option + `no-long-family-names' can be used to switch this feature off. + + * include/freetype/config/ftoption.h, devel/ftoption.h + (PCF_CONFIG_OPTION_LONG_FAMILY_NAMES): New option. + + * include/freetype/ftpcfdrv.h: New header file (only containing + comments currently, used for building the documentation). + + * include/freetype/config/ftheader.h (FT_PCF_DRIVER_H): New macro. + + * src/pcf/pcf.h (PCF_Driver): Add `no_long_family_names' field. + + * src/pcf/pcfdrivr.c: Include FT_SERVICE_PROPERTIES_H and + FT_PCF_DRIVER_H. + (pcf_property_set, pcf_property_get): New functions. + (pcf_service_properties): New service. + (pcf_services): Updated. + (pcf_driver_init) [PCF_CONFIG_OPTION_LONG_FAMILY_NAMES]: Handle + `no_long_family_names'. + + * src/pcf/pcfread.c (pcf_load_font): Handle `no_long_family_names' + and PCF_CONFIG_OPTION_LONG_FAMILY_NAMES. + + * docs/CHANGES: Updated. + +2017-01-09 Werner Lemberg + + [pcf] Introduce a driver structure. + + To be filled later on with something useful. + + * src/pcf/pcf.h (PCF_Driver): New structure. + + * src/pcf/pcfdrivr.c (pcf_driver_init, pcf_driver_done): New dummy + functions. + (pcf_driver_class): Updated. + +2017-01-08 Werner Lemberg + + [truetype] Again some GX code shuffling. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (tt_hadvance_adjust): Split off computing + an item store variation delta into... + (ft_var_get_item_delta): ...new function. + +2017-01-08 Werner Lemberg + + [truetype] Adjust font variation flags for MVAR. + + * include/freetype/internal/tttypes.h (TT_FACE_FLAG_VAR_XXX): + Remove all flags related to MVAR; replace it with... + (TT_FACE_FLAG_VAR_MVAR): ...this new macro. + (TT_Face): Remove `mvar_support' field (which was still unused). + +2017-01-06 Werner Lemberg + + [truetype] More GX code shuffling. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (tt_done_blend): Split off handling of item + variation store into... + (ft_var_done_item_variation_store): ...new function. + +2017-01-06 Werner Lemberg + + [truetype] More generalization of GX stuff. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add + parameters for delta-set index mapping and item variation store. + (ft_var_load_item_variation_store): Add parameter for item variation + store. + s/hvarData/varData/. + Move allocation of `hvar_table' to... + (ft_var_load_hvar): ...this function. + Updated. + +2017-01-06 Werner Lemberg + + [truetype] Some GX structure renames for generalization. + + We need this later on for MVAR also. + + * src/truetype/ttgxvar.h (GX_HVarData): Renamed to... + (GX_ItemVarData): ...this. + (GX_HVarRegion): Renamed to... + (GX_VarRegion): ...this. + (GX_HVStore): Renamed to... + (GX_ItemVarStore): ...this. + (GX_WidthMap): Renamed to... + (GX_DeltaSetIdxMap): ...this. + + (GX_HVarTable): Updated. + + * src/truetype/ttgxvar.c: Updated. + +2017-01-06 Werner Lemberg + + [truetype] Code shuffling. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Split off loading of + item variation store and delta set index mapping into... + (ft_var_load_item_variation_store, + ft_var_load_delta_set_index_mapping): ...new functions. + +2017-01-06 Werner Lemberg + + [truetype] Add HVAR access without advance width map. + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Handle case where + `offsetToAdvanceWidthMapping' is zero. + (tt_hadvance_adjust): Implement direct deltaSet access by glyph + index. + +2017-01-06 Werner Lemberg + + [pcf] Revise driver. + + This commit improves tracing and handling of malformed fonts. In + particular, the changes to `pcf_get_properties' fix + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=379 + + * src/pcf/pcfread.c (tableNames): Use long names for better + readability. + (pcf_read_TOC): Allow at most 9 tables. + (pcf_get_properties): Allow at most 256 properties. + Limit strings array length to 256 * (65536 + 1) bytes. + Better tracing. + (pcf_get_metric): Trace metric data. + (pcf_get_metrics): Allow at most 65536 metrics. + Fix comparison of `metrics->ascent' and `metrics->descent' to avoid + potential overflow. + Better tracing. + (pcf_get_bitmaps): Allow at most 65536 bitmaps. + Better tracing. + (pcf_get_encodings, pcf_get_accel): Better tracing. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Don't trace `format' details. + These are now shown by `pcf_get_bitmaps'. + +2017-01-04 Werner Lemberg + + * src/pcf/pcfdrivr.c (PCF_Face_Init): Trace compression format. + +2017-01-04 Werner Lemberg + + [cff] More consistency checks for pure CFFs. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=378 + + * src/cff/cffload.c (cff_font_load): Check element number and size + of Name and Top DICT indices. + +2017-01-04 Werner Lemberg + + [cff, truetype] Minor tracing improvement. + + * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c + (tt_face_init): Indent first tracing message from SFNT driver. + +2017-01-03 Werner Lemberg + + [truetype] Various minor fixes. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check instruction + size only if we do native hinting. + (TT_Load_Glyph): Trace returned error code. + + * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Trace + returned error code. + (tt_size_ready_bytecode): Don't run `prep' table if `fpgm' table is + invalid. + +2017-01-03 Werner Lemberg + + [sfnt] Don't fail if PCLT, EBLC (and similar tables) are invalid. + + These tables are optional. + + * src/sfnt/sfobjs.c (sfnt_load_face): Implement it. + +2017-01-03 Werner Lemberg + + * src/cff/cffparse.c (cff_parse_num): Simplify. + +2017-01-03 Werner Lemberg + + Various fixes for clang's undefined behaviour sanitizer. + + * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. + (cff_blend_doBlend): Don't left-shift negative numbers. + Handle 5-byte numbers byte by byte to avoid alignment issues. + + * src/cff/cffparse.c (cff_parse_num): Handle 5-byte numbers byte by + byte to avoid alignment issues. + + * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any + subrs. + + * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. + + * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around + definition of `ft_get_adobe_glyph_index'. + + * src/psnames/pstables.h: Regenerated. + + * src/psnames/psmodule.c: Include `pstables.h' twice to get both + declaration and definition. + + * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix + casting. + +2017-01-01 Werner Lemberg + + [cff] Handle multiple `blend' operators in a row correctly. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=368 + + * src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack' + pointers into `subFont->blend_stack' after reallocation. + +2017-01-01 Werner Lemberg + + [sfnt] Return correct number of named instances for TTCs. + + Without this patch, requesting information for face index N returned + the data for face index N+1 (or index 0). + + * src/sfnt/sfobjs.c (sfnt_init_face): Correctly adjust `face_index' + for negative `face_instance_index' values. + +2016-12-31 Werner Lemberg + + */*: Use hex numbers for errors in tracing messages. + +2016-12-31 Werner Lemberg + + [truetype] Check axis count in HVAR table. + + Reported as + + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=362 + + * src/truetype/ttgxvar.c (ft_var_load_hvar): Check axis count. + (ft_var_load_avar): Fix tracing message. + +2016-12-30 Werner Lemberg * Version 2.7.1 released. ========================= @@ -51,7 +2067,7 @@ * src/tools/ftfuzzer/ftfuzzer.cc: Include `stdlib.h' for `rand'. (Random): Small class to provide n randomly selected numbers - (without repitition) out of the value set [1,N]. + (without repetition) out of the value set [1,N]. (LLVMFuzzerTestOneInput): Use it to test only up to 10 bitmap strikes. @@ -891,7 +2907,7 @@ * src/type1/t1driver.c: Updated. - * src/type1/t1load.c (T1_Get_Var_Design): New dummp function to + * src/type1/t1load.c (T1_Get_Var_Design): New dump function to handle `get_var_design' service. * src/type1/t1load.h: Updated. @@ -1239,7 +3255,7 @@ 2016-09-29 Werner Lemberg - [truetype] Disallow bitmap strokes for non-default instances. + [truetype] Disallow bitmap strikes for non-default instances. Also speed up access of default instances if GX variations are active. @@ -1494,7 +3510,7 @@ 2016-09-07 Alexei Podtelezhnikov - * src/smooth/ftgrays.c (gray_hline): Microptimize. + * src/smooth/ftgrays.c (gray_hline): Micro-optimize. 2016-09-06 Alexei Podtelezhnikov @@ -1626,12 +3642,12 @@ 2016-09-03 Werner Lemberg - [base] Avoid negative bitmap stroke dimensions (#48985). + [base] Avoid negative bitmap strike dimensions (#48985). * src/base/ftobjs.c (FT_Open_Face): Check whether negation was actually successful. For example, this can fail for value -32768 if the type is `signed short'. If there are problems, - disable the stroke. + disable the strike. 2016-09-03 Werner Lemberg @@ -1670,7 +3686,7 @@ [smooth] Simplify span rendering more. It turns out that there is significant cost associated with `FT_Span' - creation and calls to `gray_render_span' because it happerns so + creation and calls to `gray_render_span' because it happens so frequently. This removes these steps from our internal use but leaves it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain is about 5%. @@ -2070,7 +4086,7 @@ [sfnt] Fix `face_index' value in `FT_Face' for named instances. - * src/sfnt/sfobjc.s (sfnt_init_face): Don't strip off higher 16bits. + * src/sfnt/sfobjs.c (sfnt_init_face): Don't strip off higher 16bits. 2016-07-14 Werner Lemberg @@ -2090,7 +4106,7 @@ ---------------------------------------------------------------------------- -Copyright 2016 by +Copyright 2016-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.20 freetype-2.8/=unpacked-tar3=/ChangeLog.20 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.20 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.20 2017-04-22 05:39:36.000000000 +0000 @@ -1338,7 +1338,7 @@ (cff_compute_bias): Use `U' for constant. * src/cid/cidload.c (cid_decrypt): Ditto. * src/psaux/psobjs.c (T1_Decrypt): Ditto. - * src/psaux/t1decode.c (T1_Decoder_Parse_CharStrings): Ditto. + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto. * src/sfnt/ttload.c (TT_Load_Kern): Remove unused `version' variable. * src/sfnt/ttsbit.c (TT_Load_SBit_Image): Remove unused `top' @@ -1524,7 +1524,7 @@ * src/base/ftcalc.c (FT_DivFix): Fixed a bug in the 64-bit code that created incorrect scale factors! - (FT_Round_Fix, FT_CeilFix, FT_FloorFix): Minor improvements. + (FT_RoundFix, FT_CeilFix, FT_FloorFix): Minor improvements. 2001-05-12 Werner Lemberg @@ -2159,7 +2159,7 @@ * include/freetype/internal/t2types.h, include/freetype/internal/cfftypes.h: Changed the structures for - CFF_Encoding and CFF_Encoding for the new implementations of the + CFF_Charset and CFF_Encoding for the new implementations of the charset and encoding parsers in the CFF driver. * src/cff/t2gload.c (t2_lookup_glyph_by_stdcharcode, @@ -2597,7 +2597,7 @@ ---------------------------------------------------------------------------- -Copyright 2000-2016 by +Copyright 2000-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.21 freetype-2.8/=unpacked-tar3=/ChangeLog.21 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.21 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.21 2017-05-03 21:30:02.000000000 +0000 @@ -170,7 +170,7 @@ FTC_CACHE_TRYLOOP_END): New macros. * src/cache/ftccache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c - (ftc_snode_compare): Use FT_CACHE_TRYLOOP and FTC_CACE_TRYLOOP_END. + (ftc_snode_compare): Use FT_CACHE_TRYLOOP and FTC_CACHE_TRYLOOP_END. 2005-05-23 Werner Lemberg @@ -617,7 +617,7 @@ `ft_get_adobe_glyph_index', a new function defined in `pstables.h'. (ps_get_macintosh_name, ps_get_standard_strings): Updated. - * src/base/ftobjs.c (FT_Set_Char_Sizes): Handle fractional sizes + * src/base/ftobjs.c (FT_Set_Char_Size): Handle fractional sizes more carefully. This fixes Savannah bug #12263. 2005-03-06 David Turner @@ -1819,7 +1819,7 @@ 2004-08-11 Detlef Würkner * src/base/ftrfork.c (FT_Raccess_Guess) - [!FT_CONFIG_OPTION_GUESSING_EMBEDDED_FORK]: Remove compiler + [!FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK]: Remove compiler warnings. 2004-08-06 Adam Piotrowski @@ -2101,7 +2101,7 @@ 2004-06-08 David Turner - * include/freetype/freetype.h (FT_GlyphMetrics): Move `lsb_delta' + * include/freetype/freetype.h (FT_Glyph_Metrics): Move `lsb_delta' and `rsb_delta' elements to... (FT_GlyphSlotRec): Here to retain binary compatibility with older FreeType versions. @@ -2528,7 +2528,7 @@ * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. (TT_Process_Simple_Glyph, load_truetype_glyph) - [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Support GX var fonts. * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include ttgxvar.h. @@ -2864,7 +2864,7 @@ (psh_blues_snap_stem): Don't use blue_shift but blue_threshold. * src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD_MAXIMUM): New macro. - (psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. + (psh_glyph_find_strong_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. (psh_glyph_find_blue_points): New function. Needed for fonts like p052003l.pfb (URW Palladio L Roman) which have flex curves at the base line within blue zones, but the flex curves aren't covered by @@ -3361,7 +3361,7 @@ * src/base/ftstroke.c: Include FT_INTERNAL_OBJECTS_H. (FT_Outline_GetOutsideBorder): Inverse result. - (FT_Stroker_Rewind, FT_Glyph_Stroke, FT_GlyphStrokeBorder): New + (FT_Stroker_Rewind, FT_Glyph_Stroke, FT_Glyph_StrokeBorder): New functions. (FT_Stroker_EndSubPath): Close path if needed. (FT_Stroker_Set, FT_Stroker_ParseOutline): Use FT_Stroker_Rewind. @@ -3493,8 +3493,8 @@ 2003-12-23 David Turner * include/freetype/internal/ftobjs.h (FT_PAD_FLOOR, FT_PAD_ROUND, - FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_CEIL): New macros. They - are used to avoid compiler warnings with very pedantic compilers. + FT_PAD_CEIL, FT_PIX_FLOOR, FT_PIX_ROUND, FT_PIX_CEIL): New macros. + They are used to avoid compiler warnings with very pedantic compilers. Note that `(x) & -64' causes a warning if (x) is not signed. Use `(x) & ~63' instead! Updated all related code. @@ -4231,7 +4231,7 @@ (t42_parse_encoding): Use `ft_isdigit'. - * src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_OK if + * src/base/ftmm.c (ft_face_get_mm_service): Return FT_Err_Ok if success. 2003-10-05 Werner Lemberg @@ -4355,7 +4355,7 @@ new POSTSCRIPT_NAMES service. * src/psaux/t1decode.h (t1_lookup_glyph_by_stdcharcode, t1_decode_init): Use new POSTSCRIPT_NAMES service. - * src/psaux/t1cmap.h, src/psaux/t1decode.h: Dont' include + * src/psaux/t1cmap.h, src/psaux/t1decode.h: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H. * src/psnames/psmodule.c: Don't include @@ -4749,8 +4749,7 @@ * include/freetype/ttunpat.h: Fixing documentation comment. * include/freetype/config/ftoption.h, devel/ftoption.h - (TT_CONFIG_OPTION_OPTION_COMPILE_UNPATENTED_HINTING): Replaced - with... + (TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING): Replaced with... (TT_CONFIG_OPTION_UNPATENTED_HINTING): This. Updated all users. (TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING): Removed. @@ -5024,7 +5023,7 @@ drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. - (FT_Set_Pixel_Size): Assign value to `metrics' after validation of + (FT_Set_Pixel_Sizes): Assign value to `metrics' after validation of arguments. 2003-06-20 Werner Lemberg @@ -5200,7 +5199,7 @@ * src/cid/cidload.c (cid_load_keyword): Handle T1_FIELD_LOCATION_BBOX. (parse_font_bbox): Commented out. - (cid_field_record): Comment out element for parsing FontBBox. + (cid_field_records): Comment out element for parsing FontBBox. * src/type42/t42parse.c (t42_parse_font_bbox): Commented out. (t42_keywords): Handle FontBBox with T1_FIELD_BBOX, not with @@ -5916,7 +5915,7 @@ 2003-04-23 Werner Lemberg * src/pfr/pfrload.c (pfr_extra_item_load_font_id): Use FT_PtrDist - instead of FT_Uint for `len'. + instead of FT_UInt for `len'. 2003-04-22 Werner Lemberg @@ -6550,7 +6549,7 @@ * src/cache/ftcsbits.c (ftc_sbit_node_load): Fixed a small bug that caused problems with embedded bitmaps. - * src/otlayout/otlayout.h, src/otlyaout/otlconf.h, + * src/otlayout/otlayout.h, src/otlayout/otlconf.h, src/otlayout/otlgsub.c, src/otlayout/otlgsub.h, src/otlayout/otlparse.c, src/otlayout/otlparse.h, src/otlayout/otlutils.h: Updating the OpenType Layout code, adding @@ -7239,7 +7238,7 @@ (ft_smooth_render, ft_smooth_render_lcd, ft_smooth_render_lcd_v): New functions. - (ft_smooth_locd_renderer_class, ft_smooth_lcdv_renderer_class): New + (ft_smooth_lcd_renderer_class, ft_smooth_lcdv_renderer_class): New classes. * src/truetype/ttobjs.c (TT_{Done,New}_GlyphZone): Renamed to... @@ -7376,7 +7375,7 @@ * src/pcf/pcfdriver.c (PCF_Glyph_Load): Fix computation of horiBearingX. - * src/bdf/bdfdrivr.c (BDF_GlyphLoad): Fix computation of + * src/bdf/bdfdrivr.c (BDF_Glyph_Load): Fix computation of horiBearingY. 2002-08-16 George Williams @@ -7581,7 +7580,7 @@ * include/freetype/cache/ftccache.h, src/cache/ftccache.i, src/cache/ftccache.c [!FTC_CACHE_USE_LINEAR_HASHING]: Removed. - (FTC_CACHE_USE_LINEAR_HASHING: Removed also. + (FTC_CACHE_USE_LINEAR_HASHING): Removed also. FT_CONFIG_OPTION_USE_CMAPS is now the default. @@ -7603,7 +7602,7 @@ * src/cid/cidriver.c (Cid_Get_Char_Index, Cid_Get_Next_Char): Removed. - (t1_cid_driver_class): Updated. + (t1cid_driver_class): Updated. * src/truetype/ttdriver.c (tt_driver_class): Updated. * src/type1/t1driver.c (Get_Char_Index, Get_Next_Char): Removed (t1_driver_class): Updated. @@ -7698,7 +7697,7 @@ CFF_Done_SubFont -> cff_subfont_done CFF_Load_Font -> cff_font_load CFF_Done_Font -> cff_font_done - CFF_Size_Get_Global_Funcs -> cff_size_get_global_funcs + CFF_Size_Get_Globals_Funcs -> cff_size_get_globals_funcs CFF_Size_Done -> cff_size_done CFF_Size_Init -> cff_size_init CFF_Size_Reset -> cff_size_reset @@ -8636,7 +8635,7 @@ src/pfr/*: New files. * include/freetype/config/ftmodule.h, - include/freetype/internal/fttrace.h, src/Jamefile: Updated. + include/freetype/internal/fttrace.h, src/Jamfile: Updated. * src/type1/t1gload.h (T1_Load_Glyph), src/type1/t1gload.c (T1_Load_Glyph): Fixed incorrect parameter sign-ness in callback @@ -9063,7 +9062,7 @@ FT_Glyph_Name_Requester => FT_Face_GetGlyphNameFunc FT_Name_Index_Requester => FT_Face_GetGlyphNameIndexFunc - * src/base/ftapi.c: New file. It contains backwards compatibility + * src/base/ftapi.c: New file. It contains backward compatibility functions. * include/freetype/internal/psaux.h, src/cid/cidload.c, @@ -9106,7 +9105,7 @@ FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings. * src/base/ftcalc.c (FT_MulFix): Ditto. * src/cff/cffdrivr.c (cff_get_name_index): Ditto. - * src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init, + * src/cff/cffobjs.c (CFF_Size_Get_Globals_Funcs, CFF_Size_Init, CFF_GlyphSlot_Init): Ditto. * src/cid/cidobjs.c (CID_GlyphSlot_Init, CID_Size_Get_Globals_Funcs): Ditto. @@ -9247,7 +9246,7 @@ { } PS_StructRec, *PS_Struct; - typedef PS_StructRec T1_Struct; /* backwards-compatibility */ + typedef PS_StructRec T1_Struct; /* backward compatibility */ Hence, we increase the coherency of the source code by effectively using the `Rec' prefix for structure types. @@ -9384,7 +9383,7 @@ * src/pcf/pcfread.c (pcf_seek_to_table_type): Ditto. * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Ditto. (pcf_get_bitmaps): The same for `sizebitmaps'. - * src/psaux/t1decode.c (T1_Decode_Parse_Charstrings): The same for + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): The same for `orig_y'. (t1operator_seac): Comment out more dead code. * src/pshinter/pshalgo2.c (ps2_hints_apply): Add `DEBUG_HINTER' @@ -9423,7 +9422,7 @@ ---------------------------------------------------------------------------- -Copyright 2002-2016 by +Copyright 2002-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.22 freetype-2.8/=unpacked-tar3=/ChangeLog.22 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.22 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.22 2017-05-03 21:30:14.000000000 +0000 @@ -189,7 +189,7 @@ * src/base/ftdbgmem.c (_ft_debug_file, _ft_debug_lineno) [FT_DEBUG_MEMORY]: New global variables, replacing... - (FT_MemTable_Rec) [FT_DEBUG_MEMORY]: Remove `filename' and + (FT_MemTableRec) [FT_DEBUG_MEMORY]: Remove `filename' and `line_no'. Update all callers. (ft_mem_debug_alloc) [FT_DEBUG_MEMORY]: Avoid possible integer overflow. @@ -494,7 +494,7 @@ FTC_MruList_Init, FTC_MruList_Reset, FTC_MruList_Done, FTC_MruList_New, FTC_MruList_Remove, FTC_MruList_RemoveSelection): Declare as FT_LOCAL_DEF. - (FTC_MruListFind, FTC_MruList_Lookup) [!FTC_INLINE]: Compile + (FTC_MruList_Find, FTC_MruList_Lookup) [!FTC_INLINE]: Compile conditionally. Declare as FT_LOCAL_DEF. @@ -605,7 +605,7 @@ * docs/release: Minor additions and clarifications. - * docs/CHANGES: Updated to reflect many fixes for backwards + * docs/CHANGES: Updated to reflect many fixes for backward compatibility. Still incomplete. 2006-02-26 David Turner @@ -814,7 +814,7 @@ * include/freetype/ftcache.h (FTC_IMAGE_TYPE_COMPARE, FTC_IMAGE_TYPE_HASH), src/cache/ftcbasic.c (FTC_OldFontRec, FTC_OldImageDescRec, FTC_ImageCache_Lookup, FTC_Image_Cache_New, - FTC_OldImage_Desc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx, + FTC_OldImageDesc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx, ftc_image_type_from_old_desc, FTC_Image_Cache_Lookup, FTC_SBitCache_Lookup, FTC_SBit_Cache_New, FTC_SBit_Cache_Lookup) [FT_CONFIG_OPTION_OLD_INTERNALS]: Try to revive old functions of the @@ -2458,8 +2458,8 @@ * src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'. - * src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE), - src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix + * src/gxvalid/gxvmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE), + src/gxvalid/gxvmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix typo. * src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c, @@ -2787,7 +2787,7 @@ 2005-06-15 Kirill Smelkov The next release will be 2.2.0, so don't worry about source code - backwards compatibility. + backward compatibility. * include/freetype/ftimage.h (FT_Outline_MoveToFunc, FT_Outline_LineToFunc, FT_Outline_ConicToFunc, @@ -2821,7 +2821,7 @@ ---------------------------------------------------------------------------- -Copyright 2005-2016 by +Copyright 2005-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.23 freetype-2.8/=unpacked-tar3=/ChangeLog.23 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.23 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.23 2017-04-22 05:39:36.000000000 +0000 @@ -607,7 +607,7 @@ (ft_black_render): Initialize `worker->gray_lines' (problem found by valgrind). - (FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Dont' #undef, just + (FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Don't #undef, just comment out. 2009-09-12 suzuki toshiya @@ -671,7 +671,7 @@ * src/raster/rules.mk: Don't handle ftmisc.h. It is needed for stand-alone mode only. - * src/raster/ftmisc.h (FT_MemoryRec , FT_Alloc_Func, FT_Free_Func, + * src/raster/ftmisc.h (FT_MemoryRec, FT_Alloc_Func, FT_Free_Func, FT_Realloc_Func): Copy declarations from ftsystem.h. 2009-09-02 Bram Tassyns @@ -929,7 +929,7 @@ type1: Fix a data type mismatching with its source. * include/freetype/internal/t1types.h: The type of - T1_Face->buildchar is matched with T1_Decorder->top. + T1_Face->buildchar is matched with T1_Decoder->top. 2009-07-31 suzuki toshiya @@ -944,7 +944,7 @@ pfr: Fix a data type mismatching with its source. - * src/pfr/pfrtypes.h: The type of PFR_PhysFont->chars_offset + * src/pfr/pfrtypes.h: The type of PFR_PhyFont->chars_offset is extended from FT_UInt32 to FT_Offset, because it is calculated with the pointer difference in pfr_phy_font_load(). @@ -975,8 +975,8 @@ psaux: Fix a data type mismatching with its source. * include/freetype/internal/psaux.h: The type of - T1_DecorderRec.buildchar is matched with - T1_DecorderRec.top. + T1_DecoderRec.buildchar is matched with + T1_DecoderRec.top. 2009-07-31 suzuki toshiya @@ -2125,7 +2125,7 @@ code unconditionally. Add support for random numbers and update remaining code accordingly; this should work now. - (t1_operator_seac): Updated. + (t1operator_seac): Updated. * src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H. (ps_hints_t1stem3, t1_hints_stem): Updated. @@ -2594,14 +2594,14 @@ Position Independent Code (PIC) support in smooth renderer. * src/smooth/ftsmooth.h declare ft_smooth_renderer_class, - ft_smooth_lcd_renderer_class and ft_smooth_lcd_v_renderer_class + ft_smooth_lcd_renderer_class and ft_smooth_lcdv_renderer_class using macros from ftrender.h, when FT_CONFIG_OPTION_PIC is defined create and destroy functions will be declared. * src/smooth/ftsmooth.c when FT_CONFIG_OPTION_PIC is defined the following structs: ft_smooth_renderer_class, ft_smooth_lcd_renderer_class - and ft_smooth_lcd_v_renderer_class + and ft_smooth_lcdv_renderer_class will have functions to init or create and destroy them instead of being allocated in the global scope. And macros will be used from ftspic.h in order to access @@ -4156,7 +4156,7 @@ 2008-09-05 suzuki toshiya * builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Carbon or - ApplicationService framework is missing. Although this value is not + ApplicationServices framework is missing. Although this value is not used in building of FreeType2, it is written in `freetype2.pc' and `freetype-config'. @@ -4861,7 +4861,7 @@ 2008-04-14 Werner Lemberg * src/pcf/pcfdrivr.c (PCF_Face_Init): Protect call to - `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZ'. From Savannah + `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZW'. From Savannah bug #22909. 2008-04-13 Werner Lemberg @@ -5243,7 +5243,7 @@ functions related to cmap type 14 support to the `FT_Object_ActionName' scheme: - FT_Get_Char_Variant_index -> FT_Face_GetCharVariantIndex + FT_Get_Char_Variant_Index -> FT_Face_GetCharVariantIndex FT_Get_Char_Variant_IsDefault -> FT_Face_GetCharVariantIsDefault FT_Get_Variant_Selectors -> FT_Face_GetVariantSelectors FT_Get_Variants_Of_Char -> FT_Face_GetVariantsOfChar @@ -5383,7 +5383,7 @@ * include/freetype/ftotval.h (FT_VALIDATE_MATH): New macro. (FT_VALIDATE_OT): Updated. - * src/otvalid/otmath.c: New file. + * src/otvalid/otvmath.c: New file. * src/otvalid/otvalid.c: Include otvmath.c. * src/otvalid/otvmod.c (otv_validate): Handle `MATH' table. @@ -5530,7 +5530,7 @@ * src/truetype/ttinterp.c (Ins_IUP): Add missing variable initialization. - * src/autofit/aflatin.c (af_latin_metric_init_blues): Get rid of an + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Get rid of an infinite loop in the case of degenerate fonts. 2007-06-26 Rahul Bhalerao @@ -5965,7 +5965,7 @@ * include/freetype/config/ftstdlib.h, include/freetype/internal/ftobjs.h: As suggested by Graham Asher, ensure that ft_isalnum, ft_isdigit, etc., use hard-coded values - instead on relying on the locale-dependent functions provided by + instead of relying on the locale-dependent functions provided by . 2007-05-15 Graham Asher @@ -7023,7 +7023,7 @@ (_ft_lcd_filter_fir): This. Update parameters. (_ft_lcd_filter_legacy) [USE_LEGACY]: New filter function. - (FT_Library_Set_LcdFilter): Update parameters. + (FT_Library_SetLcdFilter): Update parameters. Handle new filter modes. * include/internal/ftobjs.h: Include FT_LCD_FILTER_H. @@ -7366,7 +7366,7 @@ to recognize a few fonts that require the automatic unpatented loader. - * src/smooth/ftgrays.c: Optmize the performance of the anti-aliased + * src/smooth/ftgrays.c: Optimize the performance of the anti-aliased rasterizer. The speed improvement is between 15% and 25%, depending on the font data. @@ -7857,7 +7857,7 @@ 2006-05-18 Werner Lemberg * src/truetype/ttgload.c (TT_Load_Composite_Glyph) - [FT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. + [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. 2006-05-17 David Turner @@ -7932,7 +7932,7 @@ ---------------------------------------------------------------------------- -Copyright 2006-2016 by +Copyright 2006-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.24 freetype-2.8/=unpacked-tar3=/ChangeLog.24 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.24 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.24 2017-05-03 21:23:56.000000000 +0000 @@ -335,7 +335,7 @@ * include/freetype/ftmoderr.h: Fix commit from 2013-03-11. - The previous version was not backwards compatible. Reported by + The previous version was not backward compatible. Reported by Behdad. 2013-03-14 Werner Lemberg @@ -784,7 +784,7 @@ and `const' where appropriate. (X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to... - (spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This. + (sph_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This. Update all users. 2013-01-12 Alexei Podtelezhnikov @@ -2141,7 +2141,7 @@ * include/freetype/ftoutln.h (FT_Outline_EmboldenXY): Define it. * src/base/ftoutln.c (FT_Outline_EmboldenXY): Implement it, using a - simplified embolding algorithm. + simplified emboldening algorithm. (FT_Outline_Embolden): Make it a special case of `FT_Outline_EmboldenXY' @@ -2941,10 +2941,10 @@ [type42] Remove casts. - * src/type42/t42driver.c (t42_driver_class): Remove all casts and + * src/type42/t42drivr.c (t42_driver_class): Remove all casts and update affected functions. - * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42driver + * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42 driver changes. 2011-11-30 Werner Lemberg @@ -3776,7 +3776,7 @@ [gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c. * src/gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): - Check different entries pointing same traking value. + Check different entries pointing same tracking value. (gxv_trak_validate): Remove unused variable `table_size'. 2011-06-14 suzuki toshiya @@ -3788,12 +3788,12 @@ (gxv_morx_chain_validate): Conditionalize unvalidated variable `defaultFlags'. - * src/gxvalid/gxmorx0.c + * src/gxvalid/gxvmorx0.c (gxv_morx_subtable_type0_entry_validate): Conditionalize unvalidated variables; `markFirst', `dontAdvance', `markLast', `verb'. - * src/gxvalid/gxmorx1.c + * src/gxvalid/gxvmorx1.c (gxv_morx_subtable_type1_entry_validate): Conditionalize unvalidated variables; `setMark', `dontAdvance'. @@ -3826,11 +3826,11 @@ (gxv_mort_chain_validate): Conditionalize unvalidated variable `defaultFlags'. - * src/gxvalid/gxmort0.c + * src/gxvalid/gxvmort0.c (gxv_mort_subtable_type0_entry_validate): Check the conflict of the marks for the glyphs. - * src/gxvalid/gxmort1.c + * src/gxvalid/gxvmort1.c (gxv_mort_subtable_type1_offset_to_subst_validate): Local variables `min_gid', `max_gid' are replaced by variables in the validator. @@ -4029,7 +4029,7 @@ af_latin_hints_compute_blue_edges. (af_cjk_metrics_init_blues): New function, CJK version of af_latin_metrics_init_blues. - (af_cjk_hints_edges): Add code to align the edge stems to blue zones. + (af_cjk_hint_edges): Add code to align the edge stems to blue zones. * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. @@ -5669,7 +5669,7 @@ Use defined macros to set {platform,encoding}_id. * src/bdf/bdfdrivr.c: Include ttnameid.h and use macros to - set charmap.{platfom,encoding}_id. + set charmap.{platform,encoding}_id. * src/pcf/pcfdrivr.c: Ditto. * src/winfonts/winfnt.c: Ditto. * src/type1/t1objs.c: Ditto. @@ -5792,8 +5792,8 @@ * src/cff/cffobjs.c (cff_face_init): Check error value by `FT_CMap_New'. * src/pfr/pfrobjs.c (pfr_face_init): Ditto. - * src/type1/t1jobjs.c (T1_Face_Init): Ditto. - * src/type42/t42jobjs.c (T42_Face_Init): Ditto. + * src/type1/t1objs.c (T1_Face_Init): Ditto. + * src/type42/t42objs.c (T42_Face_Init): Ditto. 2010-07-03 Werner Lemberg @@ -6344,7 +6344,7 @@ ---------------------------------------------------------------------------- -Copyright 2010-2016 by +Copyright 2010-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.25 freetype-2.8/=unpacked-tar3=/ChangeLog.25 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.25 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.25 2017-05-03 21:30:22.000000000 +0000 @@ -244,7 +244,7 @@ All public FreeType enumeration and flag values are uppercase... - * include/tttables.h (FT_Sfnt_Tag): Implement it. For backwards + * include/tttables.h (FT_Sfnt_Tag): Implement it. For backward compatibility, retain the old values as macros. * src/base/ftfstype.c (FT_Get_FSType_Flags), src/sfnt/sfdriver.c @@ -1223,7 +1223,7 @@ 2014-10-14 Werner Lemberg - [autofit] Adjust Devenagari character range. + [autofit] Adjust Devanagari character range. * src/autofit/afranges.c (af_deva_uniranges): Omit characters that are common to all other Indic scripts. @@ -4767,7 +4767,7 @@ * src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast. * src/cache/ftcmanag.h (FTC_ManagerRec): Ditto. - * src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast. + * src/cff/cf2arrst.c (cf2_arrstack_setNumElements): Use cast. * src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto. * src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto. @@ -5145,7 +5145,7 @@ ---------------------------------------------------------------------------- -Copyright 2013-2016 by +Copyright 2013-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/ChangeLog.26 freetype-2.8/=unpacked-tar3=/ChangeLog.26 --- freetype-2.7.1/=unpacked-tar3=/ChangeLog.26 2016-12-11 06:53:49.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/ChangeLog.26 2017-05-03 21:37:59.000000000 +0000 @@ -324,7 +324,7 @@ 2016-06-20 Alexei Podtelezhnikov - [smooth] Sanitize memory managenent. + [smooth] Sanitize memory management. * src/smooth/ftgrays.c (gray_convert_glyph): Cleaned up. @@ -434,7 +434,7 @@ * src/truetype/ttinterp.c (Ins_SHPIX): Allow SHPIX to move points in the twilight zone. Otherwise, treat SHPIX the same as DELTAP. Unbreaks various fonts such as older versions of Rokkitt and DTL - Argo T Light that would glitch severly after calling ALIGNRP after a + Argo T Light that would glitch severely after calling ALIGNRP after a blocked SHPIX. 2016-05-30 Werner Lemberg @@ -460,7 +460,7 @@ [smooth] Shrink bisection stack. The convergence of Bézier flatteners is fast with the deviation - from straight line being assymptotically cut 4-fold on each bisection. + from straight line being asymptotically cut 4-fold on each bisection. This justifies smaller bisection stack size. * src/smooth/ftgrays.c (gray_TWorker): Remove common `bez_stack'. @@ -563,26 +563,26 @@ * src/truetype/ttinterp.c (SUBPIXEL_HINTING): Replaced by... (NO_SUBPIXEL_HINTING, SUBPIXEL_HINTING_INFINALITY, SUBPIXEL_HINTING_MINIMAL): ...new macros. - (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backwards + (Direct_Move, Direct_Move_X, Direct_Move_Y): Handle backward compatibility. Updated. (Ins_RS, Ins_FDEF, Ins_ENDF, Ins_CALL, Ins_LOOPCALL, Ins_MD): Updated. (Ins_INSTCTRL): Handle native ClearType mode flag. Updated. - (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backwards + (Ins_FLIPPT, Ins_FLIPRGON, Ins_FLIPRGOFF): Handle backward compatibility. (Move_Zp2_Point): Ditto. (Ins_SHP): Updated. - (Ins_SHPIX): Handle backwards compatibility. + (Ins_SHPIX): Handle backward compatibility. Updated. (Ins_MSIRP, Ins_MDAP, Ins_MIAP, Ins_MDRP, Ins_MIRP): Updated. (Ins_ALIGNRP): Updated. - (Ins_IUP, Ins_DELTAP): Handle backwards compatibility. + (Ins_IUP, Ins_DELTAP): Handle backward compatibility. Updated. (Ins_GETINFO): Handle v38 flags. Updated. - (TT_RunIns): Handle backwards compatibility mode. + (TT_RunIns): Handle backward compatibility mode. Updated. 2016-05-17 Nikolaus Waxweiler @@ -606,16 +606,16 @@ * src/truetype/ttinterp.h (TT_ExecContextRec): Define new fields `subpixel_hinting_lean', `vertical_lcd_lean', - `backwards_compatibility', `iupx_called', iupy_called', and + `backward_compatibility', `iupx_called', iupy_called', and `grayscale_cleartype' for new hinting mode. * src/truetype/ttdriver.c (tt_property_set): Handle v38 and v40 interpreters conditionally. * src/truetype/ttgload.c (TT_Hint_Glyph): Save phantom points unless - in v38 backwards compatibility mode. + in v38 backward compatibility mode. Updated. - (compute_glyph_metrics): Add v38 backwards compatibility mode + (compute_glyph_metrics): Add v38 backward compatibility mode constraint for adjusting advance widths. Updated. (tt_loader_init): Handle new flags `subpixel_hinting_lean', @@ -979,7 +979,7 @@ * src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move band clipping from here. (gray_conic_to, gray_cubic_to): ... to here. - (gray_rander_line, gray_render_scanline): Initialize variables closer + (gray_render_line, gray_render_scanline): Initialize variables closer to their use. 2016-03-17 Alexei Podtelezhnikov @@ -1482,7 +1482,7 @@ Still handle `__FTERRORS_H__'. - We need this for backwards compatibility. + We need this for backward compatibility. Problem reported by John Emmas . @@ -3408,7 +3408,7 @@ [raster,smooth] Microoptimizations. * src/raster/ftraster.c (Insert_Y_Turn, Finalize_Profile_Table, - Bezier_Up, ): Use do-while loops. + Bezier_Up): Use do-while loops. * src/smooth/ftgrays.c (gray_render_scanline, gray_render_line, gray_convert_glyph): Ditto. @@ -4222,7 +4222,7 @@ [truetype] Support selector index 3 of the INSTCTRL instruction. - This flag activates `native ClearType hinting', disabling backwards + This flag activates `native ClearType hinting', disabling backward compatibility mode as described in Greg Hitchcocks whitepaper. In other words, it enables unrestricted functionality of all TrueType instructions in ClearType. @@ -5447,7 +5447,7 @@ [raster] Remove 5-level gray AA mode from monochrome rasterizer. It was off by default and couldn't be turned on at runtime. And the - smooth rasterizer superceded it over ten years ago. No point in + smooth rasterizer superseded it over ten years ago. No point in keeping. Comments suggested that it was there for compatibility with FreeType 1. @@ -5695,7 +5695,7 @@ ---------------------------------------------------------------------------- -Copyright 2015-2016 by +Copyright 2015-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff -Nru freetype-2.7.1/=unpacked-tar3=/CMakeLists.txt freetype-2.8/=unpacked-tar3=/CMakeLists.txt --- freetype-2.7.1/=unpacked-tar3=/CMakeLists.txt 2016-12-30 20:06:57.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/CMakeLists.txt 2017-05-13 04:28:40.000000000 +0000 @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright 2013-2016 by +# Copyright 2013-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written originally by John Cary @@ -153,8 +153,8 @@ set(VERSION_MAJOR "2") -set(VERSION_MINOR "7") -set(VERSION_PATCH "1") +set(VERSION_MINOR "8") +set(VERSION_PATCH "0") set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SHARED_LIBRARY_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) diff -Nru freetype-2.7.1/=unpacked-tar3=/configure freetype-2.8/=unpacked-tar3=/configure --- freetype-2.7.1/=unpacked-tar3=/configure 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/configure 2017-05-03 21:24:38.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2002-2016 by +# Copyright 2002-2017 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -15,7 +15,7 @@ rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk -# respect GNUMAKE environment variable for backwards compatibility +# respect GNUMAKE environment variable for backward compatibility if test "x$GNUMAKE" = x; then if test "x$MAKE" = x; then if test "x`make -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then diff -Nru freetype-2.7.1/=unpacked-tar3=/devel/ft2build.h freetype-2.8/=unpacked-tar3=/devel/ft2build.h --- freetype-2.7.1/=unpacked-tar3=/devel/ft2build.h 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/devel/ft2build.h 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* FreeType 2 build and setup macros (development version). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff -Nru freetype-2.7.1/=unpacked-tar3=/devel/ftoption.h freetype-2.8/=unpacked-tar3=/devel/ftoption.h --- freetype-2.7.1/=unpacked-tar3=/devel/ftoption.h 2016-12-16 07:45:16.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/devel/ftoption.h 2017-03-30 10:20:23.000000000 +0000 @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2017 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -82,8 +82,8 @@ /* to control the various font drivers and modules. The controllable */ /* properties are listed in the section `Controlling FreeType Modules' */ /* in the reference's table of contents; currently there are properties */ - /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), and */ - /* TrueType (file `ftttdrv.h'). */ + /* for the auto-hinter (file `ftautoh.h'), CFF (file `ftcffdrv.h'), */ + /* TrueType (file `ftttdrv.h'), and PCF (file `ftpcfdrv.h'). */ /* */ /* `FREETYPE_PROPERTIES' has the following syntax form (broken here into */ /* multiple lines for better readability). */ @@ -835,6 +835,33 @@ /*************************************************************************/ /*************************************************************************/ /**** ****/ + /**** P C F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* There are many PCF fonts just called `Fixed' which look completely */ + /* different, and which have nothing to do with each other. When */ + /* selecting `Fixed' in KDE or Gnome one gets results that appear rather */ + /* random, the style changes often if one changes the size and one */ + /* cannot select some fonts at all. This option makes the PCF module */ + /* prepend the foundry name (plus a space) to the family name. */ + /* */ + /* We also check whether we have `wide' characters; all put together, we */ + /* get family names like `Sony Fixed' or `Misc Fixed Wide'. */ + /* */ + /* If this option is activated, it can be controlled with the */ + /* `no-long-family-names' property of the pcf driver module. */ + /* */ +#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ @@ -886,6 +913,7 @@ #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #define TT_USE_BYTECODE_INTERPRETER +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING #if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1 #define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY #endif @@ -894,6 +922,7 @@ #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif #endif +#endif /* diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/CHANGES freetype-2.8/=unpacked-tar3=/docs/CHANGES --- freetype-2.7.1/=unpacked-tar3=/docs/CHANGES 2016-12-27 07:09:26.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/CHANGES 2017-05-13 04:28:40.000000000 +0000 @@ -1,4 +1,111 @@ +CHANGES BETWEEN 2.7.1 and 2.8 + + I. IMPORTANT CHANGES + + - Support for OpenType Variation Fonts is now complete. The last + missing part was handling the `VVAR' and `MVAR' tables, which is + available with this release. + + - A new function `FT_Face_Properties' allows the control of some + module and library properties per font. Currently, the + following properties can be handled: stem darkening, LCD filter + weights, and the random seed for the `random' CFF operator. + + - The PCF change to show more `colourful' family names (introduced + in version 2.7.1) was too radical; it can now be configured with + PCF_CONFIG_OPTION_LONG_FAMILY_NAMES at compile time. If + activated, it can be switched off at run time with the new pcf + property `no-long-family-names'. If the `FREETYPE_PROPERTIES' + environment variable is available, you can say + + FREETYPE_PROPERTIES=pcf:no-long-family-names=1 + + - Support for the following scripts has been added to the + auto-hinter. + + Adlam, Avestan, Bamum, Buhid, Carian, Chakma, Coptic, Cypriot, + Deseret, Glagolitic, Gothic, Kayah, Lisu, N'Ko, Ol Chiki, Old + Turkic, Osage, Osmanya, Saurashtra, Shavian, Sundanese, Tai + Viet, Tifinagh, Unified Canadian Syllabics, Vai + + + II. IMPORTANT BUG FIXES + + - `Light' auto-hinting mode no longer uses TrueType metrics for + TrueType fonts. This bug was introduced in version 2.4.6, + causing horizontal scaling also. Almost all GNU/Linux + distributions (with Fedora as a notable exception) disabled the + corresponding patch for good reasons; chances are thus high that + you won't notice a difference. + + If optical backward compatibility for legacy applications is + necessary, you might enable the AF_CONFIG_OPTION_TT_SIZE_METRICS + configuration option. However, it is strongly recommended to + avoid that, adjusting font sizes instead. + + - If a TrueType font gets loaded with FT_LOAD_NO_HINTING, FreeType + now scales the font linearly again (bug introduced in version + 2.4.6). + + - CVE-2017-8105, CVE-2017-8287: Older FreeType versions have + out-of-bounds writes caused by heap-based buffer overflows + related to Type 1 fonts. + + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8105 + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8287 + + + III. MISCELLANEOUS + + - A new function `FT_Set_Default_Properties' has been added to + parse the `FREETYPE_PROPERTIES' environment variable + (previously, it was internal only). `FT_Init_FreeType' always + call this function, but `FT_New_Library' does not (similar to + `FT_Add_Default_Modules'). + + - To be in sync with OpenType version 1.7 and newer, macros + + FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, + FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY, + TT_NAME_ID_PREFERRED_FAMILY + TT_NAME_ID_PREFERRED_SUBFAMILY + + are renamed to + + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY, + FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY, + TT_NAME_ID_TYPOGRAPHIC_FAMILY + TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY + + The old macro names are deprecated (but still available). + + - Support for SFNT `name' tables has been improved. + + . Format 1 `name' tables are now supported. Use new function + `FT_Get_Sfnt_LangTag' to access associated language tags. + + . Language, encoding, and name IDs have been updated to OpenType + version 1.8.1. + + - The new CFF engine now handles the `random' operator. All CFF + opcodes are now supported. + + - The CFF module has a new property `random-seed' to control the + pseudo-random number generation for the `random' operator. + + - The `freetype-config' script is now a wrapper of `pkg-config' if + this program is available in the path. + + - FT_LOAD_TARGET_LCD is now a variant of FT_LOAD_TARGET_LIGHT; + this should provide better rendering results. + + - A mode to display light auto-hinting with sub-pixel positioning + has been added to `ftdiff'. + + +====================================================================== + CHANGES BETWEEN 2.7 and 2.7.1 I. IMPORTANT CHANGES @@ -18,6 +125,12 @@ - Handling of raw CID fonts was partially broken (bug introduced in 2.6.4). + - CVE-2016-10328: Older FreeType versions had an out-of-bounds + write caused by a heap-based buffer overflow related to the CFF + fonts. + + http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10328 + III. MISCELLANEOUS @@ -195,7 +308,7 @@ - Type 42 fonts as created by LilyPond are now supported. - - Minor rendering improvments in the auto-hinter. + - Minor rendering improvements in the auto-hinter. - For experimental reasons, the old CFF engine now supports all CFF operators except `random', including the deprecated Multiple @@ -240,7 +353,7 @@ to the user. The exception to this is `__FTERRORS_H__', which must be sometimes undefined by the user to get FreeType error strings: Both this form and the new `FTERRORS_H_' macro are - accepted for backwards compatibility. + accepted for backward compatibility. - Minor improvements mainly to the Type 1 driver. @@ -481,17 +594,17 @@ compiler warnings. - Function `FT_Bitmap_New' has been renamed to `FT_Bitmap_Init', - since this name better reflects its function. For backwards + since this name better reflects its function. For backward compatibility, the old function name is still available. - Function `FT_Get_X11_Font_Format' has been renamed to `FT_Get_Font_Format', since this name better reflects its - function. For backwards compatibility, the old function name is + function. For backward compatibility, the old function name is still available. Additionally, the header file macro for this function has been renamed to `FT_FONT_FORMATS_H' (the old name `FT_XFREE86_H' is - retained for backwards compatibility). + retained for backward compatibility). - Various improvements to the `ftgrid' demo program. @@ -925,7 +1038,7 @@ II. MISCELLANEOUS - The (top-level) `configure' script now respects the MAKE - environment variable to specify a `make' binary. For backwards + environment variable to specify a `make' binary. For backward compatibility, GNUMAKE still overrides MAKE, though. - The `ftview' and `ftdiff' demo programs have been redesigned, @@ -2144,7 +2257,7 @@ probably using a different pitch, and to further manipulate it. - A new API `FT_Outline_Embolden' (in FT_OUTLINE_H) gives finer - control how outlines are embolded. + control how outlines are emboldened. - `FT_GlyphSlot_Embolden' (in FT_SYNTHESIS_H) now handles bitmaps also (code contributed by Chia I Wu). Note that this function @@ -2263,7 +2376,7 @@ correctly treated as a CID, similar to FreeType's CID driver module. Note that CID CMap support is still missing. - - The FT_FACE_FLAGS_GLYPH_NAMES flag is now set correctly for all + - The FT_FACE_FLAG_GLYPH_NAMES flag is now set correctly for all font formats. - Some subsetted Type 1 fonts weren't parsed correctly. This bug @@ -2554,7 +2667,7 @@ - FT_ENCODING_MS_{SJIS,GB2312,BIG5,WANSUNG,JOHAB} are now deprecated in favour of - FT_ENCODING_{SJIS,GB2312,GIB5,WANSONG,JOHAB} -- those encodings + FT_ENCODING_{SJIS,GB2312,BIG5,WANSUNG,JOHAB} -- those encodings are not specific to Microsoft. @@ -4676,7 +4789,7 @@ ------------------------------------------------------------------------ -Copyright 2000-2016 by +Copyright 2000-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/css/freetype2.css freetype-2.8/=unpacked-tar3=/docs/css/freetype2.css --- freetype-2.7.1/=unpacked-tar3=/docs/css/freetype2.css 2016-12-30 20:46:10.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/css/freetype2.css 2017-05-13 10:52:11.000000000 +0000 @@ -5,9 +5,9 @@ /* use Droid fonts */ -@import url("http://fonts.googleapis.com/css?family=Droid+Serif:r,i,b,bi"); -@import url("http://fonts.googleapis.com/css?family=Droid+Sans:r,b"); -@import url("http://fonts.googleapis.com/css?family=Droid+Sans+Mono"); +@import url("https://fonts.googleapis.com/css?family=Droid+Serif:r,i,b,bi"); +@import url("https://fonts.googleapis.com/css?family=Droid+Sans:r,b"); +@import url("https://fonts.googleapis.com/css?family=Droid+Sans+Mono"); /* top-level appearance */ @@ -180,6 +180,7 @@ font-style: italic; } code { + white-space: nowrap; font-family: "Droid Sans Mono", "monospace"; } tt { diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/CUSTOMIZE freetype-2.8/=unpacked-tar3=/docs/CUSTOMIZE --- freetype-2.7.1/=unpacked-tar3=/docs/CUSTOMIZE 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/CUSTOMIZE 2017-03-30 10:20:23.000000000 +0000 @@ -139,7 +139,7 @@ ---------------------------------------------------------------------- -Copyright 2003-2016 by +Copyright 2003-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/DEBUG freetype-2.8/=unpacked-tar3=/docs/DEBUG --- freetype-2.7.1/=unpacked-tar3=/docs/DEBUG 2016-10-08 16:48:15.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/DEBUG 2017-03-30 10:20:23.000000000 +0000 @@ -6,7 +6,7 @@ There are several ways to enable debugging features in a FreeType 2 builds. This is controlled through the definition of special macros -located in the file `ftoptions.h'. The macros are: +located in the file `ftoption.h'. The macros are: FT_DEBUG_LEVEL_ERROR @@ -191,7 +191,7 @@ ------------------------------------------------------------------------ -Copyright 2002-2016 by +Copyright 2002-2017 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/design/design-4.html freetype-2.8/=unpacked-tar3=/docs/design/design-4.html --- freetype-2.7.1/=unpacked-tar3=/docs/design/design-4.html 2016-12-30 20:46:10.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/design/design-4.html 2017-05-13 10:52:11.000000000 +0000 @@ -287,7 +287,7 @@ FT_Remove_Module().

  • -

    Remember that face objects are owner by font drivers that are +

    Remember that face objects are owned by font drivers that are themselves modules owned by the library.

  • diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/design/design-5.html freetype-2.8/=unpacked-tar3=/docs/design/design-5.html --- freetype-2.7.1/=unpacked-tar3=/docs/design/design-5.html 2016-12-30 20:46:10.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/design/design-5.html 2017-05-13 10:52:11.000000000 +0000 @@ -238,8 +238,8 @@ created and added to the library. Note by the way that the module isn't returned directly by the call!

    -

    Here the definition of FT_Module_Class, with some - explanation. The following code is taken from +

    Here is the definition of FT_Module_Class, with some + explanations. The following code is taken from <freetype/ftmodule.h>:

    diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/documentation.html freetype-2.8/=unpacked-tar3=/docs/documentation.html
    --- freetype-2.7.1/=unpacked-tar3=/docs/documentation.html	2016-12-30 20:46:10.000000000 +0000
    +++ freetype-2.8/=unpacked-tar3=/docs/documentation.html	2017-05-13 10:52:11.000000000 +0000
    @@ -134,10 +134,10 @@
                  align="middle">
           

    -

    Flattr thisfont family and its multiple font faces, which - usually differ in style though come from the same + usually differ in style though coming from the same template.

    For example, ‘Palatino Regular’ and @@ -80,7 +80,7 @@ in ambiguous ways to refer to either a given family or given face, depending on the context. For example, most users of word-processors use ‘font’ to - describe a font family (e.g. ‘Courier’, + describe a font family (e.g., ‘Courier’, ‘Palatino’, etc.); however, most of these families are implemented through several data files depending on the file format: For TrueType, this is @@ -108,18 +108,18 @@ rather rare but can be seen in many Asian fonts, which contain images for two or more representation forms of a given scripts (usually for horizontal and vertical - layout.

    + layout).

    2. Character images and mappings

    The character images are called glyphs. A - single character can have several distinct images, - i.e. several glyphs, depending on script, usage or - context. Several characters can also take a single glyph - (good examples are Roman ligatures like ‘fi’ - and ‘fl’ which can be represented by a single + single character can have several distinct images, i.e., + several glyphs, depending on script, usage or context. + Several characters can also take a single glyph (good + examples are Roman ligatures like ‘fi’ and + ‘fl’ which can be represented by a single glyph). The relationship between characters and glyphs can be very complex but won't be discussed in this document. Moreover, some formats use more or less @@ -142,10 +142,10 @@ character maps (also called ‘charmaps’ or ‘cmaps’ for short), which are used to convert character codes for - a given encoding (e.g. ASCII, Unicode, DBCS, Big5, + a given encoding (e.g., ASCII, Unicode, Big5, ShiftJIS, etc.) into glyph indices relative to the font file. A single font face may contain several charmaps. For - example, many TrueType fonts contain an Apple-specific + example, many OpenType fonts contain an Apple-specific charmap as well as a Unicode charmap, which makes them usable on both Mac and Windows platforms.

    @@ -157,9 +157,10 @@

    Each glyph image is associated with various metrics which describe how to place and manage it when rendering text; see section III for more. - Metrics relate to glyph placement, cursor advances as well - as text layout. They are extremely important to compute - the flow of text when rendering a string of text.

    + Metrics relate to glyph placement, cursor advances, as + well as text layout. They are extremely important to + compute the flow of text when rendering a string of + text.

    Each scalable format also contains some global metrics, expressed in notional (i.e. font) units, to describe some @@ -175,7 +176,7 @@

    -

    Last update: 07-Dec-2014

    +

    Last update: 02-May-2017

    @@ -201,10 +202,10 @@ align="middle">

    -

    Flattr this -

    1. Pixels, points and device +

    1. Pixels, points, and device resolutions

    Though it is a very common assumption when dealing with computer graphics programs, the physical dimensions of a given pixel (be it for screens or printers) are not - squared. Often, the output device, be it a screen device - or a printer, exhibits varying resolutions in both - horizontal and vertical directions, and this must be taken - care of when rendering text.

    + squared. Often, the output device exhibits varying + resolutions in both horizontal and vertical directions, + and this must be taken care of when rendering text.

    It is thus common to define a device's characteristics through two numbers expressed in dpi (dots per @@ -96,7 +95,7 @@ from the size in points with the following formula:

    - pixel_size = point_size * resolution / 72 + pixel_size = point_size * resolution / 72

    The resolution is expressed in dpi. Since @@ -108,7 +107,7 @@ in pixels’ is not directly related to the real dimensions of characters when they are displayed or printed. The relationship between these two concepts is - a bit more complex and depend on some design choices + a bit more complex and depends on some design choices made by the font designer. This is described in more detail in the next sub-section (see the explanations on the EM square).

    @@ -129,8 +128,9 @@ Note that conic Béziers are usually called quadratic Béziers in the literature. Hence, FreeType associates each point of the outline with - flag to indicate its type (normal or control point). And - scaling the points will scale the whole outline.

    + flags to indicate its type (normal or control point). As + a consequence, scaling the points will scale the whole + outline.

    Each glyph's original outline points are located on a grid of indivisible units. The points are usually stored @@ -164,9 +164,14 @@ from grid units to pixels uses the formula:

    - pixel_size = point_size * resolution / 72
    - pixel_coord = grid_coord * pixel_size / EM_size + pixel_size = point_size * resolution / 72
    + pixel_coord = grid_coord * pixel_size / EM_size

    + +

    Another acronym used for the pixel size + is ppem (pixel per EM); this value can be + fractional also. Note that fractional ppem values are + not supported everywhere.

  • The greater the EM size is, the larger resolution the @@ -189,14 +194,14 @@

    Grid units are very often called font units or EM units.

    -

    As said before, pixel_size computed in the - above formula does not directly relate to the size of - characters on the screen. It simply is the size of the - EM square if it was to be displayed. Each font designer - is free to place its glyphs as it pleases him within the - square. This explains why the letters of the following - text have not the same height, even though they are - displayed at the same point size with distinct +

    As said before, pixel_size computed in + the above formula does not directly relate to the size + of characters on the screen. It simply is the size of + the EM square if it was to be displayed. Each font + designer is free to place its glyphs as it pleases him + within the square. This explains why the letters of the + following text have not the same height, even though + they are displayed at the same point size with distinct fonts:

    @@ -216,13 +221,14 @@

    3. Hinting and Bitmap rendering

    The outline as stored in a font file is called the - ‘master’ outline, as its points coordinates - are expressed in font units. Before it can be converted - into a bitmap, it must be scaled to a given size and + ‘master’ outline, as its point coordinates are + expressed in font units. Before it can be converted into + a bitmap, it must be scaled to a given size and resolution. This is done with a very simple - transformation, but always creates undesirable artifacts, - in particular stems of different widths or heights in - letters like ‘E’ or ‘H’.

    + transformation, but especially at small sizes undesirable + artifacts can appear, in particular stems of different + width or height in letters like ‘E’ or + ‘H’ can occur.

    As a consequence, proper glyph rendering needs the scaled points to be aligned along the target device pixel grid, @@ -231,9 +237,10 @@ ensure that important widths and heights are respected throughout the whole font (for example, it is very often desirable that the ‘I’ and the ‘T’ - have their central vertical line of the same pixel width), - as well as to manage features like stems and overshoots, - which can cause problems at small pixel sizes.

    + glyphs have their central vertical line of the same pixel + width), as well as to manage features like stems and + overshoots, which can cause problems at small pixel + sizes.

    There are several ways to perform grid-fitting properly; most scalable formats associate some control data or @@ -245,24 +252,25 @@

    explicit grid-fitting

    The TrueType format defines a stack-based virtual - machine, for which programs can be written with the - help of more than 200 opcodes (most of them - relating to geometrical operations). Each glyph is - thus made of both an outline and a control program to - perform the actual grid-fitting in the way defined by - the font designer.

    + machine, for which programs (also + called bytecode) can be written with the help + of more than 200 operators, most of them related + to geometrical operations. Each glyph is thus made of + both an outline and a control program to perform the + actual grid-fitting in the way defined by the font + designer.

  • implicit grid-fitting (also called hinting)

    -

    The Type 1 and CFF formats take a much simpler - approach: Each glyph is made of an outline as well as - several pieces called hints which are used to - describe some important features of the glyph, like - the presence of stems, some width regularities, and - the like. There aren't a lot of hint types, and it is - up to the final renderer to interpret the hints in - order to produce a fitted outline.

    +

    The Type 1, CFF, and CFF2 formats take a much + simpler approach: Each glyph is made of an outline as + well as several pieces called hints which are + used to describe some important features of the glyph, + like the presence of stems, some width regularities, + and the like. There aren't a lot of hint types, and + it is up to the final renderer to interpret the hints + in order to produce a fitted outline.

  • automatic grid-fitting

    @@ -376,7 +384,7 @@
    -

    Last update: 07-Dec-2014

    +

    Last update: 02-May-2017

    @@ -402,10 +410,10 @@ align="middle">

    -

    Flattr thisThe baseline is an imaginary line that is used to ‘guide’ glyphs when rendering text. It can be - horizontal (e.g. Latin, Cyrillic, Arabic, etc.) or - vertical (e.g. Chinese, Japanese, Mongolian, etc.). - Moreover, to render text, a virtual point, located on the - baseline, called the pen position - or origin, is used to locate glyphs.

    + horizontal (e.g., Latin, Cyrillic, Arabic) or vertical + (e.g., Chinese, Japanese, Mongolian). Moreover, to render + text, a virtual point, located on the baseline, called + the pen position or origin, is used to + locate glyphs.

    Each layout uses a different convention for glyph placement:

    @@ -142,7 +142,7 @@ computed as

    - linespace = ascent - descent + linegap + linespace = ascent - descent + linegap

    if you use the typographic values.

    @@ -158,12 +158,12 @@

    This is an imaginary box that encloses all glyphs from the font, usually as tightly as possible. It is represented by four parameters, - namely xMin, yMin, xMax, - and yMax, that can be computed for any - outline. Their values can be in font units if - measured in the original outline, or in integer (or - fractional) pixel units when measured on scaled - outlines.

    + namely xMin, yMin, + xMax, and yMax, that can be + computed for any outline. Their values can be in font + units if measured in the original outline, or in + integer (or fractional) pixel units when measured on + scaled outlines.

    A common shorthand for the bounding box is ‘bbox’.

    @@ -178,7 +178,7 @@ It usually can be computed as

    - internal leading = ascent - descent - EM_size + internal leading = ascent - descent - EM_size

  • @@ -206,7 +206,7 @@ vertical ones.

    In the FreeType API, this is also called - bearingX. Another shorthand is + bearingX. Another shorthand is ‘lsb’.

  • @@ -218,7 +218,7 @@ ones.

    In the FreeType API, this is also called - bearingY.

    + bearingY.

  • Advance width

    @@ -231,7 +231,7 @@ ones.

    In the FreeType API, this is also called - advanceX.

    + advanceX.

  • Advance height

    @@ -242,7 +242,7 @@ layouts.

    In the FreeType API, this is also called - advanceY.

    + advanceY.

  • Glyph width

    @@ -251,7 +251,7 @@ coordinates, it is

    - glyph width = bbox.xMax - bbox.xMin + glyph width = bbox.xMax - bbox.xMin

    For scaled glyphs, its computation requests specific @@ -264,7 +264,7 @@ coordinates, it is

    - glyph height = bbox.yMax - bbox.yMin + glyph height = bbox.yMax - bbox.yMin

    For scaled glyphs, its computation requests specific @@ -372,12 +372,22 @@ hinted outlines, one should always take care of exclusively using integer pixel distances (which means that the parameters to the - FT_Outline_Translate API function should all be - multiples of 64, as the point coordinates are in + FT_Outline_Translate API function should all + be multiples of 64, as the point coordinates are in 26.6 fixed-point format). Otherwise, the translation will simply ruin the hinter's work, resulting in very low quality bitmaps!

    +

    Note, however, that the restriction to integer pixel + distances mentioned in the previous paragraph has become + weaker; today, it is quite common to do no + hinting along the horizontal axis, only adjusting the + glyphs vertically. Typical examples are Microsoft's + ClearType implementation, FreeType's new CFF engine + (contributed by Adobe), or the ‘light’ + auto-hinting mode. For such modes you get best rendering + results if you do sub-pixel glyph positioning.

    +

    5. Text widths and bounding box

    @@ -392,10 +402,10 @@

    Likewise, the glyph's ‘advance width’ is the increment to apply to the pen position during layout, and is not related to the glyph's ‘width’, which - really is the glyph's bounding width.

    + really is the glyph's bounding box width.

    -

    The same conventions apply to strings of text. This - means that:

    +

    The same conventions apply to strings of text, with the + following consequences.

  • Applying kerning when rendering text is a rather easy - process. It merely consists in adding the scaled kern + process. It merely consists of adding the scaled kern distance to the pen position before rendering the next glyph. However, the typographically correct renderer must take a few more details in consideration.

    @@ -188,7 +188,7 @@
    -

    Last update: 07-Dec-2014

    +

    Last update: 02-May-2017

    @@ -214,10 +214,10 @@ align="middle">

    -

    Flattr this1. Writing simple text strings

    In this first example, we will generate a simple string - of text in the Latin script, i.e. with a horizontal + of text in the Latin script, i.e., with a horizontal left-to-right layout. Using exclusively pixel metrics, the process looks like: @@ -114,13 +114,13 @@

    Note that kerning isn't part of this algorithm.

    -

    2. Pseudo-subpixel positioning

    +

    2. Subpixel positioning

    -

    It is somewhat useful to use subpixel positioning when - rendering text. This is crucial, for example, to provide - semi-WYSIWYG text layouts. Text rendering is very similar - to the algorithm described in subsection 1, with the - following few differences:

    +

    This algorithm can be used for hinting modes that don't + apply horizontal hinting. It essentially provides WYSIWYG + text layout. Text rendering is very similar to the + algorithm described in subsection 1, with the + following few differences:

  • -

    return pixel dimensions, i.e.

    +

    return pixel dimensions, i.e.,

     width = (xmax - xmin)/64
    @@ -441,7 +440,7 @@
    -

    Last update: 07-Dec-2014

    +

    Last update: 02-May-2017

    @@ -467,10 +466,10 @@ align="middle">

    -

    Flattr this -

    2. The FT_Bitmap descriptor

    +

    2. The FT_Bitmap descriptor

    In FreeType, a bitmap or pixmap is described through a - single structure, - called FT_Bitmap. + single structure + called FT_Bitmap. The fields we are interested in are:

    - FT_Bitmap + FT_Bitmap
    - rows + rows - the number of rows, i.e. lines, in the bitmap + the number of rows, i.e., lines, in the bitmap
    - width + width the number of horizontal pixels in the bitmap @@ -136,7 +136,7 @@
    - pitch + pitch its absolute value is the number of bytes per bitmap @@ -146,7 +146,7 @@
    - buffer + buffer a typeless pointer to the bitmap pixel buffer @@ -154,19 +154,20 @@
    - pixel_mode + pixel_mode an enumeration used to describe the pixel format of - the bitmap; examples are ft_pixel_mode_mono - for 1-bit monochrome bitmaps - and ft_pixel_mode_grays for 8-bit + the bitmap; examples + are ft_pixel_mode_mono for 1-bit + monochrome bitmaps + and ft_pixel_mode_grays for 8-bit anti-aliased ‘gray’ values
    - num_grays + num_grays this is only used for ‘gray’ pixel modes, @@ -177,9 +178,9 @@
    -

    Note that the sign of the pitch field determines - whether the rows in the pixel buffer are stored in - ascending or descending order.

    +

    Note that the sign of the pitch field + determines whether the rows in the pixel buffer are stored + in ascending or descending order.

    Remember that FreeType uses the Y upwards convention in the 2D plane, which means that a coordinate @@ -218,6 +219,13 @@

    The ‘positive pitch’ convention is very often used, though some systems might need the other.

    +

    To speed up memory access, pitch is in most + cases a multiple of 16bit, 32bit, or even 64bit. It often + happens that the pitch is thus larger than the necessary + bits (or bytes) for a bitmap or pixmap row; in such cases, + unused bits (or bytes) are at the very right (i.e., the + end) of a row.

    +

    3. Converting outlines into bitmaps and pixmaps

    @@ -289,16 +297,15 @@ the target window.

    For example, the correct way of creating - a standalone glyph bitmap is as follows:

    + a stand-alone glyph bitmap is as follows:

    • -

      Compute the size of the glyph bitmap. It can be - computed directly from the glyph metrics, or by - computing its bounding box (this is useful when a - transformation has been applied to the outline after - loading it, as the glyph metrics are not valid - anymore).

      +

      Get the size of the glyph bitmap. It can be computed + directly from the glyph metrics, or by computing its + bounding box (this is useful when a transformation has + been applied to the outline after loading it, as the + glyph metrics are not valid anymore).

    • Create the bitmap with the computed dimensions. @@ -317,7 +324,7 @@

    • Call the rendering function (it can be - FT_Outline_Render, + FT_Outline_Render, for example).

    @@ -331,7 +338,7 @@
    -

    Last update: 07-Dec-2014

    +

    Last update: 02-May-2017

    @@ -357,10 +364,10 @@ align="middle">

    -

    Flattr this

    -

    Flattr this

    -

    Flattr this -FreeType-2.7.1 API Reference +FreeType-2.8 API Reference + + + + +

    FreeType-2.8 API Reference

    + +

    The PCF driver

    +

    Synopsis

    + + +
    no-long-family-names
    + + +

    While FreeType's PCF driver doesn't expose API functions by itself, it is possible to control its behaviour with FT_Property_Set and FT_Property_Get. Right now, there is a single property ‘no-long-family-names’ available if FreeType is compiled with PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.

    +

    The PCF driver's module name is ‘pcf’.

    + +
    +

    no-long-family-names

    +

    Defined in FT_PCF_DRIVER_H (freetype/ftpcfdrv.h).

    +
    +FT_END_HEADER
    +
    +
    +#endif /* FTPCFDRV_H_ */
    +
    +
    +/* END */
    +
    + +

    If PCF_CONFIG_OPTION_LONG_FAMILY_NAMES is active while compiling FreeType, the PCF driver constructs long family names.

    +

    There are many PCF fonts just called ‘Fixed’ which look completely different, and which have nothing to do with each other. When selecting ‘Fixed’ in KDE or Gnome one gets results that appear rather random, the style changes often if one changes the size and one cannot select some fonts at all. The improve this situation, the PCF module prepends the foundry name (plus a space) to the family name. It also checks whether there are ‘wide’ characters; all put together, family names like ‘Sony Fixed’ or ‘Misc Fixed Wide’ are constructed.

    +

    If ‘no-long-family-names’ is set, this feature gets switched off.

    +
    +  FT_Library  library;
    +  FT_Bool     no_long_family_names = TRUE;
    +
    +
    +  FT_Init_FreeType( &library );
    +
    +  FT_Property_Set( library, "pcf",
    +                            "no-long-family-names",
    +                            &no_long_family_names );
    +
    + +

    note

    +

    This property can be used with FT_Property_Get also.

    +

    This property can be set via the ‘FREETYPE_PROPERTIES’ environment variable (using values 1 and 0 for ‘on’ and ‘off’, respectively).

    + +
    +
    + + + diff -Nru freetype-2.7.1/=unpacked-tar3=/docs/reference/ft2-pfr_fonts.html freetype-2.8/=unpacked-tar3=/docs/reference/ft2-pfr_fonts.html --- freetype-2.7.1/=unpacked-tar3=/docs/reference/ft2-pfr_fonts.html 2016-12-30 20:17:19.000000000 +0000 +++ freetype-2.8/=unpacked-tar3=/docs/reference/ft2-pfr_fonts.html 2017-05-13 10:45:59.000000000 +0000 @@ -3,7 +3,7 @@ -FreeType-2.7.1 API Reference +FreeType-2.8 API Reference