# Font property settings. Self-explanatory.
fnt = {
:size => 16,
:bold => false, :italic => false, :shadow => true, :outline => true,
:color => Color.new(255,255,255,255),
:out_color => Color.new(0, 0, 0, 128),
}
# Add any font type you want to test here.
# Cycle through them with the LEFT and RIGHT keys during testing.
fonts = [
"Tw Cen MT Condensed","Bell MT","Candara","Adobe Caslon Pro","Corbel",
"Estrangelo Edessa","Franklin Gothic Book","Gill Sans MT","Iskoola Pota",
"Matrix","Aclonica","VL Gothic","Verdana", "Arial",
]
al = 1 # Alignment value.
ww = 400 # Width reserved for the text
hh = 200 # Height reserved for the text
txt = "01234567899876543210" # Sample text for testing.
fnt[:name] = fonts[0]
mtds = [:name, :size, :bold, :italic, :shadow, :outline, :pixel, :color, :out_color]
sp1 = Sprite.new
sp1.bitmap = Bitmap.new(ww,hh)
sp1.x = (Graphics.width - ww)/2
sp1.y = (Graphics.height - hh)/2
sp2 = Sprite.new
sp2.bitmap = Bitmap.new(ww,hh)
sp2.x = (Graphics.width - ww)/2
sp2.y = (Graphics.height - hh)/2
sp1.bitmap.fill_rect(0,0,ww,hh,Color.new(255,255,55,255))
mtds.each do |mtd|
sp2.bitmap.font.send(mtd.to_s+"=",fnt[mtd])
end
sp2.bitmap.draw_text(0,0,ww,hh,txt,al)
# Just a debug print to see the font properties
mtds.each do |mtd|
p "#{mtd}: #{sp1.bitmap.font.send(mtd)}" if sp1.bitmap.font.respond_to?(mtd)
end
# Yeah... laziness at it's best! :P
# Didn't want to bother with sound effects much...
DataManager.load_normal_database
loop do
Input.update
Graphics.update
sp1.update
sp2.update
SmoothAnim.update
if Input.trigger?(:LEFT)
Sound.play_cursor
id = fonts.index(sp2.bitmap.font.name)
id -= 1
id = fonts.size - 1 if id < 0
sp2.bitmap.clear
sp2.bitmap.font.name = fonts[id]
p "font name: #{sp2.bitmap.font.name}"
sp2.bitmap.draw_text(0,0,ww,hh,txt,al)
elsif Input.trigger?(:RIGHT)
Sound.play_cursor
id = fonts.index(sp2.bitmap.font.name)
id += 1
id = 0 if id > fonts.size - 1
sp2.bitmap.clear
sp2.bitmap.font.name = fonts[id]
p "font name: #{sp2.bitmap.font.name}"
sp2.bitmap.draw_text(0,0,ww,hh,txt,al)
end
end