I downloaded SegMDL2.ttf from https://learn.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font, added to the project, set Build Action as Resource and added following to the ResourceDictionary:
<FontFamily x:Key="mdl2">/Resources/Fonts/#Segoe MDL2 Assets</FontFamily>
<sys:String x:Key="mdl2 Save"></sys:String>
<sys:String x:Key="mdl2 PDF"></sys:String>
Why this displays correct glyph <TextBlock FontFamily="{StaticResource mdl2}" Text="{StaticResource mdl2 Save}"/>
,but this does not <TextBlock FontFamily="{StaticResource mdl2}" Text="{StaticResource mdl2 PDF}"/>?
Missing icon in Segoe MDL2 Assets font family
I don't think this solution is applicable as I want to use embedded resource, not system font (targeting W10 & W7 systems)
I copied font from W10 1909 c:\Windows\Fonts\segmdl2.ttf and all glyphs are now visible. Don't use file hosted on MS website mentioned in question.
Related
I am attempting to use Font Awesome in a WPF app. It half works. That is, some glyphs are picked up and show, others show a rectangle.
I'm following guides correctly, I think, but something is going wrong!
Here's a code snippet
<Window.Resources>
<FontFamily x:Key="FontAwesomeRegular">Fonts/Font Awesome 5 Free-Regular-400.otf#Font Awesome 5 Free Regular</FontFamily>
<FontFamily x:Key="FontAwesomeBrands">Fonts/Font Awesome 5 Brands-Regular-400.otf#Font Awesome 5 Brands Regular</FontFamily>
<FontFamily x:Key="FontAwesomeSolid">Fonts/Font Awesome 5 Free-Regular-400.otf#Font Awesome 5 Free Solid</FontFamily>
</Window.Resources>
<Grid>
<StackPanel Orientation="Vertical">
<TextBlock FontFamily="{StaticResource FontAwesomeSolid}" Text="" HorizontalAlignment="Left" Foreground="Red" Margin="0" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="100"/>
<TextBlock FontFamily="{StaticResource FontAwesomeSolid}" Text="" HorizontalAlignment="Left" Foreground="Red" Margin="0" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="100"/>
</StackPanel>
</Grid>
The fonts are installed in a Fonts directory
And Marked as Resource
And this is what it shows on the screen
You can see that the first icon xf15c; displays as expected but the second one xf15a; does not. Generally, most do not display.
Why?
If you open the .otf file, you can see the name of the font. This is what you need to use to the FontFamily resource, without the file extension.
Try the following code:
<FontFamily x:Key="Icons">pack://application:,,,/{YOUR PROJECT NAME};component/Fonts/#Font Awesome 5 Free Solid</FontFamily>
With caliburn.micro I can't access to any third-party fonts in my folder in my WPF Solution, and I was able to ensure the following:
Build Action is set to Resources
Font family = "./Font/#FontAwesome"
And I still cannot retrieve icons from Font Awesome.
The XAML code from my button:
<Button Name="MailButton"
Grid.Row="1" Grid.Column="2"
Width="60" Height="60"
Content=""
FontSize="30"
Foreground="White"
BorderThickness="0"
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
BorderBrush="{x:Null}"
FontFamily="./Font/#FontAwesome"
Background="#FF085078"/>
In my second project without using the Caliburn font, it worked, even when I tried to access it in the same way as I did in my first project. What can I do more to make this font working? What properties of my project should I check first?
You need to delete the leading period (.) from the font family path, then you can access your font. Example:
FontFamily = "/Font/#FontAwesome"
We are developing a custom header bar and we need to use the close/minimize/reduce button from the Windows 10 theme even if we are in windows 7.
Our approach was to use the font family from Windows 10. Is there a way to get it?
You should be able to download the Segoe MDL2 Assets font family from here or just copy the .ttf file over from a Windows 10 instance: https://www.azfonts.net/families/segoe-mdl2-assets.html
Once you have done this, you should add the .ttf file to your project as a resource. You can then use the symbols like this:
<!-- Minimize -->
<TextBlock Text="Value="" FontFamily="pack://application:,,,/#Segoe MDL2 Assets" FontSize="10" />
<!-- Maximize -->
<TextBlock Text="Value="" FontFamily="pack://application:,,,/#Segoe MDL2 Assets" FontSize="10" />
<!-- Restore -->
<TextBlock Text="Value="" FontFamily="pack://application:,,,/#Segoe MDL2 Assets" FontSize="10" />
<!-- Close -->
<TextBlock Text="Value="" FontFamily="pack://application:,,,/#Segoe MDL2 Assets" FontSize="10" />
I want to display text in italic with Segoe UI Light font family.
I am not sure but looks like in wpf TextBlock for FontFamily Segoe UI Light, FontStyle Italic is not supported.
Is there any other control (Except RichTextBox because I want to use it for field name and value) like a label or something which I can use or am I doing something wrong.
<TextBlock x:Name="TextBlockContent"
FontSize="28"
FontStyle="Italic"
FontFamily="Segoe UI Light"
Text="Text doesn't display in italic" />
There is a Segoe UI Light Italic font (you can get it from Microsoft Typography) and it comes as part of Windows 8. However, you need to have it installed on the machine in order to be able to use it.
Specifying the base font and applying the style should work if you have the font installed.
Specifying the font explicitly will definitely work:
<TextBlock x:Name="TextBlockContent"
FontSize="28"
FontFamily="Segoe UI Light Italic"
Text="Text should display in italic" />
I have a Silverlight 4 Application that I run using Visual Studio 2012 Web Express. I added a CustomFont.zip in the Fonts folder of my project. the file is marked as "Resource".
When I use the font, in a TextBlock for example, I can see it in the Visual Studio XAML designer. But when I run the application it uses de default standard font.
Here's an example of my TextBlock
<TextBlock FontFamily="/Fonts/CustomFont.zip#MyFontName" >Hello World</TextBlock>
I have tried with embedded Zip like the example above. I also tried the font directly (without zip). Tried with TTF and OTF Font. Always same result I can see it at design time but not at runtime.
Thanks
I'm sure you have this working by now but I had the same problem. I got it to work by formatting my FontFamily string like below and you definitely don't want the file to be in a zip file. I have my font in a project folder I created called "Fonts".
<TextBlock FontFamily="./Fonts/MyFontName.ttf#MyFontName" >Hello World</TextBlock>
I also had same problem and I solved like below. I had to go through a lot of forums including this but none works. But some forum asked me to forcibly load font before I come to point of my interest.
In my TextBlockStyles.xaml resource dictionary I created a styke
<Style x:Key="RadWindowTitleTextStyle"
TargetType="TextBlock">
<Setter Property="Foreground"
Value="#FFB9D449" />
<Setter Property="FontSize"
Value="18.667" />
<Setter Property="FontFamily"
Value="/sampleawebsite.application;component/Assets/Fonts/UBSHead.ttf#UBSHeadline" />
</Style>
In my MainPage, I just gave below to load my font
<TextBlock Text="Do not display Font load purpose only"
Width="1"
Height="1"
Style="{StaticResource RadWindowTitleTextStyle}"
Foreground="Transparent" />
Below is my point of interest in one of my ChildWindow popup styles resource dictionary called RadWindowStyles.xaml
<TextBlock Text="{TemplateBinding Title}"
Style="{StaticResource RadWindowTitleTextStyle}" />