Table of Contents
Introduction
This chapters shows how to create and add custom fonts and how to use them in C. By default, only Arial 16 and Arial 22 are available.
LCD Image Converter
Configuration
Starting LCD Image Converter
for the first time, the configuration file MRS_Config_Font.xml
needs to be imported like shown in LCD Image Converter Configuration.
Add New Fonts
The following illustrated instructions will show you how to create own fonts and how to add them to the Applics project.
Adjustment Sourcecode
- Save the created sourcefile
Courier_24.c
in theuser_sources
folder of the Applics project:
Path: xxx\MCONN_MINI_2_4_D2_Demoproject\src\app\user_sources\Courier_24.c
- Open
fonts.h
and add the declaration belowextern const tFont Arial_16;
:
Path: xxx\MCONN_MINI_2_4_D2_Demoproject\src\dfl\glcd\fonts.h
extern const tFont Arial_16;
extern const tFont Courier_24; // add new font
- Open
board_lcd_api.h
and add the enumLCD_FONT_COURIER_24,
:
Path: xxx\MCONN_MINI_2_4_D2_Demoproject\src\app\board_user_api\board_lcd_api.h
typedef enum{
LCD_FONT_ARIAL_16,
LCD_FONT_ARIAL_22,
LCD_FONT_COURIER_24, // add new font
LCD_FONT_MAX
}enum_lcd_fonts_t;
- Open
board_lcd_api.c
and add, &Courier_24};
to the declaration:
Path: xxx\MCONN_MINI_2_4_D2_Demoproject\src\app\board_user_api\board_lcd_api.c
const tFont *fonts_array[LCD_FONT_MAX] = {&Arial_16, &Arial_22, &MRS_Font_Demo}; // before
const tFont *fonts_array[LCD_FONT_MAX] = {&Arial_16, &Arial_22, &MRS_Font_Demo, &Courier_24}; // after
- Now the setup is finished and the new font can be called with the function
board_lcd_print_text();
:
board_lcd_print_text( 30, 30, "This is Courier 24", LCD_FONT_COURIER_24, LCD_COLOR_BLACK, LCD_COLOR_WHITE);