Branch
Hash :
97bb53ee
Author :
Date :
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`.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/****************************************************************************
*
* ft-hb.h
*
* FreeType-HarfBuzz bridge (specification).
*
* Copyright (C) 2025 by
* Behdad Esfahbod.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*/
#ifndef FT_HB_H
#define FT_HB_H
#include <freetype/internal/compiler-macros.h>
#include <freetype/freetype.h>
FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
# include "ft-hb-types.h"
# ifdef FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC
# define HB_EXTERN( ret, name, args ) \
typedef ret (*ft_ ## name ## _func_t) args;
# include "ft-hb-decls.h"
# undef HB_EXTERN
typedef struct ft_hb_funcs_t
{
# define HB_EXTERN( ret, name, args ) \
ft_ ## name ## _func_t name;
# include "ft-hb-decls.h"
# undef HB_EXTERN
} ft_hb_funcs_t;
struct AF_ModuleRec_;
FT_LOCAL( void )
ft_hb_funcs_init( struct AF_ModuleRec_ *af_module );
FT_LOCAL( void )
ft_hb_funcs_done( struct AF_ModuleRec_ *af_module );
# define hb( x ) globals->module->hb_funcs->hb_ ## x
# else /* !FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */
# define HB_EXTERN( ret, name, args ) \
ret name args;
# include "ft-hb-decls.h"
# undef HB_EXTERN
# define hb( x ) hb_ ## x
# endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC */
#endif /* FT_CONFIG_OPTION_USE_HARFBUZZ */
struct AF_FaceGlobalsRec_;
FT_LOCAL( FT_Bool )
ft_hb_enabled( struct AF_FaceGlobalsRec_ *globals );
FT_END_HEADER
#endif /* FT_HB_H */
/* END */