运行时字体与静态文本中嵌入的字体不能很好地配合?
好奇是否有人遇到这个问题:
- 我将我的(嵌入)字体保存在运行时加载的外部文件(fonts.swf)中。相当标准。
- 我还使用了 Flash IDE 中生成的一堆 UI 图稿。其中一些图稿包含
静态
文本字段(因此,不是可以更改的正确文本字段。只是冻结的字形)。
问题是:如果我在任何静态文本字段中使用相同的字体,然后将该相同的字体嵌入到我的运行时字体集合中,则运行时字体将拒绝渲染。如果您使用 embeddedFonts=true
设置文本字段以使用未嵌入的字体,则获得相同的效果。如果我更改静态文本字段以使用不同的字体,则运行时字体可以正常工作。
注意:只有在运行时加载嵌入字体时,这才会出现问题。如果它们合并到主 .SWF 中,那就没有问题了。
根据我对静态文本字段(非常有限)的理解,它们会自动嵌入它们设置使用的字体,但仅所需的最少字符数。因此,它们嵌入了部分定义。我怀疑当我尝试在运行时加载相同的字体(并通过 Font.registerFont
发布它)时,Flash 会检测到预先存在的同名嵌入字体并默默地失败。但我真的不知道。有办法解决这个问题吗?我想保持动态和静态文本字段之间的排版一致性,但这似乎不可能......
Curious if anyone has this problem:
- I save my (embedded) fonts in an external file (fonts.swf) that gets loaded at runtime. Pretty standard.
- I also use a bunch of UI artwork generated in the Flash IDE. Some of this artwork contains
static
textfields (thus, not proper TextFields that can change. Just frozen glyphs).
Here's the problem: if I use the same font in any static textfield and then embed that same font into my collection of runtime fonts, the runtime font will refuse to render. It's the same effect you get if you set a textfield with embeddedFonts=true
to use a font that isn't embedded. If I change the static textfields to use a different font, the runtime fonts work just fine.
Note: this only appears to be a problem if your embedded fonts are loaded at runtime. If they're merged into the main .SWF, then there's no problem.
From my (very limited) understanding of static textfields, they automatically embed the font that they're set to use, but only the minimum number of characters required. Thus they embed a partial definition. I suspect that when I try to load the same font at runtime (and publish it through Font.registerFont
) that Flash detects a prexisting embedded font of the same name and fails silently. But I don't really know. Is there a way around this problem? I want to maintain typographic consistency between my dynamic and static textfields, but that doesn't seem to be possible...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这对于 Flash 8 及更低版本是不可能的。我不认为你能做到这一点,我什至问过 Macromedia 当年他们是否能做到这一点,但结果是否定的。
检查文档,我知道这是无法完成的。
也许我太老了。
I know this was not possible with Flash 8 and lower. I don't think you can do this, I even asked Macromedia back in they day if they could do this and it was NO.
Check the documentation, I was under the understanding this cant be done.
Maybe I am too old.
Adobe 确实需要让字体变得更简单。我曾经做过关于字体和文本字段的噩梦。有一段时间,我试图完全理解他们,但从那时起,他们就彻底让我疲惫不堪了。现在,我不再试图理解它们,而是专注于让它们发挥作用。
当我遇到问题时,我从头开始重做所有字体。我确保 1) 它们都是通过 CSS 和 @Embed 标签嵌入代码中的(我不信任 Flash IDE 的字体),2) 我在舞台上有该字体的实例。抱歉,这不是真正的“解决方案”,但每当我按照这些步骤操作时,字体就会再次正常工作。
然后,我交叉手指祈祷它们不要折断。当他们不可避免地这样做时,我开始咒骂 Adobe 的名字,骂得比史蒂夫·乔布斯还要糟糕,然后重新开始。哈哈。
自从我上次修复以来,我们项目中的字体已经很长时间没有“损坏”了。大多数错误都与字体的粗体版本有关。为了简化事情,我只是避免使用粗体。
Adobe really needs to make fonts easier. I've had nightmares with fonts and textfields. At one time, I tried to completely understand them but they've completely worn me down, since then. Now instead of trying to understand them, I just focus on getting them working.
When I run into the problem, I redo all my fonts from the ground up. I make sure 1) they're all embedded via CSS and @Embed tags in the code (I don't trust the Flash IDE for fonts) and 2) I have an instance of the font on stage. Sorry that's not a real "solution" but whenever I follow those steps, I get the fonts working again.
Then, I cross my fingers and pray they don't break. When they inevitably do, I start cursing Adobe's name worse than Steve Jobs and start over. lol.
Since my last fix, the fonts in our project haven't "broken" in a long time. Most of the errors have been related to the bold versions of the fonts. To simplify things, I just avoid all uses of bold.