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.
This commit is contained in:
parent
bf72b5a326
commit
5149dcffbf
|
@ -24,7 +24,7 @@ use libc::c_uint;
|
||||||
|
|
||||||
pub mod fc;
|
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 {
|
struct FixedSize {
|
||||||
pixelsize: f64,
|
pixelsize: f64,
|
||||||
|
@ -295,7 +295,7 @@ impl FreeTypeRasterizer {
|
||||||
let (pixel_width, buf) = Self::normalize_buffer(&glyph.bitmap())?;
|
let (pixel_width, buf) = Self::normalize_buffer(&glyph.bitmap())?;
|
||||||
|
|
||||||
// Render a custom symbol for the underline cursor
|
// 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
|
// 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)?;
|
.ok_or(Error::MissingSizeMetrics)?;
|
||||||
|
|
|
@ -58,6 +58,12 @@ mod darwin;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub use darwin::*;
|
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)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct FontDesc {
|
pub struct FontDesc {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -22,6 +22,7 @@ use std::time::{Duration, Instant};
|
||||||
use arraydeque::ArrayDeque;
|
use arraydeque::ArrayDeque;
|
||||||
use unicode_width::UnicodeWidthChar;
|
use unicode_width::UnicodeWidthChar;
|
||||||
|
|
||||||
|
use font;
|
||||||
use ansi::{self, Color, NamedColor, Attr, Handler, CharsetIndex, StandardCharset, CursorStyle};
|
use ansi::{self, Color, NamedColor, Attr, Handler, CharsetIndex, StandardCharset, CursorStyle};
|
||||||
use grid::{BidirectionalIterator, Grid, ClearRegion, ToRange, Indexed};
|
use grid::{BidirectionalIterator, Grid, ClearRegion, ToRange, Indexed};
|
||||||
use index::{self, Point, Column, Line, Linear, IndexRange, Contains, RangeInclusive};
|
use index::{self, Point, Column, Line, Linear, IndexRange, Contains, RangeInclusive};
|
||||||
|
@ -208,7 +209,7 @@ impl<'a> RenderableCellsIter<'a> {
|
||||||
|
|
||||||
let cursor_color = self.text_cursor_color(&cursor_cell);
|
let cursor_color = self.text_cursor_color(&cursor_cell);
|
||||||
// This is part of the private use area and shouldn't be used by any font
|
// This is part of the private use area and shouldn't be used by any font
|
||||||
cursor_cell.c = '';
|
cursor_cell.c = font::UNDERLINE_CURSOR_CHAR;
|
||||||
cursor_cell.fg = cursor_color;
|
cursor_cell.fg = cursor_color;
|
||||||
self.cursor_cells.push_back(Indexed {
|
self.cursor_cells.push_back(Indexed {
|
||||||
line: self.cursor.line,
|
line: self.cursor.line,
|
||||||
|
|
Loading…
Reference in New Issue