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.
* src/autofit/afhints.c (af_glyph_hints_dump_segments): Trace
`delta' also.
Don't show first point of segment as a replacement for `pos'; this
is (a) misleading, since the difference to `pos' can be almost
arbitrarily large in corner cases, and (b) it is better to have all
segment data in font units instead of a single value given in output
space coordinates.
Improve layout.
(af_glyph_hints_dump_edges): Show px->units and units->px conversion
values for convenience.
Improve layout.
This improves rendering of scripts like Bengali or Devanagari.
* src/autofit/afhints.c (af_axis_hints_new_edge): Add parameter to
pass top-to-bottom hinting flag. This makes the function sort edges
in descending vertical position.
* src/autofit/afhints.c: Updated.
* src/autofit/aflatin.c (af_latin_hints_compute_edges,
af_latin_hint_edges): Use `top_to_bottom_hinting' flag.
* src/autofit/afcjk.c (af_cjk_hints_compute_edges),
src/autofit/aflatin2.c (af_latin2_hints_compute_edges): Updated.
* src/autofit/afhints.c (af_print_idx, af_get_segment_index,
af_get_edge_index): New functions.
(af_glyph_hints_dump_points): Remove unnecessary `|', `[', and `]'.
Add segment and edge index for each point.
Slightly change printing order of some elements.
Don't print `-1' but `--' for missing elements.
(af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Remove
unnecessary `|', `[', and `]'.
Don't print `-1' but `--' for missing elements.
This harmonizes with other code in FreeType (and reduces the number
of necessary casts to avoid compiler warnings).
* src/autofit/afblue.hin: Make flag macros unsigned.
* src/autofit/afblue.h: Regenerated.
* src/autofit/afcjk.h: Replace flag enumeration with macros.
* src/autofit/afcjk.c: Updated.
* src/autofit/afhints.h (AF_Flags, AF_Edge_Flags): Replace with
macros.
* src/autofit/afhints.c: Updated.
* src/autofit/aflatin.h: Replace flag enumerations with macros.
* src/autofit/aflatin.c, src/autofit/aflatin2.c: Updated.
* src/autofit/aftypes.h (AF_ScalerFlags): Replace with macros.
While this doesn't show up with FreeType, exactly the same code
leaks with ttfautohint's modified auto-hinter code (which gets used
in a slightly different way).
It certainly doesn't harm since it is similar to already existing
checks in the code for embedded arrays.
* src/autofit/afhints.c (af_glyph_hints_reload): Set `max_contours'
and `max_points' for all cases.
Avoids multiple mallocs per typical glyphs.
With this and recent changes to avoid mallocs, the thread-safe
stack-based loader is now as fast as the previous model that had one
cached singleton.
* src/autofit/afhints.h (AF_SEGMENTS_EMBEDDED, AF_EDGES_EMBEDDED):
New macros.
(AF_AxisHintsRec): Add two arrays for segments and edges.
* src/autofit/afhints.c (af_axis_hints_new_segment): Only allocate
data if number of segments exceeds given threshold value.
(af_axis_hints_new_edge): Only allocate data if number of edges
exceeds given threshold value.
(af_glyph_hints_done): Updated.
This avoids at least two malloc calls for typical glyphs.
* src/autofit/afhints.h (AF_POINTS_EMBEDDED, AF_CONTOURS_EMBEDDED):
New macros.
(AF_GlyphHintsRec): Add two arrays for contours and points.
* src/autofit/afhints.c (af_glyph_hints_init, af_glyph_hints_done):
Updated.
(af_glyph_hints_reload): Only allocate data if number of contours or
points exceeds given threshold values.
Using `%ld' for pointer differences causes warnings on 32bit
platforms. The correct type would be (the relatively new) `%td',
however, this is missing on some important platforms.
This patch improves the change from 2014-11-28.
* src/autofit/afhints.c (AF_INDEX_NUM): Use `int' typecast. Our
pointer differences are always sufficiently small.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edge): Revert to `%d' and use `AF_INDEX_NUM'.
Problem reported by Ralf S. Engelschall <rse@engelschall.com>.
* src/autofit/afhints.c (af_glyph_hints_reload): Fix threshold for
finding first non-near point.
Properly initialize non-near point deltas.
In particular, local extrema without horizontal or vertical segments
are better recognized:
+ A + D
\ /
\ /
\ /
\ /
\ + C
\ /
B +/
If the distances AB and CD are large, point B wasn't previously
detected as an extremum since the `ft_corner_is_flat' function
`swallowed' BC regardless of its direction, tagging point B as weak.
The next iteration started at B and made `ft_corner_is_flat' swallow
point C, tagging it as weak also, et voilà.
To improve that, another pass gets now performed before calling
`ft_corner_is_flat' to improve the `topology' of an outline: A
sequence of non-horizontal or non-vertical vectors that point into
the same quadrant are handled as a single, large vector.
Additionally, distances of near points are now accumulated, which
makes the auto-hinter handle them as if they were prepended to the
next non-near vector.
This generally improves the auto-hinter's rendering results.
* src/autofit/afhints.c (af_glyph_hints_reload): Implement it.
* src/autofit/afhints.h (AF_FLAGS): Remove no longer used flag
`AF_FLAG_NEAR'.
Points which are very near to each other are now marked as such.
The `weak' flag is then computed by using the `in' vector of the
first and the `out' vector of the last point of a group of near
points.
For example, this fixes the rendering of glyph `Oslash' in
`Roboto-Thin.ttf'.
* src/autofit/afhints.h (AF_Flags): New value `AF_FLAGS_NEAR'.
* src/autofit/afhints.c (af_glyph_hints_reload): Introduce
the heuristic value `near_limit' to decide whether the current point
is near to the previous one, then set `AF_FLAG_NEAR' accordingly.
Store good `in' vector (of last non-near point) in
`last_good_in_{x,y}' and use it as an argument to
`ft_corner_is_flat' if necessary.
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.