How to apply a custom font family to Editor control from Stream at the run time?

Deepak Gunasekaran 61 Reputation points

I have gone through the Fonts documentation for using custom fonts for Editor control in the .NET MAUI application. It requires registering font in the application to achieve the same. Instead of this, is it possible to use a custom font for Editor control from a font stream programmatically at the run time?

What I am attempting to accomplish: I have a forms document with text fields. I want to load it in a MAUI application, display the text fields, and allow users to view and edit the text fields. The text fields can be created using custom fonts and various forms use various fonts. It is not possible to keep all the fonts registered in the application. However, based on the forms loaded, I can obtain the font stream used in the text field.

Using the font stream, I need to set the font family for Editor preserving the original font metrics at the runtime.

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,156 questions
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 58,166 Reputation points Microsoft Vendor


    Based on your following statement, I guess it is not possible to create a font at runtime from a stream and use in the control. If that so, we can conclude it as not possible in MAUI control.

    Yes, it cannot be achieved, please add these fonts in the Fonts folder, then register them.

    Best Regards,

    Leon Lu

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful