diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-11 09:35:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-11 09:35:45 +0300 |
commit | 80a650dfb1e73363ae6924dc5738b732bb89ded4 (patch) | |
tree | 7d8af50bde3e4c32474d899a7fd00558afe9befc /source/blender/blenfont/intern/blf_font.c | |
parent | 59cfe81085b06243220cdb075a28a1352edebf7b (diff) |
BLF_draw functions take an extra length argument, so the console drawing doenst need to swap in NULL chars to draw word wrapping.
Diffstat (limited to 'source/blender/blenfont/intern/blf_font.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 9fb40f0206d..7542d200be1 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -92,7 +92,7 @@ void blf_font_size(FontBLF *font, int size, int dpi) } } -void blf_font_draw(FontBLF *font, const char *str) +void blf_font_draw(FontBLF *font, const char *str, unsigned int len) { unsigned int c; GlyphBLF *g, *g_prev; @@ -110,7 +110,7 @@ void blf_font_draw(FontBLF *font, const char *str) has_kerning= FT_HAS_KERNING(font->face); g_prev= NULL; - while (str[i]) { + while (str[i] && i < len) { c= blf_utf8_next((unsigned char *)str, &i); if (c == 0) break; @@ -147,7 +147,7 @@ void blf_font_draw(FontBLF *font, const char *str) } /* faster version of blf_font_draw, ascii only for view dimensions */ -void blf_font_draw_ascii(FontBLF *font, const char *str) +void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len) { char c; GlyphBLF *g, *g_prev; @@ -177,7 +177,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str) } } - while ((c= *(str++))) { + while ((c= *(str++)) && len--) { g= font->glyph_ascii_table[c]; /* if we don't found a glyph, skip it. */ |