THN logo

THN Solutions

Font Loader

Why reinvent the wheel

As you known, reading font and rendering font are the task of System. So, other graphic engines use system functions to interact with font. SunFire has it own font loader for following reason:


We need our application is portable. When you depend on system font, you will have some troubles with it:
  • When your application is deployed in other systems, but that system doesn’t have your UI’s font. Your UI will look ugly and not work as your expectation.
  • Your document has some special fonts. Your partner needs that document for his report or printing. When you send your file, your document is not as in your system. It is uncomfortable.

When you have your own font loader:
  • You can read font at any place in your file system.
  • You can embed your font to your application’s document format.

Vector data

While all True Type or Open Type fonts are outline font format, but getting vector data of a character is difficult. You must have knowledge about the system API to get it vector data. Besides, API in Linux and Windows are different. So your application need to be changed when deployed on other operating system. Other graphic engines have implemented this feature for you, but GDI+ in .NET framework is not supported by default.

SunFire is based on vector data. Reading vector data of a character help SunFire flexible in its rendering pipeline:
  • Rendering text is accurate as expectation
  • Transformation is better with vector data
  • Easy for you to use a text as a collection of paths. You can apply many effects on text.
  • Layout text as expectation. Allow implement one interested feature is “text on path1” in modern graphic engines.

SunFire's implementation

SunFire uses vector font for drawing text. Vector font has many formats: TrueType,Type-1(Postscript),Apple Advanced Typography,OpenType (a combination between TrueType and Type-1)...

SunFire ‘s font reader has been implemented as the specification from Microsoft about true type font and specification for open type font file. SunFire is full-supported for reading vector font file in OpenType format for both TrueType and Type-1 format. This format usually has extension .TTF or .OTF, this is the most common font format and supported in all common OS: Microsoft Windows,MacOS,Linux.