drawtext & drawtextEx

hello i make research to find way to supporting Arabic language in Windows_msssage, And during the search is what caught my attention.

in rpg_windows.js i found this code

Window_Base.prototype.drawTextEx = function(text, x, y) { if (text) { var textState = { index: 0, x: x, y: y, left: x }; textState.text = this.convertEscapeCharacters(text); textState.height = this.calcTextHeight(textState, false); this.resetFontSettings(); while (textState.index < textState.text.length) { this.processCharacter(textState); } return textState.x - x; } else { return 0; }};Before i dont change anyghing Arabic letters appear correctly and interrelated only in the splash screen.
FfjCb3i.png


Window_Base.prototype.drawText = function(text, x, y) { if (text) { var textState = { index: 0, x: x, y: y, left: x }; textState.text = this.convertEscapeCharacters(text); textState.height = this.calcTextHeight(textState, false); this.resetFontSettings(); while (textState.index < textState.text.length) { this.processCharacter(textState); } return textState.x - x; } else { return 0; }};But, after i change code such drawTextEx to drawText, Arabic letters appear unrelated and reversed.
Nd3cKRQ.png


note:Writing in Arabic only supported on the splash screen

1. The question here is, what is the difference between drawtextEx and drawtext ??

2. why after i change drawtextEx to drawtext, Arabic letters appear incorrectly and is not connected to and reversed [img 2] !!??

3. Can writing code that depends on drawtextEx in Windows_msssage , Even connected to the Arabic letters appear correctly?

need help.

more info about Arabic language here

http://forums.rpgmakerweb.com/index.php?/topic/50277-arabic-supporting/
  1. drawTextEx pass through each character and draws them individually in the order they are on the editor. (it does as it to allow the use of the escape codes, such as \c[x] to change text color)
    drawText draws the text as a whole, working with languages that goes from right to left.
  2. look at 1.
  3. I kinda doubt that you could do that, even if you can reverse the drawTextEx but they will be still unrelated. You can try to adapt the drawText to wherever drawTextEx is used, but you would lose all the possible codes that edit text.
drawText works with alignment, because it is directly passed to the underlying canvas element. drawTextEx always starts at the left, prints a single character and moves its internal x position by the width of this character, which means it will never draw interrelated characters.
in fact. I actually do not have any programming experience, But I want to know if this problem was possible to fix it or not?


I can pay $ for solving this problem.. Anyone interested can send me a PM...
Can I get you to do a few things for me?


I'd like you to please create a new project, go to the Terms tab in the database, and translate a heap of terms to Arabic.


Then on the map, add a Show Text, Show Choices, and Name Input Processing command, all in Arabic.


Once that's done, please zip up the Data folder from the new project and send it to me. Let me know if I need to install a special font.


Out of interest, does anyone know what other languages are written right to left?
Can I get you to do a few things for me?

I'd like you to please create a new project, go to the Terms tab in the database, and translate a heap of terms to Arabic.

Then on the map, add a Show Text, Show Choices, and Name Input Processing command, all in Arabic.

Once that's done, please zip up the Data folder from the new project and send it to me. Let me know if I need to install a special font.

Out of interest, does anyone know what other languages are written right to left?
Sure i will do any thing just to fix this issues.

here all info you need about Arabic as you ask.

https://www.mediafire.com/?np94n8a82n495pd

this demo included:

- Readme.txt

- info about Arabic letters and Arabic language

- See me (Folder)

- Arabic alphabet .txt inside (See me Folder) to put it in (rpg_windows.js)

- Photos from some places of the Arabic language problems (Inside See me Folder)

