Text layout for ab_glyph.
```rust use glyphbrushlayout::{ab_glyph::*, *};
let dejavu = FontRef::tryfromslice(includebytes!("../../fonts/DejaVuSans.ttf"))?; let garamond = FontRef::tryfromslice(includebytes!("../../fonts/GaramondNo8-Reg.ttf"))?;
// Simple font mapping: FontId(0) -> deja vu sans, FontId(1) -> garamond let fonts = &[dejavu, garamond];
// Layout "hello glyphbrushlayout" on an unbounded line with the second // word suitably bigger, greener and serif-ier. let glyphs = Layout::default().calculateglyphs( fonts, &SectionGeometry { screenposition: (150.0, 50.0), ..SectionGeometry::default() }, &[ SectionText { text: "hello ", scale: PxScale::from(20.0), fontid: FontId(0), }, SectionText { text: "glyphbrushlayout", scale: PxScale::from(25.0), fontid: FontId(1), }, ], );
assert_eq!(glyphs.len(), 24);
let SectionGlyph { glyph, fontid, sectionindex, byteindex } = &glyphs[4]; asserteq!(glyph.id, fonts[0].glyphid('o')); asserteq!(font_id, FontId(0)); assert_eq!(sectionindex, 0); asserteq!(*byte_index, 4);
let SectionGlyph { glyph, fontid, sectionindex, byteindex } = &glyphs[14]; asserteq!(glyph.id, fonts[1].glyphid('u')); asserteq!(font_id, FontId(1)); assert_eq!(sectionindex, 1); asserteq!(*byte_index, 8); ```