.NET FontManager is a small handy open source library for .NET and ASP.NET. It provides low-level operations with various font formats, which include:
- TrueType and TrueType collections,
- OpenType and OpenType collections,
- Type1 fonts, including Type1C,
- CID fonts.
With the help of .NET FontManager you can use the common type of font files, get contours of every glyph and draw them as you need. The library is rather simple and you don't even need to know about fonts internals (besides, it is low-level).
var fsup = new FreetypeFontSupplier(File.ReadAllBytes("arial.ttf")); fsup.DrawString(graphics, 0, 0, "This is a text!", 12.0f, Brushes.Black);
Technically, it works through freetype2 version 2.5 and supports all fonts from this library. Instead of playing with low C code you can work with .NET and operate with pure .NET abstractions.
For example, with OxyPlot library the typical appliance will look like:
All fonts are handled by .Net FontManager and stored in SVG font format:
<defs> <font id="Font_2107481958"> <font-face ascent="92.9000" descent="-25.0000" units-per-em="100" height="117.9000" font-style="normal" font-family="Font_2107481958" font-weight="normal" /> <glyph unicode="0" horiz-adv-x="48.0000" d="..." /> <glyph unicode="5" horiz-adv-x="48.0000" d="... Z" /> <glyph unicode="2" horiz-adv-x="48.0000" d="M 3.7 7.7 ... L 3.7 7.7 Z" /> ... </font> </defs>
This is the typical result:
Why .NET FontManager
Once working with DTP area, you need to make certain charts, vector images and logos with a real vector format and proper pantones. Or, perhaps you simply like good charts on your mobile device without raster. In all these cases you need to make images in specific and sometimes ancient formats.
So, you need proper and high quality fonts as well! It is not enough to make a few polygons to be sure it works and looks excellent.
But .NET does not even have support for OpenType fonts. Thereby, we decided to create our own library .NET FontManager with a number of helpful features. Once we have done the same trick dozens of times, we decided to share our code with others.
Moreover, we have API for Java as well.
When you need .NET FontManager
Whenever you have non-standard or commercial font, you need to think how to work with it, how to distribute it and how to keep windows font substitution hands out of your font.
Also, you don't need to purchase TrueType fonts. OpenType, CID fonts, Type1 hold glyphs in vector and are handled by freetype2.
Here is a simple decision: bring everything with your application, use it from your private folder and it will work in an excellent manner: the proper look, the proper feel and no interference with other fonts and programs. Easy distribution is important sometimes.
When you work with font files you know the proper font all the time; and errors in font metadata will not bring you any trouble. Just use contents and add any "font name" to it according to your needs.
We hope that you will enjoy using our product and would like to receive any feedback, comments or ideas sent to this e-mail: firstname.lastname@example.org
Scand is providing a full range of custom software development services. We develop software for dozens of clients world-wide, and we would be glad to do this for you. You are welcome to submit your project/product request using our contact form. We will contact you shortly to clarify all requirements.