Commit Graph

8113 Commits

Author SHA1 Message Date
Alexei Podtelezhnikov 8d536080ec * builds/windows/ftsystem.c: Fix ancient condition. 2025-01-10 22:44:40 +00:00
Alexei Podtelezhnikov 1f57020ff3 * src/bdf/bdflib.c (bdf_parse_start_): Fix tracing labels. 2025-01-10 03:23:41 +00:00
Alexei Podtelezhnikov 704d540527 * MSBuild.rsp: Force console color for mintty. 2025-01-09 15:18:55 +00:00
Heiko Lewin 1400b20ae8 * CMakeLists.txt: Use modern IMPORTED targets.
This resolves build problems with newer libPNG versions by switching
to using IMPORTED CMake targets for common libraries where provided.
To do this the required CMake version is raised to version 3.12.
Doing this seems justified as using IMPORTED targets is a cleaner
and more powerful solution that can leverage advanced and CMake-specific
features that may be utilized by the referred dependencies' CMake modules.

Resolves #1311.
2025-01-09 13:21:50 +00:00
Alexei Podtelezhnikov 73318c864a [cff] Remove size/slot checks.
After the previous commit, cff_glyph_load is no longer called
without first checking for valid size and glyph objects in
FT_Glyph_Load and these checks can be removed downstream.

* src/cff/cffdrivr.c (cff_glyph_load): Remove `size` and `glyph` checks.
* src/cff/cffgload.c (cff_slot_load): Ditto.
2025-01-08 15:45:32 -05:00
Alexei Podtelezhnikov c7a255b462 * src/cff/cffdrivr.c (cff_get_advances): Do only fast advances.
Otherwise, let TT_Get_Advances fall back on cff_load_glyph to do
slow advances. This avoids unchecked access to cff_load_glyph and
this is how tt_get_advances is implemented.
2025-01-07 19:52:29 -05:00
Alexei Podtelezhnikov 81330e1f8a * src/truetype/ttgload.c (TT_Load_Glyph): Consolidate flag setting. 2025-01-03 22:54:20 -05:00
Alexei Podtelezhnikov 5245fd69fd Delay FT_GLYPH_FORMAT_OUTLINE assignmets.
This assignmets used to be done prematurely before errors were checked
and outlines were actually loaded. Delaying the assignment provides
certain protection against careless usage of malformed input that
should now remain FT_GLYPH_FORMAT_NONE.

* src/cff/cffgload.c (cff_slot_load): Ditto.
* src/cid/cidgload.c (cid_slot_load_glyph): Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Ditto.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
2025-01-03 21:26:10 -05:00
Alexei Podtelezhnikov afc7000cac * builds/compiler/gcc-dev.mk: Silence some warnings. 2025-01-03 18:17:49 +00:00
Alexei Podtelezhnikov 64f8b7fbd0 Remove superfluous outline zeroing.
This is already done by `ft_glyphslot_clear`.

