[wxFontDialog]

27 views
Skip to first unread message

Filip Sykala

unread,
Sep 22, 2021, 6:52:55 AM9/22/21
to wx-users
Hi wx-users,
I try to use wxFontDialog for selecting TTF font.

I've three issues.
1) Is there a way to filtrate fonts inside dialog?
On my Windows 10, it looks like there is more than 200 fonts. And not all are TTF.
Screenshot2021-09-22.png
2) How Can I recognize TTF font from wxFont?
3) How to open dialog with previous selected font?
It looks like it should work with constructor, but not for me.
static wxFontData data; 
wxFontDialog font_dialog((wxWindow *)mainframe, data);
nor this one:
static wxFontDialog font_dialog(nullptr);
Thanks for any advice.
Filip

Filip Sykala

unread,
Sep 22, 2021, 7:30:10 AM9/22/21
to wx-u...@googlegroups.com
forgotten data>
WX      : 3.1.4
OS      : Windows 10
COMPILER: CMAKE MSVC (Visual Studio 16 2019)

st 22. 9. 2021 v 12:52 odesílatel Filip Sykala <filip....@prusa3d.cz> napsal:
--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to a topic in the Google Groups "wx-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wx-users/OLxRphOPOg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wx-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/05450ff2-1e74-4759-af6d-d0b1cd8926c5n%40googlegroups.com.

Vadim Zeitlin

unread,
Sep 22, 2021, 12:17:13 PM9/22/21
to wx-u...@googlegroups.com
On Wed, 22 Sep 2021 03:51:58 -0700 (PDT) Filip Sykala wrote:

FS> I've three issues.
FS> 1) Is there a way to filtrate fonts inside dialog?

This depends on what do you mean by filtering. You can't filter by font
names, but you can filter by their more global characteristics, e.g. you
can restrict the fonts to fixed-pitch ones only.

FS> On my Windows 10, it looks like there is more than 200 fonts. And not all
FS> are TTF.

I think you should be able to see only TTF fonts if you use
wxFontData::RestrictSelection(wxFONTRESTRICT_SCALABLE).

FS> 2) How Can I recognize TTF font from wxFont?

We don't have anything in the API to distinguish vector fonts from the
bitmap ones.

FS> 3) How to open dialog with previous selected font?
FS> It looks like it should work with constructor, but not for me.
FS> static wxFontData data;
FS> wxFontDialog font_dialog((wxWindow *)mainframe, data);
FS> nor this one:
FS> static wxFontDialog font_dialog(nullptr);

You need to call wxFontData::SetInitialFont(), see the dialogs sample.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages