Add layout run iterator

This commit is contained in:
Jeremy Soller 2022-10-25 12:52:46 -06:00
parent 5d7dd59078
commit a9b7b4e914
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
8 changed files with 135 additions and 97 deletions

29
src/layout.rs Normal file
View file

@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
use super::CacheKey;
/// A laid out glyph
pub struct LayoutGlyph {
/// Start index of cluster in original line
pub start: usize,
/// End index of cluster in original line
pub end: usize,
/// X offset of hitbox
pub x: f32,
/// width of hitbox
pub w: f32,
/// True if the character is from an RTL script
pub rtl: bool,
/// Cache key, see [CacheKey]
pub cache_key: CacheKey,
/// Integer component of X offset in line
pub x_int: i32,
/// Integer component of Y offset in line
pub y_int: i32,
}
/// A line of laid out glyphs
pub struct LayoutLine {
/// Glyphs in line
pub glyphs: Vec<LayoutGlyph>,
}