Embedded SDK
Embedded SDK
|
#include "nbgl_types.h"
Go to the source code of this file.
Classes | |
struct | nbgl_font_character_t |
fonts nicknames to be used for various wallet size targets (non-Nano) More... | |
struct | nbgl_font_t |
structure defining an ASCII font More... | |
struct | nbgl_font_unicode_character_t |
structure defining a unicode character (except the bitmap) More... | |
struct | nbgl_font_unicode_t |
structure defining a unicode font More... | |
struct | nbgl_unicode_ctx_s |
Macros | |
#define | PIC_CHAR(x) ((const nbgl_font_character_t *) PIC(x)) |
#define | PIC_BMP(x) ((uint8_t const *) PIC(x)) |
#define | LANGUAGE_PACK void |
#define | BAGL_ENCODING_LATIN1 0 |
#define | BAGL_ENCODING_UTF8 1 |
#define | BAGL_ENCODING_DEFAULT BAGL_ENCODING_UTF8 |
#define | IS_UNICODE(__value) ((__value) > 0xF0) |
Typedefs | |
typedef struct nbgl_unicode_ctx_s | nbgl_unicode_ctx_t |
Functions | |
const nbgl_font_t * | nbgl_font_getFont (unsigned int fontId) |
const nbgl_font_t * | nbgl_getFont (nbgl_font_id_e fontId) |
return the non-unicode font corresponding to the given font ID More... | |
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 More... | |
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, or maxLen characters have been parsed. More... | |
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) More... | |
uint8_t | nbgl_getCharWidth (nbgl_font_id_e fontId, const char *text) |
return the width in pixels of the given UTF-8 character More... | |
uint8_t | nbgl_getFontHeight (nbgl_font_id_e fontId) |
return the height in pixels of the font with the given font ID More... | |
uint8_t | nbgl_getFontLineHeight (nbgl_font_id_e fontId) |
return the height in pixels of the line of font with the given font ID More... | |
uint16_t | nbgl_getTextNbLines (const char *text) |
return the number of lines in the given text, according to the found ' 's More... | |
uint16_t | nbgl_getTextHeight (nbgl_font_id_e fontId, const char *text) |
return the height of the given multiline text, with the given font. More... | |
uint16_t | nbgl_getTextLength (const char *text) |
return the number of bytes of the given text, excluding final ' ' or '\0' More... | |
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 More... | |
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 More... | |
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. More... | |
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 More... | |
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, with the given maximum width More... | |
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 possible,. More... | |
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), in the given nbLines. More... | |
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 maxWidth More... | |
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, is_unicode is set to false. More... | |
Fonts types of the new BOLOS Graphical Library
Definition in file nbgl_fonts.h.
#define BAGL_ENCODING_DEFAULT BAGL_ENCODING_UTF8 |
Definition at line 100 of file nbgl_fonts.h.
#define BAGL_ENCODING_LATIN1 0 |
Definition at line 98 of file nbgl_fonts.h.
#define BAGL_ENCODING_UTF8 1 |
Definition at line 99 of file nbgl_fonts.h.
#define IS_UNICODE | ( | __value | ) | ((__value) > 0xF0) |
Definition at line 228 of file nbgl_fonts.h.
#define LANGUAGE_PACK void |
Definition at line 29 of file nbgl_fonts.h.
#define PIC_BMP | ( | x | ) | ((uint8_t const *) PIC(x)) |
Definition at line 26 of file nbgl_fonts.h.
#define PIC_CHAR | ( | x | ) | ((const nbgl_font_character_t *) PIC(x)) |
Definition at line 25 of file nbgl_fonts.h.
typedef struct nbgl_unicode_ctx_s nbgl_unicode_ctx_t |
enum nbgl_font_id_e |
Definition at line 140 of file nbgl_fonts.h.
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
fontId | font ID |
text | UTF-8 character |
Definition at line 372 of file nbgl_fonts.c.
const nbgl_font_t* nbgl_getFont | ( | nbgl_font_id_e | fontId | ) |
return the non-unicode font corresponding to the given font ID
fontId | font ID |
Definition at line 136 of file nbgl_fonts.c.
uint8_t nbgl_getFontHeight | ( | nbgl_font_id_e | fontId | ) |
return the height in pixels of the font with the given font ID
fontId | font ID |
Definition at line 398 of file nbgl_fonts.c.
uint8_t nbgl_getFontLineHeight | ( | nbgl_font_id_e | fontId | ) |
return the height in pixels of the line of font with the given font ID
fontId | font ID |
Definition at line 410 of file nbgl_fonts.c.
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
fontId | font ID |
text | text in UTF8 |
Definition at line 334 of file nbgl_fonts.c.
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, or maxLen characters have been parsed.
fontId | font ID |
text | text in UTF8 |
maxLen | max number of bytes to parse |
Definition at line 348 of file nbgl_fonts.c.
uint16_t nbgl_getTextHeight | ( | nbgl_font_id_e | fontId, |
const char * | text | ||
) |
return the height of the given multiline text, with the given font.
fontId | font ID |
text | text to get the height from |
Definition at line 441 of file nbgl_fonts.c.
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.
fontId | font ID |
text | text to get the height from |
maxWidth | maximum width in which the text must fit |
wrapping | if true, lines are split on separators like spaces, ... |
Definition at line 1048 of file nbgl_fonts.c.
uint16_t nbgl_getTextLength | ( | const char * | text | ) |
return the number of bytes of the given text, excluding final '
' or '\0'
text | text to get the number of bytes from |
Definition at line 454 of file nbgl_fonts.c.
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
fontId | font ID |
text | input UTF-8 string, possibly multi-line (but only first line, before , is used) |
maxWidth | maximum width in bytes, if text is greater than that the parsing is escaped |
len | (output) consumed bytes in text fitting in maxWidth |
width | (output) set to maximum width in pixels in text fitting in maxWidth |
wrapping | if true, lines are split on separators like spaces, ... |
Definition at line 482 of file nbgl_fonts.c.
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
fontId | font ID |
text | input ascii string, possibly multi-line (but only first line is handled) |
maxWidth | maximum width in bytes, if text is greater than that the parsing is escaped |
len | (output) consumed bytes in text fitting in maxWidth |
width | (output) set to maximum width in pixels in text fitting in maxWidth |
Definition at line 681 of file nbgl_fonts.c.
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, with the given maximum width
fontId | font ID |
text | input UTF-8 string, possibly multi-line |
maxWidth | maximum width in bytes, if text is greater than that the parsing is escaped |
maxNbLines | maximum number of lines, if text is greater than that the parsing is escaped |
len | (output) consumed bytes in text fitting in maxWidth |
wrapping | if true, lines are split on separators like spaces, ... |
Definition at line 572 of file nbgl_fonts.c.
uint16_t nbgl_getTextNbLines | ( | const char * | text | ) |
return the number of lines in the given text, according to the found '
's
text | text to get the number of lines from |
Definition at line 422 of file nbgl_fonts.c.
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
fontId | font ID |
text | UTF-8 text to get the number of lines from |
maxWidth | maximum width in which the text must fit |
wrapping | if true, lines are split on separators like spaces, ... |
Definition at line 731 of file nbgl_fonts.c.
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 maxWidth
fontId | font ID |
text | UTF-8 text to get the number of pages from |
nbLinesPerPage | number of lines in a page |
maxWidth | maximum width in which the text must fit |
Definition at line 885 of file nbgl_fonts.c.
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)
fontId | font ID |
text | text in UTF8 |
Definition at line 360 of file nbgl_fonts.c.
Get the coming unicode value on the given UTF-8 string. If the value is a simple ASCII character, is_unicode is set to false.
text | (in/out) text to get character from. Updated after pop to the next UTF-8 char |
textLen | (in/out) remaining length in given text (before ' ' or '\0') |
is_unicode | (out) set to true if it's a real unicode (not ASCII) |
Definition at line 150 of file nbgl_fonts.c.
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), in the given nbLines.
fontId | font ID |
origText | (input) ASCII string, must be single line |
maxWidth | maximum width in pixels |
nbLines | (input) number of lines to reduce the text to. The middle of the text is replaced by ... |
reducedText | (output) reduced text |
reducedTextLen | (input) max size of reduced text |
Definition at line 1177 of file nbgl_fonts.c.
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 possible,.
fontId | font ID |
text | (input/output) UTF-8 string, possibly multi-line |
maxWidth | maximum width in pixels |
nbLines | (input) If the text doesn't fit in this number of lines, the last chars will be replaced by ... |
Definition at line 1068 of file nbgl_fonts.c.