summaryrefslogtreecommitdiffstats
path: root/font/src/lib.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2017-12-09 03:26:33 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-12-24 09:46:54 -0800
commitce8bd1aaf2ba8c5a931b8667b354f90ddf50a1a6 (patch)
treead4787f1a4adbfbab77054a58000ce3a4a6b97a3 /font/src/lib.rs
parentd82c4f02b69a8e16057a42de470c5bea114ffda6 (diff)
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/lib.rs')
-rw-r--r--font/src/lib.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/font/src/lib.rs b/font/src/lib.rs
index 776127ea..a2580fc8 100644
--- a/font/src/lib.rs
+++ b/font/src/lib.rs
@@ -59,18 +59,12 @@ mod darwin;
pub use darwin::*;
/// Character used for the underline cursor
-#[cfg(not(target_os = "macos"))]
// This is part of the private use area and should not conflict with any font
pub const UNDERLINE_CURSOR_CHAR: char = '\u{10a3e2}';
-#[cfg(target_os = "macos")]
-pub const UNDERLINE_CURSOR_CHAR: char = '▁';
/// Character used for the beam cursor
-#[cfg(not(target_os = "macos"))]
// This is part of the private use area and should not conflict with any font
pub const BEAM_CURSOR_CHAR: char = '\u{10a3e3}';
-#[cfg(target_os = "macos")]
-pub const BEAM_CURSOR_CHAR: char = '▎';
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct FontDesc {
@@ -217,6 +211,7 @@ impl Default for RasterizedGlyph {
}
// Returns a custom underline cursor character
+// TODO: Make sure this works with positive/0 descent -> small fonts
pub fn get_underline_cursor_glyph(descent: i32, width: i32) -> Result<RasterizedGlyph, Error> {
// Create a new rectangle, the height is half the distance between
// bounding box bottom and the baseline
@@ -235,6 +230,7 @@ pub fn get_underline_cursor_glyph(descent: i32, width: i32) -> Result<Rasterized
}
// Returns a custom beam cursor character
+// TODO: Make sure this works with positive/0 descent -> small fonts
pub fn get_beam_cursor_glyph(ascent: i32, height: i32, width: i32) -> Result<RasterizedGlyph, Error> {
// Create a new rectangle
let beam_width = (f64::from(width) / 5.) as i32;