Dynamically load custom fonts

2 posts, 0 answers
  1. timothy
    timothy avatar
    2 posts
    Member since:
    Nov 2008

    Posted 20 Oct 2010 Link to this post

    I understand that the richtextbox does not support fontsource; however would it be possible to create a seperate xap containing fonts and dynamically load them using MEF.  Also how are custom fonts handled in the UI ribbon and are there any samples that you have that would be helpful in accomplishing this task. 
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 26 Oct 2010 Link to this post

    Hello timothy,

    There are issues when using custom fonts with RadRichTextBox, which we are trying to resolve. The first is that if the embedded font family is not set to the FontFamily property of a TextBox, TextBlock or RichTextBox which is in the visual tree, it does not get initialized using new FontFamily("Fonts/ChaparralPro-Regular.otf#Chaparral Pro"). There are some other cases when the behavior is inconsistent. 

    The only way we have found to work is to have a helper stack panel with TextBlocks using the embedded font families and when using the fonts in code-behind, reference them through the TextBlocks. It is more of a hack, but you can test how it works and decide if it is suitable and stable enough. Please find attached a demo illustrating how this approach can be implemented. 

    Best wishes,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top