How to ignore font size

4 posts, 0 answers
  1. Dave
    Dave avatar
    3 posts
    Member since:
    Jul 2012

    Posted 05 Sep Link to this post

    I'm trying to find a way to render all text in a RadRichTextBox in a single font size, ignoring the document style(s).

    Does anybody know of a place to start?

    Thanks

  2. Tanya
    Admin
    Tanya avatar
    577 posts

    Posted 08 Sep Link to this post

    Hi Dave,

    Since the styling mechanism is pretty complex and font size can be applied through styles, locally or through inheritance, to ensure that the document has a single font size no matter what has been set, you will need to set the local property for each span.You can achieve that through the Selection API:
    this.radRichTextBox.Document.Selection.SelectAll();
    this.radRichTextBox.ChangeFontSize(Unit.PointToDip(10));
    this.radRichTextBox.Document.Selection.Clear();

    You can use the DocumentChanged event of RadRichTextBox to apply these changes. 

    Hope this helps.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Michael
    Michael avatar
    4 posts
    Member since:
    Sep 2017

    Posted 03 Oct in reply to Tanya Link to this post

    Thanks Tanya.
    I'd rather not flatten down the actual font sizes - i'll want that info at a later stage in the files' workflow. 

    I was hoping for a setting/hook/override in the draw/render pipeline.

  4. Tanya
    Admin
    Tanya avatar
    577 posts

    Posted 06 Oct Link to this post

    Hello Michael,

    How a document is shown in RadRichtextBox strongly depends on the style settings of the document. If I correctly understand, your requirement is to change the way the document is visualized without actually changing its style settings. If so, I am afraid that this is not possible.

    Regards,
    Tanya
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top