diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-08-04 23:05:19 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-08-04 23:05:19 +0300 |
commit | 9d77b5a0ed7bed48dcb7483e79945067666eac0b (patch) | |
tree | 21acf2c4dd9665568c4d41761485f3bf3952b929 /source/blender/blenfont/intern/blf_internal.h | |
parent | fca7cb01011a3e34d21fcff6800d0b26b2be6e8e (diff) |
BLF: Implement FreeType Caching
Implementation of the FreeType 2 cache subsystem, which limits the
number of concurrently-opened FT_Face and FT_Size objects, as well as
caching information like character maps to speed up glyph id lookups.
See D13137 for much more detail.
Differential Revision: https://developer.blender.org/D13137
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenfont/intern/blf_internal.h')
-rw-r--r-- | source/blender/blenfont/intern/blf_internal.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 6207edb0107..8ff00d05e02 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -14,9 +14,16 @@ struct ResultBLF; struct rctf; struct rcti; -/* Max number of fonts in memory. Take care that every font has a glyph cache per size/dpi, +/* Max number of FontBLFs in memory. Take care that every font has a glyph cache per size/dpi, * so we don't need load the same font with different size, just load one and call BLF_size. */ -#define BLF_MAX_FONT 32 +#define BLF_MAX_FONT 64 + +/* Maximum number of opened FT_Face objects managed by cache. 0 is default of 2. */ +#define BLF_CACHE_MAX_FACES 0 +/* Maximum number of opened FT_Size objects managed by cache. 0 is default of 4 */ +#define BLF_CACHE_MAX_SIZES 0 +/* Maximum number of bytes to use for cached data nodes. 0 is default of 200,000. */ +#define BLF_CACHE_BYTES 0 extern struct FontBLF *global_font[BLF_MAX_FONT]; @@ -39,6 +46,8 @@ void blf_font_exit(void); bool blf_font_id_is_valid(int fontid); +uint blf_get_char_index(struct FontBLF *font, uint charcode); + bool blf_ensure_face(struct FontBLF *font); void blf_draw_buffer__start(struct FontBLF *font); |