Object
Implements a simple bitmap font by extracting letters from a PNG.
# File lib/png/font.rb, line 37
37: def [] c
38: c = c.chr unless String === c
39: x0, y0, x1, y1 = coordinates c
40:
41: @cache[c] ||= @canvas.extract(x0, y0, x1, y1)
42: end
# File lib/png/font.rb, line 26
26: def coordinates c
27: i = LETTERS.index c
28:
29: raise ArgumentError, "Can't find #{c.inspect}" unless i
30:
31: x = (i % 26) * width
32: y = (3 - (i / 26)) * height # start from the top (3rd row)
33:
34: return x, y, x+width-1, y+height-1
35: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.