字体未嵌入 Flash CS4 AS3

发布于 2024-08-18 07:01:31 字数 2780 浏览 10 评论 0原文

也许你可以帮助我解决我遇到的问题。该项目的网址是: http://www.mauriciogiraldo.com/vgline/beta/

这是一个 Drupal-由 AMFPHP 连接的 AS3 Web 应用程序。数据毫无问题地传输到 Flash,我已经验证 UTF-8 没问题。在以下 URL 中可以更好地看到该问题:

http://www.mauriciogiraldo.com/ vgline/beta/#/146

该链接的纯文本版本:

http:// www.mauriciogiraldo.com/vgline/node/146

(注意这个人的名字)

字体是 Inconsolata,尽管如果需要的话我可以使用任何等宽开源字体。您可以看到我已经嵌入了字体(我什至选择动态文本字段来嵌入整个内容,完整的字符集)以及库中的“新字体”菜单。 Inconsolata 在 CS4 创作工具中显示为星号(根据 Adob​​e文档意味着该内容是嵌入的)。

我尝试过其他字体嵌入选项但无济于事。 Inconsolata 在创作中使用时似乎有“ō”字符,但它没有出现在动态文本中。

我遇到的另一个问题:如果我使用静态文本字段,则字体不会嵌入(WTF)。我必须将字段转换为动态字段,然后它才能工作(“视频游戏历史时间线”左上角是一个动态文本字段,尽管我不希望它是......那个和其他字段)。如果我使用静态文本字段,字体会转换为某种 Times New Roman 字体。

文本是 AS3 创建的(以及搜索结果)。

我通过 HTML (.htmlText) 嵌入文本并使用 CSS 设计样式。

整个代码是开源的,可以在这里找到:

http://code.google.com/p /vgline/

可以在此处找到如何填写文本字段的示例:

http://code.google.com/p/vgline/source/browse/trunk/src/TLDetail.as

此类代码的一个片段是:

 var ss:StyleSheet = new StyleSheet();
 var css:String = ".title { color:#333333; font-family:Inconsolata; font-size:16; leading:2; } ";
 css += ".date { color:" + StringUtils.rgb2web(data.color.r, data.color.g, data.color.b) + "; font-family:Inconsolata; font-size:14; leading:4; } ";
 css += ".text { color:#333333; font-family:Inconsolata; font-size:11; leading:4; } ";
 css += ".link { color:#000000; font-family:Inconsolata; font-size:11; leading:4; text-decoration:underline; } ";
 css += "a:hover { text-decoration:none; } ";
 ss.parseCSS(css);
 var fechahtml:String = "<span class='date'>";
 if (data.mes != null && data.dia != null) {
         fechahtml += data.dia + " " + StringUtils.month2name(data.mes) + " " + data.anotext;
 } else if (data.mes != null) {
         fechahtml += StringUtils.month2name(data.mes) + " " + data.anotext;
 } else {
         fechahtml += data.anotext;
 }
 fechahtml += "</span>";
 date_txt = new TextField();
 date_txt.width = 275;
 date_txt.embedFonts = true;
 date_txt.antiAliasType = "advanced";
 date_txt.styleSheet = ss;
 date_txt.htmlText = fechahtml;
 date_txt.x = 8;
 date_txt.y = 3;

 addChild(date_txt);

任何帮助都会非常感谢。我真的不知道该怎么办。

谢谢

Maybe you can help me with a problem I am having. The URL of the project is:
http://www.mauriciogiraldo.com/vgline/beta/

It is a Drupal-powered, AMFPHP-connected AS3 web app. The data goes through to Flash with no problems, I have verified that UTF-8 is fine and all. The problem can be better seen in these URLs:

http://www.mauriciogiraldo.com/vgline/beta/#/146

A plaintext version of that link:

http://www.mauriciogiraldo.com/vgline/node/146

(Note the name of the guy)

The font is Inconsolata although I could use any monospace open-source font if necessary. You can see that I have embedded the font (I even opted for the dynamic textfields to embed the whole thing, full charset) as well as the "New Font" menu in the library. Inconsolata shows up with an asterisk in the CS4 authoring tool (which according to Adobe documentation means the thing is embedded).

I have tried other font embedding options to no avail. Inconsolata seems to have that "ō" character when used in the authoring but it is not showing up in the dynamic texts.

Another problem I am having: if I use static text fields the font doesn't get embedded (WTF). I have to convert the field to dynamic and then it works ("the videogame history timeline" top left is a dynamic text field although I would prefer it not to be... that and others). If I use static text field the font gets converted to some sort of Times New Roman font.

The text is AS3-created (as well as the search results).

I am embedding the text via HTML (.htmlText) and styling with CSS.

The whole code is open source and can be found here:

http://code.google.com/p/vgline/

