summaryrefslogtreecommitdiffstats
path: root/font
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2017-12-06 23:44:51 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-12-24 09:46:54 -0800
commit5149dcffbffe0bf35ad3bc85a48f9c82b9ea6477 (patch)
tree781267e955d7faff683f43c34022450df8287405 /font
parentbf72b5a326c2c06541fd0564417a4ad52a9938bc (diff)
Revert to old system for macos
Because rendering with macos works differently, the old underline cursor is used for that. The cursor symbol has also been setup as a constant in the font project.
Diffstat (limited to 'font')
-rw-r--r--font/src/ft/mod.rs4
-rw-r--r--font/src/lib.rs6
2 files changed, 8 insertions, 2 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index 25917e96..b8559237 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -24,7 +24,7 @@ use libc::c_uint;
pub mod fc;
-use super::{FontDesc, RasterizedGlyph, Metrics, Size, FontKey, GlyphKey, Weight, Slant, Style};
+use super::{FontDesc, RasterizedGlyph, Metrics, Size, FontKey, GlyphKey, Weight, Slant, Style, UNDERLINE_CURSOR_CHAR};
struct FixedSize {
pixelsize: f64,
@@ -295,7 +295,7 @@ impl FreeTypeRasterizer {
let (pixel_width, buf) = Self::normalize_buffer(&glyph.bitmap())?;
// Render a custom symbol for the underline cursor
- if glyph_key.c == '􊏢' {
+ if glyph_key.c == UNDERLINE_CURSOR_CHAR {
// Get the bottom of the bounding box
let size_metrics = face.ft_face.size_metrics()
.ok_or(Error::MissingSizeMetrics)?;
diff --git a/font/src/lib.rs b/font/src/lib.rs
index 513dacdd..d22746d3 100644
--- a/font/src/lib.rs
+++ b/font/src/lib.rs
@@ -58,6 +58,12 @@ mod darwin;
#[cfg(target_os = "macos")]
pub use darwin::*;
+/// Character used for the underline cursor
+#[cfg(not(target_os = "macos"))]
+pub const UNDERLINE_CURSOR_CHAR: char = '􊏢';
+#[cfg(target_os = "macos")]
+pub const UNDERLINE_CURSOR_CHAR: char = '▁';
+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct FontDesc {
name: String,