Skip to main content
defacato
Associate II
September 10, 2020
Question

Help with using a custom font in STemWin.

  • September 10, 2020
  • 0 replies
  • 1118 views

Hi all. I am currently working on a project using my STM3220G board with a 3.2 " TFT and STemWin. I have made a custom font with only the hebrew alphabet in the font. The font .c file is below:

/*********************************************************************
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
* www.segger.com *
**********************************************************************
* *
* C-file generated by *
* *
* emWin Font Converter (ST) version 5.32 *
* Compiled Oct 8 2015, 11:58:55 *
* *
* (c) 1998 - 2015 Segger Microcontroller GmbH & Co. KG *
* *
**********************************************************************
* *
* Source file: Qabchars.c *
* Font: Lucida Sans Unicode *
* Height: 16 *
* *
**********************************************************************
* *
* Initial font height: 16 *
* Character disabled: 0x5D0 (1488) *
* Character enabled: 0x5D0 (1488) *
* Range enabled: 05D0 - 05EA *
* Range enabled: 05D0 - 05EA *
* Range disabled: 0000 - FFFF *
* Range enabled: 05D0 - 05EA *
* *
**********************************************************************
*/
 
#include "GUI.h"
 
#ifndef GUI_CONST_STORAGE
 #define GUI_CONST_STORAGE const
#endif
 
/* The following line needs to be included in any file selecting the
 font.
*/
extern GUI_CONST_STORAGE GUI_FONT GUI_FontQabchars;
 
/* Start of unicode area */
GUI_CONST_STORAGE unsigned char aleph[ 32] = { /* code 05D0, HEBREW LETTER ALEF */
 ________,________,
 ________,________,
 ________,________,
 ________,________,
 ________,________,
 ________,________,
 _***__XX,________,
 __***_XX,________,
 __XXXXXX,________,
 _XX_***_,________,
 _XX__XX_,________,
 _XX__***,________,
 _XX___XX,________,
 ________,________,
 ________,________,
 ________,________};
 
GUI_CONST_STORAGE unsigned char beit[ 16] = { /* code 05D1, HEBREW LETTER BET */
 ________,
 ________,
 ________,
 ________,
 ________,
 ________,
 _XXXXX__,
 ____XX__,
 ____XX__,
 ____XX__,
 ____XX__,
 ____XX__,
 XXXXXXX_,
 ________,
 ________,
 ________};
 
GUI_CONST_STORAGE unsigned char gimel[ 16] = { /* code 05D2, HEBREW LETTER GIMEL */
 ________,
 ________,
 ________,
 ________,
 ________,
 ________,
 ___XX___,
 ___***__,
 ____XX__,
 ____XX__,
 ____XX__,
 __XXXX__,
 _XX_XX__,
 ________,
 ________,
 ________};
 
GUI_CONST_STORAGE unsigned char daleth[ 16] = { /* code 05D3, HEBREW LETTER DALET */
 ________,
 ________,
 ________,
 ________,
 ________,
 ________,
 XXXXXXX_,
 ____XX__,
 ____XX__,
 ____XX__,
 ____XX__,
 ____XX__,
 ____XX__,
 ________,
 ________,
 ________};
 
GUI_CONST_STORAGE unsigned char heh[ 32] = { /* code 05D4, HEBREW LETTER HE */
 ________,________,
 ________,________,
 ________,________,
 ________,________,
 ________,________,
 ________,________,
 XXXXXXXX,________,
 ______XX,________,
 _XX___XX,________,
 _XX___XX,________,
 _XX___XX,________,
 _XX___XX,________,
 _XX___XX,________,
 ________,________,
 ________,________,
 ________,________};
 
GUI_CONST_STORAGE unsigned char vav[ 16] = { /* code 05D5, HEBREW LETTER VAV */
 ________,
 ________,
 ________,
 ________,
 ________,
 ________,
 ***_____,
 __XX____,
 __XX____,
 __XX____,
 __XX____,
 __XX____,
 __XX____,
 ________,
 ________,
 ________};
 
 
 
GUI_CONST_STORAGE GUI_CHARINFO GUI_FontQabchars_CharInfo[27] = {
 { 9, 9, 2, aleph } /* code 05D0 */
 ,{ 8, 8, 1, beit } /* code 05D1 */
 ,{ 6, 6, 1, gimel } /* code 05D2 */
 ,{ 7, 7, 1, daleth } /* code 05D3 */
 ,{ 10, 10, 2, heh } /* code 05D4 */
 ,{ 5, 5, 1, vav } /* code 05D5 */
 ,{ 5, 5, 1, zain } /* code 05D6 */
 ,{ 10, 10, 2, chet } /* code 05D7 */
 ,{ 9, 9, 2, tet } /* code 05D8 */
 ,{ 5, 5, 1, yod } /* code 05D9 */
 ,{ 7, 7, 1, caph_sofit } /* code 05DA */
 ,{ 8, 8, 1, caph } /* code 05DB */
 ,{ 7, 7, 1, lamed } /* code 05DC */
 ,{ 10, 10, 2, mem_sofit } /* code 05DD */
 ,{ 9, 9, 2, mem } /* code 05DE */
 ,{ 5, 5, 1, nun_sofit } /* code 05DF */
 ,{ 6, 6, 1, nun } /* code 05E0 */
 ,{ 9, 9, 2, samekh } /* code 05E1 */
 ,{ 8, 8, 1, ayin } /* code 05E2 */
 ,{ 7, 7, 1, peh_sofit } /* code 05E3 */
 ,{ 8, 8, 1, peh } /* code 05E4 */
 ,{ 7, 7, 1, tsadi_sofit } /* code 05E5 */
 ,{ 8, 8, 1, tsadi } /* code 05E6 */
 ,{ 9, 9, 2, qoph } /* code 05E7 */
 ,{ 7, 7, 1, resh } /* code 05E8 */
 ,{ 10, 10, 2, shin } /* code 05E9 */
 ,{ 9, 9, 2, tau } /* code 05EA */
};
 
GUI_CONST_STORAGE GUI_FONT_PROP GUI_FontQabchars_Prop1 = {
 0x05D0 /* first character */
 ,0x05EA /* last character */
 ,&GUI_FontQabchars_CharInfo[ 0] /* address of first character */
 ,(GUI_CONST_STORAGE GUI_FONT_PROP *)0 /* pointer to next GUI_FONT_PROP */
};
 
GUI_CONST_STORAGE GUI_FONT GUI_FontQabchars = {
 GUI_FONTTYPE_PROP /* type of font */
 ,16 /* height of font */
 ,16 /* space of font y */
 ,1 /* magnification x */
 ,1 /* magnification y */
 ,{&GUI_FontQabchars_Prop1}
 ,13 /* Baseline */
 ,6 /* Height of lowercase characters */
 ,9 /* Height of capital characters */
};
 

This is a snippet because of the size. I would like to know how I would incorporate this into my code so I can simply print characters to the LCD. I am using STM32 Cube IDE and the Stemwin library. If anyone has experience with using custom fonts in Stemwin, please can you help?

Thanks,

Steve.

This topic has been closed for replies.