GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
A text attrbutes. More...
#include <text/gp_text.h>
#include <widgets/gp_widget_types.h>
#include <widgets/gp_widget_render.h>
Go to the source code of this file.
Enumerations | |
enum | gp_widget_tattr { GP_TATTR_BOLD = 0x10 , GP_TATTR_LARGE = 0x20 , GP_TATTR_MONO = 0x40 , GP_TATTR_FONT = 0x70 , GP_TATTR_LEFT = 0x01 , GP_TATTR_CENTER = 0x02 , GP_TATTR_RIGHT = 0x03 , GP_TATTR_HALIGN = 0x03 } |
Text attribute flags. More... | |
Functions | |
static const gp_text_style * | gp_widget_tattr_font (gp_widget_tattr attr, const gp_widget_render_ctx *ctx) |
Returns text font based on text attributes and render context. | |
static int | gp_widget_tattr_halign (gp_widget_tattr attr) |
Returns the alignment part of the text attributes. | |
int | gp_widget_tattr_parse (const char *attrs, gp_widget_tattr *tattr, int flags) |
Parses text attributes encoded in a string into attribute bitflags. | |
A text attrbutes.
Text attributes describe text font, size, and horizontal alignment. Attributes can be either passed down as a C constants, e.g. GP_TATTR_BOLD | GP_TATTR_LARGE or parsed from a string from JSON e.g. "bold|large".
Definition in file gp_widget_tattr.h.
enum gp_widget_tattr |
Text attribute flags.
Definition at line 27 of file gp_widget_tattr.h.
|
inlinestatic |
Returns text font based on text attributes and render context.
attr | Text attribute bitflags. |
ctx | A widget rendering context. |
Definition at line 54 of file gp_widget_tattr.h.
References gp_widget_render_ctx::font, gp_widget_render_ctx::font_big, gp_widget_render_ctx::font_big_bold, gp_widget_render_ctx::font_bold, gp_widget_render_ctx::font_mono, gp_widget_render_ctx::font_mono_bold, GP_TATTR_BOLD, GP_TATTR_LARGE, and GP_TATTR_MONO.
|
inlinestatic |
Returns the alignment part of the text attributes.
attr | A text attribute bitflags. |
Definition at line 82 of file gp_widget_tattr.h.
References GP_TATTR_HALIGN.
int gp_widget_tattr_parse | ( | const char * | attrs, |
gp_widget_tattr * | tattr, | ||
int | flags | ||
) |
Parses text attributes encoded in a string into attribute bitflags.
The attributes are separated by | e.g. valid attributes string is "bold|large".
attrs | Text attributes description string. |
tattr | A pointer to tattr to be filled in. |
flags | A bitwise or of GP_TATTR_FONT and GP_TATTR_HALIGN that enables parsing font and/or alignment. |