- int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
- int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+ int width = SXSIZE - 2 * pad_x;
+ int height = SYSIZE - pad_y;
+#endif
+#if 1
+#if 0
+ int max_chars = tmi->chars;
+ int max_lines = tmi->lines;
+#endif
+#else
+ int max_chars_per_line = width / font_width;
+#if 1
+ int max_lines_per_screen = height / font_height;
+#else
+ int max_lines_per_screen = height / font_height - 1; /* minus footer line */
+#endif
+#endif
+
+ /* if chars set to "-1", automatically determine by text and font width */
+ if (tmi->chars == -1)
+ tmi->chars = tmi->width / getFontWidth(font_nr);
+ else
+ tmi->width = tmi->chars * getFontWidth(font_nr);
+
+ /* if lines set to "-1", automatically determine by text and font height */
+ if (tmi->lines == -1)
+ tmi->lines = tmi->height / getFontHeight(font_nr);
+ else
+ tmi->height = tmi->lines * getFontHeight(font_nr);