aboutsummaryrefslogtreecommitdiff
path: root/font/src/ft/mod.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2017-12-09 17:07:07 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-12-24 09:46:54 -0800
commit8195d7103498043270523bd81d703cb678cd11a2 (patch)
tree8af420bc50c79156e07b1002b9ec4f740c960539 /font/src/ft/mod.rs
parentce8bd1aaf2ba8c5a931b8667b354f90ddf50a1a6 (diff)
downloadalacritty-8195d7103498043270523bd81d703cb678cd11a2.tar.gz
alacritty-8195d7103498043270523bd81d703cb678cd11a2.zip
Format cursor code and add documentation
As requested a few comments have been added to the darwin code. There also was an off by one error in the ascent calculation which has been corrected. The beam cursor width has also been tweaked to be slightly slimmer in general. All code added in this PR has also been run through the default rustfmt to make sure the formatting is okay.
Diffstat (limited to 'font/src/ft/mod.rs')
-rw-r--r--font/src/ft/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index 7b22fb03..765e8efb 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -298,7 +298,8 @@ impl FreeTypeRasterizer {
match glyph_key.c {
super::UNDERLINE_CURSOR_CHAR => {
// Get the bottom of the bounding box
- let size_metrics = face.ft_face.size_metrics()
+ let size_metrics = face.ft_face
+ .size_metrics()
.ok_or(Error::MissingSizeMetrics)?;
let descent = (size_metrics.descender / 64) as i32;
@@ -308,10 +309,11 @@ impl FreeTypeRasterizer {
// Return the new custom glyph
super::get_underline_cursor_glyph(descent, width)
- },
+ }
super::BEAM_CURSOR_CHAR => {
// Get the top of the bounding box
- let size_metrics = face.ft_face.size_metrics()
+ let size_metrics = face.ft_face
+ .size_metrics()
.ok_or(Error::MissingSizeMetrics)?;
let ascent = (size_metrics.ascender / 64) as i32 - 1;
@@ -325,7 +327,7 @@ impl FreeTypeRasterizer {
// Return the new custom glyph
super::get_beam_cursor_glyph(ascent, height, width)
- },
+ }
_ => {
// If it's not a special char, return the normal glyph
Ok(RasterizedGlyph {