Free Script for Hebrew or Arabic Text in Regular Version of InDesign
In InDesign I sometimes have to work with small bits of Hebrew text. I work enough with the issue to make Hebrew backward-typing annoying yet not enough to warrant InDesign ME.
I can totally understand this frustration! Some of you may know that back in 2001 I co-authored a book called Judaism For Dummies. Back then I tried for days to figure out how to get the bits of Hebrew we needed into InDesign. Many text editors and word processors, such as Microsoft Word, can handle right-to-left text just fine. But with InDesign, you have long needed to use the ME (middle-eastern) version of the program, developed and published by Winsoft, and available in the United States by FontWorld. (Diane Burns wrote a great article about this in Issue 13 of InDesign Magazine.)
I remember working on the book and discovering that I could copy Hebrew out of MS Word and paste it into PageMaker, and it would retain it’s right-to-left appearance. But this doesn’t work in InDesign for some reason. The ME version is great if you have a lot of Hebrew or Arabic text, but what if you only need to set a word or a phrase? Rachel’s email prompted me to take action: Get a script!
Peter Kahrel was kind enough to write a little script that reverses the order of any selected text. That is, if you select “abcde” and run the script, you get “edcba”. To download the script, right-click on this link and choose Save As (or Save Target As or whatever your browser calls it). If you need to know how to install scripts, click here.
Once you have the script installed, you can run it by double-clicking on it in the Scripts palette, or by assigning a keyboard shortcut to it in Edit > Keyboard Shortcuts (product area: Scripts).
To make this work for Hebrew, you can either type the text backward into InDesign (which isn’t fun) or type it normally into any program that supports right-to-left typing (such as MS Word or TextEdit) then copy that text and paste it into an InDesign text frame. Then select the text and run the script.
But there are (at least) two problems with this workflow. First, some languages (such as Arabic) require ligatures that won’t kick in using this method. Let me know (below) if you have any good solutions for this. Second, these languages read right-to-left, but the first line is always on top. So if you try to convert more than one line of text, the first words will end up on the last line. This is relatively easy to fix with copy and paste.
Here’s an example. (I have no idea what this says; I just copied it from Shlomit Heymann’s InDesign site… someday I really need to learn Hebrew myself.)
Steps from the top:
1. Text copied from Firefox and pasted into InDesign;
2. Hebrew font applied to the text;
3. Script run on the whole text;
4. Set flush right and first three words cut and pasted to first line.
Note that this also (sort of) works if there are nikud (diacritic accents) in the text (top is as copied in, bottom is after the ReverseText.jsx script is run):
I say “sort of” because this text was copied out of an Acrobat PDF file and I can see that one character lost its accent (the third from the right on the bottom should have three dots under it) and the other nikud aren’t always in exactly the correct place. My guess is that the ME version of InDesign handles the character substitution and accent placement better.
Here’s an example that shows how messed up Arabic gets. (Again, forgive me, but I have no idea what this says. I copied off a random Arabic web page.)
So, the lesson of the story is: This may help you with small bits of text, but it ain’t perfect and the more text you have, the more cleanup you should expect to do.
[Editor's note: If you are using CS4, please be sure to see this post for a much better solution!]