Oct 19, 2008 11:42 AM
New CS4 features
-
Like (0)
create_RTL_paragraph (app.activeDocument, 'RTL');
function create_RTL_paragraph (doc, stylename)
{
if (doc.paragraphStyles.item (stylename) == null)
doc.paragraphStyles.add ({name: stylename});
var ps = doc.paragraphStyles.item (stylename);
ps.composer = "Adobe World-Ready Paragraph Composer";
ps.paragraphDirection = ParagraphDirectionOptions.rightToLeftDirection;
ps.characterDirection = CharacterDirectionOptions.rightToLeftDirection;
// ps.paragraphJustification = ParagraphJustificationOptions.arabicJustification;
// ps.diacriticPosition = DiacriticPositionOptions.opentypePosition;
}
w = new Window ('dialog');
tpanel = w.add ('tabbedpanel');
t0 = tpanel.add ('tab', undefined, 'Tab 0');
c00 = t0.add ('checkbox', undefined,'Checkbox 0 in tab 0');
c01 = t0.add ('checkbox', undefined,'Checkbox 1 in tab 0');
c01 = t0.add ('checkbox', undefined,'Checkbox 2 in tab 0');
t1 = tpanel.add ('tab', undefined, 'Tab 1');
c10 = t1.add ('checkbox', undefined,'Checkbox 0 in tab 0');
c11 = t1.add ('checkbox', undefined,'Checkbox 1 in tab 1');
c12 = t1.add ('checkbox', undefined,'Checkbox 2 in tab 2');
buttons = w.add ('group');
buttons.alignChildren = ['right', 'bottom']
buttons.orientation = 'row';
okButton = buttons.add ('button', undefined, 'OK');
buttons.add ('button', undefined, 'Cancel');
if (w.show () == 1)
{
$.writeln ("Selected panel on exit: " + tpanel.selection.text);
}
otfStylisticSets already was available as a text property in CS3; now, in CS4 you also have otfStylisticAlternate, which selects the 'salt' feature of your current font. The weird thing is, in the User Interface you cannot select this! (Equally weird is it is recognized in character and paragraph styles. That means that, as soon as you have used the feature in your document, you can use it in char & par definitions.)
var myStyleList = new Array;
for(c = 1; c < app.activeDocument.paragraphStyles.length; c++)
{
if (app.activeDocument.paragraphStyles.item(c).otfStylisticAlternate == true)
name = "[+] ";
else
name = "[-] ";
name += app.activeDocument.paragraphStyles.item(c).name;
myStyleList.push(name);
}
var myCharsList = new Array;
for(c = 1; c < app.activeDocument.characterStyles.length; c++)
{
if (app.activeDocument.characterStyles.item(c).otfStylisticAlternate == true)
name = "[+] ";
else
name = "[-] ";
name += app.activeDocument.characterStyles.item(c).name;
myCharsList.push (name);
}
var parDialog = app.dialogs.add({name:"Salt your Styles",canCancel:true});
with(parDialog)
{
with(dialogColumns.add())
{
with(dialogRows.add())
{
parCheck = checkboxControls.add({staticLabel:"Paragraph style"});
parDropdown = dropdowns.add({stringList:myStyleList, selectedIndex:0});
}
with(dialogRows.add())
{
charCheck = checkboxControls.add({staticLabel:"Character style"});
charDropdown = dropdowns.add({stringList:myCharsList, selectedIndex:0});
}
}
}
var result = parDialog.show();
if (result)
{
if (parCheck.checkedState)
app.activeDocument.paragraphStyles.item(parDropdown.selectedIndex+1).otfStylisticAlternate =
!app.activeDocument.paragraphStyles.item(parDropdown.selectedIndex+1).otfStylisticAlternate;
if (charCheck.checkedState)
app.activeDocument.characterStyles.item(charDropdown.selectedIndex+1).otfStylisticAlternate =
!app.activeDocument.characterStyles.item(charDropdown.selectedIndex+1).otfStylisticAlternate;
}
parDialog.destroy();
North America
Europe, Middle East and Africa
Asia Pacific
Copyright © 2011 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).