Commit Graph

7520 Commits

Author SHA1 Message Date
suzuki toshiya bcdfa38692 [cmake] Drop the support of CMake 2.x.
* CMakeLists.txt: Require CMake 3.0 (released on 2014) or newer.

The issue #1059 reports the difficulty to support both of
CMake 2.x and newer one by single CMakeLists.txt without
the inflation of cmake_policy() workarounds.

For better maintainability, the support of CMake 2.x is
dropped.
2022-02-21 10:44:42 +09:00
Werner Lemberg 6c5522c6f8 * src/bdf/README: Updated. 2022-02-19 13:37:07 +01:00
Werner Lemberg ca46bc0cf2 * builds/mac/ftmac.c, src/base/ftmac.c: s|FT_MAC_H|<freetype/ftmac.h>|. 2022-02-19 13:36:25 +01:00
Werner Lemberg 5b26e92a0f src/sfnt/ttkern.c (tt_face_load_kern): Micro-optimize.
A kerning table can be handled by binary search if it has equal entries.

Fixes #1132.
2022-02-19 07:20:24 +01:00
Steve Lhomme 20ec99be7e [builds/windows] Add support for legacy UWP builds.
* builds/windows/ftsystem.c: Add neccessary macro substitutions to
enable strict UWP builds.

See !141.

Co-authored-by: Alexei Podtelezhnikov <apodtele@gmail.com>
2022-02-17 13:35:52 -05:00
Werner Lemberg 01d4deb061 ftmm.h: Minor documentation improvement. 2022-02-16 14:51:44 +01:00
Alexei Podtelezhnikov 00ae29fcd2 [pshinter] Tune PSH_STRONG_THRESHOLD_MAXIMUM value.
Before the change, the hinting engine frequently confused horizontal
stem and serif hints making some stems too thin and some serifs too
thick. The value was tuned using serif fonts from the URW+ base 35
collection.

* src/pshinter/pshalgo.c [PSH_STRONG_THRESHOLD_MAXIMUM]: s/30/12/.
2022-02-12 23:42:08 -05:00
Werner Lemberg 5a53e51b5c t1tables.h: Documentation improvements. 2022-02-12 07:58:43 +01:00
Werner Lemberg c67ecb8c3a t1tables.h: Whitespace. 2022-02-12 07:52:57 +01:00
Werner Lemberg 338b4e8846 [type42] Fix `FT_Get_PS_Font_Private` for this format.
Since Type42 fonts don't have a 'Private' dictionary, the return value
should be `FT_Err_Invalid_Argument`.

* src/type42/t42drivr.c (t42_ps_get_font_private): Removed.
(t42_service_ps_info): Updated.
2022-02-11 19:32:49 +01:00
Alexei Podtelezhnikov 1680885aa5 [pshinter] Clear reused mask.
In PS hinter, memory allocations persist until the module is done.
Therefore, we have to clear reused masks.

* src/pshinter/pshrec.c (ps_mask_table_alloc): Clear reused mask.
2022-02-09 16:41:07 +00:00
Alexei Podtelezhnikov 0447df71e7 [pshinter] Use unsigned indices.
This reduces casting and eliminates some checks.

* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_table_merge,
ps_dimension_add_t1stem, ps_hints_t1stem3): Updated.
(ps_dimension_add_counter): Updated, unnecessary checks removed.
2022-02-09 15:04:58 +00:00
Alexei Podtelezhnikov ed0e2e76d8 [pshinter] Fix mask merging.
We forgot to update the number of bits when merging a larger mask
into a smaller one.  This fix might have rendering effects.

* src/pshinter/pshrec.c (ps_mask_table_merge): Inherit the number
of bits from a larger mask. There is no need to zero unused bits,
already zeroed during allocation.
(ps_mask_clear_bit): Removed.
(ps_mask_ensure): Minor.
2022-02-08 16:35:14 -05:00
Alexei Podtelezhnikov 7c6b2f20b0 [pshinter] Revise the hint table handling.
* src/pshinter/pshrec.c (ps_hint_table_ensure): Remove redundant size
check; avoid array zeroing because it is fully initialized when used.
(ps_hint_table_alloc): Fix off-by-one comparison and remove another
zeroing of the array elements.
2022-02-08 14:37:34 +00:00
Werner Lemberg 24db55ecb8 Various minor doc fixes. 2022-02-06 21:06:52 +01:00
Alexei Podtelezhnikov a173aead31 [builds/windows] Add SVG to to project files.
* builds/windows/vc2010/freetype.vcxproj: Updated.
* builds/windows/vc2010/freetype.vcxproj.filters: Updated.
* builds/windows/visualc/freetype.vcproj: Updated.
2022-02-06 08:25:52 -05:00
Alexei Podtelezhnikov dd8676b277 * src/winfonts/winfnt.c (fnt_face_get_dll_font): Trace font resources. 2022-02-03 14:32:50 +00:00
Eric Jing 56d182a74d [cmake] Fix build on MacOS.
* CMakeLists.txt (CMAKE_OSX_ARCHITECTURES): Update value to fix the building
of a framework on MacOS.

