Commit Graph

7852 Commits

Author SHA1 Message Date
Craig White
cfce1acb14 Fill in more of the database, fix bug in binary search 2023-07-04 13:10:18 -04:00
Craig White
6650b9ebc7 Make find_unicode_charmap public and use it to choose the best charmap for building the reverse character map 2023-06-28 21:03:22 -04:00
Craig White
37e3e348b5 * Make reverse charmap lookup a binary search
* Style fixes
2023-06-25 23:43:23 -04:00
Craig White
62378cca3a * Add trace output
* Remove assumption of exactly 2 contours
* Adjustment database lookups use binary search now
2023-06-25 23:24:02 -04:00
Craig White
f8e996bfb1 Prototype adjustment database, reverse character lookup, and fixes for a few characters 2023-06-04 15:31:13 -04:00
Werner Lemberg
80a507a6b8 Replace sprintf with snprintf.
Fixes #1233.

* include/freetype/config/ftstdlib.h (ft_sprintf): Replace with...
(ft_snprintf): This new macro.

* src/autofit/afhints.c (af_print_idx): Add argument to pass the buffer
size.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edges): Updated.

* src/bdf/bdflib.c (BUFSIZE): New macro.
(bdf_parse_properties_, bdf_parse_start_): Use `ft_snprintf`.

