Sys.Drawing.SystemFonts does not return UI fonts being used in system

Bug #1577241 reported by Mingye Wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mono
Unknown
Unknown
mono (Ubuntu)
New
Undecided
Unassigned

Bug Description

The current mono implementation of System.Drawing.SystemFonts is hard-coded to return "Microsoft Sans Serif" and "Tahoma" for system font queries. Even though this matches MSDN-documented values for Windows, this violates the intended semantics of this class, and produces surprises for cross-platform Winforms developers.

With fontconfig usage in libgdiplus, a quick and (kind of) dirty fix is to replace them with "Sans" (or "Ubuntu" if you want to.) A more MSDN-friendly solution[1] is to return GenericSansSerif directly, however this ends up pointing to libgdiplus's implementation which ends up giving MS Sans Serif too.
  [1]: https://msdn.microsoft.com/en-us/library/system.drawing.systemfonts.defaultfont(v=vs.110).aspx

A related workaround in fontconfig is to alias Microsoft Sans Serif to Helvetica in 30-metric-aliases.conf (fd.o 95232). This should at least solve the issue that fontconfig most likely knows nothing about matching "Microsoft Sans Serif".

Mingye Wang (artoria2e5)
description: updated
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.