本帖最后由 余烬之中 于 2014-7-31 20:59 编辑
摘自F1手册
Horizontal text is left-aligned by default. Set align to 1 to center the text and to 2 to right-align it. Vertical text is always centered. 水平方向默认左对齐 竖直方向永远居中
所以…………用这个测试一下就清楚了
def 合适高度 24 end x = Sprite.new.tap{|s| s.bitmap = Bitmap.new(Graphics.width, Graphics.height).tap{|b| b.fill_rect(b.rect, Color.new(255,255,255)) b.draw_text(b.rect.tap{|r| r.height = 合适高度}, "Tester Tester") } } loop{Graphics.update}
def 合适高度
24
end
x = Sprite.new.tap{|s|
s.bitmap = Bitmap.new(Graphics.width, Graphics.height).tap{|b|
b.fill_rect(b.rect, Color.new(255,255,255))
b.draw_text(b.rect.tap{|r| r.height = 合适高度}, "Tester Tester")
}
}
loop{Graphics.update}
|