如何覆盖默认的 Feathers 主题字体
How to override default Feathers theme font
我想覆盖 MinimalDesktopTheme
默认字体(以便能够使用 UTF-8 字符)并且我扩展了主题 class 如下:
public class DesktopTheme extends MinimalDesktopTheme
{
public function DesktopTheme()
{
super();
}
override protected function initializeFonts():void
{
super.initializeFonts();
trace(TextField.getBitmapFont(FontProxy.ACTION_JACKSON_NAME));
this.primaryTextFormat = new BitmapFontTextFormat(
FontProxy.ACTION_JACKSON_NAME,
30,
BaseMinimalDesktopTheme.PRIMARY_TEXT_COLOR
);
}
}
跟踪显示字体已成功注册:[object BitmapFont]
。在执行这段代码之前,我在不同的地方注册了它。
问题是在 1871
行的 feathers.core::FeathersControl/setSizeInternal
抛出异常,并显示以下消息 [Fault] exception, information=ArgumentError: A component's height cannot be NaN.
The height
parameter was not a number for some原因。
我在生成位图字体时也在研究字体大小,我注意到对于位图字体大小的某些值,不会发生此异常。
我做错了什么?如何正确覆盖默认主题字体?
事实证明我的方法是正确的,问题是我生成的位图字体是纯文本格式而不是XML。
我想覆盖 MinimalDesktopTheme
默认字体(以便能够使用 UTF-8 字符)并且我扩展了主题 class 如下:
public class DesktopTheme extends MinimalDesktopTheme
{
public function DesktopTheme()
{
super();
}
override protected function initializeFonts():void
{
super.initializeFonts();
trace(TextField.getBitmapFont(FontProxy.ACTION_JACKSON_NAME));
this.primaryTextFormat = new BitmapFontTextFormat(
FontProxy.ACTION_JACKSON_NAME,
30,
BaseMinimalDesktopTheme.PRIMARY_TEXT_COLOR
);
}
}
跟踪显示字体已成功注册:[object BitmapFont]
。在执行这段代码之前,我在不同的地方注册了它。
问题是在 1871
行的 feathers.core::FeathersControl/setSizeInternal
抛出异常,并显示以下消息 [Fault] exception, information=ArgumentError: A component's height cannot be NaN.
The height
parameter was not a number for some原因。
我在生成位图字体时也在研究字体大小,我注意到对于位图字体大小的某些值,不会发生此异常。
我做错了什么?如何正确覆盖默认主题字体?
事实证明我的方法是正确的,问题是我生成的位图字体是纯文本格式而不是XML。