Primitive text-block estimation helpers.
These helpers estimate text block layout using explicit widths, average character widths, and line heights.
Examples
use ;
let block = new.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Primitive text-block estimation helpers.
These helpers estimate text block layout using explicit widths, average character widths, and line heights.
use use_text_block::{TextBlock, estimated_line_count, estimated_text_height};
let block = TextBlock::new(480.0, 16.0, 24.0, 120).unwrap();
assert_eq!(block.estimated_characters_per_line(8.0).unwrap(), 60.0);
assert_eq!(block.estimated_line_count(8.0).unwrap(), 2);
assert_eq!(block.estimated_height_px(8.0).unwrap(), 48.0);
assert_eq!(estimated_line_count(120, 60.0).unwrap(), 2);
assert_eq!(estimated_text_height(2, 24.0).unwrap(), 48.0);