locked
FontStretch / FontWeight? RRS feed

  • Question

  • Hello,

     I am using a basic TextBlock, however, it doesn't seem the FontStretch or FontWeight properties work.  No matter what value I set, the appearance of the text does not change.  Do these properties only work with certain fonts?  If so, can you please tell me of a font where these values will work?  Can somebody show me a working example of using either of the FontStretch or FontWeight?  This seems so weird.

    Thank you!

    Saturday, October 20, 2007 6:27 PM

Answers

  • Here is the only answer I can find for you regarding this in Silverlight.

    If a font doesn't support a weight or style we currently (for v1) do not generate algorithmic bolded/italic versions of that font. This is why specifying Bold with the default font doesn't do anything.

    Tuesday, October 23, 2007 2:01 PM

All replies

  • You are probably not putting in the correct values for the FontWeight and FontStretch. Try something like <textblock FontWeight="ExtraBold" .../>

    Monday, October 22, 2007 9:15 AM
  • I have tried the following without any luck 

     <TextBlock FontFamily="Arial" FontSize="12" FontWeight="Thin" Text="Thin"></TextBlock>
     <TextBlock FontFamily="Arial" FontSize="12" FontWeight="Light" Text="Light" Canvas.Top="30"></TextBlock>
     <TextBlock FontFamily="Arial" FontSize="12" FontWeight="Bold" Text="Bold" Canvas.Top="60"></TextBlock>
     <TextBlock FontFamily="Arial" FontSize="12" FontWeight="ExtraBlack" Text="ExtraBlack" Canvas.Top="90"></TextBlock>

    If I use the FontStretch property, it does not work either.  Everything renders the same.  Do you have any suggestions?

    Monday, October 22, 2007 1:50 PM
  • OK. I have seen this before. This is probably due to your default font. Change to a different font, I.E. Times New Roman. And then you should be able to set this.

    Also, try

    <TextBlock FontFamily="Times New Roman" FontSize="12" FontWeight="ExtraBlack" Text="ExtraBlack" Canvas.Top="90" FontStretch="Expanded"></TextBlock>

    Monday, October 22, 2007 3:20 PM
  • I may be asking the wrong question.  How do you know what fonts support font weights and font stretching?  Are there any that support both?

    Thank you!

    Monday, October 22, 2007 5:24 PM
  • Here is the only answer I can find for you regarding this in Silverlight.

    If a font doesn't support a weight or style we currently (for v1) do not generate algorithmic bolded/italic versions of that font. This is why specifying Bold with the default font doesn't do anything.

    Tuesday, October 23, 2007 2:01 PM