Right-to-Left Support


#1

Hi,
I would love to have - in Folding Text and TaskPaper - support for right-to-left languages.
Currently there’s no problem writing in RTL (i.e. Hebrew), but everything is aligned to the left, and bullets/checkboxes etc. appear to the left of the text instead of to the right of it.
It doesn’t seem a hard thing to implement, however I don’t know anything about programming…

Thanks,
Or


#2

It doesn’t seem a hard thing to implement

It looks like there’s some degree of support for RTL in the underlying CodeMirror libraries, but these things are always harder and more time-consuming to implement than they look …

(FWIW though, I would also really appreciate being able to interleave RTL with LTR at some point, if it looked feasible)

Rob


#3

but … FT is a plain text (utf-8 unicode) editor, and while utf-8 does a good job of representing RTL characters, I’m not sure whether it can encode and retain information about which paragraphs in a text are RTL and which are LTR (in the way that, for example, RTF can).

It would be ideal to have a FoldingText equivalent of the direction button/command in Mellel

But I notice that whereas once can round-trip out of and back into Mellel retaining the direction of each paragraph thru RTF, the same journey in UTF-8 preserves the characters but loses the line-specific direction information. It looks as if the editor might have to check the character types in each line and make line by line guesses about direction.

At the moment, exporting the document above to UTF-8 text, and then opening it in Mellel or in FT gives us all LTR.


#4

Or perhaps Mellel are just missing a trick …


#5

I know this is a problem, but there are lots of other things that I’d like to address first. I think a final fix for this could take quite some time.


#6

I found a way to turn the whole theme to be right-to-left, by changing the “alignment” in Text View Style to “NSRightTextAlignment” and adding direction=“NSWritingDirectionNatural”.

I found that in this link, and it seems like maybe there’s a way to get bidirectional text working as well. I’ll try to play with it some more, though perhaps sticking to writing only hebrew will work better for me than to writing only english…


#7

I think the problem there may be that much of FoldingText’s flexibility and scriptability is rooted in the fact that it is a webkit (rather than Cocoa Text) editor.


#8

Oh, yeah I forgot to say - I’m playing around with TP2.
I saw somewhere that there’s a RTL theme for Remember The Milk. Perhaps something can be taken from there?


#9

The alignment issues can certainly be sorted out with .css / LESS in a custom .less file for Levantine-only files (in the FT menu system: Help > Software Development Kit > Documentation > Themes

but I’m not sure about flipping the list bullets to the right.

For reference, some basics about the CSS issues here: