~alcinnz/Typograffiti

ref: c8e0b8e470f8fc4f994f2538f5f3c1bb66106a42 Typograffiti/typograffiti-core/src/Typograffiti.hs -rw-r--r-- 2.3 KiB
c8e0b8e4 — Schell Carl Scivally More abstract (#6) 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
-- |
-- Module:     Typograffiti
-- Copyright:  (c) 2019 Schell Scivally
-- License:    MIT
-- Maintainer: Schell Scivally <schell@formation.ai>
--
-- This module provides the abstract functionality of a cached font atlas.
module Typograffiti
  (
  -- * $glyphs
    GlyphSize (..)
  , CharSize (..)
  , charGlyphAction
  -- * $atlas
  , Atlas (..)
  , asciiChars
  -- * $cache
  , WordCache (..)
  , AllocatedRendering (..)
  , loadWords
  , unloadMissingWords
  -- * $store
  , Store
  , RenderedGlyphs (..)
  , GlyphRenderingData (..)
  , getRendering
  -- * Transforming allocated renderings
  , Transform (..)
  , move
  , moveV2
  , scale
  , scaleV2
  , rotate
  ) where

import           Typograffiti.Atlas
import           Typograffiti.Cache
import           Typograffiti.Glyph
import           Typograffiti.Store
import           Typograffiti.Transform

-- | $glyphs

-- | $atlas
-- Typograffiti is in plain terms a cache of caches. Its core is the `Atlas`,
-- which is a collection of rasterized glyphs. These modules don't make any
-- assumptions as to what a glyph really is, though, which means you can use
-- Typograffiti for more than just rendering text. Indeed Typograffiti is great
-- for rendering anything that can be represented by contiguous strings. For
-- example - in tile-based games we often see the same formations again and again
-- where tiles repeat a given pattern. If these patterns can be recognized  and
-- broken up into contiguous, two dimensional lists, then Typograffiti can cache
-- the renderings of these patterns for you, greatly improving your rendering
-- framerate.

-- | To keep things as general as possible this package abstracts out two
-- important concepts - rasterization and the rendering itself. Most low level
-- functions will take rasterization or rendering functions as arguments and
-- the low level types will have type variables representing the details of these
-- abstractions.

-- | If you simply want to use Typograffiti to display TTF fonts without writing
-- your own rasterizer or rendering functions I suggest you use the
-- typograffiti-freetype package (which provides freetype glyph rasterization)
-- along with either typograffiti-sdl or typograffiti-gl (which each provide
-- rendering services).

-- | $cache Collections of rasterized strings

-- | $store Collections of WordCaches for each file at a certain size