Adobe Extending Flash Professional CS5 Manuale Utente Pagina 304

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 565
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 303
282
EXTENDING FLASH PROFESSIONAL
fontItem object
Last updated 5/2/2011
function embedFontSymbol(symbolName, fontName, includeVariants) {
var doc = fl.getDocumentDOM();
if (doc) {
// look up the item. if it exists, delete it.
var index = doc.library.findItemIndex(symbolName);
if (index > -1)
doc.library.deleteItem(symbolName);
// make a new font symbol in the library
doc.library.addNewItem('font', symbolName);
// look up the symbol by its name
var index = doc.library.findItemIndex(symbolName);
if (index > -1) {
// get the item from the library and set the attributes of interest
var fontObj = doc.library.items[index];
fontObj.isDefineFont4Symbol = true;
fontObj.font = fontName;
fontObj.bold = false;
fontObj.italic = false;
fontObj.embedVariantGlyphs = includeVariants;
// this is what forces the font into the SWF stream
fontObj.linkageExportForAS = true;
fontObj.linkageExportInFirstFrame = true;
}
}
}
The following function displays all the font symbols in the Output panel.
function dumpFontSymbols()
{
var doc = fl.getDocumentDOM();
if (doc) {
var items = doc.library.items;
fl.trace("items length = " + items.length);
var i;
for(i=0; i<items.length; i++) {
var item = items[i];
fl.trace("itemType = " + item.itemType);
if (item.itemType == 'font') {
fl.trace("name = " + item.name);
fl.trace("DF4 symbol = " + item.isDefineFont4Symbol);
fl.trace("font = " + item.font);
}
}
}
}
See also
fontItem.isDefineFont4Symbol, text.embedVariantGlyphs
Vedere la pagina 303
1 2 ... 299 300 301 302 303 304 305 306 307 308 309 ... 564 565

Commenti su questo manuale

Nessun commento