User forums > General (but related to Code::Blocks)

font rendering issue when using C::B under windows remote desktop

(1/2) > >>

When I use C::B in a remote desktop PC, I see that the font is not showing correctly.

The remote C::B is using the GDI render(since the Direct2D mode has some crash issue).

I just compared the C::B with another program Notepad2, which is also scintilla based.

In the setting menu of the Notepad2, there is an option, I choose the "legecy GDI", and in another font quality setting, I choose "default". you see in the screen shot, both C::B and Notepad2 show blur font. (See the first attachment image named 2022-10-22 14 51 21.png)

But when I select the "Font quality" menu to "ClearType", the font rendering shows good in Notepad2. (See the second attachment image named  2022-10-22 14 53 32.png)
I see we have an option also in our C::B editor setting(Font quality), but that option is gray out. (I see the C::B's font quality is only enabled when I choose the DirectWrite mode. )

My question is: how can I enable the "ClearType" in our C::B when we use the default legacy GDI rending mode.

I have tried to modify the "FONT_QUALITY" in C::B's config file(default.conf)

--- Code: --- <TECHNOLOGY int="0" />
<FONT_QUALITY int="3" />

--- End code ---

But setting the value to "3" (I guess it is the ClearType option) has no effect.

Long shot. The following thread may be of some use:
Update2:Another thread that could be relevant:


--- Quote from: AndrewCot on October 22, 2022, 10:06:10 am ---Long shot. The following thread may be of some use:

--- End quote ---
Thanks for the reply. This link is about DirectWrite feature. I think it is not related. I just see that either in Notepad++ or Notepad2, I disable the DirectWrite feature and only enable the legacy GDI, and both the two application render the font correctly.

--- Quote ---Update2:Another thread that could be relevant:

--- End quote ---
Oh, this is my question in year 2017, but I see this is about DPI aware issue in the manifest. I think C::B already have the DPI aware enabled, which means C::B need to handle the DPI itself. If DPI aware is not set, the Windows will scale the application for you, and which leads to the blur text.

So, I think both the above links are not related to my original issue.

I did some search, and it looks like:


This function of wxFontInfo::AntiAliased

--- Quote ---

Set anti-aliasing flag.

Force the use of anti-aliasing on or off.

Currently this is not implemented, i.e. using this method doesn't do anything.

--- End quote ---

But there are some solutions to enable at least under Windows:

Font color problem - wxWidgets Discussion Forum and Re: wxWidgets & ClearType

--- Code: ---Call wxFont::GetNativeFontInfoDesc()

You will get a string that looks like this:

You need to change the "quality" property, with has index=12 (starting from 0).

Values are:

Use wxFont::SetNativeFontInfo() to write the new string back.

This works only under Windows. The last time i used it was under XP, i'm not sure if it works under W7 or higher.

--- End code ---

So, I think we can hack on this?

I create a code snippet to enable this option in the font wxWidgets sample program.

--- Code: ---    wxFont fontWithClearType = font;
    wxString nativeDesc = fontWithClearType.GetNativeFontInfoDesc();
    int index = 0;
    for (size_t pos = 0, start = 0; pos <= nativeDesc.length(); )
        pos = nativeDesc.find(";", start);

        if (index == 13)
            // enable the cleartype option of the font
            nativeDesc.replace(start, pos - start, "5");
            bool result = fontWithClearType.SetNativeFontInfo(nativeDesc);
        start = pos+1;


--- End code ---

This does change the description string, but has no effect.  :(


problem solved, it should be:

--- Code: --- if (index == 14)

--- End code ---


[0] Message Index

[#] Next page

Go to full version