Click here to Skip to main content
15,891,942 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?

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

This can't:
XML
<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:
XML
<Grid Height="200">
  <TextBlock x:Name="tb" FontFamily="Roboto" FontSize="50" Text="abcdef" />
  <Grid.RenderTransform>
  <ScaleTransform ScaleX="1.9999" />
  </Grid.RenderTransform>
  </Grid>

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


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[^]
Posted
Updated 16-Aug-12 15:51pm
v2

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

http://msdn.microsoft.com/en-us/library/office/aa200988%28v=office.10%29.aspx[^]
http://msdn.microsoft.com/en-us/library/cc189010%28v=vs.95%29.aspx[^]

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:
http://social.msdn.microsoft.com/forums/en/wpf/threads/[^]
 
Share this answer
 
Comments
Lee Reid 16-Aug-12 22:58pm    
Thanks :)
I've copied this question across to here: http://social.msdn.microsoft.com/Forums/en/wpf/thread/50e6086f-e767-4e07-bcc2-9e53ed78d05d

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

XML
<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