设置鞋子元素的默认字体



我有以下代码:

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"。我无法从我找到的任何教程中弄清楚如何做到这一点。有什么建议吗?

这取决于您使用的是 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 上的对话。

相关内容

  • 没有找到相关文章

最新更新