Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Packaging fonts into a windows exe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthias S. - 26 Mar 2008 18:06 GMT
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
--
Ignacio Machin ( .NET/ C# MVP ) - 26 Mar 2008 20:11 GMT
On Mar 26, 1:06 pm, "Matthias S."
<matthias.st_SP_AM_TR_...@googlemail.com> wrote:
> hi there,
>
[quoted text clipped - 8 lines]
> 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.
Matthias S. - 26 Mar 2008 20:42 GMT
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
Signature


> On Mar 26, 1:06 pm, "Matthias S."
> <matthias.st_SP_AM_TR_...@googlemail.com> wrote:
[quoted text clipped - 16 lines]
> 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.
Peter Bromberg [C# MVP] - 26 Mar 2008 21:11 GMT
I think what Ignacio means is that you could include the font in your built
assembly as an embedded resource and pull it out at runtime with
GetManifestResourceStream. However, I am not sure if you can actually use a
TTF font without installing it first into the Fonts folder.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net

> 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
[quoted text clipped - 31 lines]
> > 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.
Ignacio Machin ( .NET/ C# MVP ) - 26 Mar 2008 22:13 GMT
On Mar 26, 3:42 pm, "Matthias S."
<matthias.st_SP_AM_TR_...@googlemail.com> wrote:
> 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/microsoft.public.dotnet.languages.csharp/browse_f
rm/thread/1dd44602a1ca360c/5f6130995d18d4e5?lnk=gst&q=%22ignacio+machin%22+embed
ded#5f6130995d18d4e5

)

So after you extract the file you can try to install the font.
Ben Voigt [C++ MVP] - 26 Mar 2008 21:10 GMT
> hi there,
>
[quoted text clipped - 3 lines]
> 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).

> any help is highly appreciated. kind regards,
>
> matthias

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.