Method: Gosu::Image.from_text

Defined in:
rdoc/gosu.rb

.from_text(text, line_height, options = {}) ⇒ Gosu::Image .from_text(window, text, font_name, line_height) ⇒ Gosu::Image .from_text(window, text, font_name, line_height, line_spacing, width, align) ⇒ Gosu::Image

Note:

The text is always rendered in white. To draw it in a different color, use the color parameter of #draw, et al.

Creates a reusable image from one or more lines of text.

(Passing a Window reference is not necessary anymore, please use the first overload from now on.)

Parameters:

  • text (String)
  • line_height (Integer)

    the line height, in pixels.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :font (String) — default: Gosu::default_font_name

    the name of a system font, or a path to a TrueType Font (TTF) file. A path must contain at least one ‘/’ character to distinguish it from a system font.

  • :bold (bool) — default: false
  • :italic (bool) — default: false
  • :underline (bool) — default: false
  • :width (Integer)

    the width of the image, in pixels. Long lines will be automatically wrapped around to avoid overflow, but overlong words will be truncated. If this option is omitted, lines will not be wrapped, and :align and :spacing will be ignored as well.

  • :spacing (Integer) — default: 0

    the spacing between lines, in pixels.

  • :align (:left, :right, :center, :justify) — default: :left

    the text alignment.

  • :retro (true, false) — default: false

    if true, the image will not be interpolated when it is scaled up or down.

Returns:

See Also:



420
# File 'rdoc/gosu.rb', line 420

def self.from_text(text, line_height, options = {}); end