Commit Graph

50 Commits

Author SHA1 Message Date
Werner Lemberg d0cfb4e1b2 Update all copyright notices. 2022-01-11 10:54:10 +01:00
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +01:00
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
Werner Lemberg 9ac9060df0 [GSoC] src/*.*: Convert block comments to `light' style.
This monster commit was created by applying Nikhil's scripts
`docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 09:08:41 +02:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg 9adeab6452 Update copyright year. 2016-01-13 11:54:10 +01:00
Werner Lemberg 37412ff9f4 Don't use macro names that contain `__' [1/2].
Such macro names are reserved for both C and C++.

*/*: Replace macros of the form `__XXX_H__' with `XXX_H_'.
2016-01-12 21:37:13 +01:00
Werner Lemberg b0de5a82f1 [autofit] Start implementing hinting direction (up/down, down/up).
Right now, it does nothing.

* src/autofit/afscript.h: Add another parameter to `SCRIPT',
specifying hinting direction.

* src/autofit/afglobal.c, scr/autofit/afglobal.h,
src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/afshaper.c,
src/autofit/aftypes.h: Extend `SCRIPT' definitions.
2015-12-23 23:25:03 +01:00
Werner Lemberg 4fe3b55d0b [autofit] Restore OpenType feature check.
This was removed while rewriting the HarfBuzz interface.

* src/autofit/afglobal.h (AF_FaceGlobalsRec): Add `hb_buf' field to
hold internal HarfBuzz buffer, needed for feature comparison.

* src/autofit/afglobal.c (af_face_globals_new,
af_face_globals_free): Initialize and destroy `hb_buf'.

* src/autofit/afshaper.c (af_shaper_get_cluster): Compare character
(cluster) with and without applied feature.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix tracing
message.
2015-12-11 08:08:48 +01:00
Werner Lemberg 24aa9c665e [autofit] Rewrite HarfBuzz interface to support character clusters.
Scripts like Khmer have blue zones that can't be directly
represented by Unicode characters.  Instead, it is necessary to let
HarfBuzz convert character clusters into proper glyph representation
forms, then deriving the blue zone information from the resulting
glyphs.

* src/autofit/hbshim.c, src/autofit/hbshim.h: Replaced by...
* src/autofit/afshaper.c, src/autofit/afshaper.h: ... these two new
files, providing a new API to access HarfBuzz.

The new API manages a HarfBuzz buffer with `af_shaper_buf_create'
and `af_shaper_buf_destroy'.  The buffer receives a UTF8 encoded
string with function `af_shaper_get_cluster', and the resulting
glyph data (indices, advance widths, vertical offsets) can be
iteratively accessed with function `af_shaper_get_elem'.

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

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

* include/freetype/internal/fttrace.h: s/afharfbuzz/afshaper/.

* src/autofit/afglobal.c: s/hbshim.h/afshaper.h/.
(af_face_globals_compute_style_coverage): Updated.

* src/autofit/afglocal.h: s/hbshim.h/afshaper.h/.

* src/autofit/autofit.c: s/hbshim.c/afshaper.c/.

* src/autofit/Jamfile, src/autofit/rules.mk (AUTOF_DRV_SRC):
Updated.
2015-12-06 18:52:41 +01:00
Werner Lemberg f45c0bf963 [autofit] Use string of standard characters.
This is more flexible; additionally, it would allow character
clusters.

* src/autofit/aftypes.h (SCRIPT, AF_DEFINE_SCRIPT_CLASS): Updated.
(AF_ScriptClassRec): Replace `standard_char[123]' with
`standard_charstring'.

* src/autofit/afscript.h: Replace last three character arguments
of the `SCRIPT' calls with a string parameter, holding the standard
characters (in UTF-8 encoding) separated with spaces.

* src/autofit/afglobal.c, src/autofit/afglobal.h,
src/autofit/afpic.c, src/autofit/afranges.c, src/autofit/hbshim.c
(SCRIPT): Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Updated.
2015-12-06 09:58:18 +01:00
Nikolaus Waxweiler b2a85ad32b [autofit] Extend `AF_FaceGlobalsRec' to hold emboldening data.
* src/autofit/afglobal.h (AF_FaceGlobalsRec): Add fields.

