class SDL2::TTF::Font

Internal structure containing font information

Public Class Methods

default_bg() click to toggle source
# File lib/sdl2/ttf/font.rb, line 100
def self.default_bg
  @@default_bg ||= Color.cast([0,0,0,ALPHA_OPAQUE])
end
default_bg=(color) click to toggle source
# File lib/sdl2/ttf/font.rb, line 96
def self.default_bg=(color)
  @@default_bg = Color.cast(color)
end
default_fg() click to toggle source
# File lib/sdl2/ttf/font.rb, line 92
def self.default_fg
  @@default_fg ||= Color.cast([255,255,255, ALPHA_OPAQUE])
end
default_fg=(color) click to toggle source
# File lib/sdl2/ttf/font.rb, line 88
def self.default_fg=(color)
  @@default_fg = Color.cast(color)
end
open(file, pt_size) click to toggle source
# File lib/sdl2/ttf/font.rb, line 74
def self.open(file, pt_size)
  TTF.open_font!(file, pt_size)
end
release(pointer) click to toggle source
# File lib/sdl2/ttf/font.rb, line 78
def self.release(pointer)
  TTF.close_font(pointer)
end

Public Instance Methods

close() click to toggle source
# File lib/sdl2/ttf/font.rb, line 82
def close()
  TTF.close_font(self)
end
Also aliased as: free
free()
Alias for: close
render_text_blended(text, fg = Font::default_fg) click to toggle source
# File lib/sdl2/ttf/font.rb, line 115
def render_text_blended(text, fg = Font::default_fg)
  #binding.pry
  fg = Color.cast(fg)
  #binding.pry
  TTF.render_text_blended!(self, text, fg)
end
render_text_blended_wrapped(text, width, fg = default_fg) click to toggle source
# File lib/sdl2/ttf/font.rb, line 122
def render_text_blended_wrapped(text, width, fg = default_fg)
  fg = Color.cast(fg)
  TTF.render_text_blended_wrapped!(self, text, fg, width)
end
render_text_shaded(text, fg = Font::default_fg, bg = Font::default_bg ) click to toggle source
# File lib/sdl2/ttf/font.rb, line 109
def render_text_shaded(text, fg = Font::default_fg, bg = Font::default_bg )
  fg = Color.cast(fg)
  bg = Color.cast(bg)
  TTF.render_text_shaded!(self, text, fg, bg)
end
render_text_solid(text, color = Font::default_fg) click to toggle source
# File lib/sdl2/ttf/font.rb, line 104
def render_text_solid(text, color = Font::default_fg)
  color = Color.cast(color)
  TTF.render_text_solid!(self, text, color)
end