Scroll to navigation

TICKIT_RENDERBUFFER_TEXT(3) Library Functions Manual TICKIT_RENDERBUFFER_TEXT(3)

NAME

tickit_renderbuffer_text, tickit_renderbuffer_text_at - create text regions

SYNOPSIS

#include <tickit.h>

int tickit_renderbuffer_text(TickitRenderBuffer *rb,
        const char *text);
int tickit_renderbuffer_textn(TickitRenderBuffer *rb,
        const char *text, size_t len);
int tickit_renderbuffer_textf(TickitRenderBuffer *rb,
        const char *fmt, ...);
int tickit_renderbuffer_vtextf(TickitRenderBuffer *rb,
        const char *fmt, va_list args);

int tickit_renderbuffer_text_at(TickitRenderBuffer *rb,
        int line, int col, const char *text);
int tickit_renderbuffer_textn_at(TickitRenderBuffer *rb,
        int line, int col, const char *text, size_t len);
int tickit_renderbuffer_textf_at(TickitRenderBuffer *rb,
        int line, int col, const char *fmt, ...);
int tickit_renderbuffer_vtextf_at(TickitRenderBuffer *rb,
        int line, int col, const char *fmt, va_list args);

Link with -ltickit.

DESCRIPTION

tickit_renderbuffer_text() creates a text region that starts at the current virtual cursor position, containing the given text string and set to the current pen. tickit_renderbuffer_textn() creates a text region of at most len bytes. It returns the number of columns that the text string occupies. tickit_renderbuffer_textf() and tickit_renderbuffer_vtextf() take a format string in the style of sprintf(3) to create formatted text from either a list of arguments or a va_list. These functions will update the virtual cursor position.

tickit_renderbuffer_text_at(), tickit_renderbuffer_textn_at(), tickit_renderbuffer_textf_at() and tickit_renderbuffer_vtextf_at() create a text region at the given position, and otherwise operate analogously to their non-_at counterpart. These functions do not use or update the virtual cursor position.

Calls to any of these functions allocate storage owned by the TickitRenderBuffer instance itself to store the strings. This storage is released again by tickit_renderbuffer_reset(3), the implicit reset that happens at the end of tickit_renderbuffer_flush_to_term(3), or when every cell that was originally part of the region has been overwritten with other content.

RETURN VALUE

These functions return an integer giving the number of columns the new region occupies.

SEE ALSO

tickit_renderbuffer_new(3), tickit_renderbuffer_blit(3), tickit_renderbuffer_flush_to_term(3), tickit_renderbuffer(7), tickit(7)