Commit Graph

655 Commits

Author SHA1 Message Date
Werner Lemberg 40479fad93 [autofit] Synchronize with ttfautohint.
This corresponds to the following commits in the ttfautohint git
repository:

  bb6842bd3bd437b7b4a7921b0376c860f5e73d18  Typo, formatting.
  d5c91ddb1cb310257a3dfe9a8e20e1fc51335faa  Add Medefaidrin script.

* src/autofit/afblue.dat: Add blue zone data for Medefaidrin.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Medefaidrin
data.
2020-09-25 17:44:00 +02:00
Priyesh Kumar 53be1753de Fix `-Wformat' compiler warnings.
* src/*: Fix format specifiers.

* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
2020-07-28 07:33:40 +02:00
Werner Lemberg 96fb73efd5 Fix clang warnings.
* include/freetype/internal/autohint.h
(FT_DECLARE_AUTOHINTER_INTERFACE): New macro.
* src/autofit/afmodule.h: Use it to declare
`af_autofitter_interface'.

* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro.
* src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and
`ft_outline_glyph_class'.

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

* src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'.

* src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'.

* src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'.
* src/psaux/psauxmod.h: Declare `afm_parser_funcs',
`t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'.

* src/pshinter/pshmod.c: Include `pshmod.h'.

* src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign
conversion.
(compute_ULong_sum): Fix return type.
Fix implicit sign conversion.
(store_points): Fix type of `last_flag', `repeat_count', and `flag'.
Use casts to avoid warnings.
(reconstruct_glyf): Fix implicit sign conversion.
Use cast to avoid warning.
(get_x_mins): Fix implicit sign conversion.
* src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'.
* src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to
declare cmap classes.

* src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast.

* src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
2020-07-07 16:58:14 +02:00
Werner Lemberg 1658685967 Remove redundant inclusion of `ft2build.h'.
* */*: Remove `#include <ft2build.h>' where possible.

* include/freetype/freetype.h: Remove cpp error about missing
inclusion of `ft2build.h'.
2020-06-13 21:15:45 +02:00
David Turner e13391333f Make macros for header file names optional.
We no longer have to take care of the 8.3 file name limit; this
allows us (a) to introduce longer, meaningful file names, and (b) to
avoid macro names in `#include' lines altogether since some
compilers (most notably Visual C++) doesn't support this properly.

*/*: Replace

   #include FOO_H

with

   #include <freetype/foo.h>

or something similar.  Also update the documentation.
2020-06-08 13:31:55 +02:00
David Turner 4eee13404d Remove Jamfile files from the tree.
These have not been used in a very, very long time, so better remove
them.  A corresponding patch will be submitted to the
`freetype2-demos' repository.

* src/Jamfile, src/*/Jamfile, Jamrules: Delete.
2020-05-18 17:56:06 +02:00
Nikolaus Waxweiler 49f3394d7a [autofit] Add support for Hanifi Rohingya script.
* src/autofit/afblue.dat: Add blue zone data for Hanifi Rohingya.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Hanifi Rohingya standard character.

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Hanifi
  Rohingya data.
2020-02-19 20:04:31 +01:00
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Werner Lemberg 2c9a2d58ca Another bunch of UBSan warnings on adding offsets to nullptr.
Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19427
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19433
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19441
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19451
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19452
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19457

* src/autofit/aflatin.c (af_latin_hints_compute_segments,
af_latin_hints_compute_edges): Use `FT_OFFSET'.

* src/base/ftstream.c (FT_Stream_EnterFrame): Use `FT_OFFSET'.

* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Exit early
if there is no charstring.

