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.

65 lines
1.7 KiB

// env: Environments
#ifndef TEX_ENV
#define TEX_ENV
#include <stddef.h>
struct TeX_Node;
/* Simple type definition trick to use struct TeX_Env inside prototypes within
the struct definition itself */
typedef struct TeX_Env TeX_Env;
struct TeX_Env
/* Environment name */
char const * name;
/* free(): Free an environment instance */
void (*free)(TeX_Env *env);
/* add_node(): Add a node to an environment */
void (*add_node)(TeX_Env *env, struct TeX_Node *node);
/* add_separator(): Add a separator ("&") */
void (*add_separator)(TeX_Env *env);
/* add_break(): Add a break ("\\") */
void (*add_break)(TeX_Env *env);
/* layout(): Compute environment layout */
void (*layout)(TeX_Env *env, int display);
/* render(): Render environment */
void (*render)(TeX_Env *env, int x, int y, int color);
/* Dimensions */
uint16_t width;
uint16_t height;
uint16_t line;
/* More data, each TeX_Env_* subtype will decide */
// Environment construction functions
/* TeX_env_primary(): make a primary, single-flow environment
This is the environment type of whole formulas. It consists of a single
flow and ignores separators and breaks.
Creates and returns a new environment which must be freed by TeX_free(). */
struct TeX_Env *TeX_env_primary(void);
/* TeX_env_matrix(): make a variable-size matrix
This environment builds matrices without surrounding delimiters. Separators
are used to separate elements, and breaks mark the end of each line. Rows of
uneven length are all padded with empty elements to the maximum row length
of the whole matrix.
Returns a new environment; free with TeX_free(). */
struct TeX_Env *TeX_env_matrix(void);
#endif /* TEX_ENV */