An example of how I fill in a text field can be found here:

http://code.google.com/p/vgline/source/browse/trunk/src/TLDetail.as

A snippet of such code is:

 var ss:StyleSheet = new StyleSheet();
 var css:String = ".title { color:#333333; font-family:Inconsolata; font-size:16; leading:2; } ";
 css += ".date { color:" + StringUtils.rgb2web(data.color.r, data.color.g, data.color.b) + "; font-family:Inconsolata; font-size:14; leading:4; } ";
 css += ".text { color:#333333; font-family:Inconsolata; font-size:11; leading:4; } ";
 css += ".link { color:#000000; font-family:Inconsolata; font-size:11; leading:4; text-decoration:underline; } ";
 css += "a:hover { text-decoration:none; } ";
 ss.parseCSS(css);
 var fechahtml:String = "<span class='date'>";
 if (data.mes != null && data.dia != null) {
         fechahtml += data.dia + " " + StringUtils.month2name(data.mes) + " " + data.anotext;
 } else if (data.mes != null) {
         fechahtml += StringUtils.month2name(data.mes) + " " + data.anotext;
 } else {
         fechahtml += data.anotext;
 }
 fechahtml += "</span>";
 date_txt = new TextField();
 date_txt.width = 275;
 date_txt.embedFonts = true;
 date_txt.antiAliasType = "advanced";
 date_txt.styleSheet = ss;
 date_txt.htmlText = fechahtml;
 date_txt.x = 8;
 date_txt.y = 3;

 addChild(date_txt);

ANY help will be greatly appreciated. I really don't know what to do.

Thanks

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

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

发布评论

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