* src/autofit/afglobal.c (af_face_globals_new): Initialize new
fields.
(af_face_globals_free): Reset new fields.
2015-11-02 09:20:32 +01:00
Werner Lemberg dbd04269dc [autofit] Replace `no-base' with `non-base'.
* src/autofit/*: Do it.
2015-09-30 17:52:42 +02:00
Werner Lemberg d3cba0ed30 [autofit] Redesign code ranges (2/2).
This commit adds two fallback scripts (`latb', `latp') and
implements support for the no-base character ranges introduced in
the previous commit.

* src/autofit/aftypes.h (AF_ScriptClassRec): Add
`script_uni_nobase_ranges' field.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afscript.h, src/autofit/afstyles.h: Add `latb' and
`latp' fallback scripts.

* src/autofit/afblue.dat: Add blue zones for Latin subscript and
superscript fallback scripts.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afglobal.h (AF_NOBASE): New style flag for no-base
characters.
(AF_STYLE_MASK): Updated.

* src/autofit/afglobal.c (SCRIPT): Updated.
(af_face_globals_compute_style_coverage): Handle new style flag.

* src/autofit/aflatin.c (af_latin_hints_apply): Handle new style
flag.

* src/autofit/afranges.h (SCRIPT): Use it to export no-base ranges.
2015-09-04 10:28:53 +02:00
Werner Lemberg 40103a3af0 [autofit] Code clean-up.
* src/autofit/afglobal.h (AF_STYLE_MASK): New macro.
(AF_STYLE_UNASSIGNED): Use AF_STYLE_MASK for definition.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Updated.
2015-09-02 05:59:35 +02:00
Werner Lemberg 87c81f0460 [autofit] Make glyph style array use 16bit values.
* include/freetype/ftautoh.h (FT_Prop_GlyphToScriptMap): Use
`FT_UShort' for `map' field.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage,
af_face_globals_new), src/autofit/hbshim.c, src/autofit/hbshim.h
(af_get_coverage): Use FT_UShort for `glyph_styles' array.

* src/autofit/afglobal.h (AF_STYLE_UNASSIGNED, AF_DIGIT): Extend to
16 bits.
(AF_FaceGlobalsRec): Use `FT_UShort' for `glyph_styles' field.
2015-09-02 05:59:35 +02:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Werner Lemberg 6497b9c5a5 Fix compiler warnings.
Reported by Wojciech Mamrak <wmamrak@gmail.com>.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage),
src/autofit/afmodule.c (af_property_set): Fix `signed' vs.
`unsigned' issues.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Make compiler
happy.

* src/base/ftlcdfil.c (_ft_lcd_filter_fir): Use only four elements
for `fir'.
Fix `signed' vs. `unsigned' issues.

* src/sfnt/sfobjs.c (WRITE_BYTE): Removed, unused.
(WRITE_USHORT, WRITE_ULONG): Add proper casts.

* src/truetype/ttgload.c (TT_Get_VMetrics): Add proper casts.

* src/truetype/ttinterp.c (Ins_DELTAP): Add proper casts for `B1'
and `B2'.
2014-06-13 09:28:00 +02:00
Werner Lemberg a336400112 [autofit] Introduce two more slots for standard characters.
This is useful for OpenType features like `c2sc' (caps to small
caps) that don't have lowercase letters by definition, or other
features that mainly operate on numerals.

* src/autofit/afscript.h: Add more standard characters.

* src/autofit/aftypes.h: Update use of `SCRIPT' macro.
(AF_ScriptClassRec): Add members to hold two more standard
characters.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/afglobal.c, src/autofit/afglobal.h,
* src/autofit/afpic.c, src/autofit/afranges.h, src/autofit/hbshim.c:
Update use of `SCRIPT' macro.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Scan two more
standard characters.
2014-01-26 09:45:23 +01:00
Werner Lemberg 785f38573b [autofit] s/AF_STYLE_...._DEFAULT/AF_STYLE_...._DFLT/i. 2013-12-31 09:45:10 +01:00
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 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 3f91cb338b [autofit] s/ScriptMetrics/StyleMetrics/. 2013-12-18 12:59:35 +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 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 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 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 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 90f0487ff1 Cosmetics. 2011-03-28 15:41:49 +02: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
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
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 8ccb4552a9 updates 2004-01-16 09:51:00 +00:00
David Turner ff9d2415a7 * src/autofit/*: more updates 2003-11-23 21:39:51 +00:00