embedded Italic, bold fonts don't look the same in flex as in Windows...
Posted
by Mark
on Stack Overflow
See other posts from Stack Overflow
or by Mark
Published on 2010-04-07T19:08:56Z
Indexed on
2010/04/07
19:13 UTC
Read the original article
Hit count: 294
actionscript-3
|flex
...unless they're something like "Times New Roman" or some other established font with a fully designed italic and bold, presumably in seperate files.
Let me explain what I mean (though why no one has commented on this before I have no idea.)
Numerous, numerous fonts do not have a seperate file for italic and bold, and in fact to the best of my knowledge don't even have italic and bold defined as such. But if you install them on windows (for example) and then use them in an app, You can still make use of italic and bold with those fonts. For italic, and oblique angle is just given to it, presumably by Windows, and it looks the same in all Windows apps, and the bold is just given a heavier weight.
OK, well here's the problem: if you embed a font like that in a Flex app, as a "SystemFont" the italic and bold will not look the same as they do in Windows. Specifically, the oblique angle is invariably much less than in Windows (i.e the italic slant is much less) and the bold version is not bold enough.
I vaguely recall thinking that there was some flex mechanism to assign custom oblique angles for italic (and weight for bold) but now can't recall what it is. Does anyone know the correct established way to do this.
The following is actually a seperate (but related) font question (in case anyone is expert in all this.) Its rather a lengthy question and can be skipped, but its something that's plagued me for a long time.
I mention above embedding as a "SystemFont", so iow something like this:
package fonts {
import flash.display.Sprite;
public class FLW_Script_I extends Sprite {
[Embed(systemFont='FLW Script', fontName='FLW Script', fontStyle='italic', fntWeight='normal',
mimeType='application/x-font-truetype')]
public var wrFont:Class;
}
}
The other alternative to SystemFont for embedding, is "Source" followed by the name of an actual font file. If you try to embed one of the aformentioned single file fonts as a Source file (as opposed to SystemFont) and specify fontStyle='italic', then the mxmlc compiler will return an error and say there is no italic info in the font file. So up to now I have only been embedding these fonts as "SystemFont". The problem is, flex uses two different font compilers internally for Source embedding and SystemFont embedding. For source font embeds it uses the "Batik" compiler and for SystemFont, the JRE (Java Runtime) font compiler. Well actually the Batik is considered a superior compiler and generally produces better looking fonts. And also if you mix normal fonts compiled with Batik and italic compiled with JRE, sometimes the line spacing is different for the two, and it doesn't look right. So does anyone have an idea how to get mxmlc to do italic and bold for these single file fonts when embedding as "Source". Would there be a way using C++ or whatever to construct an "italic" font file from the SystemFont for such a font in windows.
© Stack Overflow or respective owner