在RichEditableText中嵌入字体

时间:2017-02-06 05:25:43

标签: actionscript-3 flex flex4

我正在使用flex的RichEditableText,我想在RichEditableText中嵌入我自己的字体,所以我给了fontLookUp = EMBEDD_CFF,仍然没有采用我的嵌入字体,以及如何使用这个RichEditableText的文本流。

1 个答案:

答案 0 :(得分:0)

请查看以下使用RichEditableText嵌入字体的代码。

<?xml version="1.0" encoding="utf-8"?>
<s:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/halo">
<s:layout>
    <s:BasicLayout />
</s:layout>

<fx:Style>
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace mx "library://ns.adobe.com/flex/halo";

    @font-face {
        src: url("assets/ACaslonPro-Regular.otf");
        fontFamily: "ACaslonProRegularEmbedded";
        embedAsCFF: true;
    }

    s|RichEditableText {
        fontFamily: ACaslonProRegularEmbedded;
        fontLookup: embeddedCFF;
        fontSize: 34;
    }
</fx:Style>

<s:RichEditableText id="textView"
                    text="The quick brown fox jumped over the lazy dog. 01234567890"
                    width="400"
                    horizontalCenter="0"
                    verticalCenter="0" />

</s:Application>