The five rules
Every function in the header obeys all five, so there is nothing to remember per call.
- A fallible call returns
daegun_status. Results come back through out parameters. - Passing NULL where a pointer is required returns
DAEGUN_NULL. It is never dereferenced. - daegun allocates and daegun frees. Never call
free()on a pointer daegun gave you. - A borrowed view is a const pointer plus a count, valid until the handle it came from is freed.
- Handles are thread safe: one handle may be used from several threads at once.
A crash from breaking these is a bug in the calling code. A crash from following them is a vulnerability, and worth reporting.
Status codes
| Code | Meaning |
|---|---|
DAEGUN_OK | The call did what it says. |
DAEGUN_NULL | A required pointer was NULL. Always the caller's bug. |
DAEGUN_PARSE | The font could not be read. |
DAEGUN_RANGE | An argument was outside what the call accepts. |
DAEGUN_ABSENT | No such glyph, table or axis. An answer, not a failure. |
DAEGUN_UNSUPPORTED | Not available here, such as a GPU backend the machine lacks. |