Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
RFC: DefaultWrite mode, CallTip, Completion popup fix
Pecan:
--- Quote from: Miguel Gimenez on July 24, 2023, 10:04:58 am ---These lines
--- Code: ---+ GETLB(wid)->SetFont(NewFont->Scaled(72.0/(72.0*scale))); //(ph 2023/07/18)
...
+ *pWidth = ((width*72*sysScaling)/72) + fp.size;
...
+ double dscale = (72.0 /(72.0 * sysScaleFactor)) +0.01;
--- End code ---
may be simplified, as 72.0 is in the numerator and the denominator. Why the 0.01?
--- End quote ---
I see how to simplify the "*pwidth" as (width*sysScaling) + fp.size;
but I do not see how to simplify (72.0 /(72.0 * sysScaleFactor))
With a scalling factor of 1.25:
72.0 * sysScalFactor is 90
72.0 / sysScalFactor is 57.6
72.0/(72.0*sysScalFactor) = .8 (the correct scaling factor)
Would you make a suggestion please.
Pecan:
--- Quote from: ollydbg on July 24, 2023, 09:23:23 am ---I'm testing on setting the DPI to 150% or 100% on my Win10, it looks fine, I mean the font size in the editor and the tip window are the same.
One issue is that the bottom edge of the tip window is a little small?
See the image shot below in the attachment.
--- End quote ---
Thanks for testing. What font are you using that caused the bottom edge problem?
It looks like the surface parameters will have to be adjusted to solve this.
I'd rather address that in a separate future patch.
Pecan:
--- Quote from: sodev on July 24, 2023, 05:34:12 pm ---
--- Quote from: Pecan on July 23, 2023, 08:25:07 pm ---
--- Code: ---+/* C::B begin */
+ #if wxCHECK_VERSION(3, 1, 4)
+ // Scale the popup window size for non DirectWrite (defaultWrite) mode
+ if (technology == SC_TECHNOLOGY_DEFAULT) //(ph 2023/07/22)
+ {
+ std::unique_ptr<wxWindow> pwxWin;
+ pwxWin.reset(new wxWindow());
+ double sysScaling = pwxWin->GetDPIScaleFactor();
+ int* pWidth = const_cast<int*>(&width);
+ *pWidth = ((width*72*sysScaling)/72) + fp.size;
+ }
+ #endif
+/* C::B end */
--- End code ---
--- End quote ---
The creation of this temporary windows looks at least weird. And in a multi-monitor setup (if CB does actually use per-monitor DPI, i don't know if it does) this will be wrong, because the returned DPI value depends on the monitor on which this window gets positioned.
--- End quote ---
Thanks, I'll change the code to use the current active window.
Pecan:
--- Quote from: Miguel Gimenez on July 24, 2023, 10:04:58 am ---These lines
--- Code: ---+ GETLB(wid)->SetFont(NewFont->Scaled(72.0/(72.0*scale))); //(ph 2023/07/18)
...
+ *pWidth = ((width*72*sysScaling)/72) + fp.size;
...
+ double dscale = (72.0 /(72.0 * sysScaleFactor)) +0.01;
--- End code ---
may be simplified, as 72.0 is in the numerator and the denominator. Why the 0.01?
--- End quote ---
With some fonts, the 0.01 is (experimentally) just enough to keep the right margin from melding with the last character of text.
ollydbg:
--- Quote from: Pecan on July 26, 2023, 09:30:01 pm ---
--- Quote from: ollydbg on July 24, 2023, 09:23:23 am ---I'm testing on setting the DPI to 150% or 100% on my Win10, it looks fine, I mean the font size in the editor and the tip window are the same.
One issue is that the bottom edge of the tip window is a little small?
See the image shot below in the attachment.
--- End quote ---
Thanks for testing. What font are you using that caused the bottom edge problem?
It looks like the surface parameters will have to be adjusted to solve this.
I'd rather address that in a separate future patch.
--- End quote ---
I'm using a font named: [be5invis/Sarasa-Gothic: Sarasa Gothic](https://github.com/be5invis/Sarasa-Gothic), but I think every mono font has such issue. Because I see the similar issue in my friend's PC, and he is using my personal built C::B(with your patch), and he is using the default font.
Thanks.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version