Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-09-18 13:10:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-09-18 13:43:52 +0300
commitf2341f829654c4dc97fcf9fd1f74a6526c4f50ff (patch)
tree7287c4bbe46c06394353e1f57d62a6dff8803876 /source/blender/blenkernel/intern/image_gen.c
parente9dd060102f2ca84530ed000a063abbd53b99962 (diff)
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).
Diffstat (limited to 'source/blender/blenkernel/intern/image_gen.c')
-rw-r--r--source/blender/blenkernel/intern/image_gen.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 4f9ed5f258d..303d0c6adfc 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -309,26 +309,26 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_buffer_col(mono, 1.0, 1.0, 1.0, 1.0);
BLF_position(mono, pen_x - outline, pen_y, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x + outline, pen_y, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x, pen_y - outline, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x, pen_y + outline, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x - outline, pen_y - outline, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x + outline, pen_y + outline, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x - outline, pen_y + outline, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_position(mono, pen_x + outline, pen_y - outline, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
BLF_buffer_col(mono, 0.0, 0.0, 0.0, 1.0);
BLF_position(mono, pen_x, pen_y, 0.0);
- BLF_draw_buffer(mono, text);
+ BLF_draw_buffer(mono, text, 2);
text[1]++;
}