Home > Blockchain >  Get font in use when multiple font families specified in WPF
Get font in use when multiple font families specified in WPF

Time:02-01

In WPF I set a style for my control so it has multiple font families specified:

<Style TargetType="{x:Type MyControl}">
    <Setter Property="FontFamily"
            Value="Helvetica, Arial, Segoe UI" />
</Style>

How can I determine which font is actually got selected and is in use for the control?

CodePudding user response:

According to this blog post:

The XAML text renderer [...] uses the specified list (family) of fonts on a character by character basis.

So there is no ‘font in use for the control’ as you ask.

To find out which font is used for each character, this response looks a good starting point.

  •  Tags:  
  • Related