fx9860g and fxcg50 2D math rendering library with support for TeX syntax.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.2 KiB

// flow: Horizontal flows of nodes arranged from left to right
#ifndef TEX_FLOW
#define TEX_FLOW
#include <stdint.h>
struct TeX_Node;
/* TeX_Flow
This object represents a horizontal line of nodes following the flow of the
text; each node can be a plain string or a functional node. All share the
same base line when rendered. */
struct TeX_Flow
/* Pointer to first and last elements of the line */
struct TeX_Node *first;
struct TeX_Node *last;
uint16_t width;
uint16_t height;
uint16_t line;
/* Possible subscript and superscript mode.
Subscripts and superscripts are placed on the right of the base, and
displaced vertically. (LaTeX's inline mode)
Subscripts and superscripts are placed under and above the base. (LaTeX's
display mode)
Use display mode when possible, but fall back to inline mode if the user
builds an inline mode. */
// Flow construction and destruction functions
/* TeX_flow_add_node(): Add a new node to a flow
The provided node is added at the right of the flow. If [flow] is NULL,
creates and returns a new flow. Otherwise, always returns [flow]. */
struct TeX_Flow *TeX_flow_add_node(struct TeX_Flow *flow,
struct TeX_Node *node);
/* TeX_flow_free(): Free TeX_Flow objects
Destroys a flow and all of its contained elements. */
void TeX_flow_free(struct TeX_Flow *flow);
// Layout and rendering
/* TeX_flow_layout(): Calculate the layout of a flow
This function calculates the size taken by nodes sharing the same baseline.
It heeds for special size and alignment exceptions such as parenthesis-type
characters and subscripts/superscripts. Modifies the flow's metadata. */
void TeX_flow_layout(struct TeX_Flow *flow, int display);
/* TeX_flow_render(): Render a flow and all its components
This function renders all horizontal objects in a flow. The layout of the
flow must have been computed. */
void TeX_flow_render(struct TeX_Flow const * flow, int x, int y, int color);
#endif /* TEX_FLOW */