* builds/mac/freetype-Info.plist (CFBundleExecutable): Make identifier
lowercase only.

Fixes #1127.
2022-02-02 18:15:28 +01:00
Alexei Podtelezhnikov 8e39e42ee9 [psaux] Revise `PS_Table` handling.
The old impleemntation was not using `FT_REALLOC`, buing too careful
with the offset rebasing.  It shoudl be safe to rely on the base
movements.

* src/psaux/psobjs.c (reallocate_t1_table, shift_elements): Combine
into...
(ps_table_realloc): ... this function based on `FT_REALLOC`.
(ps_table_done): Simplified.
(ps_table_add): Updated.
2022-02-02 11:35:14 -05:00
Alexei Podtelezhnikov c6dd509b99 * src/cache/ftcmru.c (FTC_MruList_New): Explain zeroing. 2022-02-02 11:32:58 -05:00
Alexei Podtelezhnikov 946e1353ea [cache] Partially revert 9870b6c07e.
Fix crashes reported by Werner.

* src/cache/ftcmru.c (FTC_MruList_New): Use `FT_ALLOC` again.
2022-01-31 14:19:07 +00:00
Werner Lemberg 36ee3160a0 freetype.h: Minor documentation improvement. 2022-01-31 10:37:56 +01:00
Alexei Podtelezhnikov 983d435865 [cache] Fix fallouts from edd4fedc54.
Reported by Werner.

* src/cache/ftcimage.c (FTC_INode_New): Always initialize FT_Glyph.
* src/cache/ftcsbits.c (FTC_SNode_New): Always initialize FT_SBit.
2022-01-30 22:13:51 -05:00
Alexei Podtelezhnikov bee8886408 Clean-up - do not doubt FT_FREE.
* src/base/ftobjs.c (memory_stream_close): Do not reassign zero
after `FT_FREE`.
* src/sfnt/sfwoff.c (sfnt_stream_close): Ditto.
* src/sfnt/sfwoff2.c (stream_close): Ditto.
* src/psaux/psobjs.c (ps_parser_load_field): Ditto.
* src/truetype/ttgxvar.c (ft_var_load_avar, tt_set_mm_blend,
tt_set_mm_blend): Ditto.
2022-01-30 21:55:21 -05:00
Werner Lemberg 7fd03a3e25 * CMakeLists.txt: Include 'FindPkgConfig' module.
Older cmake versions don't provide `pkg_check_modules` by default.

Fixes #1126.
2022-01-30 20:50:42 +01:00
Alexei Podtelezhnikov da877c8693 * src/psaux/psobjs.c (ps_parser_load_field): Reduce `string` scope. 2022-01-29 22:46:56 -05:00
suzuki toshiya 35740aa6a9 [cmake] Check the availability of `bzip2.pc'.
(CMakeLists.txt): Check the availability of `bzip2.pc'.

* If `bzip2.pc' is available, Requires.private should include
bzip2, but Libs.private should not include -lbz2.

* If `bzip2.pc' is unavailable, Requires.private cannot include
bzip2, but Libs.private should include -lbz2.

Fix #897.
2022-01-29 01:36:12 +00:00
Werner Lemberg fa226478b1 * unix/configure.raw: We need 'librsvg' version 2.46.0 or newer.
Older versions don't have function `rsvg_handle_get_intrinsic_dimensions`.
2022-01-28 15:20:12 +01:00
Alexei Podtelezhnikov b34741c1cc Minor clean-ups.
* src/base/ftrfork.c (raccess_make_file_name): Do not set error.
* src/sfnt/sfdriver.c (get_win_string, get_apple_string): Ditto.
* src/cff/cffobjs.c (cff_strcpy): Do not confuse about error.
* src/psaux/psobjs.c (ps_table_done): Ditto.
* src/truetype/ttgxvar.c (ft_var_readpacked*, ft_var_load_avar): Ditto.
2022-01-27 22:55:34 -05:00
Ben Wagner e34a860a07 Document `FT_Outline_Decompose` degenerate segments.
`FT_Outline_Decompose` does not filter out and can return degenerate
segments in an outline. This can be surprising when attemping to
stroke such an outline. Clarify the existing documentation on this
matter to cover all forms of degeneracy (without specifying exactly
how they will be reported), why they might arise, and better explain in
what cases they may be an issue.

