User forums > Using Code::Blocks

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

<< < (2/2)

edwardlucas:

--- Quote from: oBFusCATed on October 10, 2017, 07:47:51 am ---Can you upload a sample file and tell me what are you encoding/locale settings?

--- End quote ---

Please see the attachment.

file using UTF-8 encoding.

edwardlucas:

--- Quote from: New Pagodi on October 10, 2017, 08:14:43 am ---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.

--- End quote ---

I tried font "WenQuanYi Micro Hei Mono" which include Chinese and Latin character, it works fine! but I don't like the Latin  and number characters in this font.

Please see the screen shot.

oBFusCATed:
@New Pagodi: Can we do something about this problem?
@edwardlucas: Do you use the same font in geany as in c::b?

New Pagodi:

--- Quote from: oBFusCATed on October 11, 2017, 12:51:13 am ---@New Pagodi: Can we do something about this problem?

--- End quote ---

Maybe.  I don't know enough about fonts or non-English languages to have a better solution.

edwardlucas:

--- Quote from: oBFusCATed on October 11, 2017, 12:51:13 am ---@edwardlucas: Do you use the same font in geany as in c::b?

--- End quote ---

Yes I tried same fonts in geany, all fonts have problem displayed in C::B all work fine in geany.

thanks.

Navigation

[0] Message Index

[*] Previous page

Go to full version