diff --git a/Cargo.toml b/Cargo.toml index ea09ac32..4be0c9c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ image = { version = "0.25.0", features = [ # Currently doesn't require any additional dependencies. # Default Text Engine -cosmic-text = { version = "0.10.0", default-features = false, features = [ +cosmic-text = { version = "0.12.1", default-features = false, features = [ "no_std", ], optional = true } @@ -112,7 +112,7 @@ web-sys = { version = "0.3.28", default-features = false, features = [ [target.'cfg(windows)'.dependencies] # We need windows-sys to use GDI to resolve fonts on Windows. -windows-sys = { version = "0.52.0", features = [ +windows-sys = { version = "0.59.0", features = [ "Win32_Foundation", "Win32_Graphics_Gdi", ], optional = true } diff --git a/crates/livesplit-auto-splitting/src/runtime/api/wasi.rs b/crates/livesplit-auto-splitting/src/runtime/api/wasi.rs index f1722aaf..e2d3faf7 100644 --- a/crates/livesplit-auto-splitting/src/runtime/api/wasi.rs +++ b/crates/livesplit-auto-splitting/src/runtime/api/wasi.rs @@ -1,4 +1,4 @@ -use std::{path::Path, str}; +use std::path::Path; use wasmtime_wasi::{preview1::WasiP1Ctx, DirPerms, FilePerms, WasiCtxBuilder}; @@ -26,8 +26,8 @@ pub fn build(script_path: Option<&Path>) -> WasiP1Ctx { let drive = drive_idx as u8 + b'a'; // Unfortunate if this fails, but we should still continue. let _ = wasi.preopened_dir( - str::from_utf8(&[b'\\', b'\\', b'?', b'\\', drive, b':', b'\\']).unwrap(), - str::from_utf8(&[b'/', b'm', b'n', b't', b'/', drive]).unwrap(), + std::str::from_utf8(&[b'\\', b'\\', b'?', b'\\', drive, b':', b'\\']).unwrap(), + std::str::from_utf8(&[b'/', b'm', b'n', b't', b'/', drive]).unwrap(), DirPerms::READ, FilePerms::READ, ); diff --git a/crates/livesplit-auto-splitting/src/runtime/mod.rs b/crates/livesplit-auto-splitting/src/runtime/mod.rs index ac13c4a1..10ce0916 100644 --- a/crates/livesplit-auto-splitting/src/runtime/mod.rs +++ b/crates/livesplit-auto-splitting/src/runtime/mod.rs @@ -416,10 +416,10 @@ impl CompiledAutoSplitter { store.data_mut().timer.log(format_args!("This auto splitter uses WASI. The API is subject to change, because WASI is still in preview. Auto splitters using WASI may need to be recompiled in the future.")); // These may be different in future WASI versions. - if let Ok(func) = instance.get_typed_func(&mut store, "_initialize") { + if let Ok(func) = instance.get_typed_func::<(), ()>(&mut store, "_initialize") { func.call(&mut store, ()) .map_err(|source| CreationError::WasiStart { source })?; - } else if let Ok(func) = instance.get_typed_func(&mut store, "_start") { + } else if let Ok(func) = instance.get_typed_func::<(), ()>(&mut store, "_start") { func.call(&mut store, ()) .map_err(|source| CreationError::WasiStart { source })?; } diff --git a/src/component/separator.rs b/src/component/separator.rs index ab78c3cc..c9296107 100644 --- a/src/component/separator.rs +++ b/src/component/separator.rs @@ -58,6 +58,6 @@ impl Component { /// This panics if the type of the value to be set is not compatible with /// the type of the setting's value. A panic can also occur if the index of /// the setting provided is out of bounds. - #[allow(clippy::needless_pass_by_value)] + #[allow(clippy::needless_pass_by_value, clippy::needless_pass_by_ref_mut)] pub fn set_value(&mut self, _index: usize, _value: Value) {} } diff --git a/src/hotkey_system.rs b/src/hotkey_system.rs index 3a59bf84..43267293 100644 --- a/src/hotkey_system.rs +++ b/src/hotkey_system.rs @@ -130,7 +130,7 @@ impl HotkeySystem { // This method should never be public, because it might mess up the internal // state and we might leak a registered hotkey - fn register_inner(&mut self, action: Action) -> Result<()> { + fn register_inner(&self, action: Action) -> Result<()> { let inner = self.command_sink.clone(); if let Some(hotkey) = action.get_hotkey(&self.config) { self.hook.register(hotkey, action.callback(inner))?; @@ -145,7 +145,7 @@ impl HotkeySystem { // This method should never be public, because it might mess up the internal // state and we might leak a registered hotkey - fn unregister_inner(&mut self, action: Action) -> Result<()> { + fn unregister_inner(&self, action: Action) -> Result<()> { if let Some(hotkey) = action.get_hotkey(&self.config) { self.hook.unregister(hotkey)?; } diff --git a/src/layout/parser/font_resolving/gdi.rs b/src/layout/parser/font_resolving/gdi.rs index 777b18bc..93d248f4 100644 --- a/src/layout/parser/font_resolving/gdi.rs +++ b/src/layout/parser/font_resolving/gdi.rs @@ -26,8 +26,8 @@ impl DeviceContext { // parameters to `CreateCompatibleDC`. We also properly check the // result. unsafe { - let res = CreateCompatibleDC(0); - if res == 0 { + let res = CreateCompatibleDC(ptr::null_mut()); + if res.is_null() { return None; } Some(Self(res)) @@ -39,7 +39,7 @@ impl DeviceContext { // `HFONT`. We also properly check the result. unsafe { let res = SelectObject(self.0, font.0); - if res == 0 || res == GDI_ERROR as HANDLE { + if res.is_null() || res == GDI_ERROR as HANDLE { return None; } Some(()) @@ -131,7 +131,7 @@ impl Font { DEFAULT_PITCH as _, name_buf.as_ptr(), ); - if res == 0 { + if res.is_null() { return None; } Some(Self(res)) diff --git a/src/rendering/default_text_engine/mod.rs b/src/rendering/default_text_engine/mod.rs index 1b9ed4f2..9001afa0 100644 --- a/src/rendering/default_text_engine/mod.rs +++ b/src/rendering/default_text_engine/mod.rs @@ -178,6 +178,7 @@ impl TextEngine

{ glyph_text, attrs_list, Shaping::Advanced, + 4, ); if let [span] = &*shape_line.spans { if let [word] = &*span.words { @@ -230,6 +231,7 @@ impl TextEngine

{ text, &font.attrs_list, Shaping::Advanced, + 4, ); let [mut x, mut y] = [0.0; 2]; @@ -287,8 +289,7 @@ impl TextEngine

{ y -= glyph.y_advance; } } else { - x += word.x_advance; - y -= word.y_advance; + x += word.width(1.0); } } } @@ -325,8 +326,7 @@ impl TextEngine

{ glyph_y -= glyph.y_advance; } } - x += word.x_advance; - y -= word.y_advance; + x += word.width(1.0); } } } diff --git a/src/rendering/entity.rs b/src/rendering/entity.rs index 6c419f86..f843733a 100644 --- a/src/rendering/entity.rs +++ b/src/rendering/entity.rs @@ -104,7 +104,9 @@ fn hash_float(f: f32, state: &mut impl Hasher) { #[inline] fn hash_transform(f: &Transform, state: &mut impl Hasher) { - const _: () = assert!(core::mem::size_of::() == 16); + const { + assert!(core::mem::size_of::() == 16); + } let [a, b]: [u64; 2] = bytemuck::cast(*f); u64::hash(&a, state); u64::hash(&b, state); diff --git a/src/run/parser/splitterino.rs b/src/run/parser/splitterino.rs index 822c85ee..e2d00a21 100644 --- a/src/run/parser/splitterino.rs +++ b/src/run/parser/splitterino.rs @@ -46,13 +46,13 @@ struct Splits<'a> { // timing: SplitterinoTimingMethod, } -/// Timing methods which can be used for segment times -#[derive(Deserialize)] -#[serde(rename_all = "camelCase")] -enum SplitterinoTimingMethod { - Igt, - Rta, -} +// /// Timing methods which can be used for segment times +// #[derive(Deserialize)] +// #[serde(rename_all = "camelCase")] +// enum SplitterinoTimingMethod { +// Igt, +// Rta, +// } /// Detailed information about the game and run details #[derive(Deserialize, Default)] diff --git a/tests/rendering.rs b/tests/rendering.rs index 2519efe4..a9b6e65c 100644 --- a/tests/rendering.rs +++ b/tests/rendering.rs @@ -143,6 +143,9 @@ fn font_fallback() { // Meitei "ꯃꯩꯇꯩ ꯃꯌꯦꯛ", // Thaana + // FIXME: Fails font fallback because it's a cursive font, but we never + // specified that we want a cursive font: + // https://github.com/pop-os/cosmic-text/issues/277 "ދިވެހި", // Canadian Syllabics "ᖃᓂᐅᔮᖅᐸᐃᑦ ᒐᐦᑲᓯᓇᐦᐃᑫᐤ ᑯᖾᖹ ᖿᐟᖻ ᓱᖽᐧᖿ ᑐᑊᘁᗕᑋᗸ", @@ -164,8 +167,8 @@ fn font_fallback() { &state, &image_cache, [320, 750], - "2b3e4a75f3eafdc4", - "cdbbe94245ed4f69", + "0379ab7ed4cad84f", + "fea17ece738ce1be", "font_fallback", ); }