Skip to main content

Crate use_type_rhythm

Crate use_type_rhythm 

Source
Expand description

Primitive vertical rhythm helpers.

These helpers expose a small baseline grid model for deterministic layout calculations.

§Examples

use use_type_rhythm::{TypeRhythm, baseline_grid, snap_to_baseline};

let rhythm = TypeRhythm::new(16.0, 24.0).unwrap();

assert_eq!(rhythm.baseline_unit(), 24.0);
assert_eq!(rhythm.snap_to_baseline(37.0).unwrap(), 48.0);
assert_eq!(rhythm.lines_for_height(72.0).unwrap(), 3.0);
assert_eq!(baseline_grid(24.0, 3).unwrap(), vec![24.0, 48.0, 72.0]);
assert_eq!(snap_to_baseline(37.0, 24.0).unwrap(), 48.0);

Structs§

TypeRhythm

Enums§

TypeRhythmError

Functions§

baseline_grid
snap_to_baseline