This is a migrated thread and some comments may be shown as answers.

Dynamically load custom fonts

1 Answer 141 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
timothy
Top achievements
Rank 1
timothy asked on 21 Oct 2010, 12:59 AM
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. 

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 26 Oct 2010, 07:58 AM
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
Tags
RichTextBox
Asked by
timothy
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or