diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2022-01-29 23:06:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-29 23:06:44 +0300 |
commit | f6651a997bd2af3f116d40d2a60b94c7508e00a1 (patch) | |
tree | 8bc7e4e62a5971878c9cb3eca31ec2fe21faf8b4 /alacritty/src/renderer/mod.rs | |
parent | 094c2c9269685e8759104f2e9c05eca323a57fe4 (diff) | |
download | r-alacritty-f6651a997bd2af3f116d40d2a60b94c7508e00a1.tar.gz r-alacritty-f6651a997bd2af3f116d40d2a60b94c7508e00a1.tar.bz2 r-alacritty-f6651a997bd2af3f116d40d2a60b94c7508e00a1.zip |
Account for font.offset and glyph.offset in built-in font
This commit takes into account `font.offset` and `font.glyph_offset`
when generating built-in font.
Diffstat (limited to 'alacritty/src/renderer/mod.rs')
-rw-r--r-- | alacritty/src/renderer/mod.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index 50a0e7d7..715d33b5 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -132,6 +132,9 @@ pub struct GlyphCache { /// Font size. font_size: crossfont::Size, + /// Font offset. + font_offset: Delta<i8>, + /// Glyph offset. glyph_offset: Delta<i8>, @@ -168,6 +171,7 @@ impl GlyphCache { bold_key: bold, italic_key: italic, bold_italic_key: bold_italic, + font_offset: font.offset, glyph_offset: font.glyph_offset, metrics, builtin_box_drawing: font.builtin_box_drawing, @@ -274,7 +278,14 @@ impl GlyphCache { // for everything else. let rasterized = self .builtin_box_drawing - .then(|| builtin_font::builtin_glyph(glyph_key.character, &self.metrics)) + .then(|| { + builtin_font::builtin_glyph( + glyph_key.character, + &self.metrics, + &self.font_offset, + &self.glyph_offset, + ) + }) .flatten() .map_or_else(|| self.rasterizer.get_glyph(glyph_key), Ok); @@ -342,6 +353,7 @@ impl GlyphCache { ) -> Result<(), crossfont::Error> { // Update dpi scaling. self.rasterizer.update_dpr(dpr as f32); + self.font_offset = font.offset; // Recompute font keys. let (regular, bold, italic, bold_italic) = |