Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Random baseline shift

905 views
Skip to first unread message

Nol._G.@adobeforums.com

unread,
Nov 12, 2006, 6:20:01 AM11/12/06
to
Hello to all !

My question is : is it possible to randomly change the "baseline shift" on a text, to get an effect like this : <http://ddisk.ovh.org/text.jpg>

I've done this manually, and it's very long and boring to do, especially when there's more text. So, if there's any way to do this automatically, I would be glad to know it.

Thanks a lot to all !

James_...@adobeforums.com

unread,
Nov 12, 2006, 10:05:51 AM11/12/06
to
The script below will do that. It's a very simple script that does what it does in only 10 lines. But I've commented each line to help you see how it works.

Copy everything below my initials. Paste it into a text editor. Save it as a PLAIN TEXT file. Name it whatever you want, but give it a .js filename extension. Put in in Illustrator's Presets/Scripts folder. Quit and relaunch Illustrator. The script will appear in the File>Scripts submenu.

To use it, "normal select" a single textFrame object. Then select the script from the File>Scripts menu. The script will prompt you for a baseline shift range value. It defaults to 10 pts, but you can enter whatever value you want. It will then randomly shift the baseline of each character between the positive and negative of the value you entered.

JET

//--------------------------
//JET_RandomBaselineShift.
//A Javascript for Illustrator CS2.
//By James E. Talmage.
//Randomly sets the baseline shift of each character in a single selected textFrame.
//The topmost selected object must be a text object.
//It can be pointType, areaType, or pathType.
//But it must be normally selected as an object, not as a range of test.
//Just select the text object and then run the script.

//Reference the document.
var docRef = activeDocument;

//Reference the first selection in the document.
var textRef = docRef.selection[0];

//Get the number of characters in the selected object.
var charCount=textRef.textRange.characters.length;

//Set a variable to serve as alternate positive and negative value.
var shiftSign=1;

//Let the user determine the baseline shift range.
var shiftRange = prompt("Enter the distance, in points, by which you want the Baseline Shift to vary.", 10);

//For each character...
for(i=0; i<charCount; i++){

//...flop the positive/negative...
shiftSign*=-1;

//...reference the range multiplied by a random number between 0 and 1...
var curShift=Math.round(Math.random()*shiftRange);

//...shift the current character by that amount.
textRef.textRange.characters[i].characterAttributes.baselineShift=curShift*shiftSign;

}
//-------------------------

Nol._G.@adobeforums.com

unread,
Nov 12, 2006, 10:57:52 AM11/12/06
to
Wonderful !
I really ought to learn javascript...

Thanks a lot for your fast anwser Mr. JET !

Nol.

Kurt...@adobeforums.com

unread,
Nov 13, 2006, 9:00:28 AM11/13/06
to
If it were not that important to maintain editable text, you could also outline the text object, ungroup and then execute the Transform Each command (Move vertical) with the Random option turned on.

Nol._G.@adobeforums.com

unread,
Nov 13, 2006, 10:17:38 AM11/13/06
to
Thanks a lot for this useful tips, Kurt !
It's definitely something to know. But as James'script does the same thing, I'd rather use it, because I could have the need to change the font quickly, or some other character parameters.
Anyway, thanks again for your help. I think it will be very useful if I have to do this effect again while not working at home (without the script)

Nol.

Bert Philippus

unread,
Dec 1, 2006, 1:38:47 AM12/1/06
to
Here's another way:

Draw a short horizontal path. Copy and paste it so the left end of the copy aligns with the right end of the original. Ctrl-D until you have a long line of dashes.

Copy the long line of dashes down a bunch of times.

Select all, Object>Transform>Transform Each, set for Preview, Random, and enter a number for vertical transformation, and a small angle for rotation if you wish.

Leave selected, then go to Type>Threaded Text>Create.

Apply any text to this threaded complex of paths, and play with the result.

Bert

Nol._G.@adobeforums.com

unread,
Dec 1, 2006, 4:43:50 AM12/1/06
to
Thanks for this new method Bert !
Something between the previous ones, and very useful too I'll say !

Nol.

Bert Philippus

unread,
Dec 1, 2006, 10:07:33 AM12/1/06
to
I had a lot of fun with it last night...
0 new messages