File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -119,15 +119,10 @@ impl<'a> Drawable for DrawableText<'a> {
119
119
) ?;
120
120
121
121
let bounds = outlined. px_bounds ( ) ;
122
- let offset = scaled_font. descent ( ) + glyph_height;
123
- let transform = Mat4 :: from_translation (
124
- caret
125
- + Vec3 :: new (
126
- 0.0 + glyph_width / 2.0 + bounds. min . x ,
127
- glyph_height / 2.0 - bounds. min . y - offset,
128
- 0.0 ,
129
- ) ,
130
- ) ;
122
+ let x = bounds. min . x + glyph_width / 2.0 ;
123
+ // the 0.5 accounts for odd-numbered heights (bump up by 1 pixel)
124
+ let y = -bounds. max . y + glyph_height / 2.0 - scaled_font. descent ( ) + 0.5 ;
125
+ let transform = Mat4 :: from_translation ( caret + Vec3 :: new ( x, y, 0.0 ) ) ;
131
126
let sprite = TextureAtlasSprite {
132
127
index : glyph_atlas_info. char_index ,
133
128
color : self . style . color ,
You can’t perform that action at this time.
0 commit comments