Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#15410 closed defect (fixed)

wxFontList doesn't correctly match existing fonts

Reported by: eco Owned by:
Priority: normal Milestone:
Component: base Version:
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

On WXGTK there is a specialization in wxFontList::FindOrCreateFont to match when the font family is wxFONTFAMILY_DEFAULT and the font from the existing list is wxFONTFAMILY_SWISS but all other platforms just compare font family directly (with a note by VZ wondering why the other platforms don't use the same logic as GTK). On Windows the exact same issue happens where SWISS is the default font family.

This led to fonts often not matching and identical fonts being added over and over to the font list. On Windows this can exhaust GDI resources and cause some nasty program drawing corruptions and crashes.

Attached is a patch in which I've simply made all platforms follow the same logic as the WXGTK specialization. My software no longer slows down and eventually crashes as GDI resources get exhausted.

Attachments (1)

fix_non-gtk_font_list.patch download (1.1 KB) - added by eco 13 months ago.
Treat SWISS as the default font family

Download all attachments as: .zip

Change History (4)

Changed 13 months ago by eco

Treat SWISS as the default font family

comment:1 Changed 13 months ago by vadz

Unfortunately wxFONTFAMILY_SWISS doesn't seem to be the default under OS X where it's mapped to "Helvetica" while wxFONTFAMILY_DEFAULT is "Lucida Grande" (interestingly enough, in the old Cocoa port they were mapped to "Lucida Grande" and "Times", respectively). So at best we can do this for non-OSX ports and I'll commit this for now...

comment:2 Changed 13 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [74660]) Replace wxFONTFAMILY_DEFAULT with wxFONTFAMILY_SWISS when comparing fonts.

Otherwise comparison always failed as no existing fonts had
wxFONTFAMILY_DEFAULT as their family in all ports except wxOSX, which does
keep wxFONTFAMILY_DEFAULT.

Closes #15410.

comment:3 Changed 13 months ago by eco

Thanks.

Note: See TracTickets for help on using tickets.