Click here to Skip to main content
15,741,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have found that at least one ttf font vanishes in WPF (4.0) when its text size is 100 or higher. Is this a known bug?

This can be seen:
<TextBlock x:Name="tb" FontFamily="Roboto" FontSize="99" Text="abcdef" HorizontalAlignment="Left" VerticalAlignment="Top" />

This can't:
<TextBlock x:Name="tb" FontFamily="Roboto" FontSize="100" Text="abcdef" HorizontalAlignment="Left" VerticalAlignment="Top" />

This also applies when the text is enlarged through render transforms:

This can be seen:
<Grid Height="200">
  <TextBlock x:Name="tb" FontFamily="Roboto" FontSize="50" Text="abcdef" />
  <ScaleTransform ScaleX="1.9999" />

But this can't:
  <TextBlock x:Name="tb" FontFamily="Roboto" FontSize="50" Text="abcdef" />
  <ScaleTransform ScaleX="2" />

The textblock:
1)Still arranges fine, and has appropriate actualheight and actualwidth values.
2)Has normal opacity and visibility values
3)If it has a background, the background appears fine/right size etc.

Also worth noting:
1)This font is by google and seems to work just fine otherwise. I've even opened it in a font editor and it seems normal
2)This is a TTF font
3)The font works fine in MS word etc at all font sizes BUT
4)If you publish an Ms Word file with this font at a large size to XPS, the font is invisible in the XPS doc (selectable, but not visible. As though it's opacity is 0)
4)This applies to content controls and textboxes too

The reason I don't just 'pick another font' is because my program uses a LOT of fonts like this. I can't manually check each one!

Has anyone seen this before? Any ideas?

The font can be downloaded from here[^]
Updated 16-Aug-12 15:51pm

I have read the documentation from Microsoft and it does not say anything about FontSize limit. Pasted the liks below as references:[^][^]

My advice to you is to head over to the Microsoft WPF Forum and ask this question were Microsoft employees ansers. I dont think this is a common problem for programmers, but you never know:[^]
Share this answer
Lee Reid 16-Aug-12 22:58pm    
Thanks :)
I've copied this question across to here:

I'll update codeproject if I hear back from microsoft
I eventually solved this issue by specifying the textformattingmode to be display.

<textblock fontfamily="Roboto" fontsize="110" text="abcdef" textoptions.textformattingmode="Display" />
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900