| attribute.rs |
Primary attributes typically used for font classification and selection. |
8558 |
- |
| bitmap.rs |
Bitmap strikes and glyphs. |
28395 |
- |
| charmap.rs |
Mapping of characters (codepoints, not graphemes) to nominal glyph identifiers.
If you have never run into character to glyph mapping before
[Glyph IDs and the 'cmap' table](https://rsheeter.github.io/font101/#glyph-ids-and-the-cmap-table)
might be informative.
The functionality in this module provides a 1-to-1 mapping from Unicode
characters (or [Unicode variation sequences](http://unicode.org/faq/vs.html)) to
nominal or "default" internal glyph identifiers for a given font.
This is a necessary first step, but generally insufficient for proper layout of
[complex text](https://en.wikipedia.org/wiki/Complex_text_layout) or even
simple text containing diacritics and ligatures.
Comprehensive mapping of characters to positioned glyphs requires a process called
shaping. For more detail, see: [Why do I need a shaping engine?](https://harfbuzz.github.io/why-do-i-need-a-shaping-engine.html) |
20432 |
- |
| collections.rs |
Internal "small" style collection types. |
9975 |
- |
| color |
|
|
- |
| decycler.rs |
Support for cycle detection in DFS graph traversals. |
5297 |
- |
| font.rs |
Basic representation of an in-memory font resource. |
86 |
- |
| glyph_name.rs |
Support for accessing glyph names. |
12927 |
- |
| instance.rs |
Helpers for selecting a font size and location in variation space. |
8157 |
- |
| lib.rs |
A robust, ergonomic, high performance crate for OpenType fonts.
Skrifa is a mid level library that provides access to various types
of [`metadata`](MetadataProvider) contained in a font as well as support
for loading glyph [`outlines`](outline).
It is described as "mid level" because the library is designed to sit
above low level font parsing (provided by [`read-fonts`](https://crates.io/crates/read-fonts))
and below a higher level text layout engine.
See the [readme](https://github.com/googlefonts/fontations/blob/main/skrifa/README.md)
for additional details. |
2035 |
- |
| metrics.rs |
Global font and glyph specific metrics.
Metrics are various measurements that define positioning and layout
characteristics for a font. They come in two flavors:
* Global metrics: these are applicable to all glyphs in a font and generally
define values that are used for the layout of a collection of glyphs. For example,
the ascent, descent and leading values determine the position of the baseline where
a glyph should be rendered as well as the suggested spacing above and below it.
* Glyph metrics: these apply to single glyphs. For example, the advance
width value describes the distance between two consecutive glyphs on a line.
### Selecting an "instance"
Both global and glyph specific metrics accept two additional pieces of information
to select the desired instance of a font:
* Size: represented by the [Size] type, this determines the scaling factor that is
applied to all metrics.
* Normalized variation coordinates: represented by the [LocationRef] type,
these define the position in design space for a variable font. For a non-variable
font, these coordinates are ignored and you can pass [LocationRef::default()]
as an argument for this parameter.
|
25190 |
- |
| outline |
|
|
- |
| provider.rs |
|
4819 |
- |
| setting.rs |
Definitions for specifying variations and typographic features. |
3058 |
- |
| string.rs |
Localized strings describing font names and other metadata.
This provides higher level interfaces for accessing the data in the
OpenType [name](https://learn.microsoft.com/en-us/typography/opentype/spec/name)
table.
# Example
The following function will print all localized strings from the set
of predefined identifiers in a font:
```
use skrifa::{string::StringId, MetadataProvider};
fn print_well_known_strings<'a>(font: &impl MetadataProvider<'a>) {
for id in StringId::predefined() {
let strings = font.localized_strings(id);
if strings.clone().next().is_some() {
println!("[{:?}]", id);
for string in font.localized_strings(id) {
println!("{:?} {}", string.language(), string.to_string());
}
}
}
}
``` |
23493 |
- |
| variation.rs |
Axes of variation in a variable font. |
17092 |
- |