评论(3

じее 2024-08-25 07:01:31

字体嵌入是我创建 Flash 时最喜欢的敌人之一。但我找到了一种方法来减少墙上的洞(以及头上的肿块)。

  1. 将字体嵌入到库中
  2. 将字体符号(在库中)链接到扩展 Font 类的自定义类(现在我们将其称为 MyFont
  3. 创建一个 TextFormat 对象(我们称之为 frmt
  4. 设置 frmt.font = new MyFont().fontName
  5. 创建一个 TextField (让我们称之为tf
  6. 分配tf.embedFonts = truetf.defaultTextFormat = frmt

希望这有帮助。

Font embedding is one of my favourite enemies of all time when creating flash. But I found a way to reduce the amount of holes in my walls (and bumps on my head).

  1. Embed the font into the Library
  2. Link the font symbol (in the Library) to a custom class extending the Font-class (lets call it MyFont for now)
  3. Create a TextFormat object (let's call it frmt)
  4. Set frmt.font = new MyFont().fontName
  5. Create a TextField (let's call it tf)
  6. Assign tf.embedFonts = true and tf.defaultTextFormat = frmt

Hope this helps.

尸血腥色 2024-08-25 07:01:31

我遇到了类似的问题,Arial Regular(在启用 HTML 的动态文本字段中)不显示 AS 中 html 标记指定的粗体文本。

通过将字体更改为 Lucida Sans,一切正常。

I had a similar problem with Arial Regular (in a dynamic text field with HTML enabled) not displaying bold text dictated by the html tags in the AS.

By changing the font to Lucida Sans it all worked fine.

陈独秀 2024-08-25 07:01:31

我稍后会看看。

听起来有些熟悉。
当我在多语言网站上工作时,尽管在 IDE(flash cs3)中显示了字符,但我也遇到了同样的问题,即字符未显示在静态文本字段的 swf 中。当时的问题是 Arial 中的希腊字符。
我必须下载 带有正确希腊字符的单独版本的 Arial 并修复了它。

也许这是同一个问题,您需要同一字体的不同版本。

您是否尝试过使用 Courier NewLucida Console 进行同样的操作?我尝试了一种基本设置(名称 Tōru Iwatani 用 2 个文本字段、一个 Courier New、一个 Lucida Console、嵌入字体、动态文本、旋转文本字段编写,只是为了测试嵌入,并且显示正常。


编辑:

我使用来自 dafont.com

这是我用来查找字体的片段应该有效:

var fonts:Array = Font.enumerateFonts();
for(var i:int = 0 ; i < fonts.length; i++){
    if(fonts[i].hasGlyphs('ō')) trace(fonts[i].fontName);
}

这是我得到的列表:

Monaco
Lucida Grande
Bitstream Vera Sans Mono
saxMono
JackInput
Liberation Mono Regular
F25 Bank Printer

我尝试了两种不同的方法,

将字体嵌入到库中并没有帮助,正如您在此处看到的:

library embed

使用舞台上的实例嵌入字体适用于某些字体:

stage embed

这是我用于测试的代码,相当混乱,但它是一个测试:)

l.text = j.text = f.text = li.text = s.text = b.text = 'Hello Tōru Iwatani...Hello Tōru Iwatani...Hello Tōru Iwatani...';

var lucida:TextField = getStyledTextField("Lucida Grande");
var liberation:TextField = getStyledTextField("Liberation Mono Regular");
var sax:TextField = getStyledTextField("saxMono");
addChild(lucida);
addChild(liberation);
addChild(sax);
liberation.y = 30;
sax.y = 60; 
lucida.htmlText= liberation.htmlText = sax.htmlText = "<body><span class='text'>Hello Tōru Iwatani...</span></body>";

function getTextField(font:String):TextField{
    var label:TextField = new TextField();
    label.defaultTextFormat = new TextFormat(font,11,0x33333);
    label.autoSize = TextFieldAutoSize.LEFT;
    label.border = true;
    label.embedFonts = true;
    return label;
}

function getStyledTextField(font:String):TextField{
    var style:StyleSheet = new StyleSheet();
    style.parseCSS(".text { color:#333333; font-family:"+font+";  }");
    var label:TextField = new TextField();
    label.styleSheet = style;
    label.autoSize = TextFieldAutoSize.LEFT;
    label.border = true;
    label.embedFonts = true;
    return label;
}

l、li、b、j 等是动态的实例名称舞台上的文本字段使用类似字体
lucida grande、解放、bitstream vera sans mono、JackInput 等。

我不确定问题是什么,但在舞台上嵌入角色对我有用,
另外,我嵌入了所有字形只是为了确保。编译需要很长时间,您可能需要从可用的字体中选择一种您喜欢的字体,并逐渐删除字形,直到找到需要使用的最少量的字形。

祝你好运,
乔治

I'll have a look later.

It sounds somewhat familiar.
I had the same issue with characters not being displayed in the swf in a static text field, although displayed in the IDE( flash cs3), when I was working on a multilingual website. The problem that time was with the Greek Characters in Arial.
I had to download a separate version of Arial with proper Greek characters and that fixed it.

Maybe it's the same issue and you need a different version of the same font.

Have you tried the same thing with Courier New or Lucida Console ? I've tried a basic setup( the name Tōru Iwatani written in 2 textields, one Courier New, one Lucida Console, embedded font, dynamic text, rotated textfield, just to test embedding and it diplayed fine.


EDIT:

Hi,

I've made some tests using monospaced fonts from dafont.com

This is the snippet I used to find the fonts that should work:

var fonts:Array = Font.enumerateFonts();
for(var i:int = 0 ; i < fonts.length; i++){
    if(fonts[i].hasGlyphs('ō')) trace(fonts[i].fontName);
}

This is the list I got:

Monaco
Lucida Grande
Bitstream Vera Sans Mono
saxMono
JackInput
Liberation Mono Regular
F25 Bank Printer

I've tried a few with 2 different approaches.

Embedding the font in the Library didn't help as you can see here:

library embed

Embedding the font using an instance on Stage worked for some of the fonts:

stage embed

Here is the code I used for the test, pretty messy but it's a test :)

l.text = j.text = f.text = li.text = s.text = b.text = 'Hello Tōru Iwatani...Hello Tōru Iwatani...Hello Tōru Iwatani...';

var lucida:TextField = getStyledTextField("Lucida Grande");
var liberation:TextField = getStyledTextField("Liberation Mono Regular");
var sax:TextField = getStyledTextField("saxMono");
addChild(lucida);
addChild(liberation);
addChild(sax);
liberation.y = 30;
sax.y = 60; 
lucida.htmlText= liberation.htmlText = sax.htmlText = "<body><span class='text'>Hello Tōru Iwatani...</span></body>";

function getTextField(font:String):TextField{
    var label:TextField = new TextField();
    label.defaultTextFormat = new TextFormat(font,11,0x33333);
    label.autoSize = TextFieldAutoSize.LEFT;
    label.border = true;
    label.embedFonts = true;
    return label;
}

function getStyledTextField(font:String):TextField{
    var style:StyleSheet = new StyleSheet();
    style.parseCSS(".text { color:#333333; font-family:"+font+";  }");
    var label:TextField = new TextField();
    label.styleSheet = style;
    label.autoSize = TextFieldAutoSize.LEFT;
    label.border = true;
    label.embedFonts = true;
    return label;
}

l, li, b, j, etc. are instance names for the dynamic textfields on stage using fonts like
lucida grande, liberation, bitstream vera sans mono, JackInput, etc.

I'm not sure what the issues is, but embedding the characters on stage worked for me,
also, I embedded all the glyphs just to make sure. It takes ages to compile, you might want to pick a font that you like out of those that work, and take out glyphs gradually until you find the minimal amount of glyphs you need to use.

Goodluck,
George

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