C # webbrowser control - I want to use / link a specific font

I am writing a simple text editor for famous .nfo files. To simplify the layout, I use the webbrowser control to display the nfo file. I have a font - non-standard - I would like to use.

What is the best way to enable / link a font in my application? Should I include it in the application folder and register it, or is there a way to use a font in my control that is not installed by default?

+3
source share
1 answer

Fonts are not part of the web control. Fonts come from the HTML page of the web page that you are viewing using the web control.

So, the first step is to create an example HTML page that displays correctly in the browser (with the necessary fonts), after which you can load this page into webcontrol later.

To download fonts in an html page, see How to embed fonts in HTML?

After this, the second step is to simply generate the text of the HTML page dynamically (with the font code in it and your NFO), and then paste it into the WebBrowser control.

0
source

Source: https://habr.com/ru/post/1725358/


All Articles