From 4a239ede79c43cf22e8f769a4ea086687a65c3f0 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Fri, 17 Jul 2020 20:29:41 +0200 Subject: use u8g2 for font rendering, as they support fonts with umlauts --- src/main.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 70f2559..ee7435a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,5 @@ #include -#include -#include +#include #include #include "calendar.h" @@ -22,6 +21,12 @@ */ GxEPD2_BW display(GxEPD2_420(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25)); +U8G2_FOR_ADAFRUIT_GFX u8g2Fonts; + +extern GxEPD2_GFX_BASE_CLASS &get_display() { + return display; +} + void board_spi_setup() { /* board-specific setup */ @@ -32,18 +37,19 @@ void board_spi_setup() { void display_setup() { display.init(); board_spi_setup(); + u8g2Fonts.begin(display); } void draw() { display.setRotation(1); - display.setFont(&FreeSans9pt7b); - display.setTextColor(GxEPD_BLACK); + u8g2Fonts.setBackgroundColor(GxEPD_WHITE); + u8g2Fonts.setForegroundColor(GxEPD_BLACK); display.firstPage(); do { display.fillScreen(GxEPD_WHITE); - draw_calendar(display, 30, 30); - draw_qrcode_wlan(display, 30, 200, wifi_ssid, wifi_psk); + draw_calendar(30, 30); + draw_qrcode_wlan(30, 200, wifi_ssid, wifi_psk); } while(display.nextPage()); } -- cgit v1.2.3