Commit Graph

655 Commits

Author SHA1 Message Date
Sascha Brawer d19859f16f [autofit] Add support for Kayah Li script.
* src/autofit/afblue.dat: Add blue zone data for Kayah Li.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Kayah Li standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Kayah Li data.
2017-05-10 23:38:05 +02:00
Sascha Brawer 87218c9950 [autofit] Add support for Bamum script.
* src/autofit/afblue.dat: Add blue zone data for Bamum.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Bamum standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Bamum data.
2017-05-10 12:39:33 +02:00
Sascha Brawer 4aa1aec1a3 [autofit] Add support for Saurashtra script.
* src/autofit/afblue.dat: Add blue zone data for Saurashtra.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Saurashtra standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Saurashtra
data.
2017-05-10 09:36:13 +02:00
Werner Lemberg 53f3824452 [autofit] Add support for Buhid script.
* src/autofit/afblue.dat: Add blue zone data for Buhid.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Buhid standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Buhid data.
2017-05-10 09:13:20 +02:00
Sascha Brawer 44c6117ea7 [autofit] Add support for Shavian script.
* src/autofit/afblue.dat: Add blue zone data for Shavian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Shavian standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Shavian data.
2017-05-08 20:31:52 +02:00
Sascha Brawer a9e5e6e5b6 [autofit] Add support for Vai script.
* src/autofit/afblue.dat: Add blue zone data for Vai.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Vai standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Vai data.
2017-05-08 19:57:16 +02:00
Sascha Brawer acc6b6dff8 [autofit] Add support for Osmanya script.
* src/autofit/afblue.dat: Add blue zone data for Osmanya.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Osmanya standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Osmanya data.
2017-05-08 15:08:46 +02:00
Sascha Brawer f27ebb1ec4 [autofit] Add support for Coptic script.
* src/autofit/afblue.dat: Add blue zone data for Coptic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Coptic standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Coptic data.
2017-05-08 10:22:26 +02:00
Sascha Brawer db0fe73331 [autofit] Add support for Carian script.
* src/autofit/afblue.dat: Add blue zone data for Carian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Carian standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Carian data.
2017-05-08 10:00:16 +02:00
Sascha Brawer c9e7063a01 [autofit] Add support for Unified Canadian Syllabics script.
* src/autofit/afblue.dat: Add blue zone data for Unified Canadian
Syllabics.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Unified Canadian Syllabics standard
character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Unified
Canadian Syllabics data.
2017-05-03 23:21:13 +02:00
Sascha Brawer 0483fb3861 [autofit] Add blue-zone support for Sundanese script.
This essentially moves the Sundanese script from the `Indic' hinter
to the `Latin' hinter.

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

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

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

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

* src/autofit/afstyles.h: Update Sundanese data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2017-05-03 20:16:24 +02:00
Sascha Brawer 14ae17a25f [autofit] Add support for Avestan script.
* src/autofit/afblue.dat: Add blue zone data for Avestan.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Avestan standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Avestan data.
2017-05-03 18:35:13 +02:00
Werner Lemberg ba40054c2d [autofit] Remove `slight' auto-hint mode again.
A poll on freetype-devel favoured changes directly applied to
`light'.

* include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT,
FT_RENDER_MODE_SLIGHT): Removed.

* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2.c
(af_latin2_hints_init): Revert change from 2017-04-22.

* src/autofit/afloader.c (af_loader_load_glyph) Remove references to
FT_RENDER_MODE_SLIGHT.
[AF_CONFIG_OPTION_TT_SIZE_METRICS]: Enable TrueType-like metrics
unconditionally.

* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Revert change from
2017-04-22.

* src/base/ftobjs.c (FT_Load_Glyph): Revert change from 2017-04-22.

* src/pshinter/pshalgo.c (ps_hints_apply): Revert change from
2017-04-22.

* src/smooth/ftsmooth.c (ft_smooth_render): Revert change from
2017-04-22.

