Commit Graph

8081 Commits

Author SHA1 Message Date
Alexei Podtelezhnikov
3008032062 * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Tweak loop. 2024-09-06 13:43:47 +00:00
Andrew Murray
98283cb30f [sfnt] Support sbix graphicType 'flip'.
* src/sfnt/ttsbit.c (tt_face_load_sbix_image): Currently undocumented by
Apple, this flips the bitmap data horizontally.  It is used on macOS in
Apple Color Emoji; 19.4d6e1; 2024-02-05 (file `Apple Color Emoji.ttc`).

Fixes issue #1282.
2024-09-06 10:10:23 +02:00
suzuki toshiya
aaa559eaca Add clang to host compiler candidates in cross building.
* builds/unix/configure.raw: In cross building,
`clang` is tried if there is no `gcc`, nor `cc`.
2024-09-05 14:42:19 +09:00
suzuki toshiya
e622c3c4cd Improve the build rule for apinames.
* builds/unix/configure.raw: copy `CFLAGS` &
`LDFLAGS` values to `CFLAGS_BUILD` &
`LDFLAGS_BUILD`, in a self-hosting case.

* builds/unix/unix-cc.in: set `CCexe_CFLAGS` &
`CCexe_LDFLAGS` by `CFLAGS_BUILD` &
`LDFLAGS_BUILD`.

In some confused environments, simple building
like `cc -o apinames apinames.c` is no longer
able to build an executable running on the host.

The validity of `CC` is tested with consideration
of `CFLAGS` and `LDFLAGS`, thus, duplicating
`CFLAGS` & `LDFLAGS` to `CCexe_CFLAGS` &
`CCexe_LDFLAGS` (via XXX_BUILD) would be slightly
safer in a self-hosting build.

Fixes the issue #1296.
2024-09-05 14:39:46 +09:00
Alexei Podtelezhnikov
d2612e1c3f * src/sfnt/ttcmap.c (tt_cmap*_get_info): Remove casting. 2024-08-26 07:01:19 -04:00
Alexei Podtelezhnikov
4f00846dde * include/freetype/ftimage.h (FT_Bitmap): Describe empty bitmap. 2024-08-25 18:13:10 +00:00
luz paz
f92c96550a Fix various typos. 2024-08-13 23:29:13 -04:00
Alexei Podtelezhnikov
c4e6791f82 * messon.build: Install include/freetype/ftlogging.h.
Fixes #1292.
2024-08-12 20:19:19 -04:00
Werner Lemberg
42608f77f2 * Version 2.13.3 released.
==========================

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

* docs/VERSION.TXT: Add entry for version 2.13.3.
* 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.2/2.13.3/, s/2132/2133/.

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

