Thread View: adobe.scripting.indesign
4 messages
4 total messages
Started by Scott_Braucher
Thu, 15 Jan 2009 15:18
Font for inserting glyph [JS]
Author: Scott_Braucher
Date: Thu, 15 Jan 2009 15:18
Date: Thu, 15 Jan 2009 15:18
11 lines
1140 bytes
1140 bytes
I'm using a small Javascript to insert a Unicode glyph at the text insertion point:
if (app.selection[0].constructor.name == "InsertionPoint"){
with (app.selection[0].insertionPoints[0]){ // insertion point
contents = String.fromCharCode(0x20A6);
}
}
This script works, but because the glyph only exists in a few fonts, I need to add something to the script to specify the font used when inserting the glyph. I've tried to specify the insertion point appliedFont, but I can't figure out the syntax.
Any help or suggestions for an alternative approach will be appreciated.
Re: Font for inserting glyph [JS]
Author: Scott_Braucher
Date: Thu, 15 Jan 2009 15:24
Date: Thu, 15 Jan 2009 15:24
1 lines
628 bytes
628 bytes
I meant to say this is for CS3.
Re: Font for inserting glyph [JS]
Author: Peter Kahrel
Date: Thu, 15 Jan 2009 17:45
Date: Thu, 15 Jan 2009 17:45
10 lines
972 bytes
972 bytes
if (app.selection[0].constructor.name == "InsertionPoint"){
with (app.selection[0].insertionPoints[0]){ // insertion point
appliedFont = 'Arial\tRegular';
contents = String.fromCharCode(0x20A6);
}
}
Font family and style are in one string, separated by a tab (\t). By the way, you can insert a unicode character like this: .contents = '\u20A6' -- saves on typing!
Peter
Re: Font for inserting glyph [JS]
Author: Scott_Braucher
Date: Fri, 16 Jan 2009 00:03
Date: Fri, 16 Jan 2009 00:03
1 lines
621 bytes
621 bytes
Thanks, Peter, This works like a charm!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads