Moin,
Ich habe eine Projektvorlage, in der ich bspw. FontAwesome einbinde, was auch tadellos funktioniert.
Nun möchte ich eine weitere Schriftart einbinden und das funktioniert leider weder im Designer, noch in der Ausführung.
Ich gehe dabei folgendermaßen vor:
Die Schriftarten liegen im Projekt unter Fonts und sind alle als Resource im Buildvorgang eingetragen.
Ich habe darin auch eine Resourcendatei FontsInclude.xaml angelegt, in der alle Schriften auf die gleiche Weise definiert sind:
Datei- und Schriftartename sind korrekt, würde einen Screenshot machen, kann hier aber seit Jahren schon keine Bilder mehr posten, interessiert leider nur niemanden!
Diese Resourcendatei wird dann in der App.xaml eingebunden:
Jetzt kann ich bspw. die Schriften von FontAwesome wie folgt einbinden:
Versuche ich das hingegen mit der Schriftart ERASBD.TTF, klappt das nicht:
Sowohl der Designer, als auch die Executable fallen auf einen Fallback zurück.
Ich habe auch andere, beschriebene Wege probiert, aber bei mir haut das alles nicht hin, bspw.:
https://stackoverflow.com/questions/...-installing-it
https://www.reddit.com/r/dotnet/comm...wpf/?rdt=50428
https://learn.microsoft.com/en-us/an...ded-fonts-in-x
Hat vielleicht noch jemand einen Tipp?
EDIT:
Ach so, Alles unter .NET 4.8 aus Kompatiblitätsgründen zum ERP.
Ich habe eine Projektvorlage, in der ich bspw. FontAwesome einbinde, was auch tadellos funktioniert.
Nun möchte ich eine weitere Schriftart einbinden und das funktioniert leider weder im Designer, noch in der Ausführung.
Ich gehe dabei folgendermaßen vor:
Die Schriftarten liegen im Projekt unter Fonts und sind alle als Resource im Buildvorgang eingetragen.
Ich habe darin auch eine Resourcendatei FontsInclude.xaml angelegt, in der alle Schriften auf die gleiche Weise definiert sind:
Code:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <FontFamily x:Key="FA6Solid">/Fonts/FA6Solid.otf#Font Awesome 6 Free Solid</FontFamily> <FontFamily x:Key="FA6Regular">/Fonts/FA6Regular.otf#Font Awesome 6 Free Regular</FontFamily> <FontFamily x:Key="FA6Brands">/Fonts/FA6Brands.otf#Font Awesome 6 Brands Regular</FontFamily> <FontFamily x:Key="ErasBold">/Fonts/ERASBD.TTF#Eras Bold ITC</FontFamily> </ResourceDictionary>
Diese Resourcendatei wird dann in der App.xaml eingebunden:
Code:
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Styles/DataGridStyles.xaml"/> <ResourceDictionary Source="Styles/ButtonStyles.xaml"/> <ResourceDictionary Source="Fonts/FontsInclude.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
Code:
<TextBlock FontFamily="{StaticResource FA6Solid}" .../>
Code:
<TextBlock FontFamily="{StaticResource ErasBold}" .../>
Ich habe auch andere, beschriebene Wege probiert, aber bei mir haut das alles nicht hin, bspw.:
https://stackoverflow.com/questions/...-installing-it
https://www.reddit.com/r/dotnet/comm...wpf/?rdt=50428
https://learn.microsoft.com/en-us/an...ded-fonts-in-x
Hat vielleicht noch jemand einen Tipp?
EDIT:
Ach so, Alles unter .NET 4.8 aus Kompatiblitätsgründen zum ERP.
Comment