在 Flash 中嵌入具有相同 fontName 属性的字体

发布于 2024-07-19 03:43:54 字数 547 浏览 2 评论 0原文

我正在使用包含许多字体类的外部 swf 在运行时为我的 Flash 站点加载和注册字体。 (在库面板 Flash IDE 中导出,然后在框架脚本中注册)

在这种特殊情况下,swf 包含同一系列的许多不同权重。 例如。 罗马字体、斜体字体、浅字体、重字体等...

字体看起来注册良好,但是当我尝试使用这些字体时,这些字体的一些 fontName 属性是相同的。 三个显示为罗马字,两个显示为浅色,一个显示为浅色...所以我去寻找一些愚蠢的编码错误,但令我沮丧的是我没有找到任何错误。 正确的字体对象以正确的顺序加载。

经过相当多的测试后,我检查了我的字体文件夹(vista)。 当我打开 Heavy 文件时,字体查看器中的标题显示 Roman; 字体查看器中的标题与我在 Flash 中得到的标题相匹配。 此行为似乎是该字体所独有的。

由于 fontName 是我知道如何将字体分配给 TextField 的唯一方法,因此我很困惑如何为我的动态标题使用这种可爱的粗字体!

这是 type 1 字体

任何人都可以提出原因、解决方案或解决方法吗?

I'm using an external swf containing a number of font classes to load and register the fonts for my flash site at runtime. (exported in the library panel Flash IDE then registered in the frame script)

In this particular case the swf contains a number of different weights of the same family. eg. font roman, font italic, font light, font heavy, etc...

The fonts appear to register fine, but when I try to use the fonts some of the fontName properties of these fonts are identical. Three are showing up as Roman and two as light and one is light sc... So I went searching for some silly coding errors, but to my dismay I didn't find any. The correct font objects were loading in the right order.

After quite a bit of testing I checked my fonts folder (vista). When I opened the file for Heavy the title in font viewer shows Roman; the titles in font viewer matched what I was getting in flash. This behaviour appears to be unique to this font.

Since fontName is the only way i know how to assign a font to a TextField I'm stumped as to how I can use that lovely heavy font for my dynamic headings!

It's a type 1 font

Can anyone suggest a cause, solution or a workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

带上头具痛哭 2024-07-26 03:43:54

谢谢,我认为你的说法是对的。

不过,我确实找到了一种嵌入字体和设置名称的方法。

首先,我使用 CrossFont 将 Type 1 postscript 字体转换为 .otf

使用 cs4 中现有的 [embed()] 功能,我能够使用 fontFamily 属性来设置嵌入字体的 fontName 属性。

在下面的代码中,您可以看到我将名称设置为“BlaaDeeBlaa”,TextFormat 将接受它并显示嵌入的字体。

[Embed(source="assets/FontFileName.otf",
                            fontFamily="BlaaDeeBlaa",
                            mimeType="application/x-font")]
var BlaaDeeBlaa:Class;

var CH:Font = new BlaaDeeBlaa();

var testTxt:TextField =  new TextField();
testTxt.defaultTextFormat = new TextFormat("BlaaDeeBlaa",28,0x000000,true);
testTxt.embedFonts = true;
testTxt.text = Font.enumerateFonts(false)[0].fontName;
testTxt.autoSize = "left";
addChild(testTxt);

注意:只有 OpenType(.OTF) 和 Truetype (.TTF) 可以使用此方法嵌入,

我通过 Lee Brimelows 在 gotoandlearn 的教程

Thanks, i think your right about that.

I did however find a way of embedding the font and setting the name.

First of all I used CrossFont to convert the Type 1 postscript font to an .otf

Using the [embed()] feature now available in cs4, I was able to use the fontFamily attribute to set the fontName property of the embedded font.

In the code below you can see I set the name to "BlaaDeeBlaa" and the TextFormat will accept it and display the embedded font.

[Embed(source="assets/FontFileName.otf",
                            fontFamily="BlaaDeeBlaa",
                            mimeType="application/x-font")]
var BlaaDeeBlaa:Class;

var CH:Font = new BlaaDeeBlaa();

var testTxt:TextField =  new TextField();
testTxt.defaultTextFormat = new TextFormat("BlaaDeeBlaa",28,0x000000,true);
testTxt.embedFonts = true;
testTxt.text = Font.enumerateFonts(false)[0].fontName;
testTxt.autoSize = "left";
addChild(testTxt);

n.b. Only OpenType(.OTF) and Truetype (.TTF) can be embedded using this method

I was put onto this technique by Lee Brimelows' tutorial at gotoandlearn

何必那么矫情 2024-07-26 03:43:54

听起来这是字体的问题,而不是你的软件(Flash)的问题。

如果它是免费字体,则字体系列的作者很可能使用一种字体作为基础,并针对不同的字体风格编辑了它的副本。 他们可能刚刚更改了文件名,而忘记更改内部名称。

您也许可以以某种方式自己编辑名称,但我对此不太确定。

It sounds like that is a problem with the font rather that your software(Flash).

If it's a free font, it is quite possible that the author of the font-family used one font as a base and edited copies of it for different styles of the face. They may have just changed the filename, and forgot to change the internal name.

You might be able to edit the names yourself somehow, but I am not too sure about this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文