diff --git a/ChangeLog b/ChangeLog index 8dba82535..38493fb3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2007-06-26 Rahul Bhalerao + + Add autofit module for Indic scripts. This currently just reuses + the CJK-specific functions. + + * include/freetype/config/ftoption.h (AF_CONFIG_OPTION_INDIC): New + macro. + * devel/ftoption.h: Synchronize with + include/freetype/config/ftoption.h. + + * src/autofit/afindic.c, src/autofit/afindic.h: New files. + + * src/autofit/afglobal.c, src/autofit/aftypes.h, + src/autofit/autofit.c: Updated. + + * src/autofit/Jamfile (_sources), * src/autofit/rules.mk + (AUTOF_DRV_SRC): Updated. + 2007-06-23 David Turner * src/truetype/ttgload.c (TT_Load_Simple): Fix change from diff --git a/devel/ftoption.h b/devel/ftoption.h index 0add36a77..6cf1af236 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -302,7 +302,9 @@ FT_BEGIN_HEADER /* The size in bytes of the render pool used by the scan-line converter */ /* to do all of its work. */ /* */ - /* This must be greater than 4KByte. */ + /* This must be greater than 4KByte if you use FreeType to rasterize */ + /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ + /* allocation of the render pool. */ /* */ #define FT_RENDER_POOL_SIZE 16384L @@ -461,12 +463,47 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */ - /* work-around hinting system. Note that for the moment, the algorithm */ - /* is only used when selected at runtime through the parameter tag */ - /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */ - /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */ + /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ + /* of the TrueType bytecode interpreter is used that doesn't implement */ + /* any of the patented opcodes and algorithms. Note that the */ + /* the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you */ + /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words, */ + /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ + /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ + /* */ + /* This macro is only useful for a small number of font files (mostly */ + /* for Asian scripts) that require bytecode interpretation to properly */ + /* load glyphs. For all other fonts, this produces unpleasant results, */ + /* thus the unpatented interpreter is never used to load glyphs from */ + /* TrueType fonts unless one of the following two options is used. */ + /* */ + /* - The unpatented interpreter is explicitly activated by the user */ + /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ + /* when opening the FT_Face. */ + /* */ + /* - FreeType detects that the FT_Face corresponds to one of the */ + /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ + /* contains a hard-coded list of font names and other matching */ + /* parameters (see function `tt_face_init' in file */ + /* `src/truetype/ttobjs.c'). */ + /* */ + /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ + /* */ + /* { */ + /* FT_Parameter parameter; */ + /* FT_Open_Args open_args; */ + /* */ + /* */ + /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ + /* */ + /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ + /* open_args.pathname = my_font_pathname; */ + /* open_args.num_params = 1; */ + /* open_args.params = ¶meter; */ + /* */ + /* error = FT_Open_Face( library, &open_args, index, &face ); */ + /* ... */ + /* } */ /* */ /* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ @@ -592,6 +629,12 @@ FT_BEGIN_HEADER #define AF_CONFIG_OPTION_CJK + /*************************************************************************/ + /* */ + /* Compile autofit module with Indic script support. */ + /* */ +#define AF_CONFIG_OPTION_INDIC + /* */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 9d1a743f4..532848da7 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -628,6 +628,11 @@ FT_BEGIN_HEADER /* */ #define AF_CONFIG_OPTION_CJK + /*************************************************************************/ + /* */ + /* Compile autofit module with Indic script support. */ + /* */ +#define AF_CONFIG_OPTION_INDIC /* */ diff --git a/src/autofit/Jamfile b/src/autofit/Jamfile index 550f3d1ae..acee8bf2c 100644 --- a/src/autofit/Jamfile +++ b/src/autofit/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/autofit Jamfile # -# Copyright 2003, 2004, 2005, 2006 by +# Copyright 2003, 2004, 2005, 2006, 2007 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -21,7 +21,7 @@ SubDir FT2_TOP src autofit ; } if $(FT2_MULTI) { - _sources = afangles afglobal afhints aflatin afloader afmodule afdummy afwarp ; + _sources = afangles afglobal afhints aflatin afcjk afindic afloader afmodule afdummy afwarp ; if $(FT2_AUTOFIT2) { diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index a272d5023..ad3baa163 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -20,6 +20,8 @@ #include "afdummy.h" #include "aflatin.h" #include "afcjk.h" +#include "afindic.h" + #include "aferrors.h" #ifdef FT_OPTION_AUTOFIT2 @@ -35,7 +37,7 @@ #endif &af_latin_script_class, &af_cjk_script_class, - + &af_indic_script_class, NULL /* do not remove */ }; diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c new file mode 100644 index 000000000..c6e7522e1 --- /dev/null +++ b/src/autofit/afindic.c @@ -0,0 +1,134 @@ +/***************************************************************************/ +/* */ +/* afindic.c */ +/* */ +/* Auto-fitter hinting routines for Indic scripts (body). */ +/* */ +/* Copyright 2007 by */ +/* Rahul Bhalerao , . */ +/* */ +/* 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 "aftypes.h" +#include "aflatin.h" + + +#ifdef AF_CONFIG_OPTION_INDIC + +#include "afindic.h" +#include "aferrors.h" +#include "afcjk.h" + + +#ifdef AF_USE_WARPER +#include "afwarp.h" +#endif + + + static FT_Error + af_indic_metrics_init( AF_LatinMetrics metrics, + FT_Face face ) + { + /* use CJK routines */ + return af_cjk_metrics_init( metrics, face ); + } + + + static void + af_indic_metrics_scale( AF_LatinMetrics metrics, + AF_Scaler scaler ) + { + /* use CJK routines */ + af_cjk_metrics_scale( metrics, scaler ); + } + + + static FT_Error + af_indic_hints_init( AF_GlyphHints hints, + AF_LatinMetrics metrics ) + { + /* use CJK routines */ + return af_cjk_hints_init( hints, metrics ); + } + + + static FT_Error + af_indic_hints_apply( AF_GlyphHints hints, + FT_Outline* outline, + AF_LatinMetrics metrics) + { + /* use CJK routines */ + return af_cjk_hints_apply( hints, outline, metrics ); + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** I N D I C S C R I P T C L A S S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + static const AF_Script_UniRangeRec af_indic_uniranges[] = + { +#if 0 + { 0x0100, 0xFFFF }, /* why this? */ +#endif + { 0x0900, 0x0DFF}, /* Indic Range */ + { 0, 0 } + }; + + + FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec + af_indic_script_class = + { + AF_SCRIPT_INDIC, + af_indic_uniranges, + + sizeof( AF_LatinMetricsRec ), + + (AF_Script_InitMetricsFunc) af_indic_metrics_init, + (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale, + (AF_Script_DoneMetricsFunc) NULL, + + (AF_Script_InitHintsFunc) af_indic_hints_init, + (AF_Script_ApplyHintsFunc) af_indic_hints_apply + }; + +#else /* !AF_CONFIG_OPTION_INDIC */ + + static const AF_Script_UniRangeRec af_indic_uniranges[] = + { + { 0, 0 } + }; + + + FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec + af_indic_script_class = + { + AF_SCRIPT_INDIC, + af_indic_uniranges, + + sizeof( AF_LatinMetricsRec ), + + (AF_Script_InitMetricsFunc) NULL, + (AF_Script_ScaleMetricsFunc)NULL, + (AF_Script_DoneMetricsFunc) NULL, + + (AF_Script_InitHintsFunc) NULL, + (AF_Script_ApplyHintsFunc) NULL + }; + +#endif /* !AF_CONFIG_OPTION_INDIC */ + + +/* END */ diff --git a/src/autofit/afindic.h b/src/autofit/afindic.h new file mode 100644 index 000000000..b242b2614 --- /dev/null +++ b/src/autofit/afindic.h @@ -0,0 +1,41 @@ +/***************************************************************************/ +/* */ +/* afindic.h */ +/* */ +/* Auto-fitter hinting routines for Indic scripts (specification). */ +/* */ +/* Copyright 2007 by */ +/* Rahul Bhalerao , . */ +/* */ +/* 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 __AFINDIC_H__ +#define __AFINDIC_H__ + +#include "afhints.h" + + +FT_BEGIN_HEADER + + + /* the Indic-specific script class */ + + FT_CALLBACK_TABLE const AF_ScriptClassRec + af_indic_script_class; + + +/* */ + +FT_END_HEADER + +#endif /* __AFINDIC_H__ */ + + +/* END */ diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h index c7358927f..bd3fa8823 100644 --- a/src/autofit/aftypes.h +++ b/src/autofit/aftypes.h @@ -265,9 +265,11 @@ extern void* _af_debug_hints; AF_SCRIPT_NONE = 0, AF_SCRIPT_LATIN = 1, AF_SCRIPT_CJK = 2, + AF_SCRIPT_INDIC = 3, #ifdef FT_OPTION_AUTOFIT2 AF_SCRIPT_LATIN2, #endif + /* add new scripts here. Don't forget to update the list in */ /* `afglobal.c'. */ diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c index 5884ab048..2fe66a990 100644 --- a/src/autofit/autofit.c +++ b/src/autofit/autofit.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,12 +21,15 @@ #include "afangles.c" #include "afglobal.c" #include "afhints.c" + #include "afdummy.c" #include "aflatin.c" #ifdef FT_OPTION_AUTOFIT2 #include "aflatin2.c" #endif #include "afcjk.c" +#include "afindic.c" + #include "afloader.c" #include "afmodule.c" diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk index 8d6f668f5..017489d9e 100644 --- a/src/autofit/rules.mk +++ b/src/autofit/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 2003, 2004, 2005, 2006 by +# Copyright 2003, 2004, 2005, 2006, 2007 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -26,11 +26,12 @@ AUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) # AUTOF driver sources (i.e., C files) # AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ + $(AUTOF_DIR)/afcjk.c \ $(AUTOF_DIR)/afdummy.c \ $(AUTOF_DIR)/afglobal.c \ $(AUTOF_DIR)/afhints.c \ + $(AUTOF_DIR)/afindic.c \ $(AUTOF_DIR)/aflatin.c \ - $(AUTOF_DIR)/afcjk.c \ $(AUTOF_DIR)/afloader.c \ $(AUTOF_DIR)/afmodule.c \ $(AUTOF_DIR)/afwarp.c