From 419f2dc612400875c1fc20733a6ff4e740346a1d Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 12 Oct 2022 13:51:50 -0600 Subject: [PATCH] Improve rusttype usage --- examples/text/src/font/matches.rs | 2 +- examples/text/src/font/shape.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/text/src/font/matches.rs b/examples/text/src/font/matches.rs index 3a4b385e..e3efaaab 100644 --- a/examples/text/src/font/matches.rs +++ b/examples/text/src/font/matches.rs @@ -56,7 +56,7 @@ impl<'a> FontMatches<'a> { let inner = ab_glyph::GlyphId(info.glyph_id as u16); #[cfg(feature = "rusttype")] - let inner = font.rusttype.glyph(rusttype::GlyphId(info.glyph_id as u16)); + let inner = rusttype::GlyphId(info.glyph_id as u16); #[cfg(feature = "swash")] let inner = info.glyph_id as swash::GlyphId; diff --git a/examples/text/src/font/shape.rs b/examples/text/src/font/shape.rs index 0f66865d..9f50c154 100644 --- a/examples/text/src/font/shape.rs +++ b/examples/text/src/font/shape.rs @@ -14,7 +14,7 @@ pub struct FontShapeGlyph<'a> { #[cfg(feature = "ab_glyph")] pub inner: ab_glyph::GlyphId, #[cfg(feature = "rusttype")] - pub inner: rusttype::Glyph<'a>, + pub inner: rusttype::GlyphId, #[cfg(feature = "swash")] pub inner: swash::GlyphId, } @@ -37,7 +37,7 @@ impl<'a> FontShapeGlyph<'a> { ); #[cfg(feature = "rusttype")] - let inner = self.inner.clone() + let inner = self.font.rusttype.glyph(self.inner) .scaled(rusttype::Scale::uniform(font_size as f32)) .positioned(rusttype::point( x + x_offset,