Do not go to the next line if the char to display does not fit draft

Mon, 23 Nov 2020 21:57:06 +0100

author
David Douard <david.douard@sdf3.org>
date
Mon, 23 Nov 2020 21:57:06 +0100
changeset 58
c1dfd75f2842
parent 57
cce151e4bf3d
child 59
b4ce7147f82c

Do not go to the next line if the char to display does not fit

lib/unigraphic/GraphicsDisplay.cpp file | annotate | diff | comparison | revisions
--- a/lib/unigraphic/GraphicsDisplay.cpp	Mon Nov 23 21:55:40 2020 +0100
+++ b/lib/unigraphic/GraphicsDisplay.cpp	Mon Nov 23 21:57:06 2020 +0100
@@ -287,6 +287,7 @@
     vert = font[2];                      // get vert size of font
     bpl = font[3];                       // bytes per line
 */
+	/*
     if (char_x + fonthor*fontzoomhor > oriented_width) {
         char_x = 0;
         char_y = char_y + fontvert*fontzoomver;
@@ -294,6 +295,12 @@
             char_y = 0;
         }
     }
+	*/
+    if (char_x + fonthor*fontzoomhor > oriented_width) {
+		// a bit brutal, but meh
+		// so if the char to write crosses the width, do not display it
+		return;
+	}
     if ((c < firstch) || (c > lastch)) {   // test char range - if not exist fill with blank
 		window(char_x, char_y, fonthor*fontzoomhor, fontvert*fontzoomver); // char box
       window_pushpixel(_background, fontzoomhor*fonthor*fontvert*fontzoomver); //(color, howmany)

mercurial