Commit Graph

109 Commits

Author SHA1 Message Date
Werner Lemberg 6af01a04b1 [autofit] Use `global' HarfBuzz font object.
We now use `hb_font' instead of `hb_face' since yet-to-come changes
need this.

* src/autofit/afglobal.h: Include `hbshim.h'.
(AF_FaceGlobalsRec) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New member
`hb_font'.

* src/autofit/afglobal.c (af_face_globals_new)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Create `hb_font'.
(af_face_globals_free) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Destroy
`hb_font'.

* src/autofit/hbshim.h: Include HarfBuzz headers.

* src/autofit/hbshim.c: Include `hbshim.h' instead of HarfBuzz
headers.
(af_get_coverage): Updated.
2013-12-28 08:55:24 +01:00
Werner Lemberg d32a7d32e4 [autofit] Handle `DFLT' OpenType script for coverages.
* include/ftautoh.h: Document new `default-script' property.

* src/autofit/hbshim.c (af_get_coverage): Use `AF_FaceGlobals' for
type of first parameter.
(script_tags): Add one more element.
(af_get_coverage): Adjust `script_tags' to handle `DFLT' script tag.

* src/autofit/hbshim.h: Updated.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Updated.

* src/autofit/afglobal.h (AF_SCRIPT_DEFAULT): New macro.

* src/autofit/afmodule.h (AF_ModuleRec): New `default_script'
member.

* src/autofit/afmodule.c (af_property_set, af_property_get): Handle
`default-script' property.
(af_autofitter_init): Updated.
2013-12-27 19:26:04 +01:00
Werner Lemberg c7b55a3473 Split off ChangeLog.24. 2013-12-23 16:42:03 +01:00
Werner Lemberg 1924134710 Introduce `coverages'.
Coverages are the interface to the HarfBuzz library to access
OpenType features for handling glyphs not addressable by the cmap.

Right now, compilation of HarfBuzz is only added to the development
build.  A solution for standard build mode will be delayed until
HarfBuzz gets split into two libraries to avoid mutual dependencies
between FreeType and HarfBuzz.

Note that this is only a first step in handling coverages, basically
providing the framework only.  Code for handling selected OpenType
features (this is, actually using the data in `afcover.h') will
follow.

* devel/ftoption.h, include/config/ftoption.h
(FT_CONFIG_OPTION_USE_HARFBUZZ): New macro.

* src/autofit/hbshim.c, src/autofit/hbshim.h, src/autofit/afcover.h:
New files.

* src/autofit/afscript.h: Add HarfBuzz script name tags.

* src/autofit/afstyles.h: Add default coverage enumeration values.

