K-IDE support forum
Find all information about Kawasaki's Integrated Development Environment

RE: Next-next try

#16 by cquante , Wed Sep 18, 2024 1:29 pm

Zitat von Zoirkae im Beitrag #15
Got it! if you want more details about issue 2, I’m glad to help you.


To be honest: I don't see me as an editor programmer. I only changed the editor component to view the comments and strings with CJK characters correctly. If you're okay with the representation of your language characters in K-IDE and you can work with it and edit the text, my work for that editor component is done. If there are any other editor issues with CJK and other character sets that prevents developers to work with K-IDE, please let me know.


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


RE: Next-next try

#17 by zuoyuanchun , Sat Sep 21, 2024 10:01 am

Hello!
First of all, thank you to the development team for addressing the issue with displaying multi-byte characters for Chinese, Japanese, and Korean.
According to public information, the original creator of this text editor was Ukrainian, so the display and editing of multi-byte characters were not considered during its initial development.
Some programmers have attempted to support the display of CJK (Chinese, Japanese, Korean) text, but they eventually gave up due to the large amount of code modification required and changes in the program architecture. Therefore, we are deeply grateful to the KIDE development team for improving FastColoredTextBox, making it the most significant advancement so far.

There are two existing issues:

When a single line of text exceeds the display range, the horizontal scroll bar fails to display correctly. Even when it does appear, the stretch range of the horizontal scroll bar control is incorrect.
The cause of this problem is that although CJK characters have been assigned the correct width, the "visible" and "Maximum" properties of the horizontal scroll bar are still calculated based on the width of a single character.
The final solution to this issue can reference the handling in the source code of Windows' built-in "Notepad." When rendering character graphics, if the text is in ANSI encoding, the character's width should be calculated based on its encoding length.

For example:
Take "hello," with decimal encoding "104,101,108,108,111," consisting of 5 ASCII characters. If the width of each character is 8 pixels, then the starting position of the first character is 0, the second character is at position 8, the third at 16, the fourth at 24, and the fifth at 32.

Now, take "川崎" in "GB2312" encoding:

The decimal encoding for "川" is "180,168."
The decimal encoding for "崎" is "198,233."
Each character consists of two character encodings, which we refer to as double-byte (Full-width).
When rendering the graphic for each character, its width should be set to 8*2=16 pixels, ensuring that each character has an appropriate width and that the characters in each line are aligned properly.
This is the universal method used by multi-language text editors for character display.
Of course, some developers use another method—calculating the width of each character based on the font settings and then performing addition to render the characters accordingly. This makes the characters appear more compact, although only certain image processing software (like Photoshop) adopts this approach.

2. The second problem is the problem of the scroll bar eating characters, which means that in CJK characters, when the scroll bar is dragged horizontally, the characters on the left will disappear in advance. This problem should also be caused by the double-byte encoded characters mentioned above being calculated according to the single character width.
If the first problem is solved, then this problem will not exist.


The following user say thank you: Zoirkae
zuoyuanchun  
zuoyuanchun
Posts: 23
Date registered 05.01.2020


RE: Next-next try

#18 by Zoirkae , Sat Sep 21, 2024 3:08 pm

Issue 2 is that I mentioned before but I don’t know how to explain it, thank you master Zuo!


Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024


   

BETA / Update 1.1.4.21



Xobor Xobor Community Software
Datenschutz