Benutzer:MovGP0/WPF/Fonts
aus Wikipedia, der freien Enzyklopädie
< Benutzer:MovGP0 | WPF
MovGP0 | Über mich | Hilfen | Artikel | Weblinks | Literatur | Zitate | Notizen | Programmierung | MSCert | Physik |
WPF FontsEigene Fonts in Projekt einbinden[1]
<ItemGroup>
<Resource Include="Fonts\NotoSans-Bold.ttf" />
<Resource Include="Fonts\NotoSans-BoldItalic.ttf" />
<Resource Include="Fonts\NotoSans-Italic.ttf" />
<Resource Include="Fonts\NotoSans-Regular.ttf" />
<Resource Include="Fonts\NotoSansSymbols-Regular.ttf" />
</ItemGroup>
<Applicaton ...>
<Application.Resources>
<FontFamily x:Key="NotoSans">pack://application:,,,/Fonts/#NotoSans</FontFamily>
<FontFamily x:Key="NotoSansSymbols">pack://application:,,,/Fonts/#NotoSansSymbols</FontFamily>
</Application.Resources>
</Application>
<TextBlock x:Name="myTextBlock" Text="foobar" FontFamily="{StaticResource NotoSans}"
FontSize="10.0" FontStyle="Normal" FontWeight="Regular" />
var uri = new Uri("pack://application:,,,/");
myTextBlock.FontFamily = new FontFamily(uri, "./Fonts/#NotoSans");
Links
Referenzen
|