* src/autofit/aftypes.h: Update use of `SCRIPT' and `STYLE' macros.
(AF_Coverage): New enumeration (generated by `afcover.h').
(AF_StyleClassRec): New member `coverage'.
(AF_DEFINE_STYLE_CLASS): Updated.

* include/internal/fttrace.h: Add `afharfbuzz' for tracing coverage
data.

* src/autofit/afglobal.h: Update use of `SCRIPT' and `STYLE' macros.
(AF_SCRIPT_FALLBACK): Renamed to ...
(AF_STYLE_FALLBACK): ... this.

* src/autofit/afglobal.c: Include `hbshim.c'.
Update use of `SCRIPT' and `STYLE' macros.
(af_face_globals_compute_style_coverage)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Call `af_get_coverage'.
Update.

* src/autofit/afmodule.h (AF_ModuleRec):
s/fallback_script/fallback_style/.

* src/autofit/afmodule.c (af_property_set): Adapt handling of
`fallback-script' property to set a fallback style.
(af_property_get, af_autofitter_init): Updated.

* src/autofit/afpic.c: Update use of `SCRIPT' and `STYLE' macros.

* src/autofit/afranges.h: Update use of `SCRIPT' macro.

* src/autofit/autofit.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: Include
`hbshim.c'.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `hbshim.c'.
(AUTOF_DRV_H): Add `afcover.h'.

* builds/freetype.mk (INCLUDE_FLAGS) [DEVEL_DIR]: Use pkg-config for
all libraries needed by FreeType.
2013-12-21 21:39:04 +01:00
Werner Lemberg 8a8f3758f1 [autofit] Fix PIC compilation.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths)
[FT_CONFIG_OPTION_PIC]: Declare `globals'.

* src/autofit/afglobal.c: Always call AF_DEFINE_SCRIPT_CLASS, and
AF_DEFINE_STYLE_CLASS.

* src/autofit/afpic.c: Include `afglobal.h'.
(autofit_module_class_pic_init): Typo.

* src/autofit/aftypes.h (AF_DEFINE_SCRIPT_CLASS,
AF_DEFINE_STYLE_CLASS): Don't use the same identifier for macro
parameter and structure member.
2013-12-20 18:35:35 +01:00
Werner Lemberg 974b193bcc [autofit] Introduce `styles'.
This is the new top-level structure for handling glyph input data;
scripts are now defined separately.

* src/autofit/aftypes.h (SCRIPT): Updated.
(AF_ScriptClassRec): Move `blue_stringset' and `writing_system'
members to ...
(AF_Style_ClassRec): ... this new structure.
(AF_Style): New enumeration.
(AF_StyleMetricsRec): Replace `script' enumeration with
`style_class' pointer.
(AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated.
(AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros.

* src/autofit/afstyles.h: New file, using data from `afscript.h'.
* src/autofit/afscript.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated.

* src/autofit/afglobal.c (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with...
(af_style_names): ... this array.
(af_face_globals_compute_script_coverage): Renamed to...
(af_face_globals_compute_style_coverage): ... this.
Updated.
(af_face_globals_new, af_face_globals_free,
af_face_globals_get_metrics): Updated.

* src/autofit/afglobal.h (SCRIPT): Updated.
(STYLE): Redefine macro to load `afstyles.h'.
(AF_SCRIPT_FALLBACK): Update definition.  This will get more
refinements with later on.
(AF_SCRIPT_UNASSIGNED): Replace with...
(AF_STYLE_UNASSIGNED): ... this macro.
(AF_FaceGlobalsRec): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_scale_dim,
af_latin_hint_edges): Updated.

* src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated.
(af_ltn2_uniranges): Removed.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
* src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro.
(AFModulePIC): Add `af_style_classes' and `af_style_classes_rec'
members.

* src/autofit/afranges.h: Updated.

* src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'.
2013-12-20 17:26:26 +01:00
Werner Lemberg d8324571f1 [autofit] Factor scripts and uniranges out of writing system files.
* src/autofit/afranges.c, src/autofit/afranges.h: New files.

* src/autofit/afscript.h: Extend `SCRIPT' macro with more
parameters, taking data from the writing system files.

* src/autofit/aftypes.h: Updated.

* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DEFINE_SCRIPT_CLASS.
* src/autofit/afglobal.c: Include `afranges.h'.
Load `afscript.h' to call AF_DECLARE_SCRIPT_CLASS.

* src/autofit/afcjk.c, src/autofit/afcjk.h: Updated.
* src/autofit/afdummy.c, src/autofit/afdummy.h: Updated.
* src/autofit/afindic.c, src/autofit/afindic.h: Updated.
* src/autofit/aflatin.c, src/autofit/aflatin.h: Updated.
* src/autofit/aflatn2.c, src/autofit/aflatn2.h: Updated.

* src/autofit/afpic.c: Updated.

* src/autofir/autofit.c: Include `afranges.c'.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afranges.c'.
2013-12-19 15:45:24 +01:00
Werner Lemberg 73f3198101 [autofit] More code orthogonality.
* src/autofit/aftypes.h (AF_StyleMetrics): Replace `script_class'
pointer to an `AF_ScriptClass' structure with `script' index of type
`AF_Script'.
Move some code around.

* src/autofit/afcjk.c: Include `afpic.h'.
(af_cjk_metrics_init_widths, af_cjk_metrics_init_blues,
af_cjk_hint_edges): Updated.

* src/autofit/aflatin.c: Include `afpic.h'.
(af_latin_metrics_init_widths, af_latin_metrics_init_blues,
af_latin_metrics_scale_dim, af_latin_hint_edges): Updated.

* src/autofit/afglobal.c (af_face_globals_get_metrics): Updated.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.
2013-12-19 15:24:17 +01:00
Werner Lemberg 3f91cb338b [autofit] s/ScriptMetrics/StyleMetrics/. 2013-12-18 12:59:35 +01:00
Werner Lemberg 4fccc214f9 [autofit] s/script_{metrics,hints}/style_{metrics,hints}/ 2013-12-18 12:53:01 +01:00
Werner Lemberg f4df4079fb [autofit] s/gscripts/gstyles/. 2013-12-18 10:39:30 +01:00
Werner Lemberg 9a35455045 [autofit] s/glyph_scripts/glyph_styles/.
This is the first commit of a series to create a new top-level
structure (a `style') for handling scripts, writing_systems, and
soon-to-be-added coverages.
2013-12-18 10:36:06 +01:00
Werner Lemberg 9193259cf2 [autofit] s/DFLT/NONE/, s/dflt/none/. 2013-12-10 13:24:07 +01:00
Werner Lemberg 45244f8043 [autofit] s/AF_SCRIPT_NONE/AF_SCRIPT_UNASSIGNED/. 2013-12-10 13:18:11 +01:00
Werner Lemberg a5f22a9ed2 [autofit] Add description strings to script entries.
Currently, this is unused.

* src/autofit/afscript.h: Do it.
* src/autofit/afglobal.c, src/autofit/afpic.c,
src/autofit/aftypes.h: Updated.
2013-10-17 11:08:25 +02:00
Werner Lemberg 4f9760e752 [autofit] Remove outdated comment. 2013-09-25 23:32:25 +02:00
Werner Lemberg e0f39aefde [autofit] Fix C++ compilation.
* src/autofit/afglobal.c (af_face_globals_get_metrics),
src/autofit/afdummy.c (af_dflt_script_class), src/autofit/afindic.c
(af_deva_script_class): Use proper casts.
2013-08-28 17:34:01 +02:00
Werner Lemberg 5e53db25ff [autofit] While tracing, report script names instead of ID values.
* src/autofit/afglobal.c (af_script_names) [FT_DEBUG_LEVEL_TRACE]:
New array.
* src/autofit/afglobal.h: Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_hint_edges): Use `af_script_names'.
* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_hint_edges): Ditto.
2013-08-27 18:37:39 +02:00
Werner Lemberg 33655a9647 [autofit] Fix script selection.
* src/autofit/afglobal.c (af_face_globals_get_metrics): Use
`AF_SCRIPT_DFLT', not value 0.
Simplify code.

* src/autofit/afscript.h: Sort by script name.
2013-08-26 09:58:50 +02:00
Werner Lemberg 6d3c10e055 Typo. 2013-08-02 20:47:15 +02:00
Werner Lemberg 456cc440ca [autofit] Move declaration of scripts into separate file.
This has the benefit that we don't need to duplicate the data at
different places.

* src/autofit/afscript.h: New file.

* src/autofit/aftypes.h (AF_Script): Include `afscript.h' to define
the enumeration values.

* src/autofit/afglobal.c: Include `afscript.h' to get the script
specific header files.
(af_script_classes): Include `afscript.h' to fill this array.

* src/autofit/afpic.c: Include `afscript.h' to get the script
specific header files.
(autofit_module_class_pic_init): Include `afscript.h' for
initialization.
* src/autofit/afpic.h (AF_SCRIPT_CLASSES_COUNT,
AF_SCRIPT_CLASSES_REC_COUNT): Removed.  Use `AF_SCRIPT_MAX' instead.

* src/autofit/rules.mk (AUTOF_DRV_H): Updated.
2013-08-02 20:25:21 +02:00
Werner Lemberg 773601da12 [autofit] Move declaration of writing systems into separate file.
This has the benefit that we don't need to duplicate the data at
different places.

* src/autofit/afwrtsys.h: New file.

* src/autofit/aftypes.h (AF_WritingSystem): Include `afwrtsys.h' to
define the enumeration values.

* src/autofit/afglobal.c: Include `afwrtsys.h' to get the writing
system specific header files.
Include `afpic.h'.
(af_writing_system_classes): Include `afwrtsys.h' to fill this
array.

* src/autofit/afpic.c: Include `afwrtsys.h' to get the writing
system specific header files.
(autofit_module_class_pic_init): Include `afwrtsys.h' for
initialization.
* src/autofit/afpic.h (AF_WRITING_SYSTEM_CLASSES_COUNT,
AF_WRITING_SYSTEM_CLASSES_REC_COUNT): Removed.  Use
`AF_WRITING_SYSTEM_MAX' instead.
2013-08-02 19:51:17 +02:00
Werner Lemberg 89a529f317 [autofit] Fix `make multi'.
* include/freetype/config/ftconfig.h (FT_LOCAL_ARRAY,
FT_LOCAL_ARRAY_DEF): New macros.

* src/autofit/afglobal.c (af_writing_system_classes,
af_script_classes): Use FT_LOCAL_ARRAY_DEF.
* src/autofit/afglobal.h: Declare `af_writing_system_classes' and
`af_script_classes'.
* src/autofit/afloader.c: Include `afpic.h'.
2013-08-02 14:50:23 +02:00
Werner Lemberg 72f5ff5bbb [autofit] Introduce `writing systems'.
This patch adds a new top level to the auto-hinter's script class
hierarchy.  It defines `writing systems' which can contain multiple
scripts.

For example, the `latin' writing system (in file `aflatin.c') is
able to support scripts like Latin, Cyrillic, Armenian, etc., which
can be handled similarly.