* src/psaux/psobjs.c (t1_decrypt): Use `FT_OFFSET'.

* src/smooth/ftsmooth.c (ft_smooth_render_generic): Exit early for
zero bitmap dimensions.
2019-12-13 23:56:25 +01:00
Werner Lemberg 551bd3a90e More nullptr offset UBSan warnings (#57331, #57347).
* src/autofit/afcjk.c (af_cjk_hints_compute_segments),
src/psaux/psft.c (cf2_getSeacComponent), src/truetype/ttinterp.c
(Ins_UNKNOWN): Use `FT_OFFSET'.
2019-12-03 11:52:48 +01:00
Behdad Esfahbod 07c8d8bbdb Minor fixes for recent compilers.
* src/gzip/infutil.h (inflate_mask): Add `const'.

* src/autofit/aflatin2.c: Include `ft2build.h'.
2019-11-23 10:00:02 +01:00
Werner Lemberg 47ca5cb69d [autofit] Disable hinting if no blue zones are available (#56450).
* src/autofit/afglobal.c (af_face_global_get_metrics): Start again
(with dummy hinter module) if no blue zones are present.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Change
signature to return error code.
If no blue zones are found, update `glyph_styles' array to hold
AF_STYLE_NONE_DFLT instead of the current style.
(af_latin_metrics_init): Return internal error code if no blue zones
are found.
2019-06-16 15:33:32 +02:00
Werner Lemberg 3736b28af9 * src/autofit/aflatin.c (af_latin_metrics_init_widths): Minor. 2019-06-13 13:45:05 +02:00
Werner Lemberg 7b84104720 Various clang 8.0 static analyzer fixes.
Reported by Sender Ghost <lightside@gmx.com>.

* src/autofit/afcjk.c (af_cjk_hints_compute_edges): Catch a corner
case where `edge->first' could be NULL.

* src/pfr/pfrobjs.c (pfr_slot_load): Remove unnecessary test of
`size'.

* src/raster/ftraster.c (Draw_Sweep): Catch a corner case where
`draw_right' might be NULL.

* src/sfnt/ttmtx.c (tt_face_get_metrics): Fix limit test for
`aadvance'.
Ensure `abearing' always hold a meaningful result.

* src/truetype/ttgload.c (load_truetype_glyph): Ensure `subglyph' is
not NULL before accessing it.
* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Remove unnecessary
test of `namedstyle'.

* src/type42/t42parse.c (t42_parser_done): Ensure
`parser->root.funcs.done' is not NULL before accessing it.
2019-05-04 08:13:22 +02:00
Werner Lemberg f0384d5fb0 Minor. 2019-04-09 11:01:24 +02:00
Werner Lemberg df266d3e6b [autofit] Fix Mongolian blue zone characters.
* src/autofit/afblue.dat: Use U+200D (ZERO-WIDTH JOINER) characters
to get medial forms for some Mongolian characters.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
2019-03-20 07:04:06 +01:00
Werner Lemberg dde03eec37 [autofit] Add support for Mongolian script.
As a de-facto standard, layouts using this script are constructed
horizontally line by line, then the lines are rotated clockwise for
vertical display.

* src/autofit/afblue.dat: Add blue zone data for Mongolian.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Mongolian
data.
2019-03-19 10:50:38 +01:00
Andrei Alexeyev 2f4b740ce4 Fix invalid function pointer casts.
This change should allow Freetype to work on WASM/Emscripten without
needing `-s EMULATE_FUNCTION_POINTER_CASTS=1'.

* src/autofit/afdummy.c (af_dummy_hints_apply): Fix signature.

* src/cid/cidload.c (cid_parse_font_matrix, parse_fd_array,
parse_expansion_factor, parse_font_name): Return `void', not
`FT_Error'.

* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIsDefaultFunc):
Fix signature.
2019-03-07 09:43:05 +01:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Wink Saville 0ac6921109 * src/autofit/afwarp.h (af_warper_compute): Fix declaration. 2019-02-16 07:05:39 +01:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
Werner Lemberg b89166cc4d * src/autofit/aflatin2.c: Some fixes from `aflatin.c' (#55310). 2018-12-29 08:55:01 +01:00
Shailesh Mistry 339c451ad0 [autofit] Prevent SEGV.
See

  https://bugs.ghostscript.com/show_bug.cgi?id=697545

for more details on how the bug was found.

* src/autofit/afloader.c (af_loader_load_glyph): Propagate error
code.
2018-11-02 10:10:10 +01:00
Werner Lemberg a9af691481 Fix handing of `FT_Bool'.
Before this commit we had code like

  (FT_Bool)( globals->glyph_styles[gindex] & 0x8000)

Since `FT_Bool' is defined to be an `unsigned char', the code
evaluated to something like

  (unsigned char)( 0x8532 & 0x8000)

which in turn expanded to

  (unsigned char)( 0x8000)

