From d5cc561ffaf9eeef0d5fa2851c28d744e98c13c0 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 24 Nov 2022 14:35:26 +0100 Subject: [PATCH 4/5] Update the yeslogic-fontconfig-sys crate to 4.0.1 ... and adapt tests/src/utils.rs for changed fontconfig_sys import paths. Part-of: --- Cargo.lock | 25 +++++++++++++++++++++++-- Cargo.toml | 2 +- tests/src/utils.rs | 13 +++++++------ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3da93d02..83b3d405 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -357,6 +357,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "dlib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +dependencies = [ + "libloading", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -799,6 +808,16 @@ version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "librsvg" version = "2.55.1" @@ -2333,10 +2352,12 @@ dependencies = [ [[package]] name = "yeslogic-fontconfig-sys" -version = "2.11.2" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e47154248a2dba5ca6965e26b1a59146210736ea9b862362b6d72682e57f8d" +checksum = "ec657fd32bbcbeaef5c7bc8e10b3db95b143fab8db0a50079773dbf936fd4f73" dependencies = [ "const-cstr", + "dlib", + "once_cell", "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index d62250df..ae48bbfa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,7 +98,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tempfile = "3" test-generator = "0.3" -yeslogic-fontconfig-sys = "2.11.1" +yeslogic-fontconfig-sys = "4.0.1" [build-dependencies] regex = "1.3.9" diff --git a/tests/src/utils.rs b/tests/src/utils.rs index fb4ad2de..e70eb04f 100644 --- a/tests/src/utils.rs +++ b/tests/src/utils.rs @@ -49,7 +49,6 @@ pub fn render_document( #[cfg(system_deps_have_pangoft2)] mod pango_ft2 { use super::*; - use fontconfig_sys::fontconfig; use glib::prelude::*; use pangocairo::FontMap; @@ -59,7 +58,7 @@ mod pango_ft2 { // This is not bound in gtk-rs, and PangoFcFontMap is not even exposed, so we'll bind it by hand. fn pango_fc_font_map_set_config( font_map: *mut libc::c_void, - config: *mut fontconfig::FcConfig, + config: *mut fontconfig_sys::FcConfig, ); } @@ -73,15 +72,17 @@ mod pango_ft2 { "tests/resources/Roboto-BoldItalic.ttf", ]; - let config = fontconfig::FcConfigCreate(); - if fontconfig::FcConfigSetCurrent(config) == 0 { + let config = fontconfig_sys::FcConfigCreate(); + if fontconfig_sys::FcConfigSetCurrent(config) == 0 { panic!("Could not set a fontconfig configuration"); } for path in &font_paths { let path_cstring = CString::new(*path).unwrap(); - if fontconfig::FcConfigAppFontAddFile(config, path_cstring.as_ptr() as *const _) == 0 { + if fontconfig_sys::FcConfigAppFontAddFile(config, path_cstring.as_ptr() as *const _) + == 0 + { panic!("Could not load font file {} for tests; aborting", path,); } } @@ -90,7 +91,7 @@ mod pango_ft2 { let raw_font_map: *mut pango::ffi::PangoFontMap = font_map.to_glib_none().0; pango_fc_font_map_set_config(raw_font_map as *mut _, config); - fontconfig::FcConfigDestroy(config); + fontconfig_sys::FcConfigDestroy(config); FontMap::set_default(Some(font_map.downcast::().unwrap())); } -- 2.38.1