Scripts are now named using four-letter OpenType tags.

* src/autofit/aftypes.h (AF_ScriptClassRec): Move relevant members
to...
(AF_WritingSystemClassRec): This new structure.  It holds pointers
to functions which can be shared among related scripts.
(AF_WritingSystem): New enumeration.
(AF_Script): Revised values using four-letter tags.
(AF_DEFINE_WRITING_SYSTEM_CLASS): New macro.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afglobal.c (af_writing_system_classes): New global,
constant array.
(af_script_classes): Updated.
(af_face_globals_free): Updated.
Remove assertion.
(af_face_globals_get_metrics): Updated.

* src/autofit/afglobal.h (AF_SCRIPT_FALLBACK)
[!AF_CONFIG_OPTION_CJK]: Handle this case.

* src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph):
Updated.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated;
initialize structures for both writing systems and scripts.
* src/autofit/afpic.h: Updated.
(AF_WRITING_SYSTEM_CLASSES_GET): New macro.

* src/autofit/afcjk.c (af_cjk_writing_system_class): New writing
system.
(af_cjk_uniranges): Renamed to...
(af_hani_uniranges): This.
(af_cjk_script_class): Reduced and renamed to...
(af_hani_script_class): This.
* src/autofit/afcjk.h: Updated.