* docs/CHANGES: Updated.
2017-05-02 12:32:19 +02:00
Werner Lemberg 0a5315d141 Introduce AF_CONFIG_OPTION_TT_SIZE_METRICS configuration option.
* include/freetype/config/ftoption.h
(AF_CONFIG_OPTION_TT_SIZE_METRICS): New option, commented out by
default.

* src/autofit/afloader.c (af_loader_load_glyph): Use
AF_CONFIG_OPTION_TT_SIZE_METRICS to guard the corresponding code.
2017-04-27 13:02:24 +02:00
Werner Lemberg 5aa6716a5e Add new `slight' auto-hinting mode.
This mode uses fractional advance widths and doesn't scale glyphs
horizontally, only applying vertical scaling and hinting.

At the same time, the behaviour of the `light' auto-hinter gets
restored for backwards compatibility: Both vertical and horizontal
scaling is again based on rounded metrics values (this was changed
in a commit from 2017-03-30 as a side effect).  To be more precise,
the behaviour is restored for TrueType fonts only; for other font
formats like Type 1, this is a new feature of the `light' hinting
mode.

* include/freetype/freetype.h (FT_LOAD_TARGET_SLIGHT): New macro.
(FT_RENDER_MODE_SLIGHT): New render mode.

* include/freetype/internal/ftobjs.h (FT_Size_InternalRec): Add
`autohint_mode' and `autohint_metrics' fields.

* src/autofit/afcjk.c (af_cjk_hints_init), src/autofit/aflatin.c
(af_latin_hints_init), src/autofit/aflatin2 (af_latin2_hints_init):
Updated.

* src/autofit/afloader.c (af_loader_embolden_glyph_in_slot): Use
`autohint_metrics'.
(af_loader_load_glyph): s/internal/slot_internal/.
Initialize `autohint_metrics' and `autohint_mode' depending on
current auto-hint mode.
Use `autohint_metrics'.
Updated.

* src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Updated.

* src/base/ftobjs.c (FT_Load_Glyph): Updated.
(FT_New_Size): Allocate `internal' object.

* src/pshinter/pshalgo.c (ps_hints_apply): Updated.

