User forums > Using Code::Blocks

Non-English character displayed lower than normal and mutilated,How can I fix it

(1/2) > >>

edwardlucas:
I have tried code::blocks 16.01 on ubuntu 16.04.3, ubuntu 17.04, mint 18.2 xfce,  and have same problem as below:
Chinese characters displayed in the code editor were mutilated because they were lower than English characters. and I have tried several fonts, no lucky.
Please take a look these screenshots on ubuntu:

Editor settings choose font DejaVu Sans Mono 11


use font ubuntu Mono 11 get even worse

oBFusCATed:
Does it work correctly in other scintilla based editors like scite or geany?

edwardlucas:

--- Quote from: oBFusCATed on October 10, 2017, 07:05:42 am ---Does it work correctly in other scintilla based editors like scite or geany?

--- End quote ---

Geany works fine.

oBFusCATed:
Can you upload a sample file and tell me what are you encoding/locale settings?

New Pagodi:
I suspect the problem is that in PlatWX.cpp, SurfaceImpl uses a hard coded string with only latin characters to compute ascent and decent.


--- Code: ---#define EXTENT_TEST wxT(" `~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

XYPOSITION SurfaceImpl::Ascent(Font &font) {
    SetFont(font);
    int w, h, d, e;
    hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e);
    const int ascent = h - d;
    SetAscent(font, ascent);
    return ascent;
}

XYPOSITION SurfaceImpl::Descent(Font &font) {
    SetFont(font);
    int w, h, d, e;
    hdc->GetTextExtent(EXTENT_TEST, &w, &h, &d, &e);
    return d;
}

--- End code ---

You can see in the pictures posted that the ascent of the characters after the "//TODO" are higher than for the "//TODO" part, so the numbers computed computed using the hard coded sting won't work for rendering those characters. 

Is there a font where Asian and Latin characters are rendered with the same ascent?  If so, that font should work.

Navigation

[0] Message Index

[#] Next page

Go to full version