问题描述
我不知道你的情况,但是我很难把我的头弄到TLF。
我正在使用Flash CS5。我有从外部SWF加载的嵌入式字体。据我所知,它嵌入正确 - 它曾经工作之前,我从经典的TextField切换 - 但我需要切换,因为我需要先进的连字支持。我的代码是:
//设置...
var text:TFLTextField = new TLFTextField();
text.width = 530;
text.height = 330;
text.type = TextFieldType.INPUT;
text.text =在这里输入你自己的文字;
text.embedFonts = true;
addChild(text);
var format:TextLayoutFormat = new TextLayoutFormat();
format.fontSize = currentSize;
format.ligatureLevel = LigatureLevel.EXOTIC;
textFlow = text.textFlow;
textFlow.hostFormat = format;
textFlow.flowComposer.updateAllControllers();
...稍后当字体被加载时:
private function fontLoadedHandler(e:Event):void {
var a:Array = Font.enumerateFonts();
for(var i:Number = 0; i< a.length; i ++){
trace(a [i]); //字体名称在列表中显示得很好...
$ b var format:TextLayoutFormat = new TextLayoutFormat();
format.fontFamily = e.currentTarget.fontName;
format.fontLookup = FontLookup.EMBEDDED_CFF;
format.fontSize = currentSize;
textFlow.invalidateAllFormats();
textFlow.hostFormat = format;
textFlow.flowComposer.updateAllControllers();
$ b当我编译时,它默认为Times New Roman。我已经做了一个合理的谷歌搜索量,并发现这一点:
这个家伙似乎和我有类似的问题,但我已经尝试了他的解决方案,得到了同样的负面结果。
任何帮助或链接或任何东西将不胜感激!
谢谢,
Andrey
编辑: Scratch that, Arial worked after I changed embedFonts to false. So the problem is embedding after all.
解决方案 Right, I know exactly what the problem is now. I'm leaving this to serve as a warning for anyone else who's tremendously confused by TLF (a lot of people I imagine).
The problem arises from compatibility issues between the outline formats that TLF and Classic Text use. Apparently, TLF only works exclusively with DF4, and Classic Text works exclusively with DF3. You can change these settings from the Embed dialog, under the Actionscript tab (Flash CS5, not sure about CS4).
I'm not really sure if there is a workaround for this - and I'm definitely going to look for one since at the moment I need to use both DF3 AND ligatures - but I think this is enough of an answer to help anyone else who stumbles upon this issue in the future.
Andrey
这篇关于在TLFTextField中使用嵌入的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!