pw_draw: TextArea DrawText fix

Fixed a DrawText bug where the cursor would always move right one
space for the string terminator '\0' char.

Change-Id: Ied3ea06d94b4ea2af3168f6e46f145237a7c2dd1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/experimental/+/122131
Reviewed-by: Chris Mumford <cmumford@google.com>
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
GitOrigin-RevId: 5ca43b6879322d0b0dec8b8ecce9046e7e2dcc7d
diff --git a/pw_graphics/pw_draw/public/pw_draw/text_area.cc b/pw_graphics/pw_draw/public/pw_draw/text_area.cc
index c004270..241a316 100644
--- a/pw_graphics/pw_draw/public/pw_draw/text_area.cc
+++ b/pw_graphics/pw_draw/public/pw_draw/text_area.cc
@@ -106,12 +106,13 @@
   DrawCharacter(character);
 }
 
-void TextArea::DrawTestFontSheet(int character_width, int x, int y) {
+void TextArea::DrawTestFontSheet(int character_column_width, int x, int y) {
   SetCursor(x, y);
   for (int c = current_font->starting_character;
        c <= current_font->ending_character;
        c++) {
-    if (c % character_width == 0) {
+    int index = c - current_font->starting_character;
+    if (index > 0 && index % character_column_width == 0) {
       DrawCharacter('\n');
     }
     DrawCharacter(c);
@@ -121,13 +122,9 @@
 // DrawText at x, y (upper left pixel of font). Carriage returns will move
 // text to the next line.
 void TextArea::DrawText(const char* str) {
-  int character_index = 0;
-  int character;
-  do {
-    character = str[character_index];
-    DrawCharacter(character);
-    character_index++;
-  } while (character != '\0');
+  for (const char* ch = str; *ch != '\0'; ch++) {
+    DrawCharacter(*ch);
+  }
 }
 
 void TextArea::DrawText(const char* str, int x, int y) {
@@ -136,13 +133,9 @@
 }
 
 void TextArea::DrawText(const wchar_t* str) {
-  int character_index = 0;
-  int character;
-  do {
-    character = str[character_index];
-    DrawCharacter(character);
-    character_index++;
-  } while (character != '\0');
+  for (const wchar_t* ch = str; *ch != L'\0'; ch++) {
+    DrawCharacter(*ch);
+  }
 }
 
 void TextArea::DrawText(const wchar_t* str, int x, int y) {