Using custom fonts in C# application

By | 19. March 2016

Recently I wanted to embed custom fonts in my application. After some googling and mixing the solution is this

Add your font file to project resources :

Embed Font

Embed Font

 

Use the code above and you are ready to go. This solution also works with DevExpress edit components

Nice tool to quickly make your font form images https://glyphter.com/

 

Other references

http://www.codeproject.com/Articles/107376/Embedding-Font-To-Resources

http://stackoverflow.com/questions/1955629/c-sharp-using-an-embedded-font-on-a-textbox

 

 

5 thoughts on “Using custom fonts in C# application

  1. kulstad

    This is extremely useful (and timely for me), thank you for this. However, how would you modify this to dynamically load more than one font? I am building a report application, and the headers of the reports need to be a different font from the detail/body section of the report (ie: report headers = “Times New Roman”, detail/body section = “Arial”).

    Thanks in advance for any insight you may have.

  2. admin Post author

    Than you for your comment!

    Why do you need to load custom fonts for report application ?
    Specially in case of your example the fonts like “Times New Roman” and “Arial” are always present in system.

    I don’t know how does your report application work, but can’t you just use standard
    … = new Font(“Arial”, 20)
    instead of complex loading external fonts?

    Also – reporting is very complex task. I use one commercial tool for most applications. But there are also available several freeware tools and maybe they are worth to look at before putting effort into writing own reporting engine. Here is one list, sure not exhaustive one, but good starting point : http://www.butleranalytics.com/5-free-net-reporting-tools/

    1. kulstad

      I used TimeNewRoman and Arial as examples, but the fonts I need to use are custom fonts that we don’t want to distribute to customers. Swap Arial and Times New Roman for CustomFont1 and CustomFont2, and my question remains the same.

      I am using Crystal Reports for our application, and have no issues with it (other than accessing the objects properly, but that’s just a minor concern).

  3. Pingback: Using custom fonts in C# application revisited - Software Blog

Leave a Reply