2

I'm trying to make the avalonedit right-to-left layout, so that supporting languages that are right-to-left (e.g. Arabic)

The code seems to be too large to be understood, I need at least to know where my changes would be? What are main modules of it, or some diagrams/docs clarifying each component (other than the 4 images provided with the source)

I need at least to know what are the basic components of an editor. Thank you for help

1 Answers1

2

The TextView class is responsible for the actual text rendering. The layout within text lines is done using the WPF TextFormatter (see #region BuildVisualLine in TextView.cs).

AvalonEdit already supports bidirectional text within a left-to-right paragraph, so the editor should work if you can get WPF to create right-to-left paragraphs.

I think it might be sufficient to change the VisualLineTextParagraphProperties.FlowDirection property.

Ideally the text view would use the value of TextView.FlowDirection for this, but I've seen some weird effects when using TextView.FlowDirection (text being mirrored). Not sure what's up with that; I'm not familiar with the way WPF works in a right-to-left context (I guess there's some auto-mirroring feature?).

Daniel
  • 15,944
  • 2
  • 54
  • 60
  • Thank you very much... it is almost done! Just the problem now 1) line numbers are in the left side (if I can make it in the right) 2) When typing, the cursor remains at the far right side without move. (Best setting I've got `FlowDirection = LeftToRight`, `TextAlignment = Right`) –  Feb 18 '14 at 08:53