WPF: Why does these two give different values?
FontSelector.ItemsSource = Fonts.SystemFontFamilies;
FontSelector.ItemsSource = from font
in new System.Drawing.Text.InstalledFontCollection().Families
select font.Name;
Please Explain?
The WPF API gives you font families. For example, this means that Arial would appear once on the list, instead of a few entries for Arial Narrow, Arial Black, etc. which is fine since you should specify this using the
TextElement.FontWeightproperty. It’s the same way fonts are grouped in the control panel.Also, the System.Drawing API does not include Open Type fonts (.otf) while WPF does, so they will be missing from that list.