Commit Graph

3 Commits

Author SHA1 Message Date
Nigel Tao
24265d1c91 Implement GlyphBounds and GlyphAdvance. 2015-08-24 15:51:50 +10:00
Nigel Tao
9c46b87503 Make face.Glyph not allocate a new mask each time.
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-4     96914389      88683659      -8.49%

benchmark                 old allocs     new allocs     delta
BenchmarkDrawString-4     32287          0              -100.00%

benchmark                 old bytes     new bytes     delta
BenchmarkDrawString-4     1929619       156           -99.99%
2015-08-23 21:11:02 +10:00
Nigel Tao
6deea24143 Add a truetype.Face type.
Its implementation is mostly a copy/paste of the freetype.Context type.
Follow-up commits will make it more efficient.

Also add an example that uses a truetype.Face and the
golang.org/x/exp/shiny/font package to draw text.
2015-08-22 14:46:12 +10:00