diff --git a/examples/text-metrics.rs b/examples/text-metrics.rs index 629cb24d6..942cd433d 100644 --- a/examples/text-metrics.rs +++ b/examples/text-metrics.rs @@ -21,7 +21,7 @@ fn main() -> Result<(), EventLoopError> { Point::new(measured.left, line_height - measured.ascent), Size::new(measured.size.width - measured.left, measured.ascent), ), - Color::new(0, 40, 0, 255), + Color::new(0, 255, 0, 128), ) .translate_by(inset), ); @@ -31,7 +31,7 @@ fn main() -> Result<(), EventLoopError> { Point::new(measured.left, line_height), Size::new(measured.size.width - measured.left, -measured.descent), ), - Color::new(0, 0, 40, 255), + Color::new(0, 0, 255, 128), ) .translate_by(inset), ); diff --git a/src/text.rs b/src/text.rs index 25b42fe04..5f5a838d0 100644 --- a/src/text.rs +++ b/src/text.rs @@ -494,15 +494,17 @@ pub(crate) fn map_each_glyph( continue; }; + let subpixel = Point::new( + physical.cache_key.x_bin.as_float(), + 1.0 - physical.cache_key.y_bin.as_float(), + ) + .map(Px::from); + let blit = TextureBlit::new( cached.texture.region, Rect::new( (Point::new(physical.x, physical.y)).cast::() - + Point::new( - physical.cache_key.x_bin.as_float(), - physical.cache_key.y_bin.as_float(), - ) - .map(Px::from) + + subpixel + Point::new( image.placement.left, metrics.line_height.cast::() - image.placement.top, @@ -586,7 +588,7 @@ where } else { MeasuredText { ascent: line_height - Unit::from_px(min.y, kludgine.scale), - descent: Unit::from_px(first_line_max_y, kludgine.scale) - line_height, + descent: line_height - Unit::from_px(first_line_max_y, kludgine.scale), left: Unit::from_px(min.x, kludgine.scale), size: Size { width: Unit::from_px(max.x, kludgine.scale),