Author Topic: Text alignment error in C::B editor  (Read 3549 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Text alignment error in C::B editor
« on: October 22, 2020, 02:11:43 pm »
Hi, it looks like C::B's editor can't measure the Chinese character correctly, so that I can't make the comment get alignment, this does not happen in Notepad++'s editor.

See the image shot below for comparing.

Any ideas? I have set the same font "Courier New, size 10" in those two editors. Note a normal Chinese character is double width of a normal English character.
« Last Edit: October 22, 2020, 02:13:52 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Text alignment error in C::B editor
« Reply #1 on: October 23, 2020, 07:40:21 pm »
Have you enabled ligature support in one or the other? What about the latest STC sample in wxWidgets?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Text alignment error in C::B editor
« Reply #2 on: October 24, 2020, 02:55:44 am »
Have you enabled ligature support in one or the other?
I just tested it, under C::B, the alignment issue happens in both normal mode or ligature mode.
Under Notepad++, I only use the normal mode, and it does not have such alignment issue.


Quote
What about the latest STC sample in wxWidgets?
I haven't tried it yet. Will try it if I have more time.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Text alignment error in C::B editor
« Reply #3 on: October 24, 2020, 10:06:17 am »
If you overlay the images in gimp/photoshop you'll see that font rendering is totally different. I don't know why.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Text alignment error in C::B editor
« Reply #4 on: November 07, 2020, 12:48:24 pm »
OK, I find the reason of this issue.

This issue also happens in the latest Notepad++.

The problem is that a bold Chinese font is a bit wider than a normal Chinese font.

Under C::B, when the Chinese character is after the
Code
///
, which means it's a doxygen style comment, it will be bold, and this issue happens. If I set the doxygen comment font style to bold font, this issue also happens under Notepad++.

I'm not sure how I can solve this.  :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.