diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-28 06:25:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-28 06:34:56 +0300 |
commit | e78470d95411764c59af58dc996398a02bc40ae6 (patch) | |
tree | e6e325a1b5e0e017f4341ceaa65f0140b361ccdc /source/blender/blenfont/BLF_api.h | |
parent | 33017e952913a3be04e7ac8b720a12fd9d33a76f (diff) |
BLF: add utility function to loop over glyph bounds
Diffstat (limited to 'source/blender/blenfont/BLF_api.h')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 9aee8c9b78b..f6f1393bd21 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -37,6 +37,7 @@ extern "C" { struct ColorManagedDisplay; struct ResultBLF; struct rctf; +struct rcti; int BLF_init(void); void BLF_exit(void); @@ -115,6 +116,24 @@ void BLF_draw_ascii_ex(int fontid, const char *str, size_t len, struct ResultBLF void BLF_draw_ascii(int fontid, const char *str, size_t len) ATTR_NONNULL(2); int BLF_draw_mono(int fontid, const char *str, size_t len, int cwidth) ATTR_NONNULL(2); +typedef bool (*BLF_GlyphBoundsFn)(const char *str, + const size_t str_ofs, + const struct rcti *glyph_bounds, + const int glyph_advance_x, + void *user_data); + +void BLF_boundbox_foreach_glyph_ex(int fontid, + const char *str, + size_t len, + BLF_GlyphBoundsFn user_fn, + void *user_data, + struct ResultBLF *r_info) ATTR_NONNULL(2); +void BLF_boundbox_foreach_glyph(int fontid, + const char *str, + size_t len, + BLF_GlyphBoundsFn user_fn, + void *user_data) ATTR_NONNULL(2); + /* Get the string byte offset that fits within a given width */ size_t BLF_width_to_strlen(int fontid, const char *str, size_t len, float width, float *r_width) ATTR_NONNULL(2); |