Hoist `GlyphSize` out of nested scopes

pull/8738/head
Daniel Wennberg 2025-09-21 11:04:32 -07:00
parent 333a32208e
commit 52ef17d4e0
2 changed files with 9 additions and 9 deletions

View File

@ -93,6 +93,14 @@ pub const Variation = struct {
};
};
/// The size and position of a glyph.
pub const GlyphSize = struct {
width: f64,
height: f64,
x: f64,
y: f64,
};
/// Additional options for rendering glyphs.
pub const RenderOptions = struct {
/// The metrics that are defining the grid layout. These are usually
@ -214,14 +222,6 @@ pub const RenderOptions = struct {
icon,
};
/// The size and position of a glyph.
pub const GlyphSize = struct {
width: f64,
height: f64,
x: f64,
y: f64,
};
/// Returns true if the constraint does anything. If it doesn't,
/// because it neither sizes nor positions the glyph, then this
/// returns false.

View File

@ -386,7 +386,7 @@ pub const Face = struct {
}
/// Get a rect that represents the position and size of the loaded glyph.
fn getGlyphSize(glyph: freetype.c.FT_GlyphSlot) font.face.RenderOptions.Constraint.GlyphSize {
fn getGlyphSize(glyph: freetype.c.FT_GlyphSlot) font.face.GlyphSize {
// If we're dealing with an outline glyph then we get the
// outline's bounding box instead of using the built-in
// metrics, since that's more precise and allows better