typemytype / drawbot

http://www.drawbot.com
Other
406 stars 63 forks source link

Arabic type settings mixed with Latin characters looks to be wrong #567

Closed GaetanBaehr closed 8 months ago

GaetanBaehr commented 8 months ago

In Drawbot if the Arabic text starts with a Latin word, the Latin word appears at the wrong place, here on the left, but it should be on the right.

image

In text edit at first it behave the same

image

but if we change the writing direction to right to left, then the text is correct

image

As far as I know, in Drawbot looks to be impossible to change the writing direction.

GaetanBaehr commented 8 months ago

here the text Grtsk میتوان در بسیاری

justvanrossum commented 8 months ago

Yes, maybe we need a writingDirection() function or something like it. I'm not sure how this should work internally.

typemytype commented 8 months ago

CoreText has support we can wrap: https://developer.apple.com/documentation/coretext/ctwritingdirection?language=objc

justvanrossum commented 8 months ago

Can this be part of our language() function, or do you think it's better to add a new API function?

typemytype commented 8 months ago

well a writingDirection(direction) sound good and explicit...

with direction options:

It could possible be automated related to language('ar') but then we need to find out what the language direction is...

typemytype commented 8 months ago
image

a quick PR is comming (no test yet)

typemytype commented 8 months ago

https://github.com/typemytype/drawbot/pull/568

MrBrezina commented 8 months ago

@typemytype

It could possible be automated related to language('ar') but then we need to find out what the language direction is...

It is probably best not attempted as a single language can be written in two scripts with different directionality, e.g. Uzbek. But if you wanted contemporary defaults and used only the 2-letter codes, there are not that many…

typemytype commented 8 months ago

true, @MrBrezina I prefer an explicit api, no magic guessing