15#ifndef UTILS_GP_MARKUP_BUILDER_H
16#define UTILS_GP_MARKUP_BUILDER_H
37 uint32_t glyph, uint8_t fmt, uint16_t fg_color)
42 self->glyphs[self->glyph_cnt].
glyph = glyph;
43 self->glyphs[self->glyph_cnt].
fmt = fmt;
44 self->glyphs[self->glyph_cnt].
fg_color = fg_color;
64 if (self->glyphs[self->glyph_cnt-1].
glyph ==
' ' ||
65 self->glyphs[self->glyph_cnt-1].
glyph ==
'\n')
68 self->glyphs[self->glyph_cnt].
glyph =
' ';
69 self->glyphs[self->glyph_cnt].
fmt = fmt;
70 self->glyphs[self->glyph_cnt].space_padd = 0;
86 self->glyphs[self->glyph_cnt].
glyph =
'\n';
87 self->glyphs[self->glyph_cnt].
fmt = 0;
103 self->glyphs[self->glyph_cnt].
glyph =
'\n';
120 if (self->glyph_cnt && self->glyphs[self->glyph_cnt - 1].
glyph ==
' ')
123 self->glyphs[self->glyph_cnt].
glyph = 0;
124 self->glyphs[self->glyph_cnt].
fmt = 0;
140 self->glyphs = ret->
glyphs;
A simple text markup format.
static void gp_markup_builder_finish(gp_markup_builder *self)
Finishes a markup.
static gp_markup * gp_markup_builder_alloc(gp_markup_builder *self)
Allocates a buffer for a markup.
static void gp_markup_builder_glyph(gp_markup_builder *self, uint32_t glyph, uint8_t fmt, uint16_t fg_color)
Appends a markup glyph.
static void gp_markup_builder_space(gp_markup_builder *self, uint8_t fmt)
Appends a markup space.
static void gp_markup_builder_newline(gp_markup_builder *self)
Appends a markup newline.
static void gp_markup_builder_hline(gp_markup_builder *self)
Appends a markup horizontal line.
uint16_t fmt
A text format.
uint32_t glyph
An unicode glyph.
uint16_t fg_color
A text color.
gp_markup_glyph glyphs[]
An array of glyphs.