Simplify code by sharing common parts for text output, measuring, glyph
testing, and wrapping.
We have many nearly-identical functions that process a utf-8 string, convert to utf-32, finds matching glyphs, etc. For example the measuring of output length of a string is the same process as printing that string, just without the final output but returning bounds. Similarly we have other functions that allow a callback per glyph.
Unfortunately we have to keep all these things "in sync". As we change or add complexity (like with bidirectional and complex shaping) we must ensure that all these functions do the same things, in the same order, and return identical results.
This extends the private function blf_font_draw_ex to optionally output, return bounds, and/or callback per glyph. This way it can do the work of these other functions.
A summary of how much is removed:
source/blender/blenfont/intern/blf_font.c | 187 +++++++++--------------------- 1 file changed, 55 insertions(+), 132 deletions(-)