* src/autofit/afdummy.c (af_dummy_writing_system_class): New writing
system.
(af_dummy_script_class): Reduced and renamed to...
(af_dflt_script_class): This.
* src/autofit/afdummy.h: Updated.

* src/autofit/afindic.c (af_indic_writing_system_class): New writing
system.
(af_indic_uniranges): Renamed to...
(af_deva_uniranges): This.
(af_indic_script_class): Reduced and renamed to...
(af_deva_script_class): This.
* src/autofit/afcjk.h: Updated.

* src/autofit/aflatin.c (af_latin_writing_system_class): New writing
system.
(af_latin_uniranges): Renamed to...
(af_latn_uniranges): This.
(af_latin_script_class): Reduced and renamed to...
(af_latn_script_class): This.
* src/autofit/aflatin.h: Updated.

* src/autofit/aflatin2.c (af_latin2_writing_system_class): New
writing system.
(af_latin2_uniranges): Renamed to...
(af_ltn2_uniranges): This.
Synchronize ranges with `latin'.
(af_latin2_script_class): Reduced and renamed to...
(af_ltn2_script_class): This.
* src/autofit/aflatin2.h: Updated.
2013-07-31 22:57:01 +02:00
Werner Lemberg 5d6a360542 [autofit] Variable renaming.
* src/autofit/aftypes.h (AF_ScriptMetricsRec):
s/clazz/script_class/.
Update all users.
2013-07-31 22:57:01 +02:00
Werner Lemberg dc624ca4dc Apply fixes for cppcheck nitpicks.
http://cppcheck.sourceforge.net/

Note that the current version heavily chokes on FreeType, delivering
even wrong results.  I will report those issues to the cppcheck team
so that a newer version gives improved results hopefully.

*/* Improve variable scopes.
*/* Remove redundant initializations which get overwritten.

* src/base/ftmac.c ,builds/mac/ftmac.c (count_faces_scalable):
Remove unused variable.

* src/base/ftdbgmem.c (ft_mem_table_destroy): `table' can't be zero.

