Font formats | API Solution for .NET

Which font format to choose?

There are pretty many font formats already. You may have heard such as TTF, WOFF, WOFF2, OpenType, EOT, Type 1, and others. The first questions that appear in mind when you see that many font formats are:

The answer to the first one is simple. All the formats were created for specific purposes. In time almost all of them have evolved and now they are not that narrowly specialized, but because of their initial scope of application, they have their drawbacks and restrictions when using in some areas or tasks. And understanding these pros and cons of every font format gives you the answer to the second question.

TrueType Font Format

TrueType Font format or TTF was first developed by Apple. Now it is one of the most popular formats as it is used in Microsoft and Apple operating systems. With the help of FreeType library fonts, TrueType format can also be used in many Linux distributions.

The other reason for the popularity of the TTF format is that this type uses special technique to supply the high-quality rendering of the font on devices with low screen resolution. It uses the developed tool of instructions that allow fonts to have similar to bitmap fonts quality. On the other hand the process of font hinting is pretty challenging and time-consuming so many companies partly neglect it. As a result, an average TTF font may look worse than the equal font of the PostScript format.

Font-hinting - is a part of font rasterization used to improve text rendering.

Hints are a pair of guidelines that define glyph position and thickness.

There are two components of TTF format technology:

TTF fonts have excellent support for the Unicode character encoding standard, which allows them to represent a vast range of international characters and scripts. This makes these fonts suitable for multilingual text rendering. TrueType format fonts can include up to 65000 glyphs coded in Unicode standard. But in fact most fonts have much more humble glyphsets. To learn more about glyphsets and glyphs encoding, see this article about glyphs.

Font in TrueType format is a single file with .ttf extension. In Mac OS it is a suitcase-file with SFNT resource. Beginning from Mac OS X, operational systems have an embedded font processor which supports TTF font files too. So a file with .ttf extension can be used on both platforms.

Fonts of TrueType format can be located in one single file as a collection of fonts. Such a file would have .ttc extension.

These fonts can be embedded within documents, allowing the fonts to be displayed consistently across different systems and devices. You can embed them as full fonts (allowing editing and extraction) or as subset fonts (containing only the characters used in the document).

OpenType Font Format

OpenType Font or OTF was created on the basis TrueType font from which it took the basic structure. To this were added additional data constructs to order the typographic behavior. The format is known as the conjunction of TrueType and Postscript fonts. As it is really flexible it is supported by the most operational systems and devices.

OTF, TTF and Type1 are processed in Windows and Macintosh the same way, that is why there are no bugs and issues when texts render. They are also completely scaled without losing the quality.

Advanced data included in OTF font files

OpenType is technically a combination of vector and other data joined to a bunch of tables. The next data is included in such tables:

Even with all the mentioned advantages, OTF fonts may not be the best option for web projects. Most but not all the browsers will support them. If the majority of your audience uses a browser that does not go well with OTF, you’d better convert it to one of the web formats.

OTF Advantages:

OTF vs TTF

There is a pretty frequent question that sounds like:“What is better OTF or TTF?”. As OTF is an advanced font based on TrueType, with the advanced features to support much-improved typography it looks like it is a better option to choose. In reality, not that many users need and use these features, so in most cases it does not matter which one of two formats to choose.

Web Open Font Format

Web Open Font Format or WOFF was developed in 2009 to cover the needs of the web application market.

It was created by adding format-specific compression to TrueType and OpenType fonts. It uses zlib compression that gives fonts about 40% compression. Another peculiarity of WOFF format is that the font of the format can include attached additional metadata. This metadata does not affect the way the font renders, but may be shown to a user when it is needed. Like when you use Aspose Font Viewer. By choosing the font you want, you get much information about it: information about its license, number of glyphs, manufacturer, version, copyright information, etc.

Development of WOFF followed two main goals:

WOFF files let developers use custom fonts instead of standard web fonts. The latest versions of most browsers support WOFF format on desktop as well as on mobile devices.

WOFF file is a web-font file in WOFF format. It downloads a compressed container. The file has .woff extension.

The table below shows the browsers that support WOFF format.

Operating systemBrowsers with WOFF format support
WindowsMozilla Firefox, Opera, Google Chrome, Safari, Microsoft Internet Explorer, Microsoft Edge.
LinuxMozilla Firefox, Opera, Google Chrome.
AndroidAndroid browser, Chrome for Android, Firefox for Android, Opera Mobile.
MacintoshMozilla Firefox, Opera, Google Chrome, Safari.
iOSGoogle Chrome, iOS Safari.

Web Open Font Format 2

Web Open Font Format or WOFF2 is the next version of WOFF format with better compression. To be precise it gives a 30% advantage in compression over WOFF format. It uses the byte-level compression algorithm Brotli, which is a library for data compression with the open-source. It is used to speed up the loading of web pages.

The file of WOFF2 format has .woff2 extension.

WOFF2 format got a recommendation from W3C in 2018.

As WOFF format, WOFF2 is also supported by most browsers.

OpenType Font Format

OpenType Font format or OTF was developed by a collaboration of Adobe and Microsoft. This format is an extension of TrueType format.

OpenType fonts are containers built on rules of TrueType format. This container can hold TrueType as well as PostScript data. In addition, OpenType fonts may contain new data types that are absent in TrueType format. Fonts that contain PostScript data have extension .otf and those that contain TrueType fonts have extension .ttf.

