Use font ascent and descent for line positioning (#12224)
This commit is contained in:
parent
9cd3529108
commit
b780b69c62
4 changed files with 110 additions and 104 deletions
|
@ -1094,7 +1094,7 @@
|
|||
#define STATUS_SCREEN_BED_TEXT_X 81
|
||||
#endif
|
||||
#ifndef STATUS_SCREEN_FAN_TEXT_X
|
||||
#define STATUS_SCREEN_FAN_TEXT_X 104
|
||||
#define STATUS_SCREEN_FAN_TEXT_X 103
|
||||
#endif
|
||||
#ifndef STATUS_SCREEN_FAN_TEXT_Y
|
||||
#define STATUS_SCREEN_FAN_TEXT_Y (FAN_ANIM_FRAMES > 2 ? 28 : 27)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) {
|
||||
const char * const str = itostr3(temp);
|
||||
lcd_moveto(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y);
|
||||
lcd_moveto(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * MENU_FONT_WIDTH / 2, y);
|
||||
lcd_put_u8str(str);
|
||||
lcd_put_u8str_P(PSTR(LCD_STR_DEGREE " "));
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ FORCE_INLINE void lcd_implementation_status_message(const bool blink) {
|
|||
lcd_put_wchar('.');
|
||||
if (--chars) {
|
||||
// Print a second copy of the message
|
||||
lcd_put_u8str_max(lcd_status_message, LCD_PIXEL_WIDTH - ((rlen+2) * DOG_CHAR_WIDTH));
|
||||
lcd_put_u8str_max(lcd_status_message, LCD_PIXEL_WIDTH - ((rlen+2) * MENU_FONT_WIDTH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,9 +356,9 @@ void lcd_impl_status_screen_0() {
|
|||
//
|
||||
|
||||
#if DISABLED(DOGM_SD_PERCENT)
|
||||
#define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2))
|
||||
#define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (MENU_FONT_WIDTH / 2))
|
||||
#else
|
||||
#define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH)
|
||||
#define SD_DURATION_X (LCD_PIXEL_WIDTH - len * MENU_FONT_WIDTH)
|
||||
#endif
|
||||
|
||||
if (PAGE_CONTAINS(41, 48)) {
|
||||
|
@ -376,7 +376,7 @@ void lcd_impl_status_screen_0() {
|
|||
// XYZ Coordinates
|
||||
//
|
||||
|
||||
#define XYZ_BASELINE (30 + INFO_FONT_HEIGHT)
|
||||
#define XYZ_BASELINE (30 + INFO_FONT_ASCENT)
|
||||
|
||||
#define X_LABEL_POS 3
|
||||
#define X_VALUE_POS 11
|
||||
|
@ -384,10 +384,10 @@ void lcd_impl_status_screen_0() {
|
|||
|
||||
#if ENABLED(XYZ_HOLLOW_FRAME)
|
||||
#define XYZ_FRAME_TOP 29
|
||||
#define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3
|
||||
#define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 3
|
||||
#else
|
||||
#define XYZ_FRAME_TOP 30
|
||||
#define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1
|
||||
#define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 1
|
||||
#endif
|
||||
|
||||
static char xstring[5], ystring[5], zstring[8];
|
||||
|
@ -419,7 +419,7 @@ void lcd_impl_status_screen_0() {
|
|||
u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37
|
||||
#endif
|
||||
|
||||
if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) {
|
||||
if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_ASCENT - 1), XYZ_BASELINE)) {
|
||||
|
||||
#if DISABLED(XYZ_HOLLOW_FRAME)
|
||||
u8g.setColorIndex(0); // white on black
|
||||
|
@ -449,14 +449,15 @@ void lcd_impl_status_screen_0() {
|
|||
//
|
||||
// Feedrate
|
||||
//
|
||||
#define EXTRAS_BASELINE 50
|
||||
|
||||
if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) {
|
||||
if (PAGE_CONTAINS(EXTRAS_BASELINE - (INFO_FONT_HEIGHT - 1), EXTRAS_BASELINE)) {
|
||||
lcd_setFont(FONT_MENU);
|
||||
lcd_moveto(3, 50);
|
||||
lcd_moveto(3, EXTRAS_BASELINE);
|
||||
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
||||
|
||||
lcd_setFont(FONT_STATUSMENU);
|
||||
lcd_moveto(12, 50);
|
||||
lcd_moveto(12, EXTRAS_BASELINE);
|
||||
lcd_put_u8str(itostr3(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
|
||||
|
@ -464,15 +465,15 @@ void lcd_impl_status_screen_0() {
|
|||
// Filament sensor display if SD is disabled
|
||||
//
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
||||
lcd_moveto(56, 50);
|
||||
lcd_moveto(56, EXTRAS_BASELINE);
|
||||
lcd_put_u8str(wstring);
|
||||
lcd_moveto(102, 50);
|
||||
lcd_moveto(102, EXTRAS_BASELINE);
|
||||
lcd_put_u8str(mstring);
|
||||
lcd_put_wchar('%');
|
||||
lcd_setFont(FONT_MENU);
|
||||
lcd_moveto(47, 50);
|
||||
lcd_moveto(47, EXTRAS_BASELINE);
|
||||
lcd_put_wchar(LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
|
||||
lcd_moveto(93, 50);
|
||||
lcd_moveto(93, EXTRAS_BASELINE);
|
||||
lcd_put_wchar(LCD_STR_FILAM_MUL[0]);
|
||||
#endif
|
||||
}
|
||||
|
@ -481,9 +482,9 @@ void lcd_impl_status_screen_0() {
|
|||
// Status line
|
||||
//
|
||||
|
||||
#define STATUS_BASELINE (55 + INFO_FONT_HEIGHT)
|
||||
#define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT)
|
||||
|
||||
if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) {
|
||||
if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_ASCENT - 1), STATUS_BASELINE)) {
|
||||
lcd_moveto(0, STATUS_BASELINE);
|
||||
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
|
||||
|
|
|
@ -60,18 +60,14 @@
|
|||
#include "../../feature/bedlevel/ubl/ubl.h"
|
||||
#endif
|
||||
|
||||
#define FONT_SPECIAL_NAME ISO10646_1_5x7
|
||||
#define FONT_MENU_NAME ISO10646_1_5x7
|
||||
#include "fontdata/fontdata_ISO10646_1.h"
|
||||
#if ENABLED(USE_SMALL_INFOFONT)
|
||||
#include "fontdata/fontdata_6x9_marlin.h"
|
||||
#define FONT_STATUSMENU_NAME u8g_font_6x9
|
||||
#else
|
||||
#define FONT_STATUSMENU_NAME FONT_MENU_NAME
|
||||
#define FONT_STATUSMENU_NAME MENU_FONT_NAME
|
||||
#endif
|
||||
|
||||
#define START_COL 0
|
||||
|
||||
U8G_CLASS u8g(U8G_PARAM);
|
||||
U8GLIB *pu8g = &u8g;
|
||||
|
||||
|
@ -93,10 +89,9 @@ void lcd_setFont(const MarlinFont font_nr) {
|
|||
if (font_nr != currentfont) {
|
||||
switch ((currentfont = font_nr)) {
|
||||
case FONT_STATUSMENU : u8g.setFont(FONT_STATUSMENU_NAME); break;
|
||||
case FONT_EDIT : u8g.setFont(EDIT_FONT_NAME); break;
|
||||
default:
|
||||
case FONT_MENU : u8g.setFont(FONT_MENU_NAME); break;
|
||||
case FONT_SPECIAL : u8g.setFont(FONT_SPECIAL_NAME); break;
|
||||
case FONT_MENU_EDIT : u8g.setFont(FONT_MENU_EDIT_NAME); break;
|
||||
case FONT_MENU : u8g.setFont(MENU_FONT_NAME); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +150,7 @@ void lcd_setFont(const MarlinFont font_nr) {
|
|||
#if ENABLED(START_BMPHIGH)
|
||||
(LCD_PIXEL_HEIGHT - (START_BMPHEIGHT)) / 2
|
||||
#else
|
||||
DOG_CHAR_HEIGHT
|
||||
MENU_FONT_HEIGHT
|
||||
#endif
|
||||
;
|
||||
|
||||
|
@ -167,13 +162,13 @@ void lcd_setFont(const MarlinFont font_nr) {
|
|||
u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp);
|
||||
lcd_setFont(FONT_MENU);
|
||||
#ifndef STRING_SPLASH_LINE2
|
||||
const uint8_t txt1X = width - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH);
|
||||
u8g.drawStr(txt1X, (height + DOG_CHAR_HEIGHT) / 2, STRING_SPLASH_LINE1);
|
||||
const uint8_t txt1X = width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH);
|
||||
u8g.drawStr(txt1X, (height + MENU_FONT_HEIGHT) / 2, STRING_SPLASH_LINE1);
|
||||
#else
|
||||
const uint8_t txt1X = (width - (sizeof(STRING_SPLASH_LINE1) - 1) * (DOG_CHAR_WIDTH)) / 2,
|
||||
txt2X = (width - (sizeof(STRING_SPLASH_LINE2) - 1) * (DOG_CHAR_WIDTH)) / 2;
|
||||
u8g.drawStr(txt1X, height - (DOG_CHAR_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
|
||||
u8g.drawStr(txt2X, height - (DOG_CHAR_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
|
||||
const uint8_t txt1X = (width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)) / 2,
|
||||
txt2X = (width - (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH)) / 2;
|
||||
u8g.drawStr(txt1X, height - (MENU_FONT_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1);
|
||||
u8g.drawStr(txt2X, height - (MENU_FONT_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2);
|
||||
#endif
|
||||
} while (u8g.nextPage());
|
||||
safe_delay(BOOTSCREEN_TIMEOUT);
|
||||
|
@ -252,12 +247,12 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
|
||||
void lcd_implementation_hotend_status(const uint8_t row, const uint8_t extruder) {
|
||||
row_y1 = row * (DOG_CHAR_HEIGHT) + 1;
|
||||
row_y2 = row_y1 + DOG_CHAR_HEIGHT - 1;
|
||||
row_y1 = row * (MENU_FONT_HEIGHT) + 1;
|
||||
row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
|
||||
|
||||
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return;
|
||||
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - 11 * (DOG_CHAR_WIDTH), row_y2);
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2);
|
||||
lcd_put_wchar('E');
|
||||
lcd_put_wchar((char)('1' + extruder));
|
||||
lcd_put_wchar(' ');
|
||||
|
@ -272,8 +267,8 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
|
||||
// Set the colors for a menu item based on whether it is selected
|
||||
static bool mark_as_selected(const uint8_t row, const bool isSelected) {
|
||||
row_y1 = row * (DOG_CHAR_HEIGHT) + 1;
|
||||
row_y2 = row_y1 + DOG_CHAR_HEIGHT - 1;
|
||||
row_y1 = row * (MENU_FONT_HEIGHT) + 1;
|
||||
row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
|
||||
|
||||
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return false;
|
||||
|
||||
|
@ -283,7 +278,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
u8g.drawHLine(0, row_y2 + 2, LCD_PIXEL_WIDTH);
|
||||
#else
|
||||
u8g.setColorIndex(1); // black on white
|
||||
u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, DOG_CHAR_HEIGHT - 1);
|
||||
u8g.drawBox(0, row_y1 + 2, LCD_PIXEL_WIDTH, MENU_FONT_HEIGHT - 1);
|
||||
u8g.setColorIndex(0); // white on black
|
||||
#endif
|
||||
}
|
||||
|
@ -295,7 +290,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
|
||||
if (!PAGE_CONTAINS(row_y1, row_y2)) return false;
|
||||
|
||||
lcd_moveto((START_COL) * (DOG_CHAR_WIDTH), row_y2);
|
||||
lcd_moveto(0, row_y2);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -304,7 +299,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
|
||||
if (mark_as_selected(row, invert)) {
|
||||
|
||||
uint8_t n = LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * (START_COL); // pixel width of string allowed
|
||||
uint8_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed
|
||||
|
||||
if (center && !valstr) {
|
||||
int8_t pad = (LCD_WIDTH - utf8_strlen_P(pstr)) / 2;
|
||||
|
@ -315,7 +310,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
n -= lcd_put_u8str_max(valstr, n);
|
||||
}
|
||||
|
||||
while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,11 +319,11 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
UNUSED(pre_char);
|
||||
|
||||
if (mark_as_selected(row, isSelected)) {
|
||||
uint8_t n = LCD_WIDTH - (START_COL) - 2;
|
||||
n *= DOG_CHAR_WIDTH;
|
||||
uint8_t n = LCD_WIDTH - 2;
|
||||
n *= MENU_FONT_WIDTH;
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH), row_y2);
|
||||
while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2);
|
||||
lcd_put_wchar(post_char);
|
||||
lcd_put_wchar(' ');
|
||||
}
|
||||
|
@ -338,60 +333,62 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
|
||||
if (mark_as_selected(row, isSelected)) {
|
||||
const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
|
||||
uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
|
||||
n *= DOG_CHAR_WIDTH;
|
||||
uint8_t n = LCD_WIDTH - 2 - vallen;
|
||||
n *= MENU_FONT_WIDTH;
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
lcd_put_wchar(':');
|
||||
while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - (DOG_CHAR_WIDTH) * vallen, row_y2);
|
||||
while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH) * vallen, row_y2);
|
||||
if (pgm) lcd_put_u8str_P(data); else lcd_put_u8str((char*)data);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_implementation_drawedit(PGM_P const pstr, const char* const value/*=NULL*/) {
|
||||
const uint8_t labellen = utf8_strlen_P(pstr),
|
||||
vallen = utf8_strlen(value);
|
||||
const uint8_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value);
|
||||
|
||||
uint8_t rows = (labellen > LCD_WIDTH - 2 - vallen) ? 2 : 1;
|
||||
bool extra_row = labellen > LCD_WIDTH - 2 - vallen;
|
||||
|
||||
#if ENABLED(USE_BIG_EDIT_FONT)
|
||||
constexpr uint8_t lcd_width_edit = (LCD_PIXEL_WIDTH) / (DOG_CHAR_WIDTH_EDIT);
|
||||
|
||||
uint8_t lcd_width, char_width;
|
||||
if (labellen <= lcd_width_edit - 1) {
|
||||
if (labellen + vallen + 2 >= lcd_width_edit) rows = 2;
|
||||
lcd_width = lcd_width_edit + 1;
|
||||
char_width = DOG_CHAR_WIDTH_EDIT;
|
||||
lcd_setFont(FONT_MENU_EDIT);
|
||||
// Use the menu font if the label won't fit on a single line
|
||||
constexpr uint8_t lcd_edit_width = (LCD_PIXEL_WIDTH) / (EDIT_FONT_WIDTH);
|
||||
uint8_t lcd_chr_fit, one_chr_width;
|
||||
if (labellen <= lcd_edit_width - 1) {
|
||||
if (labellen + vallen + 1 > lcd_edit_width) extra_row = true;
|
||||
lcd_chr_fit = lcd_edit_width + 1;
|
||||
one_chr_width = EDIT_FONT_WIDTH;
|
||||
lcd_setFont(FONT_EDIT);
|
||||
}
|
||||
else {
|
||||
lcd_width = LCD_WIDTH - (START_COL);
|
||||
char_width = DOG_CHAR_WIDTH;
|
||||
lcd_chr_fit = LCD_WIDTH;
|
||||
one_chr_width = MENU_FONT_WIDTH;
|
||||
lcd_setFont(FONT_MENU);
|
||||
}
|
||||
#else
|
||||
constexpr uint8_t lcd_width = LCD_WIDTH - (START_COL),
|
||||
char_width = DOG_CHAR_WIDTH;
|
||||
constexpr uint8_t lcd_chr_fit = LCD_WIDTH,
|
||||
one_chr_width = MENU_FONT_WIDTH;
|
||||
#endif
|
||||
|
||||
// Center either one or two rows
|
||||
const uint8_t segmentHeight = u8g.getHeight() / (rows + 1); // 1 / (rows+1) = 1/2 or 1/3
|
||||
uint8_t baseline = segmentHeight + (DOG_CHAR_HEIGHT_EDIT + 1) / 2;
|
||||
// Center the label and value lines on the middle line
|
||||
uint8_t baseline = extra_row ? (LCD_PIXEL_HEIGHT) / 2
|
||||
: (LCD_PIXEL_HEIGHT + EDIT_FONT_ASCENT) / 2;
|
||||
|
||||
bool onpage = PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline);
|
||||
// Assume the label is alpha-numeric (with a descender)
|
||||
bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT);
|
||||
if (onpage) {
|
||||
lcd_moveto(0, baseline);
|
||||
lcd_put_u8str_P(pstr);
|
||||
}
|
||||
|
||||
// If a value is included, print a colon, then print the value right-justified
|
||||
if (value != NULL) {
|
||||
lcd_put_wchar(':');
|
||||
if (rows == 2) {
|
||||
baseline += segmentHeight;
|
||||
onpage = PAGE_CONTAINS(baseline + 1 - (DOG_CHAR_HEIGHT_EDIT), baseline);
|
||||
if (extra_row) {
|
||||
// Assume the value is numeric (with no descender)
|
||||
baseline += EDIT_FONT_ASCENT;
|
||||
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
|
||||
}
|
||||
if (onpage) {
|
||||
lcd_moveto(((lcd_width - 1) - (vallen + 1)) * char_width, baseline); // Right-justified, leaving padded by spaces
|
||||
lcd_moveto(((lcd_chr_fit - 1) - (vallen + 1)) * one_chr_width, baseline); // Right-justified, leaving padded by spaces
|
||||
lcd_put_wchar(' '); // overwrite char if value gets shorter
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
|
@ -407,7 +404,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
|
||||
if (!PAGE_CONTAINS(row_y1, row_y2)) return;
|
||||
|
||||
constexpr uint8_t maxlen = LCD_WIDTH - (START_COL) - 1;
|
||||
constexpr uint8_t maxlen = LCD_WIDTH - 1;
|
||||
const char *outstr = theCard.longest_filename();
|
||||
if (theCard.longFilename[0]) {
|
||||
#if ENABLED(SCROLL_LONG_FILENAMES)
|
||||
|
@ -432,9 +429,9 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
|
|||
if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
|
||||
|
||||
int n;
|
||||
n = lcd_put_u8str_max(outstr, maxlen * (DOG_CHAR_WIDTH));
|
||||
n = maxlen * (DOG_CHAR_WIDTH) - n;
|
||||
while (n - DOG_CHAR_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
n = lcd_put_u8str_max(outstr, maxlen * (MENU_FONT_WIDTH));
|
||||
n = maxlen * (MENU_FONT_WIDTH) - n;
|
||||
while (n - MENU_FONT_WIDTH > 0) { n -= lcd_put_wchar(' '); }
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
|
|
@ -132,25 +132,9 @@
|
|||
#include "dogm/HAL_LCD_class_defines.h"
|
||||
extern U8G_CLASS u8g;
|
||||
|
||||
// DOGM font sizes
|
||||
#define DOG_CHAR_WIDTH 6
|
||||
#define DOG_CHAR_HEIGHT 12
|
||||
#if ENABLED(USE_BIG_EDIT_FONT)
|
||||
#define FONT_MENU_EDIT_NAME u8g_font_9x18
|
||||
#define DOG_CHAR_WIDTH_EDIT 9
|
||||
#define DOG_CHAR_HEIGHT_EDIT 18
|
||||
#else
|
||||
#define FONT_MENU_EDIT_NAME FONT_MENU_NAME
|
||||
#define DOG_CHAR_WIDTH_EDIT DOG_CHAR_WIDTH
|
||||
#define DOG_CHAR_HEIGHT_EDIT DOG_CHAR_HEIGHT
|
||||
#endif
|
||||
|
||||
enum MarlinFont : uint8_t {
|
||||
FONT_STATUSMENU = 1,
|
||||
FONT_SPECIAL,
|
||||
FONT_MENU_EDIT,
|
||||
FONT_MENU,
|
||||
};
|
||||
// For selective rendering within a Y range
|
||||
#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
|
||||
#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
|
||||
|
||||
// Only Western languages support big / small fonts
|
||||
#if DISABLED(DISPLAY_CHARSET_ISO10646_1)
|
||||
|
@ -158,17 +142,41 @@
|
|||
#undef USE_SMALL_INFOFONT
|
||||
#endif
|
||||
|
||||
#define MENU_FONT_NAME ISO10646_1_5x7
|
||||
#define MENU_FONT_WIDTH 6
|
||||
#define MENU_FONT_ASCENT 10
|
||||
#define MENU_FONT_DESCENT 2
|
||||
#define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
|
||||
|
||||
#if ENABLED(USE_BIG_EDIT_FONT)
|
||||
#define EDIT_FONT_NAME u8g_font_9x18
|
||||
#define EDIT_FONT_WIDTH 9
|
||||
#define EDIT_FONT_ASCENT 10
|
||||
#define EDIT_FONT_DESCENT 3
|
||||
#else
|
||||
#define EDIT_FONT_NAME MENU_FONT_NAME
|
||||
#define EDIT_FONT_WIDTH MENU_FONT_WIDTH
|
||||
#define EDIT_FONT_ASCENT MENU_FONT_ASCENT
|
||||
#define EDIT_FONT_DESCENT MENU_FONT_DESCENT
|
||||
#endif
|
||||
#define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
|
||||
|
||||
// Get the Ascent, Descent, and total Height for the Info Screen font
|
||||
#if ENABLED(USE_SMALL_INFOFONT)
|
||||
extern const u8g_fntpgm_uint8_t u8g_font_6x9[];
|
||||
#define INFO_FONT_HEIGHT 7
|
||||
#define INFO_FONT_ASCENT 7
|
||||
#else
|
||||
#define INFO_FONT_HEIGHT 8
|
||||
#define INFO_FONT_ASCENT 8
|
||||
#endif
|
||||
#define INFO_FONT_DESCENT 2
|
||||
#define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
|
||||
|
||||
// For selective rendering within a Y range
|
||||
#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
|
||||
#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
|
||||
|
||||
// Font IDs
|
||||
enum MarlinFont : uint8_t {
|
||||
FONT_STATUSMENU = 1,
|
||||
FONT_EDIT,
|
||||
FONT_MENU
|
||||
};
|
||||
void lcd_setFont(const MarlinFont font_nr);
|
||||
|
||||
#if ENABLED(LIGHTWEIGHT_UI)
|
||||
|
@ -251,8 +259,8 @@
|
|||
#endif
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
#define SETCURSOR(col, row) lcd_moveto(col * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT))
|
||||
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT))
|
||||
#define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
|
||||
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
|
||||
#else
|
||||
#define SETCURSOR(col, row) lcd_moveto(col, row)
|
||||
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row)
|
||||
|
|
Loading…
Reference in a new issue