views:

179

answers:

1

I am trying o load a custom font in C#, so it is usable by COM libraries (like ESRI) and by GDI+.

I want to load the font from disk and don't want to install the font on the system.

COM font is of type stdole.IFontDisp.

EDIT: using in AddFontResourceEx combination with the PrivateFontCollection solves the issue.

+1  A: 

There are two GDI functions you can use

AddFontResource RemoveFontResoure

Detailed here

Understand that while you have this loaded other applications will be able to see and use the font. There is no other way around this if you want to use the APIs. Once you added the Font then you can setup a IFontDisp (for COM) and a CFont (for GDI+) and use it.

Note that IFontDisp is found by making a reference to Standard OLE Types

RS Conley