1
Explorer
,
/t5/illustrator-discussions/super-script-with-script/td-p/14458890
Feb 29, 2024
Feb 29, 2024
Copy link to clipboard
Copied
pun not intended,
whilst docs do mention
FontOpenTypePositionOption.OPENTYPESUPERSCRIPT,
I could not get it working
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Explorer
,
Feb 29, 2024
Feb 29, 2024
ok, found it by comparing 2 objects.
in case someone's struggling too, it's:
characterAttributes.baselinePosition = FontBaselineOption.SUPERSCRIPT
Explore related tutorials & articles
Explorer
,
/t5/illustrator-discussions/super-script-with-script/m-p/14458903#M399477
Feb 29, 2024
Feb 29, 2024
Copy link to clipboard
Copied
ok, found it by comparing 2 objects.
in case someone's struggling too, it's:
characterAttributes.baselinePosition = FontBaselineOption.SUPERSCRIPT
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/illustrator-discussions/super-script-with-script/m-p/14459561#M399514
Mar 01, 2024
Mar 01, 2024
Copy link to clipboard
Copied
Bonjour,
Pour s'amuser un peu...
Document ouvert, lancer le script.
// JavaScript document for Illustrator
// Landry René
// elleere Wed, 25 April 2018 17:39:04 GMT
// INIT---------
var c1 = "^";
var c2 = "_";
var text = "2^2.5 + b^2 = 5 C_12^2 sin(20^3)"; // cas 1
//var text = "2^2.5 + b^2 = 5 C^2_12 sin(20^3)"; // cas 2
var corps = 16;
//-------------
var docRef = activeDocument;
var pointText = docRef.textFrames.add();
pointText.contents = text;
pointText.position = [20,-20];
pointText.textRange.size = corps;
//expo_indice(pointText,c1,1); // si cas 2
expo_indice(pointText,c2,0);
expo_indice(pointText,c1,1); // si cas 1
//--------------
function expo_indice(textRf,rx,drap) {
var index, pos, i, r, curentChar, suit, baseline;
baseline = drap ? FontBaselineOption.SUPERSCRIPT : FontBaselineOption.SUBSCRIPT;
pos = index = textRf.contents.indexOf(rx);
suit = textRf.contents;
while (pos != -1) {
suit = suit.substring(pos+1);
r = parseFloat(suit)+"";
//r = drap ? parseFloat(suit)+"" : "1"; // si toujours 1 chiffre
for (i = 1; i <= r.length; i++) {
curentChar = textRf.textRanges[index+i];
curentChar.baselinePosition = baseline;
}
textRf.textRanges[index].remove();
pos = suit.indexOf(rx);
index += pos;
}
}
//--------------
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
LATEST
/t5/illustrator-discussions/super-script-with-script/m-p/14939428#M424757
Oct 24, 2024
Oct 24, 2024
Copy link to clipboard
Copied
hello, the baselinePosition property seems not working on my character, while using $.writeln() showed the change of it.
textFrame.textRange.characters[Index].characterAttributes.openTypePosition = FontOpenTypePositionOption.OPENTYPESUPERSCRIPT
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

