Fix underline position for bitmap fonts

Fixes #3235.
This commit is contained in:
Kirill Chibisov 2020-01-22 23:47:59 +03:00 committed by GitHub
parent 767d59155a
commit e61c28e451
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Incorrect selection status of the first cell when selection is off screen
- Backwards bracket selection
- Stack overflow when printing shader creation error
- Underline position for bitmap fonts
### Removed

View File

@ -86,7 +86,7 @@ impl RenderLine {
let line_bottom = (start.line.0 as f32 + 1.) * size.cell_height;
let baseline = line_bottom + metrics.descent;
let mut y = baseline - position - height / 2.;
let mut y = (baseline - position - height / 2.).ceil();
let max_y = line_bottom - height;
if y > max_y {
y = max_y;

View File

@ -108,7 +108,7 @@ impl Rasterize for FreeTypeRasterizer {
// Fallback for bitmap fonts which do not provide underline metrics
if underline_position == 0. {
underline_thickness = (descent / 5.).round();
underline_thickness = (descent.abs() / 5.).round();
underline_position = descent / 2.;
}