Author Topic: 2D drawing and fancy fonts  (Read 5119 times)

Offline everSome

  • Multiple posting newcomer
  • *
  • Posts: 34
2D drawing and fancy fonts
« on: February 09, 2022, 02:02:07 am »
In the file codeblocks-code-r12709-trunk\src\sdk\wxscintilla\src\PlatWX.cpp
the error "You need to have Direct2D capable wxWidget build to build Code::Blocks. We want to support fonts with ligatures!!!" Does CodeBlocks generate fonts, or just use them? The connection between isn't clear, at least to me.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: 2D drawing and fancy fonts
« Reply #1 on: February 09, 2022, 02:41:39 am »
CodeBlocks does not create any font files. It uses fonts to allow users to change fonts via options in the setting menu for different screens/plugins etc. I have not played around in this area, so other devs may be of more help than I am.


Are you getting the error? If you are then  follow the instructions for setting wxUSE_GRAPHICS_DIRECT2D to 1 on he following page when you build the monolithic wxWidgets for CB:
https://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Windows

« Last Edit: February 09, 2022, 10:14:38 am by AndrewCot »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
Re: 2D drawing and fancy fonts
« Reply #2 on: February 09, 2022, 09:23:12 am »
Code::Blocks can use fonts with ligatures, like FiraCode, but in order to use them Direct2D must be enabled in wxWidgets.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: 2D drawing and fancy fonts
« Reply #3 on: February 09, 2022, 10:55:55 am »
CodeBlocks and Fira Code issues

There are some discussion about the ligatures and Code::Blocks. You can see the above link.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline everSome

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: 2D drawing and fancy fonts
« Reply #4 on: February 09, 2022, 03:40:09 pm »
I ask because I tried compiling wxWidgets with clang a few weeks ago and it fails; clang is definitely more finicky. So I tried compiling CodeBlocks with clang utilizing the MSYS2 wxWidgets package for its clang environment, and got this. Just now getting back to this. Seems the MSYS2 package developer dropped "#define wxUSE_GRAPHICS_DIRECT2D 1" support about 4 months ago because they didn't think it made any difference but possibly was the cause of some other problem. Might end up downloading their package building tools and their version of the source to see how they made it work.

Offline everSome

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: 2D drawing and fancy fonts
« Reply #5 on: February 12, 2022, 11:15:01 pm »
"Fira Code is a free monospaced font containing ligatures for common programming multi-character combinations. This is just a font rendering feature: underlying code remains ASCII-compatible." It seems it's not a unicode font. Now "DirectWrite is a text layout and glyph rendering API by Microsoft." As "DirectWrite is hardware-accelerated (using the GPU) when running on top of Direct2D, but can also use the CPU to render on any target, ..." it seems using Direct2D is worth it as it renders somewhat faster. I did read somewhere to use the TrueTypeFont variant as the hinting supported by TTF improves appearance (tries to avoid rasterization artifacts.