question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom fonts not working

See original GitHub issue

Hey, I’m having trouble getting custom fonts to work on Avalonia. I have a <TextBlock FontFamily="/Assets/dos.ttf#PerfectDOSVGA437">test</TextBlock> control in the XAML, the text is displayed in the fallback font instead of the specified one. System fonts work as expected though

This is the font I’m using, but I’ve tried others with no success

I’m thinking it could be a Linux issue since someone else tried the same thing on Windows and the text displayed correctly there

Anyone knows what could be causing this?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:27 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
ArtjomPcommented, Mar 18, 2021

@Gillibald just for your information. It would be more friendly to have a list of available fonts in the exception message: ... Avalonia.Skia.dll: 'Could not create glyph typeface for: My Font. Available fonts: Font One, Font Two ...

2reactions
ArtjomPcommented, Mar 18, 2021

I’ve returned all my fonts to EmbededResourses and to <FontFamily x:Key="MyFont">resm:My.Lib.Assets.Fonts.MyFont-Medium.ttf?assembly=My.Lib#Fira Code"</FontFamily> And added debug output for my resources: foreach (var res in assembly.GetManifestResourceNames()) Debug.WriteLine("found resource: " + res); the output is: found resource: My.Lib.Assets.Fonts.MyFont-Medium.ttf found resource: !AvaloniaResources It works almost but on showing a ToolTip. On Windows it just doesn’t show a tooltip on Mac it crushes with the Exception: ... Avalonia.Skia.dll: 'Could not create glyph typeface for: My Font.' at Avalonia.Skia.FontManagerImpl.CreateGlyphTypeface(Typeface typeface) in /_/src/Skia/Avalonia.Skia/FontManagerImpl.cs:line 139 ...

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using custom @font-face in CSS is not working in any ...
It turns out that I was using the "Files\Fonts\" as the path of the font, although since it was the css file I...
Read more >
Custom Fonts Not Displaying On Front End
If your custom font is not showing and you receive a CORS error in your browser's console, you need to contact your host,...
Read more >
css - Custom font not loading
Ok here is how it should work. and the fonts Folder should be located in the CSS folder. Also, remove your forward slashes...
Read more >
Custom font is not working.
Hi :] I am trying to put a custom font in my localhost site child theme. So Iv'e created the 'fonts' folder within...
Read more >
How To Load and Use Custom Fonts with CSS
You can use the @font-face rule to load a custom font on a web page. The history of loading custom fonts has lead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found