typography/rasterizer

Procs

proc makeReady(glyph: Glyph; font: Font) {...}{.raises: [Defect, IOError, OSError, ValueError,
    Exception], tags: [ReadIOEffect, RootEffect].}
Make sure the glyph is ready to render
proc getGlyphSize(font: Font; glyph: Glyph): Vec2 {...}{.
    raises: [Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
proc getGlyphImage(font: Font; glyph: Glyph; glyphOffset: var Vec2; quality = 4;
                  subPixelShift: float32 = 0.0): Image {...}{.
    raises: [Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
Get image for this glyph
proc getGlyphOutlineImage(font: Font; unicode: string; lines = true; points = true;
                         winding = true): Image {...}{.
    raises: [KeyError, Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
Get an outline of the glyph with controls points. Useful for debugging.
proc getGlyphImage(font: Font; unicode: string; glyphOffset: var Vec2;
                  subPixelShift = 0.0): Image {...}{.
    raises: [KeyError, Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
Get an image of the glyph and the glyph offset the image should be drawn
proc getGlyphImage(font: Font; unicode: string): Image {...}{.
    raises: [KeyError, Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
Get an image of the glyph
proc drawGlyph(font: Font; image: var Image; at: Vec2; c: string) {...}{.
    raises: [KeyError, Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
Draw glyph at a location on the image
proc getGlyphImageOffset(font: Font; glyph: Glyph; quality = 4;
                        subPixelShift: float32 = 0.0): Vec2 {...}{.
    raises: [Defect, IOError, OSError, ValueError, Exception],
    tags: [ReadIOEffect, RootEffect].}
Get image for this glyph
proc alphaToBlankAndWhite(image: var Image) {...}{.raises: [], tags: [].}
Typography deals mostly with transparent images with white text This is hard to see in tests so we convert it to white background with black text.