From 509b4113ad340bf721ce58e645d1498a65cdad65 Mon Sep 17 00:00:00 2001 From: Thomas Sterren Date: Tue, 20 Feb 2018 16:30:53 +0100 Subject: [PATCH] Got stuck in here with a source font file generated out of `arial` size 48 --- src/gdisp/mcufont/mf_wordwrap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gdisp/mcufont/mf_wordwrap.c b/src/gdisp/mcufont/mf_wordwrap.c index 6403722d..a1df041f 100644 --- a/src/gdisp/mcufont/mf_wordwrap.c +++ b/src/gdisp/mcufont/mf_wordwrap.c @@ -179,6 +179,7 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width, struct linelen_s current = { 0 }; struct linelen_s previous = { 0 }; bool full; + uint32_t giveUp = 2048; // Do while-loop a maximum of x times current.start = text; @@ -214,6 +215,12 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width, current.last_word.space = 0; current.last_word.chars = 0; } + + giveUp--; + if (giveUp == 0) + { + break; + } } /* Dispatch the last lines. */