2020-08-18 Anuj Verma [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 [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 [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 [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 [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 [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 [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 [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 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 [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 * 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 * meson.build (ft2_defines): Fix builds on Windows. 2020-12-18 Tatsuyuki Ishi [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 * 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 [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 [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 * builds/unix/configure.raw: Don't set `FT_DEBUG_LOGGING`. All debug options are handled exclusively in `ftoption.h`. 2020-12-07 Werner Lemberg * src/*: More fixes for using a '\n' in `FT_TRACE` and `FT_ERROR`. 2020-12-07 Werner Lemberg */*: s/FT_LOGGING/FT_DEBUG_LOGGING/. 2020-12-05 Werner Lemberg * builds/toplevel.mk (do-dist): Remove `submodules` directory. 2020-12-02 Werner Lemberg * 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 [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 * submodules/dlg: Updated to commit 9f0c8b22. 2020-12-02 Werner Lemberg * src/bdf/bdflib.c: Fix `-Wformat` warning. 2020-12-02 Werner Lemberg 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 [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 [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 * src/type42/t42parse.c: Fix `-Wformat` warnings. 2020-12-01 Priyesh Kumar [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 [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 Update logging related documentation. * docs/DEBUG: Updates related to `FT_LOGGING`. * README.git: Updates related to logging. 2020-11-30 Priyesh Kumar * src/*: Fix `-Wformat` warnings. 2020-11-30 Priyesh Kumar [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 [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 [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 [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 [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 [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 * .gitmodules: Add 'dlg' library's git repository as submodule. 2020-12-01 Werner Lemberg * src/tools/chktrcmp.py (trace_use_pat): Update to current use. 2020-11-20 Alexei Podtelezhnikov [cff,cid,type1] Demote old engine for lack of CFF2. * src/cff/cffobjs.c (cff_iriver_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 * src/type42/t42parse.c (t42_parse_sfnts): More tracing messages. 2020-11-04 Werner Lemberg * 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 [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 * 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 * 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`. 2020-10-20 Werner Lemberg * Version 2.10.4 released. ========================== Tag sources with `VER-2-10-4'. * docs/VERSION.TXT: Add entry for version 2.10.4. * 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.3/2.10.4/, s/2103/2104/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 4. * builds/unix/configure.raw (version_info): Set to 23:4:17. * CMakeLists.txt (VERSION_PATCH): Set to 4. 2020-10-19 Werner Lemberg [sfnt] Fix heap buffer overflow (#59308). This is CVE-2020-15999. * src/sfnt/pngshim.c (Load_SBit_Png): Test bitmap size earlier. 2020-10-17 Alexei Podtelezhnikov * src/sfnt/tt{colr,cpal}.c: Fix signedness warnings from VC++. 2020-10-17 Alexei Podtelezhnikov * src/sfnt/sfwoff2.c (Read255UShort): Tweak types to please VC++. 2020-10-10 Werner Lemberg * Version 2.10.3 released. ========================== Tag sources with `VER-2-10-3'. * docs/VERSION.TXT: Add entry for version 2.10.3. * 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.2/2.10.3/, s/2102/2103/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 3. * builds/unix/configure.raw (version_info): Set to 23:3:17. * CMakeLists.txt (VERSION_PATCH): Set to 3. 2020-09-25 Werner Lemberg [autofit] Synchronize with ttfautohint. This corresponds to the following commits in the ttfautohint git repository: bb6842bd3bd437b7b4a7921b0376c860f5e73d18 Typo, formatting. d5c91ddb1cb310257a3dfe9a8e20e1fc51335faa Add Medefaidrin script. * src/autofit/afblue.dat: Add blue zone data for Medefaidrin. * src/autofit/afblue.c, src/autofit/afblue.h: Regenerated. * src/autofit/afscript.h: Add Medefaidrin standard characters. * src/autofit/afranges.c, src/autofit/afstyles.h: Add Medefaidrin data. 2020-09-25 Werner Lemberg Move `scripts/make_distribution_archives.py` to `src/tools`. * scr/tools/scripts/make_distribution_archives.py: (_TOP_DIR, _SCRIPT_DIR): Updated to new location. (main): s/shutils.copyfile/shutils.copy/ to preserve file permissions. (main): Prefix source file paths with `git_dir` while copying files to allow calls of the script from other places than the top-level directory. 2020-09-24 Werner Lemberg * src/cff/cffgload.c (cff_slot_load): Scale `vertBearingY`. Towards the end of the the function there is a call to `FT_Outline_Get_CBox` that retrieves the glyph bbox in scaled units. That sets `horiBearing{X,Y}` and `vertBearingX` but `vertBearingY` is left alone, and is not scaled. Patch from Eric Muller . 2020-09-24 Werner Lemberg * src/base/ftobjs.c (FT_Load_Glyph): Trace glyph metrics. 2020-09-22 Werner Lemberg [meson] Move auxiliary scripts to `builds/meson`. Suggested by Alexei. * scripts/*.py: Move meson scripts to... * builds/meson/*.py: ... this new location. * meson.build: Updated. 2020-09-21 David Turner Add python script for building tarballs. * scripts/make_distribution_archives.py: New file. This standalone Python script should be equivalent to running `make dist` with the Make-based build system, with the following minor differences: - Since `make distclean` doesn't always clean up `objs/` properly, `make dist` archives may contain some stale binaries like `objs/.libs/libfreetype.so.6` or others. - `config.guess` and `config.sub` are not updated unless option `--gnu-config-dir=DIR` is used to specify the location of these files. - Some bits of the auto-generated reference documentation may appear in slightly different order, probably due to issues related to mkdocs and docwriter. As an example, the call scripts/make_distribution_archives.py /tmp/freetype2-dist creates the following files under `/tmp/freetype2-dist`: freetype-.tar.gz freetype-.tar.xz ft.zip 2020-09-21 Werner Lemberg * scripts/extract_freetype_version.py: Fix regex typos. 2020-09-21 David Turner Add Meson build project file. Example usage: # Configure Meson build in directory `build-meson` to generate # release binaries comparable to to the ones from the # autotools/make build system. meson setup build-meson \ --prefix=/usr/local \ --buildtype=debugoptimized \ --strip \ -Db_ndebug=true # After configuring the Meson build with the above command, # compile and install to `/usr/local/`; this includes a pkg-config # file. ninja -C build-meson install # Alternatively, compile and install to `/tmp/aa/usr/local/...` # for packaging. DESTDIR=/tmp/aa ninja -C build-meson install # Generate documentation under `build-meson/docs`. ninja -C build-meson docs Library size comparison for stripped `libfreetype.so` generated by all three build systems: - Default build (autotools + libtool): 712 KiB - CMake build (RelWithDebInfo): 712 KiB - Meson build: 712 KiB * meson.build: New top-level Meson build file for the library. * meson_options.txt: New file. It holds user-selectable options for the build, which can be printed with `meson configure`, and selected at `meson setup` or `meson --reconfigure` time with `-D