* src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt1_entry_validate):
Remove functionless code.

* src/tools/ftrandom.c (main): Fix memory leak.
2013-06-04 10:30:48 +02:00
Werner Lemberg e3c9301581 */*: Use FT_Err_Ok only.
This is a purely mechanical conversion.
2013-03-14 11:21:17 +01:00
Werner Lemberg 059bc335ce */*: Use `FT_THROW'.
This is essentially a mechanical conversion, adding inclusion of
`FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for
stand-alone compiling modes of the rasterizer modules.

To convert the remaining occurrences of FT_Err_XXX and friends it is
necessary to rewrite the code.  Note, however, that it doesn't harm
if some cases are not handled since FT_THROW is a no-op.
2013-03-14 10:27:35 +01:00
Werner Lemberg bf745003e9 [autofit] Minor optimization.
* src/autofit/afglobals.c (af_face_globals_compute_script_coverage):
Add loop condition.
2012-09-29 22:40:40 +02:00
Werner Lemberg d180ac70fc [autofit] Implement Infinality's `increase glyph heights'.
This is an improved version of a similar fix contained in the
so-called `Infinality patch', taken from

  http://www.infinality.net/fedora/linux/zips/freetype-infinality-2.4.10-20120616_01-x86_64.tar.bz2

which addresses various enhancements of the auto-hinter.  Without
properties to control a module's metadata it wasn't possible to
adapt the patches because everything was originally controlled by
environment variables which I consider not suitable in general.

A patch to control `increase_x_height' follows.

* src/autofit/afglobal.h (AF_PROP_INCREASE_X_HEIGHT_MIN,
AF_PROP_INCREASE_X_HEIGHT_MAX): New macros.
(AF_FaceGlobalsRec): Add `increase_x_height' member.
* src/autofit/afglobal.c (af_face_globals_new): Initialize it.

* src/autofit/aflatin.c (af_latin_metrics_scale_dim),
* src/autofit/aflatin2.c (af_latin2_metrics_scale_dim): Implement
handling of `increase_x_height'.
2012-09-18 23:26:37 +02:00
Werner Lemberg 842c4ea258 [autofit] Add hierarchical property access to some structures.
* src/autofit/afglobal.h: Include `afmodule.h'.
(AF_FaceGlobalsRec): Add `module' member.
(AF_FaceGlobals): Typedef moved to...
* src/autofit/aftypes.h: Here.
(AF_ScriptMetricsRec): Add `globals' member.

* src/autofit/afglobal.c (af_face_globals_new,
af_face_globals_compute_script_coverage,
af_face_globals_get_metrics): Updated.

* src/autofit/afloader.c (af_loader_reset), src/autofit/afmodule.c
(af_property_get): Updated.
2012-09-18 15:23:41 +02:00
Werner Lemberg d4ec007541 [autofit] Implement `fallback-script' property.
* src/autofit/afglobal.c: s/default_script/fallback_script/.
* src/autofit/afglobal.h: s/AF_SCRIPT_DEFAULT/AF_SCRIPT_FALLBACK/.

* src/autofit/afmodule.c: s/default_script/fallback_script/.
(af_property_set, af_property_get): Implement `fallback-script'.
* src/autofit/afmodule.h: s/default_script/fallback_script/.

* include/freetype/ftautoh.h: Document it.
2012-09-15 18:26:28 +02:00
Werner Lemberg d0014f2ccb [autofit] Make default script a global property.
* src/autofit/afmodule.h (AF_ModuleRec): Add `default_script' field.

