Commit Graph

8015 Commits

Author SHA1 Message Date
Zachary Zollman 21435f07de fix typo in FT_Outline_Decompose note 2023-10-08 23:34:28 +00:00
Alexei Podtelezhnikov 7b308a29dd * src/smooth/ftgrays.c (gray_render_conic) [SSE2]: Improve flow. 2023-09-28 22:56:15 -04:00
Alexei Podtelezhnikov e0e5b838e5 * src/gxvalid/gxvcommn.h (GXV_USHORT_TO_SHORT): Removed. 2023-09-25 22:26:15 -04:00
Alexei Podtelezhnikov 49781ab72b Comment typos. 2023-09-24 20:09:17 -04:00
Alexei Podtelezhnikov 73490681a7 * src/base/ftcalc.c (FT_MOVE_SIGN): Enclose assignments. 2023-09-24 19:39:10 -04:00
Alexei Podtelezhnikov cc732ec6d1 * include/freetype/internal/ftcalc.h (FT_MSB): Define for Solaris 11. 2023-09-21 02:28:32 +00:00
Alexei Podtelezhnikov c4073d8251 [psaux] Use `FT_SqrtFixed`.
* src/psaux/cffdecode.c <cff_op_sqrt>: Call `FT_SqrtFixed`.
* src/psaux/psintrp.c <cf2_escSQRT>: Ditto.
2023-09-19 22:29:14 -04:00
Alexei Podtelezhnikov 95b0fe2a6d [base] Reintroduce `FT_SqrtFixed`.
The general square root calculations are not necessary in FreeType.
For vector normalization or length, FreeType uses special functions.
It is, however, required in the legacy CFF specifications.

* src/base/ftcalc.c (FT_SqrtFixed): New function that uses either
Babylonian or bit-wise algorithm, whichever is faster for the given
situation.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed): Declare it.
2023-09-19 22:26:32 -04:00
Alexei Podtelezhnikov babe6af167 * src/base/ftcalc.c /* FT_SqrtFixed */: Fix defunct overflow. 2023-09-18 15:01:26 +00:00
Alexei Podtelezhnikov d7b63a966b * src/tools/apinames.c (read_header_file): Typos. 2023-09-14 13:00:07 +00:00
Alexei Podtelezhnikov 6eb5f2be40 Update 2 files
- /src/base/ftcalc.c
- /include/freetype/internal/ftcalc.h
2023-09-13 17:02:31 +00:00
Ben Wagner 16f311d725 [base] Fix typo to correct predicate for call
* src/base/ftobj.c (FT_Get_Color_Glyph_Paint): check
`get_colr_glyph_paint` before calling `get_colr_glyph_paint` and not
`get_colr_layer`
2023-09-12 18:35:01 -04:00
Alexei Podtelezhnikov 7d45cf2c8f * src/psaux/cffdecode.c (cff_op_sqrt): Correct upper limit. 2023-09-11 20:45:16 -04:00
Alexei Podtelezhnikov 18eb93556c * src/psaux/cffdecode.c (cff_op_sqrt): Improve initial guess. 2023-09-11 17:00:49 -04:00
Alexei Podtelezhnikov 30b0ce7303 src/psaux/psintrp.c (cf2_escSQRT): Improve initial guess.
The worst number of iterations decreased from 11 to 5.
2023-09-11 16:34:36 +00:00
Alexei Podtelezhnikov 17db21f3fc * src/type1/t1afm.c (t1_get_index): Restore `strlen` call.
This reverts commit 8ed6d97446
and fixes
   https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62246
2023-09-10 22:34:17 -04:00
Alexei Podtelezhnikov 446720a29e * src/cff/cffparse.c (CFF_Field_Handler): Some s/0/NULL/. 2023-09-09 23:01:13 -04:00
Alexei Podtelezhnikov 8d0897b37d [type1, cid, type42] Post-cleanup.
* include/freetype/internal/psaux.h (T1_FIELD_ZERO): Terminating macro.
* src/cid/cidload.c (cid_parse_dict): Use while-loop.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
2023-09-09 22:20:00 -04:00
Alexei Podtelezhnikov 3302e2f60c Update forgotten array termini.
* src/cid/cidload.c (cid_field_records): Account for added `len`.
* src/type1/t1load.c (t1_keywords): Ditto.
* src/type42/t42parse.c (t42_keywords): Ditto.
2023-09-09 17:24:34 -04:00
Alexei Podtelezhnikov 7ad9d57c3b [type1, cid, type42] Streamline dictionary parsing.
When matching the keywords, we avoid calculating their lengths by
checking the stored values. This itself is a sufficient pre-check
before diving into `memcmp`. Therefore, we remove explicit check of
the first characters.

