Path to this page:
Subject: CVS commit: pkgsrc/graphics/freetype2
From: Ryo ONODERA
Date: 2022-01-04 14:16:17
Message id: 20220104131617.BC776FAEC@cvs.NetBSD.org
Log Message:
freetype2: Update to 2.11.1
Changelog:
2021-12-02 Werner Lemberg <wl@gnu.org>
* Version 2.11.1 released.
==========================
Tag sources with `VER-2-11-1'.
* docs/VERSION.TXT: Add entry for version 2.11.1.
* docs/CHANGES, docs/release: 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.11.0/2.11.1/, s/2110/2111/.
* include/freetype/freetype.h (FREETYPE_PATCH): Set to 1.
* builds/unix/configure.raw (version_info): Set to 24:1:18.
* CMakeLists.txt (VERSION_PATCH): Set to 1.
* builds/toplevel.mk (version_tag, CHANGELOG_SCRIPT): New variables.
(do-dist): Generate `ChangeLog` file with all commits since last release.
2021-11-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Improve debugging.
* builds/windows/ftdebug.c (FT_Message, FT_Panic): Buffer output
and call `OutputDebugStringA` only if `IsDebuggerPresent`.
[_WIN32_WCE] (OutputDebugStringA): Implement the missing API.
2021-11-29 Seigo Nonaka <nona@google.com>
* src/base/ftobjs.c (FT_Request_Metrics): Fix build warning on Android.
Use casts since `FT_USHORT_MAX` is unsigned short in bionic (libc used in
Android).
2021-11-28 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj (DlgCopy): Minor tweak.
2021-11-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttpload.c (tt_face_load_hdmx): Added comments.
2021-11-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Quietly reject out-of-spec `hdmx` tables.
The `hdmx` table is optional and can be safely rejected without
an error if it does not follow specifications. The record size
must be equal to the number of glyphs + 2 + 32-bit padding.
* src/truetype/ttpload.c (tt_face_load_hdmx): Thoroughly check
the record size and improve tracing.
2021-11-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Partly revert 5b626281.
Fixes #1118.
* src/truetype/ttpload.c (tt_face_load_hdmx): Do not assume that
`record_size` is rounded even though the records are padded.
2021-11-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj (DlgCopy): Use transforms.
2021-11-22 Werner Lemberg <wl@gnu.org>
Update `CHANGES` files, other minor whitespace and documentation issues.
2021-11-21 Werner Lemberg <wl@gnu.org>
formats.txt: Add info about WOFF and WOFF2.
2021-11-21 Werner Lemberg <wl@gnu.org>
meson.build: Initialize `common_ldflags`.
2021-11-21 Lukas Oberhuber <@lukaso>
* meson.build: Fix compatibility version on MacOS.
Fixes #1117.
2021-11-21 Werner Lemberg <wl@gnu.org>
* src/truetype/ttinterp.c (Ins_MD): Avoid `FT_ABS`.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38562
2021-11-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/fttypes.h (FT_MAKE_TAG): Remove the same casting.
2021-11-20 Werner Lemberg <wl@gnu.org>
[gxvalid] Fix minor compilation warning.
* src/gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup): Declare
as static.
2021-11-20 Werner Lemberg <wl@gnu.org>
[smooth] Fix stand-alone compilation.
* src/smooth/ftgrays.c (FT_Trace_Enable, FT_Trace_Disable)[STANDALONE_]:
Define.
2021-11-20 Werner Lemberg <wl@gnu.org>
Avoid undefined left-shifts.
We really have to use double casts to avoid issues with C's and C++'s
signedness propagation rules in implicit casts.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41178
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41182
* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): Modify macro to take two arguments.
Update all callers.
(FT_STATIC_BYTE_CAST): New macro.
* include/freetype/freetype.h (FT_ENC_TAG): Use `FT_STATIC_BYTE_CAST`.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG): Ditto.
Use `FT_Tag` for casting.
* src/ftraster/ftmisc.h (FT_MAKE_TAG): Removed, no longer needed.
(FT_STATIC_BYTE_CAST): New macro.
* src/smooth/ftgrays.c (FT_STATIC_CAST): Replace with...
(FT_STATIC_BYTE_CAST): ... this.
2021-11-18 Werner Lemberg <wl@gnu.org>
Provide C++ versions for public macros with casts.
Many FreeType clients use C++. However `g++ -Wold-style-cast` warns for
macros with C-style casts even for system header files; this also affects
directories included with `-isystem`. While this could be seen as a problem
with g++, the problem is more a philosophical one: Over the time, C and C++
diverged more and more, and some features of C are no longer the 'right'
solution in C++.
* include/freetype/config/public-macros.h (FT_STATIC_CAST,
FT_REINTERPRET_CAST): New macros.
* include/freetype/freetype.h (FT_ENC_TAG, FT_LOAD_TARGET_,
FT_LOAD_TARGET_MODE): Use `FT_STATIC_CAST`.
Correctly handle negative 'signed char' input.
* include/freetype/ftimage.h (FT_IMAGE_TAG): Ditto.
* include/freetype/fttypes.h (FT_MAKE_TAG, FT_BOOL): Ditto.
* include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): Use
`FT_REINTERPRET_CAST`.
* src/smooth/ftgrays.c (FT_STATIC_CAST)[STANDALONE_]: New macro.
[!STANDALONE]: Include `FT_CONFIG_CONFIG_H`.
Fixes #1116.
2021-11-16 Werner Lemberg <wl@gnu.org>
Fix clang++ warnings.
* src/*: Initialize some variables to NULL.
2021-11-16 Werner Lemberg <wl@gnu.org>
[truetype] Updates for the forthcoming OpenType 1.9 standard (2/2).
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store):
s/shortDeltaCount/wordDeltaCount/ (as done in the specification, too).
Recognize new format and reject it for now.
2021-11-16 Werner Lemberg <wl@gnu.org>
[truetype] Updates for the forthcoming OpenType 1.9 standard (1/2).
This is in preparation for implementing `DeltaSetIndexMap` format 1, which
is used by `COLR` v1 tables, and which allows 32bit indices.
\
https://docs.microsoft.com/en-us/typography/opentype/otspec190/delta/otvarcommonformats_delta.html
* src/truetype/ttgxvar.h (GX_DeltaSetIdxMapRec): Change type of `mapCount`
to `FT_ULong`.
* src/truetype/ttgxvar.c (ft_var_load_delta_set_index_mapping): Add argument
for passing the table size; update caller.
Implement new format.
2021-11-14 Werner Lemberg <wl@gnu.org>
Fix clang warnings.
* src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block.
* src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto.
* src/smooth/ftgrays.c (gray_convert_glyph): Add cast.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast.
* src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter.
(parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
2021-11-13 Dominik Röttsches <drott@chromium.org>
[sfnt] Avoid undefined shifts in `COLR` v1 paint parsing
* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Tighten shift
behavior by using multiplication, mostly using macros from ftcalc.h.
Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1269168
2021-11-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Improve `DlgCopy` target.
Fixes #1113.
* builds/windows/vc2010/freetype.vcxproj: Run `DlgCopy` conditionally
and decouple it from `Build`.
2021-11-12 Alexei Podtelezhnikov <apodtele@gmail.com>
Explicitly define `FT_MSB` for Clang.
* include/freetype/internal/ftcalc.h [__clang__] (FT_MSB): Updated.
2021-11-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgxvar.c (ft_var_to_normalized): Edge optimization.
2021-11-10 Alexei Podtelezhnikov <apodtele@gmail.com>
Additional `FT_MSB` macro definitions.
Better macros for Windoes CE and ARM in general, based on !109
from metarutaiga.
* include/freetype/internal/ftcalc.h [_MSC_VER] (FT_MSB): Updated.
2021-11-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[build/windows] Remove logging from default debug configurations.
DLG is rather costly for performance and should be used judiciously.
This removes it from the default configurations but gives an example
how to enable it using the `UserDefines` property.
* builds/windows/vc2010/freetype.vcxproj: Hide FT_DEBUG_LOGGING.
2021-11-08 Werner Lemberg <wl@gnu.org>
* src/sfnt/sfobjs.c (sfnt_open_font): Fix typo.
2021-11-08 Werner Lemberg <wl@gnu.org>
* src/gxvalid.*, src/otvalid.*: Fix `-Wformat` warnings.
2021-11-08 Werner Lemberg <wl@gnu.org>
[pshinter] Fix C++ compilation.
* src/pshinter/pshalgo.c (psh_compute_dir): Fix type of `result`.
(psh_hint_table_find_strong_points): Add cast.
2021-11-08 Werner Lemberg <wl@gnu.org>
[sfnt] Reduce footprint if WOFF and WOFF2 support is not needed.
Based on a patch from metarutaiga (MR !106). The gist of this commit is
that it doesn't make sense to support WOFF without compression (which would
be only possible in WOFF 1.0 anyway).
* src/sfnt/sfobjs.c (sfnt_open_font): Guard WOFF code with
`FT_CONFIG_OPTION_USE_ZLIB` block.
Guard WOFF2 code with `FT_CONFIG_OPTION_USE_BROTLI` block.
* src/sfnt/sfwoff.c, src/sfnt/sfwoff.h: Guard files with
`FT_CONFIG_OPTION_USE_ZLIB` blocks, not parts of the code.
* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h, src/sfnt/woff2tags.c,
src/sfnt/woff2tags.h: Guard files with `FT_CONFIG_OPTION_USE_BROTLI` blocks,
not parts of the code.
Fixes #1111.
2021-11-08 Werner Lemberg <wl@gnu.org>
[truetype] Make trickyness checks depend on TT_USE_BYTECODE_INTERPRETER.
Based on a patch from metarutaiga (MR !106).
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag,
tt_check_trickyness_family, tt_synth_sfnt_checksum, tt_get_sfnt_checksum,
tt_check_trickyness_sfnt_ids, tt_check_trickyness): Put functions into a
`TT_USE_BYTECODE_INTERPRETER` block.
(tt_face_init): Put trickyness checks into a `TT_USE_BYTECODE_INTERPRETER`
block.
Fixes #1111.
2021-11-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_gasp): Fix a type mismatch warning.
2021-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[dlg] Define DLG_STATIC explicitly.
DLG_STATIC is intended to disable Windows DLL linking attributes.
It does not hurt to define it explicitly when we wrap DLG code.
This fixes tons of LNK4286 and C4273 warnings from MSVC if we
forget to define DLG_STATIC as a compiler option.
* builds/windows/vc2010/freetype.vcxproj: Remove DLG_STATIC option.
* src/dlg/dlgwrap.c [FT_DEBUG_LOGGING]: Define DLG_STATIC.
* include/freetype/internal/ftdebug.h [FT_DEBUG_LOGGING]: Ditto.
2021-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[dlg] Lighten up the inclusions.
The DLG wrapper needs to know if FT_DEBUG_LOGGING is defined in
`ftoption.h`. It does not need entire FreeType.
* src/dlg/dlgwrap.c: Include FT_CONFIG_OPTIONS_H directly.
2021-11-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Avoid some memory zeroing in variations.
* src/truetype/ttgxvar.c (ft_var_readpackeddeltas, ft_var_load_avar,
ft_var_load_item_variation_store, ft_var_load_gvar): Use FT_QNEW_ARRAY
if memory immediately initialized or discarded otherwise.
2021-11-05 Jany Belluz <jany.belluz@daltonmaag.com>
[truetype] Fix handling of packed deltas in Variation Fonts.
* src/truetype/ttgxvar (ft_var_readpackeddeltas): Don't expect the number of
bytes used to encode the deltas to be higher than the number of encoded
values. The specification allows a very compact encoding; for example, a
list of 200 zeros can be encoded with just a couple of bytes.
We now count the consumed bytes to make sure to not read more than expected.
2021-11-04 Jany Belluz <jany.belluz@daltonmaag.com>
[truetype] Fix CVAR handling of tuples for all points.
* src/truetype/ttgxvar (tt_face_vary_cvt): Function
`ft_var_readpackedpoints`, when it returns `ALL_POINTS`, also sets
`point_count` to value 0. However, the CVAR code was incorrectly expecting
that `point_count` would be set to match the length of the CVT table.
2021-11-04 Jany Belluz <jany.belluz@daltonmaag.com>
* src/truetype/ttgxvar.c: Fix typos in macros that guard CVAR code.
2021-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
* docs/INSTALL: Mention Meson and MSBuild more prominently.
2021-11-03 Gabor Kertesz <gabor.kertesz@linaro.org>
[libpng] Update Meson wrap for win-arm64
1.6.37-5 released patches for win-arm64 to successfully build
libpng with Meson:
https://github.com/mesonbuild/wrapdb/pull/205
https://github.com/mesonbuild/wrapdb/pull/216
Updated by the following command:
meson wrap update libpng
Tested on win-arm64 and x64.
2021-11-03 Dominik Röttsches <drott@chromium.org>
[sfnt] Clarify `COLR` v1 FT_Paint* format representations
* include/freetype/ftcolor.h (FT_PaintLinearGradient,
FT_PaintRadialGradient, FT_PaintSweepGradient, FT_PaintTransform,
FT_PaintTranslate, FT_PaintScale, FT_PaintRotate, FT_PaintSkew): Clarify
16.16 fixed point representation of struct fields.
* src/sfnt/ttcolr.c (read_paint): Shift coordinates for
FT_PaintLinearGradient, FT_PaintRadialGradient, FT_PaintSweepGradient
accordingly.
Fixes: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1110
2021-11-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Let MSBuild handle DLG copy.
* builds/windows/vc2010/freetype.vcxproj: Specify DlgCopy target.
* builds/windows/vc2010/script.bat: Deleted.
2021-10-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttgload.c (load_truetype_glyph): Fix MSVC warning C4312.
2021-10-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Separate MSVC linker and librarian.
MSVC uses LIB for static and LINK for dynamic libraries. They are
related but the former has much smaller set of options.
* builds/windows/vc2010/freetype.vcxproj: Updated.
2021-10-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Revise MSVC linking optimizations.
* builds/windows/vc2010/freetype.vcxproj: Optimize DLL linking only.
* builds/windows/visualc/freetype.dsp: Ditto.
* builds/windows/visualc/freetype.vcproj: Ditto.
2021-10-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff] Optimize table tagging.
* include/freetype/internal/wofftypes.h (WOFF_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff.c (woff_open_font): Use 32-bit tag.
2021-10-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff2] Optimize table tagging.
Fixes #1107.
* include/freetype/internal/wofftypes.h (WOFF2_TableRec): Use
32-bit tag.
* src/sfnt/sfwoff2.c (compare_tags, find_table, woff2_open_font):
Use 32-bit tag.
* src/sfnt/woff2tags.[ch] (woff2_known_tags): Use static storage and
return 32-bit tag.
2021-10-26 Werner Lemberg <wl@gnu.org>
Formatting.
2021-10-26 Ben Wagner <bungeman@chromium.org>
[mm] Tolerate missing Blend dictionary entries
In a Multiple Master font, the Blend dictionary must contain valid
Private, FontInfo, and FontBBox. The current code will error if any of
these are present and invalid, but will not error and will provide
uninitialized data if the Blend dictionary exists but does not contain
one of these entries. This change reverts to the older behavior of
treating any missing entries as containing all zero data and not
returning an error.
In the future it may be best to keep track of when these are actually
initialized and error if they are not.
* src/type1/t1load.c (t1_allocate_blend): Zero initiailize.
2021-10-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Add MSVC linker optimazations.
We continue to build static libraries with statically linked C run-
time and add options to optimize references.
* builds/windows/vc2010/freetype.vcxproj: Sort entries, add options.
2021-10-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj: Use MachineARM64.
2021-10-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Prioritize x64.
* builds/windows/vc2010/freetype.sln: Sort entries.
2021-10-22 Gabor Kertesz <gabor.kertesz@linaro.org>
[builds/windows] Add ARM64 platform.
* builds/windows/vc2010/freetype.sln: Updated
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Minor fix.
2021-10-21 Ben Wagner <bungeman@chromium.org>
[mm] Delay setting blend weight and design position.
Previously the `blend->weight_vector`, `blend->default_weight_vector`,
and `blend->design_pos` were set early to allocated but uninitialized
memory under the assumption that the memory would eventually be
initialized. However, it is possible that some of the required
keywords may not actually be present, leaving the memory uninitialized.
This is different from a present but invalid table, which would produce
an error.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1261762
* src/type1/t1load.c (t1_allocate_blend): Remove early allocation and
initialization.
(parse_blend_design_positions, parse_weight_vector): Parse into local
and assign to blend if valid.
(T1_Open_Face): Check that if a blend exists that it has the weight
vector and design positions.
2021-10-21 Ben Wagner <bungeman@chromium.org>
[cff] Commit vstore data and regions on allocation.
The vstore->regionCount and vstore->dataCount were read directly
from the data. However, vstore->varRegionList and vstore->varData
would still contain uninitialized entries with uninitialized
pointers in the event of an error, leading to issues when attempting
to clean up.
Reportd as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40104
* src/cff/cffload.c (cff_vstore_load): Read the region and data counts
into locals and update the vstore counts immediately after each entry
becomes free-able.
2021-10-20 Ben Wagner <bungeman@chromium.org>
[sfnt] Delay setting gasp ranges and count until computed.
Previously, the gasp.numRanges was set and gasp.gaspRanges was
allocated and assigned before a possible early exit if the frame could
not be entered. It is also possible that the gaspRanges allocation
could fail but the numRanges still be set to non-zero. In such cases
an error would be returned, but the face would have a gasp in an
inconsistent state which may still be accessed.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1261450
* src/sfnt/ttload.c (tt_face_load_gasp): Delay setting gasp.numRanges
and gasp.gaspRanges until after the ranges are initialized.
2021-10-20 Ben Wagner <bungeman@chromium.org>
[sfnt] Delay setting names and langTags until computed.
Previously, the table->names and table->langTags fields were created
pointing to uninitialized memory and an early exit could happen if the
frame could not be entered. The caller would then be unable to properly
dispose of the memory as the string fields had not been initialized.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1261343
* src/sfnt/ttload.c (tt_face_load_name): delay setting table->langTags
and table->names until after the memory they will point to is fully
initialized.
2021-10-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* tests/issue-1063/main.c: s/PATH_MAX/FILENAME_MAX/.
Closes !97 for Windows by using a standard macro.
2021-10-19 Werner Lemberg <wl@gnu.org>
[bdf, cid, pfr, winfonts] Improve rejection of other font formats.
This is mainly for better diagnostics of malformed fonts.
* src/bdf/bdflib.c (_bfd_readstream): Stop font format testing if the first
input line is too long or doesn't end with `\r` or `\n`.
* src/cid/cidparse.c (cid_parser_new): Don't handle too short input as an
error but as an unknown format.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/winfonts/winfnt.c (fnt_font_load, fnt_face_get_dll_font): Ditto.
2021-10-19 Alexei Podtelezhnikov <apodtele@gmail.com>
[pcf] Zero out the allocated properties.
Fallout reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40033
* src/pcf/pcfread.c (pcf_get_properties): Use FT_NEW_ARRAY and zero
out `properties` in case of failure.
2021-10-18 Werner Lemberg <wl@gnu.org>
configure: Use string comparison for directory inodes.
Inode values might be larger than integers supported by the shell.
Fixes #1105.
2021-10-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_name): NULL-initialize langTag.
Another attempt to fix fallout reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40024
2021-10-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Fix up user properties.
Fallout reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40027
* src/bdf/bdflib.c (_bdf_add_property): Cosmetic NULL.
(bdf_create_property): Limit allocations to customary signed
FT_Long and NULL-initialize unused storage.
(bdf_free_font): Do not free unused storage.
2021-10-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttload.c (tt_face_load_name): Accounting fix.
Fallout reported as
https://crbug.com/40024
2021-10-16 Ben Wagner <bungeman@chromium.org>
Fix typos in memory macros.
FT_QNEW_ARRAY and FT_QRENEW_ARRAY were using the non-Q
FT_MEM_NEW_ARRAY and FT_MEM_RENEW_ARRAY. Change these to use the Q
versions. Also fix the one issue discovered in tt_face_load_name
where table->names is created with FT_QNEW_ARRAY but the extra
string member is not initialized to NULL.
* include/freetype/internal/ftmemory.h (FT_Q(RE)NEW_ARRAY):
Use FT_MEM_Q(RE)NEW_ARRAY as needed.
* src/sfnt/ttload.c (tt_face_load_name): Initialize `entry->string`.
2021-10-15 Ben Wagner <bungeman@chromium.org>
[truetype] Reload context after re-executing `prep`.
When a different hinting mode from the current is selected, the `prep` table
must be re-executed with the new mode. After this happens the context must
be re-loaded in preparation for the glyph program to be run.
Fixes #1104.
* truetype/ttgload.c (tt_loader_init): Add call to `TT_Load_Context`.
2021-10-15 Werner Lemberg <wl@gnu.org>
[truetype] Minor documentation improvements.
2021-10-14 Anurag Thakur <anuthadev@gmail.com>
Add clang build to linux CI
2021-10-12 Anurag Thakur <anuthadev@gmail.com>
CI: Add macOS CI, including a clang build
2021-10-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (parse_fd_array): Protect against trancation.
2021-10-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1] Revert to signed size for binary data.
Recently introduced and reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39838
* src/type1/t1load.c (read_binary_data): Reject negative size.
(parse_subrs, parse_charstrings): Use customary signed size.
2021-10-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] Signedness revisions.
Unsigned indexes are easier to check.
* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated.
* src/psaux/psintrp.c (cf2_interpT2CharString): Ditto.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
* src/type1/t1load.c (read_binary_data): Ditto.
2021-10-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[cid] Signedness revisions.
Unsigned checks are simpler.
* include/freetype/t1tables.h (CID_FaceInfoRec): Change to unsignd
`num_dicts`.
* src/cid/cidparse.h (CID_Parser): Change to unsigned `num_dict`.
* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.c (cid_load_keyword, parse_fd_array,
parse_expansion_factor, parse_font_name, cid_read_subrs,
cid_face_open): Updated.
* src/cid/cidobjs.c (cid_face_done): Updated.
* src/cid/cidparse.c (cid_parser_new): Updated.
2021-10-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_face_open): Streamline CIDCount check.
2021-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_face_open): Streamline SubrCount check.
2021-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading.
2021-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Signedness revisions.
This eliminates explicit casting by switching to unsigned fields.
The revisions mostly impact the handling of CID fonts.
* include/freetype/fttypes.h (FT_Data): Change to unsigned `length`.
* include/freetype/t1tables.h (CID_FaceDictRec): Ditto for `sd_bytes`.
(CID_FaceInfoRec): Ditto for `gd_bytes` and `gd_bytes`.
* include/freetype/internal/tttypes.h (TT_LoaderRec): Ditto for
`byte_len`.
* src/cid/cidgload.c (cid_load_glyph): Updated.
* src/cid/cidload.h (cid_get_offset): Update argument.
* src/cid/cidload.c (cid_get_offset, cid_read_subrs, cid_face_open):
Updated.
* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data):
Updated.
* src/psaux/psft.c (cf2_getT1SeacComponent): Updated.
* src/truetype/ttgload.c (TT_Process_Composite_Glyph,
load_truetype_glyph): Updated.
2021-10-07 Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
meson.build (gen_docs): Use `current_source_dir` instead of `source_root`.
These two are not equal when FreeType is used as a subproject, such as in
`freetype-demos`. In that case, `source_root` points at the root project,
causing the docs build to fail.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (FT_DIV_MOD): Limit the ARM workaround.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/unix, builds/vms] Standardize `mmap` failure.
* builds/unix/ftsystem.c (FT_Stream_Open): Check for MAP_FAILED.
* builds/vms/ftsystem.c (FT_Stream_Open): Ditto.
This should cover https://savannah.nongnu.org/patch/?5909 as well.
2021-10-05 Hugh McMaster <hugh.mcmaster@outlook.com>
autogen.sh: Only copy submodules if building from a git branch.
`autogen.sh` fails if building from a standard source tarball. Firstly, git
expects to be called in a git repository, then `copy_submodule_files`
blindly attempts to copy files.
Debian, Ubuntu, Linux Mint, and other derivatives all run `autogen.sh`
before compiling to regenerate build files.
This patch ensures that various git commands are only called and 'dlg' files
are only copied if `autogen.sh` is called from a git repository.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/internal/ftgloadr.h: Add missing header.
Noticed by Jouk Jansen.
2021-10-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Additional clean-ups.
* src/pshinter/pshalgo.h (psh_hint_table_find_strong_points): Streamline code.
* src/pshinter/pshalgo.h (PSH_Glyph): Remove unused fields.
2021-10-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] More convenient direction definition.
It is easier to check directions using flags than integer values.
* src/pshinter/pshalgo.h (PSH_Dir): Redefine directions.
(PSH_PointRec): Use them as an enum type.
* src/pshinter/pshalgo.c (psh_compute_dir): Modify return type.
(psh_glyph_init, psh_hint_table_find_strong_points,
psh_glyph_find_blue_points): Update users.
2021-10-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[pshinter] Remove unnecessary check.
* src/pshinter/pshalgo.c (psh_hint_table_find_strong_points): Do not
check if direction is defined before checking how.
2021-10-02 AnuthaDev <anuthadev@gmail.com>
CI: Hardcode meson version to fix build failure on windows
2021-10-01 Alexei Podtelezhnikov <apodtele@gmail.com>
Additional `FT_MSB` macro definitions.
* include/freetype/internal/ftcalc.h [__DECC,_CRAYC]: Use builtins
and intrinsics.
2021-10-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/autofit/afhints.c (af_glyph_hints_reload): Decrease casting.
2021-09-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/tools/apinames.c: Facilitate OpenVMS linker options.
2021-09-29 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/winfonts/winfnt.c (FNT_Face_Init): Correct reallocation.
2021-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/unix] Do not use autoconf SIZEOF.
* builds/unix/ftconfig.h.in [FT_USE_AUTOCONF_SIZEOF_TYPES]: Removed.
* builds/unix/configure.raw: Remove AC_CHECK_SIZEOF and update.
After this commit, autoconf builds will fully rely on <limits.h>
rather than falling back on it if AC_CHECK_SIZEOF failed for some
reason. There is a risk that misconfigured cross-compilation might
have wrong headers. Note that Meson and CMake builds always relied on
<limits.h> for sizes and availability of integer types.
2021-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
Propagate sign when reading OFF3.
Signed 24-bit values are extremely rare. FreeType only reads them in
PFR fonts with bitmap strikes conditionally. They have not been seen
in the known fonts. That is why this bug could never be discovered.
`FT_FRAME_OFF3` propagates sign correctly.
* include/freetype/internal/ftstream.h (FT_PEEK_OFF3, FT_PEEK_OFF3_LE):
Propagate sign into 32-bit value.
(FT_GET_OFF3, FT_READ_OFF3): Needed fixing but removed as unused.
2021-09-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Simplify comment collection or lack thereof.
BDF comments are neither actually collected nor retrieved. There is
no need to be fancy with delimiters.
* src/bdf/bdflib.c (_add_bdf_comment): Delimit comments with zeros...
(bdf_load_font): ...and do not null-terminate comments additionally.
(_bdf_parse_glyphs): Check if comments are kept, which they are not.
(_bdf_parse_start): Minor clean up.
2021-09-24 Alexei Podtelezhnikov <apodtele@gmail.com>
Use NULL for pointers only.
* src/bdf/bdflib.c (*): Code changes.
* include/freetype/freetype.h: Comments only.
* src/cff/cffload.c, src/cff/cffobjs.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
2021-09-23 Werner Lemberg <wl@gnu.org>
Minor documentation fixes and improvements.
2021-09-23 Alexei Podtelezhnikov <apodtele@gmail.com>
Reference `fopen` in the docs.
2021-09-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf, pcf] Minor optimization.
* src/pcf/pcfread.c (pcf_load_font): Do not call `FT_MulDiv` for a
small job.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto.
* src/bdf/bdflib.c (_bdf_parse_glyphs): Fix a comment.
2021-09-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Initialize stream memory earlier.
With Windows memory management tracking heap, it is important to use
it during the stream opening fallback. In Unix, the argument is
unused, but it is better to set it correctly.
* src/base/ftobjs.c (FT_Stream_New): Set memory before calling
`FT_Stream_Open`.
* builds/windows/ftsystem.c, builds/unix/ftsystem.c (FT_Stream_Open,
ft_close_stream_by_free): Call `ft_alloc` and `ft_free` with proper
memory argumment.
2021-09-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Revert back to `CreateFileA` only.
Calling `CreateFileW` without making sure that the patname is really
`wchar_t` is a bad idea and can lead to unpredictable overreads. For
Windows CE, we impelemnt the missing API.
Fixes #1098 and !76 again.
* builds/windows/ftsystem.c (FT_Stream_Open): Call `CreateFileA`.
[_WIN32_WCE] (CreateFileA, FileSizeEx): Implement missing interfaces.
2021-09-21 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_parse_{start,glyphs}): Use appropriate scanner.
2021-09-21 Alexei Podtelezhnikov <apodtele@gmail.com>
Minor.
2021-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffdrivr.c (cff_ps_get_font_{info,extra}): Use FT_QNEW.
2021-09-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Minor clean-ups.
* src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Remove parantheses.
* src/cache/ftccache.c (FTC_Cache_Lookup): Ditto.
(FTC_Cache_RemoveFaceID): Remove unnecessary variable.
2021-09-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Try both wide and narrow `CreateFile`
Windows handles wchar_t* UTF-16 and char* ANSI (presently UTF-8)
filenames using alternative -A and -W API. We'll try them both
when opening a file. This means that you should not worry about
about conversions.
Fixes #1098 and !76.
* builds/windows/ftsystem.c (FT_Stream_Open): Call alternative
`CreateFile` in the case of failure.
2021-09-17 Edwin Steiner <edwin.steiner@gmail.com>
[cff] Explicitly set StandardEncoding or ExpertEncoding offsets.
Fixes #1097.
* src/cff/cffload.c (cff_encoding_load): Set special offset values.
2021-09-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Miscellaneous clean-ups.
* src/cache/ftccache.c (ftc_get_top_node_for_hash, FTC_Cache_Clear):
Remove barely used variables.
(ftc_cache_add): Adjust casting.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Remove casting.
* src/cache/ftcsbits.c (ftc_snode_load): Remove casting.
2021-09-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffload.c (cff_fd_select_get): Remove casting.
2021-09-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pcf/pcfread.c (pcf_read_TOC): Remove casting.
2021-09-15 Alexei Podtelezhnikov <apodtele@gmail.com>
Minor type adjustments.
* src/cff/cffobjs.c (cff_face_init): Reduce casting.
* src/truetype/ttobjs.c (tt_size_ready_bytecode): Ditto.
* src/type1/t1load.c (T1_Set_MM_Design): Ditto.
2021-09-15 Alexei Podtelezhnikov <apodtele@gmail.com>
Replace boolean allocation macros with MEM ones.
* src/base/ftbitmap.c (FT_Bitmap_Copy): Use MEM-macro.
* src/base/ftobjs.c (ft_glyphslot_alloc_bitmap): Ditto.
* src/bzip2/ftbzip2.c (ft_bzip2_alloc): Ditto.
* src/cache/ftccache.c (ftc_cache_init): Ditto
* src/gzip/ftgzip.c (ft_gzip_alloc): Ditto.
* src/psnames/psmodule.c (ps_unicodes_init): Ditto.
* src/sfnt/sfobjs.c (sfnt_load_face): Ditto.
* src/sfnt/ttload.c (tt_face_load_name): Ditto.
2021-09-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Revert to some zeroing.
* src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Zero
`buckets` again to fix some crashes.
2021-09-14 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/pshinter/pshrec.c (ps_mask_table_merge_all): Tweak loops.
Fixes fallout from 731d0b685685 reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38685
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff, pshinter] Clean up unsigned counters.
Loops with unsigned decrement can be reliably stopped when the counter
wraps around after reaching zero.
* src/cff/cffload.c (cff_charset_compute_cids): Use unsigned counter.
* src/pshinter/pshalgo.c (psh_hint_table_activate_mask): Ditto.
* src/pshinter/pshrec.c (ps_mask_table_merge): Ditto.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf, psnames, sfnt] Avoid some memory zeroing.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use Q-macro.
* src/sfnt/sfobjs.c (sfnt_load_face): Ditto.
* src/psnames/psmodule.c (src/psnames/psmodule.c): Remove zero.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (FT_CMap_New): Revert to zeroing.
Fixes fallout from c1fa7aa2bc96, reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38641
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Clean up `exec` initialization.
* src/truetype/ttinterp.c (Init_Context): Absorbed into...
(TT_New_Context): ... this function.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Avoid some memory zeroing.
* src/truetype/ttgload.c (load_truetype_glyph): Use Q-macro.
* src/truetype/ttinterp.c (Update_Max): Ditto.
* src/truetype/ttpload.c (src/truetype/ttpload.c): Ditto.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Avoid some memory zeroing.
* src/base/ftobjs.c (FT_New_Size, FT_CMap_New, FT_CMap_Done,
ft_open_face_internal, ft_open_face_internal): Use Q-macros.
2021-09-13 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache, psaux] Remove zeros.
* src/cache/ftcmru.c (FTC_MruList_New): Remove initialization.
* src/psaux/psstack.c (cf2_stack_init): Ditto.
2021-09-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Avoid some memory zeroing.
* src/cache/ftcmru.c (FTC_MruList_New): Use Q-macro.
* src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Ditto.
* src/cache/ftccache.c (ftc_cache_init, ftc_cache_resize): Ditto.
2021-09-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmanag.c (FTC_Manager_New): Add missing zero.
Fixes fall out from a7b199d081e7.
2021-09-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak `hdmx` checking.
Fixes #1096.
* src/truetype/ttpload.c (tt_face_load_hdmx): Account for padding.
2021-09-10 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Tweak `loca` clamping.
Fixes #1095.
* src/truetype/ttpload.c (tt_face_load_loca): Fix up clamping.
* include/freetype/internal/tttypes.h (TT_Face): Correct docs.
2021-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Fortify memory debugging (cont'd).
* src/base/ftdbgmem.c (FT_DumpMemory): Check for active debugger.
(ft_mem_table_destroy): Move `FT_DumpMemory` call from here...
(ft_mem_debug_done): ... to here.
2021-09-08 Alexei Podtelezhnikov <apodtele@gmail.com>
Fortify memory debugging.
These changes are neccessary to properly recover `memory->user` that
holds the Windows heap handle now.
* src/base/ftdbgmem.c (ft_mem_debug_init): Handle all table allocations,
initializations, and sizing instead of...
(ft_mem_table_new): ... this function removed.
(ft_mem_debug_done): Better check for the active debugger and free the
debugger table here instead of...
(ft_mem_table_destroy): ... here.
2021-09-08 Werner Lemberg <wl@gnu.org>
src/tools/ftrandom/ftrandom.c (_XOPEN_SOURCE): Set to 600.
This allows C99 compilation on Solaris.
Problem reported by Mojca Miklavec.
2021-09-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Use native memory allocation API.
* builds/windows/ftsystem.c (ft_alloc, ft_realloc, ft_free):
Wrap HeapAlloc, HeapReAlloc, and HeapFree.
(FT_New_Memory): Set the heap handle.
2021-09-07 Werner Lemberg <wl@gnu.org>
[dlg] Synchronize with upstream.
* src/dlg/dlgwrap.c (_XOPEN_SOURCE): Set to 600.
Fixes #1093.
2021-09-04 Alexei Podtelezhnikov <apodtele@gmail.com>
Cosmetic zeros.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_parse_start): Keep parser memory.
2021-09-03 Werner Lemberg <wl@gnu.org>
autogen.sh: Make it work with old Solaris 10 shell.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth, raster, sdf] Clean up initialization calls.
* src/raster/ftraster.c (ft_black_init): Removed.
(ft_black_new): Clean up.
* src/sdf/ftbsdf.c (bsdf_raster_new): Ditto.
* src/sdf/ftsdf.c (sdf_raster_new): Ditto.
* src/smooth/ftgrays.c (gray_raster_new): Ditto.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cache/ftcmanag.c (FTC_Manager_New): Avoid some zeroing.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (bdf_load_font): Remove memory shuffling.
2021-09-03 Alexei Podtelezhnikov <apodtele@gmail.com>
Cosmetic zeros.
2021-09-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Clean up stream reading.
* src/base/ftstream.c (FT_Stream_ReadUShort, FT_Stream_ReadUOffset,
FT_Stream_ReadULong and their LE variants): Remove unnecessary
initialization and slightly refactor.
(FT_Stream_GetByte, FT_Stream_ReadByte): Rename to return unsigned
value and align with sister functions.
* include/freetype/internal/ftstream.h (FT_Stream_GetByte,
FT_Stream_ReadByte): Update prototypes and caller macros.
2021-09-02 Alexei Podtelezhnikov <apodtele@gmail.com>
s/0/NULL/ where appropriate.
2021-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c (FT_Stream_Open): Fix double-close.
2021-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Reduce shift in multiply-shift optimization.
* src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): Reduce shift.
Smaller shifts that keep the division operands of FT_UDIVPREP within
32 bits result in slightly faster divisions, which is noticeable in
the overall performance. The loss of precision is tolerable until the
divisors (the components dx and dy) approach 32 - PIXEL_BITS. With
PIXEL_BITS = 8, this corresponds to 65,000 pixels or the bitmap size
that we refuse to render anyway.
Using `ftbench -p -s60 -t5 -bc timesi.ttf`,
Before: 8.52 us/op
After: 8.32 us/op
2021-08-28 Werner Lemberg <wl@gnu.org>
[truetype] Fix compilation if !TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
* src/truetype/ttgxvar.c (tt_cvt_ready_iterator): Compile function
conditionally.
(tt_face_vary_cvt) [!TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Add code.
Fixes #1091.
2021-08-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Revise SSE2 settings.
* builds/windows/vc2010/freetype.vcxproj [x64]: Remove explicit SSE2.
* builds/windows/visualc/freetype.vcproj [Win32]: Add explicit SSE2.
2021-08-27 Ben Wagner <bungeman@chromium.org>
[smooth] Detect SSE2 with MSVC for x86
MSVC does not set `__SSE2__`. Instead one must check whether `_M_IX86_FP` is
defined and greater than or equal to 2.
* src/smooth/ftgrays.c (FT_SSE2): New macro.
Use it where appropriate.
2021-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
Expand comment (cont'd).
2021-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
Expand comment.
2021-08-24 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_render_conic): Refactor redundancy.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Fix for the family name shorter than 8 characters.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag):
If the family name to be checked is shorter than 8 characters,
do not check its syntax.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Simplify `trick_names'.
* src/truetype/ttobjs.c (tt_check_trickyness_family): For the case
that the beginning part of a long tricky family name is already
registered as another tricky family name, no need to double-check
the longer one. Such long tricky family names are removed from
the `trick_names'.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Add 2 tricky font names.
Additional fix for the issue #1087.
* src/truetype/ttobjs.c (tt_check_trickyness_family): Add 2 tricky
font names reported in #1087.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] New function to skip the randomization tag.
* src/truetype/ttobjs.c (tt_skip_pdffont_random_tag):
New function to skip the randomization tag in the names of the
fonts embedded in a PDF. It is used by tt_check_trickyness_family(),
to keep from mistaking "DLC" in the randomization tag as a
tricky font name. See discussion in:
https://lists.nongnu.org/archive/html/freetype-devel/2021-02/msg00002.html
For technical detail about the randomization tag, please find
PDF Reference 5.5.3 "Font Subsets". Thanks to Justyna Wawrzynska
for pointing out the issue caused by the randomization tag.
2021-08-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Add checksums for 2 tricky fonts.
Thanks to Ting717 for providing sample PDF. Fixes #1087.
* src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): Add
checksums for 2 tricky fonts `DFHei-Bd-WIN-HK-BF' and
`DFMing-Md-WIN-HK-BF'.
2021-08-23 Alexei Podtelezhnikov <apodtele@gmail.com>
Whitespace formatting.
2021-08-22 Alexei Podtelezhnikov <apodtele@gmail.com>
Decorate const arguments.
* src/base/ftglyph.c (FT_Glyph_Transform, FT_Glyph_To_Bitmap): Do it.
* include/freetype/ftglyph.h (FT_Glyph_Transform, FT_Glyph_To_Bitmap):
Do it.
2021-08-21 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Clean up the null cell usage.
Put the null cell at the end of the pool and store it explicitly so that
we can use it as both the limit and the dumpster.
* src/smooth/ftgrays.c (gray_TWorker): Store the last `cell_null` and
remove unnecesary fields.
(NULL_CELL_PTR, CELL_IS_NULL): Remove in favor of explicit `cell_null`.
(gray_dump_cells, gray_set_cell, gray_sweep{,_direct}): Update callers.
(gray_convert_glyph_inner): Trace remaining cells (oh well).
(gray_convert_glyph): Set up `cell_null` and slightly improve the pool
management.
2021-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Restore quiet no-op rendering of bitmap glyphs.
Fixes #1076.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Discard an error when
rendering a bitmap glyph.
2021-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Fortify 64-bit algorithm.
* src/smooth/ftgrays.c (FT_UDIVPREP, FT_UDIV): s/long/FT_Int64/ and
s/unsigned long/FT_UInt64/.
(gray_render_line): Adjust a critical variable type.
2021-08-20 Carlo Bramini <carlo.bramix@libero.it>
* builds/windows/ftsystem.c (FT_Stream_Open): Support legacy Windows.
2021-08-20 Alexei Podtelezhnikov <apodtele@gmail.com>
Determine `long long` availability based on its size.
MSVC, for example, used `long long` even without full C99 support.
* include/freetype/config/ftstdlib.h: Check if `long long` limits are
defined in <limits.h>.
* include/freetype/config/integer-types.h: Check `long long` size and
use it to typedef FT_Int64.
2021-08-19 Dominik Röttsches <drott@chromium.org>
[sfnt] Fix format expectation for `COLR` v1 ClipList
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Change ClipList
format expectation to 1 instead of 0 to make it compliant with the
latest spec.
2021-08-19 Alexei Podtelezhnikov <apodtele@gmail.com>
Readily use `long long` as a 64-bit type in C99 mode.
* include/freetype/config/integer-types.h (FT_INT64):
FT_CONFIG_OPTION_FORCE_INT64 is no longer required to use `long long`.
2021-08-19 Alexei Podtelezhnikov <apodtele@gmail.com>
Use FT_INT64 instead of FT_LONG64.
* include/freetype/config/integer-types.h: Remove synonymous FT_LONG64.
* include/freetype/internal/ftcalc.h: s/FT_LONG64/FT_INT64/.
* src/base/ftcalc.c: Ditto.
* src/base/fttrigon.c: Ditto.
* src/smooth/ftgrays.c: Ditto.
2021-08-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Do not set CharacterSet for VC++.
* builds/windows/vc2010/freetype.vcxproj: s/Unicode/NotSet/.
* builds/windows/visualc/freetype.vcproj: s/"1"/"0"/.
2021-08-18 Werner Lemberg <wl@gnu.org>
* src/sdf/ftsdf.c (get_control_box): Fix compiler warning.
2021-08-18 Werner Lemberg <wl@gnu.org>
[base] Fix ppem size overflow.
Fixes #1086.
* src/base/ftobjs.c (FT_Request_Metrics): Add return value.
Check whether ppem values fit into unsigned short values.
(FT_Request_Size): Updated.
* include/freetype/internal/ftobjs.h: Updated.
* src/cff/cffobjs.c (cff_size_request), src/cid/cidobjs.c
(cid_size_request), src/truetype/ttdriver.c (tt_size_request),
src/type1/t1objs.c (T1_Size_Request): Updated.
2021-08-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c (FT_Stream_Open): Cast to remove warning.
2021-08-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/ftsystem.c (FT_Stream_Open): Support UNICODE compilation.
2021-08-09 Werner Lemberg <wl@gnu.org>
* src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Minor fix.
2021-08-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Add missing blend mode 'plus' to 'COLR' v1.
* include/freetype/ftcolor.h (FT_Composite_Mode): Add missing blend mode
'plus' after it was added to the spec.
2021-08-08 Werner Lemberg <wl@gnu.org>
include/freetype/freetype.h (FT_Encoding): Improve documentation.
Based on a suggestion by Antony Lee <anntzer.lee@gmail.com>.
2021-08-07 Werner Lemberg <wl@gnu.org>
[smooth] Avoid integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36243
* src/smooth/ftgrays.c(ADD_LONG, SUB_LONG, MUL_LONG, NEG_LONG)
[STANDALONE_]: Removed, unused.
(ADD_INT) [STANDALONE_]: New macro.
(FT_INTEGRATE): Use ADD_INT.
2021-08-07 Dominik Röttsches <drott@chromium.org>
[sfnt] Add API for retrieving a 'COLR' v1 'ClipBox' table.
The optional 'COLR' v1 glyph-specific clip box helps upstream graphics
libraries allocate a sufficiently large bitmap for a glyph without having to
traverse the glyph graph for that. See
https://github.com/googlefonts/colr-gradients-spec/issues/251
for background on the introduction of this specification change.
* include/freetype/ftcolor.h (FT_ClipBox): New structure.
(FT_Get_Color_Glyph_ClipBox): New function declaration.
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_ClipBox_Func):
New function type.
(SFNT_Interface, FT_DEFINE_SFNT_INTERFACE): Use it.
* src/base/ftobjs.c (FT_Get_Color_Glyph_ClipBox): New function to link API
with SFNT implementation.
* src/sfnt/sfdriver.c (sfnt_interface): Updated.
* src/sfnt/ttcolr.c (Colr): New field `clip_list`.
(tt_face_load_colr): Parse global clip list offset.
(tt_face_get_color_glyph_clipbox): New function to find the clip box for a
glyph id from the clip list array.
* src/sfnt/ttcolr.h: Updated.
2021-08-06 Werner Lemberg <wl@gnu.org>
[smooth] Fix left shifts of negative numbers.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36241
* src/smooth/ftgrays.c (LEFT_SHIFT): New macro.
(gray_render_conic) [BEZIER_USE_DDA]: Use it.
2021-08-02 Werner Lemberg <wl@gnu.org>
* meson.build: Fix zlib support.
This commit synchronizes zlib support with both autotools and cmake: If no
external zlib is found (or intentionally disabled on the command line), use
the internal zlib by undefining `FT_CONFIG_OPTION_SYSTEM_ZLIB` without
modifying `FT_CONFIG_OPTION_USE_ZLIB`.
Also improve summary output.
Problem reported by Moazin.
2021-08-02 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Fix out-of-range-access.
* src/sdf/ftbsdf.c (first_pass, second_pass): Fix range during forward pass.
Otherwise the index goes out of range for the last column.
Fixes issue #1077.
2021-08-02 Anuj Verma <anujv@iitbhilai.ac.in>
Fix invalid memory access in `bsdf` rasterizer.
Do not generate SDF from bitmap if the `FT_GLYPH_OWN_BITMAP` flag is not
set. In some cases the bitmap buffer is freed but still points to a valid
address; to handle those cases check the flag before accessing the memory.
* src/sdf/ftsdfrend.c (ft_bsdf_render): Handle the above case.
Also, return an error message if the bitmap's rows/pitch is invalid,
otherwise `slot->buffer` might be assigned to some invalid memory location.
(ft_sdf_render): Same as above.
Plus, move the outline back to original state after rasterization and not if
any error occurs.
2021-07-29 Heiko Becker <heirecka@exherbo.org>
* meson.build: Honor `--includedir` instead of hard-coding 'include'.
2021-07-29 Werner Lemberg <wl@gnu.org>
src/sfnt/ttcolr.c: Minor formatting.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] 'COLR' v1 PaintSweepGradient spec update
* src/sfnt/ttcolr.c (read_paint): PaintSweepGradient follows other
spec changes and now has the angles specified as F2DOT14, reflect
that in the implementation.
* include/freetype/ftcolor.h (FT_PaintSweepGradient): Update
documentation.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] Retrieve affine matrix from offset in 'COLR' v1 parsing.
* src/sfnt/ttcolr.c (read_paint): Implement spec change where
affine transform matrix is now referenced by offset instead of
being placed inline in the PaintTransform table.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] 'COLR' v1 PaintSkew related spec updates
* src/sfnt/ttcolr.c (read_paint): Implement spec changes around
PaintSkew, PaintSkewAroundCenter. Update parsing to read shorter
values as changed in the spec.
* include/freetype/ftcolor.h (FT_PaintSkew): Update documentation.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] PaintRotate/PaintRotateAroundCenter spec updates
* src/sfnt/ttcolr.c (read_paint): Implement spec change where
PaintRotate and PaintRotateAroundCenter were split for a more
compact format definition. Update parsing to read shorter values
as changed in the spec.
* include/freetype/ftcolor.h (FT_PaintRotate): Update documentation.
2021-07-29 Dominik Röttsches <drott@chromium.org>
[sfnt] 'COLR' v1 PaintTranslate and PaintScale precision
* src/sfnt/ttcolr.c (read_paint): Implement spec changes in
PaintTranslate and PaintScale and friends. Update parsing to read
new shorter values.
2021-07-29 AnuthaDev <anuthadev@gmail.com>
README.git: Add Code of Conduct.
2021-07-25 Werner Lemberg <wl@gnu.org>
ChangeLog housekeeping.
Archive old `ChangeLog` file.
We no longer write ChangeLog entries manually; instead, the file will be
created from commit messages (which should be formatted in GNU's ChangeLog
style) by a call to
gitlog-to-changelog --format='%B%n'
or something similar (this script is part of the 'gnulib' repository).
2021-07-24 Werner Lemberg <wl@gnu.org>
Fix some `cppcheck` warnings.
* src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c
(ft_gzip_file_skip_output): Reduce scope of `delta`.
* src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add
`const` to `buf` parameter.
* src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter.
(Vertical_Sweep_Span): Reduce scope of `target`.
(FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`.
* src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`.
(gray_sweep, gray_sweep_direct): Reduce scope of `area`.
* src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of
`temp`.
2021-07-24 AnuthaDev <anuthadev@gmail.com>
* .gitlab-ci.yml: Fixed cmake build, using correct options.
2021-07-24 AnuthaDev <anuthadev@gmail.com>
* CMakeLists.txt: Make `cmake` handle disabled dependencies correctly.
Include 'CMakeDependentOption'.
Replace `FT_WITH_XXX` options with `FT_DISABLE_XXX` and `FT_REQUIRE_XXX`
pairs. Update option logic accordingly.
Fixes #1066.
2021-07-24 Ben Wagner <bungeman@chromium.org>
[autofit] Split `afwrtsys.h`.
The header file `afwrtsys.h` has two distinct functions: to include the
required writing system headers and also to generate code for each writing
system. At each current use site only one or the other is used, with
various macro trickery selecting one or the other. Split this header into
`afws-decl.h` for the required writing system declarations and `afws-iter.h`
for iterating over the writing systems to generate code.
The motivation for this change is that the Visual C++ compiler treats the
standard include guard idiom like `#pragma once` 'if no non-comment code or
preprocessor directive comes before or after the standard form of the
idiom'. It appears to check this after macro expansion, so if
`WRITING_SYSTEM` expands to empty the bottom of `afwrtsys.h` is empty and
looks like the standard include guard idiom which is treated like `#pragma
once`, so subsequent inclusion of `afwrtsys.h` is elided.
Fixes #1075.
* src/autofit/afglobal.c (af_writing_system_classes), src/autofit/aftypes.h
(AF_WritingSystem), src/autofit/rules.mk (AUTOF_DRV_H): Updated.
* src/autofit/afwrtsys.h: Split into...
* src/autofit/afws-decl.h, src/autofit/afws-iter.h: New files.
2021-07-18 Werner Lemberg <wl@gnu.org>
* Version 2.11.0 released.
==========================
Tag sources with `VER-2-11-0'.
* docs/VERSION.TXT: Add entry for version 2.11.0.
* docs/CHANGES: 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.10.4/2.11.0/, s/2104/2110/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 11.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 24:0:18.
* CMakeLists.txt (VERSION_MINOR): Set to 11.
(VERSION_PATCH): Set to 0.
* builds/toplevel.mk (dist): Ignore more git-related files.
2021-07-17 David Turner <david@freetype.org>
* src/smooth/ftgrays.c: Fix compilation if `FT_LONG64` is undefined.
The code assumed that if `__SSE2__` is defined, then 64-bit integer
types are available. This is not the case apparently for certain
multilib compiler targets like 'x86_32.x86' used by Gentoo.
This patch fixes the issue by disabling the special code path when
64-bit integer types are not available.
Fixes #1071.
2021-07-16 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
[tests] Allow arbitrary build directories.
* tests/issue-1063/main.c (main): I am building with a build
directory that is not directly inside the source tree, so the path
`../tests/data/As.I.Lay.Dying.ttf` does not resolve to the test
input file. This change passes the test data directory as an
environment variable to allow arbitrary build directories.
* tests/meson.build: Updated.
2021-07-16 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* tests/issue-1063/main.c (main): Fix uninitialized variable.
I tried running `meson test` but the test just crashed and gdb
reported that the face argument to `FT_Get_Char_Index` was nonsense.
With this change the test prints 'Could not open file: ' as it
should.
2021-07-16 Werner Lemberg <wl@gnu.org>
[smooth] Minor fixes.
* src/smooth/ftgrays.c (gray_render_conic): Move variable and
structure declarations to beginning of function. Inspite of C99
compliance we still do this for the sake of backward compatibility.
This also avoids a shadowing declaration of `count`.
(gray_convert_glyph_inner): Fix typo.
2021-07-15 Ben Wagner <bungeman@chromium.org>
* src/smooth/ftgrays.c: Guard inclusion of `emmintrin.h`.
Guard inclusion of `emmintrin.h` with `#ifdef __SSE2__`. The gcc
version of this header, `xmmintrin.h`, and `mmintrin.h` check that
the appropriate defines are set before defining anything (are
internally guarded). However, the clang versions of these includes
are not internally guarded. As a result of this, externally guard
the inclusion of these headers.
2021-07-15 David Turner <david@freetype.org>
[smooth] Implement Bézier quadratic arc flattening with DDA.
Benchmarking shows that this provides a very slighty performance
boost when rendering fonts with lots of quadratic Bézier arcs,
compared to the recursive arc splitting, but only when SSE2 is
available, or on 64-bit CPUs.
On a 2017 Core i5-7300U CPU on Linux/x86_64:
ftbench -p -s10 -t5 -cb DroidSansFallbackFull.ttf
Before: 4.033 us/op (best of 5 runs for all numbers)
After: 3.876 us/op
ftbench -p -s60 -t5 -cb DroidSansFallbackFull.ttf
Before: 13.467 us/op
After: 13.385 us/op
* src/smooth/ftgrays.c (gray_render_conic): New implementation
based on DDA and optionally SSE2.
2021-07-15 David Turner <david@freetype.org>
[smooth] Minor speedup to smooth rasterizer.
This speeds up the smooth rasterizer by avoiding conditional
branches in the hot path.
- Define a fixed 'null cell', which will be pointed to whenever the
current cell is outside of the current target region. This avoids
a `ras.cell != NULL` check in the `FT_INTEGRATE` macro.
- Also use the null cell as a sentinel at the end of all `ycells`
linked-lists, by setting its x coordinate to `INT_MAX`. This
avoids a `if (!cell)` check in `gray_set_cell` as well.
- Slightly change the worker struct fields to perform a little less
operations during rendering.
Example results (on a 2013 Corei5-3337U CPU)
out/ftbench -p -s10 -t5 -bc DroidSansFallbackFull.ttf
Before: 5.472 us/op
After: 5.275 us/op
out/ftbench -p -s60 -t5 -bc DroidSansFallbackFull.ttf
Before: 17.988 us/op
After: 17.389 us/op
* src/smooth/ftgrays.c (grat_TWorker): Replace `num_cells` field with
`cell_free` and `cell_limit`.
(NULL_CELL_PTR, CELL_MAX_X_VALUE, CELL_IS_NULL): New macros.
(gray_dump_cells, gray_set_cell, gray_sweep, gray_sweep_direct,
gray_convert_glyph_inner, gray_convert_glyph): Updated.
2021-07-15 David Turner <david@freetype.org>
[tests] Rewrite download script in Python3.
This commit replaces the bash script with a Python script that does
the same work, plus avoiding to download anything if the files are
already installed with the right content.
We now use the first 8 bytes of each file's sha256 hash for the
digest.
* tests/scripts/download-test-fonts.sh: Removed.
* tests/scripts/download-test-fonts.py: New script.
* tests/README.md: Updated.
2021-07-15 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Support architectures where `long` is smaller than pointers.
I am currently trying to compile FreeType for CHERI-extended ISAs
(CHERI-RISC-V and Arm's Morello), but I am getting compiler warnings
from the `FT_UINT_TO_POINTER` macro. When compiling with the CHERI
Clang compiler, not using `uinptr_t` for casts between integers an
pointers results in the following `-Werror` build failures:
```
In file included from .../src/truetype/truetype.c:22:
.../src/truetype/ttgload.c:1925:22: error:
cast from provenance-free integer type to pointer type will
give pointer that can not be dereferenced
[-Werror,-Wcheri-capability-misuse]
node->data = FT_UINT_TO_POINTER( glyph_index );
^
.../include/freetype/internal/compiler-macros.h:79:34: note:
expanded from macro 'FT_UINT_TO_POINTER'
```
* include/freetype/internal/compiler-macros.h (FT_UINT_TO_POINTER):
The ISO C standard compliant fix for this would be to use
`uintptr_t` from `stdint.h`, but I am not sure if this is supported
by the minimum compiler version. Therefore, use the
compiler-defined `__UINTPTR_TYPE__` macro (supported in GCC 4.6+ and
Clang since about 3.0) before checking for `_WIN64` and falling back
to `unsigned long`.
2021-07-13 Oleg Oshmyan <chortos@inbox.lv>
[base] Fix `FT_Open_Face`'s handling of user-supplied streams.
This was already true (though undocumented) most of the time, but
not if `FT_NEW` inside `FT_Stream_New` failed or if the
`FT_OPEN_XXX` flags were bad.
Normally, `FT_Open_Face` calls `FT_Stream_New`, which returns the
user-supplied stream unchanged, and in case of any subsequent error
in `FT_Open_Face`, the stream is closed via `FT_Stream_Free`.
Up to now, however, `FT_Stream_New` allocates a new stream even if
it is already given one by the user. If this allocation fails, the
user-supplied stream is not returned to `FT_Open_Face` and never
closed. Moreover, the user cannot detect this situation: all they
see is that `FT_Open_Face` returns `FT_Err_Out_Of_Memory`, but that
can also happen after a different allocation fails within the main
body of `FT_Open_Face`, when the user's stream has already been
closed by `FT_Open_Face`. It is plausible that the user stream's
`close` method frees memory allocated for the stream object itself,
so the user cannot defensively free it upon `FT_Open_Face` failure
lest it ends up doubly freed. All in all, this ends up leaking the
memory/resources used by user's stream.
Furthermore, `FT_Stream_New` simply returns an error if the
`FT_OPEN_XXX` flags are unsupported, which can mean either an
invalid combination of flags or a perfectly innocent
`FT_OPEN_STREAM` on a FreeType build that lacks stream support.
With this patch, the user-supplied stream is closed even in these
cases, so the user can be sure that if `FT_Open_Face` failed, the
stream is definitely closed.
* src/base/ftobjs.c (FT_Stream_New): Don't allocate a buffer
unnecessarily.
Move error-handling code to make the control flow more obvious.
Close user-supplied stream if the flags are unsupported.
`FT_Stream_Open` always sets `pathname.pointer`, so remove the
redundant (re)assignment. None of the `FT_Stream_Open...` functions
uses `stream->memory`, so keep just one assignment at the end,
shared among all possible control flow paths.
('Unsupported flags' that may need a stream closure can be either an
invalid combination of multiple `FT_OPEN_XXX` mode flags or a clean
`FT_OPEN_STREAM` flag on a FreeType build that lacks stream
support.)
2021-07-13 Oleg Oshmyan <chortos@inbox.lv>
[base] Reject combinations of incompatible `FT_OPEN_XXX` flags.
The three modes are mutually exclusive, and the documentation of the
`FT_OPEN_XXX` constants notes this. However, there was no check to
validate this in the code, and the documentation on `FT_Open_Args`
claimed that the corresponding bits were checked in a well-defined
order, implying it was valid (if useless) to specify more than one.
Ironically, this documented order did not agree with the actual
code, so it could not be relied upon; hopefully, nobody did this and
nobody will be hurt by the new validation.
Even if multiple mode bits were allowed, they could cause memory
leaks: if both `FT_OPEN_STREAM` and `stream` are set along with
either `FT_OPEN_MEMORY` or `FT_OPEN_PATHNAME`, then `FT_Stream_New`
allocated a new stream but `FT_Open_Face` marked it as an 'external'
stream, so the stream object was never released.
* src/base/ftobjs.c (FT_Stream_New): Reject incompatible
`FT_OPEN_XXX` flags.
2021-07-12 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* meson.build: Fix build for other UNIX systems (e.g., FreeBSD).
Without this change the build of `unix/ftsystem.c` fails because the
`ftconfig.h` header that defines macros such as `HAVE_UNISTD_H` and
`HAVE_FCNTL_H` is only being generated for Linux, macOS, and Cygwin
systems:
```
.../builds/unix/ftsystem.c:258:32: error:
use of undeclared identifier 'O_RDONLY'
file = open( filepathname, O_RDONLY );
```
Instead of hardcoding a list of operating systems for this check,
update the logic that decides whether to build the file and set a
boolean flag that can be checked instead.
2021-07-12 Werner Lemberg <wl@gnu.org>
[autofit] More clean-ups.
* src/autofit/afhints.h (AF_GlyphHintsRec): Remove the no longer
needed fields `xmin_delta` and `xmax_delta`.
* src/autofit/afhints.c (af_glyph_hints_reload),
src/autofit/afloader.c (af_loader_load_glyph): Updated.
2021-07-12 Werner Lemberg <wl@gnu.org>
Small clean-ups for the last few commits.
* include/freetype/fttrace.h (afwarp): Removed.
2021-07-12 David Turner <david@freetype.org>
Remove obsolete `AF_Angle` type and related sources.
* src/autofit/afangles.c: File removed. Functions related to
sorting moved to...
* src/autofit/afhints.c (af_sort_pos, af_sort_and_quantize_widths):
This file.
* src/autofit/afangles.h: File removed.
* src/autofit/aftypes.h: Updated.
* src/autofit/autofit.c: Updated.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
2021-07-12 David Turner <david@freetype.org>
Remove experimental auto-hinting 'warp' mode.
This feature was always experimental, and probably never worked
properly. This patch completely removes it from the source code,
except for a documentation block describing it for historical
purposes.
* devel/ftoption.h, include/freetype/config/ftoption.h: Remove
`AF_CONFIG_OPTION_USE_WARPER`.
* include/freetype/ftdriver.h: Document 'warping' property as
obsolete.
* src/autofit/afwarp.c, src/autofit/afwarp.h: Files removed.
* src/autofit/*: Remove any code related to warp mode.
2021-07-12 David Turner <david@freetype.org>
Remove experimental 'Latin2' writing system (`FT_OPTION_AUTOFIT2`).
This code has always been experimental and was never compiled anyway
(`FT_OPTION_AUTOFIT2` does not appear in `ftoption.h` or even any of
our build files).
* include/freetype/internal/fttrace.h (aflatin2): Removed.
* src/autofit/aflatin2.h, src/autofit/aflatin2.c: Files removed.
* src/autofit/afloader.c: Remove undocumented hook to activate
Latin2 system.
* src/autofit/afstyles.h: Remove `ltn2_dflt` style definition.
* src/autofit/afwrtsys.h: Remove `LATIN2` writing system definition.
* src/autofit/autofit.c: Updated.
2021-07-05 Werner Lemberg <wl@gnu.org>
* src/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix argument.
Reported by Hin-Tak.
2021-07-03 Werner Lemberg <wl@gnu.org>
* meson_options.txt: Sort alphabetically; no final full stops.
2021-07-01 Ben Wagner <bungeman@chromium.org>
* src/truetype/ttgxvar.c (tt_set_mm_blend): Test `coords`.
It is undefined behavior to pass `NULL` to `memcpy`. `coords' is
passed to `memcpy` but `TT_Get_MM_Blend` and `TT_Get_Var_Design`
explictly call `tt_set_mm_blend` with `coords` as `NULL`. In
addition, `TT_Set_MM_Blend` has a similar possible issue.
2021-06-30 Dominik Röttsches <drott@chromium.org>
[sfnt] Support PaintScale in 'COLR' v1 parsing.
* include/freetype/ftcolor.h (FT_PaintFormat): Renumber values, add
`FT_COLR_PAINTFORMAT_SCALE`.
(FT_PaintScale): New structure to represent 'PaintScale*' tables.
(FT_COLR_Paint): Updated.
* src/sfnt/ttcolr.c (FT_PaintFormat_Internal): New enumeration.
(read_paint): Parse 'PaintScale' and friends.
2021-06-30 Dominik Röttsches <drott@chromium.org>
[sfnt] Handle fonts without layer list in 'COLR' v1.
'COLR' v1 fonts do not necessarily need to have a layer list; for
this reason, 'fontTools' recently started generating fonts in a way
that drops the layer list if there are no layers in it. This
results in the layer list offset becoming zero, which FreeType
treated as an invalid table. Fix that and handle the case for layer
list offset being 0. This slightly changes how we need to calculate
the starting offset for paints.
* src/sfnt/ttcolr.c (tt_face_load_colr): Handle case of layer list
offset being zero without outright rejecting table.
2021-06-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Render_Single_Pass): Simplify `band_stack'.
2021-06-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Do not skip the second pass without dropout control.
The second pass also fixes horizontal lines through the pixel centers.
* src/raster/ftraster.c (black_TWorker): Do not use `second_pass'.
(Render_Glyph): Skip the second pass only with the appropriate flag.
2021-06-29 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Handle sub-band stack locally.
* src/raster/ftraster.c (black_TWorker): Move `band_stack' from here..
(Render_Single_Pass): ... to here and accept limit arguments.
(Render_Glyph): Updated.
2021-06-25 Anurag Thakur <anuthadev@gmail.com>
[CI] Introduce linux CI and refactor job names.
* .gitlab-ci.yml: Added jobs for building freetype on linux.
2021-06-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Handle Bézier stack locally.
* src/raster/ftraster.c (black_TWorker): Move `arcs' from here...
(Conic_To, Cubic_To): ... to here to tighten their scope.
(Bezier_Up, Bezier_Down): ... Take the current `arc' argument.
2021-06-28 Dominik Röttsches <drott@chromium.org>
[sfnt] Improve paint limit checks
Paint tables can appear before the `base_glyphs_v1` offset if the
font is produced with the layer list before the base glyph list. In
this case paint tables can occur after the layer list but before the
base glyph list. Checks in the 'COLR' v1 code were rejecting fonts
with this layout. Improve these checks by calculating a minimum
offset after which paint tables can occur and use that in safety
checks.
* src/sfnt/ttcolr.c (Colr, tt_face_load_colr): Declare
`paint_start_v1` and calculate that as the minimum of the end of
layer list and base glyph list.
(get_child_table_pointer, read_paint, tt_face_get_paint_layers):
Use that in safety checks.
2021-06-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Clean up vertical sweep.
* src/raster/ftraster.c (black_TWorker): Replace the current line
offset with the pointer and drop the increment.
(Function_Sweep_Init): Take values as arguments instead of pointers.
(Vertical_Sweep_*, Horizontal_Sweep_Init, Draw_Sweep): Updated.
2021-06-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Make `band_top' local variable.
* src/raster/ftraster.c (black_TWorker): Move `band_top' from here...
(Render_Single_Pass): ... to here, and refactor.
(Render_Glyph): Updated.
2021-06-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Adjust sub-band bisecting limits.
We can bisect a band until it is just a single scan line. This might
be slow and cause time-outs but if we need to impose limits it should
be elsewhere.
* src/raster/ftraster.c (Render_Single_Pass): Tweak sub-banding.
2021-06-25 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/raster/ftraster.c (Render_Single_Pass): Remove dead code.
2021-06-25 Werner Lemberg <wl@gnu.org>
[base] Add trace level to logging output.
Some practical debugging work has shown that displaying level X of
an `FT_TRACEX` macro in the output of `FT2_DEBUG="... -v"` would be
very helpful to find out which trace level should be selected. As
an example, we now get output like
```
[ttobjs:2] TTF driver
[ttobjs:2] SFNT driver
[sfobjs:2] not a font using the SFNT container format
[t1objs:2] Type 1 driver
[stream:7] FT_Stream_EnterFrame: 14 bytes
```
* include/freetype/internal/ftdebug.h (FT_LOGGING_TAGX): New macro.
(FT_LOG): Use it to add the trace level to the logging tag.
* include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
Adjust.
* docs/DEBUG: Updated.
2021-06-24 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth, raster] Fix up and align error codes.
FT_Render_Glyph picked up FAILURE or 1 returned from the raster
function, which became a confusing error code. Instead, return
Raster_Overflow in the unlikely event that banding does not help or
another meaningful error.
* src/smooth/ftgrays.c (gray_convert_glyph_inner, gray_convert_glyph):
Use Raster_Overflow when the rendering pool is exhausted and return it
if banding does not help.
(gray_raster_render): Use Smooth_Err_Ok.
* src/raster/ftraster.c (Render_Single_Pass): Return Raster_Overflow
if banding does not help or another error code.
2021-06-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth, raster] Remove synonymous error macros.
* src/smooth/ftgays.c [STANDALONE_]: s/ErrRaster_/Smooth_Err_/.
(gray_convert_glyph_inner): Updated accordingly.
* src/raster/ftraster.c [STANDALONE_]: Do not abbreviate error macros.
(New_Profile, End_Profile, Insert_Y_Turn, Line_Up, Bezier_Up,
Decompose_Curve, Draw_Sweep, Render_Single_Pass, ft_black_render):
Updated accordingly.
2021-06-22 Dominik Röttsches <drott@chromium.org>
[sfnt] s/PaintTransformed/PaintTransform/, s/transformed/transform/.
* include/freetype/ftcolor.h (FT_PaintTransformed, FT_PaintFormat,
FT_COLR_Paint): Do it to make it harmonize with other names such as
'PaintTranslate'.
* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Ditto.
2021-06-22 Dominik Röttsches <drott@chromium.org>
Move 'COLR' API to `ftcolor.h`.
* include/freetype/freetype.h: Cut section layer managament
containing 'COLR' v0 and v1 API and move it to `ftcolor.h` as
requested by Werner on freetype-devel.
* include/freetype/ftcolor.h: Paste that section.
2021-06-19 Werner Lemberg <david@freetype.org>
[truetype] Fix integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35312
* src/truetype/ttinterp.c (Ins_JMPR): Use `ADD_LONG`.
2021-06-19 Werner Lemberg <david@freetype.org>
[autofit] Prevent hinting if there are too many segments.
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.
2021-06-18 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sdf/ftsdfrend.c (ft_(b)sdf_render): Do not FT_ERROR routinely.
2021-06-16 David Turner <david@freetype.org>
[autofit] Fix return value of `FT_Load_Glyph`.
* src/autofit/afglobal.c (af_face_globals_get_metrics): The issue is
that `style_metrics_init` sometimes returns -1 without clearing
`error`. While looping to `Again`, the next operation is
successful, but -1 is still returned by the function. The fix is to
set `error` to 0 appropriately.
Fixes #1063.
2021-06-15 David Turner <david@freetype.org>
[meson] Add first regression test to FreeType.
* tests/README.md: New file that explains how to build and run the
tests with the Meson build.
* tests/scripts/download-test-fonts.sh: New bash script to download
test font files to the `tests/data` folder.
* meson.build, meson_options.txt: Add 'tests' option to enable
building and running the test programs (disabled by default).
* tests/meson.build: New file.
* tests/issue-1063/main.c: Simple regression test to exhibit issue
1063.
* .gitignore: Ignore the content of the `tests/data` folder for
now.
2021-06-12 Alexei Podtelezhnikov <apodtele@gmail.com>
[type42] Fix new memory leak.
We need to inverse inheritance of FT_GlyphSlot_Internal so that we
have a chance to free the rendered bitmap from the parent slot.
* src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
of the child `ttslot' and replace it with the parent structure.
(T42_GlyphSlot_Done): Updated accordingly.
2021-06-12 Werner Lemberg <wl@gnu.org>
[psaux] Fix another assertion.
* src/psaux/psintrp.c (cf2_interpT2CharString)
<cf2_escCALLOTHERSUBR>: Convert assertion into error, since the
problem can happen with invalid user input.
Test case is file
fuzzing/corpora/legacy/oss-fuzz/5754332360212480-unknown-read
in the `freetype2-testing` repository.
2021-06-12 Werner Lemberg <wl@gnu.org>
[psaux] Fix assertions.
* src/psaux/pshints.c (cf2_hintmap_adjustHints): Check for overflow
before emitting an assertion error.
Test case is file
fuzzing/corpora/legacy/oss-fuzz/4594115297673216-integer-overflow
in the `freetype2-testing` repository.
2021-06-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/truetype/ttinterp.c (TT_RunIns): Optimize tracing.
2021-06-09 Alexei Podtelezhnikov <apodtele@gmail.com>
[sdf] Fix SDF positioning.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Add padding to
`bitmap_top' and `bitmap_left'.
* sdf/sdf/ftsdf.c (sdf_generate_with_overlaps): Fix VC++ warning.
2021-06-08 Werner Lemberg <wl@gnu.org>
Fix 'devel' build for 'COLR' v1.
* devel/ftoption.h: Synchronize with
`include/freetype/config/ftoption.h`.
2021-06-08 Werner Lemberg <wl@gnu.org>
[sfnt] Sanitize cmap4 table better.
Fixes #1062.
* src/sfnt/ttcmap.c (tt_cmap4_validate): Handle a too-small value of
`length` gracefully.
2021-06-08 Dominik Röttsches <drott@chromium.org>
[sfnt] Pointer validity check when reading 'COLR' v1 layers
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): In addition to the
existing sanity checks, ensure that the pointer to the layer to be
read is within the 'COLR' v1 table.
2021-06-08 Werner Lemberg <wl@gnu.org>
* src/sdf/ftsdfcommon.c: Fix inclusion of header files.
2021-06-08 Werner Lemberg <wl@gnu.org>
[sdf] Make `make multi` work.
* src/sdf/ftsdf.c: Include `ftbitmap.h`.
* src/sdf/ftsdfcommon.h: Move function bodies to `ftsdfcommon.c`.
Include `ftobjs.h` to get definitions of `FT_LOCAL` and friends.
* src/sdf/ftsdfcommon.c: New file.
* src/sdf/rules.mk, src/sdf/sdf.c: Updated.
2021-06-08 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Use 8 bits for final SDF output instead of 16bits.
Since 8-bits is enough to represent SDF data we no longer require
16-bits for this purpose. Also, we now normalize the output data
to use the entire 8-bit range efficiently. For example: if we use
3.5 format with a spread of 1 we basically only use the starting
5-bits. By normalizing we can use the entire 8-bit range.
* include/freetype/freetype.h (FT_Render_Mode): Updated description
for `FT_RENDER_MODE_SDF` regarding this change.
* include/freetype/ftimage.h (FT_Pixel_Mode): Removed
`FT_PIXEL_MODE_GRAY16` since no longer required.
* include/freetype/fttypes.h (FT_F6Dot10): Removed since no longer
required.
* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Allocate 8-bit
bitmap instead of 16-bit buffer.
* src/sdf/ftsdfcommon.h (map_fixed_to_sdf): Added function to convert
16.16 distance value to our desired format.
* src/sdf/ftsdf.c (sdf_generate_with_overlaps,
sdf_generate_bounding_box): Use the new `map_fixed_to_sdf` function
and also use 8-bit output buffer.
* src/sdf/ftbsdf.c (finalize_sdf): Output to a 8-bit buffer instead
of 16-bit buffer.
2021-06-02 Ben Wagner <bungeman@chromium.org>
Werner Lemberg <wl@gnu.org>
[sfnt] Fix fallout from 2021-05-29 change.
* src/sfnt/ttcolr.c (find_base_glyph_record,
find_base_glyph_v1_record): Adjust binary search.
Needs to be updated with change to unsigned.
2021-06-02 Werner Lemberg <wl@gnu.org>
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix tracing.
Problem reported by Alexei.
2021-06-02 Werner Lemberg <wl@gnu.org>
[psaux] Fix MSVC compiler warnings.
* src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs):
Add cast.
2021-05-29 Werner Lemberg <wl@gnu.org>
Fix compilation errors and (some) warnings for clang++.
* src/autofit/afmodule.c (AF_GlyphHintsRec): Make it static.
* src/cache/ftcache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c
(ftc_snode_compare): Remove semicolon.
* src/cff/cffparse.c (cff_parser_run): Add `break` statement.
* src/cid/cidload.c (cid_hex_to_binary): Add cast.
* src/sdf/ftbsdf.c (CHECK_NEIGHBOR): Use `do {} while(0)` loop.
(bsdf_init_distance_map, finalize_sdf, bsdf_raster_render): Add
casts.
* src/sdf/ftsdf.c (sdf_generate_bounding_box,
sdf_generate_with_overlaps): Ditto.
* src/sdf/ftsdfcommon.h (square_root): Ditto.
* src/sdf/ftsdfrend.c (sdf_property_get, ft_sdf_render,
ft_bsdf_render): Ditto.
* src/sfnt/ttcolr.c (find_base_glyph_record,
find_base_glyph_v1_record): Fix variable signedness.
(read_color_line): Add cast.
(read_paint): Add casts.
Fix signedness issue.
(tt_face_get_colorline_stops) Fix signedness issues.
* src/sfnt/ttpost.c (load_format_20): Add casts.
* src/truetype/ttsubpix.c (TWEAK_RULES, TWEAK_RULES_EXCEPTIONS):
Remove final semicolons.
2021-05-29 Werner Lemberg <wl@gnu.org>
[build] Allow overriding of `ANSIFLAGS` for GNU make build.
* builds/*: Implement it.
2021-05-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[type42] Fix auto-hinting.
The autohinter could not access the base (unscaled) outline in the
child TrueType glyph slot. We now share the internal parts between
the parent and child glyph slots. Fixes #1057.
* src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
of `T42_GlyphSlot' and replace it with the child TrueType structure.
(T42_GlyphSlot_Done): Updated accordingly.
2021-05-25 Werner Lemberg <wl@gnu.org>
[psaux] Guard and trace AFM kern data allocation.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31543
* include/freetype/internal/fttrace.h: Add 'afmparse' trace
component.
* src/psaux/afmparse.c (FT_COMPONENT): Define.
(afm_parse_track_kern, afm_parse_kern_pairs): Protect against
allocations bombs.
Add tracing.
(afm_parse_kern_data): Don't allow multiple kern data sections.
2021-05-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* meson.build (ft2_public_headers): Add missing `ftcid.h'.
Fixes #1058.
2021-05-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[type42] Avoid some memory zeroing.
* src/type42/t42objs.c (T42_Open_Face): Tweak allocation macro.
* src/type42/t42parse.c (t42_parse_sfnts): Ditto.
2021-05-19 Nikolaus Waxweiler <madigens@gmail.com>
[CMake] Update dependency finders.
1. Fixes CMake using any found HarfBuzz version lower than the minimum
required. This is based on HALX99's merge request at
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/31
2. Update FindHarfBuzz.cmake from
https://github.com/WebKit/WebKit/blob/1ce32454/Source/cmake/FindHarfBuzz.cmake
and guard post-CMake-3.1 features to keep the minimum version unchanged
3. Update FindBrotliDec.cmake to stop the warnings, based on what
https://github.com/google/woff2/blob/a0d0ed7d/cmake/FindBrotliDec.cmake
is doing
* CMakeLists.txt, builds/cmake/FindHarfBuzz.cmake: Implement 1 and 2.
* builds/cmake/FindBrotliDec.cmake: Implement 3.
2021-05-19 Ben Wagner <bungeman@chromium.org>
[gzip] Use exact type for `ft_gzip_alloc` and `ft_gzip_free`.
While a function pointer may be cast to another function pointer
type, it is required to cast the function pointer back to the
original function pointer type before calling it. If a parameter is
a pointer the exact pointer type is required. Using a pointer to a
different underlying type is technically undefined behavior. The
wrapper functions `ft_gzip_alloc` and `ft_gzip_free` took
`FT_Memory` (a `FT_MemoryRec_*`) instead of `voidpf` (`void*`), so
when gzip calls these callbacks through `alloc_func` or `free_func`
it invokes undefined behavior. On most platforms this works out as
expected, but newer undefined behavior detectors and targets like
wasm can detect this and will produce an error.
* src/gzip/ftgzip.c (ft_gzip_alloc, ft_gzip_free): Update signatures
to exactly match `alloc_func` and `free_func`, respectively.
Internally, cast the `void*` opaque pointer to `FT_Memory`.
2021-05-18 Alexei Podtelezhnikov <apodtele@gmail.com>
Prioritize the anti-aliasing renderer module.
* modules.cfg: Reorder the renderers.
* include/freetype/config/ftmodule.h: Ditto.
2021-05-16 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Additional guards on the POST table.
Fixes timeout (#1055) analyzed by Ben Wagner, reported as
https://crbug.com/1194092
* src/sfnt/ttload.c (tt_face_load_post): Check POST format.
* src/sfnt/sfobjs.c (sfnt_load_face): Synthesize the missing unicode
charmap only if the glyph names exist.
* src/psnames/psmodule.c (ps_unicode_value): Short cut ".notdef" and
".null".
2021-05-13 Daniel McArdle <dmcardle@chromium.org>
[psaux] Use doubling allocation strategy for CF2_ArrStack.
Fixes timeout reported as
https://crbug.com/1206181
* src/psaux/psarrst.c (cf2_arrstack_{push,init}): Implement it.
* src/psaux/psarrst.h (CF2_ArrStackiRec): Drop `chunk'.
2021-05-12 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (FT_MAX_GRAY_SPANS): Increase from 10 to 16.
Ten was barely enough for two slanted stems. Sixteen can actually fit
a bit more complicated scanlines.
2021-05-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (FT_GRAY_SET): Adjust for better code.
2021-05-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Faster bitmap sweeping.
Selecting the fill rule or checking the direct mode each time we call
`gray_hline' is sub-optimal. This effectively splits the direct mode
into a separate code path while inlining `gray_hline' and saving 5-7%
of rendering time.
* src/smooth/ftgrays.c (gray_hline): Eliminated in favor of...
(FT_FILL_RULE, FT_GRAY_SET): ... these new macros...
(gray_sweep): ... inlined here.
(gray_sweep_direct): New function that handles the direct span buffer.
(gray_TWorker): Remove the span buffer.
(gray_raster_render, gray_convert_glyph): Updated.
2021-05-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_hline): Simplify even-odd computations.
It is too bad the even-odd rule is not used much.
2021-05-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[type1] Avoid MM memory zeroing.
* src/type1/t1load.c (t1_allocate_blend, parse_blend_design_map):
Tweak allocation macros.
* src/type1/t1objs.c (T1_Face_Done): Minor.
2021-05-07 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/bdf/bdflib.c (_bdf_list_ensure): Tweak allocation macro.
2021-05-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/psaux/psobjs.c (ps_parser_load_field): Tweak allocation macro.
2021-05-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/sfobjs.c (sfnt_load_face): Tweak allocation macro.
2021-05-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_read_subrs): Tweak allocation macro.
2021-05-06 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Tweak allocation.
2021-05-05 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,psaux] Avoid memory zeroing (contd.).
* src/cff/cffload.c (cff_blend_doBlend, cff_blend_build_vector): Tweak
allocation macros.
* src/psaux/psarrst.c (cf2_arrstack_setNumElements): Ditto.
* src/psaux/psstack.c (cf2_stack_init): Ditto.
2021-05-04 Ben Wagner <bungeman@chromium.org>
* src/cid/cidload.c (cid_hex_to_binary): Improve return value.
Add argument to return the actual number of bytes that were decoded.
The actual number of bytes decoded can be quite variable depending
on the number of ignored 'whitespace' bytes or early termination
with `>`.
(cid_face_open): Updated to use this calculated value. This avoids
trusting `parser->binary_length` is always be correct and reading
uninitialized bits if fewer are actually decoded.
First reported as
https://crbug.com/1203240
2021-05-03 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Streamline POST format 2.0 handing.
To reduce memory allocations, we read an entire Pascal-string buffer
and convert it to a C-string buffer. We also reject tables with
Postscript glyph names exceeding 63 bytes.
* src/sfnt/ttpost.c (load_format20): Implement it.
(load_post_names): Check the minimal POST table size.
(load_format25, tt_face_free_ps_names): Updated accordingly.
2021-05-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf,pcf] Avoid memory zeroing (contd.).
* src/bdf/bdflib.c (bdf_create_property, _bdf_add_comment,
_bdf_add_property, bdf_load_font): Tweak allocation macros.
* src/pcf/pcfread.c (pcf_get_properties, pcf_get_metrics): Ditto.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] Avoid some memory zeroing.
* src/sfnt/sfobjs.c (sfnt_open_font, sfnt_init_face,
tt_name_ascii_from_{utf16,other}): Tweak allocaton macros.
* src/sfnt/ttload.c (tt_face_load_name): Ditto.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocaton macros.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/pngshim.c (Load_SBit_Png): Tweak allocaton macro.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[truetype] Avoid some memory zeroing.
* src/truetype/ttinterp.c (Init_Context): Tweak allocation macro.
* src/truetype/ttpload.c (tt_face_load_cvt): Ditto.
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
[woff2] Avoid some memory zeroing.
* src/sfnt/sfwoff2.c (store_loca, woff2_open_font): Tweak macros.
2021-04-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/gzip/ftgzip.c (ft_gzip_alloc): Zero out memory again.
2021-04-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[lzw] Preserve decompression stack when relocating to heap.
* src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Copy stack when
relocating to heap.
2021-04-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cid/cidgload.c (cid_load_glyph): Restore the glyph_length check.
2021-04-27 Werner Lemberg <wl@gnu.org>
* src/psmodule.c (ps_unicodes_init): Ignore empty glyph names.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33637
2021-04-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/sfobjs.c (sfnt_init_face): Revert macro change.
2021-04-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff] Avoid some memory zeroing.
* src/cff/cffparse.c (cff_parser_init): Tweak memory macro.
* src/cff/cffload.c (cff_index_load_offsets, cff_index_get_pointers,
cff_charset_load, cff_vstore_load): Ditto.
2021-04-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[pfr] Avoid some memory zeroing.
* src/pfr/pfrobjs.c (pfr_face_init) : Tweak memory macro.
* src/pfr/pfrload.c (pfr_extra_item_load_stem_snaps,
pfr_phy_font_load): Ditto.
2021-04-26 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/winfonts/winfnt.c (FNT_Face_Init): Tweak memory macro.
2021-04-26 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux,psnames] Avoid some memory zeroing.
* src/psaux/psstack.c (cf2_stack_init): Tweak memory macro.
* src/psnames/psmodule.c (ps_unicodes_init): Ditto.
2021-04-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Avoid some memory zeroing.
* src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Use FT_QNEW_ARRAY.
* src/base/ftsnames.c (FT_Get_Sfnt_{Name,LangTag}): Ditto.
2021-04-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf,pcf] Avoid some memory zeroing.
* src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties, pcf_load_font):
Tweak memory macros.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto.
* src/bdf/bdflib.c (_bdf_readstreami, bdf_create_property,
_bdf_parse_glyphs, _bdf_parse_start): Ditto.
(_bdf_add_property): Do not handle zero size.
2021-04-25 Issam E. Maghni <issam.e.maghni@mailbox.org>
* builds/meson/process_ftoption_h.py: Add LF at EOF.
This fixes
.../ftoption.h:1030:10: error:
no newline at end of file [-Werror,-Wnewline-eof]
for the generated `ftoption.h` file.
2021-04-24 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffload.c (cff_index_get_pointers): s/FT_QALLOC/FT_ALLOC/.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (Mac_Read_POST_Resource): s/FT_ALLOC/FT_QALLOC/.
* builds/mac/ftmac.c (FT_New_Face_From_SFNT, read_lwfn): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sdf/ftsdf.c (sdf_{edge,contour,shape}_new): Use FT_QALLOC.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[sfnt] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string,
sfnt_get_var_ps_name): Do not zero out the buffer.
* src/sfnt/sfobjs.c (sfnt_init_face): Ditto.
* src/sfnt/sfwoff.c (woff_open_font): Ditto.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,type1,type42] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/cff/cffload.c (cff_index_get_pointers, cff_index_get_name):
Do not zero out the buffer.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Ditto.
* src/type1/t1load.c (parse_subrs, parse_charstrings,
parse_blend_axis_types): Ditto.
* src/type1/t1parse.c (T1_New_Parser, T1_Get_Private_Dict): Ditto.
* src/type42/t42parse.c (t42_parser_init): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[cid] s/FT_ALLOC/FT_QALLOC/ and clean up.
* src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
* src/cid/cidload.c (cid_face_open, cid_read_subrs): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[pfr] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/pfr/pfrload.c (pfr_extra_item_load_font_id, pfr_aux_name_load):
Do not zero out the buffer.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[bzip2,gzip] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/bzip2/ftbzip2.c (ft_bzip2_alloc): Do not zero out the buffer.
* src/gzip/ftgzip.c (ft_gzip_alloc, FT_Stream_OpenGzip): Ditto.
2021-04-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[pcf,bdf,winfonts] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/pcf/pcfread.c (pcf_interpret_style): Do not zero out the buffer.
* src/bdf/bdfdrivr.c (bdf_interpret_style): Ditto.
* src/winfonts/winfnt.c (FNT_Face_Init, FNT_Load_Glyph): Ditto.
2021-04-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Optimize SBit copying.
* src/cache/ftcsbits.c (ftc_snode_load): Do not initialize the buffer.
(ftc_sbit_copy_bitmap): Accept zero size, s/FT_ALLOC/FT_QALLOC/.
2021-04-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[gxvalid,otvalid] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/gxvalid/gxvmod.c (gxv_load_table): Do not zero out the buffer.
* src/otvalid/otvmod.c (otv_load_table): Ditto.
2021-04-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[psaux] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/psaux/psobjs.c (ps_table_done, ps_parser_load_field): Do not
zero out the buffer.
2021-04-22 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
* src/base/ftobjs.c (open_face_PS_from_sfnt_stream,
Mac_Read_sfnt_Resource): Do not zero out the buffer.
* src/base/ftmac.c (FT_New_Face_From_SFNT, read_lwfn): Ditto.
* src/base/ftrfork.c (raccess_make_file_name,
raccess_guess_darwin_hfsplus, raccess_guess_darwin_newvfs): Ditto.
2021-04-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Restore SBit copying for unowned (BDF) bitmaps.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
(ftc_snode_load): Check ownership and copy unowned bitmaps.
2021-04-19 Dominik Röttsches <drott@chromium.org>
[sfnt] Return in 'COLR' v1 when layer pointer outside table
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): Add missing return
when paint pointer outside table.
(read_paint): Add missing return when paint pointer outside table.
2021-04-18 Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Switch to lazy SBit setting.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Removed.
(ftc_snode_load): Take the bitmap ownership instead of copying.
2021-04-16 Daniel Welty <@danielwelty>
* src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.
2021-04-16 Werner Lemberg <wl@gnu.org>
* builds/unix/freetype2.m4: Fix help string formatting.
The indented `dnl` macros inserted unwanted horizontal space.
Problem reported by Ozkan Sezer <sezeroz@gmail.com>.
2021-04-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Safeguard 'COLR' v1 layer extraction
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): Do not output
layer pointer to iterator if it is outside the 'COLR' table.
(read_paint): Do not attempt to read layers that are outside the
table.
2021-04-02 Ben Wagner <bungeman@chromium.org>
[base] Complete `ft_glyphslot_clear`.
* src/base/ftobjs.c (ft_glyphslot_clear): This function is intended
to reset all the values of a glyph slot. However, it was not
resetting the values of the advances and `glyph_index`. Reset the
advances and `glyph_index` to zero.
2021-04-02 Ben Wagner <bungeman@chromium.org>
[truetype] Prevent glyph program state from persisting.
`FDEF` instructions are specified as allowed only in 'prep' or
'fpgm'. FreeType has attempted to prevent their use in the glyph
program, but they were still allowed in glyph programs if defined in
a function defined in 'prep' or 'fpgm' and called from the glyph
program.
Similarly, `IDEF` instructions are specified not to be able to
modify any existing instruction. FreeType has attempted to prevent
their use in the glyph program, but they can still be used like
`FDEF`.
This change stores the initial bytecode range type and disallows the
use of `FDEF` and `IDEF` while running the glyph program.
Most other state is copied from the `TT_Size` into the execution
context. However, it is possible for a glyph program to use `WS` to
write to the storage area or `WCVTP`, `WCVTF`, and `DELTAC[123]` to
write to the control value table.
Allowing any change to the global state from the glyph program is
problematic as the outlines of any given glyph may change based on
the order the glyphs are loaded or even how many times they are
loaded. There exist fonts that write to the storage area or the
control value table in the glyph program, so their use should not be
an error.
Possible solutions to using these in the glyph program are
* ignore the writes;
* value-level copy on write, discard modified values when finished;
* array-level copy on write, discard the copy when finished;
* array-level copy up-front.
Ignoring the writes may break otherwise good uses. A full copy
up-front was implemented, but was quite heavy as even well behaved
fonts required a full copy and the memory management that goes along
with it. Value-level copy on write could use less memory but
requires a great deal more record keeping and complexity. This
change implements array-level copy on write. If any attempt is made
to write to the control value table or the storage area when the
initial bytecode range was in a glyph program, the relevant array
will be copied to a designated storage area and the copy used for
the rest of the glyph program's execution.
* src/truetype/ttinterp.h (TT_ExecContextRec): New fields
`iniRange`, `glyfCvtSize`, `glyfCvt`, `origCvt`, `glyfStoreSize`,
`glyfStorage`, and `origStorage`.
* src/truetype/ttinterp.c (Modify_CVT_Check): New function to handle
`exc->glyfCvt`.
(Write_CVT, Write_CVT_Stretched, Move_CVT, Move_CVT_Stretched): Use
it.
(Ins_WS): Handle `exc->glyfStorage`.
(Ins_FDEF, Ins_IDEF): Updated.
(TT_RunIns): Updated.
(TT_Done_Context): Free 'glyf' CVT working and storage area.
(TT_Load_Context): Fix/add casts.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Fix cast.
2021-03-30 Dominik Röttsches <drott@chromium.org>
[sfnt] Check validity of pointer location of `read_color_line`.
* src/sfnt/ttcolr.c (get_child_table_pointer): New function to fetch
child table pointer early for all paint formats that compute a child
table pointer.
(read_color_line, read_paint): Updated.
(tt_face_get_colorline_stops): Check `colr->table`.
2021-03-28 Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com>
[docs] Update docwriter stylesheet for 1.3.1.
This change is required to support docwriter 1.3.1.
See
https://gitlab.freedesktop.org/freetype/docwriter/-/merge_requests/101
for more information.
* docs/markdown/stylesheets/extra.css:
(.wy-nav-content, .md-sidebar--secondary): Remove.
2021-03-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/sfnt/pngshim.c (Load_SBit_Png): Free `rows` once later.
2021-03-16 Ben Wagner <bungeman@google.com>
[sfnt] Fix memory leak in png loading.
Reported as
https://bugs.chromium.org/p/chromium/issues/detail?id=1182552
Memory is allocated and the pointer assigned to `rows` inside a
'setjmp' scope. This memory must be freed outside the 'setjmp'
scope after a 'longjmp'. Since `rows` is a local and modified
inside the 'setjmp' scope it must be marked volatile or it will have
an indeterminate value after the 'longjmp'.
* src/sfnt/pngshim.c (Load_SBit_Png): Fix memory leak of `rows`.
2021-03-16 Christopher Degawa <ccom@randomderp.com>
* CMakeLists.txt: Don't limit generation of 'pkg-config' file to UNIX.
mingw-w64 uses the 'pkg-config' files but does not set UNIX.
2021-03-11 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_set_cell): Refactor to fix VC++ warning.
2021-03-13 Werner Lemberg <wl@gnu.org>
Handle various VC++ compiler warnings.
Fixes #1039.
* src/base/ftstroke.c (ft_stroker_inside, ft_stroker_outside):
Initialize `sigma`.
* src/sdf/ftsdf.c (sdf_generate_with_overlaps): Exit immediately if
function arguments are invalid.
* src/sdf/ftsdfrend.c (sdf_property_set) <"overlaps">: Fix cast.
* src/sfnt/sfwoff2.c (woff2_decompress)
[!FT_CONFIG_OPTION_USE_BROTLI]: Use `FT_UNUSED`.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `fvar_head`.
2021-03-11 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Reduce copying during integration phase.
We now record `cover' and `area' directly into the linked list. This
makes rendering faster by 10% or even more at larger sizes.
* src/smooth/ftgrays.c (FT_INTEGRATE): Write directly.
(gray_TWorker): Add direct cell reference and remove unused fields.
(gray_set_cell): Consolidate the linked list management and pointers.
(gray_convert_glyph, gray_convert_glyph_inner): Updated.
2021-03-10 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (FT_INTEGRATE): New convenience macro.
(gray_render_line, gray_render_scanline): Use it.
2021-03-09 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/smooth/ftgrays.c (gray_render_line): Rearrange conditionals.
These produce faster or more optimizable code.
2021-03-08 Tim-Philipp Müller <tim@centricular.com>
[meson] Fix 'mmap' handling on Windows.
* meson.build (ft2_sources): Always use `windows/ftsystem.c` on
Windows unless mmap has been disabled.
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/5#note_829289
2021-03-07 Tim-Philipp Müller <tim@centricular.com>
[ci] Add basic support for Meson builds with MSVC on Windows.
This adds meson jobs for VS2017 (x86 and x86_64).
* .gitlab-ci.yml: New file.
2021-03-07 Tim-Philipp Müller <tim@centricular.com>
[meson] Add subproject fallbacks for 'libpng' and 'zlib'.
* subprojects/libpng.wrap, subprojects/zlib.wrap: New files.
* meson.build: Updated.
2021-03-07 Xavier Claessens <xavier.claessens@collabora.com>
[meson] Make it work with Windows.
* meson.build: Do not process `ftconfig.h` when not using
`ftconfig.h.in`.
Fixes #1029.
2021-02-25 Werner Lemberg <wl@gnu.org>
[woff2] Fix memory leak.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28148
* src/sfnt/sfwoff2.c (woff2_open_font): Reject fonts that have
multiple tables with the same tag. While not explicitly forbidden
in the OpenType specification, it is implicitly forbidden by
describing a binary search algorithm for tables that only works
reliably if table tags are unique.
2021-02-22 Werner Lemberg <wl@gnu.org>
* CMakeLists.txt: Update location of `LICENSE.TXT`.
Fixes #1035.
2021-02-19 Werner Lemberg <wl@gnu.org>
* builds/unix/ax_pthread.m4: Update from 'autoconf-archive'.
A bunch of fixes were added recently to its git repository.
2021-02-17 Werner Lemberg <wl@gnu.org>
[unix] Updates for autoconf 2.71.
This fixes warnings reported by autoupdate.
* builds/unix/ax_pthread.m4: Replace `as_echo` with `AS_ECHO`.
* builds/unix/configure.raw: Remove obsolete `AC_HEADER_STDC`.
Don't escape back quotes in messages for `AC_MSG_WARN`.
2021-02-16 Werner Lemberg <wl@gnu.org>
* builds/toplevel.mk: Fix previous commit.
<top_level>: Use `TOP_DIR` in `wildcard` function.
(check_out_submodule, copy_submodule): Move down to come after
definition of `all` rule.
Call `mkdir` conditionally.
2021-02-16 Werner Lemberg <wl@gnu.org>
* builds/toplevel.mk: Use rules for handling 'dlg'.
Suggested by Alexei.
(check_out_submodule, copy_submodule): New targets.
<top-level>: Replace calls to `shell` with rules.
2021-02-16 Werner Lemberg <wl@gnu.org>
* builds/toplevel.mk: Avoid side effects of `shell`.
We use a dummy variable to catch its output. Otherwise the `make`
program is going to interpret the return value of `shell`; this can
cause obscure warning or error messages or even be harmful.
2021-02-16 Werner Lemberg <wl@gnu.org>
Move 'dlg' submodule to `subprojects` directory.
This is for future changes with Meson, which doesn't allow a
different name for its `subprojects` directory. Having both a
`submodules` and a `subprojects` directory is confusing.
* .gitmodules, autogen.sh (copy_submodule_files, DLG_INC_DIR,
DLG_SRC_DIR): Updated.
* builds/toplevel.mk (<top-level>, do-dist),
builds/windows/vc2010/script.bat: Updated.
* src/tools/no-copyright: Updated.
2021-02-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Update paint format values to support non-variable paints.
* freetype.h (FT_PaintFormat): Update paint format identifiers after
a specification change. The specification was updated to have
sibling formats, variable and non-variable variants for each.
Reflect that here.
* sfnt/ttcolr.c (read_paint): Remove parsing of variable indices as
the non-variable formats no longer have them.
2021-02-15 Daniel E <daniel.engberg.lists@pyret.net>
* CMakeLists.txt: Improve 'bz2' support.
Not all distributions such as FreeBSD provide a `.pc` file for
'(lib)bz2' so follow autotools and add it to `Libs.private` instead.
2021-02-13 Werner Lemberg <wl@gnu.org>
* src/tools/update-copyright-year: Fix single-year entry handling.
The fix from 2021-01-17 didn't cover the case where the year to be
updated is identical to the current year.
2021-02-13 Werner Lemberg <wl@gnu.org>
Add new function `FT_Get_Transform`.
See
https://github.com/harfbuzz/harfbuzz/issues/2428
for some reasons to introduce this function.
* include/freetype/freetype.h, src/base/ftobjs.c (FT_Get_Transform):
Implement it.
2021-02-12 Alexei Podtelezhnikov <apodtele@gmail.com>
Decorate `qsort` callbacks with `cdecl`.
* include/freetype/internal/compiler-macros.h (FT_COMPARE_DEF):
Add new macro.
* src/base/ftrfork.c, src/bdf/bdflib.c, src/gxvalid/gxvcommn.c,
src/psaux/afmparse.c, src/psnames/psmodule.c, src/type1/t1afm.c,
src/sfnt/sfwoff.c, src/sfnt/sfwoff2.c: Update `qsort` callbacks.
Fixes #1026 when compiling FreeType with an unusual calling
convention while the C library function `qsort` still expects
`cdecl`.
2021-02-10 Dominik Röttsches <drott@chromium.org>
[sfnt] Implement 'COLR' v1 sweep gradients.
* freetype.h (FT_PaintSweepGradient): Add `FT_PaintSweepGradient` to
represent a 'COLR' v1 sweep gradient.
Update format.
(FT_PaintFormat): Update shifted paint formats.
Sync with spec.
* sfnt/ttcolr.c (read_paint): Logic to parse sweep gradients.
Fix struct access in radial gradient implementation.
2021-02-09 Dominik Röttsches <drott@chromium.org>
[sfnt] Provide optional root transform for 'COLR' v1 glyph graph.
* include/freetype/freetype.h (FT_Get_Color_Glyph_Paint):
Additional function argument `root_transform` to control whether
root transform should be returned.
(FT_OpaquePaint): Additional tracking field to denote whether
root transform is to be returned.
* include/freetype/internal/sfnt.h
(TT_Get_Color_Glyph_Paint_Func): Propagate additional argument.
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint): Ditto.
* src/sfnt/ttcolr.c (tt_face_get_colr_glyph_paint): Return root
transform reflecting the size and tranform configured on
`FT_Face`.
(read_paint): Initialize and track status of insert_root_transform
flag.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
* meson.build: s/freetype2_dep/freetype_dep/.
Many projects (e.g., fontconfig, cairo) hardcode the `freetype_dep`
variable name to use FreeType as subproject because that was the
variable name in Centricular's Meson port of FreeType. While they
should stop hardcoding that variable name, it does not cost us
anything to keep using that name to ease transition.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
[meson] Fix handling of HarfBuzz library.
* meson.build (harfbuzz_dep): Do not fall back to HarfBuzz by
default.
Otherwise it causes a dependency cycle:
cairo => fontconfig => freetype2 => harfbuzz => cairo
Meson will still fall back to HarfBuzz subprojects if the `harfbuzz`
option is set to `enabled` instead of `auto` and a
`subprojects/harfbuzz.wrap` file is present. In that case it is the
responsibility of the main project to set the proper options on each
subproject to break the dependency cycle.
Fixes: #1028.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
[meson] Fix dependency lookup and generate `ftconfig.h`.
- zlib: If not found on the system, meson can build it as a
subproject. We thus never use the (outdated) zlib support that
comes with FreeType. Doing so has the additional advantage that
the zlib code can be shared with other projects like GLib if both
are subprojects of an application.
- harfbuzz: Build as a subproject if not found on the system.
- 'QUESTION: What if the compiler doesn't support `-D` but uses `/D`
instead as on Windows?' Answer: Meson translate arguments for us.
- visibility: Replace self-made code with meson-specific solution.
* meson.build (ft2_defines): Rewrite logic to set and handle it.
(process_header_command): New variable, previously called
`ftoption_command`.
(ftoption_command, ftconfig_command): New variables.
(zlib_option): Removed.
(zlib_dep): New variable.
(ft2_deps): Updated.
(harfbuzz_dep): Updated.
(ftconfig_h_in, ftconfig_h): New variables.
(ft2_sources): Updated.
(ft2_lib): Updated, handle visibility.
(summary): Updted.
* meson_options.txt (zlib): Updated.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
* meson.build: Fix resource compilation on Windows.
This is copied from GStreamer's meson port of FreeType.
(ft2_sources): Add both debug and resource file (the latter for
Windows only).
(ft2_debug_src): Removed.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
* meson.build: s/ft2_libtool_version/ft2_pkgconfig_version/.
(freetype2_dep): Use it.
`ft2_libtool_version` would be the shared library version, not the
one we should use in file `freetype2.pc`.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
* meson.build: Use `meson.override_dependency`.
This is a new meson mechanism to avoid other projects to hard-code
the `freetype2_dep` variable name in their build definition. It
also ensures that meson does not mix system and subproject versions
of FreeType inside of the same project.
Also remove outdated TODO because `declare_dependency` was already
there.
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
* meson.build (bzip2_dep): Simplify.
We remove `static:false` from `find_library('bz2')`.
I don't know whether the previous code was a workaround for an old
meson bug, but at least with version >=0.55.0 (which FreeType uses)
it picks the shared library when both are available.
File `freetype2.pc` still contains the full path to file `libbz2.so`
instead of `-lbz2` – that we need to do this is a meson bug even
present in the current version (0.57.0).
2021-02-09 Xavier Claessens <xavier.claessens@collabora.com>
* meson.build: Set project version.
2021-02-04 Werner Lemberg <wl@gnu.org>
[base] Fix Netpbm tracing message.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Don't emit Netpbm
warning if there is nothing to output.
2021-02-04 Werner Lemberg <wl@gnu.org>
* src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.
This ensures good logging output, with all lines having a proper
prefix (if requested).
This is a continuation of a similar patch from 2020-12-02, which
missed some locations.
2021-02-03 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/unix/configure.raw [mmap]: Restore default path.
Fixes #1023.
2021-02-03 Werner Lemberg <wl@gnu.org>
[psaux] Fix integer overflow.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30154
* src/psaux/psblues.c (cf2_blues_capture): Use `SUB_INT32`.
2021-02-02 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/unix/configure.raw [mmap support]: Explicitly handle Windows.
Fixes #1024.
2021-01-31 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw [mmap support]: Correctly handle Windows.
Fixes #1024.
2021-01-31 Werner Lemberg <wl@gnu.org>
* builds/windows/ftdebug.c: Synchronize with `src/base/ftdebug.c`.
2021-01-31 Werner Lemberg <wl@gnu.org>
Always provide logging API.
It's easier to have stubs if FT_DEBUG_LOGGING is undefined than to
modify `ftexport.sym` conditionally.
Problem reported by Alexei.
* src/base/ftdebug.c: Include `ftlogging.h`.
(FT_Trace_Set_Level, FT_Trace_Set_Default_Level, FT_Set_Log_Handler,
FT_Set_Default_Log_Handler) [!FT_DEBUG_LOGGING]: Provide stubs.
2021-01-31 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw: Fix typo.
Bug introduced in Vincent's last commit bb33f03.
Fixes issue #1021.
2021-01-27 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftstroke.c (FT_Stroker_EndSubPath): Ignore tiny gaps.
Fixes bug #1020.
2021-01-27 Alexei Podtelezhnikov <apodtele@gmail.com>
[stroker] Minor clean-up.
* src/base/ftstroke.c (FT_Stroker_{ConicTo,CubicTo}): Reset the last
line length.
(FT_Stroker_EndSubPath): Call `ft_stroker_process_corner'.
2021-01-27 Vincent Torri <vincent.torri@gmail.com>
* builds/windows/ftsystem.c: Add shared memory support on Windows.
* CMakeLists.txt (BASE_SRCS), builds/unix/configure.raw (FTSYS_SRC),
builds/windows/vc2010/freetype.vcxproj,
builds/windows/visualc/freetype.vcproj, meson.build (ft2_sources):
Add it (conditionally).
2021-01-23 Werner Lemberg <wl@gnu.org>
Require HarfBuzz 2.0.0.
This is needed to make commit f1f9705f9 work.
* CMakeLists.txt (HARFBUZZ_MIN_VERSION), builds/unix/configure.raw
(harfbuzz_pkg), meson.build (harfbuzz_dep): Updated.
2021-01-22 Alexei Podtelezhnikov <apodtele@gmail.com>
* autogen.sh: Absorb `version.sed'.
* version.sed: Removed.
2021-01-19 Alexei Podtelezhnikov <apodtele@gmail.com>
* srd/base/ftlcdfil.c (FT_Library_SetLcdGeometry): Fix return value.
2021-01-15 Nikolaus Waxweiler <madigens@gmail.com>
[afshaper] Fix hb_ot_tags_from_script deprecation warning.
* autofit/afshaper.c (af_shaper_get_coverage): Copy the source code
of the function as suggested in
https://github.com/harfbuzz/harfbuzz/issues/2737 and adjust to handle
at most three tags.
2021-01-17 Werner Lemberg <wl@gnu.org>
* src/tools/update-copyright-year: Fix single-year entry handling.
2021-01-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/unix/unixddef.mk: Remove the second DEVEL_DIR definition.
2021-01-14 Dominik Röttsches <drott@chromium.org>
[sfnt] Additional checks for 'colr' table presence.
* sfnt/ttcolr.c (tt_face_get_colr_glyph_paint,
tt_face_get_colorline_stops, tt_face_get_paint): Additional checks
for whether colr table is present. Prevents crashes when these
methods are called on non-COLR fonts.
2021-01-13 Dominik Röttsches <drott@chromium.org>
Add config option to test for 'COLR' v1 support in headers.
* include/freetype/config/ftoption.h (TT_SUPPORT_COLRV1): New macro
so that clients can test whether the FreeType checkout that they are
building against supports the 'COLR' v1 API. This is intended to be
a temporary solution until 'COLR' v1 support is released in a
FreeType version and such a check can be made by using the version
number instead.
2020-12-16 Dominik Röttsches <drott@chromium.org>
[base] Fill 'COLR' v1 API templates to make them work (#59703).
* src/base/ftobjs.c (FT_Get_Color_Glyph_Paint, FT_Get_Paint_Layers,
FT_Get_Paint, FT_Get_Colorline_Stops): Add basic sanity checks,
check for existence of `FT_Face`, check arguments and delegate calls
for the respective 'COLR' v1 API to the SFNT driver.
2020-12-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Register 'COLR' v1 API in driver (#59703).
* include/freetype/internal/sfnt.h (TT_Get_Color_Glyph_Paint_Func,
TT_Get_Paint_Layers_Func, TT_Get_Colorline_Stops_Func,
TT_Get_Paint_Func): New function pointer types.
(SFNT_Interface): Add them.
(FT_DEFINE_SFNT_INTERFACE): Updated.
* src/sfnt/sfdriver.c (PUT_COLOR_LAYERS_V1): New macro.
(sfnt_interface): Add new function pointers.
2020-12-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Add 'COLR' v1 API to retrieve color layers (#59703).
* src/sfnt/ttcolr.c (tt_face_get_paint_layers): New function to get
the layers of a `PaintColrLayers` table in the font, using an
`FT_LayerIterator` from an `FT_PaintColrLayers` object retrieved via
`tt_face_get_paint`.
* src/sfnt/ttcolr.h: Updated.
2020-12-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Add 'COLR' v1 API to iterate color stops (#59703).
* src/sfnt/ttcolr.c (tt_face_get_colorline_stops): New function to
return the current `FT_ColorStop` object from `FT_ColorStopIterator`.
Also increment the iterator.
* src/sfnt/ttcolr.h: Updated.
2020-12-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Add API to get actual paint from `FT_OpaquePaint` (#59703).
* src/sfnt/ttcolr.c (tt_face_get_paint): New function to resolve an
`FT_OpaquePaint` paint reference into an `FT_COLR_Paint` object of a
certain format, which contains the detailed information stored in a
paint of the respective format.
(read_paint): New function to provide the format specific parsing
and to populate the data members of each specific `FT_COLR_Paint`
subtype.
(read_color_line): New function to parse retrieved color line
information into an `FT_ColorLine` object, which has information
about the color line extend mode as well as an
`FT_ColorStopIterator` object.
* src/sfnt/ttcolr.h: Updated.
2020-12-16 Dominik Röttsches <drott@chromium.org>
[sfnt] Add API to retrieve 'COLR' v1 root paint (#59703).
* src/sfnt/ttcolr.c (BaseGlyphV1Record): New structure.
(tt_face_load_colr): Handle version 1 table header.
(find_base_glyph_v1_record): New auxiliary function.
(tt_face_get_colr_glyph_paint): New function to find the root
`FT_OpaquePaint` object for a given glyph ID.
* src/sfnt/ttcolr.h: Updated.
2020-12-16 Dominik Röttsches <drott@chromium.org>
Add new methods required for 'COLR' v1 to public API (#59703).
* include/freetype/freetype.h (FT_Get_Color_Glyph_Paint): New method
for retrieving the root paint object for a color glyph by specifying
a glyph ID.
(FT_Get_Paint_Layers): New method for retrieving the layers of a
`PaintColorGlyph`.
(FT_Get_ColorLine_Stops): New method for retrieving the stops of a
color.
(FT_Get_Paint): New method for resolving an `FT_OpaquePaint` into an
`FT_COLR_Paint` object.
2020-12-16 Dominik Röttsches <drott@chromium.org>
Add types required for 'COLR' v1 to public API (#59703).
* include/freetype/freetype.h (FT_PaintFormat, FT_ColorStopIterator,
FT_ColorIndex, FT_ColorStop, FT_PaintExtend, FT_ColorLine,
FT_Affine23, FT_CompositeMode, FT_OpaquePaint, FT_PaintColrLayers,
FT_PaintSolid, FT_PaintLinearGradient, FT_PaintRadialGradient,
FT_PaintGlyph, FT_PaintColrGlyph, FT_PaintTransformed,
FT_PaintTranslate, FT_PaintRotate, FT_PaintSkew, FT_PaintComposite,
FT_COLR_Paint): Adding structs and enum to represent paint format,
color stop information, gradient extend information, structs to
reference paint offsets, and to define transforms and compositions.
Adding a union type to represent the union of the structs,
distinguished by `FT_PaintFormat`.
2021-01-10 Werner Lemberg <wl@gnu.org>
* builds/*: s/BUILD_DIR/PLATFORM_DIR/.
The old variable name caused confusion.
2021-01-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds] Revert `FTMODULE_H' changes.
* builds/toplevel.mk, builds/freetype.mk: Revert changes.
2021-01-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Fix up DLG build with VC++.
* builds/windows/vc2010/script.bat: Copy headers to include/.
* builds/windows/vc2010/freetype.vcxproj: Remove DLG paths.
2021-01-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds] Relocate `FTMODULE_H'.
* builds/toplevel.mk: Place `FTMODULE_H' in include/.
* builds/freetype.mk: Simplify included path.
2021-01-07 Werner Lemberg <wl@gnu.org>
Fix ABI incompatibility.
* include/freetype/ftimage.h (FT_Pixel_Mode): Don't insert
`FT_PIXEL_MODE_GRAY16' but append it.
* src/base/ftobjs.c (pixel_modes): Updated.
2021-01-07 Alexei Podtelezhnikov <apodtele@gmail.com>
[dlg] Move the headers to include/dlg to simplify their use.
* autogen.sh, builds/toplevel.mk: Copy headers to include/dlg.
* builds/freetype.mk, builds/windows/vc2010/freetype.vcxproj:
Simplify included path.
* include/freetype/internal/ftdebug.h: Simplify #include.
* src/dlg/rules.mk, .gitignore: Updated.
2021-01-06 Werner Lemberg <wl@gnu.org>
* meson.build: Add summary.
Based on a patch from Vincent Torri <vincent.torri@gmail.com>.
2021-01-06 Torsten Hilbrich <emacs.nolkaf@hilbrich.tk>
* meson.build: Fix 'png' build option (#59458).
Without this patch, 'png' is always required.
2021-01-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[builds/windows] Add SDF to VC2010 project.
* builds/windows/vc2010/freetype.vcxproj: Updated;
AfterBuild conveniences.
2020-12-26 Werner Lemberg <wl@gnu.org>
[sdf] Use 'counter-clockwise', not 'anti-clockwise'.
We prefer US nomenclature.
* src/sdf/ftsdf.c (SDF_Contour_Orientation):
s/SDF_ORIENTATION-ACW/SDF_ORIENTATION_CCW/.
Update all users.
2020-12-26 Werner Lemberg <wl@gnu.org>
* src/base/ftobjs.c (pixel_modes): Updated.
2020-12-26 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Remove custom memory tracker.
The internal FreeType memory tracker is sufficient.
* src/sdf/ftsdf.c (FT_DEBUG_INNER, FT_ASSIGNP_INNER, SDF_MemoryUser,
sdf_alloc, sdf_free, SDF_ALLOC, SDF_FREE,
SDF_MEMORY_TRACKER_DECLARE, SDF_MEMORY_TRACKER_SETUP,
SDF_MEMORY_TRACKER_DONE): Removed.
s/SDF_ALLOC/FT_ALLOC/.
s/SDF_FREE/FT_FREE/.
Other updates.
2020-12-24 Werner Lemberg <wl@gnu.org>
[sdf] Fix `make multi`.
* src/sdf/ftsdf.c: Include `ftoutln.h`.
2020-12-24 Werner Lemberg <wl@gnu.org>
[sdf] Fix tracing.
* include/freetype/internal.fttrace.h: Add 'bsdf' component.
* src/sdf/ftbsdf.c, src/sdf/ftsdf.c (FT_COMPONENT): Define.
2020-08-21 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add debugging function.
* src/sdf/ftsdf.c (sdf_shape_dump): New function.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add 'bsdf' renderer to 'sdf' module.
* src/sdf/ftsdfrend.c (ft_bsdf_render): New function.
(ft_bitmap_sdf_renderer_class): New structure.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add interface functions for the 'bsdf' rasterizer.
* src/sdf/ftsdf.c (bsdf_raster_new, bsdf_raster_reset,
bsdf_raster_set_mode, bsdf_raster_render, bsdf_raster_done): New
functions.
(ft_bitmap_sdf_raster): New variable.
* src/sdf/ftsdf.h: Updated.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add function to copy SDF data into output bitmap.
* src/sdf/ftbsdf.c (finalize_sdf): New function.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add '8-point sequential Euclidean distance mapping' algorithm.
* src/sdf/ftbsdf.c (compare_neighbor, first_pass, second_pass,
edt8): New functions.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add function to copy source bitmap to distance map.
* src/sdf/ftbsdf.c (bsdf_init_distance_map): New function.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add functions to compute pixel edge distances.
* src/sdf/ftbsdf.c (compute_edge_distance, bsdf_approximate_edge):
New functions.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add function to find edge pixels in a grid of alpha values.
* src/sdf/ftbsdf.c (bsdf_is_edge): New function.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add essential structures for the 'bsdf' rasterizer.
* src/sdf/ftbsdf.c (ONE): New macro.
(BSDF_TRaster, ED, BSDF_Worker): New structures.
(zero_ed): New constant.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add 'sdf' module to non-gnumake build systems.
* include/freetype/config/ftmodule.h: Add both the 'sdf' and 'bsdf'
renderers to the list of modules.
* CMakeLists.txt (BASE_SRCS): Add 'sdf' single-object module.
2020-08-20 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added basic overlapping contour support.
* src/sdf/ftsdf.c (sdf_generate_with_overlaps): New function.
(sdf_raster_render): Enable it.
2020-08-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add build infrastructure.
* src/sdf/module.mk, src/sdf/rules.mk: New files.
* src/sdf/ftsdf.h (ft_sdf_raster): New forward declaration.
* include/freetype/ftmoderr.h (FT_MODERRDEF): Add error definition
for the 'sdf' module.
* include/freetype/internal/fttrace.h (FT_TRACE_DEF): Add trace
definition for the `sdf' module.
* modules.cfg (RASTER_MODULES): Add the `sdf' module to the list of
rasterizers.
2020-08-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add interface functions for the 'sdf' rasterizer.
* src/sdf/ftsdf.c (sdf_raster_new, sdf_raster_reset,
sdf_raster_set_mode, sdf_raster_render, sdf_raster_done): New
functions.
(ft_sdf_raster): New structure.
2020-08-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add subdivision and bounding box optimization.
* src/sdf/ftsdf.c (sdf_generate_bounding_box): New function, which
is an optimized version of `sdf_generate`.
(sdf_generate_subdivision): New function.
2020-08-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add function to generate SDF.
* src/sdf/ftsdf.c (sdf_generate): New function, currently disabled.
This is a proof-of-concept implementation: It doesn't use any
optimization, it simply checks all grid points against all contours.
2020-08-19 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add functions to get shortest distance from any edge/contour.
* src/sdf/ftsdf.c (sdf_edge_get_min_distance): New function.
(sdf_contour_get_min_distance): New function, currently disabled.
2020-08-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add shortest distance finding functions.
* src/sdf/ftsdf.c (get_min_distance_line, get_min_distance_conic,
get_min_distance_cubic): New functions. Note that
`get_min_distance_conic` comes with two implementations (using an
analytical and an iterative method, to be controlled with the
`USE_NEWTON_FOR_CONIC` macro).
2020-08-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add function to resolve corner distances.
* src/sdf/ftsdf.c (resolve_corner): New function.
2020-08-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add essential math functions.
* src/sdf/ftsdf.c (cube_root, arc_cos) [!USE_NEWTON_FOR_CONIC]: New
auxiliary functions.
* src/sdf/ftsdf.c (solve_quadratic_equation, solve_cubic_equation)
[!USE_NEWTON_FOR_CONIC]: New functions.
2020-08-18 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add utility functions for contours.
* src/sdf/ftsdf.c (get_control_box, get_contour_orientation): New
functions.
(split_conic, split_cubic, split_sdf_conic, split_sdf_cubic,
split_sdf_shape): New functions.
2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add functions to decompose `FT_Outline`.
* src/sdf/ftsdf.c (sdf_move_to, sdf_line_to, sdf_conic_to,
sdf_cubic_to): New auxiliary decomposition functions.
(sdf_compose_funcs): New structure.
(sdf_outline_decompose): New function.
2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Structs, enums, macros, and functions for 'sdf' rasterizer.
* src/sdf/ftsdf.c (FT_DEBUG_INNER, FT_ASSIGNP_INNER)
[FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New macros.
(SDF_MemoryUser) [FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New
struct for memory usage tracing.
(sdf_alloc, sdf_free) [FT_DEBUG_LEVEL_TRACE && FT_DEBUG_MEMORY]: New
functions for memory usage tracing.
(SDF_ALLOC, SDF_FREE): New macros for memory management.
(SDF_MEMORY_TRACKER_DECLARE, SDF_MEMORY_TRACKER_SETUP,
SDF_MEMORY_TRACKER_DONE): New macros to set up memory usage tracing.
(USE_NEWTON_FOR_CONIC, MAX_NEWTON_DIVISIONS, MAX_NEWTON_STEPS,
CORNER_CHECK_EPSILON, CG_DIMEN): New configuration macros for
controlling the process of finding the shortest distance.
(MUL_26D6, VEC_26D6_DOT): New auxiliary macros.
(SDF_TRaster, SDF_Edge, SDF_Contour, SDF_Shape, SDF_Signed_Distance,
SDF_Params): New structs for setting up SDF data.
(SDF_Edge_Type, SDF_Contour_Orientation): New enums for SDF data.
(zero_vector, null_edge, null_contour, null_shape, max_sdf): Useful
constants.
(sdf_edge_new, sdf_edge_done, sdf_contour_new, sdf_contour_done,
sdf_shape_new, sdf_shape_done): New constructors and destructors.
2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add raster parameters structure.
* src/sdf/ftsdf.h (SDF_Raster_Params): New structure.
* src/sdf/sdf.c: Include source files in order to make a single
object of the module.
2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add 'sdf' renderer.
* src/sdf/ftsdf.c: Add 'sdf' renderer along with its interface
functions.
Also add functions to set and get properties.
2020-08-17 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add common elements for 'sdf' and 'bsdf' renderers.
* src/sdf/ftsdfrend.h (SDF_Rendere_Module, ft_sdf_renderer_class,
ft_bitmap_sdf_renderer_class): New structures.
* src/sdf/ftsdfcommon.h (DEFAULT_SPREAD, MIN_SPREAD_MAX_SPREAD,
USE_SQUARED_DISTANCES): New macros.
(FT_INT_26D6, FT_INT_16D16, FT_26D6_16D16): New macros.
(FT_CALL, VECTOR_LENGTH_16D16): New macros.
(FT_26D6_Vec, FT_16D16_Vec, FT_16D16, FT_26D6, FT_6D10, FT_CBox):
New typedefs.
(square_root): New macro.
* src/sdf/ftsdferrs.h: Add module error setup.
2020-08-16 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Add files for new 'sdf' module.
Here is a breakdown of what the files will contain.
* src/sdf/ftsdfrend.c, src/sdf/ftsdfrend.h: The 'sdf' and 'bsdf'
renderers.
* src/sdf/ftsdf.c, src/sdf/ftsdf.h: The rasterizer for the 'sdf'
renderer.
* src/sdf/ftbsdf.c, src/sdf/ftbsdf.h: The rasterizer for the 'bsdf'
renderer.
* src/sdf/ftsdfcommon.h: Commmon properties and functions for both
rasterizers.
* src/sdf/ftsdferrs.h: Common error defines.
* src/sdf/sdf.c: For building a single object of the entire module.
2020-08-16 Anuj Verma <anujv@iitbhilai.ac.in>
[base] Allow renderers of different formats.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the
glyph's slot format is `FT_GLYPH_FORMAT_BITMAP`. The forthcoming
'bsdf' renderer will require bitmaps for processing.
* src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove
renderer's glyph format check before adding and removing them. The
'bsdf' renderer will have a format `FT_GLYPH_FORMAT_BITMAP`.
2020-08-16 Anuj Verma <anujv@iitbhilai.ac.in>
Add data types required for the forthcoming 'sdf' module.
* include/freetype/freetype.h (FT_Render_Mode): Add new render mode
`FT_RENDER_MODE_SDF`, which will be used to generate SDF.
* include/freetype/ftimage.h (FT_Pixel_Mode): Add new pixel mode
`FT_PIXEL_MODE_GRAY16`, which will be the output of the 'sdf'
module.
(FT_RASTER_FLAG_SDF): New raster flag to be used internally by the
'sdf' module.
* include/freetype/fttypes.h (FT_F6Dot10): New data type.
2020-08-16 Anuj Verma <anujv@iitbhilai.ac.in>
[base] Allow renderers of different formats.
* src/base/ftobjs.c (FT_Render_Glyph_Internal): Do not return if the
glyph's slot format is `FT_GLYPH_FORMAT_BITMAP`. The forthcoming
'bsdf' renderer will require bitmaps for processing.
* src/base/ftobjs.c (ft_add_renderer, ft_remove_renderer): Remove
renderer's glyph format check before adding and removing them. The
'bsdf' renderer will have a format `FT_GLYPH_FORMAT_BITMAP`.
2020-12-23 Werner Lemberg <wl@gnu.org>
* builds/windows/detect.mk (COPY): Make it work with `shell`.
Without this patch, we get the error
builds/toplevel.mk:127: *** missing separator. Stop.
Reported by Anuj, with a solution from Alexei.
2020-12-23 Ignacio Casal Quinteiro <qignacio@amazon.com>
* meson.build (ft2_defines): Fix builds on Windows.
2020-12-18 Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
[autofit] Fix double division in stem darkening.
The old code used to divide the darkening amount by em_ratio twice,
leading to unnecessarily bold stems on certain fonts with higher
units per em (e.g. Inter). This patch fixes it.
The return value of af_loader_compute_darkening was also changed to
use 16.16 fixed point to get rid of a redundant truncation operation.
This should slightly improve the precision, although it's still
bottlenecked by the emboldening function, which uses 26.6 fixed point.
* src/autofit/afloader.[ch]
(af_loader_compute_darkening): Return FT_Fixed.
(af_loader_embolden_glyph_in_slot): Revise calculations.
2020-12-17 Alexei Podtelezhnikov <apodtele@gmail.com>
* include/freetype/ftmodapi.h (FT_FACE_DRIVER_NAME): New public macro.
The driver name is needed for `FT_Property_Set' and `FT_Property_Get'.
2020-12-16 Chris Liddell <chris.liddell@artifex.com>
[truetype] Fix incremental metrics (#59503).
* src/truetype/ttgload.c (tt_get_metrics, load_truetype_glyph):
Previously, the code would populate the phantom points before
calling the `get_glyph_metrics` callback. For formats like PCL XL
format 1, class 2 downloaded fonts (where metrics are removed from
the TTF header), this causes problems when the hinting program uses
the phantom points (misplaced and distorted glyphs) due to the
metrics being unset (all zeros).
(tt_get_metrics_incr_overrides): Renamed to...
(tt_get_metrics_incremental): ... this. Updated caller
* include/freetype/ftincrem.h: Update the documentation to make it
clearer that `get_glyph_metrics` is to retrieve metrics from a
non-standard source, but *not* for the purpose of imposing custom
metrics.
2020-12-14 Werner Lemberg <wl@gnu.org>
[type42] Pacify static analysis tools (#59682).
* src/type42/t42objs.c (T42_Size_Init, T42_GlyphSlot_Init): Avoid
warnings about uninitialized variables.
2020-12-07 Werner Lemberg <wl@gnu.org>
* builds/unix/configure.raw: Don't set `FT_DEBUG_LOGGING`.
All debug options are handled exclusively in `ftoption.h`.
2020-12-07 Werner Lemberg <wl@gnu.org>
* src/*: More fixes for using a '\n' in `FT_TRACE` and `FT_ERROR`.
2020-12-07 Werner Lemberg <wl@gnu.org>
*/*: s/FT_LOGGING/FT_DEBUG_LOGGING/.
2020-12-05 Werner Lemberg <wl@gnu.org>
* builds/toplevel.mk (do-dist): Remove `submodules` directory.
2020-12-02 Werner Lemberg <wl@gnu.org>
* src/*: Don't use more than one '\n' in `FT_TRACE` and `FT_ERROR`.
This ensures good logging output, with all lines having a proper
prefix (if requested).
2020-12-02 Werner Lemberg <wl@gnu.org>
[base] Don't close 'stderr' after logging.
* src/base/ftdebug.c, builds/windows/ftdebug.c (ft_logging_deinit):
Fix it.
2020-12-02 Werner Lemberg <wl@gnu.org>
* submodules/dlg: Updated to commit 9f0c8b22.
2020-12-02 Werner Lemberg <wl@gnu.org>
* src/bdf/bdflib.c: Fix `-Wformat` warning.
2020-12-02 Werner Lemberg <wl@gnu.org>
Improve setup for 'dlg' library.
* autogen.sh (copy_submodule_file), builds/toplevel.mk: Redirect
stderr to `/dev/null`.
* builds/toplevel.mk: Move code block to handle 'dlg' stuff into
`check_platform` conditional.
Also fix wildcard expressions for guarding `git submodule` commands.
Also make file copying work with non-Unix platforms (untested).
2020-12-01 Werner Lemberg <wl@gnu.org>
[build] Use gcc (and clang) in C99 mode.
Other compilers are unchanged.
* builds/compiler/gcc-dev.mk, builds/compiler/gcc.mk (ANSIFLAGS):
s/-ansi/-std=c99/.
* builds/freetype.mk (FT_CFLAGS): Remove `-std=c99`.
* builds/unix/configure.raw: Handle C99.
Remove no longer needed test for gcc 4.6 and earlier.
2020-12-01 Werner Lemberg <wl@gnu.org>
[dlg] Fix compiler warnings.
* src/dlg/dlgwrap.c: Duplicate some feature test macros from
`dlg.c`, which must come first before loading standard headers. For
example, `freetype.h` loads `stdio.h` if compiled in debug mode.
2020-12-01 Werner Lemberg <wl@gnu.org>
* src/type42/t42parse.c: Fix `-Wformat` warnings.
2020-12-01 Priyesh Kumar <priyeshkkumar@gmail.com>
[builds/unix] Check for 'pthread' library.
* builds/unix/ax_pthread.m4: New file, taken from 'autoconf-archive'
git repository.
* builds/unix/configure.raw: Check for 'pthread'; also check whether
it works.
2020-12-01 Werner Lemberg <wl@gnu.org>
[base] Implement vertical alignment of log printing.
Based on a patch by Priyesh.
* include/freetype/internal/fttrace.h (FT_MAX_TRACE_LEVEL_LENGTH):
New macro.
* src/base/ftdebug.c, builds/windows/ftdebug.c (ft_log_handler):
Print logs after a fixed width to handle different lengths of
`FT_COMPONENT` entries.
Use `ft_strrchr` to check for final newline character.
2020-11-30 Priyesh Kumar <priyeshkkumar@gmail.com>
Update logging related documentation.
* docs/DEBUG: Updates related to `FT_LOGGING`.
* README.git: Updates related to logging.
2020-11-30 Priyesh Kumar <priyeshkkumar@gmail.com>
* src/*: Fix `-Wformat` warnings.
2020-11-30 Priyesh Kumar <priyeshkkumar@gmail.com>
[builds/windows] Changes to build 'dlg' with FreeType on Windows.
We only support Visual C++ 2010 and newer.
* builds/windows/vc2010/script.bat: New windows batch file to copy
necessary 'dlg' files from `submodules/dlg` to `src/dlg`. This file
is used as a pre-built event in Visual C++.
* builds/windows/ftdebug.c: Synchronize with `src/base/ftdebug.c`.
* builds/windows/vc2010/freetype.vcxproj.filters: Add
`src/dlgwrap.c`.
* builds/windows/vc2010/freetype.vcxproj
(AdditionalIncludeDirectories): Add include files of dlg for 'Debug'
and 'Debug Static' configurations on both 'x64' and 'win32'
platforms.
(PreprocessorDefinitions): Add `FT_LOGGING` for 'Debug' and 'Debug
Static' configurations on both 'x64' and 'win32' platforms.
Add `DLG_STATIC' for 'Debug' configuration on 'x64' and 'win32'
platforms.
(DisableLanguageExtensions): We need to disable the `/Za` option
when building 'dlg' with FreeType as 'dlg' strictly follows the C99
standard. Visual C++ produces behaves unexpectedly when
compiling a C99 file with `/Za` option enabled.
2020-11-30 Priyesh Kumar <priyeshkkumar@gmail.com>
[base] Add public API to change log handling function.
* include/freetype/ftlogging.h (FT_Custom_Log_Handler): New function
typedef to store the custom callback logging function.
(FT_Set_Log_Handler, FT_Set_Default_Log_Handler): New functions to
set and reset custom log handler.
* include/freetype/internal/ftdebug.h (custom_output_handler): New
variable to support a custom callback logging function.
(FT_Logging_Callback): A new function typedef to print log using
custom callback logging function, which is set using
`FT_Set_Log_Handler`.
(FT_Log): Use it.
* src/base/ftdebug.c (FT_Set_Log_Handler,
FT_Set_Default_Log_Handler, FT_Logging_Callback): Add function
definitions.
2020-11-28 Priyesh Kumar <priyeshkkumar@gmail.com>
[base] Add public API to change the levels of tracing components.
* include/freetype/ftlogging.h: New header file.
* include/freetype/internal/ftdebug.h [FT_LOGGING]: Include
`ftlogging.h`.
* src/base/ftdebug.c (ft_custom_trace_level): New variable.
(ft_debug_init): Update to support change of levels of tracing
components of FreeType at run-time.
(FT_Trace_Set_Level): New function to change the levels of tracing
components at run-time.
(FT_Trace_Set_Default_Level): New function to reset the levels of
tracing components back to default.
2020-11-28 Priyesh Kumar <priyeshkkumar@gmail.com>
[base] Updates to print timestamp and name of `FT_COMPONENT` in logs.
* include/freetype/internal/ftdebug.h (FT_LOGGING_TAG,
FT_LOGGING_TAG_): New macros to resolve the value of `FT_COMPONENT'
into a string.
(ft_add_tag, ft_remove_tag): New functions to add and remove dlg tags.
* src/base/ftdebug.c: Add new variables to control the logging of
timestamp and name of `FT_COMPONENT` along with actual logs.
(ft_add_tag, ft_remove_tag): Add function definitions.
(ft_log_handler): Updates to print timestamp and name of
`FT_COMPONENT`.
(ft_debug_init) [FT_LOGGING]: Users can now control the logging of
timestamp and name of `FT_COMPONENT` by adding tags in the
`FT2_DEBUG` environment variable.
2020-11-27 Priyesh Kumar <priyeshkkumar@gmail.com>
[base] Add functions and variables to print logs to a file.
* include/freetype/internal/ftdebug.h: Added dlg's header files.
(FT_LOG): New macro to redirect trace logs to dlg's API's whenever
`FT_LOGGING' is defined.
(ft_logging_init, ft_logging_deinit): New functions to handle
initialization and uninitialization of logging related variables.
(ft_log_handler): New function to handle logs of FreeType.
* src/base/ftdebug.c: Add necessary logging related variables.
(ft_logging_init, ft_logging_deinit, ft_log_handler): Add function
definitions.
* src/base/ftinit.c (FT_Init_FreeType) [FT_LOGGING]: Call
`ft_logging_init`.
(FT_Done_FreeType) [FT_LOGGING]: Call `ft_logging_deinit`.
* src/base/ftobjs.c (FT_New_Library): Call `ft_debug_init` only if
`FT_LOGGING` is not defined.
2020-11-27 Priyesh Kumar <priyeshkkumar@gmail.com>
[builds] Necessary changes to make 'dlg' compile.
* autogen.sh (copy_submodule_files): New script to copy all the
necessary source and include files from `submodules/dlg` to
`src/dlg`.
* src/dlg/dlgwrap.c: New wrapper file for `src/dlg.c`. It enables
the build of 'dlg' if the `FT_LOGGING` macro is defined.
* src/dlg/rules.mk: New sub-Makefile.
* builds/freetype.mk (DLG_DIR): New variable to include the
header files of the 'dlg' library.
(INCLUDES): Add `DLG_DIR`.
(FT_CFLAGS): Add `-std=c99' flag.
Include `src/dlg/rules.mk` file to build 'dlg' library.
(OBJ_S, OBJ_M): Add `DLG_OBJS_M` and `DLG_OBJS_S`.
* builds/toplevel.mk: For builds directly from the git repository
we need to copy files from `submodule/dlg` to `src/dlg`.
* include/freetype/config/ftoption.h, devel/ftoption.h (FT_LOGGING):
New macro to enable or disable the logging facility in FreeType.
2020-11-27 Priyesh Kumar <priyeshkkumar@gmail.com>
* .gitmodules: Add 'dlg' library's git repository as submodule.
2020-12-01 Werner Lemberg <wl@gnu.org>
* src/tools/chktrcmp.py (trace_use_pat): Update to current use.
2020-11-20 Alexei Podtelezhnikov <apodtele@gmail.com>
[cff,cid,type1] Demote old engine for lack of CFF2.
* src/cff/cffobjs.c (cff_driver_init): Always default to Adobe engine.
* src/cid/cidobjs.c (cid_driver_init): Ditto.
* src/type1/t1objs.c (T1_Driver_Init): Ditto.
2020-11-09 Werner Lemberg <wl@gnu.org>
* src/type42/t42parse.c (t42_parse_sfnts): More tracing messages.
2020-11-04 Werner Lemberg <wl@gnu.org>
* meson.build: Fix .pc file generation.
For backwards compatibility we need the libtool version, not the .so
number.
Reported by Nikolaus.
2020-10-28 Werner Lemberg <wl@gnu.org>
[truetype] Minor update to forthcoming OpenType 1.8.4 standard.
* src/truetype/ttgxvar.c (ft_var_load_item_variation_store): Limit
size of `regionCount`.
2020-10-26 Werner Lemberg <wl@gnu.org>
* meson.build: Fix 'harfbuzz' and 'brotli' build options (#59347).
Without this patch, 'harfbuzz' and 'brotli' are always required.
Patch submitted anonymously in Savannah bug report.
2020-10-23 Ben Wagner <bungeman@google.com>
* src/sfnt/pngshim.c (Load_SBit_Png): Fix memory leak (#59322).
The issue is that `rows` is allocated but will not be freed in the
event that the call to `png_read_image` fails and calls `longjmp`.
Files: