Hi,
I have wxPython 2.9.1.1 on Win32.
I can retrieve the names of all available fonts with:
wx.FontEnumerator.GetFacenames()
But how do I retrieve available sizes and styles for each font?
Most fonts are scalable (TrueType), so no problem here, but there are some raster fonts (like "Courier") that have only a few predefined sizes. Also, not all fonts can be turned bold.
Is it possible to get this info from wx or do I have to go WinAPI?
I also noticed that when I try to use wx.FontEnumerator.GetEncodings(), I get assertion error:
"..\..\src\msw\fontutil.cpp(190): assert "Assert failure" failed in wxGetFontEncFromCharSet(): unexpected Win32 charset"
This looks like a bug in wxPython.
Hi,
I have wxPython 2.9.1.1 on Win32.
I can retrieve the names of all available fonts with:
wx.FontEnumerator.GetFacenames()
But how do I retrieve available sizes and styles for each font?
Most fonts are scalable (TrueType), so no problem here, but there are some raster fonts (like "Courier") that have only a few predefined sizes. Also, not all fonts can be turned bold.
IIRC wx.FontEnumerator will ignore the non TT fonts anyway...
Is it possible to get this info from wx or do I have to go WinAPI?
No, wx can't give you info like that.
I also noticed that when I try to use wx.FontEnumerator.GetEncodings(), I get assertion error:
"..\..\src\msw\fontutil.cpp(190): assert "Assert failure" failed in wxGetFontEncFromCharSet(): unexpected Win32 charset"
This looks like a bug in wxPython.
IIRC wx.FontEnumerator will ignore the non TT fonts anyway...
In wxWidgets sources src\msw\fontenum.cpp I found:
"
// we used to process TrueType fonts only, but there doesn't seem to be any
// reasons to restrict ourselves to them here
"
and I checked that raster fonts are in fact also returned.
For the record, I found a function:
win32gui.EnumFontFamilies
which solves my problem with raster font sizes.
IIRC wx.FontEnumerator will ignore the non TT fonts anyway...
In wxWidgets sources src\msw\fontenum.cpp I found:
"
// we used to process TrueType fonts only, but there doesn't seem to be any
// reasons to restrict ourselves to them here
"
Ah, I hadn't remembered that change. Thanks.
and I checked that raster fonts are in fact also returned.
For the record, I found a function:
win32gui.EnumFontFamilies
which solves my problem with raster font sizes.