Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.
The premium type system: the default faces, the type tokens and the tracking.
A premium by default UI is a typographic decision before it is a colour one. This module is the typographic half of the default look:
- the default face set ([
DEFAULT_FACES]): a proportional sans, a monospace, an oblique and a display face, registered automatically when thenative-fontsfeature is on. Every face is bundled in the repository (no download, no system font, no licence question): the licences are listed indocs/TYPE.md. - the type tokens ([
crate::design::TypeTokens]): the size, the weight, the line height, the letter spacing and the face of every step of the type scale, in the theme. - the tracking (the letter spacing): resolved from the type scale of the theme in use and applied by the text pipeline, in the measurement and in the drawing alike, so a tracked line is exactly as wide as it looks.
| name | face | file |
|---|---|---|
[face::SANS] | Inter (400) | assets/fonts/Inter-Regular.ttf |
inter-100 .. inter-900 | Inter Thin, ExtraLight, Light, Medium, ExtraBold, Black (the others are the faces around them) | assets/fonts/Inter-<Weight>.ttf |
[face::SANS_SEMIBOLD] | Inter SemiBold (600) | assets/fonts/Inter-SemiBold.ttf |
[face::SANS_BOLD] | Inter Bold (700) | assets/fonts/Inter-Bold.ttf |
[face::MONO] | Martian Mono (400) | assets/opentype-v01/martian-mono-400.ttf |
[face::MONO_BOLD] | Martian Mono (600) | assets/opentype-v01/martian-mono-600.ttf |
[face::OBLIQUE] | Inter Oblique (400, 10°) | assets/fonts/Inter-Oblique.ttf |
[face::MONO_OBLIQUE] | DejaVu Sans Mono Oblique | assets/native-slant-v01/DejaVuSansMono-Oblique.ttf |
(documentation continues in the source)
Structs
structaster_blueprint::typography::FaceSpec
pub struct FaceSpec { /* see fields */ }One face of the default set: the file it draws with and the face a text falls back to when it has no glyph for a cluster.
Public fields
| field | type | |
|---|---|---|
name | &'static str | The name the face is registered under. |
bytes | &'static [u8] | The font file. |
fallback | Option<&'static str> | The face a text falls back to when this one lacks a cluster (None: the face is the last of its chain). |
Trait implementations: Clone, Copy, Debug
structaster_blueprint::typography::Scale
pub struct Scale { /* see fields */ }The type scale of the theme in use: the six steps, in the order of
[Type::ALL].
Methods
fn new(steps: [Step; 6]) -> Self— A scale of six steps.fn step(&self, ty: Type) -> Step— The step of a type style.fn steps(&self) -> &[Step; 6]— The steps, in the order of [Type::ALL].fn resolve(&self, size: f64, bold: bool) -> Option<Step>— The step a text ofsizein theboldrole draws with: the size and the weight class pick it (Nonewhen the size belongs to no step).
Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq
structaster_blueprint::typography::Step
pub struct Step { /* see fields */ }One step of the type scale: the size, the weight, the line height, the letter spacing and the face of the step.
Public fields
| field | type | |
|---|---|---|
size | f64 | The size in logical px. |
weight | u16 | The weight class (400 regular, 600 semibold, 700 bold). |
line_height | f64 | The line height in logical px. |
tracking | f64 | The letter spacing, in em (negative is tighter). |
face | &'static str | The face the step draws with. |
Methods
fn bold(&self) -> bool— True for the steps whose weight class is the bold one (>= 600).
Trait implementations: Clone, Copy, Debug, PartialEq, StructuralPartialEq
Functions
fnaster_blueprint::typography::bundled_fallback
pub fn bundled_fallback(name: &str) -> Option<&'static [u8]>The bundled fallback face of a role (None when the role has none).
fnaster_blueprint::typography::bundled_fallback_of
pub fn bundled_fallback_of(name: &str, bytes: &[u8]) -> Option<&'static str>The fallback face a bundled face joins when it is registered under a role
name (None for any other face).
The library registers the bundled DejaVu Sans as the ui face (the screen
constructor does); that registration is the fallback tier of the premium
sans, so it does not displace it.
fnaster_blueprint::typography::install_default_faces
pub fn install_default_faces(ts: &mut text_measure::Typesetter) -> Result<(), layout::LayoutError>Install the default face set on ts.
The faces are the premium ones: a proportional sans, a monospace, an oblique and a display face, each with the face it falls back to. A face that is already registered under the same name is kept (the caller's face wins); the fallback faces are always installed, they are the coverage of the whole set.
fnaster_blueprint::typography::is_all_caps
pub fn is_all_caps(text: &str) -> boolTrue when text is in capitals (two letters or more, no lower case): its punctuation and brackets are set in the
case-sensitive forms (case), so a hyphen or a slash sits at the middle of the capitals and not of the lower case.
fnaster_blueprint::typography::is_default_face
pub fn is_default_face(name: &str) -> boolTrue when name is a face of the default set.
fnaster_blueprint::typography::is_numeric_run
pub fn is_numeric_run(text: &str) -> boolTrue when text is a number with at most a short unit (37 ms, 99.97%,
1.42 GB/s, 12:05:09, +3.2, ▲ 9.0 ms): the figures of such a text are
tabular (tnum), so a column of values or a running clock keeps its digits
aligned and does not jitter. A sentence with a number in it is not one.
fnaster_blueprint::typography::lazy_face
pub fn lazy_face(name: &str) -> Option<&'static [u8]>The faces of the weight ramp that are not in the default set: registered by the typesetter the first time one is looked up (a screen that never names a weight never parses them).
fnaster_blueprint::typography::publish_scale
pub fn publish_scale(tokens: &[design::TypeTokens; 6])Publish the type scale of the theme in use.
The scale is published when the theme is read (a type step of the scale), so the text pipeline resolves the face and the tracking of a text from the scale of the theme that is drawing. Publishing the same scale again is a no-op (the text caches are not dropped).
fnaster_blueprint::typography::resolve
pub fn resolve(role: &str, size: f64, bold: bool) -> (Option<&'static str>, f64)The face and the letter spacing (in em) of a text of role at size.
The face is the one of the type step the text has (its size and its weight class) when the role is a proportional one; the mono, the oblique and the display roles are explicit and keep their face. A text whose size belongs to no step keeps the face of its role and no tracking.
fnaster_blueprint::typography::restore_default_face
pub fn restore_default_face(ts: &mut text_measure::Typesetter, name: &str) -> Result<(), layout::LayoutError>Put the face of the default set back under name (an app's own face that
replaced it is gone), with its fallback tier. A name that is no face of the
default set is left alone.
fnaster_blueprint::typography::scale
pub fn scale() -> Option<Scale>The type scale in use (None when no theme has been read yet: the text
keeps the face of its role and no tracking).
fnaster_blueprint::typography::scale_changes
pub fn scale_changes() -> u64The number of changes of the published scale: a typesetter that has seen another number drops its text caches (the face or the tracking of a text changed).
fnaster_blueprint::typography::scale_epoch
pub fn scale_epoch() -> u64The epoch of the published scale: a hash of the scale itself (0 when no
theme has published a scale yet).
A typesetter watches it: a new epoch means that the face or the tracking of a text changed, so the text caches (the measurements and the prepared drawings) are dropped once.
fnaster_blueprint::typography::small_caps_face
pub fn small_caps_face(base: &str) -> Option<&'static str>The small-capital face of a face (None when there is none).
fnaster_blueprint::typography::face::sans_weight
pub fn sans_weight(weight: u16) -> &'static strThe face of Inter at a weight (100..=900, rounded to the nearest hundred): the whole ramp, 100 Thin to 900 Black, each a real static instance (a bold is heavier than a regular because it is another face).
fnaster_blueprint::typography::features::rebase
pub fn rebase(name: &str, face: &str) -> StringThe face name with the face replaced by face and the features kept.
fnaster_blueprint::typography::features::split
pub fn split(name: &str) -> (&str, &str)Split a face name into the face and its features.
fnaster_blueprint::typography::features::with
pub fn with(name: &str, f: &str) -> StringThe face name with the feature f added.
Constants
constaster_blueprint::typography::DEFAULT_FACES
pub const DEFAULT_FACES: &[FaceSpec]The default face set, in the order the faces are registered.
constaster_blueprint::typography::face::DISPLAY
pub const DISPLAY: &strThe display face (Unbounded 800): the face of a headline.
constaster_blueprint::typography::face::FALLBACK
pub const FALLBACK: &strThe fallback sans (DejaVu Sans): the glyphs the premium faces lack.
constaster_blueprint::typography::face::FALLBACK_MONO
pub const FALLBACK_MONO: &strThe fallback monospace (DejaVu Sans Mono).
constaster_blueprint::typography::face::MONO
pub const MONO: &strThe monospace (Martian Mono 400).
constaster_blueprint::typography::face::MONO_BOLD
pub const MONO_BOLD: &strThe monospace, bold (Martian Mono 600).
constaster_blueprint::typography::face::MONO_OBLIQUE
pub const MONO_OBLIQUE: &strThe oblique monospace (DejaVu Sans Mono Oblique).
constaster_blueprint::typography::face::OBLIQUE
pub const OBLIQUE: &strThe oblique (Inter slanted 10°): the face of an italic run.
constaster_blueprint::typography::face::SANS
pub const SANS: &strThe proportional sans (Inter 400): the face of the body text.
constaster_blueprint::typography::face::SANS_BLACK
pub const SANS_BLACK: &strInter Black (900).
constaster_blueprint::typography::face::SANS_BOLD
pub const SANS_BOLD: &strThe proportional sans, bold (Inter 700).
constaster_blueprint::typography::face::SANS_BOLD_SC
pub const SANS_BOLD_SC: &strInter Bold small capitals.
constaster_blueprint::typography::face::SANS_EXTRABOLD
pub const SANS_EXTRABOLD: &strInter ExtraBold (800).
constaster_blueprint::typography::face::SANS_EXTRALIGHT
pub const SANS_EXTRALIGHT: &strInter ExtraLight (200).
constaster_blueprint::typography::face::SANS_LIGHT
pub const SANS_LIGHT: &strInter Light (300).
constaster_blueprint::typography::face::SANS_MEDIUM
pub const SANS_MEDIUM: &strInter Medium (500).
constaster_blueprint::typography::face::SANS_SC
pub const SANS_SC: &strInter Regular small capitals (the lower case drawn as small capitals).
constaster_blueprint::typography::face::SANS_SEMIBOLD
pub const SANS_SEMIBOLD: &strThe proportional sans, semibold (Inter 600): labels and titles.
constaster_blueprint::typography::face::SANS_SEMIBOLD_SC
pub const SANS_SEMIBOLD_SC: &strInter SemiBold small capitals.
constaster_blueprint::typography::face::SANS_THIN
pub const SANS_THIN: &strInter Thin (100) of the weight ramp.
constaster_blueprint::typography::features::CASE
pub const CASE: &strCase-sensitive forms.
constaster_blueprint::typography::features::FRACTIONS
pub const FRACTIONS: &strDiagonal fractions.
constaster_blueprint::typography::features::PROPORTIONAL
pub const PROPORTIONAL: &strProportional figures (switches the automatic tabular figures off).
constaster_blueprint::typography::features::SLASHED_ZERO
pub const SLASHED_ZERO: &strSlashed zero.
constaster_blueprint::typography::features::SMALL_CAPS
pub const SMALL_CAPS: &strSmall capitals.
constaster_blueprint::typography::features::TABULAR
pub const TABULAR: &strTabular figures.