Commit Graph

125 Commits

Author SHA1 Message Date
Werner Lemberg 371f5c3b9d [autofit] Add support for Hebrew script.
* src/autofit/afblue.dat: Add blue strings for Hebrew.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.c (af_hebr_uniranges): New array.
(af_hebr_script_class): New script.
* src/autofit/aflatin.h, src/autofit/afscript.h: Updated.
2013-08-26 20:11:24 +02:00
Werner Lemberg 098121dbb9 [autofit] Improve tracing messages.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Mention script
ID in tracing message.
(af_cjk_metrics_init_blues): Initialize `axis' outside of the inner
loop.
Improve tracing messages.
(af_cjk_hint_edges) [FT_DEBUG_LEVEL_TRACE]: New variable
`num_actions' to count hinting actions.
Improve tracing messages.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Mention
script ID in tracing message.
(af_latin_metrics_init_blues, af_latin_hint_edges): Improve tracing
messages.
2013-08-26 18:54:05 +02:00
Werner Lemberg 306f8c5d89 [autofit] Synchronize `cjk' with `latin' module (and vice versa).
* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Add tracing
messages.
(af_cjk_metrics_init_blues): Don't pass blue string array as
argument but use the global array directly.
Use `outline' directly.
Update and add tracing messages.
(af_cjk_metrics_init): Simplify code.
(af_cjk_metrics_scale_dim): Improve tracing message.
(af_cjk_metrics_scale): Synchronize.

* src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues): Improve and add tracing messages.
2013-08-25 13:07:08 +02:00
Werner Lemberg 0975d685ed [autofit] Make `latin' module use blue stringsets.
* src/autofit/aflatin.c (AF_LATIN_MAX_TEST_CHARACTERS): Removed.
(af_latin_blue_chars): Removed.
(af_latin_metrics_init_blues): Replace AF_LATIN_MAX_TEST_CHARACTERS
with AF_BLUE_STRING_MAX_LEN.
Change loops to use offsets (in file `afblue.h') into the new arrays
`af_blue_stringsets' and `af_blue_strings' (in file `afblue.c').
Use `AF_LATIN_IS_SMALL_TOP_BLUE' macro.

* src/autofit/aflatin.h: Remove old enumeration values superseded by
the new data in `afblue.h'.
(AF_LATIN_IS_TOP_BLUE): Updated definition.
(AF_LATIN_IS_SMALL_TOP_BLUE): New macro.
(AF_LATIN_MAX_BLUES): Remove.
(AF_LatinAxisRec): Updated.
2013-08-25 08:37:47 +02:00
Werner Lemberg db3e5b9394 [autofit] Add blue stringsets.
* src/autofit/aftypes.h: Include `afblue.h'.
(AF_ScriptClassRec): Add `blue_stringset' field.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/autofit.c: Include `afblue.c'.

* src/autofit/afcjk.c (af_hani_script_class), src/autofit/afdummy.c
(af_dflt_script_class), src/autofit/afindic.c
(af_deva_script_class), src/autofit/aflatin.c
(af_latn_script_class), src/autofit/aflatin2.c
(af_ltn2_script_class): Updated.

* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afblue.c'.
2013-08-25 08:23:22 +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 05c1421f8d [autofit] Fix segment classification for blue zones.
The old code (essentially unchanged since the very beginning)
incorrectly handled this configuration

               x -o- x
                /   \
               /     \
              /       \
             o         o

as flat and this

                o               o
               /               /
             x|              x|
              |               |
              o---------------o

as round.  (`o' and `x' are on and off points, respectively).

This is a major change which should improve the rendering results
enormously for many TrueType fonts, especially in the range approx.
20-40ppem, fixing the appearance of many overshoots.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Look at the
first and last points of the segment, not the points right before
and after.
2013-07-19 23:11:23 +02:00
Werner Lemberg aa0ac3239c [sfnt] Fix documentation of `tt_face_get_metrics'.
Problem reported in Savannah bug #39383.
2013-07-02 10:36:26 +02:00
Werner Lemberg ccbdc3c421 * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Typo. 2013-05-08 09:17:56 +02:00
Werner Lemberg eed830614f Whitespace. 2013-03-23 14:25:43 +01: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 3a55340029 [autofit] Trace stem widths.
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Add some
FT_TRACE calls.
2012-11-15 16:37:05 +01:00
Werner Lemberg 1a37e4174b [autofit] Minor improvement.
* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Fix
loop.
2012-11-12 11:01:07 +01:00
Werner Lemberg f966da825c [autofit] Improve tracing.
* src/autofit/aflatin.c (af_latin_hint_edges)
[FT_DEBUG_LEVEL_TRACE]: Count number of actions and emit something
if there weren't any.
2012-11-10 12:42:18 +01:00
Werner Lemberg 553bb3c3ca [autofit] Add standard character to `AF_ScriptClassRec' structure.
* src/autofit/aftypes.h (AF_ScriptClassRec): Add `standard_char'
member.
(AF_DEFINE_SCRIPT_CLASS): Updated.

* src/autofit/aflatin.c (af_latin_metrics_init_widths): Use it.
(af_latin_metrics_init, af_latin_script_class): Updated.

* src/autofit/aflatin.c (af_latin2_metrics_init_widths): Use it.
(af_latin2_metrics_init, af_latin2_script_class): Updated.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths): Use it.
(af_cjk_metrics_init, af_cjk_script_class): Updated.

* src/autofit/afindic.c(af_indic_metrics_init,
af_indic_script_class): Updated.

* src/autofit/afcjk.h, src/autofit/aflatin.h: Updated.

* src/autofit/afdummy.c: Updated.
2012-10-24 14:22:14 +02:00
Werner Lemberg 118c6025b7 [autofit] Only use Unicode CMap.
* src/autofit/aflatin.c (af_latin_metrics_init): Implement it, to be
in sync with `af_face_globals_compute_script_coverage)'.
2012-10-24 12:26:20 +02:00
Werner Lemberg dda1e93db8 [autofit] Fix `make multi CC=c++'.
* src/autofit/aflatin.c, src/autofit/aflatin2.c: Include
`afglobal.h'.
* src/autofit/afloader.c: Fix order of header files.
* src/autofit/afmodule.c: Include `afglobal.h' and `aferrors.h'.
2012-10-20 08:34:57 +02:00
Werner Lemberg 7da6bbc34a Typos. 2012-09-25 06:37:15 +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 302fd62590 [autofit] Cosmetics. 2012-09-16 07:51:20 +02:00
Werner Lemberg 44e1f0d3a0 [autofit] Correct previous Unicode 6.1.0 change.
The auto-hinter's latin module only handles latin ligatures in the
`Alphabetical Presentation Forms' block.

* src/autofit/aflatin.c (af_latin_uniranges): Fix it.
2012-09-15 11:11:18 +02:00
Werner Lemberg 8ae2a65e09 [autofit] Update to Unicode 6.1.0.
* src/autofit/afcjk.c (af_cjk_uniranges), src/autofit/aflatin.c
(af_latin_uniranges): Add and fix ranges.
2012-09-14 14:10:01 +02:00
Werner Lemberg 5b995a8dd8 [autofit] Improve recognition of flat segments.
Problem reported by Brad Dunzer <BDunzer@extensis.com>.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): We have
a flat segment if the horizontal distance of best on-points is
larger than a given threshold.
2012-08-05 11:11:44 +02:00
Werner Lemberg e194d7cd61 [autofit] Variable renamings.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Replace
`glyph' with `outline'.
s/best_first/best_contour_first/.
s/best_last/best_contour_last/.
2012-08-05 10:58:02 +02:00
Werner Lemberg 5a0af493e4 [autofit] Improve debugging messages; do some code cleanup.
* src/autofit/aflatin.c (af_latin_align_linked_edge,
af_latin_hint_edges): Synchronize with formatting used in the
ttfautohint project.
2012-07-09 08:19:25 +02:00
Werner Lemberg 5210306145 Fix Savannah bug #36091.
* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Change the
constraint for testing round vs. flat segment: Accept either a
small distance or a small angle.
2012-07-04 17:20:33 +02:00
Werner Lemberg 09e9b59605 [autofit] Beautify blue zone tracing.
* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Implement it.
2012-07-04 13:00:06 +02:00
Werner Lemberg 2a9c4552f6 [autofit] Quantize stem widths.
* src/autofit/afangles.c (af_sort_widths): Rename to...
(af_sort_and_quantize_widths): This.
Add code to avoid stem widths which are almost identical.
* src/autofit/aftypes.h, src/autofit/aflatin.c, src/autofit/afcjk.c:
Updated.
2012-07-03 11:54:12 +02:00
Werner Lemberg 8be32d2f4a [autofit] Properly copy scaler flags to script metrics object.
Without this patch, only the dummy and cjk autohinter modules get
them (since they copy the whole scaler object).

* src/autofit/aflatin.c (af_latin_metrics_scale),
src/autofit/aflatin2.c (af_latin2_metrics_scale): Implement it.
2012-03-28 12:21:50 +02:00
Werner Lemberg c52f44d4fd Whitespace. 2011-11-30 10:46:53 +01:00
Werner Lemberg 4696dde23d * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix change
from 2011-05-04.
2011-06-20 19:09:02 +02:00
Werner Lemberg 58d1a5ee74 [autofit] Remove unused structure member.
* src/autofit/afhints.h (AF_SegmentRec): Remove `contour'.
* src/autofit/aflatin.c (af_latin_hints_compute_segments),
src/autofit/aflatin2.c (af_latin2_hints_compute_segments): Updated.
2011-06-08 09:32:56 +02:00
Werner Lemberg 71cc1a83d8 Fix gcc 4.6 compiler warnings.
* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Use casts and
remove unused variables.
* src/autofit/aflatin.c (af_latin_hints_compute_edges): Comment out
`up_dir'.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `height_org'
and `width_org' conditionalized.
2011-05-30 07:20:37 +02:00
Werner Lemberg 735e5abb7b [autofit] Improve tracing of hinting process.
* src/autofit/aflatin.c (af_latin_hint_edges): Add tracing message
`ADJUST'.
2011-05-27 10:22:42 +02:00
Werner Lemberg a3a0f57a1d * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify. 2011-05-04 06:14:30 +02:00
Werner Lemberg c3135e43f5 [autofit] Fix and add comments. 2011-05-02 06:04:15 +02:00
Werner Lemberg b9aa1f1339 [autofit] Improve tracing messages.
* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_latin_align_linked_edge, af_latin_hint_edges): Do it.
2011-04-28 09:09:45 +02:00
Werner Lemberg d503b1bce2 Integrate autofitter debugging stuff.
* devel/ftoption.h, include/freetype/config/ftoption.h
(FT_DEBUG_AUTOFIT): New macro.

* include/freetype/internal/fttrace.h: Add trace components for
autofitter.

* src/autofit/aftypes.h (AF_LOG): Removed.
(_af_debug): Removed.

* src/autofit/*: s/AF_DEBUG/FT_DEBUG_AUTOFIT/.
s/AF_LOG/FT_TRACE5/.
Define FT_COMPONENT where necessary.
2011-04-18 19:05:28 +02:00
Werner Lemberg 948a8fb674 Fix formatting of autofit debug dumps.
* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Adjust
column widths.
2011-04-04 13:02:08 +02:00
Werner Lemberg 9f5ed8118c Cosmetics. 2011-04-02 07:23:00 +02:00
Werner Lemberg 544adf7313 Whitespace, typo. 2011-04-02 07:15:33 +02:00
Werner Lemberg c7f26a1982 C++ compilation fixes.
* src/autofit/aflatin.c (af_latin_hints_apply), src/autofit/afcjk.c
(af_cjk_hints_apply): Use cast for `dim'.
2011-03-19 02:28:21 +01:00
Werner Lemberg 576fc2c06e Add AF_CONFIG_OPTION_USE_WARPER to control the autofit warper.
* devel/ftoption.h, include/freetype/config/ftoption.h
(AF_CONFIG_OPTION_USE_WARPER): New macro.
* src/autofit/aftypes.h (AF_USE_WARPER): Remove.

* src/autofit/*: s/AF_USE_WARPER/AF_CONFIG_OPTION_USE_WARPER/.

* src/autofit/afwarp.c [!AF_CONFIG_OPTION_USE_WARPER]: Replace dummy
variable assignment with a typedef.
2011-03-02 03:52:36 +01:00
Werner Lemberg e547a656a5 [autofit] More comments, formatting, whitespace. 2011-02-26 18:39:10 +01:00
Werner Lemberg b7fc0c7461 [autofit] Slight simplifications.
* src/autofit/aflatin.c (af_latin_hints_link_segments): Remove
test which always returns false.
(af_latin_hints_compute_blue_edges): Remove redundant assignment.
2011-02-26 18:36:21 +01:00
Werner Lemberg 6c28689691 [autofit] Comment out unused code.
* src/autofit/aflatin.c, src/autofit/aflatin2.c
(af_latin_hints_compute_edges): Do it.
2011-02-24 05:52:14 +01:00
Werner Lemberg 5220ef58c5 Fix minor issues reported by <muktha.narayan@wipro.com>.
* src/autofit/aflatin.c (af_latin_compute_stem_width): Remove
redundant conditional check.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Ditto.
* src/cff/cffload.c (cff_encoding_load): Remove conditional check
which always evaluates to `true'.
* src/pshinter/pshalgo.c (ps_glyph_interpolate_strong_points):
Ditto.
* src/truetype/ttinterp.c (Ins_IUP): Ditto.
* src/cid/cidgload.c (cid_slot_load_glyph): Don't check for NULL if
value is already dereferenced.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Fix check of `face'.
2010-09-13 07:32:22 +02:00
Werner Lemberg 09344385ee autofit: Remove dead code.
Suggested by Graham.

* src/autofit/afhints.c (af_glyph_hints_compute_inflections):
Removed.
(af_glyph_hints_reload): Remove third argument.
Update all callers.
2010-05-22 07:43:22 +02:00
Werner Lemberg 7635ba64b7 Really fix FreeDesktop bug #21197.
This also fixes Savannah bug #28021.

* src/autofit/aflatin.c (af_latin_metrics_check_digits),
src/autofit/aflatin2.c (af_latin2_metrics_check_digits): Fix loop.
2009-11-15 10:17:44 +01:00