diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-16 14:47:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-16 15:00:30 +0400 |
commit | ce3f42e16a9e501b7c0221a6ed152d0926cc59e7 (patch) | |
tree | aca1331a4d0d5db6856ec79e9bd33f2d999a493e /source/blender/blenfont/BLF_api.h | |
parent | c193dbe30b40beb435d6edde7117469f4706f98e (diff) |
BLF API: Add BLF_width_to_strlen,rstrlen gives a byte offset from a string width
Diffstat (limited to 'source/blender/blenfont/BLF_api.h')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index b25166f4b18..6ba3bedd4b6 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -79,6 +79,11 @@ void BLF_draw(int fontid, const char *str, size_t len); void BLF_draw_ascii(int fontid, const char *str, size_t len); int BLF_draw_mono(int fontid, const char *str, size_t len, int cwidth); +/* 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); +/* Same as BLF_width_to_strlen but search from the string end */ +size_t BLF_width_to_rstrlen(int fontid, const char *str, size_t len, float width, float *r_width); + /* This function return the bounding box of the string * and are not multiplied by the aspect. */ |