src/autofit/ft-hb.c

Branch


Log

Author Commit Date CI Message
Behdad Esfahbod 3ccc27dc 2025-06-19T08:06:53 [autofit] Really fix handling of `RTLD_DEFAULT`. This commit actually implements what commit 43ec023e1a7 describes. * src/autofit/ft-hb.c (FT_RTLD_FLAGS): New macro for `dlopen`; it uses `RTLD_GLOBAL` only if `RTLD_DEFAULT` is available.
Ozkan Sezer bd28cf7a 2025-06-04T08:55:04 [autofit] Fix `-Wunused-but-set-variable` warning in Windows builds. With this commit, the following warning gets removed. ``` In file included from src/autofit/autofit.c:21:0: src/autofit/ft-hb.c: In function 'ft_hb_funcs_init': src/autofit/ft-hb.c:75:35: warning: variable 'version_atleast' set but not used [-Wunused-but-set-variable] ft_hb_version_atleast_func_t version_atleast = NULL; ^~~~~~~~~~~~~~~ ``` * src/autofit/ft-hb.c (ft_hb_funcs_init): Move `NULL` check of `version_atleast` out of ifdefs.
Ozkan Sezer 1518bc83 2025-06-03T12:38:38 * src/autofit/ft-hb.c: Fix definition of `_GNU_SOURCE`. Commit 43ec023e1a730f defined the macro too late.
Behdad Esfahbod 43ec023e 2025-06-03T07:56:13 * src/autofit/ft-hb.c: Fix usage of `RTLD_DEFAULT`. Using `RTLD_DEFAULT` we see whether the process already has HarfBuzz linked in, and reuse it. If this symbol is not defined it is tempting to use `RTLD_GLOBAL` instead, which would make the library available to the whole process. However, without `RTLD_DEFAULT`, we would risk loading a second HarfBuzz library, and if the linker mixes them up, probably giving symbols from the new library to other clients, we might get into trouble. For this reason, we do not pass `RTLD_GLOBAL` to `dlopen`; the default is `RTLD_LOCAL`, and the rest of the process won't see the loaded HarfBuzz and hopefully all be happy.
Behdad Esfahbod (بهداد اسفهبد) 97bb53ee 2025-04-28T07:24:41 [autofit] Enable dynamic loading of HarfBuzz. (2/2) Handle the case where loading HarfBuzz dynamically fails. * src/autofit/ft-hb.c, src/autofit/ft-hb.h (ft_hb_enabled): New function. * src/autofit/afglobal.c (af_face_globals_new, af_face_globals_free): Guard HarfBuzz functions with `ft_hb_enabled`. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_metrics_init_blues, af_latin_metrics_check_digits): Simplify setup of `shaper_buf`. Guard calls of `af_shaper_buf_create` with `ft_hb_enabled`. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, af_cjk_metrics_check_digits): Dito. * src/autofit/afshaper.c: Guard all HarfBuzz function calls with `ft_hb_enabled`.
Behdad Esfahbod (بهداد اسفهبد) 7651fe00 2025-04-27T18:44:49 [autofit] Enable dynamic loading of HarfBuzz. (1/2) This commit activates the mini-HarfBuzz header files and provides the necessary infrastructure for dynamically loading HarfBuzz if `FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC` is defined (this macro gets set up in a follow-up commit). * src/autofit/ft-hb.c: New file, providing `ft_hb_funcs_init` and `ft_hb_funcs_done` for loading HarfBuzz dynamically. The name of the library is hold in the macro `FT_LIBHARFBUZZ`, which can be overridden. * src/autofit/ft-hb.h: Don't include `hb.h` but `ft-hb-types.h`. (hb): Modified to handle both standard linking and dynamically loading of HarfBuzz. (HB_EXTERN): New macro to load `ft-hb-decls.h`. * src/autofit/afadjust.c [FT_CONFIG_OPTION_USE_HARFBUZZ]: For the sake of dynamically loading the HarfBuzz library, replace the compile-time macro `HB_VERSION_ATLEAST` with a call to the run-time function `hb_version_atleast` where necessary – a follow-up commit will set the minimum version of HarfBuzz to 2.6.8, which provides all necessary functions needed by FreeType. * src/autofit/afmodule.h: Include `ft-hb.h`. (AF_ModuleRec) [FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Add `hb_funcs` structure to hold pointers to the dynamically loaded HarfBuzz functions. * src/autofit/afmodule.c (af_autofitter_init, af_autofitter_done) [FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC]: Call `ft_hb_funcs_init` and `ft_hb_funcs_done`. * src/autofit/afshaper.h: Updated. * src/autofit/autofit.c: Include `ft-hb.c`. * src/autofit/rules.mk (AUTOF_DRV_SRC, AUTOF_DRV_H): Updated.
Behdad Esfahbod (بهداد اسفهبد) 3eb4eade 2025-04-12T00:44:46 [autofit] Rename 'ft-hb' to 'ft-hb-ft'. Since it's a (shrinked) copy of 'hb-ft'. * src/autofit/afglobal.c (af_face_globals_new), src/autofit/afshaper.h, src/autofit/autofit.c: Updated. * src/autofit/ft-hb.c, src/autofit/ft-hb.h: Renamed to... * src/autofit/ft-hb-ft.c, src/autofit/ft-hb-ft.h: ...this; updated. * src/autofit/rules.mk (AUTOF_DRV_SRC): Updated.
Werner Lemberg d399657f 2023-02-26T20:18:54 * src/*: Replace leading underscores with trailing ones in dummy variables. This is to avoid clang warnings.
Werner Lemberg 995ccfac 2023-02-08T21:49:56 [autofit] Fix 'multi' compilation. * src/autofit/ft-hb.c: Decorate with `FT_LOCAL_DEF`. Add ANSI boilerplate code for otherwise empty file. * src/autofit/ft-hb.h: Include `compiler-macros.h` and `freetype.h`. Use `FT_BEGIN_HEADER` and `FT_END_HEADER`. Decorate with `FT_LOCAL`. * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `ft-hb.c`.
Werner Lemberg 37bc7c26 2023-02-07T07:37:07 Avoid reserved identifiers that are globally defined. This is mandated by the C99 standard, and clang 15 produces zillions of warnings otherwise. * devel/ftoption.h, include/freetype/config/ftoption.h, include/freetype/internal/ftmemory.h, src/autofit/afhints.h, src/autofit/afmodule.c, src/autofit/aftypes.h, src/base/ftadvanc.c, src/base/ftdbgmem.c, src/base/ftstream.c, src/bdf/bdflib.c, src/truetype/ttinterp.c: Replace identifiers of the form `_foo` with `foo_`.
Werner Lemberg 6a179ff7 2023-01-16T16:38:56 sr/*.c: Various minor fixes. * src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after variable declarations. * src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate unused variable. * src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++ compiler. * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid compiler warning. * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning.
Werner Lemberg b1c90733 2023-01-07T07:40:12 * src/autofit/ft-hb.c (_hb_ft_reference_table): Minor integration fixes.
Matthias Clasen ebe7e912 2023-01-02T20:13:22 [autofit] Don't depend on 'hb-ft'. The circular dependency is still there, but at least we no longer depend on the HarfBuzz API that is only present if HarfBuzz has been built with FreeType support, making the bootstrapping a bit easier. * src/autofit/ft-hb.c, src/autofit/ft-hb.h: New files, providing `_hb_ft_font_create`, which is more or less a verbatim copy of the corresponding HarfBuzz code from file `hb-ft.cc`. * src/autofit/afglobal.c (af_face_globals_new): Use it. * src/autofit/afshaper.h: Don't include `hb-ft.h` but `ft-hb.h`. * src/autofit/autofit.c: Include `ft-hb.c`. * LICENSE.TXT: Updated.