嵌入字体在 Flex 移动 ActionBar 中不起作用 [英] embedded font won't work in Flex mobile ActionBar

查看:19
本文介绍了嵌入字体在 Flex 移动 ActionBar 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我嵌入了一些字体,并在我的移动应用程序中使用它们,它们都可以正常工作,除了我尝试用于ActionBar"的字体.它们在其他任何地方都可以使用,用 "Comic Sans MS" 代替 "titleCGF" 将其更改为 Comic Sans.那么为什么它不适用于我的自定义 fontFamily?

i've got a few fonts embedded and am using them in my mobile application, and they are all working, except for the ones i try to use for the "ActionBar". They work everywhere else, and substituting "Comic Sans MS" for "titleCGF" changes it to Comic Sans. So why won't it work with my custom fontFamily?

    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        @font-face {
            src: url("assets/Comic_Book.ttf");
            fontFamily: comic;
            embedAsCFF: false;
        }
/******************************
        @font-face{
            src: url("assets/CGF_Locust_Resistance.ttf");
            fontFamily: titleCGF;
            embedAsCFF: false;
        }
        @font-face{
            src: url("assets/CGF_Locust_Resistance.ttf");
            fontFamily: titleCGF;
            embedAsCFF: true;
        }
**********************************/
        .titleStyle{
            fontFamily: titleCGF;
            color: #FFFFFF;
        }
        .comicMessage{
            fontFamily: titleCGF;
            color: #838689;
            fontSize: 14;
        }
        s|IconItemRenderer{
            fontFamily: comic;
            color: #FEBA03;
            fontSize:18;
        }
        s|ActionBar{
            defaultButtonAppearance: beveled;
            accentColor: #FEBA03;
        }
        s|ActionBar #titleDisplay{
            fontFamily: "titleCGF";

        }
    </fx:Style>

这是我得到的:

我尝试制作自己的皮肤,部分预先编写的代码是这样的:

i tried to make my own skin, and part of the pre-written code is this:

<!-- SkinParts
name=titleGroup, type=spark.components.Group, required=false
name=actionGroup, type=spark.components.Group, required=false
name=navigationGroup, type=spark.components.Group, required=false
name=titleDisplay, type=spark.core.IDisplayText, required=false
-->

当我尝试定义前三个,<s:Group .../> 之类的东西时,它工作正常.但是 spark.core.IDisplayText 没有显示任何内容.即, 什么也没有...

when i try to define something like the first three, <s:Group .../>, it works fine. But nothing shows up for spark.core.IDisplayText. ie, <s:IDisplayText .../> yeilds nothing...

推荐答案

这里有一个两次嵌入字体的示例,一次使用 embedAsCFF=false,另一次使用 embedAsCFF=true.在 http://查看完整说明blogs.adobe.com/jasonsj/2011/08/embedding-fonts-in-flex-mobile-projects.html.

Here's an example of embedding fonts twice, once with embedAsCFF=false and again using embedAsCFF=true. View the full explanation at http://blogs.adobe.com/jasonsj/2011/08/embedding-fonts-in-flex-mobile-projects.html.

Edit 1: 固定字体文件名

Edit 1: Fixed font file name

/* StyleableTextField, regular */
@font-face {
    src: url("assets/COMIC.TTF");
    fontFamily: "comic";
    embedAsCFF: false;
}

/* StyleableTextField, bold */
@font-face {
    src: url("assets/COMICBD.TTF");
    fontFamily: "comic";
    fontWeight: bold;
    embedAsCFF: false;
}

/* Label, regular */
@font-face {
    src: url("assets/COMIC.TTF");
    fontFamily: "comicCFF";
    embedAsCFF: true;
}

/* Label, bold */
@font-face {
    src: url("assets/COMICBD.TTF");
    fontFamily: "comicCFF";
    fontWeight: bold;
    embedAsCFF: true;
}

s|Label
{
    fontFamily: "comicCFF";
}

s|ActionBar
{
    fontFamily: "comic";
}

s|LabelItemRenderer
{
    fontFamily: "comic";
}

这篇关于嵌入字体在 Flex 移动 ActionBar 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