2

I work on Arabic scripted texts in DrRacket but the characters stand seprate, they have to be attached to each other.
The second problem is that DrRacket reads them left-to-right like in Latin script. When I am posting here in order to show how they look in DrRacket; they get conjoined and its order gets reversed (which is good since Arabic script is written right-to-left).

(explode "اعمالنده")

(list "اعمالنده" "اولا") (list "آبار — آوار كلمه+سنه نظر بیوریله")

This is how it looks in DrRacket1

Why do the chars stand separately and why aren't the order of the chars as they should be from right-to left?

Sandy
  • 21
  • 2
  • 3
    Rendering text is hard and nobody who works on Racket has probably ever added support for BiDi text or ligatures to its text widgets. – Shawn Oct 02 '22 at 11:47
  • I wrote small functions to handle the direction issue, it works fine. The problem chars don't get conjoined as it must be in Arabic script. (chars have to be joined when they are part of a word) If anyone interested my codes about the direction issue: to reverse words: (define (rev-word s) (implode (reverse (explode s)))) to reverse list-of-words: (define (rev-low low) (cond [(empty? low) empty] [else (cons (rev-word (first low)) (rev-low (rest low)))])) to reverse text: (define (rev-txt s) (string-join (rev-low (string-split s)))) – Sandy Oct 02 '22 at 15:24
  • Unicode is a bit harder than just reversing text. You can read more [here](https://unicode.org/reports/tr9/) to get an idea or, if you want something more divulgative, you can try [this](https://www.w3.org/International/articles/inline-bidi-markup/uba-basics). TL;DR Unicode is *hard*, and not every programming language has full native support yet because it's a painful thing to implement. – jthulhu Oct 06 '22 at 18:52

0 Answers0