Table of Contents
Errors and Limits
The condition
(define-condition slug-error (error) ...)
(slug-error-message condition) => string
Every error cl-slug signals for bad data or a full store is a slug-error. Its message says what went wrong and what to do. An argument outside the type its function declares, such as a store that is not a store, signals a type-error instead, which SBCL signals on entry and words itself; where the argument is a constant, SBCL warns when the call is compiled. That includes a fill rule given to store-add that is not :nonzero or :even-odd, a real given to half-float-bits that rounds to no finite half, the bits of an infinity or a NaN given to half-float-value, and a row past 65535 or a count past 65536 given to copy-curve-rows or copy-band-rows.
Errors adding a shape
| Message | Cause | What to do |
|---|---|---|
| A shape's curves are six numbers each, X0 Y0 CX CY X1 Y1, but n numbers were given. | The vector's length is not a multiple of 6. | Check how the curves were packed. |
| A shape's curves are numbers, not x. | An element is not a real. | |
| x is beyond the largest half-precision float, 65504, so it cannot be stored in the curve texture. Give curves in ems, as for a font of size 1. | A coordinate is too large for the curve texture. | Scale the shape to ems. |
| x is not a finite number, which a curve's coordinates must be. | An infinity. | |
| A fill rule is :NONZERO or :EVEN-ODD, not x. | The fill rule store-find-or-add's function returned. |
|
| A band of n curves does not fit in a row of the band texture, of 4096 texels. Split the shape into smaller shapes. | More than 4096 curves cross one band. | Split the shape; draw the parts together. |
| A shape's bands need more than 65535 texels of the band texture. Split it into smaller shapes. | The shape's band lists reach too far from its headers. | Split the shape. |
| store is full: its textures may have n rows. Make the store with a larger :MAX-ROWS, up to what the device's textures take, or put fewer shapes in it. | Either texture would need more than max-rows rows. |
A larger :max-rows, if the GPU takes taller textures; or a second store. |
The first five are found before the store's lock is taken, and leave the store as it was. The last three are found while placing the shape: what was placed of it stays in the store, unused, and the store still works for shapes that fit.
Other errors
| Function | Message | Cause |
|---|---|---|
write-shape-data |
Writing a shape's 8 floats from start overruns a vector of n. | Fewer than eight floats left in the vector after start. |
Limits
| Limit | Value | Why |
|---|---|---|
| Texture width | 4096 texels | The reference shaders' layout. |
| Rows per texture | max-rows, 4096 by default, at most 65536 |
16-bit places in the band texture. |
| Bands per shape, each way | 32 | Enough for the largest glyphs; the band count is 8 bits in the reference format. |
| Curves in one band | 4096 | A list is read along one row. |
| A shape's band data | 65536 texels from its place | 16-bit offsets. |
| Curve coordinates | ±65504 | Half floats. |
| Precision | about 1/2048 em near 1 em | Half floats' 11 bits. |
Real fonts come nowhere near the band limits: the largest CJK glyphs have a few hundred curves, spread over many bands.
What is not an error
- An empty shape, such as a space:
shape-empty-pis true, and it takes no texels. - Curves of no length: left out.
- Open contours: not checked. The fill is wrong where a contour is open, as in any renderer.
- Self-intersecting or overlapping contours: filled by the fill rule, as fonts expect.
- The same curves added twice with
store-add: added twice. Usestore-find-or-addto share.