README: update to example code following API changes

This commit is contained in:
Lephenixnoir 2019-06-12 13:49:05 -04:00
parent 9be3414e96
commit 97b60443f8
1 changed files with 2 additions and 2 deletions

View File

@ -71,11 +71,11 @@ Before using the library in a program, a configuration step is needed. The libra
The three rendering functions are available in fxlib; for monospaced fonts the fourth can be implemented trivially. In gint, the four can be defined as wrappers for `dpixel()`, `dline()`, `dsize()` and `dtext()`.
The type of formulae is `TeX_Flow`. To parse and compute the size of a formula, use the `TeX_parse()` function, which returns a new formula object (or `NULL` if a critical error occurs).
The type of formulae is `TeX_Env`. To parse and compute the size of a formula, use the `TeX_parse()` function, which returns a new formula object (or `NULL` if a critical error occurs).
```c
char *code = "\\frac{x_7}{\\left\\{\\frac{\\frac{2}{3}}{27}\\right\\}^2}";
struct TeX_Flow *formula = TeX_parse(code);
struct TeX_Env *formula = TeX_parse(code);
```
The size of the formula can be queried through `formula->width` and `formula->height`. To render, specify the location of the top-left corner and the drawing color (which will be passed to all primitives):