* src/cff/cffgload.c (cff_slot_load): Do not zero outline fields.
* src/cid/cidgload.c (cid_slot_load_glyph: Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Ditto.
* src/truetype/ttgload.c (load_sbit_image): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
2025-01-02 18:22:24 +00:00
Alexei Podtelezhnikov 10b3b14da2 * src/truetype/ttobjs.c: Abbreviate tracing. 2025-01-01 23:04:14 -05:00
Alexei Podtelezhnikov 1beb83fd12 * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Refactor `flip`. 2025-01-01 22:28:36 -05:00
Alexei Podtelezhnikov abed051e06 [truetype] Consolidate bitmap strike handling.
* src/truetype/ttgload.c (TT_Load_Glyph): Relocate omitted whitespace
strike handling from here...
(load_sbit_image): ... to here.
2025-01-01 14:40:58 -05:00
Alexei Podtelezhnikov 4ef8eed11b [truetype] Ingnore FT_LOAD_NO_BITMAP in bitmap-only fonts.
For consistency with other bitmap-only fonts, we should ignore this
flag of the font is not scalable.

* src/truetype/ttgload.c (TT_Load_Glyph): Check if face is scalable
when checking for FT_LOAD_NO_BITMAP.

* docs/CHANGES: Start new chapter wtith this change.
2024-12-31 16:25:50 -05:00
Ben Wagner 38272bf853 [ftstroke] Fix invalid pointer assignement to `arc`
In `FT_Stroker_ConicTo` and `FT_Stroker_CubicTo` there is a `bez_stack`.
`arc` is initialized with `arc = bez_stack` and is never set to point
into any different object. The main loop looks like `while ( arc >=
bez_stack )` which is depending on a later `arc -= 2` (or `arc -= 3`) to
make `arc` point to before `bez_stack`. However, using pointer
subtraction to make `arc` point outside the array is undefined behavior,
and attempting to use the value in the loop predicate is "very"
undefined behavior. (C99 "Additive operators" 6.5.6.8.)

This particular undefined behavior was discovered as either hangs or
MemorySantizer issues after "[InstCombine] Infer nuw for gep inbounds
from base of object" [0]. With this change, clang can infer that `arc`
must always point into the `bez_stack` object and therefore cannot be at
a "negative index" so the predicate is always true.

[0] e21ab4d16b

* src/base/ftstroke.c (FT_Stroker_ConicTo, FT_Stroker_CubicTo): test
loop exit condition (there are no more arcs to process) before
decrementing `arc`

Fixes: #1307
2024-12-16 14:39:10 -05:00
Ben Wagner 59320b2d3c [cff] Fix leak of cmap data
When `sfnt->load_face` succeeds it has already loaded any (optional)
cmap data. As a result, a subsequent call to `sfnt->load_cmap` will
overwrite the cmap data pointer with a new copy of the data but not free
the old, leading to a leak.

This is a fix for "* src/cff/cffobjs.c (cff_face_init): Better handling
of Type0 fonts.". This still allows the cmap to be missing but avoids
the leak by only calling `sfnt->load_cmap` when there is no `head`
table (the font data is not being loaded as OpenType/CFF).

* src/cff/cffobjs.c (cff_face_init): Fix leak

Fixes: #1306
2024-12-04 16:55:10 -05:00
Honnesh Ramachandra 3f3e3de34e * src/cff/cffobjs.c (cff_face_init): Better handling of Type0 fonts.
This issue relates to the PDF specification and its usage of CFF-based
embedded Type0 fonts.  For Type0 fonts containing CID-keyed descendant
CFF-based fonts, the glyph index is the CID present in the content stream.
As a result, there is no requirement for a 'cmap' table to be present in the
font since the glyph indices are derived directly from the CIDs.  FreeType
throws an error when it doesn’t find a 'cmap' table for such an Open Type
font containing CFF outlines.  This commit relaxes this requirement for a
'cmap' table for such fonts.
2024-11-06 06:28:41 +01:00
suzuki toshiya 0ae7e60737 Download the latest gnu-config files in `make dist`.
* builds/toplevel.mk: In `make dist`, checkout gnu-config
git repository at savannah, copy the latest versions of
`config.guess` and `config.sub` to builds/unix/.  Also
the latest version of `gitlog-to-changelog` is used to
generate `ChangeLog`.
2024-10-18 14:08:19 +09:00
Behdad Esfahbod 1394436633 Move generic destroy to later in the face and size destruction.
* src/base/ftobjs.c (destroy_size, destroy_face): This is such that the
  generic destroy can be used to call `FT_Done_Library`.  For that to work,
  it needs to call it *after* having removed the face from the respective
  module.
2024-10-16 05:08:22 +02:00
Alexei Podtelezhnikov f02bffad0f * src/truetype/ttgload.c (load_truetype_glyph): Rearrange. 2024-10-14 11:47:31 +00:00
suzuki toshiya 5f2abe76fe * autogen.sh: Fix for Solaris 10.
o Replace `test -e` by `test -d` (directory) and `-h`
  (symlink), because pre-POSIX /bin/sh of Solaris 10
  does not support `test -e`.
o Replace the combination of `head` and `sed ...` by
  single sed command `sed -n 1...p`.  GNU libtoolize
  with Solaris 10 /bin/sh complains "Broken Pipe" for
  the closure of stdout by `head`.  Let `sed` receive
  all stdout and discard.
2024-10-14 10:26:17 +09:00
Alexei Podtelezhnikov 089ccb1bfa * src/smooth/ftgrays.c (gray_convert_glyph): Clear stack pointers.
Fixes a dangling pointer warning, see #1299.
2024-10-13 12:14:43 -04:00
suzuki toshiya 5f20c89215 apinames: Fix a buffer overrun for VMS platform.
Some output formats may rewrite symbol names during the output,
like the concatenation of "64__" suffix on VMS.  To estimate
sufficient size to store symbol name, pass the output format
info to `names_add`.  For VMS, `names_add` allocates longer
buffer to append "64__".

* apinames.c (SUFFIX_VMS_64ADDR): New macro of "64__".
(main): Pass the format info to `read_header_file`.
(read_header_file): Pass the format info to `names_add`.
(names_add): Receive the format info, and reserve the symbol
name buffer 4 byte longer in the case of VMS, to append the
suffix in `names_dump`.
2024-10-13 21:18:47 +09:00
suzuki toshiya 26b545f368 apinames: Fix out-of-scope reference of a static array.
* apinames.c (names_dump): For WATCOM_LBC format, the
  DLL name with no suffix is constructed on a static
  array temp[], but the scope is closed before use it.
  The declaration of temp[] is moved to the wider
  scope for the dumping part to refer it.
2024-10-13 11:39:14 +09:00
Alexei Podtelezhnikov 7c09421d83 * vms_make.com: Format rules.
Use tabs in rules only à la Makefile.
2024-10-12 08:22:51 -04:00
Marian Klymov b4ca23bed1 * meson.build: Define DLL_EXPORT for shared library only.
Fixes #1298.
2024-10-12 10:57:59 +00:00
Benoit Pierre 78ff353509 * meson.build: Minor improvements. 2024-10-12 10:51:25 +00:00
Benoit Pierre 34aed655f1 * meson.build: Fix `bzip2` option handling. 2024-10-12 10:49:46 +00:00
Benoit Pierre f4c2a44ea9 * meson.build: Add support for compiling with error strings.
* meson_options.txt: Document it.
2024-10-12 10:47:38 +00:00
suzuki toshiya 0dd4eef68f Fix help message of apinames.
* src/tools/apinames.c: The first header file must be
  given after the options.  All arguments after the
  first header file are dealt as header files to be
  parsed, regardless with their leading "-".

  For example,
  "apinames include/freetype/freetype.h -dFREETYPE.DLL"
  warns "unable to open -dFREETYPE.DLL".

  Thus, the "header1" must be given after the arguments
  to be parsed as the options.
2024-10-10 15:56:22 +09:00
Jouk Jansen c82745878d Minor fixes for OpenVMS.
* vms_name.com: Suppress a warning with the latest Clang compiler.

* builds/vms/apinames_vms.bash: Use absolute path to avoid dependency on the
  environment.
2024-09-21 06:41:47 +02:00
Alexei Podtelezhnikov 83af801b55 * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Respect metrics_only.
Also fixes recursive flip.
2024-09-07 13:44:57 -04:00
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