* include/freetype/internal/psaux.h (T1_FieldRec): Store length.
* src/cid/cidload.c (cid_parse_dict): Use `memcmp` and stored length.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
2023-09-09 15:19:06 -04:00
Alexei Podtelezhnikov 8ed6d97446 * src/type1/t1afm.c (t1_get_index): Avoid `strlen` call.
Instead, we check the terminal zero.
2023-09-09 15:13:55 -04:00
Alexei Podtelezhnikov 68f1b93247 * src/type1/t1driver.c (t1_ps_get_font_value): Avoid redundant null. 2023-09-08 16:23:05 +00:00
Alexei Podtelezhnikov 9c51e21e53 [cff, truetype] Improve prefix and suffix removal.
* src/cff/cffobjs.c (remove_style): Rewrite using pointers.
(remove_subset_prefix): Unwrap loop and use `memmove`.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag): Unwrap loop
and avoid `strlen`.
2023-09-07 23:50:35 -04:00
Alexei Podtelezhnikov 4904d1eb1b * src/sfnt/ttpost.c (load_format_20): Micro-optimize. 2023-09-06 22:58:46 -04:00
Werner Lemberg 45903920b9 [autofit] Fix synchronization mistake between FreeType and ttfautohint.
Found by Behdad.

* src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix array size of
`blue_sorted`: FreeType doesn't have artificial blue zones.
2023-09-05 08:09:31 +02:00
Werner Lemberg ad20173942 [autofit] Fix typos.
This also reduces the used heap size by a large factor.

From Behdad.

* src/autofit/afcjk.h (AF_CJKAxisRec): Use `AF_BLUE_STRINGSET_MAX_LEN`.
* src/autofit/aflatin.h (AF_LatinAxisRec): Ditto.
2023-09-04 19:26:31 +02:00
Alexei Podtelezhnikov 000b26a30f * src/sfnt/ttpost.c (load_format_20): Rework tracing. 2023-08-30 23:03:02 -04:00
Alexei Podtelezhnikov dd1ced4ee3 [builds] Abbreviate the DLG submodule update.
* autogen.sh, builds/toplevel.mk: Revise the command options.
2023-08-30 02:28:48 +00:00
Alexei Podtelezhnikov 2f7abe4838 Comment added. 2023-08-29 19:18:43 +00:00
Alexei Podtelezhnikov c46c4b8e79 * src/sfnt/ttpost.c (load_format_20): Permit long names.
Fixes #1254.
2023-08-29 17:52:06 +00:00
Werner Lemberg 2d9fce53d4 [gzip] Update sources to zlib 1.13. 2023-08-27 09:47:24 +02:00
Werner Lemberg 4a0c5639f7 docs/release: Minor fixes. 2023-08-25 21:36:39 +02:00
Anurag Thakur a4f3e858ae docs/freetype-web.txt: New file. 2023-08-25 21:36:12 +02:00
Werner Lemberg 920c5502cc * Version 2.13.2 released.
==========================

Tag sources with `VER-2-13-2'.

* docs/VERSION.TXT: Add entry for version 2.13.2.
* docs/CHANGES: Updated.
* docs/release, docs/README, builds/macs/README: Updated.

* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
builds/windows/visualc/index.html, builds/windows/visualce/index.html,
builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
docs/freetype-config.1: s/2.13.1/2.13.2/, s/2131/2132/.

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

* builds/unix/configure.raw (version_info): Set to 26:1:20.
* CMakeLists.txt (VERSION_PATCH): Set to 2.
2023-08-25 20:12:52 +02:00
Alexei Podtelezhnikov 0c817334b7 * src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding. 2023-08-25 17:57:47 +00:00
Werner Lemberg d42679b93d Fix clang warnings.
* src/cffload.c (cff_blend_doBlend): Fix type of `sum`.
* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Fix type of
  `word_delta_count`.
2023-08-25 18:05:01 +02:00
Werner Lemberg aa5f001874 * subprojects/*.wrap: Updated. 2023-08-24 20:47:00 +02:00
Hugh McMaster e3ada2f70d builds/unix/configure.raw: Use variable to specify minimum Python version. 2023-08-24 20:47:00 +02:00
Alexei Podtelezhnikov 00b07598d9 * builds/toplevel.mk: Simplify version extraction. 2023-08-24 08:13:18 -04:00
Alexei Podtelezhnikov 97251fd5aa [base] Improve the matrix degeneracy check.
Also fixes #1251.

* src/base/ftcalc.c (FT_Matrix_Check): To avoid overflow, scale by shifting.
* include/freetype/internal/ftcalc.h (FT_Matrix_Check): Update description.
2023-08-22 11:01:16 +00:00
Werner Lemberg a3f44aadbc builds/toplevel.mk: Don't use `\#` in functions.
The behaviour changed in GNU make 4.3, where `#` (without the backslash)
would be necessary.  Using a variable instead the code works with both older
and newer GNU make versions.

