Packaging fonts into a windows exe

M

Matthias S.

hi there,

can anyone tell me whether it is possible to pack a font into a .net
2.0 windows application (resource)? i need to use the font within the
application, but i don't want to distribute it as a ttf file. i've read
on msdn that this is possible through wpf in .net 3.0 but can't find
any information on how to do it in 2.0.

any help is highly appreciated. kind regards,

matthias
--
 
I

Ignacio Machin ( .NET/ C# MVP )

hi there,

can anyone tell me whether it is possible to pack a font into a .net
2.0 windows application (resource)? i need to use the font within the
application, but i don't want to distribute it as a ttf file. i've read
on msdn that this is possible through wpf in .net 3.0 but can't find
any information on how to do it in 2.0.

any help is highly appreciated. kind regards,

matthias
--

Hi,

You can always pack it as a resource in the .EXE and then @ runtime
create a temp file with the form and use it like that.
Note that you would have to pack it as just another file though.
 
M

Matthias S.

i don't fully understand your answer. do you mean i should pack the
font into another file and then extract it from there? like for
example, encrypt the font, decrypt it and use it, and on application
exit encrypt it again? could you please provide some more detailed
information?

all i need is to use a font in my applikation (it doesn't have to be
necessarily stored in the resource file) but i don't want to install
the font on the users machine. i don't even want, that the user can
install the font himself.

kind regards,

matthias
 
B

Ben Voigt [C++ MVP]

Matthias said:
hi there,

can anyone tell me whether it is possible to pack a font into a .net
2.0 windows application (resource)? i need to use the font within the
application, but i don't want to distribute it as a ttf file. i've
read on msdn that this is possible through wpf in .net 3.0 but can't
find any information on how to do it in 2.0.

p/invoke AddFontMemResourceEx before calling InitializeComponent (which sets
the fonts for .NET controls).
 
I

Ignacio Machin ( .NET/ C# MVP )

i don't fully understand your answer. do you mean i should pack the
font into another file and then extract it from there? like for
example, encrypt the font, decrypt it and use it, and on application
exit encrypt it again? could you please provide some more detailed
information?

No,
What I mean is that you can embedd ANY file of any kind as a resource
in your EXE (or DLL) and later extract it (take a look at this post of
mine from a time ago
http://groups.google.com/group/micr...&q="ignacio+machin"+embedded#5f6130995d18d4e5
)

So after you extract the file you can try to install the font.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top