简体   繁体   English

Pharo4 Spec GUI:如何更改字体大小

[英]Pharo4 Spec GUI: How to change font size

I am thinking of programming my next project in Pharo. 我正在考虑在Pharo中编写我的下一个项目。 For this I will need to create a status monitor that can be seen from further away. 为此,我需要创建一个状态监视器,可以从更远的地方看到它。 The GUI is very simple. GUI非常简单。 Basically just a few labels and buttons. 基本上只有几个标签和按钮。 Here is the problem: I need the font to be rather big - so that it can be seen from further away. 这里是问题:我需要字体很大-以便可以从更远的地方看到它。 How can I achieve this? 我该如何实现? Here is some sample code. 这是一些示例代码。 My two labels need their font sitze changed: 我的两个标签需要更改其字体大小:

initializeWidgets
  last1 := self newLabel.
  last1 label: '88,88'.

  last2 := self newLabel.
  last2 label: '99,99'.

Thanks a lot!!! 非常感谢!!!

Not well supported for now. 目前还没有很好的支持。 You can workaround this problem be resetting the font when the widget is built: 您可以解决此问题,方法是在构建小部件时重置字体:

|lm|
lm:=LabelModel new.
lm label:'Hello'.
lm whenBuiltDo: [ :w | w widget font: (LogicalFont familyName: 'Source Code Pro' pointSize: 30)].
lm openWithSpec.

When using lm whenBuiltDo: within the initializeWidgets method of a ComposableModel we do not get the LabelModel as in above suggestion, but a MorphicLabelAdapter. 在ComposableModel的initializeWidgets方法中使用lm whenBuiltDo: ,我们没有像上面的建议那样获得LabelModel,而是得到了MorphicLabelAdapter。 That one does understand widget again and returns the LabelModel. 那个再次了解小部件并返回LabelModel。 So above example needs to read: 因此,上面的示例需要阅读:

... lm whenBuiltDo: [ :w | w widget widget font: (LogicalFont familyName: 'Source Code Pro' pointSize: 30)]. lm openWithSpec.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM