View Issue Details

IDProjectCategoryView StatusLast Update
0002546NoesisGUIC# SDKpublic2023-03-29 13:20
Reportersumel007 Assigned Tosfernandez  
PrioritynormalSeveritymajor 
Status resolvedResolutionno change required 
Product Version3.2.0 
Target Version3.2.1Fixed in Version3.2.1 
Summary0002546: Font with "Condensed" in the name is not rendered properly
Description

I use Roboto Condensed font (that's the actual name of the family). In 3.1.7 it worked properly, but in 3.2 it seems to go back to rendering the default font. I assume it's due to "Condensed" being in the name and the parser interpreting it as font family Roboto with condensed line spacing (which is not the case here).
Roboto Condensed font is available here: https://fonts.google.com/specimen/Roboto+Condensed

PlatformAny

Activities

sfernandez

sfernandez

2023-03-28 16:57

manager   ~0008373

After fixing 0002545 I tried the specified Roboto Condensed font and it works as expected, so I think your problems were related to the previous ticket.
I tested the following xaml:

<TextBlock Text="Hello World" FontFamily="pack://application:,,,/Fonts/#Roboto Condensed"/>
<TextBlock Text="Hello World" FontFamily="/Fonts/#Roboto Condensed"/>
<TextBlock Text="Hello World" FontFamily="Fonts/#Roboto Condensed"/>

And in all cases the font selected was the correct one.

Could you share the xaml you were using and the file structure (and providers) that were failing for you?

sfernandez

sfernandez

2023-03-29 12:25

manager   ~0008379

I see now what is happening, in 3.2 we fully implemented the font differentiation algorithm used by WPF (0001868).
This means that if a style is included in the FontFamily name it will try to match that, overriding the style attributes, so for example:

This text will use "Roboto" + Condensed + Italic, which is "Roboto Condesed Italic" font:

<TextBlock Text="Hello World" FontFamily="Fonts/#Roboto" FontStretch="Condensed" FontStyle="Italic"/>

This text will use "Roboto Condensed" font, ignoring the Italic attribute:
<TextBlock Text="Hello World" FontFamily="Fonts/#Roboto Condensed" FontStyle="Italic"/>

This text will use "Roboto Condensed Italic" font:
<TextBlock Text="Hello World" FontFamily="Fonts/#Roboto Condensed Italic"/>

This text will use "Roboto Condensed Italic" font too, ignoring the Bold attribute:
<TextBlock Text="Hello World" FontFamily="Fonts/#Roboto Condensed Italic" FontWeight="Bold"/>

This text will use "Roboto Condensed Bold Italic" font:
<TextBlock Text="Hello World" FontFamily="Fonts/#Roboto Condensed Bold Italic"/>

Our recommedation is to use the plain family name "Roboto", and then specify the rest of styles as attributes. So you can define styles like this:

<FontFamily x:Key="RobotoFont">../Fonts/#Roboto</FontFamily>
<Style x:Key="Roboto" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{StaticResource RobotoFont}"/>
<Setter Property="FontStretch" Value="Condensed"/>
</Style>
<Style x:Key="RobotoBoldItalic18" TargetType="TextBlock" BasedOn="{StaticResource Roboto}">
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="LineHeight" Value="20"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>

sumel007

sumel007

2023-03-29 13:07

reporter   ~0008383

Okay, I see now. Thanks for clarifying it. Yeah using Roboto as the font family name and then specifying weight, spacing etc. separately seems to work correctly. It was a little confusing, since the font is called "Roboto Condensed", which is why I was referencing it the way I originally was. But your solution seems to work fine. Thank you!

Issue History

Date Modified Username Field Change
2023-03-28 11:41 sumel007 New Issue
2023-03-28 12:04 sfernandez Assigned To => sfernandez
2023-03-28 12:04 sfernandez Status new => assigned
2023-03-28 12:04 sfernandez Target Version => 3.2.1
2023-03-28 16:57 sfernandez Status assigned => feedback
2023-03-28 16:57 sfernandez Note Added: 0008373
2023-03-29 09:09 sumel007 Status feedback => assigned
2023-03-29 12:25 sfernandez Status assigned => feedback
2023-03-29 12:25 sfernandez Note Added: 0008379
2023-03-29 13:07 sumel007 Note Added: 0008383
2023-03-29 13:07 sumel007 Status feedback => assigned
2023-03-29 13:20 sfernandez Status assigned => resolved
2023-03-29 13:20 sfernandez Resolution open => no change required
2023-03-29 13:20 sfernandez Fixed in Version => 3.2.1