update skribo, fontkit, and format

macos-click-through
Keith Simmons 5 years ago
parent bea55d321f
commit 3da11e09d8

83
Cargo.lock generated

@ -51,15 +51,6 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "arrayvec"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
dependencies = [
"nodrop",
]
[[package]]
name = "arrayvec"
version = "0.5.1"
@ -152,7 +143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
dependencies = [
"arrayref",
"arrayvec 0.5.1",
"arrayvec",
"constant_time_eq",
]
@ -518,13 +509,14 @@ dependencies = [
[[package]]
name = "dwrote"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bd1369e02db5e9b842a9b67bce8a2fcc043beafb2ae8a799dd482d46ea1ff0d"
checksum = "bcdf488e3a52a7aa30a05732a3e58420e22acb4b2b75635a561fc6ffbcab59ef"
dependencies = [
"lazy_static",
"libc",
"winapi 0.3.8",
"wio",
]
[[package]]
@ -624,23 +616,24 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
[[package]]
name = "font-kit"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09b6e2b877097ffd0abac6597fea26fccb5ed7eb9da0a4094f11ccc8aba64efb"
checksum = "8f953474ebbe3460775ed2da52435477cc029493284d6ceb635598586a2c6298"
dependencies = [
"bitflags",
"byteorder",
"core-foundation 0.7.0",
"core-graphics 0.19.0",
"core-text 15.0.0",
"dirs",
"dwrote",
"euclid",
"float-ord",
"freetype",
"lazy_static",
"libc",
"log",
"lyon_path",
"pathfinder_geometry",
"pathfinder_simd",
"servo-fontconfig",
"walkdir",
"winapi 0.3.8",
@ -1001,26 +994,6 @@ dependencies = [
"hashbrown",
]
[[package]]
name = "lyon_geom"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca04310c9807612a311506106000b6eccb2e27bca9bfb594ce80fb8a31231f9d"
dependencies = [
"arrayvec 0.4.12",
"euclid",
"num-traits",
]
[[package]]
name = "lyon_path"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bcb57ac24a5428539e2c7c0592766d5933c937d703f430990c669c00de96862"
dependencies = [
"lyon_geom",
]
[[package]]
name = "lzw"
version = "0.10.0"
@ -1183,12 +1156,6 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "nodrop"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nom"
version = "4.2.3"
@ -1337,6 +1304,25 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "pathfinder_geometry"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "451f12870c33af093e0bb8e44ec13f056de02fe3690a704e5d412fa9a2c30d8d"
dependencies = [
"log",
"pathfinder_simd",
]
[[package]]
name = "pathfinder_simd"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b451513912d6b3440e443aa75a73ab22203afedc4a90df8526d008c0f86f7cb3"
dependencies = [
"rustc_version",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
@ -1780,13 +1766,13 @@ dependencies = [
[[package]]
name = "skribo"
version = "0.0.1"
source = "git+https://github.com/linebender/skribo#f306037c36f596bba45cb9fd698ea53b6ca65e2e"
source = "git+https://github.com/linebender/skribo#85293c3b3d7bbd7fc6b8fbfb732bc9450904211f"
dependencies = [
"euclid",
"font-kit",
"harfbuzz",
"harfbuzz-sys",
"log",
"pathfinder_geometry",
"unicode-normalization",
]
@ -2114,6 +2100,15 @@ dependencies = [
"toml",
]
[[package]]
name = "wio"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "ws2_32-sys"
version = "0.2.1"

@ -13,7 +13,7 @@ embed-fonts = []
[dependencies]
euclid = "0.20.7"
font-kit = "0.5.0"
font-kit = "0.6.0"
skribo = { git = "https://github.com/linebender/skribo" }
lru = "0.4.3"
skulpin = { git = "https://github.com/Kethku/skulpin", branch = "sdl2" }

@ -1,10 +1,10 @@
use cfg_if::cfg_if as define;
use font_kit::{
font::Font,
handle::Handle,
metrics::Metrics,
properties::{Properties, Stretch, Style, Weight},
source::SystemSource,
handle::Handle
};
use log::{trace, warn};
use lru::LruCache;
@ -298,7 +298,7 @@ impl CachingShaper {
for (i, glyph) in layout_run.glyphs().enumerate() {
glyphs[i] = glyph.glyph_id as u16;
positions[i] = glyph.offset.x;
positions[i] = glyph.offset.x();
}
blobs.push(blob_builder.make().unwrap());
@ -340,7 +340,7 @@ impl CachingShaper {
let session =
LayoutSession::create(STANDARD_CHARACTER_STRING, &style, &self.font_set.normal);
let layout_run = session.iter_all().next().unwrap();
let glyph_offsets: Vec<f32> = layout_run.glyphs().map(|glyph| glyph.offset.x).collect();
let glyph_offsets: Vec<f32> = layout_run.glyphs().map(|glyph| glyph.offset.x()).collect();
let glyph_advances: Vec<f32> = glyph_offsets
.windows(2)
.map(|pair| pair[1] - pair[0])

@ -130,7 +130,8 @@ impl Corner {
let relative_scaled_position: Point = (
self.relative_position.x * font_dimensions.x,
self.relative_position.y * font_dimensions.y,
).into();
)
.into();
let corner_destination = destination + relative_scaled_position;

@ -164,7 +164,11 @@ impl Renderer {
};
let current_font = Some(self.shaper.font_name.clone().unwrap_or(String::from("")));
let editor_font = if font_name.clone().unwrap_or_default().is_empty() { &current_font } else { &font_name };
let editor_font = if font_name.clone().unwrap_or_default().is_empty() {
&current_font
} else {
&font_name
};
let font_changed = current_font != *editor_font
|| font_size

@ -5,8 +5,8 @@ use std::time::{Duration, Instant};
use log::{debug, error, info, trace};
use skulpin::sdl2;
use skulpin::sdl2::event::{Event, WindowEvent};
use skulpin::sdl2::keyboard::{Keycode};
use skulpin::sdl2::video::{Window};
use skulpin::sdl2::keyboard::Keycode;
use skulpin::sdl2::video::Window;
use skulpin::sdl2::Sdl;
use skulpin::{dpis, CoordinateSystem, PresentMode, Renderer as SkulpinRenderer, RendererBuilder};
use skulpin::{LogicalSize, PhysicalSize};
@ -56,7 +56,7 @@ struct WindowWrapper {
transparency: f32,
fullscreen: bool,
cached_size: (i32, i32),
cached_position: (i32, i32)
cached_position: (i32, i32),
}
pub fn window_geometry() -> Result<(u64, u64), String> {
@ -171,7 +171,7 @@ impl WindowWrapper {
transparency: 1.0,
fullscreen: false,
cached_size: (0, 0),
cached_position: (0, 0)
cached_position: (0, 0),
}
}
@ -186,22 +186,34 @@ impl WindowWrapper {
sdl2::sys::SDL_SetWindowResizable(raw_handle, sdl2::sys::SDL_bool::SDL_TRUE);
// Use cached size and position
self.window.set_size(self.cached_size.0 as u32, self.cached_size.1 as u32).unwrap();
self.window
.set_size(self.cached_size.0 as u32, self.cached_size.1 as u32)
.unwrap();
self.window.set_position(
sdl2::video::WindowPos::Positioned(self.cached_position.0),
sdl2::video::WindowPos::Positioned(self.cached_position.1)
sdl2::video::WindowPos::Positioned(self.cached_position.1),
);
self.window.set_bordered(true);
}
else {
} else {
// Cache the size and position
sdl2::sys::SDL_GetWindowSize(raw_handle, &mut self.cached_size.0, &mut self.cached_size.1);
sdl2::sys::SDL_GetWindowPosition(raw_handle, &mut self.cached_position.0, &mut self.cached_position.1);
sdl2::sys::SDL_GetWindowSize(
raw_handle,
&mut self.cached_size.0,
&mut self.cached_size.1,
);
sdl2::sys::SDL_GetWindowPosition(
raw_handle,
&mut self.cached_position.0,
&mut self.cached_position.1,
);
sdl2::sys::SDL_SetWindowResizable(raw_handle, sdl2::sys::SDL_bool::SDL_FALSE);
// Set window to fullscreen
self.window.set_size(rect.width(), rect.height()).unwrap();
self.window.set_position(sdl2::video::WindowPos::Positioned(rect.x()), sdl2::video::WindowPos::Positioned(rect.y()));
self.window.set_position(
sdl2::video::WindowPos::Positioned(rect.x()),
sdl2::video::WindowPos::Positioned(rect.y()),
);
self.window.set_bordered(true);
}
}

Loading…
Cancel
Save