aboutsummaryrefslogtreecommitdiffstats
path: root/src/gdisp/gdisp.c
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@seriouslyembedded.com>2015-11-04 07:11:49 +0100
committerJoel Bodenmann <joel@seriouslyembedded.com>2015-11-04 07:11:49 +0100
commitdf76759cd43e4d6edcf089c05420ab2180ff4491 (patch)
treef96c4b3392b0166cf6ee0838f269139918fafdbb /src/gdisp/gdisp.c
parent96789916e3c6b8db8f4b1aba4ff5c36b0137bf3f (diff)
parentb276bd7a4b3a0d213d95fab3e2a425fc8be92fe6 (diff)
downloaduGFX-df76759cd43e4d6edcf089c05420ab2180ff4491.tar.gz
uGFX-df76759cd43e4d6edcf089c05420ab2180ff4491.tar.bz2
uGFX-df76759cd43e4d6edcf089c05420ab2180ff4491.zip
Merge branch 'master' of https://bitbucket.org/Tectu/ugfx
Diffstat (limited to 'src/gdisp/gdisp.c')
-rw-r--r--src/gdisp/gdisp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index ea9fcc7a..84215796 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -3169,7 +3169,15 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
/* Callback to render string boxes with word wrap. */
#if GDISP_NEED_TEXT_WORDWRAP
- static bool mf_line_callback(mf_str line, uint16_t count, void *state) {
+ static bool mf_drawline_callback(mf_str line, uint16_t count, void *state) {
+ wrapParameters_t* wrapParameters = (wrapParameters_t*)state;
+
+ mf_render_aligned(wrapParameters->font, wrapParameters->x, wrapParameters->y, wrapParameters->justify, line, count, drawcharglyph, wrapParameters->g);
+
+ wrapParameters->y += wrapParameters->font->line_height;
+ return TRUE;
+ }
+ static bool mf_fillline_callback(mf_str line, uint16_t count, void *state) {
wrapParameters_t* wrapParameters = (wrapParameters_t*)state;
mf_render_aligned(wrapParameters->font, wrapParameters->x, wrapParameters->y, wrapParameters->justify, line, count, fillcharglyph, wrapParameters->g);
@@ -3283,7 +3291,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
wrapParameters.justify = justify;
wrapParameters.g = g;
- mf_wordwrap(font, cx, str, mf_line_callback, &wrapParameters);
+ mf_wordwrap(font, cx, str, mf_drawline_callback, &wrapParameters);
#else
mf_render_aligned(font, x, y, justify, str, 0, drawcharglyph, g);
#endif
@@ -3336,7 +3344,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
wrapParameters.justify = justify;
wrapParameters.g = g;
- mf_wordwrap(font, cx, str, mf_line_callback, &wrapParameters);
+ mf_wordwrap(font, cx, str, mf_fillline_callback, &wrapParameters);
#else
mf_render_aligned(font, x, y, justify, str, 0, fillcharglyph, g);
#endif