microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.27k stars 674 forks source link

[Regression] FontFamily resolution changed between WinUI 2 and WinUI 3 #9247

Open jbrianceau opened 8 months ago

jbrianceau commented 8 months ago

Describe the bug

On the same machine, some FontFamily that are properly resolved with WinUI 2 fall back to the default Segoe UI font with WinUI 3.

Steps to reproduce the bug

Use the following XAML snippet in an app:

<TextBlock FontSize="24">
    <TextBlock.Inlines>
        <Run Text="Segoe UI" FontFamily="Segoe UI"/><LineBreak/>
        <Run Text="Arial" FontFamily="Arial"/><LineBreak/>
        <Run Text="Arial Narrow" FontFamily="Arial Narrow"/><LineBreak/>
        <Run Text="Algerian" FontFamily="Algerian"/><LineBreak/>
        <Run Text="Harlow Solid Italic" FontFamily="Harlow Solid Italic"/><LineBreak/>
    </TextBlock.Inlines>
</TextBlock>

Note that other controls like CheckBox are impacted as well.

Expected behavior

On the same machine, the rendering should be the same whether WinUI 2 or WinUI 3 is used.

Screenshots

Using a WinUI 2 / UWP app, rendering is correct: image

Using a WinUI 3 / WinAppSDK app, rendering is not correct. "Arial Narrow" and "Harlow Solid Italic" fall back to Segoe UI: image

NuGet package version

WinUI 3 - Windows App SDK 1.4.4: 1.4.231219000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

JohnnyWestlake commented 7 months ago

Also related https://github.com/microsoft/microsoft-ui-xaml/issues/6109

Caused by change change from WSS family resolution in Windows 10 SDK's to Typographic font families for Windows 11 SDK's, with no way provided to properly reference the missing fonts. This also affects WinUI 2 if the Min version is set to a Windows 11 SDK.