I haven't tried it, but you could try using
PrivateFontCollection.AddMemoryFont().  Based on signature, something like
the following?

// load of font resource and retrieval of it's length performed previous
GCHandle gcHandle = GCHandle.Alloc(loadedFontResource,
GCHandleType.Pinned);
try
{
  privateFontCollection.AddMemoryFont(gcHandle.AddrOfPinnedObject, length);
}
finally
{
  gcHandle.Free();
}

I don't know if the font resource needs to stay pinned--the documentation
doesn't detail that; so be sure to watch for that.

On Mon, 17 Mar 2008 15:57:13 -0400, Peter Vertes <[EMAIL PROTECTED]> wrote:

>*Hi List,*
>
>    I have a font embedded inside a resource in one of my assemblies but I
>can't seem to able to retrieve it.  Correction, I am able to retrieve it
but
>the only way I can do it is by saving the stream of data coming from the
>resource file to the disk and then loading the saved font into the
>PrivateFontCollection's AddFontFile() method.  While I can retrieve the
font
>from the resource file this way there has to be a way to do all this
without
>writing to the disc.  Can anyone point me in the right direction ?  Thanks
>in advance...

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to