diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-06-17 20:30:34 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-06-17 20:31:48 +0300 |
commit | 524a9e3db8102c89abf3b80cddaea60c314d67ae (patch) | |
tree | eae881aad7e3b114dbdfb5cbac183355a38b5d06 /source/blender/blenfont/BLF_api.h | |
parent | 5485057a27b92400ddc57dfb67c1017f26fefad8 (diff) |
BLF: Fallback Font Stack
Allow use of multiple fonts acting together like a fallback stack,
where if a glyph is not found in one it can be retrieved from another.
See D12622 for much more detail
Differential Revision: https://developer.blender.org/D12622
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenfont/BLF_api.h')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index e5e2b1711b1..78c8612f7f5 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -14,6 +14,15 @@ extern "C" { #endif +/* Name of subfolder inside BLENDER_DATAFILES that contains font files. */ +#define BLF_DATAFILES_FONTS_DIR "fonts" + +/* File name of the default variable-width font. */ +#define BLF_DEFAULT_PROPORTIONAL_FONT "droidsans.ttf" + +/* File name of the default fixed-pitch font. */ +#define BLF_DEFAULT_MONOSPACED_FONT "bmonofont-i18n.ttf" + /* enable this only if needed (unused circa 2016) */ #define BLF_BLUR_ENABLE 0 @@ -37,12 +46,14 @@ void BLF_cache_flush_set_fn(void (*cache_flush_fn)(void)); */ int BLF_load(const char *name) ATTR_NONNULL(); int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL(); +bool BLF_is_loaded(const char *name) ATTR_NONNULL(); int BLF_load_unique(const char *name) ATTR_NONNULL(); int BLF_load_mem_unique(const char *name, const unsigned char *mem, int mem_size) ATTR_NONNULL(); void BLF_unload(const char *name) ATTR_NONNULL(); void BLF_unload_id(int fontid); +void BLF_unload_all(void); char *BLF_display_name_from_file(const char *filepath); @@ -312,6 +323,7 @@ int BLF_set_default(void); int BLF_load_default(bool unique); int BLF_load_mono_default(bool unique); +void BLF_load_font_stack(void); #ifdef DEBUG void BLF_state_print(int fontid); @@ -331,6 +343,9 @@ void BLF_state_print(int fontid); #define BLF_HINTING_FULL (1 << 10) #define BLF_BOLD (1 << 11) #define BLF_ITALIC (1 << 12) +#define BLF_MONOSPACED (1 << 13) /* Intended USE is monospaced, regardless of font type. */ +#define BLF_DEFAULT (1 << 14) /* A font within the default stack of fonts. */ +#define BLF_LAST_RESORT (1 << 15) /* Must only be used as last font in the stack. */ #define BLF_DRAW_STR_DUMMY_MAX 1024 |