Confusion about NSWritingDirectionNatural

2013-09-26 Thread Kyle Sluder
According to this knowledge base article, if a paragraph has natural
writing direction, then the writing direction of the paragraph should
change depending on the first character of the paragraph:
http://support.apple.com/kb/PH11211?viewlocale=en_USlocale=en_US

The article gives an example where an English character begins a
paragraph that consists primarily of Arabic text.

I tried a similar experiment in TextEdit, and I'm not sure how to
interpret the results. (I can't read any languages with RTL scripts, so
I'm flying a bit blind here):

1. Locale is set to English - United States
2. English is the first item in the list of preferred languages in
System Preferences
3. Enabled input methods are U.S. and Hebrew - QWERTY, with U.S.
currently active
4. Open a new TextEdit document
5. Note that the current writing direction for both Paragraph and
Selection are natural
6. Switch to the Hebrew - QWERTY input method
7. Type some gibberish

The ruler has flipped to right-aligned, but the text, while running RTL,
is laid out flush-left. Why? How is this useful?

8. Select the paragraph and change the paragraph's writing direction to
RTL.

Now the text is aligned flush-right. Why does an explicit RTL paragraph
style behave differently than a natural paragraph whose first
character is strongly RTL?

--Kyle 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Shane Stanley
On 27/09/2013, at 5:12 AM, Kyle Sluder k...@ksluder.com wrote:

 The ruler has flipped to right-aligned, but the text, while running RTL,
 is laid out flush-left. Why?

Because paragraph alignment and text direction are orthogonal?

 How is this useful?

No automatic rule is going to satisfy all cases, but I'd imagine most people 
who have asked for a paragraph to be aligned a particular way expect it to stay 
that way.

-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Kyle Sluder
On Thu, Sep 26, 2013, at 03:57 PM, Shane Stanley wrote:
 On 27/09/2013, at 5:12 AM, Kyle Sluder k...@ksluder.com wrote:
 
  The ruler has flipped to right-aligned, but the text, while running RTL,
  is laid out flush-left. Why?
 
 Because paragraph alignment and text direction are orthogonal?

But it means the tabstops on the ruler have no relation to where the
text is laid out on screen.

And it doesn't explain why explicitly setting the paragraph to RTL
causes text to align flush-right.

According to my understanding of the docs, the text should behave
identically whether the paragraph is explicitly RTL or if its first
character is a hard-RTL character.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Shane Stanley
On 27/09/2013, at 9:00 AM, Kyle Sluder k...@ksluder.com wrote:

 ut it means the tabstops on the ruler have no relation to where the
 text is laid out on screen.

it's a compromise to a difficult situation.
 
 And it doesn't explain why explicitly setting the paragraph to RTL
 causes text to align flush-right.

Setting the *paragraph* is setting the alignment.
 
 According to my understanding of the docs, the text should behave
 identically whether the paragraph is explicitly RTL or if its first
 character is a hard-RTL character.

The text and the paragraph are different things.


-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Martin Wierschin
 The ruler has flipped to right-aligned, but the text, while running RTL,
 is laid out flush-left. Why?
 
 Because paragraph alignment and text direction are orthogonal?
 
 But it means the tabstops on the ruler have no relation to where the
 text is laid out on screen.
 
 And it doesn't explain why explicitly setting the paragraph to RTL
 causes text to align flush-right.

When you say you're changing the writing direction, do you mean 
programmatically via NSParagraphStyle or just testing in TextEdit? If it's the 
latter, then I'd guess TextEdit's menu action is also changing the text 
alignment as a convenience.

~Martin



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Kyle Sluder
On Thu, Sep 26, 2013, at 04:14 PM, Shane Stanley wrote:
 
 The text and the paragraph are different things.

Allow me to be more specific.

According to my understanding of the docs, NSTextView should lay out
text identically in both of these situations:

- Text in the range (0, textStorage.length) has a value of
NSWritingDirectionNatural for the NSWritingDirectionAttributeName
attribute, and a value of NSWritingDirectionRightToLeft for the
baseWritingDirection property of the paragraph style in the
NSParagraphStyleAttributeName.
- Text in the range (0, textStorage.length) has a value of
NSWritingDirectionNatural for both the NSWritingDirectionAttributeName
attribute and for the baseWritingDirection property of the paragraph
style, and the first character in the text storage is a hard-RTL
character.

I have not yet verified that the menu items in TextEdit are producing
the exact circumstances I describe above, but it's certainly confusing
to see a ruler that's right-aligned and text that's not.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread dangerwillrobinsondanger
Likely natural is based on either the preferred language priority in system 
preferences or the region format settings there in text edit. 

Arguably, mixed RTL and LTR layout is non trivial and basically has no catch 
all correct state, and is generally going to be the case of the dominant one is 
LTR with some RTL (probably English) interspersed. 
Good news is LTR languages tend to not have a lot of RTL interspersed. 

It's probably best handled for page layout via separate layout boxes in a UI 
that are aligned by some typographic rules.
NSTextView will suffer from having its original design based on basically 
European RTL word processors. 

It's a hard topic that pretty much requires special case development. 

Sent from my iPhone

 On 2013/09/27, at 4:12, Kyle Sluder k...@ksluder.com wrote:
 
 According to this knowledge base article, if a paragraph has natural
 writing direction, then the writing direction of the paragraph should
 change depending on the first character of the paragraph:
 http://support.apple.com/kb/PH11211?viewlocale=en_USlocale=en_US
 
 The article gives an example where an English character begins a
 paragraph that consists primarily of Arabic text.
 
 I tried a similar experiment in TextEdit, and I'm not sure how to
 interpret the results. (I can't read any languages with RTL scripts, so
 I'm flying a bit blind here):
 
 1. Locale is set to English - United States
 2. English is the first item in the list of preferred languages in
 System Preferences
 3. Enabled input methods are U.S. and Hebrew - QWERTY, with U.S.
 currently active
 4. Open a new TextEdit document
 5. Note that the current writing direction for both Paragraph and
 Selection are natural
 6. Switch to the Hebrew - QWERTY input method
 7. Type some gibberish
 
 The ruler has flipped to right-aligned, but the text, while running RTL,
 is laid out flush-left. Why? How is this useful?
 
 8. Select the paragraph and change the paragraph's writing direction to
 RTL.
 
 Now the text is aligned flush-right. Why does an explicit RTL paragraph
 style behave differently than a natural paragraph whose first
 character is strongly RTL?
 
 --Kyle 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Shane Stanley
On 27/09/2013, at 11:12 AM, Kyle Sluder k...@ksluder.com wrote:

 - Text in the range (0, textStorage.length) has a value of
 NSWritingDirectionNatural for the NSWritingDirectionAttributeName attribute

As I read the docs, NSWritingDirectionNatural is a type of NSTextAlignment, 
specified by NSText's -setAlignment: method. NSWritingDirectionAttributeName is 
a character-level attribute for overriding the default bidirectional behavior, 
and takes an array of numbers.  So I'm not quite following.


-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Kyle Sluder
 On Sep 26, 2013, at 7:00 PM, Shane Stanley sstan...@myriad-com.com.au wrote:
 
 On 27/09/2013, at 11:12 AM, Kyle Sluder k...@ksluder.com wrote:
 
 - Text in the range (0, textStorage.length) has a value of
 NSWritingDirectionNatural for the NSWritingDirectionAttributeName attribute
 
 As I read the docs, NSWritingDirectionNatural is a type of NSTextAlignment,

No, it's not. It specifically refers to the writing direction, NOT the text 
alignment. Values in this enum are valid for 
NSParagraphStyle.baseWritingDirection right out of the bag, and when combined 
with NSTextWritingDirectionOverride or NSTextWritingDirectionEmbedded can be 
used with the NSWritingDirectionAttributeName key. See the OS X 10.6 AppKit 
release notes for further clarification.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Confusion about NSWritingDirectionNatural

2013-09-26 Thread Jeffrey Oleander

On 2013 Sep 26, at 21:02, dangerwillrobinsondan...@gmail.com wrote:
Good news is LTR languages tend to not have a lot of RTL interspersed.

It's somewhat common for authors in certain fields to have to mix, e.g. 
German, Italian, Greek and Hebrew, or Hebrew, ProtoPhoenician, and 
Arabic in the same page, with individual words or phrases of a 
different language from the primary one embedded within sentences or as 
parentheticals.  I'm tired and fuzzy at the moment about some of the 
mixed directionalities of other language combinations I've had 
customers (or relatives) asking about (e.g. English+Japanese, Gujarati 
+ English + ?).


Ludwig von Mises _Human Action_, an economics book; and a 
pre-publication manuscript for a book on Isaac Luria (with hundreds of 
multi-lingual, multiple attributes, etc., foot-notes associated with 
the first 2 pages) come to mind.


Anywhere, there are people who need this stuff to work correctly.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com