18 #ifdef HAVE_LANGUAGE_PACK
25 #define PIC_CHAR(x) ((const nbgl_font_character_t *) PIC(x))
26 #define PIC_BMP(x) ((uint8_t const *) PIC(x))
28 #ifndef HAVE_LANGUAGE_PACK
29 #define LANGUAGE_PACK void
37 #define SMALL_REGULAR_FONT BAGL_FONT_INTER_REGULAR_24px
38 #define SMALL_BOLD_FONT BAGL_FONT_INTER_SEMIBOLD_24px
39 #define LARGE_MEDIUM_FONT BAGL_FONT_INTER_MEDIUM_32px
40 #define SMALL_REGULAR_1BPP_FONT BAGL_FONT_INTER_REGULAR_24px_1bpp
41 #define SMALL_BOLD_1BPP_FONT BAGL_FONT_INTER_SEMIBOLD_24px_1bpp
42 #define LARGE_MEDIUM_1BPP_FONT BAGL_FONT_INTER_MEDIUM_32px_1bpp
47 #define SMALL_REGULAR_FONT BAGL_FONT_INTER_REGULAR_28px
48 #define SMALL_BOLD_FONT BAGL_FONT_INTER_SEMIBOLD_28px
49 #define LARGE_MEDIUM_FONT BAGL_FONT_INTER_MEDIUM_36px
50 #define SMALL_REGULAR_1BPP_FONT BAGL_FONT_INTER_REGULAR_28px_1bpp
51 #define SMALL_BOLD_1BPP_FONT BAGL_FONT_INTER_SEMIBOLD_28px_1bpp
52 #define LARGE_MEDIUM_1BPP_FONT BAGL_FONT_INTER_MEDIUM_36px_1bpp
98 #define BAGL_ENCODING_LATIN1 0
99 #define BAGL_ENCODING_UTF8 1
100 #define BAGL_ENCODING_DEFAULT BAGL_ENCODING_UTF8
132 #if !defined(HAVE_LANGUAGE_PACK)
207 const char *origText,
218 #ifdef HAVE_UNICODE_SUPPORT
221 uint32_t nbgl_getUnicodeFontCharacterByteCount(
void);
228 #define IS_UNICODE(__value) ((__value) > 0xF0)
struct nbgl_unicode_ctx_s nbgl_unicode_ctx_t
void nbgl_textWrapOnNbLines(nbgl_font_id_e fontId, char *text, uint16_t maxWidth, uint8_t nbLines)
Modifies the given text to wrap it on the given max width (in pixels), in the given nbLines If possib...
void nbgl_getTextMaxLenAndWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, uint16_t *len, uint16_t *width, bool wrapping)
compute the max width of the first line of the given text fitting in maxWidth
uint16_t nbgl_getTextNbLines(const char *text)
return the number of lines in the given text, according to the found ' 's
uint8_t nbgl_getTextNbPagesInWidth(nbgl_font_id_e fontId, const char *text, uint8_t nbLinesPerPage, uint16_t maxWidth)
compute the number of pages of nbLinesPerPage lines per page of the given text fitting in the given m...
uint32_t nbgl_popUnicodeChar(const uint8_t **text, uint16_t *text_length, bool *is_unicode)
Get the coming unicode value on the given UTF-8 string. If the value is a simple ASCII character,...
uint16_t nbgl_getSingleLineTextWidth(nbgl_font_id_e fontId, const char *text)
return the max width in pixels of the given text until the first or \0 is encountered
const nbgl_font_t * nbgl_font_getFont(unsigned int fontId)
uint8_t nbgl_getCharWidth(nbgl_font_id_e fontId, const char *text)
return the width in pixels of the given UTF-8 character
bool nbgl_getTextMaxLenInNbLines(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, uint16_t maxNbLines, uint16_t *len, bool wrapping)
compute the len of the given text (in bytes) fitting in the given maximum nb lines,...
@ BAGL_FONT_OPEN_SANS_REGULAR_11px_1bpp
@ BAGL_FONT_INTER_REGULAR_28px_1bpp
@ BAGL_FONT_INTER_SEMIBOLD_28px
@ BAGL_FONT_INTER_REGULAR_24px_1bpp
@ BAGL_FONT_OPEN_SANS_EXTRABOLD_11px_1bpp
@ BAGL_FONT_INTER_REGULAR_24px
@ BAGL_FONT_INTER_REGULAR_28px
@ BAGL_FONT_INTER_MEDIUM_32px
@ BAGL_FONT_INTER_MEDIUM_36px
@ BAGL_FONT_INTER_MEDIUM_36px_1bpp
@ BAGL_FONT_INTER_SEMIBOLD_24px
@ BAGL_FONT_INTER_MEDIUM_32px_1bpp
@ BAGL_FONT_OPEN_SANS_LIGHT_16px_1bpp
@ BAGL_FONT_INTER_SEMIBOLD_24px_1bpp
@ BAGL_FONT_INTER_SEMIBOLD_28px_1bpp
bool nbgl_getTextMaxLenAndWidthFromEnd(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, uint16_t *len, uint16_t *width)
compute the len and width of the given text fitting in the maxWidth, starting from end of text
uint8_t nbgl_getFontHeight(nbgl_font_id_e fontId)
return the height in pixels of the font with the given font ID
void nbgl_textReduceOnNbLines(nbgl_font_id_e fontId, const char *origText, uint16_t maxWidth, uint8_t nbLines, char *reducedText, uint16_t reducedTextLen)
Create a reduced version of given ASCII text to wrap it on the given max width (in pixels),...
uint16_t nbgl_getTextWidth(nbgl_font_id_e fontId, const char *text)
return the max width in pixels of the given text (can be multiline)
uint16_t nbgl_getTextHeightInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
return the height of the given multiline text, with the given font.
uint16_t nbgl_getTextLength(const char *text)
return the number of bytes of the given text, excluding final ' ' or '\0'
uint16_t nbgl_getTextNbLinesInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
compute the number of lines of the given text fitting in the given maxWidth
uint16_t nbgl_getTextHeight(nbgl_font_id_e fontId, const char *text)
return the height of the given multiline text, with the given font.
const nbgl_font_t * nbgl_getFont(nbgl_font_id_e fontId)
return the non-unicode font corresponding to the given font ID
uint8_t nbgl_getFontLineHeight(nbgl_font_id_e fontId)
return the height in pixels of the line of font with the given font ID
uint16_t nbgl_getSingleLineTextWidthInLen(nbgl_font_id_e fontId, const char *text, uint16_t maxLen)
return the max width in pixels of the given text until the first or \0 is encountered,...
common types for Graphical Library
fonts nicknames to be used for various wallet size targets (non-Nano)
uint32_t width
width of character in pixels
uint32_t encoding
method used to encode bitmap data
uint32_t x_min_offset
x_min = x_min_offset
uint32_t bitmap_offset
offset of this character in chars buffer
uint32_t y_min_offset
y_min = (y_min + y_min_offset)
uint32_t x_max_offset
x_max = width - x_max_offset
uint32_t y_max_offset
y_max = (height - y_max_offset)
structure defining an ASCII font
uint8_t char_kerning
kerning for the font
uint8_t crop
If false, x_min_offset+y_min_offset=bytes to skip.
uint8_t first_char
ASCII code of the first character in bitmap and in characters fields.
uint8_t font_id
ID of the font, from nbgl_font_id_e.
uint32_t bitmap_len
Size in bytes of the associated bitmap.
uint8_t const * bitmap
array containing bitmaps of all characters
const nbgl_font_character_t *const characters
array containing definitions of all characters
uint8_t height
height of all characters in pixels
uint8_t line_height
height of a line for all characters in pixels
uint8_t last_char
ASCII code of the last character in bitmap and in characters fields.
uint8_t y_min
Most top Y coordinate of any char in the font.
uint8_t bpp
number of bits per pixels
structure defining a unicode character (except the bitmap)
uint32_t encoding
method used to encode bitmap data
uint32_t char_unicode
plane value from 0 to 16 then 16-bit code.
uint32_t width
width of character in pixels
uint32_t x_min_offset
x_min = x_min_offset
uint32_t y_min_offset
y_min = (y_min + y_min_offset)
uint32_t y_max_offset
y_max = (height - y_max_offset)
uint32_t x_max_offset
x_max = width - x_max_offset
uint32_t bitmap_offset
offset of this character in chars buffer
structure defining a unicode font
uint8_t crop
If false, x_min_offset+y_min_offset=bytes to skip.
uint8_t y_min
Most top Y coordinate of any char in the font.
uint16_t bitmap_len
Size in bytes of all characters bitmaps.
uint8_t height
height of all characters in pixels
uint8_t font_id
ID of the font, from nbgl_font_id_e.
uint8_t char_kerning
kerning for the font
const nbgl_font_unicode_character_t *const characters
array containing definitions of all characters
uint8_t line_height
height of a line for all characters in pixels
uint8_t bpp
Number of bits per pixels, (interpreted as nbgl_bpp_t)
const nbgl_font_unicode_character_t * characters
const nbgl_font_unicode_t * font
uint32_t unicode_character_byte_count