* src/autofit/afglobal.c (af_face_globals_compute_script_coverage,
af_face_globals_new), src/autofit/afloader.c (af_loader_reset),
src/autofit/afmodule.c (af_property_get) <glyph-to-script-map>,
af_autofitter_init:
Handle default script.

* src/autofit/afglobal.h: Updated.
2012-09-15 10:33:43 +02:00
Werner Lemberg 7bbbcbfb1a [autofit] Minor reorganization.
* src/autofit/afglobal.c (AF_SCRIPT_LIST_DEFAULT,
AF_SCRIPT_LIST_NONE, AF_DIGIT): Move to...
* src/autofit/afglobal.h (AF_SCRIPT_DEFAULT, AF_SCRIPT_LIST_NONE,
AF_DIGIT): This and update code.
2012-09-12 17:45:39 +02:00
Werner Lemberg 2be60cfe7e [autofit] Implement `glyph-to-script-map' property.
* include/freetype/ftautoh.h: New public header file.
* include/freetype/config/ftheader.h (FT_AUTOHINTER_H): New macro.

* src/autofit/afglobal.c (AF_FaceGlobalsRec): Move structure to...
* src/autofit/afglobal.h: This header file.
* src/autofit/afmodule.c: Include FT_AUTOHINTER_H.
(af_property_get): Handle `glyph-to-script-map'.
2012-09-01 22:31:43 +02:00
Werner Lemberg b6978dd0c9 [autofit] Do some code cleanup.
* src/autofit/afglobal.c (af_face_globals_new): Simplify.

* src/autofit/afhints.c: Use `FT_TRACE7' instead of `printf'
everywhere.
(FT_COMPONENT): New macro.
(af_glyph_hints_done): Simplify.

