BeRTOS
|
printf-family routines for text output More...
#include "text.h"
#include <mware/formatwr.h>
#include <gfx/font.h>
#include <gfx/gfx.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
Go to the source code of this file.
Functions | |
int | text_puts (const char *PGM_ATTR str, struct Bitmap *bm) |
Render string str in Bitmap bm at current cursor position. | |
int | text_vprintf (struct Bitmap *bm, const char *PGM_ATTR fmt, va_list ap) |
vprintf()-like formatter to render text in a Bitmap. | |
int | text_printf (struct Bitmap *bm, const char *PGM_ATTR fmt,...) |
printf()-like formatter to render text in a Bitmap. | |
int | text_xyvprintf (struct Bitmap *bm, coord_t x, coord_t y, uint16_t style, const char *PGM_ATTR fmt, va_list ap) |
Render text with vprintf()-like formatting at a specified pixel position. | |
int | text_xyprintf (struct Bitmap *bm, coord_t x, coord_t y, uint16_t style, const char *PGM_ATTR fmt,...) |
Render text with printf()-like formatting at a specified pixel position. | |
int | text_xprintf (struct Bitmap *bm, uint8_t row, uint8_t col, uint16_t style, const char *PGM_ATTR fmt,...) |
Render text with printf()-like formatting at a specified row/column position. | |
static int | text_charWidth (int c, struct TextWidthData *twd) |
Compute width in pixels of a character. | |
int | text_vwidthf (UNUSED_ARG(struct Bitmap *, bm), const char *PGM_ATTR fmt, va_list ap) |
Return the width in pixels of a vprintf()-formatted string. | |
int | text_widthf (struct Bitmap *bm, const char *PGM_ATTR fmt,...) |
Return the width in pixels of a printf()-formatted string. |
printf-family routines for text output
Definition in file text_format.c.
static int text_charWidth | ( | int | c, |
struct TextWidthData * | twd | ||
) | [static] |
Compute width in pixels of a character.
Compute the on screen width of a character, taking the current style and font into account.
The width is accumulated in the WidthData structure passed as second argument.
This is a formatted_write() callback used by text_vwidthf() to compute the length of a formatted string.
Definition at line 222 of file text_format.c.
int text_printf | ( | struct Bitmap * | bm, |
const char *PGM_ATTR | fmt, | ||
... | |||
) |
printf()-like formatter to render text in a Bitmap.
Perform printf()-like formatting on the fmt format string. Render the resulting string in Bitmap bm starting at the current cursor position.
Definition at line 99 of file text_format.c.
int text_puts | ( | const char *PGM_ATTR | str, |
struct Bitmap * | bm | ||
) |
Render string str in Bitmap bm at current cursor position.
Definition at line 64 of file text_format.c.
int text_vprintf | ( | struct Bitmap * | bm, |
const char *PGM_ATTR | fmt, | ||
va_list | ap | ||
) |
vprintf()-like formatter to render text in a Bitmap.
Perform vprintf()-like formatting on the fmt format string using the variable-argument list ap. Render the resulting string in Bitmap bm starting at the current cursor position.
Definition at line 85 of file text_format.c.
int text_xprintf | ( | struct Bitmap * | bm, |
uint8_t | row, | ||
uint8_t | col, | ||
uint16_t | style, | ||
const char *PGM_ATTR | fmt, | ||
... | |||
) |
Render text with printf()-like formatting at a specified row/column position.
Definition at line 188 of file text_format.c.
int text_xyprintf | ( | struct Bitmap * | bm, |
coord_t | x, | ||
coord_t | y, | ||
uint16_t | style, | ||
const char *PGM_ATTR | fmt, | ||
... | |||
) |
Render text with printf()-like formatting at a specified pixel position.
bm | Bitmap where to render the text |
x | [pixels] Initial X coordinate of text. |
y | [pixels] Coordinate of top border of text. |
style | Formatting style to use. In addition to any STYLEF_ flag, it can be TEXT_NORMAL, TEXT_FILL, TEXT_INVERT or TEXT_RIGHT, or a combination of these flags ORed together. |
fmt | String possibly containing printf() formatting commands. |
Definition at line 169 of file text_format.c.
int text_xyvprintf | ( | struct Bitmap * | bm, |
coord_t | x, | ||
coord_t | y, | ||
uint16_t | style, | ||
const char *PGM_ATTR | fmt, | ||
va_list | ap | ||
) |
Render text with vprintf()-like formatting at a specified pixel position.
Definition at line 116 of file text_format.c.