RTL text question before starting a patch (1 Viewer)

bob987

MP Donator
  • Premium Supporter
  • January 25, 2009
    47
    5
    Home Country
    Israel Israel
    I'm thinking about making a patch to the MP source code but I would like to hear what you think about this before I start.

    When you set on the option general -> skin -> language contains right to left chars, whenever MP renders a text on the screen it will check if this a RTL text and if so it will reorder its characters.
    Doing so has two disadvantages:
    a) Because the screen get constantly rendered, and the texts hardly get changed allot of CPU time is wasted on the reordering of the characters. (I have an old pc so I can see the effect of this)
    b) While scrolling a text with mixed RTL and LTR text the constant reorder makes the text appear in a wrong order.

    These problems can be solved by checking to see if the text is a RTL only when text is being set or changed.

    I was thinking to add a new struct to GUIFont.cs which will hold:
    srting OrigText;
    bool isRTL;
    string RTLText;

    When a new text will be added to the screen (For example, in GUIButtonControls.cs on "public string Label") instead of just saving the text this new structure will be used and the text will be tested for the RTL.
    Now in all of the Render and DrawText subs the full structure will be passed and not only the label.
    So at the end, in GUIFont.cs -> DrawText there will be no need to constantly use the HandleRTLText(text) function.

    I beleve that this will work, my only qestion concerns the plugins for MP.
    If I change the Render subs to use the structure insted of the label will this have an effect on plugins that addes UI (e.g. Moving Pictures)? Or maybe the plugins only uses XML so these changes will have no effect?

    I hope that my explanations are clear enough.
    I am Wating for a replay from someone from the dev before I start doing this.

    Bob
     

    Users who are viewing this thread

    Top Bottom