Bump crossfont to 0.7.0
This commit is contained in:
parent
c0c267d60e
commit
0fd04c371a
|
@ -52,6 +52,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Default `bell.animation` is now `Linear`
|
||||
- `IncreaseFontSize/DecreaseFontSize` step is now 1px
|
||||
- `font.size` precision was raised to 6 floating point digits
|
||||
- Default font size to `11.25` matching 15px
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ dependencies = [
|
|||
"clap_complete",
|
||||
"cocoa",
|
||||
"copypasta",
|
||||
"crossfont 0.6.0",
|
||||
"crossfont 0.7.0",
|
||||
"dirs",
|
||||
"embed-resource",
|
||||
"gl_generator",
|
||||
|
@ -586,9 +586,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossfont"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80c5cf9f7d8f5478dbebc0e7a9ddcd350401e4cd9275d003481d8ec9613b7de1"
|
||||
checksum = "e89c65306ecd118368d875f48d69394b5c3ff6bb7c57ae6deb638782735a093c"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"core-foundation",
|
||||
|
|
|
@ -26,7 +26,7 @@ ahash = { version = "0.8.6", features = ["no-rng"] }
|
|||
bitflags = "2.2.1"
|
||||
clap = { version = "4.2.7", features = ["derive", "env"] }
|
||||
copypasta = { version = "0.10.0", default-features = false }
|
||||
crossfont = { version = "0.6.0", features = ["force_system_fontconfig"] }
|
||||
crossfont = { version = "0.7.0", features = ["force_system_fontconfig"] }
|
||||
glutin = { version = "0.31.1", default-features = false, features = ["egl", "wgl"] }
|
||||
home = "0.5.5"
|
||||
libc = "0.2"
|
||||
|
|
|
@ -134,7 +134,7 @@ struct Size(FontSize);
|
|||
|
||||
impl Default for Size {
|
||||
fn default() -> Self {
|
||||
Self(FontSize::new(11.))
|
||||
Self(FontSize::new(11.25))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -463,9 +463,10 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
|
|||
}
|
||||
}
|
||||
|
||||
fn change_font_size(&mut self, delta: i32) {
|
||||
let new_size = (self.display.font_size.as_px() as i32 + delta).clamp(1, u16::MAX as i32);
|
||||
self.display.font_size = FontSize::from_px(new_size as u16);
|
||||
fn change_font_size(&mut self, delta: f32) {
|
||||
// Round to pick integral px steps, since fonts look better on them.
|
||||
let new_size = self.display.font_size.as_px().round() + delta;
|
||||
self.display.font_size = FontSize::from_px(new_size);
|
||||
let font = self.config.font.clone().with_size(self.display.font_size);
|
||||
self.display.pending_update.set_font(font);
|
||||
}
|
||||
|
@ -1168,8 +1169,7 @@ impl TouchZoom {
|
|||
|
||||
// Calculate font change in `FONT_SIZE_STEP` increments.
|
||||
let delta = (self.distance() - old_distance) * TOUCH_ZOOM_FACTOR + self.fractions;
|
||||
let font_delta =
|
||||
(delta.abs() / FONT_SIZE_STEP as f32).floor() * FONT_SIZE_STEP as f32 * delta.signum();
|
||||
let font_delta = (delta.abs() / FONT_SIZE_STEP).floor() * FONT_SIZE_STEP * delta.signum();
|
||||
self.fractions = delta - font_delta;
|
||||
|
||||
font_delta
|
||||
|
|
|
@ -48,7 +48,7 @@ use crate::scheduler::{Scheduler, TimerId, Topic};
|
|||
pub mod keyboard;
|
||||
|
||||
/// Font size change interval in px.
|
||||
pub const FONT_SIZE_STEP: i32 = 1;
|
||||
pub const FONT_SIZE_STEP: f32 = 1.;
|
||||
|
||||
/// Interval for mouse scrolling during selection outside of the boundaries.
|
||||
const SELECTION_SCROLLING_INTERVAL: Duration = Duration::from_millis(15);
|
||||
|
@ -98,7 +98,7 @@ pub trait ActionContext<T: EventListener> {
|
|||
fn create_new_window(&mut self, _tabbing_id: Option<String>) {}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn create_new_window(&mut self) {}
|
||||
fn change_font_size(&mut self, _delta: i32) {}
|
||||
fn change_font_size(&mut self, _delta: f32) {}
|
||||
fn reset_font_size(&mut self) {}
|
||||
fn pop_message(&mut self) {}
|
||||
fn message(&self) -> Option<&Message>;
|
||||
|
@ -865,7 +865,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
|
|||
},
|
||||
TouchPurpose::Zoom(zoom) => {
|
||||
let font_delta = zoom.font_delta(touch);
|
||||
self.ctx.change_font_size(font_delta as i32);
|
||||
self.ctx.change_font_size(font_delta);
|
||||
},
|
||||
TouchPurpose::Scroll(last_touch) => {
|
||||
// Calculate delta and update last touch position.
|
||||
|
|
|
@ -245,7 +245,7 @@ macOS: { family = _"Menlo"_, style = _"Regular"_ }
|
|||
|
||||
Font size in points.
|
||||
|
||||
Default: _11.0_
|
||||
Default: _11.25_
|
||||
|
||||
*offset* = { x = _<integer>_, y = _<integer>_ }
|
||||
|
||||
|
|
Loading…
Reference in New Issue