From 744bcaee61a1e9cc7777561a8d1b4611cd36b5c4 Mon Sep 17 00:00:00 2001 From: Chris Pepper Date: Tue, 17 Apr 2018 23:28:55 +0100 Subject: [PATCH] [2.0.x] Fix problems compiling with Arduino IDE (#10441) * Fix problems compiling u8glib utf8 support on Arduino * Change header in auto-generated font data * Change include in font gen scripts --- .../src/lcd/dogm/dogm_font_data_ISO10646_1.h | 2 +- Marlin/src/lcd/dogm/language_data_an.h | 2 +- Marlin/src/lcd/dogm/language_data_bg.h | 2 +- Marlin/src/lcd/dogm/language_data_ca.h | 2 +- Marlin/src/lcd/dogm/language_data_cz.h | 2 +- Marlin/src/lcd/dogm/language_data_da.h | 2 +- Marlin/src/lcd/dogm/language_data_de.h | 2 +- Marlin/src/lcd/dogm/language_data_el-gr.h | 2 +- Marlin/src/lcd/dogm/language_data_el.h | 2 +- Marlin/src/lcd/dogm/language_data_en.h | 2 +- Marlin/src/lcd/dogm/language_data_es.h | 2 +- Marlin/src/lcd/dogm/language_data_eu.h | 2 +- Marlin/src/lcd/dogm/language_data_fi.h | 2 +- Marlin/src/lcd/dogm/language_data_fr.h | 2 +- Marlin/src/lcd/dogm/language_data_gl.h | 2 +- Marlin/src/lcd/dogm/language_data_hr.h | 2 +- Marlin/src/lcd/dogm/language_data_it.h | 2 +- Marlin/src/lcd/dogm/language_data_jp-kana.h | 2 +- Marlin/src/lcd/dogm/language_data_nl.h | 2 +- Marlin/src/lcd/dogm/language_data_pl.h | 2 +- Marlin/src/lcd/dogm/language_data_pt-br.h | 2 +- Marlin/src/lcd/dogm/language_data_pt.h | 2 +- Marlin/src/lcd/dogm/language_data_ru.h | 2 +- Marlin/src/lcd/dogm/language_data_sk.h | 2 +- Marlin/src/lcd/dogm/language_data_test.h | 2 +- Marlin/src/lcd/dogm/language_data_tr.h | 2 +- Marlin/src/lcd/dogm/language_data_uk.h | 2 +- Marlin/src/lcd/dogm/language_data_zh_CN.h | 2 +- Marlin/src/lcd/dogm/language_data_zh_TW.h | 2 +- Marlin/src/lcd/fontutils.cpp | 1 - .../lcd/{u8g_fontutf8.c => u8g_fontutf8.cpp} | 38 ++++++++++--------- Marlin/src/lcd/u8g_fontutf8.h | 2 +- buildroot/share/fonts/genallfont.sh | 3 -- buildroot/share/fonts/uxggenpages.sh | 2 +- 34 files changed, 52 insertions(+), 52 deletions(-) rename Marlin/src/lcd/{u8g_fontutf8.c => u8g_fontutf8.cpp} (91%) diff --git a/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h b/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h index b3aca0fc7e..8580675d59 100644 --- a/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h +++ b/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h @@ -20,7 +20,7 @@ * */ -#include +#include #if defined(__AVR__) && ENABLED(NOT_EXTENDED_ISO10646_1_5X7) // reduced font (only sysmbols 1 - 127) - saves about 1278 bytes of FLASH diff --git a/Marlin/src/lcd/dogm/language_data_an.h b/Marlin/src/lcd/dogm/language_data_an.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_an.h +++ b/Marlin/src/lcd/dogm/language_data_an.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_bg.h b/Marlin/src/lcd/dogm/language_data_bg.h index c0c7506f0e..47d82b032f 100644 --- a/Marlin/src/lcd/dogm/language_data_bg.h +++ b/Marlin/src/lcd/dogm/language_data_bg.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_8_144_149[96] U8G_FONT_SECTION("fontpage_8_144_149") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x90,0x95,0x00,0x07,0xff,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_ca.h b/Marlin/src/lcd/dogm/language_data_ca.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_ca.h +++ b/Marlin/src/lcd/dogm/language_data_ca.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_cz.h b/Marlin/src/lcd/dogm/language_data_cz.h index 6a1ddaa785..8766ff59c5 100644 --- a/Marlin/src/lcd/dogm/language_data_cz.h +++ b/Marlin/src/lcd/dogm/language_data_cz.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_2_140_141[49] U8G_FONT_SECTION("fontpage_2_140_141") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x8c,0x8d,0x00,0x0b,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_da.h b/Marlin/src/lcd/dogm/language_data_da.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_da.h +++ b/Marlin/src/lcd/dogm/language_data_da.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_de.h b/Marlin/src/lcd/dogm/language_data_de.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_de.h +++ b/Marlin/src/lcd/dogm/language_data_de.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_el-gr.h b/Marlin/src/lcd/dogm/language_data_el-gr.h index 9fe33be926..ad78f98671 100644 --- a/Marlin/src/lcd/dogm/language_data_el-gr.h +++ b/Marlin/src/lcd/dogm/language_data_el-gr.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_7_136_136[31] U8G_FONT_SECTION("fontpage_7_136_136") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x08,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_el.h b/Marlin/src/lcd/dogm/language_data_el.h index 1fbb29326a..f3c9a83c35 100644 --- a/Marlin/src/lcd/dogm/language_data_el.h +++ b/Marlin/src/lcd/dogm/language_data_el.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_7_136_136[31] U8G_FONT_SECTION("fontpage_7_136_136") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x00,0x08,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_en.h b/Marlin/src/lcd/dogm/language_data_en.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_en.h +++ b/Marlin/src/lcd/dogm/language_data_en.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_es.h b/Marlin/src/lcd/dogm/language_data_es.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_es.h +++ b/Marlin/src/lcd/dogm/language_data_es.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_eu.h b/Marlin/src/lcd/dogm/language_data_eu.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_eu.h +++ b/Marlin/src/lcd/dogm/language_data_eu.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_fi.h b/Marlin/src/lcd/dogm/language_data_fi.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_fi.h +++ b/Marlin/src/lcd/dogm/language_data_fi.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_fr.h b/Marlin/src/lcd/dogm/language_data_fr.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_fr.h +++ b/Marlin/src/lcd/dogm/language_data_fr.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_gl.h b/Marlin/src/lcd/dogm/language_data_gl.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_gl.h +++ b/Marlin/src/lcd/dogm/language_data_gl.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_hr.h b/Marlin/src/lcd/dogm/language_data_hr.h index 87bdabbe1f..5b82b71cb1 100644 --- a/Marlin/src/lcd/dogm/language_data_hr.h +++ b/Marlin/src/lcd/dogm/language_data_hr.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_2_135_135[32] U8G_FONT_SECTION("fontpage_2_135_135") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x87,0x87,0x00,0x09,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_it.h b/Marlin/src/lcd/dogm/language_data_it.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_it.h +++ b/Marlin/src/lcd/dogm/language_data_it.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_jp-kana.h b/Marlin/src/lcd/dogm/language_data_jp-kana.h index 77d129d66c..36a5c493f8 100644 --- a/Marlin/src/lcd/dogm/language_data_jp-kana.h +++ b/Marlin/src/lcd/dogm/language_data_jp-kana.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_97_161_164[61] U8G_FONT_SECTION("fontpage_97_161_164") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xa1,0xa4,0x00,0x06,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_nl.h b/Marlin/src/lcd/dogm/language_data_nl.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_nl.h +++ b/Marlin/src/lcd/dogm/language_data_nl.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_pl.h b/Marlin/src/lcd/dogm/language_data_pl.h index 4a8d9cba1e..61169b363f 100644 --- a/Marlin/src/lcd/dogm/language_data_pl.h +++ b/Marlin/src/lcd/dogm/language_data_pl.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_2_133_133[31] U8G_FONT_SECTION("fontpage_2_133_133") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x85,0x85,0x00,0x06,0xfe,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_pt-br.h b/Marlin/src/lcd/dogm/language_data_pt-br.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_pt-br.h +++ b/Marlin/src/lcd/dogm/language_data_pt-br.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_pt.h b/Marlin/src/lcd/dogm/language_data_pt.h index 02e2f8eaba..199099d25d 100644 --- a/Marlin/src/lcd/dogm/language_data_pt.h +++ b/Marlin/src/lcd/dogm/language_data_pt.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include #define FONTDATA_ITEM(page, begin, end, data) {page, begin, end, NUM_ARRAY(data), data} static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { diff --git a/Marlin/src/lcd/dogm/language_data_ru.h b/Marlin/src/lcd/dogm/language_data_ru.h index f0b2b54615..1b2cfd956d 100644 --- a/Marlin/src/lcd/dogm/language_data_ru.h +++ b/Marlin/src/lcd/dogm/language_data_ru.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_8_144_152[135] U8G_FONT_SECTION("fontpage_8_144_152") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x90,0x98,0x00,0x07,0xff,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_sk.h b/Marlin/src/lcd/dogm/language_data_sk.h index fcc6622a9f..f14ba65f9a 100644 --- a/Marlin/src/lcd/dogm/language_data_sk.h +++ b/Marlin/src/lcd/dogm/language_data_sk.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_2_140_143[80] U8G_FONT_SECTION("fontpage_2_140_143") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x8c,0x8f,0x00,0x0b,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_test.h b/Marlin/src/lcd/dogm/language_data_test.h index 346707b10a..59d34f8dcb 100644 --- a/Marlin/src/lcd/dogm/language_data_test.h +++ b/Marlin/src/lcd/dogm/language_data_test.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_8_128_255[1255] U8G_FONT_SECTION("fontpage_8_128_255") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x00,0x08,0xff,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_tr.h b/Marlin/src/lcd/dogm/language_data_tr.h index b0079ba87d..24badf62e4 100644 --- a/Marlin/src/lcd/dogm/language_data_tr.h +++ b/Marlin/src/lcd/dogm/language_data_tr.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_2_159_159[34] U8G_FONT_SECTION("fontpage_2_159_159") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x9f,0x9f,0x00,0x09,0xfe,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_uk.h b/Marlin/src/lcd/dogm/language_data_uk.h index d6b5e3253a..31621bf391 100644 --- a/Marlin/src/lcd/dogm/language_data_uk.h +++ b/Marlin/src/lcd/dogm/language_data_uk.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_8_134_134[30] U8G_FONT_SECTION("fontpage_8_134_134") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x86,0x86,0x00,0x07,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_zh_CN.h b/Marlin/src/lcd/dogm/language_data_zh_CN.h index 2155315312..bd8c7458ed 100644 --- a/Marlin/src/lcd/dogm/language_data_zh_CN.h +++ b/Marlin/src/lcd/dogm/language_data_zh_CN.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_69_191_191[41] U8G_FONT_SECTION("fontpage_69_191_191") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x0a,0x00,0x00, diff --git a/Marlin/src/lcd/dogm/language_data_zh_TW.h b/Marlin/src/lcd/dogm/language_data_zh_TW.h index 247627079c..2ddc891968 100644 --- a/Marlin/src/lcd/dogm/language_data_zh_TW.h +++ b/Marlin/src/lcd/dogm/language_data_zh_TW.h @@ -2,7 +2,7 @@ /* This file is generated automatically, any changes to the file may be REPLACED by future processing. */ /* Please turn to the tools call this script to change the contents! */ -#include +#include const u8g_fntpgm_uint8_t fontpage_69_191_191[41] U8G_FONT_SECTION("fontpage_69_191_191") = { 0x00,0x06,0x0a,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x0a,0x00,0x00, diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index 2fc5cad3f9..39f47bde33 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -7,7 +7,6 @@ * @copyright GPL/BSD */ -#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfig.h" #if ENABLED(ULTRA_LCD) diff --git a/Marlin/src/lcd/u8g_fontutf8.c b/Marlin/src/lcd/u8g_fontutf8.cpp similarity index 91% rename from Marlin/src/lcd/u8g_fontutf8.c rename to Marlin/src/lcd/u8g_fontutf8.cpp index 8c0827582c..4e0b17088c 100644 --- a/Marlin/src/lcd/u8g_fontutf8.c +++ b/Marlin/src/lcd/u8g_fontutf8.cpp @@ -7,25 +7,27 @@ * @copyright GPL/BSD */ +#include "../inc/MarlinConfig.h" + +#if ENABLED(ULTRA_LCD) + #include #include "fontutils.h" #include "u8g_fontutf8.h" //////////////////////////////////////////////////////////// -#define font_t void +typedef void font_t; #ifndef PSTR #define PSTR(a) a -void * -memcpy_from_rom(void *dest, const void * rom_src, size_t sz) -{ +void* memcpy_from_rom(void *dest, const void * rom_src, size_t sz) { uint8_t * p; uint8_t * s; FU_ASSERT(NULL != dest); - p = dest; - s = rom_src; + p = (uint8_t*)dest; + s = (uint8_t*)rom_src; uint8_t c; while ((p - (uint8_t *)dest) < sz) { *p = pgm_read_byte(s); @@ -79,7 +81,7 @@ static int pf_bsearch_cb_comp_fntifo_pgm (void *userdata, size_t idx, void *data uxg_fontinfo_t *fntinfo = (uxg_fontinfo_t*)userdata; uxg_fontinfo_t localval; memcpy_from_rom(&localval, fntinfo + idx, sizeof(localval)); - return fontinfo_compare(&localval, data_pin); + return fontinfo_compare(&localval, (uxg_fontinfo_t*)data_pin); } typedef struct _font_group_t { @@ -95,7 +97,7 @@ static int fontgroup_init(font_group_t * root, const uxg_fontinfo_t * fntinfo, i } static const font_t* fontgroup_find(font_group_t * root, wchar_t val) { - uxg_fontinfo_t vcmp = {val / 128, val % 128 + 128, val % 128 + 128, 0, 0}; + uxg_fontinfo_t vcmp = {(uint16_t)(val / 128), (uint8_t)(val % 128 + 128), (uint8_t)(val % 128 + 128), 0, 0}; size_t idx = 0; if (val < 256) return NULL; @@ -178,11 +180,11 @@ struct _uxg_drawu8_data_t { }; static int fontgroup_cb_draw_u8g (void *userdata, const font_t *fnt_current, const char *msg) { - struct _uxg_drawu8_data_t * pdata = userdata; + struct _uxg_drawu8_data_t * pdata = (_uxg_drawu8_data_t*)userdata; FU_ASSERT(NULL != userdata); if (pdata->fnt_prev != fnt_current) { - u8g_SetFont(pdata->pu8g, fnt_current); + u8g_SetFont(pdata->pu8g, (const u8g_fntpgm_uint8_t*)fnt_current); //u8g_SetFontPosBottom(pdata->pu8g); pdata->fnt_prev = fnt_current; } @@ -225,7 +227,7 @@ unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t data.max_width = max_width; data.fnt_prev = NULL; fontgroup_drawwchar(group, fnt_default, ch, (void*)&data, fontgroup_cb_draw_u8g); - u8g_SetFont(pu8g, fnt_default); + u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default); return data.adv; } @@ -259,7 +261,7 @@ unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const data.max_width = max_width; data.fnt_prev = NULL; fontgroup_drawstring(group, fnt_default, utf8_msg, strlen(utf8_msg), read_byte_ram, (void*)&data, fontgroup_cb_draw_u8g); - u8g_SetFont(pu8g, fnt_default); + u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default); return data.adv; } @@ -296,18 +298,18 @@ unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, const TRACE("call fontgroup_drawstring"); fontgroup_drawstring(group, fnt_default, utf8_msg, my_strlen_P(utf8_msg), read_byte_rom, (void*)&data, fontgroup_cb_draw_u8g); TRACE("restore font"); - u8g_SetFont(pu8g, fnt_default); + u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default); TRACE("return %d", data.adv); return data.adv; } static int fontgroup_cb_draw_u8gstrlen(void *userdata, const font_t *fnt_current, const char *msg) { - struct _uxg_drawu8_data_t * pdata = userdata; + struct _uxg_drawu8_data_t * pdata = (_uxg_drawu8_data_t*)userdata; FU_ASSERT(NULL != userdata); if (pdata->fnt_prev != fnt_current) { - u8g_SetFont(pdata->pu8g, fnt_current); + u8g_SetFont(pdata->pu8g, (const u8g_fntpgm_uint8_t*)fnt_current); u8g_SetFontPosBottom(pdata->pu8g); pdata->fnt_prev = fnt_current; } @@ -339,7 +341,7 @@ int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg) { data.pu8g = pu8g; data.adv = 0; fontgroup_drawstring(group, fnt_default, utf8_msg, strlen(utf8_msg), read_byte_ram, (void*)&data, fontgroup_cb_draw_u8gstrlen); - u8g_SetFont(pu8g, fnt_default); + u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default); return data.adv; } @@ -367,6 +369,8 @@ int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg) { data.pu8g = pu8g; data.adv = 0; fontgroup_drawstring(group, fnt_default, utf8_msg, my_strlen_P(utf8_msg), read_byte_rom, (void*)&data, fontgroup_cb_draw_u8gstrlen); - u8g_SetFont(pu8g, fnt_default); + u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default); return data.adv; } + +#endif // ENABLED(ULTRA_LCD) diff --git a/Marlin/src/lcd/u8g_fontutf8.h b/Marlin/src/lcd/u8g_fontutf8.h index 3df9907c19..9d3c46c6a5 100644 --- a/Marlin/src/lcd/u8g_fontutf8.h +++ b/Marlin/src/lcd/u8g_fontutf8.h @@ -9,7 +9,7 @@ #ifndef _UXG_FONTUTF8_H #define _UXG_FONTUTF8_H 1 -#include +#include #include "fontutils.h" #ifdef __cplusplus diff --git a/buildroot/share/fonts/genallfont.sh b/buildroot/share/fonts/genallfont.sh index 0d382da425..ba8fddbc94 100755 --- a/buildroot/share/fonts/genallfont.sh +++ b/buildroot/share/fonts/genallfont.sh @@ -101,10 +101,7 @@ EOF #endif EOF - sed -e 's|#include "u8g.h"|#include |' -i tmp3.h cd .. mv ${DN_WORK}/tmp3.h src/lcd/dogm/dogm_font_data_ISO10646_1.h fi - - diff --git a/buildroot/share/fonts/uxggenpages.sh b/buildroot/share/fonts/uxggenpages.sh index b98595472f..227fdf1b37 100755 --- a/buildroot/share/fonts/uxggenpages.sh +++ b/buildroot/share/fonts/uxggenpages.sh @@ -154,7 +154,7 @@ echo "/* Generated by $0 */" >> fontutf8-data.h echo "/* This file is generated automatically, any changes to the file may be REPLACED by future processing. */" >> fontutf8-data.h echo "/* Please turn to the tools call this script to change the contents! */" >> fontutf8-data.h echo "" >> fontutf8-data.h -echo "#include " >> fontutf8-data.h +echo "#include " >> fontutf8-data.h #echo "#include \"fontutf8u8g.h\"" >> fontutf8-data.h echo "" >> fontutf8-data.h cat tmpa >> fontutf8-data.h