-
674d629b
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-14T13:06:01-04:00
[smooth] Store persistent clipping box.
* src/smooth/ftgrays.c (gray_TWorker, gray_raster_render): Add and set
the new structure field.
(gray_convert_glyph): Use it.
-
fff58f54
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-14T15:12:31-04:00
* src/smooth/ftgrays.c (gray_convert_glyph): Refactor for convenience.
-
b3a6a20a
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-14T15:37:57-04:00
[smooth] Switch to vertical bisections.
With horizontal bisections, the smallest section is a whole single
scanline. Almost horizontal lines or other complex scanlines can
easily overflow the rendering pool. Switching to vertical bisections
splits the scanlines and should rule out the overflows. Fixes #1269.
* src/smooth/ftgrays.c (gray_convert_glyph): Bisect vertically.
-
d091bca5
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-17T00:33:14-04:00
[cache] Fix error handling.
Manipulate the cache after a face is requested or a size is looked up
successfully. Fixes #1270.
* src/cache/ftcmanag.c (ftc_size_node_init, ftc_size_node_reset,
ftc_face_node_init): Check for errors before accepting a change.
* src/cache/ftcmru.c (FTC_MruList_New): Do nothing if reset fails.
-
12adfc21
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-17T15:07:23+00:00
[cache] Improve MRU list management.
* src/cache/ftcmru.c (FTC_MruList_Remove): Cosmetic.
(FTC_MruList_New): Accept only valid changes.
* src/cache/ftcmanag.c (ftc_size_node_done): Simplify.
-
db83e9c0
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-18T23:23:13-04:00
* src/cache/ftcglyph.c [!FTC_INLINE]: Fix compilation.
-
dbdcd758
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-19T14:02:43-04:00
[cache] Tweak headers.
* src/cache/ftccback.h: Include less and move `ftc_node_destroy`...
* src/cache/ftccache.h: ... to here.
* src/cache/ftcmanag.c: Include less.
-
9a2d6d97
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-19T14:45:39-04:00
* src/cache/{ftcbasic.c,ftccmap.c}: Use FTC_INLINE.
-
23e1d645
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-20T12:01:58-04:00
[cache] Reduce type mismatches.
* src/cache/ftcbasic.c (FTC_BasicAttrRec): Match type of `load_flags`
to its main purpose in `FT_Load_Glyph`.
(FTC_ImageCache_Lookup{,Scaler},FTC_SBitCache_Lookup{,Scaler}): Updated.
-
5a3bfa92
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-20T23:28:17-04:00
* src/cache/ftcbasic.c: Cosmetic harmonization.
-
982bc838
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-21T15:53:05-04:00
[cache] Minor tweaks.
* src/cache/ftcimage.c (ftc_inode_free): Remove unnecessary check.
* src/cache/ftcmanag.c (FTC_Manager_Done): Do not zero before freeing.
-
ec46a50d
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-22T21:21:12-04:00
Improve SDF documentation.
-
e2bcca40
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-22T22:43:41-04:00
* include/freetype/ftdriver.h: s/truncated/clamped/.
-
4e079f63
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-27T20:07:36-04:00
Document the SDF spread further.
-
1168b1b5
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-27T20:44:01-04:00
* src/cache/ftcimage.c (ftc_inode_weight): Formatting.
-
f8f0d1a1
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-29T16:58:59-04:00
* src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.
Resetting of the size nodes can crash, if a parent face purge happens
simultaneously and destroys the node. It is safer to create a new node.
Fixes #1270, reopened with a separate issue.
-
a209e1ad
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-29T17:54:30-04:00
[cache] Remove unused `node_reset`.
* src/cache/ftcmru.h (FTC_MruListClassRec): Remove `node_reset` field.
* src/cache/ftcbasic.c (ftc_basic_{image,sbit}_family_class): Ditto.
* src/cache/ftcmanag.c (ftc_face_list_class): Ditto.
(ftc_size_node_reset): Remove function.
* src/cache/ftcglyph.h: Fix comment.
-
5962d3c1
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-29T22:34:09-04:00
* src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Remove nodes instantly.
-
2c9691e7
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-30T12:59:52+00:00
* docs/CHANGES: Updated.
-
13da9042
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-01T00:34:21-04:00
* src/sfnt/sfwoff2.c (compute_ULong_sum): Clean up.
-
4d504684
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-01T23:19:31-04:00
[sfnt] Use faster macros in checksums.
* src/truetype/ttobjs.c (tt_synth_sfnt_checksum): Use FT_NEXT_XXX.
* src/sfnt/sfwoff2.c (compute_ULong_sum): Use macros.
-
13d1180f
by Ben Wagner at 2024-05-02T15:00:27-04:00
[woff2] Disallow zero table font entries
The existing code already disallows zero table woff2 overall, but still
allows for individual CollectionFontEntry to create font instances with
zero tables. Such fonts are not useful so error early.
This also fixes an MSAN discovered issue where if a CollectionFontEntry
numTables is zero then the sfnt_header was not fully initialized.
* src/sfnt/sfwoff2.c (woff2_open_font): error on zero tables, always
initalize sfnt_header
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68384
-
3f28a6b6
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-03T15:44:57+00:00
[woff,woff2] Limit the number of tables and use FT_MSB.
The upper limit of 4095 is implied by the SFNT header format
where the multiplication by 16 would overflow without it.
* src/sfnt/sfwoff.c (woff_open_font): Updated.
* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
-
7bd887f1
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-03T16:04:35+00:00
* src/sfnt/sfwoff2.c (woff2_open_font): Fix copy-paste typo.
-
2edfd7e1
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-04T16:42:47-04:00
* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Remove FT_ABS.
See
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68679
-
d0e3239f
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-06T13:39:06+00:00
[sdf, bsdf] Use shared FT_SqrtFixed.
FT_SqrtFixed (95b0fe2a6dff) is faster and does not overflow.
* src/sdf/ftsdfcommin.h (square_root): Replace with a macro.
* src/sdf/ftsdfcommin.c (square_root): Remove function.
-
2240e21c
by Werner Lemberg at 2024-05-06T21:53:24+02:00
.mailmap: Fix entry for Ben Wagner.
-
5858fa16
by Ben Wagner at 2024-05-08T05:01:16+02:00
[colr] Avoid overflow in range checks
In 32 bit builds `FT_ULong` is 32 bits and can silently overflow when a
large number is read into one and then it is summed or multiplied with
another number. Checks for range overflow must be written so that they
themselves do not overflow. Also ensure that the table_size is always the
first part of the range check and consistently use `<` or `<=`.
* src/sfnt/ttcolr.c (tt_face_load_colr): Avoid overflow.
(find_base_glyph_v1_record): Remove old work-around.
Bug: https://issues.chromium.org/issues/41495455
Bug: https://issues.chromium.org/issues/40945818
-
1264b84c
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-07T23:35:59-04:00
* include/freetype/internal/psaux.h: Fix g++ warning.
Reported by Hin-Tak Leung.
-
a4642422
by Ben Wagner at 2024-05-08T11:36:18-04:00
[psaux] Fix location and type order in initializer
`T1_FIELD_ZERO` is used to zero initialize a `T1_FieldRec`.
`T1_FIELD_ZERO` is currently initilizing `T1_FieldRec::location` with a
`T1_FieldType` and `T1_FieldRec::type` with a `T1_FieldLocation`. This
was detected with `-Wenum-conversion`.
* include/freetype/internal/psaux.h (T1_FIELD_ZERO): correct order of
initalizers
-
b875924a
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-10T23:01:23-04:00
* src/pshinter/pshrec.c (ps_hints_stem): Correct argument.
-
4a85db7e
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-11T22:19:25-04:00
[type1/MM] Tighten headers.
* include/freetype/internal/t1types.h: Host PS_DesignMap and PS_Blend.
* include/freetype/ftmm.h: Host and document TT_MAX_MM_XXX.
* include/freetype/t1tables.h: Remove them from here.
-
e834786b
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-11T23:25:37-04:00
* docs/CHANGES: Mention the last commit.
-
5b1cde80
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-11T23:27:34-04:00
* src/type1/t1load.c (parse_blend_design_map): Add risky cast.
-
b8db8197
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-12T22:38:38-04:00
[type1/MM] Safer handle arrays of different types.
* src/type1/t1load.c (parse_blend_design_map): Separately allocate...
(T1_Done_Blend): ... and free `design_points` and `blend_points`.
-
68399b42
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-13T16:57:35+00:00
* include/freetype/ftmm.h: Include `freetype.h`.
Reported by Ben Wagner, see !326.
-
cdd3572e
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-17T22:25:00-04:00
* builds/windows/ftsystem.c: Use _WINRT_DLL to check for UWP.
Fixes compilation using Windows GDK, reported by Erin Melucci.
-
d7cf931a
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-19T22:48:13-04:00
[truetype, type1] Use FT_DUP to duplicate data.
* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use concise FT_DUP.
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Ditto.
* src/type1/t1load.c (parse_subrs): Ditto.
-
026fd5d4
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-19T22:54:57-04:00
[cache] Use FT_DUP to duplicate data.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Use concise FT_MEM_DUP.
-
b25265fe
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-19T22:58:23-04:00
[bdf] Use concise macros.
* src/bdf/bdflib.c (bdf_create_property): Use FT_STRDUP.
(bdf_parse_glyphs_, bdf_parse_start_): Use FT_DUP for brevity.
-
4ccdc9f9
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-20T18:53:57-04:00
[cff] Optimize the blend vector computations.
* src/cff/cffload.c (cff_blend_build_vector): Use FT_MulDiv and skip
multiplying by 1.
-
39f2fbf8
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-20T22:47:14-04:00
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Minor refactoring.
-
347276c1
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-21T13:12:45+00:00
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Align with specs.
-
99be2b31
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-21T18:26:09+00:00
[cff, truetype] Rearrange variation range checks.
This should achieve quicker results for common cases.
* src/cff/cffload.c (cff_blend_build_vector): Rearrange conditionals.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto.
-
5f131cfd
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-21T16:24:43-04:00
[cff, truetype] Validate variation axes immediately.
Instead of validating variation axes in every access, OpenType specs
suggest that peak = 0 be used to tag invalid ranges. This implements
just that once during loading.
* src/cff/cffload.c (cff_blend_build_vector): Move the range checks...
(cff_vstore_load): ... here.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): Ditto...
(tt_var_load_item_variation_store): ... ditto.
-
42d406ab
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-22T21:08:34-04:00
* include/freetype/internal/ftmemory.h (FT_MEM_DUP): Fix g++ error.
-
a4988736
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-23T03:05:59+00:00
* .gitlab-ci.yml: Disable UWP compilation.
-
9ff4153c
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-22T23:38:34-04:00
[truetype] Reduce allocation scope.
* src/truetype/ttgxvar.c (TT_Vary_Apply_Glyph_Deltas): Reduce scope
of `points_org` and 'points_out`.
-
70299c92
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-23T22:50:32-04:00
Revert "[truetype] Reduce allocation scope."
This reverts commit 9ff4153cbfd60491f11bb56905ce6e20e94d23c7.
-
b6dbbd96
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-24T17:38:14+00:00
* src/truetype/ttgxvar.c (ft_var_apply_tuple): Reduce checks.
-
3416ac16
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-26T08:10:21-04:00
Whitespace.
-
7ff43d3e
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-26T19:40:20-04:00
[truetype/GX] Consolidate memory allocations.
* src/truetype/ttgxvar.c (tt_face_vary_cvt, TT_Vary_Apply_Glyph_Deltas):
Allocate and split bigger memory blocks, avoid unnecessary zeroing,
do not copy shared tuples, revise error exit paths.
-
d41a855a
by Ben Wagner at 2024-05-29T17:01:29-04:00
[ttgxvar] Replace tabs with spaces
Also clarify comments around conversion and clamping.
* src/truetype/ttgxvar.c (ft_var_to_normalized): doit
-
deba7feb
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-18T14:01:58+00:00
* include/freetype/ftimage.h: Explain standard types.
-
93a067e3
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-18T17:48:41+00:00
[base, autofit, psaux] Remove unnecessary casting.
* src/autofit/afhints.c (af_glyph_hints_reload): Remove (short) casting.
* src/base/ftgloadr.c (FT_GlyphLoader_Add): Ditto.
* src/psaux/psobjs.c ({t1,cff,ps}_builder_{add,close}_contour): Ditto.
-
7a753c96
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-18T21:14:58-04:00
* src/base/ftgloadr.c (FT_GlyphLoader_Prepare): Minor refactoring.
-
2b9fdec5
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-19T21:38:58-04:00
* src/pfr/pfrgload.c (pfr_glyph_curve_to): Avoid casting.
-
2a7bb459
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-20T20:49:56-04:00
Use unsigned point and contour indexing in `FT_Outline`.
This doubles the number or allowed points, see
https://github.com/harfbuzz/harfbuzz/issues/4752
Although it is hardly practical to use more than 32767 points,
other font engines seem to support it.
* docs/CHANGES: Announce it.
* include/freetype/ftimage.h (FT_Outline): Do it and update limits.
* src/*: Update `FT_Outline` users.
-
b1cbcb20
by Ben Wagner at 2024-06-21T01:41:40+00:00
[ttgxvar] Avoid "applying zero offset to null pointer"
In C it is undefined behavior to do arithmetic on a null pointer, including
adding zero. When using NotoSansKhmer[wdth,wght].ttf UBSAN produces a report
like
ttgxvar.c:1052:31: runtime error: applying zero offset to null pointer
when adding zero to `varData->deltaSet` (which is null) to produce `bytes`.
Protect against all the potential issues of this kind by returning early if
`varData->regionIdxCount == 0`.
* src/truetype/ttgxvar.c (tt_var_get_item_delta): early return on no regions
-
044d142b
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-20T22:16:51-04:00
Use unsigned tags `FT_Outline`.
This change comes along with 2a7bb4596f56 ans is only meant to reduce
pointer casting in the code.
* include/freetype/ftimage.h (FT_Outline): Do it.
* src/*: Update `FT_Outline` users.
-
73720c7c
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-06-23T10:58:00-04:00
* src/truetype/ttgload.c (load_truetype_glyph): Unsigned fix.
-
bab9564a
by Werner Lemberg at 2024-06-26T05:41:36+02:00
Make 'multi' build work again.
* src/psaux/psobjs.c: Include `psft.h`.
* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttgpos.c`.
Fixes issue #1284.
-
22803461
by Don Olmstead at 2024-06-28T17:46:15-07:00
CMakeLists.txt: Respect FT_DISABLE_ZLIB value
The CMake build uses `find_package` to look for dependencies. Before calling `find_package` it looks to see if the dependency was disabled. If not the associated `_FOUND` variable will be set. This value is then checked to determine if the dependency is added.
However `find_package(PNG)` calls `find_package(ZLIB)` within its find module. So in the case of `FT_DISABLE_ZLIB=TRUE` and `FT_DISABLE_PNG=FALSE` the `ZLIB_FOUND` value can be set and even though `FT_DISABLE_ZLIB` is turned on.
Unset the value of `ZLIB_FOUND` after the call to `find_package(PNG)` so the value is only set when `FT_DISABLE_ZLIB` is turned off.
-
37cefe33
by Philip Race at 2024-06-29T05:17:14+02:00
* psobjs.c (ps_table_add): Check length before calling `FT_MEM_CPY`.
Fixes issue #1280.
-
efa555bf
by Craig White at 2024-07-18T09:48:43+02:00
[base] Make `find_unicode_charmap` a base function.
This is needed for forthcoming changes in the auto-hinter.
* include/freetype/internal/ftobjs.h, src/base/ftobjs.c: Updated.
-
fe317007
by Craig White at 2024-07-18T09:48:43+02:00
[autofit] Add adjustment database.
* src/autofit/afadjust.c, src/autofit/afadjust.h: New files.
* include/freetype/internal/fttrace.h: Add 'afadjust' component.
* src/autofit/autofit.c: Include `afadjust.c`.
* src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afadjust.c`.
-
c70b3d94
by Craig White at 2024-07-18T09:48:43+02:00
[autofit] Add code for reverse charmaps and adjustment database lookup.
* src/autofit/aftypes.h (AF_ReverseMapEntry, AF_ReverseCharacterMap): New
structures.
* src/autofit/afadjust.c (af_adjustment_database_lookup,
af_reverse_character_map_entry_compare, af_reverse_character_map_lookup,
af_lookup_vertical_separation_type, af_lookup_tilde_correction_type,
af_reverse_character_map_expand, af_reverse_character_map_new,
af_reverse_character_map_done): New functions.
* src/autofit/afadjust.c: Updated.
-
1e5e193a
by Craig White at 2024-07-18T09:48:43+02:00
[autofit] Implement vertical separation adjustment.
* src/autofit/aflatin.c: Include `afadjust.h`.
(af_latin_metrics_init): Call `af_reverse_character_map_new`.
(af_latin_metrics_done): New function.
(af_move_contour_vertically, af_check_contour_horizontal_overlap,
af_glyph_hints_apply_vertical_separation_adjustments): New functions.
(af_latin_hints_apply): Call
`af_glyph_hints_apply_vertical_separation_adjustments`.
(af_latin_writing_system_class): Updated.
* src/autofit/aftypes.h (AF_StyleMetricsRec): Add `reverse_charmap` field.
-
adf5129a
by Craig White at 2024-07-18T09:48:43+02:00
[autofit] Add tilde-unflattening algorithm.
* src/autofit/aflatin.c (af_find_highest_contour,
af_remove_segments_containing_point,
af_latin_remove_tilde_points_from_edges, af_latin_stretch_tildes,
af_latin_align_tildes): New functions.
(af_latin_hints_apply): Call tilde-unflatting code if necessary.
-
faae5501
by Craig White at 2024-07-18T09:48:43+02:00
[autofit] Add GSUB table handling to reverse character map generation.
If HarfBuzz is enabled, the reverse character map generation now considers
GSUB entries when looking for glyphs that correspond to a code point.
* src/autofit/afadjust.c (af_all_glyph_variants_helper,
af_all_glyph_variants) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New functions.
(af_reverse_character_map_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Call new
code.
-
6bc1ac48
by Werner Lemberg at 2024-07-18T09:50:33+02:00
* docs/CHANGES: Mention Craig's GSoC 2023 project.