我有以下代码:
Shoes.app title: "Add a person to database" do
stack do
title "Create a new person"
para "Enter their name:", :font => "MS UI Gothic"
@name = edit_line
para "Enter their age:", :font => "MS UI Gothic"
@age = edit_line
para "Enter their address:",:font => "MS UI Gothic"
@address = edit_line
para "Enter their mobile number:", :font => "MS UI Gothic"
@mob_number = edit_line
para "Enter their home number:", :font => "MS UI Gothic"
@home_number = edit_line
button "Add person to database" do
Person.new(@name, @age, @address, @mob_number, @home_number)
para newperson.details
end
end
end
不是将字体样式设置为每个元素的“MS UI Gothic”,我希望将默认字体设置为应用程序中显示的所有文本的MS UI Gothic。我无法从我找到的任何教程中解决如何做到这一点。有什么建议吗?
答案 0 :(得分:2)
这取决于您使用的是Shoes3还是Shoes4。
在Shoes3中,您只需将style Para, font: "MS UI Gothic"
放在Shoes.app
块中的任意位置即可。它将为应用程序中的所有段落设置该样式。
Shoes.app title: "Add a person to database" do
style Para, font: "MS UI Gothic"
stack do
title "Create a new person"
para "Enter their name:"
@name = edit_line
para "Enter their age:"
@age = edit_line
para "Enter their address:"
@address = edit_line
para "Enter their mobile number:"
@mob_number = edit_line
para "Enter their home number:"
@home_number = edit_line
button "Add person to database" do
Person.new(@name, @age, @address, @mob_number, @home_number)
para newperson.details
end
end
end
由于Shoes4坐在一个新的Ruby(1.9+)中,你需要写
而是style Shoes::Para, font: "MS UI Gothic"
。
有关此主题的Shoes3和4之间差异的详细信息,请在github上查看此对话:https://github.com/shoes/shoes4/pull/460。