mirror of
https://github.com/wez/wezterm.git
synced 2024-11-10 06:34:17 +03:00
parent
4eef20320d
commit
e25deaaed1
@ -56,6 +56,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* Improved: [use_cap_height_to_scale_fallback_fonts](config/lua/config/use_cap_height_to_scale_fallback_fonts.md) now computes *cap-height* based on the rasterized glyph bitmap which means that the data is accurate in more cases, including for bitmap fonts. Scaling is now also applied across varying text styles; previously it only applied to a font within an `wezterm.font_with_fallback` font list.
|
||||
* Fixed: ssh config parser incorrectly split `Host` patterns with commas instead of whitespace [#1196](https://github.com/wez/wezterm/issues/1196)
|
||||
* Fixed: search now auto-updates when the pane content changes [#1205](https://github.com/wez/wezterm/issues/1205)
|
||||
* Fixed: fonts with emoji presentation are shifted to better align with the primary font baseline [#1203](https://github.com/wez/wezterm/issues/1203)
|
||||
|
||||
### 20210814-124438-54e29167
|
||||
|
||||
|
@ -229,6 +229,7 @@ impl AllsortsParsedFont {
|
||||
cap_height_ratio: None,
|
||||
cap_height: None,
|
||||
is_scaled: true, // FIXME
|
||||
presentation: Presentation::Text,
|
||||
};
|
||||
|
||||
log::trace!("metrics: {:?}", metrics);
|
||||
|
@ -473,6 +473,7 @@ impl FontShaper for HarfbuzzShaper {
|
||||
cap_height_ratio: selected_size.cap_height_to_height_ratio,
|
||||
cap_height: selected_size.cap_height.map(PixelLength::new),
|
||||
is_scaled: selected_size.is_scaled,
|
||||
presentation: pair.presentation,
|
||||
};
|
||||
|
||||
self.metrics.borrow_mut().insert(key, metrics.clone());
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::parser::ParsedFont;
|
||||
use crate::units::PixelLength;
|
||||
use termwiz::cell::Presentation;
|
||||
|
||||
pub mod allsorts;
|
||||
pub mod harfbuzz;
|
||||
@ -60,6 +61,8 @@ pub struct FontMetrics {
|
||||
/// False if the font only has bitmap strikes and what we
|
||||
/// have here is a best approximation.
|
||||
pub is_scaled: bool,
|
||||
|
||||
pub presentation: Presentation,
|
||||
}
|
||||
|
||||
pub trait FontShaper {
|
||||
|
@ -20,6 +20,7 @@ use std::convert::TryInto;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, MutexGuard};
|
||||
use std::time::Instant;
|
||||
use termwiz::cell::Presentation;
|
||||
use termwiz::color::RgbColor;
|
||||
use termwiz::image::{ImageData, ImageDataType};
|
||||
use termwiz::surface::CursorShape;
|
||||
@ -470,6 +471,23 @@ impl<T: Texture2d> GlyphCache<T> {
|
||||
}
|
||||
};
|
||||
|
||||
let descender_adjust = {
|
||||
if info.font_idx == 0 {
|
||||
PixelLength::new(0.0)
|
||||
} else {
|
||||
let descender = idx_metrics.descender * scale;
|
||||
base_metrics.descender
|
||||
- descender
|
||||
- if idx_metrics.presentation == Presentation::Emoji {
|
||||
// If it's emoji, we'll just shift up to make
|
||||
// it sit on the baseline
|
||||
base_metrics.descender
|
||||
} else {
|
||||
PixelLength::new(0.0)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let (cell_width, cell_height) = (base_metrics.cell_width, base_metrics.cell_height);
|
||||
|
||||
let glyph = if glyph.width == 0 || glyph.height == 0 {
|
||||
@ -482,7 +500,7 @@ impl<T: Texture2d> GlyphCache<T> {
|
||||
y_offset: info.y_offset * scale,
|
||||
x_advance: info.x_advance * scale,
|
||||
bearing_x: PixelLength::zero(),
|
||||
bearing_y: PixelLength::zero(),
|
||||
bearing_y: descender_adjust,
|
||||
scale,
|
||||
}
|
||||
} else {
|
||||
@ -494,7 +512,7 @@ impl<T: Texture2d> GlyphCache<T> {
|
||||
);
|
||||
|
||||
let bearing_x = glyph.bearing_x * scale;
|
||||
let bearing_y = glyph.bearing_y * scale;
|
||||
let bearing_y = descender_adjust + (glyph.bearing_y * scale);
|
||||
let x_offset = info.x_offset * scale;
|
||||
let y_offset = info.y_offset * scale;
|
||||
let x_advance = info.x_advance * scale;
|
||||
|
Loading…
Reference in New Issue
Block a user