* src/smooth/ftsmooth.c (ft_smooth_render): Updated.
2017-04-26 11:39:53 +02:00
Werner Lemberg 90ccab3d78 [autofit] Add support for Old Turkic script.
* src/autofit/afblue.dat: Add blue zone data for Old Turkic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Old Turkic standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Old Turkic data.
2017-04-08 17:58:57 +02:00
Sascha Brawer df2a7cd198 [autofit] Add support for Gothic script.
* src/autofit/afblue.dat: Add blue zone data for Gothic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Gothic data.
2017-04-08 16:11:44 +02:00
Sascha Brawer 5bf4b1aaf7 [autofit] Add support for Cypriot script.
* src/autofit/afblue.dat: Add blue zone data for Cypriot.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Cypriot data.
2017-04-08 11:38:52 +02:00
Sascha Brawer d79fc79422 [autofit] Add support for Deseret script.
* src/autofit/afblue.dat: Add blue zone data for Deseret.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Deseret data.
2017-04-08 07:06:24 +02:00
Werner Lemberg 32efd8c008 [autofit] Fix invalid character range description (#50745).
Also reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1034

* src/autofit/afranges.c (af_glag_nonbase_uniranges): Fix typo in
recent commit.
2017-04-07 17:22:59 +02:00
Sascha Brawer 2c256e6dac [autofit] Add support for Lisu script.
* src/autofit/afblue.dat: Add blue zone data for Lisu.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Lisu data.
2017-04-06 17:05:47 +02:00
Sascha Brawer 2b9114765a [autofit] Add support for Osage script.
* src/autofit/afblue.dat: Add blue zone data for Osage.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Osage data.
2017-04-06 16:49:39 +02:00
Sascha Brawer 628e2850b2 [autofit] Add support for Glagolitic script.
* src/autofit/afblue.dat: Add blue zone data for Glagolitic.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Glagolitic data.
2017-04-06 12:47:27 +02:00
Sascha Brawer 6967eb93f8 [autofit] Add support for Tai Viet script.
* src/autofit/afblue.dat: Add blue zone data for Tai Viet.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Tai Viet standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Tai Viet data.
2017-04-06 11:35:07 +02:00
Sascha Brawer 837f112566 [autofit] Add support for Tifinagh script.
* src/autofit/afblue.dat: Add blue zone data for Tifinagh.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Tifinagh data.
2017-04-06 08:44:08 +02:00
Sascha Brawer 134246b72b [autofit] Add support for N'Ko script.
* src/autofit/afblue.dat: Add blue zone data for N'Ko.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add N'Ko standard characters.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add N'Ko data.
2017-04-06 07:06:32 +02:00
Sascha Brawer ba9cee479a [autofit] Add support for Adlam script.
* src/autofit/afblue.dat: Add blue zone data for Adlam.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Adlam data.
2017-04-06 05:50:44 +02:00
Sascha Brawer 8210ee4b69 [autofit] Add support for Ol Chiki script.
* src/autofit/afblue.dat: Add blue zone data for Ol Chiki.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Ol Chiki standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Ol Chiki data.
2017-04-06 05:39:51 +02:00
Alexei Podtelezhnikov e7b013044e [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'.
* src/autofit/aflatin.c (af_latin_hints_init): Updated.
* src/autofit/aflatin2.c (af_latin2_hints_init): Ditto.
2017-04-02 22:01:47 -04:00
Alexei Podtelezhnikov 54b58097ee [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'.
* include/freetype/freetype.h (FT_LOAD_TARGET_LCD): Document it.
* src/autofit/afcjk.c (af_cjk_hints_init): Updated.
* src/autofit/aflatin.c (af_latin_hints_init): Ditto.
* src/autofit/aflatin2.c (af_latin2_hints_init): Ditto.
2017-03-31 22:41:53 -04:00
Werner Lemberg 9931175dcc Improve `make multi'.
* src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2.

* src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH.

* src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM.

* src/sfnt/pngshim.c: Guard file with
TT_CONFIG_OPTION_EMBEDDED_BITMAPS also.

* src/sfnt/ttbdf.c: Avoid empty source file.
* src/sfnt/ttpost.c: Guard file with
TT_CONFIG_OPTION_POSTSCRIPT_NAMES.
* src/sfnt/ttsbit.c: Guard file with
TT_CONFIG_OPTION_EMBEDDED_BITMAPS.

* src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty
source file.

* src/truetype/ttsubpix.c: Guard file with
TT_USE_BYTECODE_INTERPRETER also.

* src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM.

* src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c,
src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c,
src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c,
src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c,
src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c,
src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort
entries.
2017-03-18 07:06:49 +01:00
Werner Lemberg d5bfa053f5 Fixes for conditional compilation.
* src/autofit/afcjk.c, src/autofit/afindic.c: Include `afcjk.h'
earlier.

* src/sfnt/sfobjs.c (sfnt_init_face): Put `memory' variable into
TT_CONFIG_OPTION_GX_VAR_SUPPORT block.
(sfnt_done_face): Protect some code with
TT_CONFIG_OPTION_GX_VAR_SUPPORT.

* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Remove compiler
warning.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Put `tmp' variable
into TT_USE_BYTECODE_INTERPRETER block.

(tt_loader_init): Put `error' variable into
TT_USE_BYTECODE_INTERPRETER block.
2017-03-17 21:47:54 +01:00
Werner Lemberg 981c23b75e Remove clang compiler warnings (#50548).
* include/freetype/internal/tttypes.h (TT_FaceRec): Make
`var_postscript_prefix_len' unsigned.

* src/autofit/afwarp.c (af_warper_compute_line_best): Remove
redundant assignment.

* src/cff/cffload.c (cff_subfont_load): Add casts.

* src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment.

* src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static'
keyword.
Add casts.
(fixed2float): Add cast.
(sfnt_get_var_ps_name): Make `p' always initialized.
Add casts.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.
2017-03-15 11:35:26 +01:00
Werner Lemberg 467b026cd5 Remove clang warnings.
* src/autofit/aflatin.c (af_latin_sort_blue): Add missing `static'
keyword.

* src/base/ftmm.c (FT_Set_Var_Design_Coordinates,
FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates):
Initialize some variables.
2017-02-18 10:42:48 +01:00
Nikolaus Waxweiler 2b0ac18990 Add face property for stem darkening.
* include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New
macro.

* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add
`no_stem_darkening' field.

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

* src/base/ftobjs.c: Include FT_AUTOHINTER_H.
(ft_open_face_internal): Updated.
(FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING.

* src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated.

* src/cff/cffdrivr.c (cff_property_set): Updated.
2017-02-18 10:42:23 +01:00
Werner Lemberg 319125d4c2 [autofit] Prevent overlapping blue zones.
Problem reported as

  https://github.com/google/fonts/issues/632

The font in question (Nunito) has values 705 and 713 for the
reference and overshoot values, respectively, of the first blue
zone.  Blue zone 2, however, has value 710 for both the reference
and overshoot.  At 12ppem, reference and overshoot of blue zone 0
becomes 8px, while blue zone 2 becomes 9px.

A peculiarity of this font is that the tops of isolated vertical
stems like `N' have a slight overshoot also.  The auto-hinter tries
to find the nearest blue zone using the *original* coordinates.  For
vertical stems, this is value 713.  For normal horizontal tops like
in character `E', this is value 710.  Since value 713 is mapped to
8px but value 710 to 9px, `N' and similar characters are one pixel
higher than `E', which looks very bad.

This commit sanitizes blue zones to avoid such a behaviour.

* src/autofit/aflatin.c (af_latin_sort_blue): New function.
(af_latin_metrics_init_blues): Sort blue values and remove overlaps.
2017-02-13 09:34:17 +01:00
Werner Lemberg 1dee4bf9f7 [autofit] Use better blue zone characters for lowercase latin.
The number of lowercase characters for computing the top flat blue
zone value was too small (in most cases only `x' and `z').  If one
of the two characters has a large serif, say, it can happen that
FreeType must select between two different values, having a 50%
chance to use the wrong one.  As a result, rendering at larger PPEM
values could yield uneven lowercase glyph heights.

Problem reported by Christoph Koeberlin <christoph@koe.berlin>.

* src/autofit/afblue.dat (AF_BLUE_STRING_LATIN_SMALL): Replaced
with...
(AF_BLUE_STRING_LATIN_SMALL_TOP, AF_BLUE_STRING_LATIN_SMALL_BOTTOM):
... New, extended sets.
(AF_BLUE_STRINGSET_LATN): Updated.

* src/autofit/afblue.c, scr/autofit/afblue.h: Regenerated.
2017-02-05 08:33:10 +01:00
Werner Lemberg 68a738db83 Comments. 2017-02-03 21:32:21 +01:00
Werner Lemberg 0a1169f7c3 * src/autofit/afglobal.c (af_face_globals_free): Erase useless code. 2017-02-03 19:38:20 +01:00
Werner Lemberg dadc50a467 Make compilation with FT_CONFIG_OPTION_PIC work again.
All code committed here is guarded with `FT_CONFIG_OPTION_PIC'.

* include/freetype/internal/services/svmetric.h
(FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon.

* src/autofit/aflatin.c (af_latin_hints_compute_edges,
af_latin_hint_edges): Provide `globals' variable.

* src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing
variable.

* src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET,
AF_STYLE_CLASSES_GET): Redefine.

* src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo.

* src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it.

* src/cff/cffpic.h (CffModulePIC): Fix typo.
2017-02-02 07:13:29 +01:00
Werner Lemberg 31f8055390 [autofit] Avoid uninitialized jumps (#50191).
* src/autofit/afcjk.c (af_cjk_metrics_check_digits),
src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize
`advance'.
2017-01-31 08:10:04 +01:00
Werner Lemberg d66c3645fc Minor: Use `FT_ERR' macro. 2017-01-25 12:53:06 +01:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg 84b0d9927b */*: Use `0.5f' for tracing 16.16 numbers. 2016-12-29 10:38:51 +01:00
Werner Lemberg 4441f7b246 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.
Other minor formatting.
2016-12-26 17:08:17 +01:00
Werner Lemberg d44daf9e9b * src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Thinko.
Don't apply deltas twice for non-phantom points.

Spotted by Ben Wagner.
2016-12-21 23:03:48 +01:00
Oleksandr Chekhovskyi 255828c891 [autofit] Fix Emscripten crash (patch #9180).
Function calls through pointers must use a matching signature to
work on Emscripten, since such calls are dispatched through lookup
tables grouped by signature.

* src/autofit/aftypes.h (AF_WritingSystem_ApplyHintsFunc): Fix
typedef.
2016-12-01 07:07:22 +01:00
Nikolaus Waxweiler b37b799c56 [autofit] Code shuffling.
Also improve some comments and remove unused code.

No functional change.

* src/autofit/afloader.c (af_loader_load_g): Merged with...
(af_loader_load_glyph): ...this function.
Split off emboldening code into...
(af_loader_embolden_glyph_in_slot): ... this function.
2016-11-27 16:30:53 +01:00
Werner Lemberg 48c77da382 Add minor comment to avoid confusion (#19044). 2016-11-17 07:37:50 +01:00
Werner Lemberg 2f2e73c50c [autofit] Tracing fixes.
* src/autofit/afmodule.c (af_autofitter_load_glyph): Call dumping
functions only if we actually do tracing.
2016-09-24 22:42:58 +02:00
Werner Lemberg c95b7652d8 s/0/NULL/ for function pointers; comments, formatting. 2016-09-17 17:12:50 +02:00
Werner Lemberg 9749f269e2 [autofit] Another improvement to Armenian support.
Suggested by Hrant H Papazian <hpapazian@gmail.com>.

* src/autofit/afscript.h: Use better suited characters to derive
default stem widths.
2016-09-08 07:51:03 +02:00
Werner Lemberg c9adf1a14d [autofit] Improve Armenian support.
Thanks to Hrant H Papazian <hpapazian@gmail.com> for help.

* src/autofit/afblue.dat (AF_BLUE_STRING_ARMENIAN_*): Improve
selection of characters.

* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2016-09-05 07:32:37 +02:00
Werner Lemberg d9c7f5aa6e * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor.
No functional change.
2016-07-26 20:20:27 +02:00
Werner Lemberg aafff57428 * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko.
`max_pos' is always larger than `min_pos' so `FT_ABS' is not needed.

Reported by Alexei.
2016-07-16 06:41:39 +02:00
Werner Lemberg 1831e6f068 [autofit] Update and improve segment and edge tracing.
* 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.
2016-07-15 10:35:32 +02:00
Werner Lemberg 894c0228ca [autofit] For edges, reject segments wider than 1px (#41334).
* src/autofit/afhints.h (AF_SegmentRec): New member `delta'.

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Compute
`delta'.
(af_latin_hints_compute_edges): Reject segments with a delta larger
than 0.5px.
2016-07-15 10:23:11 +02:00
Werner Lemberg 605946af6d Conditionally compile environment support.
* include/freetype/internal/ftobjs.h, src/autofit/afmodule.c,
src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c:
Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where
necessary.
2016-07-11 16:14:36 +02:00
Werner Lemberg 8f8ae8c52d Handle properties in `FREETYPE_PROPERTIES' environment variable.
This commit covers the most important one.

* src/autofit/afmodule.c (af_property_set): Handle `warping',
`darkening-parameters', and `no-stem-darkening'.

* src/cff/cffdrivr.c (cff_property_set): Handle
`darkening-parameters', `hinting-engine', and `no-stem-darkening'.

* src/truetype/ttdriver.c (tt_property_set): Handle
`interpreter-version'.
2016-07-11 15:11:38 +02:00
Werner Lemberg c3beb30a21 Add function `ft_property_string_set'.
This is a preparation for handling an `FREETYPE_PROPERTIES'
environment variable to control (some) driver properties.

No change in functionality.

* src/base/ftobjs.c (ft_property_do): Add `value_is_string'
parameter.
(ft_property_string_set): New function.
(FT_Property_Set, FT_Property_Get): Updated.

* include/freetype/internal/ftobjs.h: Updated.

* include/freetype/internal/services/svprop.h
(FT_Properties_SetFunc): Add `value_is_string' parameter.

* src/autofit/afmodule.c (af_property_set), src/cff/cffdrivr.c
(cff_property_set), src/truetype/ttdriver.c (tt_property_set):
Updated, emitting an error currently if `value_is_string' is set.
2016-07-10 07:11:45 +02:00
Werner Lemberg 5e353f0786 [autofit] Handle single-point contours as segments.
Doing so allows us to link them to edges – some fonts like
`NotoSansGurmukhi-Regular' have such isolated points sitting exactly
on other outlines.

* src/autofit/aflatin.c (af_latin_hints_compute_segments): Don't
ignore one-point contours but handle them specially as one-point
segments.
(af_latin_hints_compute_edges): Append one-point segments to edges
if possible.
2016-07-04 14:59:22 +02:00
Werner Lemberg 8b8c4408dd [autofit] Remove unused structure members.
* src/autofit/afhints.h (AF_SegmentRec, AF_EdgeRec): Remove
`num_linked'.

* src/autofit/afcjk.c (af_cjk_hints_link_segments): Updated.
2016-07-02 18:35:50 +02:00
Werner Lemberg aab2b8d83e [autofit] Update to Unicode 9.0.0.
* src/autofit/afranges.c (af_arab_nonbase_uniranges,
af_cyrl_uniranges): Add new data.
2016-07-02 08:37:44 +02:00
Werner Lemberg 05a55a56e2 [autofit] Add support for Cherokee script.
* src/autofit/afblue.dat: Add blue zone data for Cherokee.

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

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

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

* src/autofit/afstyles.h: Add Cherokee data.
2016-06-13 12:16:45 +02:00
Werner Lemberg 223d002c63 [autofit] Add support for Ethiopic script.
* src/autofit/afblue.dat: Add blue zone data for Ethiopic.

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

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

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

* src/autofit/afstyles.h: Add Ethiopic data.
2016-06-07 13:52:14 +02:00
Werner Lemberg 15eab36340 [autofit] Fix compilation with VS2016 (#48126).
This compiler doesn't recognize the end-of-comment sequence `*/' if
it immediately follows non-ASCII characters.

* src/autofit/afscript.h: Ensure whitespace before `*/'.
2016-06-07 10:36:27 +02:00
Werner Lemberg 46d36904b0 * src/autofit/afranges.c: Remove `UL' postfix from hex numbers.
Suggested by Alexei.  `UL' is only needed for 16bit compilers, but
it seems noone is using this anymore (and we no longer test whether
FreeType compiles in such an environment).  Otherwise, it is easy to
add the postfix to the `AF_UNICODE_RANGE' macro.
2016-05-28 19:38:43 +02:00
Werner Lemberg e97918c57b [autofit] Fixes for Armenian and Gujarati ranges.
* src/autofit/afranges.c (af_armn_uniranges): Corrected.
(af_guru_nonbase_uniranges): Make U+0A3E a base character.
2016-05-25 07:13:29 +02:00
Werner Lemberg 1dcda70ef9 [autofit] Ordering, whitespace. 2016-05-24 23:10:44 +02:00
Werner Lemberg a74f40f9e7 [autofit] Add support for Armenian script.
* src/autofit/afblue.dat: Add blue zone data for Armenian.

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

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

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

* src/autofit/afstyles.h: Add Armenian data.
2016-05-24 18:27:18 +02:00
Werner Lemberg 9d179e3d70 [autofit] Add blue-zone support for Gurmukhi script.
This essentially moves the Gurmukhi script from the `Indic' hinter to
the `Latin' hinter.

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

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

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

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

* src/autofit/afstyles.h: Update Gurmukhi data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-05-22 08:38:41 +02:00
Werner Lemberg 22167629d1 [autofit] Add blue-zone support for Gujarati script.
This essentially moves the Gujarati script from the `Indic' hinter to
the `Latin' hinter.

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

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

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

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

* src/autofit/afstyles.h: Update Gujarati data; in particular, use
AF_WRITING_SYSTEM_LATIN.
2016-04-25 21:18:24 +02:00
Werner Lemberg 80afef8bd6 [autofit] Improve Georgian blue zone characters.
Suggested by Akaki Razmadze <razmadzekoko@gmail.com>.

* src/autofit/afblue.dat (AF_BLUE_STRING_GEORGIAN_MKHEDRULI_BOTTOM):
Updated.

* src/autofit/afblue.c: Regenerated.
2016-04-23 21:34:15 +02:00
Werner Lemberg c8c7ad7910 [autofit] Add support for Georgian scripts.
Georgian is problematic, since `uppercase' forms of Mkhedruli
(called Mtavruli) are not yet defined in Unicode, which means that
proper blue zones can't be defined.  However, there is already a
proposal submitted to Unicode; see

  http://www.unicode.org/L2/L2016/16034-n4707-georgian.pdf

Additionally, due to historical reasons, Unicode treats Khutsuri as
the same script as Mkhedruli, and so does OpenType.  However, since
the two scripts have completely different shapes it can happen that
blue zones differ considerably.  The tag `geok' used here (derived
from ISO 15924) to differentiate the two scripts is not an OpenType
tag in use.  If we now have a font that contains both glyphs for
Mkhedruli and Khutsuri, and it uses OpenType features for both also,
HarfBuzz unavoidably treats all glyphs as `geor'.  As a consequence,
blue zones for `geok' are not used for glyphs involved in the
OpenType features.

An issue not yet resolved is which OpenType feature should be used
to access Mtavruli glyph shapes; right now, FreeType doesn't set up
support for them, but it is easy to add them later on as soon as
more information is available.

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

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

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

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

* src/autofit/afstyles.h: Add Georgian data.
2016-04-09 08:24:00 +02:00
Alexei Podtelezhnikov e85422606d Typos. 2016-04-08 23:21:34 -04:00
Werner Lemberg bf8f100d2c [autofit] Provide dummy blue zone for pseudo script `none'.
Even if the dummy hinter is used as the handler for `none' (which
doesn't use blue zones), it is more consistent than the old value
(which was 0), pointing to Arabic...

* src/autofit/afblue.dat: Add `AF_BLUE_STRINGSET_NONE'.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afstyles.h (none_dflt): Use AF_BLUE_STRINGSET_NONE.
2016-04-05 11:43:58 +02:00
Werner Lemberg f73a993750 [autofit] Mark `aflatin2.[ch]' as not compilable. 2016-03-26 22:42:13 +01:00
Werner Lemberg 614a8f17c7 * src/autofit/afhints.c (af_glyph_hints_reload): Thinko.
This fixes the previous commit to this file.
2016-03-21 19:39:14 +01:00
Werner Lemberg 709486db7f [autofit] Show `near' points in tracing.
* src/autofit/afhints.h (AF_FLAG_NEAR): New macro.

* src/autofit/afhints.c (af_glyph_hints_dump_points): Implement it.
(af_glyph_hints_reload): Handle AF_FLAG_NEAR.
2016-03-20 22:20:32 +01:00
Werner Lemberg da86b73f03 * src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize. 2016-03-15 07:55:05 +01:00
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