* include/freetype/internal/fttrace.h: Updated.
2012-07-06 19:38:44 +02:00
suzuki toshiya 1749d8bc6a Remove trailing spaces. 2012-01-17 02:00:24 +09:00
Werner Lemberg 332da87d99 [autofit] Some formatting and clean-ups. 2011-01-23 12:42:23 +01:00
Werner Lemberg c8f5b98be2 Remove C++ warnings.
*/*: Initialize pointers where necessary to make g++ happy.
2010-07-12 21:13:22 +02:00
Werner Lemberg 5d86cdce7e Fix Savannah bug #30108.
* src/autofit/afglobal.c (af_face_globals_compute_script_coverage):
Properly mask AF_DIGIT bit in comparison.
2010-06-15 08:29:30 +02:00
suzuki toshiya 6e2375f72c autofit: Cast FT_Long glyph_count to compare with FT_UInt GID. 2009-08-01 00:37:54 +09:00
suzuki toshiya 87054758fb autofit: Fix some data types mismatching with their sources. 2009-08-01 00:32:08 +09:00
Werner Lemberg 8b84c9d19f autohinter: Don't change digit widths if all widths are the same.
This fixes FreeDesktop bug #21197.

* src/autofit/afglobal.c (AF_DIGIT): New macro.
(af_face_globals_compute_script_coverage): Mark ASCII digits in
`glyph_scripts' array.
(af_face_globals_get_metrics): Updated.
(af_face_globals_is_digit): New function.
* src/autofit/afglobal.h: Updated.
(AF_ScriptMetricsRec): Add `digits_have_same_width' flag.

* src/autofit/aflatin.c: Include FT_ADVANCES_H.
(af_latin_metrics_check_digits): New function.
(af_latin_metrics_init): Use it.
* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c (af_cjk_metrics_init): Updated.

* src/autofit/aflatin2.c: Similar changes as with aflatin.c.

* src/autofit/afloader.c (af_loader_load_g): Test digit width.

* docs/CHANGES: Document it.
2009-04-27 19:40:35 +02:00
Oran Agra 59b4af8d59 Position Independent Code (PIC) support in autofit module.
* include/freetype/internal/autohint.h add macros to init
instances of FT_AutoHinter_ServiceRec.

* src/autofit/afmodule.h declare autofit_module_class
using macros from ftmodapi.h,
when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined
af_autofitter_service and autofit_module_class structs
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from afpic.h in order to access them.

* src/autofit/aftypes.h add macros to init and declare
instances of AF_ScriptClassRec.

* src/autofit/afcjk.h declare af_cjk_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined
af_cjk_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/afdummy.h declare af_dummy_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined
af_dummy_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/afindic.h declare af_indic_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined
af_indic_script_class struct will have function to init it instead of
being allocated in the global scope.

* src/autofit/aflatin.h declare af_latin_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined
af_latin_script_class struct will have function to init it instead of
being allocated in the global scope.
Change af_latin_blue_chars to be PIC-compatible by being a two
dimentional array rather than array of pointers.


* src/autofit/aflatin2.h declare af_latin2_script_class
using macros from aftypes.h,
when FT_CONFIG_OPTION_PIC is defined init function will be declared.
* src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined
af_latin2_script_class struct will have function to init it instead of
being allocated in the global scope.
Change af_latin2_blue_chars to be PIC-compatible by being a two
dimentional array rather than array of pointers.

* src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined
af_script_classes array initialization was moved to afpic.c and
is later refered using macros defeined in afpic.h.

New Files:
* src/autofit/afpic.h declare struct to hold PIC globals for autofit
module and macros to access them.
* src/autofit/afpic.c implement functions to allocate, destroy and
initialize PIC globals for autofit module.

* src/autofit/autofit.c add new file to build: afpic.c.
* src/autofit/jamfile add new files to FT2_MULTI build: afpic.c.
2009-04-05 18:23:38 +03:00
Werner Lemberg e6e6eade04 Finish fix of scaling bug of CID-keyed CFF subfonts.
* include/freetype/internal/ftcalc.h, src/base/ftcalc.c
(FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled): New
functions.

* src/cff/cffobjs.h (CFF_Internal): New struct.  It is used to
provide global hinting data for both the top-font and all subfonts
(with proper scaling).

* src/cff/cffobjs.c (cff_make_private_dict): New function, using
code from `cff_size_init'.
(cff_size_init, cff_size_done, cff_size_select, cff_size_request):
Use CFF_Internal and handle subfonts.
(cff_face_init): Handle top-dict and subfont matrices correctly;
apply some heuristic in case of unlikely matrix concatenation
results.  This has been discussed with people from Adobe (thanks
goes mainly to David Lemon) who confirm that the CFF specs are fuzzy
and not correct.

* src/cff/cffgload.h (cff_decoder_prepare): Add `size' argument.

* src/cff/cffgload.c (cff_builder_init): Updated.
(cff_decoder_prepare): Handle hints globals for subfonts.
Update all callers.
(cff_slot_load): Handling scaling of subfonts properly.

* src/cff/cffparse.c (cff_parse_fixed_dynamic): New function.
(cff_parse_font_matrix): Use it.

* src/cff/cfftypes.h (CFF_FontDictRec): Make `units_per_em'
FT_ULong.

* docs/CHANGES: Document it.
2008-05-14 23:05:38 +00:00
Werner Lemberg 7723dc34d3 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-26 04:44:35 +00:00
Werner Lemberg 49e18b8d5f formatting 2007-06-11 21:15:09 +00:00
David Turner b792017faf experimental changes for the Latin auto-hinter.
note that the new code is disabled by default.
2007-06-11 05:37:35 +00:00
David Turner f0cd69c1b4 2007-05-28 David Turner <david@freetype.org>
* src/autofit/afglobal.c: change default hinting script to
	CJK, since it works well with a larger array of scripts. thanks to
	"Rahul Bhalerao" <b.rahul.pm@gmail.com> for pointing this out !
2007-05-28 15:42:09 +00:00
Werner Lemberg 689dd66b56 More typo fixes from Alexei. 2007-01-30 23:08:50 +00:00
Wu, Chia-I (吳佳一) 4cdb45c01e Introduce experimental autofit CJK module based on akito's autohint
patch.  You need to #define AF_MOD_CJK in afcjk.c to enable it.

* src/autofit/afglobal.c, src/autofit/afcjk.h, src/autofit/afcjk.c,
src/autofit/rules.mk, src/autofit/autofit.c, src/autofit/aftypes.h:
Add CJK module based on akito's autohint patch.

* src/autofit/afhints.h (AF_SegmentRec): New field `len' for the
overlap length of the segments.  (AF_SEGMENT_LEN, AF_SEGMENT_DIST):
New macros.

* src/autofit/aflatin.h (af_latin_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Made `FT_LOCAL'.
Use the character given by the caller.
(af_latin_metrics_init_widths, af_latin_hints_link_segments): Scale
the thresholds.

* src/autofit/afloader.c (af_loader_load_g): Respect
AF_SCALER_FLAG_NO_ADVANCE.
2006-02-09 14:17:04 +00:00
Werner Lemberg 2cefb52fc8 * src/autofit/afglobal.c (af_face_globals_get_metrics):
s/index/gidx/.

* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Fix compiler
warnings.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add ttsbit0.c.

* src/sfnt/ttsbit0.h: Dummy file for build with `make'.
2005-03-26 10:27:09 +00:00
Werner Lemberg a37745bad4 * docs/CHANGES, docs/INSTALL.ANY: Updated.
* include/freetype/ftmoderr.h: Replace `Autohint' with `Autofit'.
Add `OTvalid'.

* src/autofit/aferrors.h: New file.

* src/autofit/afglobal.c, src/autofit/afhints.c,
src/autofit/aflatin.c, src/autofit/afloader.c: s/FT_Err_/AF_Err_/.
Include aferrors.h.

* src/autofit/rules.mk (AUTOF_DRV_H): Include aferrors.h.

* src/otvalid/otverror.h: s/FT_Mod_Err_OTV/FT_Mod_Err_OTvalid/.
2005-03-23 16:45:24 +00:00
Werner Lemberg f13516c832 Various fixes for C and C++ compiling.
* src/autofit/*: Add copyright messages.
  Formatting.

* src/autofit/afhints.c (af_glyph_hints_done): Don't use
`AF_Dimension' but `int' for loop counter.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Don't use
`AF_Dimension' but `int' for loop counter.
Use proper enumeration value for `render_mode'.
(af_latin_metrics_scale_dim): Don't shadow variables.
(af_latin_hints_compute_segments): Use proper cast for `major_dir'
and `segment_dir'.
(af_latin_align_linked_edge, af_latin_hint_edges): Fix arguments of call to
`af_latin_compute_stem_width'.
(af_latin_hints_apply): Don't use `AF_Dimension' but `int' for loop
counter.

* src/base/ftdbgmem.c (ft_mem_table_get_source, FT_DumpMemory): Use
proper cast for memory allocation.

* src/cff/cffdrivr.c (cff_get_kerning): Use proper cast for
initialization of `sfnt'.

* src/sfnt/sfdriver.c: Include `ttkern.h'.

* src/sfnt/ttkern.c (tt_face_get_kerning): Don't shadow variables.

* src/truetype/ttgload.c: Include `ttpload.h'.

* src/truetype/ttpload.c (tt_face_load_loca) [FT_OPTIMIZE_MEMORY]:
Remove redundant variable.
2005-03-03 17:09:08 +00:00
David Turner e664efaddd * src/autofit/*: important fixes to the auto-fitter. The output
now seems to be 100% equivalent to the auto-hinter, while being
        about 2% faster (which proves that script-specific algorithm
        selection isn't a performance problem).

        to test it, change "autohint" to "autofit" in
        <freetype/config/ftmodule.h> and recompile.

        a few more testing is needed before making this the official
        auto-hinting module
2004-06-04 17:41:59 +00:00
David Turner 9bfbf79c9f adding support for dummy script, i.e. no-hinting for non latin glyphs 2004-02-23 21:08:37 +00:00
David Turner 8ccb4552a9 updates 2004-01-16 09:51:00 +00:00
David Turner cf2c49c80c * fixed compilation problems in the cache sub-system
* partial updates to src/autofit
2003-12-24 18:42:04 +00:00
David Turner ff9d2415a7 * src/autofit/*: more updates 2003-11-23 21:39:51 +00:00