Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

This modules provides functionality for outputting a monochrome font to a display.

API Overview

Modules

 System font
 The system font objects are globally available for a graphical application.
 

Data Structures

struct  font
 Storage structure for font meta data. More...
 

Enumerations

enum  font_data_type { FONT_LOC_PROGMEM }
 Valid storage locations for font data. More...
 

Strings and characters located in RAM

void gfx_mono_draw_char (const char c, const gfx_coord_t x, const gfx_coord_t y, const struct font *font)
 Draws a character to the display. More...
 
void gfx_mono_draw_string (const char *str, const gfx_coord_t x, const gfx_coord_t y, const struct font *font)
 Draws a string to the display. More...
 
void gfx_mono_get_string_bounding_box (char const *str, const struct font *font, gfx_coord_t *width, gfx_coord_t *height)
 Computes the bounding box of a string. More...
 

Strings located in flash

void gfx_mono_draw_progmem_string (char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font)
 Draws a string located in program memory to the display. More...
 
void gfx_mono_get_progmem_string_bounding_box (char PROGMEM_PTR_T str, const struct font *font, gfx_coord_t *width, gfx_coord_t *height)
 Computes the bounding box of a string located in program memory. More...
 

Valid storage locations for font data.

Add support for fonts in regular ram

Enumerator
FONT_LOC_PROGMEM 

Font data stored in program/flash memory.

void gfx_mono_draw_char ( const char  c,
const gfx_coord_t  x,
const gfx_coord_t  y,
const struct font font 
)

Draws a character to the display.

Parameters
[in]cCharacter to be drawn
[in]xX coordinate on screen.
[in]yY coordinate on screen.
[in]fontFont to draw character in

References Assert, FONT_LOC_PROGMEM, gfx_mono_draw_char_hugemem(), gfx_mono_draw_char_progmem(), gfx_mono_draw_filled_rect, GFX_PIXEL_CLR, font::height, font::type, and font::width.

Referenced by about_co_routine(), about_task(), gfx_mono_draw_progmem_string(), gfx_mono_draw_string(), terminal_co_routine(), and terminal_task().

void gfx_mono_draw_progmem_string ( char PROGMEM_PTR_T  str,
gfx_coord_t  x,
gfx_coord_t  y,
const struct font font 
)

Draws a string located in program memory to the display.

This function will draw a string located in program memory to the display, this differs from gfx_mono_draw_string() by using constant string data from the program memory instead of string data in RAM.

Using program memory for constant strings will reduce the applications need for RAM, and thus lower the overall size footprint.

Parameters
[in]strPointer to string located in program memory
[in]xX coordinate on screen.
[in]yY coordinate on screen.
[in]fontFont to draw string in

References Assert, gfx_mono_draw_char(), font::height, NULL, PROGMEM_PTR_T, PROGMEM_READ_BYTE, and font::width.

Referenced by gfx_mono_menu_init(), gfx_mono_spinctrl_draw(), and menu_draw().

void gfx_mono_draw_string ( const char *  str,
gfx_coord_t  x,
gfx_coord_t  y,
const struct font font 
)

Draws a string to the display.

This function will draw a string located in memory to the display.

Parameters
[in]strPointer to string
[in]xX coordinate on screen.
[in]yY coordinate on screen.
[in]fontFont to draw string in

References Assert, gfx_mono_draw_char(), font::height, NULL, and font::width.

Referenced by gfx_mono_spinctrl_draw(), gfx_mono_spinctrl_draw_button(), init_display(), main(), main_co_routine(), main_task(), and setup_board().

void gfx_mono_get_progmem_string_bounding_box ( char PROGMEM_PTR_T  str,
const struct font font,
gfx_coord_t width,
gfx_coord_t height 
)

Computes the bounding box of a string located in program memory.

Note
If string is empty the returned width will be 1 pixel and the height equal to the font height.
Parameters
[in]strString in program memory to calculate bounding box for
[in]fontFont used
[in]widthPointer to width result
[in]heightPointer to height result

References Assert, font::height, NULL, PROGMEM_PTR_T, PROGMEM_READ_BYTE, and font::width.

void gfx_mono_get_string_bounding_box ( const char *  str,
const struct font font,
gfx_coord_t width,
gfx_coord_t height 
)

Computes the bounding box of a string.

Note
If string is empty the returned width will be 1 pixel and the height equal to the font height.
Parameters
[in]strString to calculate bounding box for
[in]fontFont used
[in]widthPointer to width result
[in]heightPointer to height result

References Assert, font::height, NULL, and font::width.

Referenced by gfx_mono_spinctrl_draw_button().