- Tahoma Font (maybe you need it but i don't use it coz mv by default show Arabic)

Spoiler
9d39628268cf4a216f33211b3d0e6e65.png
hope this demo to help and understand how arabic words work.

there many languages read from right to left such

Arabic

Persian

Hebrew

source:

http://www.i18nguy.com/temp/rtl.html

https://en.wikipedia.org/wiki/Right-to-left

Edit

Arabic Window_NameInput Update v1.0

Spoiler
Code:
//Arabic have 28 letters.//Arabic is written from right to left.//Arabic letters to be related to be Useful word,//Example:العربية = Arabic , مرحبا = Hello , انا احبك = I love you.Window_NameInput.Arabic =        [ 'ا','ب','ت','ث','ج',  'و','ي','ﺀ','آ','أ',          'ح','خ','د','ذ','ر',  'لا','لآ','ة','لأ','ّ',          'ز','س','ش','ص','ض',  'َ','ً','ُ','ٌ','ِ',          'ط','ظ','ع','غ','ف',  'ٍ','ْ','ـ','ئ','ؤ',          'ق','ك','ل','م','ن',  ',','الله','لله','','',          'ه','[',']','^','_',  '','{','}','|','~',          '0','1','2','3','4',  '!','#','$','%','&',          '5','6','7','8','9',  '(',')','*','+','-',          '/','=','@','<','>',  ':',';',' ','صفحة','تم' ];
or http://pastebin.com/WRXVR4jM
OMG, i fix items , skills, Equip, description in Arabic !!

i will Continue research!!

but right now i don't find how to fix Window_Message?

2e98468edfe25bfecfcb1eda35943b9d.png


Edit: Excuse me, I forgot to explain the way ^^

1. go to rpg_windows

2. find this code

Window_Help.prototype.refresh = function() { this.contents.clear(); this.drawTextEx(this._text, this.textPadding(), 0);};change it to
Code:
Window_Help.prototype.refresh = function() {    this.contents.clear();    this.drawText(this._text, this.textPadding(), 0);};
then save it this will fix items , skills, Equip, description in Arabic.But I do not know that this matter will cause problems in the future or not
Window_Message displays its text one character at a time, and adds a space between characters manually. You would be looking for a way to make it show a word at a time, or the whole message at once. But it still needs to handle the escape codes and drawing icons.


Nice going!
to make Window_Message displays its text one, is hard with my level in programming 🙁 ,


I believe that there is a solution to this problem. For this reason, i put subject here ,to asking help.
  • drawTextEx pass through each character and draws them individually in the order they are on the editor. (it does as it to allow the use of the escape codes, such as \c[x] to change text color)
    drawText draws the text as a whole, working with languages that goes from right to left.

  • look at 1.

  • I kinda doubt that you could do that, even if you can reverse the drawTextEx but they will be still unrelated. You can try to adapt the drawText to wherever drawTextEx is used, but you would lose all the possible codes that edit text.
you are right Victor,I lost ability like escape codes, such as \c[x] to change text color.


Do you think that there is a solution to this problem?

Window_Message displays its text one character at a time, and adds a space between characters manually. You would be looking for a way to make it show a word at a time, or the whole message at once. But it still needs to handle the escape codes and drawing icons.


Nice going!
I wish to fix this problem, by MV development team or any person who has the ability to do this.


This will open the door to develop games for many languages such as Arabic,Persian etc languages.
how to fix ScrollText in Arabic

first find code

Window_ScrollText.prototype.refresh = function() { var textState = { index: 0 }; textState.text = this.convertEscapeCharacters(this._text); this.resetFontSettings(); this._allTextHeight = this.calcTextHeight(textState, true); this.createContents(); this.origin.y = -this.height; this.drawTextEx(this._text, this.textPadding(), 1);};change it to
Code:
Window_ScrollText.prototype.refresh = function() {    var textState = { index: 0 };    textState.text = this.convertEscapeCharacters(this._text);    this.resetFontSettings();    this._allTextHeight = this.calcTextHeight(textState, true);    this.createContents();    this.origin.y = -this.height;    this.drawText(this._text, this.textPadding(), 0);};
before change
iywKWMO.png


after change you see arabic is fix ^^

60ug5gV.png


note: this change you lost ability like escape codes, such as \c[x] to change text color.

Arab user is still suffering in Rpg maker mv 🙁

Edit: the magic is by this code this.drawText(this._text, this.textPadding(), 0); anyone can Is it possible to explain how one use this code in all the texts of the engine ؟؟
You could do this:

Code:
Window_Base.prototype.drawTextEx = function(text, x, y) {    this.drawText(text, x, y, Graphics.boxWidth, "left");};
Note, that this will completely disable all escape characters like \c[...] or \v[...] throughout the whole game and might break a lot of plugins.
You could do this:

Window_Base.prototype.drawTextEx = function(text, x, y) { this.drawText(text, x, y, Graphics.boxWidth, "left");};Note, that this will completely disable all escape characters like \c[...] or \v[...] throughout the whole game and might break a lot of plugins.
amazing sir Iavra, you fix items , skills, Equip, Save, profile description and ScrollText, battlelog text in Arabic just in one code i put it as plugin!!

and working like charm!! , I really appreciate your help, thanks.

but how about Window_Message is there any code can fix arabic ?

Our problem is still.

Spoiler
5283cda3fb2b0038f89ff89241d3d7da.png
Window_Message would need special treatment, since it also offers the option to have short wait times between printing characters, so it doesn't call drawTextEx directly, but its subfunctions. You'll need to at least modfy the "startMessage" and "updateMessage" functions, probably more.
I give up...
not give up please .. i am also searching for it


i just have the same problem you have here ..


so i need to pop up the topic
not give up please .. i am also searching for it


i just have the same problem you have here ..


so i need to pop up the topic

i give up coz, there no way to fix this problem in mv only can do it is the rpg maker mv company or we will got a lot problems by another plugins.


And this is not new, all the company's Products do not support Arabic language properly.
@biud436 ... we Finally made it 😉  by sir @biud436 , he code plugin to fixed Arabic language in Message System, hope all arab users give him full supporting..


you can find Arabic plugin here


http://biud436.tistory.com/62










Message to Arabic speakers:


اتمنى من مستخدمي الإضافة ان يقدم الدعم الكافي لصانع السكربت سواء التعليقات في موقعه او الدعم المادي و المعنوي له وايضاً تحصلونه  موجود في موقعه هنا


http://biud436.tistory.com


وايضاً عنده قناة على اليوتيوب ، هذا الشخص ما قصر حقيقة في كتابة السكربت..


واذا احد يبي شرح عن السكربت باللغة العربية يخبرني راح اسوي شرح هنا في المنتدى اذا حاب.


والتوفيق للجميع...
Nice work

Original thread: https://forums.rpgmakerweb.com/threads/drawtext-drawtextex.51787/