* builds/unix/configure.raw (version_info): Set to 26:2:20.
* CMakeLists.txt (VERSION_PATCH): Set to 3.
2024-08-12 12:50:14 +02:00
Werner Lemberg
a4b4e3ec23 * meson.build: Install freetype2.m4.
Fixes #1290.
2024-08-12 12:50:10 +02:00
Werner Lemberg
6b992aaaf2 * src/*/*: Fix C++ compilation; fix clang warnings. 2024-08-12 12:34:28 +02:00
Werner Lemberg
8fc8b1310e * subprojects/*.wrap: Updated. 2024-08-12 12:34:28 +02:00
Werner Lemberg
ed8b82ba94 Various minor documentation or formatting fixes. 2024-08-12 12:34:28 +02:00
Werner Lemberg
ec378cecaf tttables.h (FT_Get_CMap_Format): Minor documentation improvement. 2024-08-07 21:23:44 +02:00
Alexei Podtelezhnikov
1f72a120a9 * src/truetype/ttgxvar.c (ft_var_readpacked*): Minor. 2024-08-05 13:05:51 +00:00
Alexei Podtelezhnikov
e181911d87 * src/base/ftstream.c (FT_Stream_ReadFields): Switch to FT_Offset. 2024-08-05 13:02:04 +00:00
Alexei Podtelezhnikov
a48cdddef3 * src/winfonts/winfnt.c (fnt_face_get_dll_font): Unwrap arithmetic. 2024-08-01 21:15:46 -04:00
Alexei Podtelezhnikov
72e199e8d3 * src/base/ftstream.c (FT_Stream_ReadFields): Update condition. 2024-08-01 21:12:41 -04:00
Alexei Podtelezhnikov
7c75b8a7bd [truetype/GX] Use more robust conditions.
* src/truetype/ttgxvar.c (ft_var_readpacked{points,deltas}): Rewrite
conditions to avoid undefined behavior.
2024-08-01 19:14:44 -04:00
Alexei Podtelezhnikov
5e116bb0dc [truetype/GX] Read points and deltas more carefully.
Hopefully fixes newly introduced buffer overflows:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70807
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70809

* src/truetype/ttgxvar.c (ft_var_readpacked{points,deltas}): Explicitly
check stream frame limits and modify run counting.
2024-07-30 21:51:51 -04:00
Alexei Podtelezhnikov
104f85448d [truetype/GX] Read stream more aggressively.
With ample checks against the table size, we should be able to use
macros without the limit checks and functional calls.

* src/truetype/ttgxvar.c (ft_var_readpacked{points,deltas}):
Use FT_NEXT_* instead of FT_GET_*.
2024-07-29 20:26:00 -04:00
Alexei Podtelezhnikov
3f8edd234d * src/sfnt/ttload.c (tt_face_load_name): Shorten dereference. 2024-07-28 20:56:07 -04:00
Alexei Podtelezhnikov
d42bffd4a0 * src/autofit/afmodule.c (af_autofitter_load_glyph): Shorten deref. 2024-07-28 20:32:41 -04:00
Alexei Podtelezhnikov
2488854056 [bdf,pcf,winfonts,sfnt] Remove barely used marcros.
* include/freetype/internal/ftobjs.h (FT_FACE_SIZE, FT_SIZE_FACE):
Removed.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Updated.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto
* src/sfnt/ttbdf.c (tt_face_find_bdf_prop): Ditto.
2024-07-28 19:42:49 -04:00
Dan Rosser
97069edd16 * include/freetype/internal/ftcalc.h (FT_MSB)[_M_ARM64EC]: Added. 2024-07-27 20:41:25 +00:00
Werner Lemberg
1452355de9 * src/truetype/ttobjs.c (tt_size_run_prep): Correct scaling of CVT values.
This reverts the scaling behaviour introduced in commit 37580053.

Fixes issue #1005.
2024-07-19 22:35:37 +02:00
Philip Race
37cefe33b2 * psobjs.c (ps_table_add): Check length before calling FT_MEM_CPY.
Fixes issue #1280.
2024-06-29 05:17:14 +02:00
Don Olmstead
2280346192 CMakeLists.txt: Respect FT_DISABLE_ZLIB value
The CMake build uses `find_package` to look for dependencies. Before calling `find_package` it looks to see if the dependency was disabled. If not the associated `_FOUND` variable will be set. This value is then checked to determine if the dependency is added.

However `find_package(PNG)` calls `find_package(ZLIB)` within its find module. So in the case of `FT_DISABLE_ZLIB=TRUE` and `FT_DISABLE_PNG=FALSE` the `ZLIB_FOUND` value can be set and even though `FT_DISABLE_ZLIB` is turned on.

Unset the value of `ZLIB_FOUND` after the call to `find_package(PNG)` so the value is only set when `FT_DISABLE_ZLIB` is turned off.
2024-06-28 17:46:15 -07:00
Werner Lemberg
bab9564a97 Make 'multi' build work again.
* src/psaux/psobjs.c: Include `psft.h`.

* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttgpos.c`.

Fixes issue #1284.
2024-06-26 05:41:36 +02:00
Alexei Podtelezhnikov
73720c7c99 * src/truetype/ttgload.c (load_truetype_glyph): Unsigned fix. 2024-06-23 10:58:00 -04:00
Alexei Podtelezhnikov
044d142be7 Use unsigned tags FT_Outline.
This change comes along with 2a7bb4596f ans is only meant to reduce
pointer casting in the code.

* include/freetype/ftimage.h (FT_Outline): Do it.
* src/*: Update `FT_Outline` users.
2024-06-20 22:16:51 -04:00
Ben Wagner
b1cbcb2045 [ttgxvar] Avoid "applying zero offset to null pointer"
In C it is undefined behavior to do arithmetic on a null pointer, including
adding zero. When using NotoSansKhmer[wdth,wght].ttf UBSAN produces a report
like

ttgxvar.c:1052:31: runtime error: applying zero offset to null pointer

when adding zero to `varData->deltaSet` (which is null) to produce `bytes`.
Protect against all the potential issues of this kind by returning early if
`varData->regionIdxCount == 0`.

* src/truetype/ttgxvar.c (tt_var_get_item_delta): early return on no regions
2024-06-21 01:41:40 +00:00
Alexei Podtelezhnikov
2a7bb4596f Use unsigned point and contour indexing in FT_Outline.
This doubles the number or allowed points, see
    https://github.com/harfbuzz/harfbuzz/issues/4752

Although it is hardly practical to use more than 32767 points,
other font engines seem to support it.

* docs/CHANGES: Announce it.
* include/freetype/ftimage.h (FT_Outline): Do it and update limits.
* src/*: Update `FT_Outline` users.
2024-06-20 20:49:56 -04:00
Alexei Podtelezhnikov
2b9fdec5fa * src/pfr/pfrgload.c (pfr_glyph_curve_to): Avoid casting. 2024-06-19 21:38:58 -04:00
Alexei Podtelezhnikov
7a753c9653 * src/base/ftgloadr.c (FT_GlyphLoader_Prepare): Minor refactoring. 2024-06-18 21:14:58 -04:00
Alexei Podtelezhnikov
93a067e312 [base, autofit, psaux] Remove unnecessary casting.
* src/autofit/afhints.c (af_glyph_hints_reload): Remove (short) casting.
* src/base/ftgloadr.c (FT_GlyphLoader_Add): Ditto.
* src/psaux/psobjs.c ({t1,cff,ps}_builder_{add,close}_contour): Ditto.
2024-06-18 17:48:41 +00:00
Alexei Podtelezhnikov
deba7feb57 * include/freetype/ftimage.h: Explain standard types. 2024-06-18 14:01:58 +00:00
Ben Wagner
d41a855aab [ttgxvar] Replace tabs with spaces
Also clarify comments around conversion and clamping.

* src/truetype/ttgxvar.c (ft_var_to_normalized): doit
2024-05-29 17:01:29 -04:00
Alexei Podtelezhnikov
7ff43d3e9f [truetype/GX] Consolidate memory allocations.
* src/truetype/ttgxvar.c (tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas):
Allocate and split bigger memory blocks, avoid unnecessary zeroing,
do not copy shared tuples, revise error exit paths.
2024-05-26 19:40:20 -04:00
Alexei Podtelezhnikov
3416ac16d0 Whitespace. 2024-05-26 08:10:21 -04:00
Alexei Podtelezhnikov
b6dbbd9630 * src/truetype/ttgxvar.c (ft_var_apply_tuple): Reduce checks. 2024-05-24 17:38:14 +00:00
Alexei Podtelezhnikov
70299c924f Revert "[truetype] Reduce allocation scope."
This reverts commit 9ff4153cbf.
2024-05-23 22:50:32 -04:00
Alexei Podtelezhnikov
9ff4153cbf [truetype] Reduce allocation scope.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reduce scope
of `points_org` and 'points_out`.
2024-05-22 23:38:34 -04:00
Alexei Podtelezhnikov (Алексей Подтележников)
a498873652 * .gitlab-ci.yml: Disable UWP compilation. 2024-05-23 03:05:59 +00:00
Alexei Podtelezhnikov
42d406ab04 * include/freetype/internal/ftmemory.h (FT_MEM_DUP): Fix g++ error. 2024-05-22 21:08:34 -04:00
Alexei Podtelezhnikov
5f131cfd20 [cff, truetype] Validate variation axes immediately.
Instead of validating variation axes in every access, OpenType specs
suggest that peak = 0 be used to tag invalid ranges.  This implements
just that once during loading.

* src/cff/cffload.c (cff_blend_build_vector): Move the range checks...
(cff_vstore_load): ... here.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto...
(tt_var_load_item_variation_store): ... ditto.
2024-05-21 16:24:43 -04:00
Alexei Podtelezhnikov
99be2b3154 [cff, truetype] Rearrange variation range checks.
This should achieve quicker results for common cases.

* src/cff/cffload.c (cff_blend_build_vector): Rearrange conditionals.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto.
2024-05-21 18:26:09 +00:00
Alexei Podtelezhnikov
347276c1f6 * src/truetype/ttgxvar.c (tt_var_get_item_delta): Align with specs. 2024-05-21 13:12:45 +00:00
Alexei Podtelezhnikov
39f2fbf80c * src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring. 2024-05-20 22:47:14 -04:00
Alexei Podtelezhnikov
4ccdc9f982 [cff] Optimize the blend vector computations.
* src/cff/cffload.c (cff_blend_build_vector): Use FT_MulDiv and skip
multiplying by 1.
2024-05-20 18:53:57 -04:00