Pikchr  Artifact [e69a1f1be1]

Artifact e69a1f1be1dfdedf5e44a99193ee2b17b269ed1b3c4f963209cf164135211978:

  • File pikchr.h — part of check-in [d8132dfeff] at 2020-11-22 02:15:51 on branch trunk — Include the pikchr.h header file in the check-in, for the convenience of integrators. Enhancements to integration documentation. Fix errors in the "differences.md" page. (user: drh size: 1340)
  • File pikchr.h.in — part of check-in [d3409e5db7] at 2020-11-09 19:09:04 on branch trunk — Add the PIKCHR_DARK_MODE flag. (user: drh size: 1340)

/*
** Interface definition for Pikchr.
*/


/* The main interface.  Invoke this routine to translate PIKCHR source
** text into SVG. The SVG is returned in a buffer obtained from malloc().
** The caller is responsible for freeing the buffer.
**
** If an error occurs, *pnWidth is filled with a negative number and
** the return buffer contains error message text instead of SVG.  By
** default, the error message is HTML encoded.  However, error messages
** come out as plaintext if the PIKCHR_PLAINTEXT_ERRORS flag is included
** as one of the bits in the mFlags parameter.
*/
char *pikchr(
  const char *zText,     /* Input PIKCHR source text.  zero-terminated */
  const char *zClass,    /* Add class="%s" to <svg> markup */
  unsigned int mFlags,   /* Flags used to influence rendering behavior */
  int *pnWidth,          /* OUT: Write width of <svg> here, if not NULL */
  int *pnHeight          /* OUT: Write height here, if not NULL */
);

/* Include PIKCHR_PLAINTEXT_ERRORS among the bits of mFlags on the 3rd
** argument to pikchr() in order to cause error message text to come out
** as text/plain instead of as text/html
*/
#define PIKCHR_PLAINTEXT_ERRORS 0x0001

/* Include PIKCHR_DARK_MODE among the bits of mFlags on the 3rd
** argument to pikchr() to render the image in dark mode.
*/
#define PIKCHR_DARK_MODE        0x0002