Layout
Sizes here are on the same 1000 unit em the advances use, so divide by px / 1000.0going in and multiply coming out.
use daegun::{Align, BreakStrategy, LayoutOptions};
let px = 16.0;
let scale = px / 1000.0;
let layout = font.layout(text, &[], &LayoutOptions {
max_inline_size: 240.0 / scale,
line_height: Some(20.0 / scale),
strategy: BreakStrategy::Optimal,
align: Align::Start,
..LayoutOptions::default()
}).expect("lays out");
for line in &layout.lines {
for run in &line.runs {
// run.run.glyphs, run.run.advances, run.offset
}
}Greedy breaks at the last opportunity that fits. Optimal searches the whole paragraph for the least bad set of breaks.