From ad211e558b12fd16ea1e3d45716f0c8002440367 Mon Sep 17 00:00:00 2001 From: 6ziv Date: Wed, 29 Oct 2025 02:46:36 +0800 Subject: [PATCH] move exposed ft-hb interface to public include directory --- .../freetype}/ft-hb-decls.h | 0 include/freetype/ft-hb-functype.h | 46 +++++++++++++++++++ .../freetype}/ft-hb-types.h | 0 meson.build | 3 ++ src/autofit/ft-hb.c | 2 +- src/autofit/ft-hb.h | 17 +------ src/autofit/rules.mk | 3 +- 7 files changed, 53 insertions(+), 18 deletions(-) rename {src/autofit => include/freetype}/ft-hb-decls.h (100%) create mode 100644 include/freetype/ft-hb-functype.h rename {src/autofit => include/freetype}/ft-hb-types.h (100%) diff --git a/src/autofit/ft-hb-decls.h b/include/freetype/ft-hb-decls.h similarity index 100% rename from src/autofit/ft-hb-decls.h rename to include/freetype/ft-hb-decls.h diff --git a/include/freetype/ft-hb-functype.h b/include/freetype/ft-hb-functype.h new file mode 100644 index 000000000..0fafb64a9 --- /dev/null +++ b/include/freetype/ft-hb-functype.h @@ -0,0 +1,46 @@ +/**************************************************************************** + * + * ft-hb.h + * + * FreeType-HarfBuzz bridge (specification). + * + * Copyright (C) 2025 by + * 6ziv. + * + * 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. + * + * + * Originally located in src/autofit/ft-hb.h + * Move to a public header so that external projects can rely on this. + * + */ + +#ifndef FT_HB_FUNCTYPE_H +#define FT_HB_FUNCTYPE_H + +#include +#if defined( FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC ) || \ + defined( FT_CONFIG_OPTION_USE_HARFBUZZ_CALLBACKS ) + +#define HB_EXTERN( ret, name, args ) \ + typedef ret (*ft_ ## name ## _func_t) args; +#include +#undef HB_EXTERN + +typedef struct ft_hb_funcs_t +{ + + #define HB_EXTERN( ret, name, args ) \ + ft_ ## name ## _func_t name; +#include +#undef HB_EXTERN + +} ft_hb_funcs_t; + +#endif + +#endif /* FT_HB_FUNCTYPE_H */ \ No newline at end of file diff --git a/src/autofit/ft-hb-types.h b/include/freetype/ft-hb-types.h similarity index 100% rename from src/autofit/ft-hb-types.h rename to include/freetype/ft-hb-types.h diff --git a/meson.build b/meson.build index 42f244517..fe70d93db 100644 --- a/meson.build +++ b/meson.build @@ -183,6 +183,9 @@ ft2_public_headers = files([ 'include/freetype/ttnameid.h', 'include/freetype/tttables.h', 'include/freetype/tttags.h', + 'include/freetype/ft-hb-types.h', + 'include/freetype/ft-hb-decls.h', + 'include/freetype/ft-hb-functype.h' ]) ft2_config_headers = files([ diff --git a/src/autofit/ft-hb.c b/src/autofit/ft-hb.c index 9c1e1b09f..12e7f5ea1 100644 --- a/src/autofit/ft-hb.c +++ b/src/autofit/ft-hb.c @@ -137,7 +137,7 @@ if ( !funcs->name ) \ goto Fail; \ } -#include "ft-hb-decls.h" +#include #undef HB_EXTERN #undef DLSYM diff --git a/src/autofit/ft-hb.h b/src/autofit/ft-hb.h index c8f180134..1893d1373 100644 --- a/src/autofit/ft-hb.h +++ b/src/autofit/ft-hb.h @@ -27,24 +27,11 @@ FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ -# include "ft-hb-types.h" +# include # if defined( FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC ) || \ defined( FT_CONFIG_OPTION_USE_HARFBUZZ_CALLBACKS ) -# 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; - # ifdef FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC struct AF_ModuleRec_; @@ -63,7 +50,7 @@ FT_BEGIN_HEADER # define HB_EXTERN( ret, name, args ) \ ret name args; -# include "ft-hb-decls.h" +# include # undef HB_EXTERN # define hb( x ) hb_ ## x diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk index 03fb5a5ed..52e6a00a8 100644 --- a/src/autofit/rules.mk +++ b/src/autofit/rules.mk @@ -53,8 +53,7 @@ AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ $(AUTOF_DIR)/afstyles.h \ $(AUTOF_DIR)/aftypes.h \ $(AUTOF_DIR)/afws-decl.h \ - $(AUTOF_DIR)/afws-iter.h \ - $(AUTOF_DIR)/ft-hb-decls.h + $(AUTOF_DIR)/afws-iter.h # AUTOF driver object(s)