Author Topic: CodeBlocks and Fira Code issues  (Read 1859 times)

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: CodeBlocks and Fira Code issues
« Reply #15 on: May 31, 2019, 09:38:45 pm »
This does seem to be a bug with wxSTC.  I've a standard demo application of mine for the screenshots below.  It has a wxSTC on the left and a native Scintilla window on the right.  The first is with the default GDI drawing and the second is with direct write drawing.  The font in the autocompletion window does end up larger than it should be when direct write drawing is used.  I don't know what could be going on here.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6589
    • My Best Post
Re: CodeBlocks and Fira Code issues
« Reply #16 on: June 01, 2019, 12:16:19 am »
Link to wxwidgets master branch change https://github.com/wxWidgets/wxWidgets/pull/1123
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: CodeBlocks and Fira Code issues
« Reply #17 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.

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 321
Re: CodeBlocks and Fira Code issues
« Reply #18 on: June 03, 2019, 06:53:50 pm »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11899
    • Travis build status
Re: CodeBlocks and Fira Code issues
« Reply #19 on: June 03, 2019, 08:10:50 pm »
Anything in STC should first be fixed in wxWidgets. I'm just backporting fixes...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Miguel Gimenez

  • Regular
  • ***
  • Posts: 321
Re: CodeBlocks and Fira Code issues
« Reply #20 on: June 04, 2019, 08:32:09 pm »
New Pagodi, I have published a patch in the ticket zone with your first suggestion. Can you review it? Is it possible to create a PR in wxWidgets?

It is attached here too for convenience.

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 33
Re: CodeBlocks and Fira Code issues
« Reply #21 on: June 04, 2019, 09:20:31 pm »
New Pagodi, I have published a patch in the ticket zone with your first suggestion. Can you review it? Is it possible to create a PR in wxWidgets?

It is attached here too for convenience.

That seems fine.  I eventually want to try to use the SurfaceD2D functions for measuring and drawing and if I can get that to work, I'll try to submit a patch the wxWidgets, but I don't know when I'll be able to get to that.