如何覆盖默认的Feathers主题字体

科柳尼亚

我想覆盖MinimalDesktopTheme默认字体(以便能够使用UTF-8字符),并且已经扩展了主题类,如下所示:

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]在执行此代码之前,我将其注册在其他位置。

问题是,由于以下原因,feathers.core::FeathersControl/setSizeInternalat行引发了异常参数不是数字。1871[Fault] exception, information=ArgumentError: A component's height cannot be NaN.height

在生成位图字体时,我也在使用字体大小,并且我注意到,使用位图字体大小的某些值时,不会发生此异常。

我究竟做错了什么?如何正确覆盖默认主题字体?

科柳尼亚

事实证明,我的方法是正确的,问题出在我以纯文本格式而不是XML生成位图字体的事实。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章