This is a pressing issue for me that I just can’t make sense of. I’ve been programming in flex/as3 for about five months and out of two other forums I’ve joined and about twenty posts, I’ve gotten one response, so for whatever reason, information is hard to come by in the flash world, at least for newbies.
I can imbed a system font - no problem:
package fonts {
import flash.display.Sprite;
public class Ghostwriter_I extends Sprite {
[Embed(systemFont='Ghostwriter', fontName='Ghostwriter', fontStyle='italic',
fontWeight='normal',
mimeType='application/x-font')]
public var wrFont:Class;
}}
Now, if I go to the windows font directory, I see a ttf file ‘ghostwriter.ttf’, so I can try to imbed that directly. To do so I replace, “[Embed(systemFont=‘Ghostwriter’,” from the above with [Embed(source=‘c:/winnt/fonts/ghostwriter.ttf’,".
However, now I get an error from the mxmlc compiler:
Error: exception during transcoding: Font for alias ‘Ghostwriter’ with italic style was not found at: file:/c:/winnt/fonts/ghostwriter.ttf
But if I make the fontStyle=‘normal’ then it succeeds.
I’ve tried moving the ttf to my own class directory, but same results. Also the same happens for any windows system font ttf file I’ve tried - compiles OK for normal, but with bold or italic, an error occurs unless I embed as a systemFont.
The reason that I need to embed as source, Is that of the two FontManagers that the mxml compiler uses, the best one, the Batik FontManager, doesn’t do System Fonts. (The difference between Batik and the other Font manager, JRE, is actually quite pronounced - with Batik in general producing slightly superior results, and JRE flat out crashing from time to time.) Furthermore, this compilation will be done in an automated context, so I want to go with the dependable font manager.
But anyway, I’ll admit some ignorance as to what is actually going on with a windows system font - if a ttf file doesn’t actually contain italic or bold variants, are they automatically generated by windows and is that why mxml is able to only compile such a file if its a windows system font?
If there’s some way I could take a windows system font and produce an actual ttf containining italic or bold info that would work as well.
But I don’t really understand why I can’t embed an italic font using the ttf source directly. Should I be able to do this?
Apologies for the verbosity, as this may be a very trivial issue for most of you, but if it is, maybe you could clear it up for me.
Thanks.
edit:
Wasn’t saying above I’ve made twenty posts over five months over just this issue - It just came up today.