Class: PNG::Canvas

Inherits:
Object
  • Object
show all
Defined in:
lib/png_font.rb

Instance Method Summary collapse

Instance Method Details

#annotate(x, y, string, pointsize = 8, font = PNG::Font::P04B_03, color = PNG::Color::Black) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/png_font.rb', line 25

def annotate(x, y, string, pointsize=8, font=PNG::Font::P04B_03, color=PNG::Color::Black)
  x_offset = 0
  string.each_byte do |byte|
    character(x + x_offset, y, byte, pointsize, font, color)
    x_offset += PNG::Font.character_width(byte, pointsize, font) + font.tracking
  end
end