summaryrefslogtreecommitdiff
path: root/src/autofit/aflatin.c
Commit message (Collapse)AuthorAgeFilesLines
* [autofit] Clean up contour indexing.Alexei Podtelezhnikov2023-02-201-11/+8
| | | | | * src/autofit/aflatin.c (af_latin_metrics_init_blues): Refactor. * src/autofit/afcjk.c (af_cjk_metrics_init_blues): Ditto.
* For debugging, avoid implicit conversion from integer to double.Werner Lemberg2023-02-081-36/+41
| | | | | | | | | | Otherwise we get zillions of clang 15 warnings. * src/autofit/afcjk.c, src/autofit/afhints.c, src/autofit/aflatin.c, src/base/ftobjs.c, src/base/ftoutln.c, src/cff/cffparse.c, src/raster/ftraster.c, src/sfnt/pngshim.c, src/truetype/ttgload.c, src/truetype/ttgxvar.c, src/truetype/ttobjs.c, src/type1/t1gload.c: Use `double` cast in debugging and tracing macros.
* Update all copyright notices.Werner Lemberg2023-01-171-1/+1
|
* [autofit] Reset the face charmap directly.Alexei Podtelezhnikov2022-10-031-1/+1
| | | | | | | | | There is no need to validate the original charmap in `FT_Set_Charmap`. It can be reset directly. * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Use direct assignment. * src/autofit/af{latin,cjk,indic}.c (af_latin_metrics_init): Ditto.
* [autofit] Updated to reduce casting.Alexei Podtelezhnikov2022-08-011-1/+1
| | | | | | | | * src/autofit/afglobal.h (AF_FaceGlobalsRec): Change `glyph_count` type. * src/autofit/afglobal.c (af_face_globals_compute_style_coverage, af_face_globals_get_metrics, af_face_globals_is_digit, af_face_globals_new): Changed local types and updated accordingly. * src/autofit/aflatin.c (af_latin_metrics_init_blues): Ditto.
* [autofit] Use unsigned accounting for hints.Alexei Podtelezhnikov2022-07-291-2/+2
| | | | | | | | | | * src/autofit/afhints.h (AF_AxisHintsRec): Use unsigned types. * src/autofit/afhints.c (af_axis_hints_new_{segment,edge}, af_glyph_hints_get_num_segments, af_glyph_hints_get_segment_offset): Updated accordingly. * src/autofit/aflatin.c (af_cjk_hints_compute_edges): Ditto. * src/autofit/afcjk.c (af_cjk_hints_compute_edges): Ditto.
* Update all copyright notices.Werner Lemberg2022-01-111-1/+1
|
* [autofit, pshinter] Use `FT_OFFSET`.Werner Lemberg2022-01-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | This avoids ``` runtime error: applying zero offset to null pointer ``` warnings of clang's undefined behaviour sanitizer. * src/autofit/afcjk.c (af_cjk_hints_link_segments, af_cjk_hints_compute_edges, af_cjk_hints_compute_blue_edges, af_cjk_hint_edges, af_cjk_align_edge_points): Do it. * src/autofit/afhints.c (af_glyph_hints_align_edge_points, af_glyph_hints_align_strong_points): Ditto. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_hints_link_segments, af_latin_hints_compute_edges, af_latin_hints_compute_blue_edges, af_latin_hint_edges): Ditto. * src/pshinter/pshalgo.c (psh_hint_table_init): Ditto.
* Cosmetic zeros.Alexei Podtelezhnikov2021-09-021-1/+1
|
* Remove experimental auto-hinting 'warp' mode.David Turner2021-07-121-34/+0
| | | | | | | This feature was always experimental, and probably nevery worked properly. This patch completely removes it from the source code, except for a documentation block describing it for historical purpose.
* Prevent hinting if there are too many segments.Werner Lemberg2021-06-191-0/+25
| | | | | | | | | | | This speeds up handling of broken glyphs. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35309 * src/autofit/aflatin.c (af_latin_hints_compute_segments): Implement it.
* * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix tracing.Werner Lemberg2021-06-021-0/+2
| | | | Problem reported by Alexei.
* Update all copyright notices.Werner Lemberg2021-01-171-1/+1
|
* * src/*: More fixes for using a '\n' in `FT_TRACE` and `FT_ERROR`.Werner Lemberg2020-12-071-17/+16
|
* * src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.Werner Lemberg2020-12-051-15/+14
| | | | | This ensures good logging output, with all lines having a proper prefix (if requested).
* Fix `-Wformat' compiler warnings.Priyesh Kumar2020-07-281-25/+25
| | | | | | * src/*: Fix format specifiers. * builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
* Remove redundant inclusion of `ft2build.h'.Werner Lemberg2020-06-131-1/+0
| | | | | | | * */*: Remove `#include <ft2build.h>' where possible. * include/freetype/freetype.h: Remove cpp error about missing inclusion of `ft2build.h'.
* Make macros for header file names optional.David Turner2020-06-081-2/+2
| | | | | | | | | | | | | | | | | 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.
* Update all copyright notices.Werner Lemberg2020-01-191-1/+1
|
* Another bunch of UBSan warnings on adding offsets to nullptr.Werner Lemberg2019-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* [autofit] Disable hinting if no blue zones are available (#56450).Werner Lemberg2019-06-161-7/+39
| | | | | | | | | | | | * 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.
* * src/autofit/aflatin.c (af_latin_metrics_init_widths): Minor.Werner Lemberg2019-06-131-0/+4
|
* Minor.Werner Lemberg2019-04-091-4/+4
|
* Update all copyright notices.Werner Lemberg2019-02-231-1/+1
|
* Update copyright years.Werner Lemberg2019-01-221-1/+1
|
* Fix handing of `FT_Bool'.Werner Lemberg2018-09-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Don't use `trace_' prefix for FT_COMPONENT arguments.Werner Lemberg2018-08-151-1/+1
| | | | | | | | * 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.
* [GSoC] src/*.*: Convert block comments to `light' style.Werner Lemberg2018-06-031-86/+86
| | | | | | | | | | | 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.
* [autofit] Avoid potential SEGV if running out of memory.Werner Lemberg2018-05-081-6/+36
| | | | | | | | | | | | | | | | | 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'.
* Remove FT_CONFIG_OPTION_PIC and related code.Werner Lemberg2018-05-021-19/+3
| | | | | | | | | | | | | | | | | */* [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.
* Update copyright year.Werner Lemberg2018-01-021-1/+1
|
* [autofit] Really fix #41334 (#52000).Werner Lemberg2017-09-131-8/+13
| | | | | * src/autofit/aflatin.c (af_latin_hints_compute_segments): Set `segment->delta' everywhere.
* [autofit] Make autohint warping NORMAL option.Alexei Podtelezhnikov2017-05-151-9/+3
| | | | | | | | | | | | | | | 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.
* [autofit] Remove `slight' auto-hint mode again.Werner Lemberg2017-05-021-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add new `slight' auto-hinting mode.Werner Lemberg2017-04-261-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [autofit] Disable metrics adjustment for `FT_LOAD_TARGET_LCD'.Alexei Podtelezhnikov2017-04-021-3/+3
| | | | | * src/autofit/aflatin.c (af_latin_hints_init): Updated. * src/autofit/aflatin2.c (af_latin2_hints_init): Ditto.
* [autofit] Disable stem adjustment for `FT_LOAD_TARGET_LCD'.Alexei Podtelezhnikov2017-03-311-2/+2
| | | | | | | * 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.
* Remove clang warnings.Werner Lemberg2017-02-181-1/+1
| | | | | | | | | * 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.
* [autofit] Prevent overlapping blue zones.Werner Lemberg2017-02-131-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make compilation with FT_CONFIG_OPTION_PIC work again.Werner Lemberg2017-02-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | 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.
* [autofit] Avoid uninitialized jumps (#50191).Werner Lemberg2017-01-311-1/+1
| | | | | | * src/autofit/afcjk.c (af_cjk_metrics_check_digits), src/autofit/aflatin.c (af_latin_metrics_check_digits): Initialize `advance'.
* Update copyright year.Werner Lemberg2017-01-041-1/+1
|
* */*: Use `0.5f' for tracing 16.16 numbers.Werner Lemberg2016-12-291-1/+1
|
* Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.Werner Lemberg2016-12-261-1/+1
| | | | Other minor formatting.
* s/0/NULL/ for function pointers; comments, formatting.Werner Lemberg2016-09-171-6/+6
|
* * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Minor.Werner Lemberg2016-07-261-4/+4
| | | | No functional change.
* * src/autofit/aflatin.c (af_latin_hints_compute_segments): Thinko.Werner Lemberg2016-07-161-1/+1
| | | | | | `max_pos' is always larger than `min_pos' so `FT_ABS' is not needed. Reported by Alexei.
* [autofit] For edges, reject segments wider than 1px (#41334).Werner Lemberg2016-07-151-6/+15
| | | | | | | | | * 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.
* [autofit] Handle single-point contours as segments.Werner Lemberg2016-07-041-5/+66
| | | | | | | | | | | | 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.
* * src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize.Werner Lemberg2016-03-151-27/+32
|