wxFontEnumerator::IsValidFacename does not account for fuzzy matching (Issue #26056)

11 views
Skip to first unread message

GenevensiS

unread,
Dec 28, 2025, 1:04:36 PM (3 days ago) Dec 28
to wx-...@googlegroups.com, Subscribed
G-e-n-e-v-e-n-s-i-S created an issue (wxWidgets/wxWidgets#26056)

When I get the list of fonts using wxFontEnumerator::GetFacenames(), it contains a font named:
"CCMeanwhile-Regular"

If I now create a font like so:
wxFont testFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, "CCMeanwhile Regular");
(with a space instead of a hyphen in the face name), then wxFontEnumerator::IsValidFacename(testFont.GetFaceName()) returns false, as expected.

However, if I now pass this font to a DC using DC::SetFont(testFont), the DC uses the "CCMeanwhile-Regular" font to draw text.

The documentation for wxFont states:
"If the desired font does not exist, the closest match will be chosen."

Is there a way to know in advance if a DC will render text using the default font or not, when given a particular font name string? Basically, the same as wxFontEnumerator::IsValidFacename, but taking into account the fuzzy matching?

Thank you for your continued work on this great library.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26056@github.com>

Reply all
Reply to author
Forward
0 new messages