Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

CodeBlocks and Fira Code issues

<< < (6/7) > >>

Quiss:
My build is with wxmaster-1f3150b5f0d050262dbe132fc60d33a5e351d5b3 (25.09.2020), the issue (bigger font in popup window) isn't fixed (Miguel Gimenez wrote a reply while I'm writing). The thing is, I changed technology in the settings to DirectWrite just to check this.

Without DirectWrite, fonts are ok in popup but truncated. Font is Consolas-Regular-10. If I change font to Cascadia Mono-Regular-10, it doesn't truncated. I don't know if it's related to this topic or not.

Consolas, Arial, Georgia, Tahoma truncated.
Cascadia Mono, Calibri, Courier New not truncated.

ollydbg:

--- Quote from: Miguel Gimenez on November 11, 2020, 07:32:30 am ---It is fixed in master, but C::B uses a modified version of Scintilla, so changing to wx3.1.5 won't solve the issue.

--- End quote ---
OK, I see, thanks.
So, currently, for C::B build against wx3.14 or wx3.13, I can use a workaround patch supplied by you in Code::Blocks / Tickets / #835 wxSTC popups' font bigger than expected when using DirectWrite, which is against our C::B code base. Am I right?

EDIT:

--- Quote from: New Pagodi on June 01, 2019, 08:50:12 pm ---I'm pretty sure I know what the problem is with the font size in the list boxes.  Direct write uses DIPs for font size.  So when the technology is set to direct write, Scintilla internally scales all the fonts by 96/72 so that so drawing comes out as expected for a given font size.  So, for example, when you try to set the default font size to be 10pts, Scintilla interanlly creates a 10*96/72 = 13.333 pt font.  When drawing text in the editor, that's not a problem, but when passing that font to the list control (as is done in ListBoxImpl::SetFont), the font will be larger than expected. 

The quick fix is to check the technology in ListBoxImpl::SetFont and unscale the font if needed.  A better fix would be to measure and draw the autocompletion listbox with direct write using the SurfaceD2D methods.

--- End quote ---

So, your patch in Code::Blocks / Tickets / #835 wxSTC popups' font bigger than expected when using DirectWrite — https://sourceforge.net/p/codeblocks/tickets/835/ is the "quick fix".

Miguel Gimenez:

--- Quote ---So, your patch is the "quick fix"
--- End quote ---

Yes, the patch is directwrite.patch. It works OK as long as you use 100% display scaling.

Probably it's easy to include scaling in the calculation, just include wxDisplay::GetScaleFactor() in the calculations (currently scale > 100 % makes the font bigger). If C::B is on the primary display:


--- Code: ---GETLB(wid)->SetFont(NewFont->Scaled(72.0/(96.0*wxDisplay().GetScaleFactor())));
--- End code ---

This line may need to be changed also:


--- Code: ---maxw = (maxw*96)/72;
--- End code ---

I can test this tonight.

ollydbg:

--- Quote from: Miguel Gimenez on November 12, 2020, 11:27:43 am ---I can test this tonight.

--- End quote ---
OK, thanks.
I have one PC which use 100% scale, and another use 125% scale. :)

oBFusCATed:
It is better to use the scaling factor of the window and not the display.
If you want to use a display you'll have to use something like wxDisplay::FromWindow(myWindow).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version