-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new FontFamily( "file:///absolutepath#fontname" ) doesn't load TTF #3766
Comments
@MikeHillberg FYI |
Not a surprising gap given that WinUI3 is coming from the code written to target UWP and not Win32, and in UWP absolute file paths are not so much a thing. To be clear, this is a mismatch with WPF, not a mismatch between inbox OS XAML and WinUI3? |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
So how can I load fontfamily from file path? Finally, I wrote the ttf file in AppData folder from EmbeddedResource. |
It works with relative path for custom fonts or full path for System fonts |
Hello to all, I just discovered this old issue while searching for the same thing. And I found an workaround, though a bit limited. Hope it might help you a bit. |
Describe the bug
Loading a font dynamically from the file system doesn't work correctly in a WinUI 3 Desktop application. Loading fonts dynamically using the file:///absolutepath#fontname syntax works in WPF.
Steps to reproduce the bug
Steps to reproduce the behavior:
_textBlock.FontFamily = new FontFamily(@"file:///absoluatepath#fontname");
// replace absolutepath with the path to a TTF and fontname with the name of the font.
Expected behavior
It should load the font and apply it to the component.
Version Info
NuGet package version:
[Microsoft.WinUI 3.0.0-preview3.201113.0]
Windows app type:
Windows 10 2004 20262.1010 Windows Feature Experience Pack 120.27510.103230.0
The text was updated successfully, but these errors were encountered: