Embedding Bold Italic Fonts?
Ok first of all, sorry if this has been coverd but the "search forums" field apprently searchs all adobe forums and not just this one. ![]()
I have been using TextLayout Framework for some time now and I have been embedding open type fonts with jsfl, and this works wonderfully with fonts such as the Champion family that have fonts such as "Champion Bantamweigh" or "Champion Featherweight". But font families like ITC Avant Garde Std is where I get completely lost.
Here is how I am embedding my fonts ():
embedFont("ITC Avant Garde Std Bold", "ITC_Avant_Garde_Std_Bold");
embedFont("ITC Avant Garde Std Demi", "ITC_Avant_Garde_Std_Demi");
embedFont("ITC Avant Garde Std Md", "ITC_Avant_Garde_Std_Md");
embedFont("ITC Avant Garde Std Bold Obl", "ITC_Avant_Garde_Std_Bold_Obl");
embedFont("Champion Bantamweight", "Champion_Bantamweight");
embedFont("Champion Featherweight", "Champion_Featherweight");
function embedFont(fontName, className){
var symbolName = fontName + "_DF4";
var doc = fl.getDocumentDOM();
if (doc) {
var index = doc.library.findItemIndex(symbolName);
if (index > -1) doc.library.deleteItem(symbolName);
doc.library.addNewItem('font', symbolName);
var index = doc.library.findItemIndex(symbolName);
if (index > -1) {
var fontObj = doc.library.items[index];
fontObj.isDefineFont4Symbol = true;
fontObj.bitmap = false;
fontObj.font = fontName;
fontObj.bold = false;
fontObj.italic = false;
fontObj.embedVariantGlyphs = true;
fontObj.linkageExportForAS = true;
fontObj.linkageExportInFirstFrame = true;
fontObj.linkageClassName = className + "_DF4";
}
}
}
Now, when i use these fonts I do so such as these two examples:
SpanElement.fontFamily = "Champion Heviweight"
SpanElement.fontFamily = "ITC Avant Garde Std Md"
These both work, but with the other Avant Garde family the font does not render with the embed glyphs if the font uses styles such as Bold, Italic, Bold Italic .. something like:
SpanElement.fontFamily = "ITC Avant Garde Std BoldObl"
It doesn't work, I got the bold version to work by using
SpanElement.weight = "bold"
The above code works on along with SpanElement.fontFamily = "ITC Avant Garde Std Bk", which i find very odd because I don't want to put a faux style on someting, I want to use the actual font with the embeded fonts, though it doesn't seem to be using faux anthing. So why is this required for fonts that have "Bold" or "Black" in their name?? it makes zero sense to me especially when latest API refrence say:
"TextLayoutFormat: Weight of text (adopts parent's value if undefined during cascade). May be normal, for use in plain text, or bold. Applies only to device fonts (fontLookup property is set to flash.text.engine.FontLookup.DEVICE). "
But for the life of me I can not get ITC Avant Garde Std Bold Obl to work and I am not sure why, there seems to be a big gap between what fonts are named and what name I have to use in AS 3 in order for SpanElement.fontFamily can take them and display them correctly, if anyone has any detailed documentation about how this process works, or insight it would be greatly appreciated because I am baffled. I will keep you updated if i figure it out, I will be working on it till i figure it out hopefully.
Thanks in advance,
Troy
