Commit Graph

625 Commits

Author SHA1 Message Date
Werner Lemberg caa48b0db1 [autofit] Avoid excessive stem length rounding (#25392).
* src/autofit/aflatin.c (af_latin_compute_stem_width): Add argument
to pass difference between hinted and unhinted position of base
point; use this to adjust the stem width depending on the PPEM so
that it doesn't become too large under certain circumstances.
Update all callers using value 0 for this argument except...
(af_latin_align_linked_edge): Pass position delta of base point to
`af_latin_compute_stem_width'.
2016-03-05 19:47:07 +01:00
Werner Lemberg 3eb6f66a37 [autofit] Fix reallocation error introduced in 2016-02-27 (#47310).
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Reassign
`prev_segment' after reallocation.
2016-03-01 07:10:30 +01:00
Werner Lemberg 015c6e08a1 Fix clang warnings.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Use
FT_UShort for `min_flags' and `max_flags'.
Initialize `prev_*' variables.

* src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Fix
types of local variables.

* src/smooth/ftgrays.c (gray_dump_cells) [FT_DEBUG_LEVEL_TRACE]:
Update `printf' format string.

* src/tools/ftfuzzer/ftfuzzer.cc (setIntermediateAxis): Add cast.
(LLVMFuzzerTestOneInput): Fix loop type.
2016-03-01 06:45:52 +01:00
Werner Lemberg 5c7646d226 [autofit] Add blue-zone support for Sinhala script.
This essentially moves the Sinhala script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Sinhala.

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

* src/autofit/afscript.h: Add Sinhala standard character and move data
out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Sinhala data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Sinhala data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-02-29 09:12:35 +01:00
Werner Lemberg f216947813 [autofit] Properly handle spikes pointing to the x-axis.
An example that gets better rendered is glyph `uusignTaml' (glyph
index 2286) in font `FreeSerif.ttf' (Version 0412.2263) at 22ppem.

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Properly
handle segments where the last point of the first segment is
identical to the first point in the second one.  This can happen for
malformed fonts or spikes.  We either merge the new segment with the
previous one (both segments point into the same direction), or we
discard the shorter segment if they point into different directions.
2016-02-28 22:48:34 +01:00
Werner Lemberg ce48664579 [autofit] Minor code clean-up.
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Change
some local variable names to better differentiate between values
along a segment and values orthogonal to it.
2016-02-27 15:01:49 +01:00
Werner Lemberg ebfd7ce52f [autofit] Improve BOUND action.
In complex glyph shapes, the original logic was too simple to cater
for situations that would actually need something similar to PS Hint
masks.  This fix should alleviate the worst cases.

* src/autofit/aflatin.c (af_latin_hint_edges): Don't allow
complete disappearance of stems.
2016-02-26 08:10:41 +01:00
Werner Lemberg 44324b3746 [autofit] Add blue-zone support for Tamil script.
This essentially moves the Tamil script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Tamil.

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

* src/autofit/afscript.h: Add Tamli standard character and move data
out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Tamil data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Tamil data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-02-25 06:58:47 +01:00
Werner Lemberg a5952d3049 [autofit] Add blue-zone support for Malayalam script.
This essentially moves the Malayalam script from the `Indic' hinter
to the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Malayalam.

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

* src/autofit/afscript.h: Add Malayalam standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Malayalam data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Malayalam data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-02-18 12:56:38 +01:00
Werner Lemberg 3295039107 Whitespace. 2016-02-15 12:54:40 +01:00
Werner Lemberg f380d743f2 Typo. 2016-01-30 11:16:04 +01:00
Werner Lemberg baa41ff204 [autofit] Minor tracing improvement.
* src/autofit/afhints.c (af_glyph_hints_dump_points): Insert newline
at the start of a new contour.
2016-01-30 07:44:30 +01:00
Werner Lemberg 8d810097fd [autofit] Add blue-zone support for Kannada script.
This essentially moves the Kannada script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Kannada.

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

* src/autofit/afscript.h: Add Kannada standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Kannada data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Kannada data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-01-28 10:13:24 +01:00
Werner Lemberg fb672897f8 [autofix] Complete last autofit commit.
Problem reported by Kostya Serebryany <kcc@google.com>.

* src/autofit/afshaper.c (af_shaper_get_coverage)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Update signature.
2016-01-20 21:13:16 +01:00
Werner Lemberg ec776596ce [autofit] Fix handling of default script.
Patch taken from ttfautohint, commit
071ae2c00e0d67f9d19418f4fade1c23d27dc185.

There were two bugs.

  - We now use non-standard script tags like `khms' for special
    purposes.  However, HarfBuzz maps such tags to `DFLT', and
    without this commit the associated lookups were incorrectly
    assigned to the non-standard tags.

  - Let's assume we have a Bengali font, and the font's `DFLT'
    script tag handles the necessary lookups for Bengali, too.
    Without this commit, the `DFLT' lookups were assigned to
    ttfautohint's default script (usually `latn') before the
    standard lookups for Bengali were handled.

    We now have the following order while searching for covered
    glyph indices.

      special features of scripts (e.g. `sups' for Cyrillic)
      Unicode mappings of scripts
      remaining features of scripts (especially important for Indic
        scripts)
      default features of default script

* src/autofit/afshaper.c, src/autofit/afshaper.h
(af_shaper_get_coverage): Add boolean parameter to indicate default
script.
Update all callers.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Fix search order for coverages.
2016-01-19 19:33:57 +01:00
Werner Lemberg fc11af1ea2 Various minor clang fixes.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Initialize
`ch'.

* src/base/ftcalc.c (FT_MulFix) [FT_LONG64]: Add cast.

* src/base/ftdbgmem.c (ft_mem_table_destroy): Add cast.

* src/base/fthash.c (hash_num_lookup): Add cast.

* src/base/fttrigon.c (ft_trig_downscale) [FT_LONG64]: Fix cast.

* src/gxvalid/gxvcommn.c (gxv_EntryTable_validate): Comment out
redundant code.

* src/type1/t1driver.c (t1_get_ps_font_value) <PS_DICT_SUBR>: Add
cast.

* src/type1/t1load.c (parse_subrs): Fix type of `count'.
2016-01-19 19:15:54 +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 2e09812c51 [autofit] Make top-to-bottom hinting work in latin auto-hinter.
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.
2015-12-25 08:05:30 +01:00
Werner Lemberg 172db3254c [autofit] Add hinting direction to `AF_ScriptClassRec'.
Still unused.

* src/autofit/afglobal.c (SCRIPT): Handle hinting direction.

* src/autofit/aftypes.h (AF_ScriptClassRec): Add
`top_to_bottom_hinting' field.
(AF_HINTING_BOTTOM_TO_TOP, AF_HINTING_TOP_TO_BOTTOM): New macros.
(AF_DEFINE_SCRIPT_CLASS): Updated.
2015-12-24 08:17:51 +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 1f80c8152b Whitespace. 2015-12-16 08:22:42 +01:00
Werner Lemberg 02451c7917 [autofit] Add blue-zone support for Bengali script.
This essentially moves the Bengali script from the `Indic' hinter to
the `Latin' hinter.

* src/autofit/afblue.dat: Add blue zone data for Bengali.

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

* src/autofit/afscript.h: Add Bengali standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Bengali data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Bengali data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2015-12-15 17:53:46 +01:00
Werner Lemberg 0063649d54 Whitespace, `.mailmap' update. 2015-12-14 07:02:56 +01:00
Werner Lemberg d8f9a453b2 [autofit] Add support for Myanmar script.
* src/autofit/afblue.dat: Add blue zone data for Myanmar.

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

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

* src/autofit/afranges.c: Add Myanmar data.

* src/autofit/afstyles.h: Add Myanmar data.
2015-12-13 15:54:17 +01:00
Werner Lemberg 868d5a0eaf * src/autofit/aflatin.c (af_latin_metrics_init_blues): Minor. 2015-12-12 07:28:22 +01:00
Werner Lemberg 79a42ad283 * src/autofit/afscript.h: Avoid potential crash. 2015-12-12 07:27:14 +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 3c3d7c212e Another typo. 2015-12-10 11:54:41 +01:00
Werner Lemberg 93fdf4eb89 Formatting. 2015-12-10 11:52:08 +01:00
Werner Lemberg bbe84ed972 [autofit] Remove redundant code.
* src/autofit/aflatin.c (af_latin_metrics_init_widths): Do it.
2015-12-10 09:33:41 +01:00
Werner Lemberg 5330e3de15 [autofit] Minor. 2015-12-10 08:32:58 +01:00
Werner Lemberg dd305f31f0 [autofit] Thinko.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Don't count
empty blue zones (bug introduced 2015-12-06).
2015-12-09 21:00:33 +01:00
Werner Lemberg 0164d934b6 [autofit] Introduce subscript top blue zones.
This feature is mainly for Khmer: The idea is to avoid a clash
between the top of subscript glyphs and the bottom of normal
baseline glyphs.

This only works for character clusters mapped to multiple glyphs.

* src/autofit/afblue.dat: Add subscript top blue zone for Khmer.

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_SUB_TOP): New
macro.

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

* src/autofit/aflatin.h (AF_LATIN_IS_SUB_TOP_BLUE,
AF_LATIN_BLUE_SUB_TOP): New macros.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Handle new
blue zone property.
Update tracing messages.
(af_latin_metrics_scale_dim): Handle new blue zone property.
(af_latin_hints_compute_blue_edges): Updated.
2015-12-09 20:04:18 +01:00
Werner Lemberg f02e1df7ac [autofit] Fix tracing message.
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Display
inactive blue zones also.
2015-12-09 14:45:30 +01:00
Werner Lemberg c13526e6af * src/autofit/afblue.dat: Add more Khmer clusters.
Some fonts have incorrect ligatures; we need more samples to get a
good mean value.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2015-12-08 09:48:50 +01:00
Werner Lemberg b38ca3cbeb [autofit] Typos.
* src/autofit/afshaper.c (af_shaper_buf_create, af_shaper_get_elem)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Make it compile.
2015-12-06 19:48:31 +01:00
Werner Lemberg facb79abdc [autofit] Add support for Khmer script.
We split Khmer into two auto-hinter scripts: `Khmer' (`khmr') and
`Khmer symbols' (`khms', U+19E0-U+19FF).

* src/autofit/afblue.dat: Add blue zone data for Khmer.

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

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

* src/autofit/afranges.c: Add Khmer data.

* src/autofit/afstyles.h: Add Khmer data.
2015-12-06 19:34:59 +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 de5999411a [autofit] Prepare forthcoming changes.
This makes it easier to control the commits.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Add dummy
loop.  No functional change.
2015-12-06 18:18:02 +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
Werner Lemberg a8a54c3060 * src/autofit/afblue.dat: Separate blue zone characters with spaces.
Another preparation for character cluster support.

* src/autofit/afblue.c, src/autofit.afblue.h: Regenerated.
2015-12-05 13:26:44 +01:00
Werner Lemberg f7e6d51a75 * src/autofit/afblue.hin (GET_UTF8_CHAR): Use `do...while(0)'.
* src/autofit/afblue.h: Regenerated.
2015-12-05 13:08:45 +01:00
Werner Lemberg 53696f03ce * src/autofit/afwarp.c: s/INT_MIN/FT_INT_MIN/. 2015-12-05 07:44:16 +01:00
Werner Lemberg 4679bf83a6 Fix C++ compilation.
* src/autofit/afloader.c: Include FT_INTERNAL_CALC_H.

* src/truetype/ttgload.c (load_truetype_glyph): Pacify compiler.
2015-11-28 19:05:36 +01:00
Werner Lemberg 68fb4789a5 * src/autofit/afhints.c (af_get_segment_index): Fix it.
The old code was too simple, returning invalid values in most cases
where a segment crosses the contour start.
2015-11-15 13:06:48 +01:00
Werner Lemberg 75722f8929 [cff, autofit] Switch off stem darkening by default.
* src/autofit/afmodule.c (af_autofitter_init), src/cff/cffobjs.c
(cff_driver_init): Do it.
2015-11-11 09:55:16 +01:00
Philipp Knechtges be32b168ac [autofit] Don't distort (latin) glyphs too much (#46195).
* src/autofit/aflatin.h (AF_LatinBlueRec): Add `ascender' and
`descender' fields.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Collect
ascender and descender data for blue zones.
(af_latin_metrics_scale_dim): Reject vertical scaling values that
change the result by more than two pixels.
2015-11-08 08:37:51 +01:00
Nikolaus Waxweiler b6fd5bc06c * src/autofit/afloader.c (af_loader_load_g): Implement emboldening. 2015-11-03 10:40:58 +01:00
Nikolaus Waxweiler bf2ba9e3d4 [autofit] Implement darkening computation function.
This is a crude adaption of the original `cf2_computeDarkening'
function.

* src/autofit/afloader.c (af_intToFixed, af_fixedToInt,
af_floatToFixed): New macros, taken from `cf2fixed.h'.
(af_loader_compute_darkening): New function.
* src/autofit/afloader.h: Updated.
2015-11-02 13:12:34 +01:00
Nikolaus Waxweiler 37c401ac0a [autofit] Add functions to get standard widths for writing systems.
We need the computed standard horizontal and vertical widths for the
emboldening calculation.  This method provides a convenient way to
extract it from writing-system-specific metrics structures, which
all script definitions must implement.

* src/autofit/aftypes.h (AF_WritingSystem_GetStdWidthsFunc): New
function type.
(AF_WritingSystemClassRec): New member `style_metrics_getstdw'.
(AF_DEFINE_WRITING_SYSTEM_CLASS): Updated.

* src/autofit/afcjk.c (af_cjk_get_standard_width): New function.
(af_cjk_writing_system_class): Updated.
* src/autofit/afdummy.c	(af_dummy_writing_system_class): Updated.
* src/autofit/afindic.c (af_cjk_get_standard_width): New function.
(af_indic_writing_system_class): Updated.
* src/autofit/aflatin.c (af_latin_get_standard_width): New function.
(af_indic_writing_system_class): Updated.
* src/autofit/aflatin.c (af_latin_get_standard_width): New function.
(af_indic_writing_system_class): Updated.
2015-11-02 09:32:26 +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
Nikolaus Waxweiler d682e51062 [autofit] Add stem-darkening properties.
Actual code follows in a later commit.

* include/freetype/ftautoh.h: Document `no-stem-darkening' and
`darkening-parameters'.

* src/autofit/afmodule.h: New fields `no_stem_darkening' and
`darken_params'.

* src/autofit/afmodule.c (af_property_set, af_property_get):
Handle them.
(af_autofitter_init): Initialize them.
2015-11-02 09:06:36 +01:00
Werner Lemberg 4188deacf3 Comments. 2015-10-30 08:07:56 +01:00
Werner Lemberg 02cfd71498 * src/autofit/afhints.c (af_glyph_hints_dump_points): Minor. 2015-10-29 20:50:57 +01:00
Werner Lemberg 7f00fa6462 [autofit] Improve tracing.
* 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.
2015-10-25 10:59:59 +01:00
Werner Lemberg 3066f5f53d Revert erroneously applied commits. 2015-10-21 14:05:41 +02:00
Werner Lemberg e6593389cf [sfnt] Avoid unnecessarily large allocation for WOFFs (#46257).
* src/sfnt/sfobjs.c (woff_open_font): Use WOFF's `totalSfntSize'
only after thorough checks.
Add tracing messages.
2015-10-21 08:04:29 +02:00
Werner Lemberg 8cabd919ca * Version 2.6.1 released.
=========================

Tag sources with `VER-2-6-1'.

* docs/VERSION.DLL: Update documentation and bump version number to
2.6.1.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.6/2.6.1/, s/26/261/.

* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.

* builds/unix/configure.raw (version_info): Set to 18:1:12.
* CMakeLists.txt (VERSION_PATCH): Set to 1.

* src/autofit/afmodule.c [AF_DEBUG_AUTOFIT]: Ensure C linking for
dumping functions.
2015-10-04 08:18:01 +02:00
Werner Lemberg fab67b85ec * src/autofit/afranges.c (af_deva_nonbase_uniranges): Fix ranges.
They should be a subset of `af_deva_uniranges'.
2015-10-01 16:47:05 +02:00
Werner Lemberg f68bd40836 afranges.c: Add some comments. 2015-10-01 16:43:45 +02: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 a3046567bc [autofit] Add support for Lao script.
Thanks to Danh Hong <danhhong@gmail.com> for guidance with blue zone
characters!

* src/autofit/afblue.dat: Add blue zone data for Lao.

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

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

* src/autofit/afranges.c: Add Lao data.

* src/autofit/afstyles.h: Add Lao data.
2015-09-28 09:45:56 +02:00
Werner Lemberg 19188a9a19 [autofit] Minor tracing improvement.
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Don't emit
blue zones header line if there are no blue zones.
2015-09-26 16:57:17 +02:00
Alexei Podtelezhnikov a9f6f04e56 [autofit] Missing piece. 2015-09-04 22:28:13 -04: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 696b712691 [autofit] Redesign code ranges (1/2).
This patch introduces auxiliary code ranges that identify no-base
characters; they refer to glyphs of a script that should be hinted
without alignments to blue zones (mostly diacritics).

It also splits off ranges for fallback scripts that handle subscript
and superscript characters not covered by OpenType features.  For
example, this greatly helps improve the hinting of various phonetic
alphabets, which contain a large amount characters that look like
superscript glyphs.

Finally, code ranges are updated to Unicode 8.0, and enclosed
characters are removed in general since they normally look better if
they stay unhinted.

* src/autofit/afranges.c (af_latn_uniranges): Updated to Unicode
8.0.
Split off superscript-like and subscript-like glyphs into...

(af_latb_uniranges, af_latp_uniranges): ... these two new arrays.

(af_xxxx_nobase_uniranges): New arrays that hold no-base characters
of the corresponding character ranges.
2015-09-04 10:10:59 +02:00
Werner Lemberg 8cbbcf6b98 [autofit] Pass glyph index to hinting function.
No functionality change yet.

* src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Pass
glyph index.

* src/autofit/afcjk.c, src/autofit/afcjk.h (af_cjk_hints_apply),
src/autofit/afdummy.c (af_dummy_hints_apply), src/autofit/afindic.c
(af_indic_hints_apply), src/autofit/aflatin.c
(af_latin_hints_apply), src/autofit/aflatin2.c
(af_latin2_hints_apply), src/autofit/afloader.c (af_loader_load_g):
Updated.
2015-09-03 06:47:30 +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 ff406e2e58 [autofit] Improve Arabic hinting.
Problem reported by Titus Nemeth <tn@tntypography.eu> (by using
ttfautohint).

* src/autofit/afblue.dat: Add neutral blue zone for the tatweel
character.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2015-08-06 07:34:50 +02:00
Werner Lemberg 15e2a4f790 [autofit] Improve recognition of flat vs. rounded segments.
Lower the flatness threshold from upem/8 to upem/14, making the
auto-hinter accept shorter elements.

Synchronize flat/round stem selection algorithm with blue zone code.

* src/autofit/aflatin.c (FLAT_THRESHOLD): New macro.
(af_latin_metrics_init_blues): Use it.
(af_latin_hints_compute_segments): Collect information on maximum
and minimum coordinates of `on' points; use this to add a constraint
for the flat/round decision similar to
`af_latin_metrics_init_blues'.
2015-08-05 21:53:50 +02:00
Werner Lemberg f9be567f5f Better support of user-supplied C++ namespaces.
See

  http://lists.nongnu.org/archive/html/freetype-devel/2015-07/msg00008.html

for a rationale.

* src/autofit/afpic.h, src/base/basepic.h, src/cff/cffpic.h,
src/pshinter/pshpic.h, src/psnames/pspic.h, src/raster/rastpic.h,
src/sfnt/sfntpic.h, src/smooth/ftspic.h, src/truetype/ttpic.h
(FT_BEGIN_HEADER, FT_END_HEADER): Move macro calls to not enclose
header files that contain FT_{BEGIN,END}_HEADER macros by
themselves.

* src/autofit/aftypes.h [FT_DEBUG_AUTOFIT]: Include
FT_CONFIG_STANDARD_LIBRARY_H earlier.

* src/truetype/ttpic.h: Include FT_INTERNL_PIC_H.
2015-07-09 15:10:31 +02:00
Werner Lemberg 5931268eec s/TYPEOF/FT_TYPEOF/ (#45376).
* builds/unix/ftconfig.in, builds/vms/ftconfig.in,
include/freetype2/config/ftconfig.h,
include/freetype2/internal/ftobjs.h, src/autofit/afwarp.h: Do it.
2015-06-23 09:24:48 +02:00
Werner Lemberg 31d97df99f Make Jam support work again.
This is just very basic stuff and just a little bit tested on
GNU/Linux only.  I won't delve into this since I'm not a Jam user.

* Jamfile: Call `HDRMACRO' for `ftserv.h' also.
(DEFINES): Replace with...
(CCFLAGS): ... this.

* src/Jamfile: Don't call `HDRMACRO' for `internal.h'; this is
already handled in the top-level Jamfile.

* src/autofit/Jamfile (DEFINES): Replace with...
(CCFLAGS): ... this.
(_sources): Add missing files.

* src/cache/Jamfile: Don't call `HDRMACRO' for `ftcache.h'; it no
longer contains macro header definitions.

* src/base/Jamfile, src/cff/Jamfile, src/sfnt/Jamfile,
src/truetype/Jamfile (_sources): Add missing files.
2015-06-21 19:12:12 +02:00
Werner Lemberg e186230678 * Version 2.6 released.
=======================

Tag sources with `VER-2-6'.

* docs/VERSION.DLL: Update documentation and bump version number to
2.6.

* README, Jamfile (RefDoc), builds/windows/vc2005/freetype.vcproj,
builds/windows/vc2005/index.html,
builds/windows/vc2008/freetype.vcproj,
builds/windows/vc2008/index.html,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.5.5/2.6/, s/255/26/.

* include/freetype/freetype.h (FREETYPE_MINOR): Set to 6.
(FREETYPE_PATCH): Set to 0.

* builds/unix/configure.raw (version_info): Set to 18:0:12.
* CMakeLists.txt (VERSION_MINOR): Set to 0.
(VERSION_PATCH): Set to 6.

* src/autofit/afmodule.c [!FT_MAKE_OPTION_SINGLE_OBJECT]: Add
declarations for dumping functions.

* src/truetype/ttinterp.c (TT_New_Context): Pacify compiler.

* builds/toplevel.mk: Use `freetype.mk's code to compute the version
string.
Don't include a zero patch level in version string.
* builds/freetype.mk: Remove code for computing the version string.
2015-06-07 16:11:18 +02:00
Werner Lemberg a678560dc2 Minor. 2015-05-28 17:31:15 +02:00
Alexei Podtelezhnikov 4091495271 [autofit] Speed up IUP.
* src/autofit/afhints.c (af_iup_interp): Separate trivial snapping to
the same position from true interpolation, use `scale' to reduce divisions.
2015-04-29 21:57:30 -04:00
Werner Lemberg 14df6b1a63 [autofit] By default, enable warping code but switch off warping.
Suggested by Behdad.

* include/config/ftoption.h: Define AF_CONFIG_OPTION_USE_WARPER.

* src/autofit/afmodule.c (af_autofitter_init): Initialize `warping'
with `false'.
2015-04-22 11:14:35 +02:00
Werner Lemberg 12661a5ae0 [autofit] Introduce `warping' property.
This code replaces the debugging hook from the previous commit with
a better, more generic solution.

* include/ftautoh.h: Document it.

* src/autofit/afmodule.h (AF_ModuleRec)
[AF_CONFIG_OPTION_USE_WARPER]: Add `warping' field.

* src/autofit/afmodule.c (_af_debug_disable_warper): Remove.
(af_property_set, af_property_get, af_autofitter_init)
[AF_CONFIG_OPTION_USE_WARPER]: Handle `warping' option.

* src/autofit/afhints.h (AF_HINTS_DO_WARP): Remove use of the no
longer existing `_af_debug_disable_warper'.

* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2.c (af_latin2_hints_init)
[AF_CONFIG_OPTION_USE_WARPER]: Add `AF_SCALER_FLAG_NO_WARPER' to the
scaler flags if warping is off.

* src/autofit/aftypes.h: Updated.
2015-04-21 07:13:59 +02:00
Werner Lemberg 58f48f0ddc [autofit] Add debugging hook to disable warper.
* src/autofit/afmodule.c (_af_debug_disable_warper)
[FT_DEBUG_AUTOFIT]: New global variable.

* src/autofit/aftypes.h: Updated.
(AF_SCALER_FLAG_NO_WARPER): New macro (not actively used yet).

* src/autofit/afhints.h (AF_HINTS_DO_WARP): New macro.

* src/autofi/aflatin.c (af_latin_hints_apply)
[AF_CONFIG_OPTION_USE_WARPER]: Use `AF_HINTS_DO_WARP' to control use
of warper.

* src/autofit/afcjk.c (af_cjk_hints_init, af_cjk_hints_apply)
[AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.

* src/autofit/aflatin2.c (af_latin2_hints_apply)
[AF_CONFIG_OPTION_USE_WARPER]: Synchronize with `aflatin.c'.
2015-04-16 20:11:49 +02:00
Alexei Podtelezhnikov eae1b3e371 [autofit,pshinter] NULL. 2015-04-13 22:40:17 -04:00
Alexei Podtelezhnikov 67b912d2fa * src/autofit/afhints.c (af_glyph_hints_reload): Use do-while loop. 2015-04-03 22:38:11 -04:00
Alexei Podtelezhnikov 770b5d0647 * src/autofit/aflatin.c (af_latin_hint_edges): Reduce logic. 2015-04-02 23:15:36 -04:00
Alexei Podtelezhnikov 886f4d0493 [autofit] Finish the thought.
* src/autofit/afhints.c (af_direction_compute): make sure the long arm
is never negative so that its `FT_ABS' is not necessary.
2015-04-01 22:57:43 -04:00
Werner Lemberg a2fa657a03 [autofit] Call dumper functions for tracing.
* src/autofit/afcjk.c (af_cjk_hints_apply): Remove dead code.
* src/autofit/afhints.c (af_glyph_hints_dump_points): Minor
improvement.
* src/autofit/afmodule.c (af_autofitter_load_glyph): Implement it.
2015-04-01 15:55:41 +02:00
Werner Lemberg db8df797d0 [autofit] Make debugging stuff work again.
The interface to ftgrid was broken in the series of commits starting
with

  [autofit] Allocate AF_Loader on the stack instead of AF_Module.

from 2015-01-14.

* src/autofit/afmodule.c (_af_debug_hints_rec) [FT_DEBUG_AUTOFIT]:
Use a global AF_GlyphHintsRec object for debugging.
(af_autofitter_done, af_autofitter_load_glyph): Updated.

* src/autofit/afloader.c (af_loader_init, af_loader_done): Updated.
2015-04-01 13:30:55 +02:00
Werner Lemberg 16217e5f22 * src/autofit/afhints.c (af_glyph_hints_done): Fix minor thinko. 2015-04-01 13:13:56 +02:00
Alexei Podtelezhnikov dac5644cea [base] Optimize `FT_Angle_Diff'.
Under normal circumstances we are usually close to the desired range
of angle values, so that the remainder is not really necessary.

* src/base/fttrigon.c (FT_Angle_Diff): Use loops instead of remainder.

* src/autofit/aftypes.h (AF_ANGLE_DIFF): Ditto in the unused macro.
2015-03-21 23:30:16 -04:00
Werner Lemberg d3284462c3 [autofit] Add support for Arabic script.
Thanks to Titus Nemeth <tn@tntypography.eu> for guidance!

* src/autofit/afblue.dat: Add blue zone data for Arabic.

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

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

* src/autofit/afranges.c: Add Arabic data.

* src/autofit/afstyles.h: Add Arabic data.

* docs/CHANGES: Document it.
2015-03-11 16:45:58 +01:00
Werner Lemberg a374c9cfe7 [autofit] Fix Savannah bug #44241.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Reject glyphs
with less than 3 points.
2015-03-03 11:23:45 +01:00
Werner Lemberg a07029ef5f Simplify `TYPEOF' macro.
No need for two arguments.

* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h (TYPEOF): Updated.

* include/internal/ftobjs.h (FT_PAD_FLOOR, FT_PIX_FLOOR),
src/autofit/afwarp.h (AF_WARPER_FLOOR): Updated.
2015-03-02 06:54:08 +01:00
Werner Lemberg 851e815127 Various compiler warning fixes for `make multi'.
* src/autofit/afcjk.c (af_cjk_hints_compute_blue_edges),
src/autofit/aflatin.c (af_latin_hint_compute_blue_edges,
af_latin_hint_edges), src/autofit/aflatin2.c
(af_latin2_hints_compute_blue_edges, af_latin2_hint_edges): Declare
as `static'.

* src/cache/ftccmap.c (FTC_CMAP_QUERY_HASH, FTC_CMAP_NODE_HASH):
Removed.  Unused.
* src/cache/ftcimage.c: Include FT_INTERNAL_OBJECTS_H.
* src/cache/ftcmanag.c (FTC_LRU_GET_MANAGER): Removed.  Unused.

* src/cff/cf2intrp.c: Include `cf2intrp.h'.
* src/cff/cffdrivr.c (PAIR_TAG): Removed.  Unused.

* src/gzip/ftgzip.c (NO_DUMMY_DECL): Removed.  Unused.

* src/psaux/afmparse.c (afm_parser_read_int): Declare as `static'.

* src/pshinter/pshalgo.c (STRONGER, PSH_ZONE_MIN, PSH_ZONE_MAX):
Removed.  Unused.

* src/raster/ftraster.c (Render_Glyph): Declare as `static'.

* src/sfnt/ttpost.c (load_format_20): Fix signedness warning.

* src/truetype/ttdriver.c (PAIR_TAG): Removed.  Unused.
* src/truetype/ttsubpix.c (is_member_of_family_class,
is_member_of_style_class): Declare as `static'.

* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Declare
as `static'.
* src/type1/t1load.c (mm_axis_unmap, mm_weights_unmap): Declare as
`static'.
(T1_FIELD_COUNT): Removed.  Unused.
* src/type1/t1parse.h (T1_Done_Table): Removed.  Unused.

* src/type42/t42parse.c (T1_Done_Table): Removed.  Unused.
2015-03-01 19:27:09 +01:00
Werner Lemberg bd133c352e Minor typo. 2015-03-01 07:45:36 +01:00
Werner Lemberg b57bb11ad0 [autofit] Fix signedness issues.
* src/autofit/afangles.c, src/autofit/afcjk.c,
src/autofit/afglobal.c, src/autofit/afhints.c,
src/autofit/aflatin.c, src/autofit/aflatin2.c, src/autofit/afwarp.c,
src/autofit/hbshim.c: Apply.
2015-02-19 10:44:18 +01:00
Werner Lemberg 81e5ff53a8 [autofit] Use macros for (unsigned) flags, not enumerations.
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.
2015-02-19 09:46:48 +01:00
Werner Lemberg 6f325c26cf New `TYPEOF' macro.
This helps suppress signedness warnings, avoiding issues with
implicit conversion changes.

* include/config/ftconfig.h, builds/unix/ftconfig.in,
builds/vms/ftconfig.h (TYPEOF): Define.

* include/internal/ftobjs.h (FT_PAD_FLOOR, FT_PIX_FLOOR),
src/autofit/afwarp.h (AF_WARPER_FLOOR): Use it.
2015-02-16 11:31:32 +01:00
Werner Lemberg b6cb4997e8 [autofit] Fix potential memory leak.
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.
2015-02-06 08:46:06 +01:00
Werner Lemberg 19146a5302 [autofit] Add support for Thai script.
Thanks to Ben Mitchell <ben@rosettatype.com> for guidance with blue
zone characters!

* src/autofit/afblue.dat: Add blue zone data for Thai.

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

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

* src/autofit/afranges.c: Add Thai data.

* src/autofit/afstyles.h: Add Thai data.
2015-01-31 11:01:33 +01:00
Werner Lemberg f57fc59e01 Run `src/tools/update-copyright'. 2015-01-17 20:41:43 +01:00
Behdad Esfahbod 48c86628de * src/autofit/afmodule.c (af_autofitter_done): Fix compiler warning. 2015-01-14 19:38:36 +01:00
Behdad Esfahbod 56ddafa01c [autofit] Add embedded array of segments and edges.
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.
2015-01-14 19:36:02 +01:00
Behdad Esfahbod 6f16b10019 [autofit] Add embedded arrays for points and contours.
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.
2015-01-14 19:26:49 +01:00
Behdad Esfahbod c27336567b [autofit] Allocate hints object on the stack.
This avoids one malloc per load.

* src/autofit/afloader.h (AF_LoaderRec): Change type of `hints' to
`AF_GlyphHints'.
Update prototype.

* src/autofit/afloader.c (af_loader_init): Use `AF_GlyphHints'
parameter instead of `FT_Memory'.
(af_loader_done): Directly reset `load_hints'.
(af_loader_load_g): Updated.

* src/autofit/afmodule.c (af_autofitter_load_glyph): Use local
`hints' object.
2015-01-14 19:16:12 +01:00
Behdad Esfahbod a4117fbda7 [autofit] Reuse slot glyph loader.
No need to create a new glyph loader; we can reuse the one from
`slot->internal->loader'.  It's hard to tell why it was written that
way originally, but new code looks sound and correct to me, and
avoids lots of allocations.

* src/autofit/afloader.c (af_loader_init): Change return type to
`void'.
Don't call `FT_GlyphLoader_New'.
(af_loader_reset): Don't call `FT_GlyphLoader_Rewind'.
(af_loader_load_g): Update code to use `internal->loader', which
doesn't need copying of data.

* src/autofit/afloader.h (AF_LoaderRec): Remove `gloader' member.
Update prototype.

* src/autofit/afmodule.c (af_autofitter_load_glyph): Updated.
2015-01-14 19:07:54 +01:00
Behdad Esfahbod ae6699f86c [autofit] Remove (unused) support for composite glyphs.
We never have to deal with composite glyphs in the autohinter, as
those will be loaded into FORMAT_OUTLINE by the recursed
`FT_Load_Glyph' function.

In the rare cases that FT_LOAD_NO_RECURSE is set, it will imply
FT_LOAD_NO_SCALE as per `FT_Load_Glyph', which then implies
FT_LOAD_NO_HINTING:

  /* resolve load flags dependencies */

  if ( load_flags & FT_LOAD_NO_RECURSE )
    load_flags |= FT_LOAD_NO_SCALE         |
                  FT_LOAD_IGNORE_TRANSFORM;

  if ( load_flags & FT_LOAD_NO_SCALE )
  {
    load_flags |= FT_LOAD_NO_HINTING |
                  FT_LOAD_NO_BITMAP;

    load_flags &= ~FT_LOAD_RENDER;
  }

and as such the auto-hinter is never called.  Thus, the recursion in
`af_loader_load_g' never actually happens.  So remove the depth
counter as well.

* src/autofit/afloader.c (af_loader_load_g): Remove `depth'
parameter.
<FT_GLYPH_FORMAT_COMPOSITE>: Remove associated code.
(af_loader_load_glyph): Updated.
2015-01-14 18:55:39 +01:00
Behdad Esfahbod 89bc8d4de7 [autofit] Allocate AF_Loader on the stack instead of AF_Module.
Stop sharing a global `AF_Loader'.  Allocate one on the stack during
glyph load.

Right now this results in about 25% slowdown, to be fixed in a
following commit.

With this patch loading glyphs from different faces from different
threads doesn't immediately crash in the autohinting loader code.

Bugs:

  https://bugzilla.redhat.com/show_bug.cgi?id=1164941

* src/autofit/afloader.c (af_loader_init): Pass
`AF_Loader' and `FT_Memory' instead of `AF_Module' as arguments.
(af_loader_reset, af_loader_load_glyph): Also pass `loader' as
argument.
(af_loader_done): Use `AF_Loader' instead of `AF_Module' as
argument.

* src/autofit/afmodule.c (af_autofitter_init): Don't call
`af_loader_init'.
(af_autofitter_done): Don't call `af_loader_done'.
(af_autofitter_load_glyph): Use a local `AF_Loader' object.

* src/autofit/afloader.h: Include `afmodule.h'.
Update prototypes.
Move typedef for `AF_Module' to...

* src/autofit/afmodule.h: ... this place.
No longer include `afloader.h'.
2015-01-14 16:01:19 +01:00
Werner Lemberg 36d03c9f58 Fix Savannah bug #43976.
Assure that FreeType's internal include directories are found before
`CPPFLAGS' (which might be set by the user in the environment), and
`CPPFLAGS' before `CFLAGS'.

* builds/freetype.mk (FT_CFLAGS): Don't add `INCLUDE_FLAGS'.
(FT_COMPILE): Make this a special variable for compiling only the
files handled in `freetype.mk'.
(.c.$O): Removed, unused.

* src/*/rules.mk (*_COMPILE): Fix order of include directories.
2015-01-12 11:26:30 +01:00
Werner Lemberg 5018477f4e Minor. 2014-12-07 08:17:12 +01:00
Werner Lemberg a632b5f406 [autofit] Better fix for conversion specifiers in debug messages.
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'.
2014-12-03 19:30:44 +01:00
suzuki toshiya 9ee6a0a085 Fix compiler warning to conversion specifiers in debug messages.
* src/autofit/afhints.c (af_glyph_hints_dump_points): Add length
modifier to dump long integers.  (af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Ditto.
2014-11-28 11:14:18 +09:00
Werner Lemberg 02b8e7e8d7 */*: s/Invalid_Argument/Invalid_Size_Handle/ where appropriate. 2014-11-25 11:31:51 +01:00
Werner Lemberg 04edbbda3c */*: s/Invalid_Argument/Invalid_Face_Handle/ where appropriate. 2014-11-25 10:21:13 +01:00
Werner Lemberg 6689a009ce [Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.

* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
Alexei Podtelezhnikov 237c0abfdc Trailing space. 2014-11-19 22:10:29 -05:00
Werner Lemberg d8632a842e Improve comments, remove dead code. 2014-10-25 06:28:18 +02:00
Werner Lemberg c9c33f202e [autofit] Add blue-zone support for Telugu.
This essentially moves the Telugu script from the `Indic' hinter to
the `Latin' hinter.

Note that this is a first shot and quite certainly needs
refinements.

* src/autofit/afblue.dat: Add blue zone data for Telugu.

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

* src/autofit/afscript.h: Add Telugu standard characters and move
data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Telugu data out of
AF_CONFIG_OPTION_INDIC block.

* src/autofit/afstyles.h: Update Telugu data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2014-10-18 11:01:14 +02:00
Werner Lemberg 8f17809b2d [autofit] Adjust Devenagari character range.
* src/autofit/afranges.c (af_deva_uniranges): Omit characters that
are common to all other Indic scripts.
2014-10-14 08:28:09 +02:00
Werner Lemberg 5b68e4fb60 [autofit] Minor clean-ups.
* src/autofit/afhints.c (AF_FLAGS): Remove obsolete values.

* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_align_strong_points): Updated.

* src/autofit/aflatin.c (af_latin_hints_link_segments,
af_latin_hints_compute_segments), src/autofit/afcjk.c
(af_cjk_hints_link_segments), src/autofit/aflatin2.c
(af_latin2_hints_link_segments, af_latin2_hints_compute_segments):
There are no longer fake segments since more than 10 years...
2014-09-24 19:06:13 +02:00
Werner Lemberg 7a615283cb [autofit] Minor. 2014-09-22 08:38:00 +02:00
Werner Lemberg 387a9fe73d [autofit] Minor code streamlining.
* src/autofit/afhints.c (af_axis_hints_new_edge): Remove redundant
initialization.
2014-09-22 06:42:24 +02:00
Werner Lemberg 378266dc1a Formatting. 2014-09-22 06:33:38 +02:00
Werner Lemberg 231171fc3a Partially revert commit from 2014-06-13.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Move
declaration of `p_first' and `p_last' out of the loop.
2014-06-17 09:14:32 +02:00
Werner Lemberg e5c0fff5af Fix more compiler warnings.
Reported by Wojciech Mamrak <wmamrak@gmail.com>.

* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Make integer constant unsigned.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
<TT_SBIT_TABLE_TYPE_SBIX>: Fix types.
(tt_sbit_decoder_load_compound, tt_face_load_sbix_image): Add proper
casts.
2014-06-13 14:01:20 +02: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 d7f4594317 [autofit] Fix comment. 2014-05-13 15:33:11 +02:00
Werner Lemberg faa21472b7 [autofit] Fix variable initializations.
* src/autofit/afhints.c (af_glyph_hints_reload): Assign default
values to `in_dir' and `out_dir' for all points.
2014-05-11 12:44:00 +02:00
Werner Lemberg 07e7b8affe [autofit] Fix crash with font `CabinSketch-Bold.ttf'.
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.
2014-05-11 08:00:25 +02:00
Werner Lemberg 5f18a0c35d Formatting. 2014-05-01 17:26:52 +02:00
Werner Lemberg c576bb0d21 [autofit] Add blue-zone support for Devanagari.
This essentially moves the Devanagari script from the `Indic' hinter
to the `Latin' hinter.  Thanks to Girish Dalvi
<girish.dalvi@gmail.com> for guidance with blue zone characters!

* src/autofit/afblue.dat: Add blue zone data for Devanagari.

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

* src/autofit/afscript.h: Add Devanagari standard characters and
move data out of AF_CONFIG_OPTION_INDIC block.

* src/autofit/afranges.c: Move Devanagari data out of
AF_CONFIG_OPTION_INDIC block.
Move U+20B9, (new) Rupee sign, from Latin to Devanagari.

* src/autofit/afstyles.h: Update Devanagari data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2014-05-01 17:24:19 +02:00
Werner Lemberg 63bef9a588 [autofit] Fix handling of neutral blue zones in stems.
* src/autofit/afhints.h (AF_Edge_Flags): New value
`AF_EDGE_NEUTRAL'.

* src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Trace
neutral blue zones with AF_EDGE_NEUTRAL.
(af_latin_hint_edges): Skip neutral blue zones if necessary.
2014-05-01 07:16:05 +02:00
Werner Lemberg ccfc4b4c4e [autofit] Introduce neutral blue zones to the latin module.
Such blue zones match either the top or the bottom of a contour.  We
need them for scripts where accent-like elements directly touch the
base character (for example, some vowel signs in Devanagari, cf.
U+0913 or U+0914).

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_LATIN_NEUTRAL): New
property.

* src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.h (AF_LATIN_IS_NEUTRAL_BLUE): New macro.
(AF_LATIN_BLUE_NEUTRAL): New enumeration value.

* src/autofit/aflatin.c (af_latin_metrics_init_blues,
af_latin_hints_compute_blue_edges): Handle neutral blue zones.
2014-04-28 21:13:14 +02:00
Werner Lemberg abb3fcac85 * src/autofit/hbshim.c: Partially revert commit from 2014-04-17.
Using input glyph coverage data is simply wrong.

Problem reported by Nikolaus Waxweiler <madigens@gmail.com> and
Mantas Mikulėnas <grawity@gmail.com>.
2014-04-25 22:13:32 +02:00
Werner Lemberg 98e510ee94 [autofit] Fix Savannah bug #42148.
The adaptation of the cjk auto-hinter module to blue stringsets in
2013-08-25 had three severe bugs.  Mea culpa.

1. Contrary to the latin auto-hinter, characters for reference and
   overshoot values of a blue zone are specified separately.  Due to
   the screwed-up change it didn't work at all.

2. A boolean comparison was erroneously replaced with a cast,
   causing invalid results with the `^' operator later on.  The
   visual artifact caused by this problem is the topic of the bug
   report.

3. Two flag values were inverted, causing incorrect assignment of
   reference and overshoot values.

* src/autofit/afblue.dat: Fix CJK bluestrings, introducing a new
syntax to have both reference and overshoot characters in a single
string.  This is error #1.
Add extensive comments.

* src/autofit/afblue.hin (AF_BLUE_PROPERTY_CJK_FILL): Removed, no
longer used.
(AF_BLUE_PROPERTY_CJK_TOP, AF_BLUE_PROPERTY_CJK_HORIZ): Fix values.
This is error #3.

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

* src/autofit/afcjk.c (af_cjk_metrics_init_blues): Correct error #1.
Use character `|' to separate characters for reference and overshoot
values.
Improve tracing messages, synchronizing them with the latin
auto-hinter.
(af_cjk_hints_compute_blue_edges): Fix value of `is_top_right_blue'.
This is error #2.
(af_cjk_align_linked_edge): Add tracing message.

* src/autofit/afcjk.h (AF_CJK_IS_FILLED_BLUE): Removed, no longer
used.
2014-04-20 22:11:27 +02:00
Werner Lemberg 8c7fb78b16 [autofit] More coverage fixes for complex scripts.
* src/autofit/hbshim.c (af_get_coverage): Merge input glyph coverage
of GSUB lookups into output coverage.  Otherwise, ligatures are not
handled properly.
Don't check blue zone characters for default coverage.
2014-04-17 15:53:25 +02:00
Werner Lemberg 8b1f2a6cda [autofit] Improve coverage handling.
* src/autofit/hbshim.c (af_get_coverage): Don't exclude glyphs
appearing in the GPOS table if we are processing the default
coverage.
2014-04-14 07:58:19 +02:00
Werner Lemberg 8a94b1efd6 [autofit] Redesign the recognition algorithm of strong points.
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'.
2014-04-12 20:44:33 +02:00
Werner Lemberg 71f53e122b [autofit] Improve scoring algorithm for identifying stems.
Problem reported by Karsten Lücke <karsten.luecke@kltf.de>.

The new algorithm takes care of the width of stems: If the distance
between two segments is larger than the largest stem width, the
demerits quickly increase for larger distances.  This improves
hinting of slanted fonts (especially if the inner parts of serifs
have non-horizontal `shoulders'), avoiding false stem links.

* src/autofit/aflatin.c (af_latin_hints_link_segments): Use largest
stem width (if available) to compute better demerits for distances
between stems.
(af_latin_hints_detect_features): Pass stem width array and array
size.
(af_latin_metrics_init_widths): Updated to use original algorithm.
(af_latin_hints_apply): Updated to use new algorithm.

* src/autofit/aflatin.h: Updated.
* src/autofit/afcjk.c: Updated.
2014-04-05 16:27:19 +02:00
Werner Lemberg 87360a78f3 [aflatin] Improve comment. 2014-04-05 00:08:52 +02:00
Werner Lemberg cc7cf2c3d0 Partially revert last commit.
Found by Alexei.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initializing
those variables is plain wrong, since we are in a loop.
2014-03-19 07:35:35 +01:00
Sean McBride 87628724a9 Fix clang warnings.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
some variables.

* src/base/ftcalc.c (FT_MulFix): Only use code if
`FT_MULFIX_INLINED' is not defined.

* src/bdf/bdfdrivr.c (bdf_cmap_class), src/cache/ftcbasic.c
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class),
src/cache/ftccmap.c (ftc_cmap_cache_class), src/cache/ftcmanag.c
(ftc_size_list_class, ftc_face_list_class), src/pcf/pcfdrivr.c
(pcf_cmap_class), src/pfr/pfrdrivr.c (pfr_metrics_service_rec): Make
function static.

* src/type1/t1driver.c (t1_ps_get_font_value): Remove redundant
code.
2014-03-18 08:39:35 +01:00
Werner Lemberg 23367ff97f Fix Savannah bug #41869.
This works around a problem with HarfBuzz (<= 0.9.26), which doesn't
validate glyph indices returned by
`hb_ot_layout_lookup_collect_glyphs'.

* src/autofit/hbshim.c (af_get_coverage): Guard `idx'.

* docs/CHANGES: Updated.
2014-03-17 07:33:14 +01:00
Alan Coopersmith ed372b712f Fix cppcheck 1.64 warning.
* src/autofit/afglobal.c (af_face_globals_new): Catch NULL pointer
dereference in case of error.
2014-03-09 06:14:12 +01:00
Werner Lemberg 055653668f Fixes for compilation with C++.
* src/autofit/hbshim.c (scripts): Change type to `hb_script_t'.
(af_get_coverage): Updated.
(COVERAGE): Add cast.
2014-03-06 18:56:58 +01:00
Werner Lemberg 7ac76b50da Fix several clang static analyzer dead store warnings.
* src/autofit/afhints.c (af_glyph_hints_reload,
af_glyph_hints_align_weak_points): Remove unnecessary assignments.

* src/bdf/bdflib.c (bdf_font_load): Ditto.

* src/pshinter/pshalgo.c (psh_glyph_compute_extrema,
psh_glyph_interpolate_other_points): Ditto.

* src/type1/t1load.c (T1_Set_MM_Blend): Ditto.
2014-03-04 04:29:17 +01:00
suzuki toshiya 91c7a97b9b [autofit] Fix `make multi' compilation.
* src/hbshim.c: Include `afglobal.h' and `aftypes.h'.
2014-02-17 16:38:31 +09:00
Sean McBride 7be2a94a50 Fix clang static analyzer and compiler warnings.
* src/autofit/afhints.c (af_glyph_hints_align_weak_points),
src/autofit/afloader (af_loader_load_g) <FT_GLYPH_FORMAT_COMPOSITE>,
src/base/ftcalc.c (FT_MSB), src/base/ftoutln.c
(FT_Outline_Decompose), src/bdf/bdfdrivr.c (bdf_interpret_style),
src/cff/cffparse.c (cff_parse_integer), src/cid/cidparse.c
(cid_parser_new), src/pfr/pfrload.c (pfr_phy_font_load),
src/raster/ftraster.c (Decompose_Curve), src/sfnt/sfdriver.c
(sfnt_get_ps_name), src/sfnt/ttcmap.c (tt_cmap12_next,
tt_cmap13_next), src/smooth/ftgrays.c (gray_hline): Remove dead
code.

* src/autofit/afmodule.c (af_property_get_face_globals,
af_property_set, af_property_get), src/base/ftbitmap.c
(ft_gray_for_premultiplied_srgb_bgra): Make functions static.

* src/base/ftobjs.c (ft_remove_renderer): Protect against
library == NULL.
(ft_property_do): Make function static.

* src/base/ftrfork.c: Include `ftbase.h'.

* src/sfnt/ttsbit.c (tt_face_load_sbix_image)
[!FT_CONFIG_OPTION_USE_PNG], src/type1/t1gload.c
(T1_Compute_Max_Advance): Avoid compiler warning.

* src/truetype/ttinterp.c (TT_New_Context): Reduce scope of
variable.
2014-02-08 13:55:38 +01:00
Werner Lemberg a8772918a3 [autofit] Minor fix.
* src/autofit/afcjk.c (af_cjk_metrics_init_widths),
src/autofit/aflatin.c (af_latin_metrics_init_widths): Fix handling
of alternative standard characters.
This also fixes a compilation warning in non-debug mode.
2014-02-04 11:36:08 +01: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 eb7691cc3d Fix Savannah bug #41320.
* src/autofit/aflatin.c (af_latin_metrics_init_blues)
<AF_LATIN_IS_LONG_BLUE>: Avoid negative index of `last'.
2014-01-24 19:04:22 +01:00
Werner Lemberg ff8dc315d1 * src/autofit/hbshim.c (af_get_coverage): Fix memory leaks. 2014-01-22 09:19:57 +01:00
Werner Lemberg 6a700786ae [autofit] Improve tracing of style coverages.
* include/internal/fttrace.h: Add `afglobal' for tracing style
coverages.

* src/autofit/afglobal.c: Include FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
(af_face_globals_compute_style_coverage): Trace `gstyles' array
data.
2014-01-16 08:55:40 +01:00
Werner Lemberg 2b623fe4f6 Minor doc issues. 2014-01-15 09:46:23 +01:00
Werner Lemberg c46fa86bd5 [autofit] Fix Savannah bug #41138, part 1.
* src/tools/afblue.pl <Handling #endif>: Produce correct auxiliary
enumeration names for generated `#else'.

* src/autofit/afblue.h: Regenerated.
2014-01-08 08:45:40 +01:00
Werner Lemberg 991cbcce97 [autofit] Minor fixes for `afblue.pl'.
* src/tools/afblue.pl (aux_name): Don't use `reverse'.
<Handling #endif>: Use proper indentation for generated `#else'.

* src/autofit/afblue.h: Regenerated.
2014-01-05 13:24:56 +01:00
Werner Lemberg 0d97744d81 [autofit] Fix Indic scripts.
Split the single, incorrect Indic entry into separate scripts so
that the covered ranges are the same: Bengali, Devanagari, Gujarati,
Gurmukhi, Kannada, Limbu, Malayalam, Oriya, Sinhala, Sundanese,
Syloti Nagri, Tamil, Telugu, and Tibetan.  At the same time, remove
entries for Meetai Mayak and Sharada – the Unicode ranges were
incorrect (and nobody has complained about that), fonts are scarce
for those scripts, and the Indic auto-hinter support is rudimentary
anyways.

* src/autofit/afscript.h: Updated, using AF_CONFIG_OPTION_INDIC and
AF_CONFIG_OPTION_CJK.

* src/autofit/afstyles.h (STYLE_DEFAULT_INDIC): New auxiliary macro.
Use it, together with AF_CONFIG_OPTION_INDIC and
AF_CONFIG_OPTION_CJK, to update.

* src/autofit/afranges.c [AF_CONFIG_OPTION_INDIC]: Updated.
[!AF_CONFIG_OPTION_INDIC, !AF_CONFIG_OPTION_CJK]: Removed.
Sort entries by tags.
2014-01-04 11:46:34 +01:00
Werner Lemberg ecdb0e35c3 [autofit] Thinko.
* src/autofit/hbshim.c (af_get_char_index): Similar to
`af_get_coverage', reject glyphs which are not substituted.
2014-01-03 20:49:31 +01:00
Werner Lemberg 1b5bc89754 [autofit] Fix handling of default coverages.
With this commit, the implementation of coverage handling is
completed.

* src/autofit/hbshim.c (af_get_coverage): Exit early if nothing to
do.
Reject coverages which don't contain appropriate glyphs for blue
zones.
2014-01-03 18:33:24 +01:00
Werner Lemberg a42f918434 [autofit] Fix handling of default coverages.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
First handle non-default coverages, then the default coverage of the
default script, and finally the other default coverages.
2014-01-03 18:29:41 +01:00
Werner Lemberg f45749b05b [autofit] Fix scaling of HarfBuzz shaping.
* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
2014-01-03 18:09:36 +01:00
Werner Lemberg ea0367fbfe [autofit] Minor. 2014-01-03 18:06:45 +01:00
Werner Lemberg 5c7f5500e8 [autofit] Better ftgrid support.
* src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Add
parameters `is_blue' and `blue_offset'.
2014-01-03 10:48:26 +01:00
Werner Lemberg 55cd7e0a05 [autofit] Remove some styles.
* src/autofit/afcover.h: Remove coverages for alternative fractions,
denominators, numerators, and fractions.

* src/autofit/afstyles.h (META_STYLE_LATIN): Updated.
2014-01-02 13:07:48 +01:00
Werner Lemberg c973e67b5a [autofit] Add more styles.
* src/autofit/afstyles.h (STYLE_LATIN, META_STYLE_LATIN): New
auxiliary macros; use them to define styles for Cyrillic, Greek, and
Latin.

* src/autofit/afcover.h: Remove coverage for oldstyle figures.
Since those digits are used in combination with ordinary letters, it
makes no sense to handle them separately.

* src/autofit/afglobal.c (af_face_globals_get_metrics): Don't limit
`options' parameter to 4 bits.
2014-01-01 16:34:42 +01:00
Werner Lemberg abb2f73054 [autofit] Fix style assignments to glyphs.
* src/autofit/hbshim.c (af_get_coverage)
[FT_CONFIG_OPTION_USE_HARFBUZZ]: Scan GPOS coverage of features also
so that we can skip glyphs that have both GSUB and GPOS data.
2014-01-01 08:00:16 +01:00
Werner Lemberg 0950f3a50e * src/autofit/hbshim.c: s/{lookups,glyphs}/gsub_{lookups,glyphs}/. 2014-01-01 07:48:20 +01:00
Werner Lemberg 73cc8330ed [autofit] Implement and use `af_get_char_index' with HarfBuzz.
* src/autofit/hbshim.c (COVERAGE) [FT_CONFIG_OPTION_USE_HARFBUZZ]:
Redefine to construct HarfBuzz features.
(af_get_char_index) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Rewritten.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Use
`y_offset' to adjust `best_y'.
2014-01-01 07:10:36 +01:00
Werner Lemberg 785f38573b [autofit] s/AF_STYLE_...._DEFAULT/AF_STYLE_...._DFLT/i. 2013-12-31 09:45:10 +01:00
Werner Lemberg c9d9947c68 [autofit] Fix interface of `af_get_char_index'.
* src/autofit/hbshim.c (af_get_char_index): Return error value.
Add argument for y offset (to be used in a yet-to-come patch).

* src/autofit/hbshim.h, src/autofit/afcjk.c,
src/autofit/aflatin.c: Updated.
2013-12-31 08:16:57 +01:00
Werner Lemberg 44aa7e0af5 [autofit] Don't combine multiple features into one set.
Combining them, as originally envisioned, would lead to much more
complicated code, as investigations have shown meanwhile.  The major
drawback is that we run out of available style slots much earlier.
However, this is only a theoretical issue since we don't support a
large number of scripts currently.

* src/autofit/afcover.h: Replace `COVERAGE_{1,2,3}' macros with
a single-element `COVERAGE' macro, sort the elements by the feature
tags, and add entry for `ruby'.

* src/autofit/aftypes.h: Updated.
* src/autofit/hbshim.c: Updated.
2013-12-30 07:41:22 +01:00
Werner Lemberg 072dc45d27 [autofit] Code shuffling to reduce use of cpp macros.
* src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
Call `af_get_coverage' unconditionally.

* src/autofit/autofit.c: Include `hbshim.c' unconditionally.

* src/autofit/hbshim.c (af_get_coverage)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Provide dummy function.

* src/autofit/hbshim.h: Provide function declarations
unconditionally.
2013-12-28 12:26:21 +01:00
Werner Lemberg 17af586e05 [autofit] Add wrapper function for `FT_Get_Char_Index'.
Yet-to-come changes will provide HarfBuzz functionality for the new
function.

* src/autofit/hbshim.c (af_get_char_index): New function.
* src/autofit/hbshim.h: Updated.

* 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.
2013-12-28 10:33:01 +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 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 3bf60950f7 [autofit] Make PIC mode work actually.
* src/autofit/afpic.h (AFModulePIC): Fix array sizes to fit the
enumeration values automatically generated by including `afscript.h'
and friends.

* src/autofit/afpic.c (autofit_module_class_pic_init): Updated.
2013-12-21 08:49:11 +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 4593062207 [autofit] Minor. 2013-12-19 15:24:39 +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 115de7131d [autofit] Minor. 2013-12-18 16:06:09 +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 7a5fc2f362 [autofit] s/AF_Script_/AF_WritingSystem_/ where appropriate. 2013-12-17 13:29:53 +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 52166ab0a7 [autofit] Fix use of dumping functions in `ftgrid' demo program.
* src/autofit/afhints.c (AF_DUMP) [FT_DEBUG_AUTOFIT]: New macro.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges) [FT_DEBUG_AUTOFIT]: Add parameter to
handle output to stdout.
Use AF_DUMP.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges) [!FT_DEBUG_AUTOFIT]: Removed.
2013-11-27 10:10:16 +01:00
Werner Lemberg 75efc2d0bd [autofit] s/SMALL_TOP/X_HEIGHT/.
* src/autofit/afblue.dat: Updated.

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

* src/autofit/aflatin.c, src/autofit/aflatin.h,
src/autofit/atlatin2.c: Updated.
2013-10-19 21:46:03 +02:00
Werner Lemberg 34efe05ce0 * src/autofit/afblue.dat: s/MINOR/DESCENDER/.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2013-10-19 21:14:40 +02: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 955f6a86a3 [autofit] Improve tracing message for extra light flag.
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Do it.
2013-10-16 19:47:57 +02:00
Werner Lemberg b6695243b7 [autofit] Improve tracing of `latin' hinter.
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Report blue
zone types.
(af_latin_metrics_scale_dim): Report scaling changes due to x height
alignment.
Report scaled stroke width and blue zone values.
2013-10-12 10:33:04 +02:00
Werner Lemberg 4f9760e752 [autofit] Remove outdated comment. 2013-09-25 23:32:25 +02:00
Werner Lemberg b75a8b8817 * src/autofit/aflatin.c (af_{grek,cyrl}_uniranges): Fix arrays. 2013-09-25 09:46:36 +02:00
Werner Lemberg 4de7787f22 Fix Savannah bug #40090.
* src/autofit/afcjk.c (af_cjk_metrics_scale): Revert commit
306f8c5d (from 2013-08-25) affecting this function.
2013-09-23 22:10:08 +02:00
Werner Lemberg 5a4c5a5b23 [autofit] Disunify Cyrillic and Greek handling from Latin.
* src/autofit/afscript.h: Add Cyrillic and Greek.

* src/autofit/afblue.dat (AF_BLUE_STRINGSET_GREK,
AF_BLUE_STRINGSET_CYRL): Add blue zones for Greek and Cyrillic.
(AF_BLUE_STRINGSET_LATN): Fix typo.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/aflatin.c (af_grek_uniranges, af_cyrl_uniranges): New
arrays.
(af_grek_script_class, af_cyrl_script_class): New scripts.
* src/autofit/aflatin.h: Updated.
2013-09-22 22:37:26 +02:00