-
Notifications
You must be signed in to change notification settings - Fork 1
Text and Fonts
The print stream is used to put text on the display. So you can use tft.print() and tft.println().
Below you'll find a whole list of functions to select fonts, define line & character spacing and control the cursor position. External fonts are included as C source files. There are several fonts included with the library and users can convert computer fonts with a conversation tool. The RA8875 driver (used in the 5.0" and 9.0" XG8800) also has a build-in 'internal' font and a font RAM to store up to 256 characters. The advantages of those build-in fonts is that they render quicker and don't require CPU memory space.
Select the RA8875 internal font
void setFont(void)
Select an external font
void setFont(const tFont *font)
- font: is a pointer to the font structure. You must include an external font C source file which includes this font structure. Several example fonts are included with the library.
void setFontInterline(uint8_t pix)
- pix: number of pixels between text lines (0 ... 63)
void setFontSpacing(uint8_t spc)
- spc: the number of pixels in between characters (0 ... 63)
void setFontScale(uint8_t scale)
void setFontScale(uint8_t xscale,uint8_t yscale)
- scale: sets the scale for fonts.
- xscale: sets the horizontal scale for fonts.
- yscale: sets the vertical scale for fonts.
For internal fonts the scale is limited to (0 (1x) ... 3 (4x)
uint8_t getFontWidth(boolean inColums)
uint8_t getFontHeight(boolean inRows)
Returns the current fonts width or height in pixels (parameter is FALSE) or columns/rows (parameter is TRUE). If the font is scaled it will use the scaled values.
void setCursor(int16_t x, int16_t y,bool autocenter)
- x: horizontal pixel position or CENTER (which will center the cursor in the horizontal direction)
- y: vertical pixel position or CENTER (which will center the cursor in the vertical direction)
- autocenter: FALSE: |ABCD
- autocenter: TRUE: AB|CD
void getCursorFast(int16_t &x, int16_t &y)
int16_t getCursorX(void)
int16_t getCursorY(void)
- x: returns the horizontal position of the cursor in pixels
- y: returns the vertical position of the cursor in pixels
void showCursor(enum RA8875tcursor c, bool blink)
- c: cursor type: NOCURSOR, IBEAM, UNDER, BLOCK
- blink: TRUE = blinking cursor
The cursor is only visible when the RA8875 internal font is used.
void setCursorBlinkRate(uint8_t rate)
- rate: changes the blink rate (fast 0 ... 255 slow)
void XGLCD::cursorIncrement(bool on)
- bool: TRUE/FALSE: enable/disable auto-incrementation of the cursor
void setFontFullAlign(boolean align)
- align: TRUE or FALSE
void setIntFontCoding(enum RA8875fontCoding f)
- f: ISO_IEC_8859_1, ISO_IEC_8859_2, ISO_IEC_8859_3, ISO_IEC_8859_4
Refer to the RA8875 datasheet to understand the different font encodings. The default encoding is ISO_IEC_8859_1.
void uploadUserChar(const uint8_t symbol[],uint8_t address)
- symbol: a 16 byte array which contains the character graphical data
- address: address to store the symbol in the font RAM (0 ... 255)
void showUserChar(uint8_t symbolAddrs,uint8_t wide)
- symbolAddrs: address of the symbol in the font RAM (0 ... 255)
- wide: number of consequent symbols to be shown. Several font RAM symbols can be combined to make one larger symbol (0 ... 255)
- XGLCD Library Reference
- [Display and Windows](https://github.com/xgraph/xg8800/wiki/Display and Windows)
- [Graphic Primitives](https://github.com/xgraph/xg8800/wiki/Graphic Primitives)
- [Text and Fonts](https://github.com/xgraph/xg8800/wiki/Text and Fonts)
- Colors
- Touchscreen
- Scrolling
- Layers
- [Block Transfer Engine](https://github.com/xgraph/xg8800/wiki/Block Transfer Engine)