diff options
author | Christian Duerr <contact@christianduerr.com> | 2017-12-09 03:26:33 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-24 09:46:54 -0800 |
commit | ce8bd1aaf2ba8c5a931b8667b354f90ddf50a1a6 (patch) | |
tree | ad4787f1a4adbfbab77054a58000ce3a4a6b97a3 /font/src/darwin | |
parent | d82c4f02b69a8e16057a42de470c5bea114ffda6 (diff) | |
download | alacritty-ce8bd1aaf2ba8c5a931b8667b354f90ddf50a1a6.tar.gz alacritty-ce8bd1aaf2ba8c5a931b8667b354f90ddf50a1a6.zip |
Add custom cursors for macos
The macos target now also supports the custom beam and underline
cursors. The only thing left for this is now is testing and making sure
it works with tiny fonts.
Diffstat (limited to 'font/src/darwin')
-rw-r--r-- | font/src/darwin/mod.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs index 97f02553..877564fa 100644 --- a/font/src/darwin/mod.rs +++ b/font/src/darwin/mod.rs @@ -461,6 +461,19 @@ impl Font { } pub fn get_glyph(&self, character: char, _size: f64, use_thin_strokes: bool) -> Result<RasterizedGlyph, Error> { + // Render custom symbols for underline and beam cursor + if character == super::UNDERLINE_CURSOR_CHAR { + let descent = -(self.ct_font.descent() as i32); + let width = self.glyph_advance('0') as i32; + return super::get_underline_cursor_glyph(descent, width); + } else if character == super::BEAM_CURSOR_CHAR { + let metrics = self.metrics(); + let height = metrics.line_height; + let ascent = height - self.ct_font.descent() + 1.; + let width = self.glyph_advance('0') as i32; + return super::get_beam_cursor_glyph(ascent as i32, height as i32, width); + }; + let glyph_index = self.glyph_index(character) .ok_or(Error::MissingGlyph(character))?; |