Fixes #1252.
2023-08-22 12:27:10 +02:00
Hugh McMaster e907eef6b2 builds/freetype.mk: Invoke `mkdocs` as a Python module
FreeType's `refdoc` target currently allows users to override the
default Python path, which is useful for testing and development.

In contrast, `mkdocs` is invoked via the default Python path.

Invoking `mkdocs` via Python's module syntax allows for greater
flexibility, although there is no change for the default use case.
2023-08-19 22:02:14 +10:00
Ben Wagner a9793feace [base] Avoid UB with memcpy
`FT_NEW_ARRAY(p, 0)` sets `p` to `NULL`. `FT_Stream_ReadAt` with a
memory based stream uses `FT_MEM_COPY` which is `memcpy` which specifies
that it is undefined behavior for either the `src` or `dst` to be
`NULL`. Instead of forcing all callers work around calling
`FT_Stream_Read` when `buffer == NULL && count == 0` do the check in
`FT_StreamRead`. This allows any call with `count == 0` to succesfully
read zero bytes without UB.

* src/base/ftstream.c (FT_Stream_ReadAt): skip `FT_MEM_COPY` when
`count == 0`. (FT_Stream_TryRead): ditto

Fixes: #1250
2023-08-17 13:25:31 -04:00
Werner Lemberg a20de84e16 Fix warnings in tracing messages for 32bit compilation.
Since we now require C99, use `%td` for `ptrdiff_t` and `%zu` for `size_t`.
2023-08-12 11:47:41 +02:00
Ben Wagner 3829fdaae5 Avoid overflow in COLR bounds checks.
The values read into `base_glyphs_offset_v1` and `layer_offset_v1` may
be in the range 0xFFFFFFFD-0xFFFFFFFF. On systems where `unsigned long`
is 32 bits adding 4 to such values will wrap and pass bounds checks but
accessing values at such offsets will be out of bounds.

On the other hand `table_size` has already been tested to be at least
`COLRV1_HEADER_SIZE` (34) so it is safe to subtract 4 from it.

* src/sfnt/ttcolr.c (tt_face_load_colr): subtract 4 from `table_size`
instead of adding 4 to font data offsets in bounds checks

Fixes: https://crbug.com/1469348
2023-08-04 11:41:23 -04:00
Alexei Podtelezhnikov 95a872085e * src/base/ftobjs.c (open_face_from_buffer): Silence `maybe-uninitialized`.
We never call this function without a `driver_name` (#1245).
2023-08-01 22:48:31 -04:00
Alexei Podtelezhnikov b2584c738f [truetype] Reduce v40 footprint.
*  src/truetype/ttgload.c (TT_HInt_Glyph, tt_loader_set_pp,
tt_loader_init): Refactor code.
2023-07-28 22:35:58 -04:00
Alexei Podtelezhnikov 1ecfd21990 [truetype] Remove Infinality for good (remaining bits).
* src/truetype/ttobjs.h: Remove remaining fields.
* src/truetype/ttinterp.c: Do not initialize them.
* include/freetype/internal/tttypes.h: Remove descriptions.
2023-07-27 16:12:28 +00:00
Alexei Podtelezhnikov 5b7e45ac34 [truetype] Remove Infinality for good.
Remove everything `#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY`,
which was undefined for a while now.

* include/freetype/internal/tttypes.h: Ditto.
* src/truetype/truetype.c: Ditto.
* src/truetype/ttdriver.c: Ditto.
* src/truetype/ttgload.c: Ditto.
* src/truetype/ttinterp.c: Ditto.
* src/truetype/ttinterp.h: Ditto.
* src/truetype/ttobjs.c: Ditto.
* src/truetype/ttsubpix.[ch]: Remove files.
* src/truetype/rules.mk: Don't mention "ttsubpix.c".
2023-07-27 15:06:38 +00:00
Jouk Jansen 9e3c5d7e18 * vms_make.com: Provide separate library compiled with C++.
Some types on OpenVMS x86_64 (for example, `long') have different sizes
depending on whether compiled with either C or C++.  In particular,
X-Windows applications crash if linked with the C++ version.

This patch makes `vms_make.com` create a second version of the FreeType
library compiled with C++ if OpenVMS is running on the x86_64 platform.
2023-07-21 21:36:57 +02:00