Using Raster fonts

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
marksatterfield
Knows some wx things
Knows some wx things
Posts: 33
Joined: Fri Jun 30, 2017 12:34 pm

Using Raster fonts

Post by marksatterfield »

I would like to use raster fonts but not sure wxWidgets will work with .fon files. Also would like to know if I can find source for raster fonts?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Using Raster fonts

Post by doublemax »

wxWidgets can work with both bitmap and vector fonts that are installed on the system.

Since wx 3.1.1 there is a new static method to use external fonts:
https://docs.wxwidgets.org/trunk/classw ... 4c7d1ec620

This only works for truetype fonts though.
Use the source, Luke!
marksatterfield
Knows some wx things
Knows some wx things
Posts: 33
Joined: Fri Jun 30, 2017 12:34 pm

Re: Using Raster fonts

Post by marksatterfield »

I noticed my fonts are installed under \windows and not \windows\fonts. Is that a problem. This is a windows embedded compact 7 system.
Also if I install raster fonts on my system should I be able to just specify the font name to use those fonts?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Using Raster fonts

Post by doublemax »

Run the "fonts" sample that comes with wxWidgets.

Actually, i'm not sure any more that wxWidgets can use any font. In the sample i see fewer fonts than i see in the Windows control panel.
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Using Raster fonts

Post by PB »

I do not know about Windows Embedded, but on Windows 10 the font sample seems to work with "Terminal", which I believe is a raster font - it is a font available under Raster Fonts in the dialog where you set the font for the command prompt window.

On MSW, wxFont::AddPrivateFont() uses ::AddFontResourceEx() which is documented to support also raster fonts. But whether the wxFont can be, contrary to its docs, created from a private raster font... It should be easy to test though.

Edit:
FWIW, I donwloaded Leros and Yamaha fonts from https://www.cylog.org/graphics/rasterfonts.jsp and tried to load them as private fonts by modifying the font sample. Seemed to work.
MSW 10 Pro, wxWidgets recentish master
Post Reply