Improve Au(0) constructions (#33709)

This replaces `Au(0)` with `Au::zero()` and other utility functions when possible.

Signed-off-by: hackerbirds <120066692+hackerbirds@users.noreply.github.com>
This commit is contained in:
birdbrained 2024-10-10 16:45:18 +00:00 committed by GitHub
parent c6d305fbb3
commit a591778a25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 20 additions and 16 deletions

View file

@ -441,7 +441,7 @@ impl Font {
let offset = prev_glyph_id.map(|prev| {
let h_kerning = Au::from_f64_px(self.glyph_h_kerning(prev, glyph_id));
advance += h_kerning;
Point2D::new(h_kerning, Au(0))
Point2D::new(h_kerning, Au::zero())
});
let glyph = GlyphData::new(glyph_id, advance, offset, true, true);
@ -818,7 +818,7 @@ pub struct RunMetrics {
impl RunMetrics {
pub fn new(advance: Au, ascent: Au, descent: Au) -> RunMetrics {
let bounds = Rect::new(
Point2D::new(Au(0), -ascent),
Point2D::new(Au::zero(), -ascent),
Size2D::new(advance, ascent + descent),
);