Functions
Functions
Graphics » HAL GFX » GFX FONT
Collaboration diagram for Functions:

## Functions
void | hal_gfx_bind_font (hal_gfx_font_t *font)
| Bind the font to use in future hal_gfx_print() calls. More...
int | hal_gfx_string_get_bbox (const char *str, int *w, int *h, int max_w, uint32_t wrap)
| Get the bounding box's width and height of a string. More...
void | hal_gfx_print (const char *str, int x, int y, int w, int h, uint32_t fg_col, uint32_t align)
| Print pre-formatted text. More...
void | hal_gfx_print_to_position (const char *str, int *pos_x, int *pos_y, int x, int y, int w, int h, uint32_t fg_col, uint32_t align)
| Print pre-formatted text. More...

## Detailed Description

## Function Documentation

## ◆ hal_gfx_bind_font()

void hal_gfx_bind_font | ( | hal_gfx_font_t * | font | ) |

Bind the font to use in future hal_gfx_print() calls.

Parameters

  [in] | font | Pointer to font

## ◆ hal_gfx_print()

void hal_gfx_print | ( | const char * | str,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | uint32_t | fg_col,
|  | uint32_t | align
| ) |  |

Print pre-formatted text.

Parameters

  [in] | str | Pointer to string
  [in] | x | X coordinate of text-area's top-left corner
  [in] | y | Y coordinate of text-area's top-left corner
  [in] | w | Width of the text area
  [in] | h | Height of the text area
  [in] | fg_col | Foreground color of text
  [in] | align | Alignment and wrapping mode

Returns

## ◆ hal_gfx_print_to_position()

void hal_gfx_print_to_position | ( | const char * | str,
|  | int * | pos_x,
|  | int * | pos_y,
|  | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | uint32_t | fg_col,
|  | uint32_t | align
| ) |  |

Print pre-formatted text.

Parameters

  [in] | str | Pointer to string
  [in] | pos_x | X position of next character to be drawn. Usually initialized to 0 by the user and then updated internally by the library
  [in] | pos_y | Y position of next character to be drawn. Usually initialized to 0 by the user and then updated internally by the library
  [in] | x | X coordinate of text-area's top-left corner
  [in] | y | Y coordinate of text-area's top-left corner
  [in] | w | Width of the text area
  [in] | h | Height of the text area
  [in] | fg_col | Foreground color of text
  [in] | align | Alignment and wrapping mode

Returns

## ◆ hal_gfx_string_get_bbox()

int hal_gfx_string_get_bbox | ( | const char * | str,
|  | int * | w,
|  | int * | h,
|  | int | max_w,
|  | uint32_t | wrap
| ) |  |

Get the bounding box's width and height of a string.

Parameters

  [in] | str | Pointer to string
  [in] | w | Pointer to variable where width should be written
  [in] | h | Pointer to variable where height should be written
  [in] | max_w | Max allowed width
  [in] | wrap | warp mode

Returns
  Number of carriage returns