Class: SDL2::TTF::Font

Inherits:
Struct
  • Object
show all
Defined in:
lib/sdl2/ttf/font.rb

Overview

Internal structure containing font information

Defined Under Namespace

Classes: CachedGlyph, FT_Bitmap, FT_Open_Args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#==, cast, #initialize

Methods included from StructHelper

#member_readers, #member_writers

Constructor Details

This class inherits a constructor from SDL2::Struct

Class Method Details

.open(file, pt_size) ⇒ Object



74
75
76
# File 'lib/sdl2/ttf/font.rb', line 74

def self.open(file, pt_size)
  TTF.open_font!(file, pt_size)
end

.release(pointer) ⇒ Object



78
79
80
# File 'lib/sdl2/ttf/font.rb', line 78

def self.release(pointer)
  TTF.close_font(pointer)
end

Instance Method Details

#closeObject Also known as: free



82
83
84
# File 'lib/sdl2/ttf/font.rb', line 82

def close()
  TTF.close_font(self)
end

#render_text_blended(text, fg = [255, 255, 255, 255]) ⇒ Object



99
100
101
102
103
104
# File 'lib/sdl2/ttf/font.rb', line 99

def render_text_blended(text, fg = [255, 255, 255, 255])
  #binding.pry
  fg = Color.cast(fg)
  #binding.pry
  TTF.render_text_blended!(self, text, fg)
end

#render_text_blended_wrapped(text, width, fg = [255,255,255,255]) ⇒ Object



106
107
108
109
# File 'lib/sdl2/ttf/font.rb', line 106

def render_text_blended_wrapped(text, width, fg = [255,255,255,255])
  fg = Color.cast(fg)
  TTF.render_text_blended_wrapped!(self, text, fg, width)
end

#render_text_shaded(text, fg = [255,255,255,255], bg = [0,0,0,0]) ⇒ Object



93
94
95
96
97
# File 'lib/sdl2/ttf/font.rb', line 93

def render_text_shaded(text, fg = [255,255,255,255], bg = [0,0,0,0] )
  fg = Color.cast(fg)
  bg = Color.cast(bg)
  TTF.render_text_shaded!(self, text, fg, bg)
end

#render_text_solid(text, color = [255,255,255]) ⇒ Object



88
89
90
91
# File 'lib/sdl2/ttf/font.rb', line 88

def render_text_solid(text, color = [255,255,255])
  color = Color.cast(color)
  TTF.render_text_solid!(self, text, color)
end