Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic committed Aug 14, 2022
1 parent 9378517 commit c9f9705
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/title/ab_glyph_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,8 @@ impl AbGlyphTitleText {
let font = self.font.as_scaled(self.size);

let glyphs = self.layout();
if glyphs.is_empty() {
return None;
}

let last_glyph = glyphs.last().unwrap();
let width = (last_glyph.position.x.ceil() + font.h_advance(last_glyph.id)).ceil() as u32;
let last_glyph = glyphs.last()?;
let width = (last_glyph.position.x + font.h_advance(last_glyph.id)).ceil() as u32;
let height = font.height().ceil() as u32;

let mut pixmap = Pixmap::new(width, height)?;
Expand Down

0 comments on commit c9f9705

Please sign in to comment.