* include/freetype/ftoutlin.h (FT_Outline_Decompose): update
documentation.

Fixes #952.
2022-01-27 21:49:47 +01:00
Anuj Verma ab1c98ac18 Fix sdf computation while `USE_SQUARED_DISTANCES`.
Function `map_fixed_to_sdf` expects spread to be absolute
and not squared.

* src/sdf/ftbsdf.c (finalize_sdf): Pass absolute spread
while `map_fixed_to_sdf`.

* src/sdf/ftsdf.c (sdf_generate_bounding_box): Ditto.
2022-01-27 18:01:08 +05:30
Tapish Ojha 3d77756e73 [sfnt] Improve sRGB constants.
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use slightly
more precise values.

Fixes #1018.
2022-01-27 08:43:19 +01:00
Werner Lemberg 9476cb7eb3 docs/release: Updated. 2022-01-27 08:32:42 +01:00
Alexei Podtelezhnikov 837f0345a9 * src/pfr/pfrload.c (pfr_phy_font_load): Use FT_QNEW_ARRAY. 2022-01-26 15:49:24 -05:00
Alexei Podtelezhnikov 0ac535900b * src/sdf/ftsdf.c (sdf_*_new): Use standard macro. 2022-01-26 14:02:27 -05:00
Alexei Podtelezhnikov 09223ef929 [pcf] Delay encoding allocation and avoid its zeroing.
* src/pcf/pcfread.c (pcf_get_encodings): Refactor and use FT_QNEW_ARRAY.
2022-01-26 11:23:38 -05:00
Werner Lemberg 267c6918d1 Aarg, typo. 2022-01-25 14:46:36 +01:00
Werner Lemberg 9af1127fbe freetype.h: More updates to `FT_LOAD_COLOR` description. 2022-01-25 14:45:10 +01:00
Werner Lemberg 8b7226bb43 * builds/unix/configure.raw (FT_DEMO_CFLAGS): Pass `-DHAVE-LIBRSVG`.
This helps in decoupling library support from `pkg-config` for other
platforms.
2022-01-25 14:28:45 +01:00
Werner Lemberg 6a8e95b7a0 Update documentation for `FT_LOAD_COLOR`. 2022-01-25 08:49:41 +01:00
Ben Wagner 5e9caaee78 [pshinter] Ensure all point flags are initialized.
Only off curve point flags were fully initialized.

* src/pshinter/pshalgo.c (psh_glyph_init): always initialize flags.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43930
2022-01-24 12:24:59 -05:00
Werner Lemberg 657745212b .mailmap: Typo. 2022-01-24 07:57:20 +01:00
Werner Lemberg ef48a33271 * src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers. 2022-01-23 19:05:15 +01:00
Werner Lemberg cddfe6574b .mailmap: Updated. 2022-01-23 12:37:48 +01:00
Werner Lemberg 21d0fa3742 More documentation on handling OT-SVG. 2022-01-23 12:23:47 +01:00
Werner Lemberg 9c1538525b * src/svg/ftsvg.c: Rename `svg_hooks` to `svg-hooks` for consistency. 2022-01-23 08:56:17 +01:00
Werner Lemberg 112527dd44 [sfnt] Reject malformed SVG tables.
* src/sfnt/ttsvg.c (SVG_TABLE_HEADER_SIZE, SVG_DOCUMENT_RECORD_SIZE,
SVG_DOCUMENT_LIST_MINIMUM_SIZE, SVG_MINIMUM_SIZE): New macros.
(tt_face_load_svg): Check offsets.
Check table and record sizes.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43918
2022-01-22 12:09:08 +01:00
Alexei Podtelezhnikov 706c79a1da * src/psaux/psobjs.c (ps_table_new): Revert to zeroing. 2022-01-21 22:46:35 -05:00
Alexei Podtelezhnikov 0d2b4952a3 [psaux, type1, type42] Avoid annecessary zeroing.
* src/psaux/psobjs.c (ps_table_new): Use FT_QNEW_ARRAY.
* src/type1/t1load.c (parse_encoding): Ditto.
* src/type42/t42parse.c (t42_parse_encoding): Ditto.
2022-01-20 14:47:01 -05:00
Werner Lemberg 02fa26f4cd [builds/unix] Handle 'librsvg' for demo programs.
* builds/unix/configure.raw: Check for 'librsvg'.
(LIB_CLOCK_GETTIME): Don't call `AC_SUBST` on this but on...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.

* builds/unix/unix-cc.in (LIB_CLOCK_GETTIME): Replaced by...
(FT_DEMO_CFLAGS, FT_DEMO_LDFLAGS): ... these two new variables.
2022-01-20 16:45:18 +00:00