and finally yielded 0x00 – i.e., false – not as expected.

Problem reported and analyzed by Tony Smith <tony.smith@macro4.com>.

* include/freetype/fttypes.h (FT_BOOL): Add a comparison against
zero so that we always have a Boolean expression.

*/*: Replace castings to `FT_Bool' with calls to `FT_BOOL' where
possible.
2018-09-25 09:10:09 +02:00
Werner Lemberg 0d4ca13865 * src/autofit/afhints.c (af_glyph_hints_reload): Add initialization. 2018-08-31 06:53:52 +02:00
Werner Lemberg c0ccf75012 [autofit] Trace `before' and `after' edges of strong points.
* src/autofit/afhints.h (AF_PointRec) [FT_DEBUG_AUTOFIT]: New arrays
`before' and `after'.

* src/autofit/afhints.c (af_get_strong_edge_index): New auxiliary
function.
(af_glyph_hints_dump_points): Trace `before' and `after' edges.
(af_glyph_hints_align_strong_points) [FT_DEBUG_AUTOFIT]: Set
`before' and `after' information.
2018-08-30 09:56:09 +02:00
Werner Lemberg a0dd16fb3d Don't use `trace_' prefix for FT_COMPONENT arguments.
* include/freetype/internal/ftdebug.h (FT_TRACE_COMP,
FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix.
(FT_TRACE): Use `FT_TRACE_COMP'.

*/* (FT_COMPONENT): Updated.
2018-08-15 18:13:17 +02:00
Werner Lemberg 64bf5d48eb Minor formatting. 2018-06-03 09:20:09 +02:00
Werner Lemberg 9ac9060df0 [GSoC] src/*.*: Convert block comments to `light' style.
This monster commit was created by applying Nikhil's scripts
`docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 09:08:41 +02:00
Werner Lemberg fab10b6fc2 * src/autofit/afwarp.h: Use AF_CONFIG_OPTION_USE_WARPER (#54033). 2018-06-02 09:53:58 +02:00
Armin Hasitzka d45d4b97e6 Beautify a3cfed5e87.
* src/autofit/afloader.c (af_loader_load_glyph): Move the
initialisation and declaration of variables into the if-block.
2018-05-30 17:38:14 +02:00
Armin Hasitzka a3cfed5e87 Fix pointer underflow.
The declaration of `edge2' can be reached with `edge1 == NULL' and
`axis->edges == 0' which results in undefined behaviour.

* src/autofit/afloader.c (af_loader_load_glyph): Initialise `edge2'
after checking `axis->num_edges > 1'.  `edge1 != NULL' can be assumed.
2018-05-30 12:37:46 +02:00
Werner Lemberg e0015f7612 [autofit] Avoid potential SEGV if running out of memory.
Problem reported by Shailesh Mistry <shailesh.mistry@hotmail.co.uk>.

* src/autofit/afshaper.c (af_shaper_buf_create,
af_shaper_buf_destroy) [!FT_CONFIG_OPTION_USE_HARFBUZZ]: Don't
allocate and free a four-byte buffer.  Instead, make those functions
no-ops; the calling functions will provide a pointer to a buffer
instead.

* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
af_cjk_metrics_init_blues, af_cjk_metrics_check_digits),
src/autofit/aflatin.c (af_latin_metrics_init_widths,
af_latin_metrics_init_blues, af_latin_metrics_check_digits)
[!FT_CONFIG_OPTION_USE_HARFBUZZ]: Use pointer to local variable for
`shaper_buf'.
2018-05-08 11:51:16 +02:00
Werner Lemberg 9514959241 Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.

*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.

* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
Werner Lemberg e4b6d85326 [autofit] Add support for Georgian Mtavruli characters.
This will be part of the forthcoming Unicode 11.0.

* src/autofit/afblue.dat: Add blue zone data for Mtavruli.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

* src/autofit/afscript.h: Add Mtavruli standard character.
2018-04-19 17:43:03 +02:00
Werner Lemberg 576670b779 [autofit] Update to Unicode 11.0.0.
But no support new scripts (volunteers welcomed).

* src/autofit/afranges.c (af_arab_nonbase_uniranges,
af_beng_nonbase_uniranges, af_cakm_nonbase_uniranges,
af_deva_nonbase_uniranges, af_geor_uniranges,
af_gujr_nonbase_uniranges, af_mlym_nonbase_uniranges,
af_nkoo_nonbase_uniranges, af_telu_nonbase_uniranges,
af_hani_uniranges): Add new data.
2018-04-14 07:00:30 +02:00
Werner Lemberg 63aaf89cec s/sub-pixel/subpixel/. 2018-02-17 10:34:47 +01:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 98ba0c4a37 New `ftdriver.h' file, covering all driver modules.
This reduces redundancy and increases synergy; it also reduces the
number of header files.

* include/freetype/config/ftheader.h (FT_DRIVER_H): New macro.
(FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H,
FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to
FT_DRIVER_H.

* include/freetype/ftautoh.h, include/freetype/ftcffdrv.h,
include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h,
include/freetype/ftttdrv.h: Replaced with...
* include/freetype/ftdriver.h: ...this new file.
(FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to...
(FT_HINTING_ADOBE): ... this new macro.
(FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to...
(FT_HINTING_FREETYPE): ... this new macro.

* src/*/*: Updated accordingly.
2017-12-08 18:41:49 +01:00
Werner Lemberg 87ddad2007 Update or fix links to use the https protocol instead of http. 2017-12-04 20:43:30 +01:00
Behdad Esfahbod 90461c0137 [afshaper] Delay creating `hb_set' objects until needed.
In runs on Noto Naskh Arabic, this results in 89 sets created
instead of 340 before.  Makes auto-hinter setup with HarfBuzz
enabled 20% to 30% faster.

* src/autofit/afshaper.c (af_shaper_get_coverage): Implement it.
2017-10-14 08:42:07 +02:00
Werner Lemberg 8768536c89 [autofit] Better visualize table tracing in source code. 2017-10-12 00:13:51 +02:00
Werner Lemberg 96dcc8ad6e [autofit] Really fix #41334 (#52000).
* src/autofit/aflatin.c (af_latin_hints_compute_segments): Set
`segment->delta' everywhere.
2017-09-13 08:16:23 +02:00
suzuki toshiya 21658c31f7 [autofit, sfnt] Fix for `make multi'.
* src/autofit/afshaper.c: Include FT_ADVANCE_H, to use
FT_Get_Advance() in it.
* src/sfnt/ttcmap.c: Include FT_SERVICE_POSTSCRIPT_CMAPS_H
to use PS_Unicodes in it, also include `ttpost.h' to use
tt_face_get_ps_name() in it.
2017-09-12 15:59:18 +09:00
Werner Lemberg 0ab2b62d3f [autofit] Improve communication with ftgrid.
* src/autofit/afhints.c (af_glyph_hints_get_segment_offset):
Provide values in font units.
2017-09-09 08:08:47 +02:00
Werner Lemberg 881f64475f [autofit] More code sorting. 2017-05-17 07:56:53 +02:00
Werner Lemberg 548704f426 Code sorting. 2017-05-17 07:40:50 +02:00
Alexei Podtelezhnikov a7f276a281 [autofit] Make autohint warping NORMAL option.
This moves warping option from LIGHT to NORMAL mode.  This makes LIGHT
truly void of hinting in x-direction, with left side bearing never
changed and right side bearing only altered by advance rounding.
Therefore, LIGHT is now ready to return fractional advance.  As a
NORMAL option, warping substitutes normal hinting.

* src/autofit/afcjk.c (af_cjk_hints_apply): Updated.
* src/autofit/aflatin.c (af_latin_hints_apply): Updated.
* src/autofit/aflatin2.c (af_latin2_hints_apply): Updated.

* src/autofit/afloader.c (af_loader_load_glyph): Handle warping
phantom points as normal.
2017-05-15 00:25:37 -04:00
Werner Lemberg 9de936d343 s/AF_BLUE_STRINGSET_CANADIAN_SYLLABICS/AF_BLUE_STRINGSET_CANS/. 2017-05-11 00:11:59 +02:00
Sascha Brawer ac0eed8646 [autofit] Add support for Chakma script.
* src/autofit/afblue.dat: Add blue zone data for Chakma.
* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.

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

* src/autofit/afranges.c, src/autofit/afstyles.h: Add Chakma data.
2017-05-11 00:06:37 +02:00
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