Loading Fonts at Runtime with latest Flex 4 SDK

11 May, 2010 @ 03:27:29 GMT

I wrote a post a while back about loading fonts at runtime. Nothing there has really changed, but I did want to clarify one thing on here. I just discovered that when embedding fonts with the lastest Flex 4 SDK, I got an error with the following

[Embed(systemFont='OCR A Std', 
fontName="OCR",
mimeType="application/x-font",
unicodeRange="U+0041-U+005A")]

The error read:
Error: exception during transcoding: Cannot embed local font 'nameOfFont' as CFF. The CSS @font-face 'local()' syntax is not supported. Please specify a path directly to a font file using the 'url()' syntax. For [Embed] syntax the 'systemFont' attribute is not supported. Please specify a path directly to a font file using the 'source' attribute.

I found that adding the following solved this problem.

[Embed(systemFont='OCR A Std', 
fontName="OCR",
embedAsCFF='false',
mimeType="application/x-font",
unicodeRange="U+0041-U+005A")]

Comment Area


1. Seb12 May, 2010 @ 19:02:06

Just to clarify : embedding a font is not done at runtime, it's done at compile time.


2. Ben13 May, 2010 @ 00:48:11

Right you are, Seb! Which is why we compile the font first at compile time and then load it at runtime. Check out Loading Fonts at Runtime for more about that.


3. Victor31 May, 2010 @ 05:44:28

Thank you for this fix. I ran into the exact same error trying to compile a font in Flash CS5; this solved it.



Leave a Comment

Name: *

Email: *

Website:

Your Comment: *

Tags you can use: <strong>, <em>, <b>, <u>, <code>, <img>, <br>, <href>, <rel>, <src>.

( Please also note that this form requires JavaScript enabled to work.
In addition, due to spam checks, your comment may take a little while to display ).