GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
gp_markup_justify.h File Reference

Justifies markup into lines. More...

#include <utils/gp_markup.h>

Go to the source code of this file.

Data Structures

struct  gp_markup_line
 A markup line. More...
 
struct  gp_markup_lines
 A markup lines. More...
 

Typedefs

typedef struct gp_markup_line gp_markup_line
 A markup line.
 
typedef struct gp_markup_lines gp_markup_lines
 A markup lines.
 
typedef unsigned int(* gp_markup_width_cb) (gp_markup_glyph *first, size_t len, void *priv)
 A callback for text justification.
 

Functions

gp_markup_linesgp_markup_justify (gp_markup *self, unsigned int line_width, gp_markup_width_cb width_callback, void *priv)
 Justifies text into lines.
 
void gp_markup_justify_free (gp_markup_lines *self)
 Frees justified lines.
 
void gp_markup_justify_dump (gp_markup_lines *self)
 Dumps justified lines into stdout, used for debugging.
 

Detailed Description

Justifies markup into lines.

Definition in file gp_markup_justify.h.

Typedef Documentation

◆ gp_markup_lines

A markup lines.

This represents a markup text justified into a lines.

◆ gp_markup_width_cb

typedef unsigned int(* gp_markup_width_cb) (gp_markup_glyph *first, size_t len, void *priv)

A callback for text justification.

The algorithm that breaks text into lines needs to know the width of a group of glyphs in order to be able to break the text into lines of a given width.

Parameters
firstA pointer to a start of the array of glyphs.
lenA number of glyphs in the array.
privA private pointer passed to the gp_markup_justify() function.
Returns
A width of the glyphs.

Definition at line 50 of file gp_markup_justify.h.

Function Documentation

◆ gp_markup_justify()

gp_markup_lines * gp_markup_justify ( gp_markup self,
unsigned int  line_width,
gp_markup_width_cb  width_callback,
void *  priv 
)

Justifies text into lines.

Parameters
selfA text markup.
line_widthA width the markup should be justified into.
width_callbackA callback that computes width of a glyph group.
privA private pointer passed down to the width_callback.

◆ gp_markup_justify_dump()

void gp_markup_justify_dump ( gp_markup_lines self)

Dumps justified lines into stdout, used for debugging.

Parameters
selfA justified markup.

◆ gp_markup_justify_free()

void gp_markup_justify_free ( gp_markup_lines self)

Frees justified lines.

Parameters
selfA justified markup.