mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 06:12:16 +03:00
fonts: refine scaling factor
The ongoing saga froma465378dc4
,f204ad9a82
, and others! Only do scale adjustment here for glyphs that are taller rather than wider. This makes the ligatures in fira code look good again, and still works with the v1 of the operator mono fonts.
This commit is contained in:
parent
5c1b78c17c
commit
291800b49a
@ -129,16 +129,8 @@ impl<T: Texture2d> GlyphCache<T> {
|
||||
glyph = font.rasterize_glyph(info.glyph_pos, info.font_idx)?;
|
||||
}
|
||||
let (cell_width, cell_height) = (metrics.cell_width, metrics.cell_height);
|
||||
let nominal_width = cell_width.get() * info.num_cells as f64;
|
||||
|
||||
let scale = if glyph.width as f64 > nominal_width * 1.5 {
|
||||
// This is for the case where the glyph is a big bitmap that hasn't
|
||||
// yet been scaled
|
||||
nominal_width / glyph.width as f64
|
||||
} else if (info.x_advance.get() / f64::from(info.num_cells)).floor() > cell_width.get() {
|
||||
// This is to handle double-width replacements such as ligatures
|
||||
nominal_width / info.x_advance.get() as f64
|
||||
} else if PixelLength::new(glyph.height as f64) > cell_height * 1.5 {
|
||||
let scale = if PixelLength::new(glyph.height as f64) > cell_height * 1.5 {
|
||||
// This is another way to detect overside glyph images
|
||||
cell_height.get() / glyph.height as f64
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user