Skip to content

Instantly share code, notes, and snippets.

@pederan
Created October 20, 2011 20:02
Show Gist options
  • Save pederan/1302175 to your computer and use it in GitHub Desktop.
Save pederan/1302175 to your computer and use it in GitHub Desktop.
JSFL script to embed character ranges and special characters to library fonts. Select the font(s) in the library and run this script.
var dom = fl.getDocumentDOM();
// array of selected library items
var selItems = dom.library.getSelectedItems();
var count = selItems.length;
for(var i=0; i<count; i++)
{
currentItem = selItems[i];
//check that the selected item is a font
if(currentItem.itemType == "font")
{
currentItem.embedRanges = "1|2|3|4|5";
currentItem.embeddedCharacters = "æøåÆØÅöÖüÜäÄéÉèÉëË";
}
}
@Matan
Copy link

Matan commented Oct 20, 2011

Very nice, just a quick trivial thing. You don't have to get the selected items from the Library object, you can simple do "var selItems = dom.selection;" - and get the current selection of items directly from the dom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment