kashida
Re: kashida
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.
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.
- martin
- Official Nisus Person
- Posts: 5227
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: kashida
Thanks for the full list. Give this a try and let me know how it goes:
Remember that it operates on the last line of the current/selected paragraph.
Code: Select all
# Edit: removed intermediate macro, see later post for full code
Re: kashida
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!
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!
Re: kashida
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.
Do not know enough to add repetition so it works for all paragraphs in a selection.
- martin
- Official Nisus Person
- Posts: 5227
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: kashida
Here's an update that should do exactly what you want:
Let me know- oh and:
Code: Select all
# Edit: removed intermediate macro, see later post for full code
I used "\B" instead, which means "not a word boundary", so that takes care of punctuation and any other whitespace characters.I take care of my fatal flaw by adding (?!\u0020) to the kashida character list.
Re: kashida
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.
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.
- martin
- Official Nisus Person
- Posts: 5227
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: kashida
Ah, yes, of course, thanks for spotting that.kamran wrote:But it needs a test to skip over empty lines (extra paragraph break) and continue.
No problem.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.
The revised macro:
Code: Select all
# Edit: removed intermediate macro code, see later post for full macro
Re: kashida
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 greatly appreciate you working on this with me. You are doing the heavy lifting, I am just complaining
Re: kashida
I should have said "lines consisting entirely of arabic characters that cannot or non-arabic..."
- martin
- Official Nisus Person
- Posts: 5227
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: kashida
Not at all- we're happy to get this macro working as best we can!kamran wrote:I greatly appreciate you working on this with me. You are doing the heavy lifting, I am just complaining
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 695 times
Re: kashida
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
(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 694 times
- martin
- Official Nisus Person
- Posts: 5227
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: kashida
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!
Thanks again for working with us on this!
-
- Posts: 1
- Joined: 2009-07-14 15:09:48
Re: kashida
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
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
- martin
- Official Nisus Person
- Posts: 5227
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: kashida
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.
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.