But it needs a test to skip over empty lines (extra paragraph break) and continue. It should probably also have test to skip over column or page break that I have not tested yet.

Also, occasionally people insert vowel marks like \u061a or \u0650 at word-end (not recognized as word-boundary that makes it invalid to insert kashida, so we need to insert something like (?![\u061a\u0650]) along with \B.

kamran wrote:But it needs a test to skip over empty lines (extra paragraph break) and continue.

Ah, yes, of course, thanks for spotting that.

Also, occasionally people insert vowel marks like \u061a or \u0650 at word-end (not recognized as word-boundary that makes it invalid to insert kashida, so we need to insert something like (?![\u061a\u0650]) along with \B.

I think the macro is about ready for prime time. We have taken care of empty lines, but not of lines that have arabic characters that cannot or non-arabic characters that obviously do not take a kashida. Under these conditions in the middle of a selection, the macro exits. It would be "nice" if we skip these lines as well like the empties and continue to the top of the selection - at that point we may remark that the application of the macro was "successful" or if some lines were skipped due to exceptions.

I greatly appreciate you working on this with me. You are doing the heavy lifting, I am just complaining

I think we are ready to distribute this to the wider community for further testing, moaning, and use.

(there is some issue with u0644 rules (and possibly with others) when a vowel mark (u0651) disappears when kashida are inserted. I can resolve this problem by extending disallowed list for u0644-rule to include \u0644\u0647, a solution I do not like, or by disallowing kashida after u0644 altogether, a solution I like even less. Since I do not understand the mechanism why this is so, I will leave it to the larger community to decide.)

I am attaching a file I was using for testing for you to see how well the macro works - it uses Arial Unicode MS font, it comes with mac. (Note: there may be an issue with Firefox 3.5 uploading files to the forum.)

Thanks for the test file, it downloaded just fine. I've made one small final change, in that the order of error is reported front-to-back instead of in reverse. The final macros are now in the macro repository, so we'll see what feedback we get on where kashidas can be inserted.

Glad to join the Nisus family. I just received a copy of Nisus yesterday and I am having the same issue of justifying Arabic poetry. I have tried to follow these posts but I am really a beginner so I couldn't understand how to solve the problem. Could someone give me a step by step way of justifying the poetry or do I have to download something new from Nisus?

Hello Rami- we're glad to have you as part of our family! Following all these posts is pretty involved- the discussion is mainly useful for macro authors. Let me try to break it down into something usable.

The first step is to install the "fully justify" macros. You'll only need to do this once. Here's what to do:

1. Download the justification macros.
2. They come in a compressed archive, which you may need to double click in the Finder to expand.
3. Switch to Nisus Writer Pro (NWP).
4. Use the menu Macros > Load Macro.
5. In the open file dialog, choose the files you downloaded/expanded earlier (eg: "Justify Fully Arabic"). You can select all the macros at once. Click the "Open" button.

From now on these macros will always be available on your Macros menu and you can safely trash the files you download.

Once you've typed up some poetry:

1. Select the paragraphs of text you want to fully justify.
2. Use the menu Macros > Justify Fully Arabic.

When the macro is done running, your text should appear fully justified.

One final note: these macros work by inserting kashida characters into your writing. It may be that you later want to go back and edit what you've written- having these kashidas may make that awkward. To remove them select the relevant text and use the menu Macros > Justify Fully Arabic (remove kashidas).