Merge pull request #2238 from zed-industries/subpixel-variant-incorrectly-wrapping

Avoid wrapping to the 0th glyph variant when the 4th should be used
This commit is contained in:
Julia 2023-03-03 13:13:34 -05:00 committed by GitHub
commit 3b6f66791f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,11 +90,12 @@ impl SpriteCache {
let fonts = &self.fonts;
let atlases = &mut self.atlases;
let subpixel_variant = (
(target_position.x().fract() * SUBPIXEL_VARIANTS as f32).round() as u8
(target_position.x().fract() * SUBPIXEL_VARIANTS as f32).floor() as u8
% SUBPIXEL_VARIANTS,
(target_position.y().fract() * SUBPIXEL_VARIANTS as f32).round() as u8
(target_position.y().fract() * SUBPIXEL_VARIANTS as f32).floor() as u8
% SUBPIXEL_VARIANTS,
);
self.glyphs
.entry(GlyphDescriptor {
font_id,