Address review
This commit is contained in:
parent
896f36cdab
commit
020701734e
2 changed files with 5 additions and 2 deletions
|
|
@ -105,8 +105,8 @@ impl FamilyOwned {
|
|||
//TODO: what are the edge cases of this?
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct CacheMetrics {
|
||||
pub font_size_bits: u32,
|
||||
pub line_height_bits: u32,
|
||||
font_size_bits: u32,
|
||||
line_height_bits: u32,
|
||||
}
|
||||
|
||||
impl From<Metrics> for CacheMetrics {
|
||||
|
|
|
|||
|
|
@ -519,6 +519,8 @@ impl ShapeGlyph {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get the width of the [`ShapeGlyph`] in pixels, either using the provided font size
|
||||
/// or the [`ShapeGlyph::metrics_opt`] override.
|
||||
pub fn width(&self, font_size: f32) -> f32 {
|
||||
self.metrics_opt.map_or(font_size, |x| x.font_size) * self.x_advance
|
||||
}
|
||||
|
|
@ -613,6 +615,7 @@ impl ShapeWord {
|
|||
Self { blank, glyphs }
|
||||
}
|
||||
|
||||
/// Get the width of the [`ShapeWord`] in pixels, using the [`ShapeGlyph::width`] function.
|
||||
pub fn width(&self, font_size: f32) -> f32 {
|
||||
let mut width = 0.0;
|
||||
for glyph in self.glyphs.iter() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue