1 unstable release
|0.1.0||May 25, 2018|
#68 in Rendering
3 downloads per month
Used in 2 crates (0 directly)
Load fonts as vector graphics in pure Rust - based on RustType
fonterator's current features:
- Load TTF fonts and font collections.
- Load some OTF fonts and font collections.
- Automatic kerning and font layout.
fonterator's planned features:
- Support OpenType formatted fonts that are not just TrueType fonts (OpenType is a superset of TrueType). Notably there is no support yet for cubic Bezier curves used in glyphs.
- Support ligatures of any kind (‽, etc.).
- Support some less common TrueType sub-formats.
- Support right-to-left and vertical text layout.
Fonterator is a pure Rust alternative to libraries like FreeType based on RustType.
Add the following to your Cargo.toml:
[dependencies] fonterator = "0.1.0"
To hit the ground running with Fonterator, look at the
supplied with the crate. It demonstrates loading a font file, rasterising an
arbitrary string, and saving as an SVG. If you prefer to
just look at the documentation, the entry point for loading fonts is
FontCollection, from which you can access individual fonts, then their
This crate uses terminology for computerised typography as specified by the Unicode standard. If you are not sure of the differences between a code point, a character, and a glyph, you may want to check the official Unicode glossary, or alternatively, here's my take on it from a practical perspective:
- A character is what you would conventionally call a single symbol,
independent of its appearance or representation in a particular font.
- A Unicode code point is the particular number that the Unicode standard
associates with a particular character. Note however that code points also
exist for things not conventionally thought of as characters by
themselves, but can be combined to form characters, such as diacritics
like accents. These "characters" are known in Unicode as "combining
characters". E.g., a diaeresis (
¨) has the code point U+0308. If this code point follows the code point U+0055 (the letter
u), this sequence represents the character
ü. Note that there is also a single codepoint for
ü, U+00FC. This means that what visually looks like the same string can have multiple different Unicode representations. Some fonts will have glyphs (see below) for one sequence of codepoints, but not another that has the same meaning. To deal with this problem it is recommended to use Unicode normalisation, as provided by, for example, the unicode-normalization crate, to convert to code point sequences that work with the font in question. Typically a font is more likely to support a single code point vs. a sequence with the same meaning, so the best normalisation to use is "canonical recomposition", known as NFC in the normalisation crate.
- A glyph is a particular font's shape to draw the character for a particular Unicode code point. This will have its own identifying number unique to the font, its ID.