use-line-height 0.0.1

Primitive line-height helpers
Documentation
  • Coverage
  • 8.33%
    1 out of 12 items documented1 out of 9 items with examples
  • Size
  • Source code size: 5.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 383.12 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-typography
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

Primitive line-height helpers.

These helpers expose explicit line-height calculations and a small readable threshold check.

Examples

use use_line_height::{LineHeight, is_readable_line_height, line_height_px, line_height_ratio};

let line_height = LineHeight::new(16.0, 24.0).unwrap();

assert_eq!(line_height.px(), 24.0);
assert!((line_height.ratio() - 1.5).abs() < 1.0e-12);
assert!((line_height_px(16.0, 1.5).unwrap() - 24.0).abs() < 1.0e-12);
assert!((line_height_ratio(16.0, 24.0).unwrap() - 1.5).abs() < 1.0e-12);
assert!(is_readable_line_height(1.5).unwrap());