* src/tools/ftrandom/ftrandom.c (do_test): Use `snprintf`.
2023-05-23 13:18:01 +02:00
Werner Lemberg
66cc4619d2 docs/DEBUG: Formatting. 2023-05-23 12:54:48 +02:00
suzuki toshiya
562f348192 [doc] Type1 GX (sfnt-wrapped Type1) is not supported.
* docs/formats.txt: Clarify the reference of Type1 GX,
and state that this format is not supported.  This
is because the content `TYP1' table is not exactly same
with the Type1 font format specification; no eexec
encryption is used.  For detail and concrete examples,
see the analysis on:

https://gitlab.freedesktop.org/freetype/freetype/-/issues/1231
2023-05-20 12:52:25 +00:00
Craig White
2342a03a9d Add missing end quote of a string in the example code of FT_Trace_Set_Level 2023-05-19 14:11:57 -04:00
Seigo Nonaka
115e927540 [truetype] Reduce heap allocation of deltaSet variation data.
`deltaSet` is an array of packed integers that can be 32 bits, 16 bits, or
8 bits.  Before this change, these values were unpacked to 32-bit integers.
However, this can cause big heap allocations, e.g., around 500 KByte for
'NotoSansCJK'.  To reduce this amount, store the packed integers and unpack
them just before passing to the calculation.  At calculation time, due to
the variable length of region indices, temporary heap allocations are
necessary.  This heap allocation is not negligible and visible in `ftbench`
results.  So, use stack-allocated arrays for short array calculations.

Fixes #1230.

* include/freetype/internal/ftmmtypes.h (GX_ItemVarDataRec): New fields
`wordDeltaCount` and `longWords`.

* src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Load packed
data.
(tt_var_get_item_delta): Unpack data before applying.
2023-05-19 06:50:28 +02:00
Jouk Jansen
99dadd56a4 vms_make.com: Create shared executable for x86 version of OpenVMS. 2023-05-17 12:40:59 +02:00
Werner Lemberg
416d4c25f1 Add new load flag FT_LOAD_NO_SVG.
Modern color fonts often contain both an 'SVG' and 'COLR' table.  FreeType
always preferred 'SVG' over 'COLR' (this was a design decision), however,
this might not be the right choice for the user.  The new flags makes
FreeType ignore the 'SVG' table while loading a glyph.

Fixes #1229.

* include/freetype/freetype.h (FT_LOAD_NO_SVG): New macro.

* src/base/ftobjs.c (FT_Load_Glyph), src/cff/cffgload.c (cff_slot_load),
src/truetype/ttgload.c (TT_Load_Glyph): Use it.
2023-05-15 16:04:15 +02:00
Werner Lemberg
872a759b46 .mailmap: Updated. 2023-05-13 09:35:12 +02:00
Alexei Podtelezhnikov
e1a4e081aa [cache] Merge functions.
* src/cache/ftccache.c (FTC_Cache_Init): Merge into...
(ftc_cache_done): ... this function, with unnecessary checks removed.
2023-05-12 22:27:08 -04:00
Alexei Podtelezhnikov
771ff8bd03 [cache] Minor casting and cosmetic updates.
* src/cache/ftcglyph.c (ftc_gcache_{init,done}): Remove casting.
(FTC_GCache_Lookup): Cosmetic variable renaming.
* src/cache/ftcsbits.c (ftc_snode_compare): Formatting.
2023-05-12 22:21:47 -04:00
Werner Lemberg
3af4772d68 * include/freetype/ftcache.h: Typo, punctuation. 2023-05-12 05:59:00 +02:00
Alexei Podtelezhnikov
b07ab47b2a * include/freetype/ftcache.h: Formatted and updated. 2023-05-11 23:23:52 -04:00
suzuki toshiya
7132f5b0d1 * include/freetype/internal/t1types.h: Fix the indentation. 2023-05-12 09:49:58 +09:00
Alexei Podtelezhnikov
ad708d70c9 [cache] Revise the dynamic hash table accounting.
Instead of counting entries relative to the middle of the hash table,
this switches to the absolute counter with the full index range mask.
As a result, some calculations become a bit simpler.  The cache resizing
logic stays largely the same.

* src/cache/ftccache.h (FTC_NODE_TOP_FOR_HASH): Revised with new counter.
* src/cache/ftccache.c (ftc_get_top_node_for_hash): Ditto.
(ftc_cache_resize): Simplify reallocations and stop their zeroing.
(ftc_cache_init): Stop over-allocating but keep zeroing initially.
(FTC_Cache_Clear, FTC_Cache_RemoveFaceID): Updated accordingly.
2023-05-11 21:44:31 +00:00
suzuki toshiya
6ca0a9356f [t1cid] Set FT_FACE_FLAG_CID_KEYED.
* cidobjs.c (cid_face_init): Set FT_FACE_FLAG_CID_KEYED.

* cidriver.c (cid_get_is_cid): Comment about the case that
is_cid cannot guarantee the glyph collection specification.
2023-05-11 14:31:23 +00:00
Jouk Jansen
c3876354e5 * src/smooth/ftgrays.c (FT_SSE2): Don't define for VMS. 2023-05-09 07:15:53 +02:00
Werner Lemberg
e02a40a4f8 * src/cff/cffdrivr.c (cff_glyph_load): Fix guard for size.
This was forgotten to change in commit 2b54eba36b (in May 2004).

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58739
2023-05-08 20:12:26 +02:00
Werner Lemberg
5edd6d52b1 Minor compiler warning fixes.
* src/autofit/afcjk.c (af_cjk_get_standard_widths), src/autofit/aflatin.c
(af_latin_get_standard_widths): Use `FT_CALLBACK_DEF`.

* src/cff/cffparse.c (cff_parser_run): Initialize and fix allocation of `q`.
2023-05-08 07:22:59 +02:00
Werner Lemberg
bd37b84718 * src/psaux/t1cmap.c: Signature fixes. 2023-05-08 06:46:55 +02:00
Werner Lemberg
968fc281ac * src/bzip2/ftbzip2.c: Signature fixes. 2023-05-08 06:26:43 +02:00
Werner Lemberg
d52166ae9d [cache] Signature fixes.
* src/cache/ftcglyph.c, src/cache/ftcglyph.h (FTC_GNode_Compare): Remove
redundant function.  It is equivalent to `ftc_gnode_compare` and becomes
completely meaningless with fixed signatures.
Update all callers.

* src/cache/ftcsbits.c, src/cache/ftcsbits.h (FTC_SNode_Compare): Remove
redundant function.  It is equivalent to `ftc_snode_compare` and becomes
completely meaningless with fixed signatures.
Update all callers.
2023-05-08 06:21:16 +02:00
Werner Lemberg
c8ae37bab3 [sdf] Signature fixes. 2023-05-07 21:06:14 +02:00
Werner Lemberg
924329a9b0 * src/svg/ftsvg.c: Signature fixes. 2023-05-07 20:57:22 +02:00
Werner Lemberg
6e7b1b7650 [raster] Signature fixes. 2023-05-07 20:51:32 +02:00
Werner Lemberg
02283a6e99 [smooth] Signature fixes. 2023-05-07 20:44:20 +02:00
Werner Lemberg
669b7f7d6b [pshinter] Signature fixes.
* src/pshinter/pshrec.c (t1_hints_close, t1_hints_apply): New wrapper
functions.
(t1_hints_funcs_init): Use them.
(t2_hints_close, t2_hints_apply): New wrapper functions.
(t2_hints_funcs_init): Use them.
2023-05-07 20:26:12 +02:00
Werner Lemberg
274e0dd5b5 [autofit] Signature fixes. 2023-05-07 19:54:46 +02:00
Werner Lemberg
365eb10dd4 * src/sfnt/ttcmap: Signature fixes. 2023-05-07 19:16:38 +02:00
Werner Lemberg
60c11919e0 * src/pcf/pcfdrivr.c: Signature fix. 2023-05-07 16:42:01 +02:00
Werner Lemberg
5f7a26fd31 * src/winfonts/winfnt.c: Signature fixes. 2023-05-07 16:30:21 +02:00
Werner Lemberg
394c4de988 * src/type42/t42parse.c: Signature fixes. 2023-05-07 16:25:37 +02:00
Werner Lemberg
19aca9666e [pfr] Signature fixes. 2023-05-07 15:57:06 +02:00
Werner Lemberg
3297a7a9e0 * src/cid/cidload.c: Signature fixes. 2023-05-07 15:23:46 +02:00
Werner Lemberg
4a28ff3db8 * src/cff/cffcmap.c: Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg
563f401127 * src/type1/t1load.c: Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg
95d635eab1 [truetype] Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg
e05c056220 [base] Signature fixes. 2023-05-07 14:59:50 +02:00
Werner Lemberg
ff0ef828c9 * src/type42/t42drivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg
7cc5dfa297 * src/type1/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg
3a85bf0b3f * src/truetype/*: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg
e245951c43 * src/sfnt/sfdriver.c, src/sfnt/ttbdf.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.

* src/sfnt/sfdriver.c (sfnt_load_table): New wrapper function.
(sfnt_service_sfnt_table): Use it.
2023-05-07 14:59:50 +02:00
Werner Lemberg
ceba488cf8 * src/psnames/psmodule.c: Use FT_CALLBACK_DEF. 2023-05-07 14:59:50 +02:00
Werner Lemberg
4360e20e31 * src/pfr/pfrdrivr.c: face -> pfrface, pfrface -> face. 2023-05-07 14:59:50 +02:00
Werner Lemberg
0685b0ad36 * src/pcf/pcfdrivr.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00
Werner Lemberg
b9ce8e33a7 * src/cid/cidriver.c: Clean up interface.
Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
2023-05-07 14:59:50 +02:00