LCDGFX LCD display driver  1.1.5
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
NanoFont Class Reference

#include <font.h>

Public Member Functions

 NanoFont ()
 
 NanoFont (const uint8_t *progmemFont)
 
void loadFixedFont (const uint8_t *progmemFont)
 
void loadFreeFont (const uint8_t *progmemFont)
 
void loadSecondaryFont (const uint8_t *progmemUnicode)
 
void getCharBitmap (uint16_t ch, SCharInfo *info)
 returns char data for currently set (active) font. More...
 
lcduint_t getTextSize (const char *text, lcduint_t *height=nullptr)
 returns text width in pixels (and its height if height is requested) More...
 
const SFontHeaderRecordgetHeader ()
 
void setSpacing (uint8_t spacing)
 
uint8_t getPages ()
 

Static Public Member Functions

static uint16_t unicode16FromUtf8 (uint8_t ch)
 

Detailed Description

NanoFont class implements work with fonts provided by the library: loading fonts, providing their parameters

Definition at line 45 of file font.h.

Constructor & Destructor Documentation

◆ NanoFont() [1/2]

NanoFont::NanoFont ( )
inline

Creates empty NanoFont object. Please, use loadFixedFont(), loadFreeFont(), loadSecondaryFont() functions after creating the object.

Definition at line 53 of file font.h.

◆ NanoFont() [2/2]

NanoFont::NanoFont ( const uint8_t *  progmemFont)
inlineexplicit

Creates NanoFont object and loads font of fixed type from flash memory

Definition at line 60 of file font.h.

Member Function Documentation

◆ getCharBitmap()

void NanoFont::getCharBitmap ( uint16_t  ch,
SCharInfo info 
)

returns char data for currently set (active) font.

Function returns char data for currently set font: pointer to progmem data for specified char, and width, height of the char. You can use these data to draw char manually using NanoDisplayOps1::drawBitmap1(), NanoDisplayOps8::drawBitmap1(), NanoDisplayOps16::drawBitmap1() or NanoCanvasOps::drawBitmap1().

Parameters
chchar to read from set font
infopointer to SCharInfo structure to fill with char data
See also
loadFixedFont

◆ getHeader()

const SFontHeaderRecord& NanoFont::getHeader ( )
inline

Returns reference to SFontHeaderRecord. This record contains some useful information on font like width, height, etc.

Definition at line 142 of file font.h.

◆ getPages()

uint8_t NanoFont::getPages ( )
inline

Returns how many pages in terms of ssd1306 display are required for the font height.

Definition at line 161 of file font.h.

◆ getTextSize()

lcduint_t NanoFont::getTextSize ( const char *  text,
lcduint_t height = nullptr 
)

returns text width in pixels (and its height if height is requested)

Returns text width in pixels (and its height if height is requested)

Parameters
textpointer to null-terminated string
heightpointer to lcduint_t variable to store height to. nullptr if height is not required

◆ loadFixedFont()

void NanoFont::loadFixedFont ( const uint8_t *  progmemFont)

Function allows to set another fixed font for the library. By default, the font supports only first 128 - 32 ascii chars. Please refer to github wiki on how to generate new fonts.

Parameters
progmemFont- font to setup located in Flash area

◆ loadFreeFont()

void NanoFont::loadFreeFont ( const uint8_t *  progmemFont)

Function allows to set another free font for the library. By default, the font supports only first 128 - 32 ascii chars. Please refer to github wiki on how to generate new fonts.

Parameters
progmemFont- font to setup located in Flash area

◆ loadSecondaryFont()

void NanoFont::loadSecondaryFont ( const uint8_t *  progmemUnicode)

Function allows sets secondary font for specific language. Use it if you want to use additional font to combine capabilities of ascii fonts and language specific font.

Parameters
progmemUnicodefont containing unicode table (refer to ssd1306xled_font6x8_German as example).

◆ setSpacing()

void NanoFont::setSpacing ( uint8_t  spacing)
inline

Sets spacing in pixels between 2 nearest characters

Parameters
spacingspacing in pixels

Definition at line 152 of file font.h.

◆ unicode16FromUtf8()

static uint16_t NanoFont::unicode16FromUtf8 ( uint8_t  ch)
static

Returns 16-bit unicode char, encoded in utf8 SSD1306_MORE_CHARS_REQUIRED if more characters is expected

Parameters
chcharacter byte to decode
Returns
16-bit unicode char, encoded in utf8 SSD1306_MORE_CHARS_REQUIRED if more characters is expected

The documentation for this class was generated from the following file: