Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
kashida 
Author Message
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
Thanks, Martin.

I will try your concoction. Let me know when you post the final version of the script. Here is the extended list of letters that can be followed by a kashida.

u0628
u062a-u062e
u0633-u063a
u0641-0643
0644 (but not when followed by 0627)
0645-0647
0649-064a
0679
067e
0686
06a9

This should cover text in arabic, persian, and urdu. There are some other exotic characters in the unicode table that may take a kashida, but I am not familiar with them.

Thanks again for helping.


2009-07-07 08:23:20
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Thanks for the full list. Give this a try and let me know how it goes:
Code:
# Edit: removed intermediate macro, see later post for full code


Remember that it operates on the last line of the current/selected paragraph.


2009-07-07 12:12:23
Profile WWW
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
It works - except for one fatal flaw in my logic - Kashida cannot be inserted if the letter is the last character of the word or in other words, if it is followed by a "space" character.

And one minor detail: it should work on every last line in a paragraph in a selection. This way one could select the entire poem at once, rather than selecting the lines one by one.

Thanks, it is exciting!


2009-07-07 12:45:52
Profile
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
So I take care of my fatal flaw by adding (?!\u0020) to the kashida character list.

Do not know enough to add repetition so it works for all paragraphs in a selection.


2009-07-07 12:57:00
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Here's an update that should do exactly what you want:
Code:
# Edit: removed intermediate macro, see later post for full code


Let me know- oh and:
Quote:
I take care of my fatal flaw by adding (?!\u0020) to the kashida character list.

I used "\B" instead, which means "not a word boundary", so that takes care of punctuation and any other whitespace characters.


2009-07-07 13:20:06
Profile WWW
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
Even better!

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.


2009-07-07 14:00:55
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
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.

Quote:
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.

No problem.

The revised macro:
Code:
# Edit: removed intermediate macro code, see later post for full macro

Thanks for testing this out so well.


2009-07-07 15:28:52
Profile WWW
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
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 :)


2009-07-08 08:59:13
Profile
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
I should have said "lines consisting entirely of arabic characters that cannot or non-arabic..."


2009-07-08 09:04:08
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
kamran wrote:
I greatly appreciate you working on this with me. You are doing the heavy lifting, I am just complaining :)

Not at all- we're happy to get this macro working as best we can!

The macro I attach here now processes all paragraphs, even if there is an error. All problem paragraphs are reported at the end.


Attachments:
Full Justify Arabic.nwm.zip [4.75 KiB]
Downloaded 287 times
2009-07-08 11:52:07
Profile WWW
User avatar

Joined: 2009-06-16 09:48:02
Posts: 15
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 all your great help.

kamran


Attachments:
hg_experiamus.rtfd.zip [5.49 KiB]
Downloaded 280 times
2009-07-08 14:19:26
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
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.

Thanks again for working with us on this!


2009-07-08 15:43:24
Profile WWW

Joined: 2009-07-14 15:09:48
Posts: 1
Hello everyone.

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?

Thank you


2009-07-14 15:14:03
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
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).

Let me know if you have any troubles.


2009-07-14 15:57:51
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 29 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software