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.

env.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //---
  2. // env: Environments
  3. //---
  4. #ifndef TEX_ENV
  5. #define TEX_ENV
  6. #include <stddef.h>
  7. struct TeX_Node;
  8. /* Simple type definition trick to use struct TeX_Env inside prototypes within
  9. the struct definition itself */
  10. typedef struct TeX_Env TeX_Env;
  11. struct TeX_Env
  12. {
  13. /* Environment name */
  14. char const * name;
  15. /* free(): Free an environment instance */
  16. void (*free)(TeX_Env *env);
  17. /* add_node(): Add a node to an environment */
  18. void (*add_node)(TeX_Env *env, struct TeX_Node *node);
  19. /* add_separator(): Add a separator ("&") */
  20. void (*add_separator)(TeX_Env *env);
  21. /* add_break(): Add a break ("\\") */
  22. void (*add_break)(TeX_Env *env);
  23. /* layout(): Compute environment layout */
  24. void (*layout)(TeX_Env *env, int display);
  25. /* render(): Render environment */
  26. void (*render)(TeX_Env *env, int x, int y, int color);
  27. /* Dimensions */
  28. uint16_t width;
  29. uint16_t height;
  30. uint16_t line;
  31. /* More data, each TeX_Env_* subtype will decide */
  32. };
  33. //---
  34. // Environment construction functions
  35. //---
  36. /* TeX_env_primary(): make a primary, single-flow environment
  37. This is the environment type of whole formulas. It consists of a single
  38. flow and ignores separators and breaks.
  39. Creates and returns a new environment which must be freed by TeX_free(). */
  40. struct TeX_Env *TeX_env_primary(void);
  41. /* TeX_env_matrix(): make a variable-size matrix
  42. This environment builds matrices without surrounding delimiters. Separators
  43. are used to separate elements, and breaks mark the end of each line. Rows of
  44. uneven length are all padded with empty elements to the maximum row length
  45. of the whole matrix.
  46. Returns a new environment; free with TeX_free(). */
  47. struct TeX_Env *TeX_env_matrix(void);
  48. #endif /* TEX_ENV */