Storing Font data for use on other PC  
Author Message
Reiner Obrecht





PostPosted: Visual C# General, Storing Font data for use on other PC Top

Hi all

In my application special user fonts are used and have to be stored in a document. Later this document is printed on another PC, where those fonts are not installed. So I have to serialize not only the font description, but also the font data. How can this be done

I tried it with the FontFamily object, but this class is not serializable.

Reiner Obrecht




Visual C#8  
 
 
TaylorMichaelL





PostPosted: Visual C# General, Storing Font data for use on other PC Top

Fonts in Windows are stored as TTF or FON files. You need to install these on the target machine. You can then serialize out the font data (family, italic, size, etc) and use it on the target machine. To distribute the font you can attach the font file as a resource in your assembly or add the file to your distribution program.

Michael Taylor - 11/30/06


 
 
Reiner Obrecht





PostPosted: Visual C# General, Storing Font data for use on other PC Top

Thanks for your answer, but it will not help in my case.

My frontend program, which creates a document, has selectable fonts depending on the individual users besides the normal Windows fonts. These fonts are unknown and not available to the backend, which has to print them. So they must be transported together with the document. The font data (not only the name) have to be serialized in the document, so that the backend can deserialize and use them automatically. Is there a solution in .NET

Ok, there is a not so good solution. I can serialize the font data files and send them together with the document. But how do I know which files to send How can I get the filenames owned by a font family

Is there a class where the data of a font family is stored Can this data be extracted

Questions without end ...

I am thankful to everyone who helps.

Reiner Obrecht



 
 
CsharpNeophyte





PostPosted: Visual C# General, Storing Font data for use on other PC Top

A bigger problem is that it might not be LEGAL to copy a font file from one system to another. For instance we use a mapping program that has various symbols stored as custom TrueType fonts. We cannot legally copy those font files to a system that does not have a licensed copy of that software on it.

In our case we are forced to create an image file of some sort if the map needs to be printed from on a non-licensed system.

Most font packages you buy commerically have similar restrictions (installed on one system per purchased font pack).


 
 
Reiner Obrecht





PostPosted: Visual C# General, Storing Font data for use on other PC Top

You are right. I surely have to look a little closer to the license conditions of the fonts before releasing the program.

But what I want to do is not to install the font on the target system! I only need the necessary data for printing of the document on an intelligent RIP. Similar what PDF does with embedded fonts. Best was to embed only the necessary glyphs to reduce the document size.



 
 
Peter Ritchie





PostPosted: Visual C# General, Storing Font data for use on other PC Top

Check out the PrivateFontCollection class. Licensing issues aside, this class lets an application have private fonts that don't need to be installed as system fonts.