Custom font set function (#2261)

* custom font set function
* update API symbols
* add example of custom font usage
* delete u8g2 dependency in example custom font
* rename to canvas_set_custom_u8g2_font
* now change the name in ALL places

Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
This commit is contained in:
LTVA1
2023-02-08 12:26:17 +03:00
committed by GitHub
parent 111c7557b3
commit 23ecc186c2
6 changed files with 124 additions and 2 deletions

View File

@@ -137,6 +137,12 @@ void canvas_set_font(Canvas* canvas, Font font) {
}
}
void canvas_set_custom_u8g2_font(Canvas* canvas, const uint8_t* font) {
furi_assert(canvas);
u8g2_SetFontMode(&canvas->fb, 1);
u8g2_SetFont(&canvas->fb, font);
}
void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str) {
furi_assert(canvas);
if(!str) return;

View File

@@ -146,6 +146,13 @@ void canvas_invert_color(Canvas* canvas);
*/
void canvas_set_font(Canvas* canvas, Font font);
/** Set custom drawing font
*
* @param canvas Canvas instance
* @param font Pointer to u8g2 const uint8_t* font array
*/
void canvas_set_custom_u8g2_font(Canvas* canvas, const uint8_t* font);
/** Draw string at position of baseline defined by x, y.
*
* @param canvas Canvas instance