Alike TrueType format, each OpenType font uses one file to store information about outlines, metrics, and service data. One the same file can be set in Windows and Macintosh operating systems.

OpenType fonts use the multi-byte coding system Unicode which spans almost all world languages. OpenType fonts can also have a manufacturer’s digital signature which lets the operating system define the font origin and to find out if it was modified.

Because of the better-compressing methods, OpenType fonts are faster to send over the network and take less space on a drive.

OpenType format has its typographic rules. The main feature of them is that the terms character and glyph are separate. Every character is defined by default with a basic glyph and the order of placement in the text. Applying additional rules to one or several characters may change their mutual arrangement or replace basic glyphs with alternative ones.

Adobe InDesign and Adobe Photoshop were the first applications that supported OpenType typography rules. By 2023 Adobe will not have supported Type1 format anymore, supporting OpenType format instead.

Embedded OpenType Font Format

Embedded OpenType or EOT format. It is a compact format of OpenType fonts embedded into web pages. The format is developed by Microsoft. The format has the next peculiarities:

The drawback of the font is that it is proprietary and supported only by Internet Explorer.

Type 1 Font Format

Type 1 format came to market along with the PostScript programming language in 1984. Because of this, the format is also called Postscript Type 1.

Font of Type 1 format is a special form of the program Postscript and the file format, which is oriented on describing the font.

Type 1 format is recognized by printers and computers either by built-in interpreters or by additional utilities like Adobe Type Manager. This technology is present in Microsoft Windows and Macintosh OS X. The peculiarity of Type 1 fonts is that they do not support Unicode coding standards.

Type 1 format also supports Multiple Master fonts, which allow users to generate a continuum of typeface styles between two or more predefined “master” designs. This feature enables flexible interpolation and customization of font styles.

Type 1 font for Microsoft may consist of the next files:

Font Type 1 for Macintosh consists of a suitcase file and a printer file. If you have one typeface you may have one suitcase file and four printer files (for normal, bold, italic and bold italic styles). Or you may get eight files, one suitcase for each font style plus four printer files.

Type 1 format has next drawbacks:

Compact Font Format

Compact Font Format or CFF is also known as Type 2 font format, or CFF/Type 2 font format. It is said that CFF is not exactly the font format. It is the way to compress other font formats, like Type 1.

It offers a notable space saving as it uses a subroutine mechanism to define reusable portions of font programs, reducing the overall font file size. Subroutines are snippets of code that can be called multiple times, improving the efficiency of the font representation.

The principle of CFF work is that it works as a container to hold several fonts together as one unit. This unit is called FontSet. These fonts also use Type 2 Charstrings encoding to define the outline shapes of individual glyphs which consists of instructions describing how to construct each glyph shape with curves and lines.

Similar to TrueType fonts, CFF fonts also use outlines to define the shapes of glyphs. However, CFF outlines are described using PostScript’s cubic Bézier curves. Additionally, they can include hinting information to enhance glyph rendering at low resolutions.

Like Type 1 and TrueType formats, CFF also uses hinting. It uses the same methods to represent hints as Type 1, but they are easier and cleaner to write in code.

In comparison to Type 1, has CFF gained:

Vector and raster fonts

Raster or bitmap fonts refer to a specific type of font format that is based on a grid of individual pixels. These fonts represent each character as a collection of pixels arranged in a grid.

Outline or vector fonts are a type of font format that represents characters using mathematical curves and lines.

Bitmap fonts and outline fonts are two different approaches to representing and rendering typefaces. Here’s a comparison of the two font formats:

CharacteristicRasterVector
RepresentationMade of a grid of pixels, where each character is defined by a specific arrangement of pixels.Use mathematical curves and vectors to define the shapes of characters. Each character is defined by a series of curves, lines, and points.
Resolution DependenceResolution-dependent, meaning they are designed for a specific size, so when scaled up, they may appear pixelated or jagged.Resolution-independent, allowing them to scale smoothly to any size without losing quality.
EditingModifying individual pixels can be tedious and may lead to distortion.Designers can manipulate the curves and points that define the characters using vector editing software.
File SizeHave smaller file sizes because they store information pixel by pixel.Have larger file sizes due to the complex vector data they store.
Language SupportMay have limited language support.Can support a wide range of languages and characters.
HintingDo not require hinting.Can benefit from hinting to improve legibility.
Styling OptionsHave limited styling options, such as bold or italic, as they are defined pixel by pixel.Offer more styling options which can be applied programmatically or through font stylesheets.

So bitmap fonts are pixel-based, resolution-dependent, and have limited scalability and styling options in comparison to outline fonts that use mathematical curves, are resolution-independent, offer greater flexibility in editing and styling, and can support various languages. Outline fonts are widely used today due to their scalability and versatility in different contexts.

Conclusion

The article was aimed to teach you about font formats and make it easier for you to make a choice. Here are the most famous font formats described. Some of them are known as web formats because they are built to suit purposes better. These fonts are:

But not a single one of them can be counted as a cross-platform one, so you may need to use a few of them simultaneously.

Regardless of which format you have chosen, you can manipulate it with Aspose.Fontsolution. It comes in handy when you need to convert one font format to another like TTF to WOFF and vice versa or load a font. Learn it yourself to see what advantages the solution gives to you. And if you have a need to convert one font to a font of a different format, you may also use an online web application. Aspose.Font has such a Font Converter in its ecosystem.

Have any questions about Aspose.Font?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.