Revert "Prospective build fix for arm cross build" and "With Rust 1.64 we can use core:ffi types instead of depending on libc"

This reverts commit 000d95670b and commit
d764796e0c to fix arm cross build and
x86-64 linux.

Let's use the core::ffi types when fontconfig-sys switches to it.
This commit is contained in:
Simon Hausmann 2022-12-06 09:14:34 +01:00
parent 000d95670b
commit 755cd66398
4 changed files with 10 additions and 8 deletions

View file

@ -21,7 +21,7 @@ path = "lib.rs"
[features]
wayland = ["winit/wayland", "glutin/wayland", "copypasta/wayland"]
x11 = ["winit/x11", "glutin/x11", "copypasta/x11"]
renderer-winit-femtovg = ["femtovg", "fontdb", "yeslogic-fontconfig-sys", "winapi", "dwrote", "imgref", "unicode-script", "ttf-parser", "rgb"]
renderer-winit-femtovg = ["femtovg", "fontdb", "libc", "yeslogic-fontconfig-sys", "winapi", "dwrote", "imgref", "unicode-script", "ttf-parser", "rgb"]
renderer-winit-skia = ["skia-safe", "glow", "unicode-segmentation", "metal", "objc", "core-graphics-types", "foreign-types", "wio", "winapi/d3d12", "winapi/dxgi", "winapi/dxgi1_2", "winapi/dxgi1_3", "winapi/dxgi1_4", "winapi/d3d12sdklayers", "winapi/synchapi"]
renderer-winit-skia-opengl = ["skia-safe/gl", "glow", "unicode-segmentation"]
renderer-winit-software = ["femtovg", "imgref", "rgb"]
@ -77,6 +77,7 @@ skia-safe = { version = "0.56.1", optional = true, features = ["d3d"] }
wio = { version = "0.2.2", optional = true }
[target.'cfg(not(any(target_family = "windows", target_os = "macos", target_os = "ios", target_arch = "wasm32")))'.dependencies]
libc = { version = "0.2", optional = true }
yeslogic-fontconfig-sys = { version = "3.2", optional = true }
[target.'cfg(target_os = "macos")'.dependencies]

View file

@ -18,7 +18,7 @@ pub fn find_families(requested_family: &str) -> Vec<String> {
feature = "fontconfig-dlopen",
LIB,
FcNameParse,
family_cstr.as_ptr() as *mut core::ffi::c_char
family_cstr.as_ptr() as *mut libc::c_uchar
);
ffi_dispatch!(
feature = "fontconfig-dlopen",
@ -49,7 +49,7 @@ pub fn find_families(requested_family: &str) -> Vec<String> {
LIB,
FcPatternGetString,
*(*result_set).fonts.offset(idx as isize),
b"family\0".as_ptr() as *const core::ffi::c_char,
b"family\0".as_ptr() as *const libc::c_char,
0,
&mut raw_family_name
) != ffi::FcResultMatch
@ -61,7 +61,7 @@ pub fn find_families(requested_family: &str) -> Vec<String> {
continue;
}
if let Some(family_name) =
std::ffi::CStr::from_ptr(raw_family_name as *const core::ffi::c_char)
std::ffi::CStr::from_ptr(raw_family_name as *const libc::c_char)
.to_str()
.ok()
.map(|raw_family_name| raw_family_name.to_owned())

View file

@ -28,7 +28,7 @@ proc_macro_span = ["quote", "proc-macro2"]
display-diagnostics = ["codemap", "codemap-diagnostic"]
# Enabled the support to render images and font in the binary
software-renderer = ["image", "tiny-skia", "resvg", "usvg", "fontdb", "fontdue", "yeslogic-fontconfig-sys"]
software-renderer = ["image", "tiny-skia", "resvg", "usvg", "fontdb", "fontdue", "libc", "yeslogic-fontconfig-sys"]
[dependencies]
@ -63,6 +63,7 @@ fontdb = { version = "0.10", features = ["fontconfig"], optional = true }
fontdue = { version = "0.7.1", optional = true }
[target.'cfg(not(any(target_family = "windows", target_os = "macos", target_os = "ios", target_arch = "wasm32")))'.dependencies]
libc = { version = "0.2", optional = true }
yeslogic-fontconfig-sys = { version = "3.2.0", optional = true }
[dev-dependencies]

View file

@ -19,7 +19,7 @@ pub fn find_families(requested_family: &str) -> Vec<String> {
feature = "fontconfig-dlopen",
LIB,
FcNameParse,
family_cstr.as_ptr() as *mut core::ffi::c_uchar
family_cstr.as_ptr() as *mut libc::c_uchar
);
ffi_dispatch!(
feature = "fontconfig-dlopen",
@ -50,7 +50,7 @@ pub fn find_families(requested_family: &str) -> Vec<String> {
LIB,
FcPatternGetString,
*(*result_set).fonts.offset(idx as isize),
b"family\0".as_ptr() as *const core::ffi::c_char,
b"family\0".as_ptr() as *const libc::c_char,
0,
&mut raw_family_name
) != ffi::FcResultMatch
@ -62,7 +62,7 @@ pub fn find_families(requested_family: &str) -> Vec<String> {
continue;
}
if let Some(family_name) =
std::ffi::CStr::from_ptr(raw_family_name as *const core::ffi::c_char)
std::ffi::CStr::from_ptr(raw_family_name as *const libc::c_char)
.to_str()
.ok()
.map(|raw_family_name| raw_family_name.to_owned())