Use a custom font using a .NET COM object.

I am trying to load a custom font in C # so it can be used by COM libraries (like ESRI) and GDI +.

I want to download a font from disk and do not want to install the font on the system.

The COM font is of type stdole.IFontDisp.

EDIT: Using a combination of AddFontResourceEx with PrivateFontCollection solves the problem.

+1


source to share


1 answer


There are two GDI functions you can use

AddFontResource RemoveFontResoure

Details here



Understand that as long as you download other applications, you will be able to see and use the font. There is no other way if you want to use the API. After adding the font, you can configure IFontDisp (for COM) and CFont (for GDI +) and use it.

Note that IFontDisp is found by referencing standard OLE types

+1


source







All Articles