From f2341f829654c4dc97fcf9fd1f74a6526c4f50ff Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Sep 2015 20:10:26 +1000 Subject: BLF: initial word-wrap support - Adds support for word wrapping to Blender's BLF font library. - Splits lines when width limit is reached or on explicit \n newlines. Details: - Word wrapping is used when `BLF_WORD_WRAP` flag is enabled. - There is a single loop to handle line wrapping, this runs callback, passing in a substring, this way we can avoid code-duplication for all word-wrapped versions of functions... OR... avoid having to add support for word-wrapping directly into each function. - The `ResultBLF` struct was added to be able to get the number of wrapped lines, when calling otherwise unrelated functions such as `BLF_draw/BLF_width/BLF_boundbox`, which can be passed as the last argument to `BLF_*_ex()` functions. - The `ResultBLF` struct is used to store the result of drawing (currently only the number of lines wrapped, and the width). --- source/blender/blenkernel/intern/seqeffects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/seqeffects.c') diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index c65ed527568..3e93fb53bfc 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2968,11 +2968,11 @@ static ImBuf *do_text_effect(const SeqRenderData *context, Sequence *seq, float fonty = BLF_height_max(mono); BLF_position(mono, x + max_ii(fontx / 25, 1), y + max_ii(fonty / 25, 1), 0.0f); BLF_buffer_col(mono, 0.0f, 0.0f, 0.0f, 1.0f); - BLF_draw_buffer(mono, data->text); + BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX); } BLF_position(mono, x, y, 0.0f); BLF_buffer_col(mono, 1.0f, 1.0f, 1.0f, 1.0f); - BLF_draw_buffer(mono, data->text); + BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX); BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL); -- cgit v1.2.3