Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
This updates all dependencies to their latest major versions.
  • Loading branch information
chrisduerr committed Oct 24, 2024
1 parent e9c6fa3 commit 118fe73
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- MSRV changed to 1.77.0
- **Breaking** yeslogic-fontconfig-sys bumped to 6.0.0
- **Breaking** freetype-rs bumped to 0.37.0

## 0.8.0

Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ foreign-types = "0.5"
log = "0.4"

[target.'cfg(not(any(target_os = "macos", windows)))'.dependencies]
yeslogic-fontconfig-sys = "5.0.0"
freetype-rs = "0.36.0"
yeslogic-fontconfig-sys = "6.0.0"
freetype-rs = "0.37.0"

[target.'cfg(not(any(target_os = "macos", windows)))'.build-dependencies]
pkg-config = "0.3"

[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.9.3"
core-text = "20.1.0"
core-graphics = "0.23.1"
core-foundation = "0.10.0"
core-text = "21.0.0"
core-graphics = "0.24.0"
core-foundation-sys = "0.8.4"
once_cell = "1.12"
objc2 = "0.5.1"
Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fn main() {
println!("cargo::rustc-check-cfg=cfg(ft_set_default_properties_available)");

// This libtool version maps to FreeType version 2.8.0, so we can use
// `FT_Set_Default_Properties`.
#[cfg(not(any(target_os = "macos", windows)))]
Expand Down
35 changes: 7 additions & 28 deletions src/ft/fc/pattern.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::ffi::{CStr, CString};
use std::fmt;
use std::mem;
use std::path::PathBuf;
use std::ptr::{self, NonNull};
use std::str;
Expand Down Expand Up @@ -45,11 +44,7 @@ impl<'a> StringPropertyIter<'a> {
};

if result == FcResultMatch {
// Transmute here is to extend lifetime of the str to that of the iterator.
//
// Potential unsafety? What happens if the pattern is modified while this ptr is
// borrowed out?
unsafe { mem::transmute(CStr::from_ptr(value as *const c_char).to_str().ok()?) }
unsafe { CStr::from_ptr(value as *const c_char).to_str().ok() }
} else {
None
}
Expand All @@ -63,7 +58,7 @@ pub struct BooleanPropertyIter<'a> {
index: usize,
}

impl<'a> BooleanPropertyIter<'a> {
impl BooleanPropertyIter<'_> {
fn new<'b>(pattern: &'b PatternRef, object: &'b [u8]) -> BooleanPropertyIter<'b> {
BooleanPropertyIter { pattern, object, index: 0 }
}
Expand Down Expand Up @@ -95,7 +90,7 @@ pub struct IntPropertyIter<'a> {
index: usize,
}

impl<'a> IntPropertyIter<'a> {
impl IntPropertyIter<'_> {
fn new<'b>(pattern: &'b PatternRef, object: &'b [u8]) -> IntPropertyIter<'b> {
IntPropertyIter { pattern, object, index: 0 }
}
Expand Down Expand Up @@ -200,7 +195,7 @@ pub struct DoublePropertyIter<'a> {
index: usize,
}

impl<'a> DoublePropertyIter<'a> {
impl DoublePropertyIter<'_> {
fn new<'b>(pattern: &'b PatternRef, object: &'b [u8]) -> DoublePropertyIter<'b> {
DoublePropertyIter { pattern, object, index: 0 }
}
Expand Down Expand Up @@ -552,26 +547,15 @@ impl PatternRef {
/// retained. That is, the CharSet can be safely dropped immediately
/// after being added to the pattern.
pub fn add_charset(&self, charset: &CharSetRef) -> bool {
unsafe {
FcPatternAddCharSet(
self.as_ptr(),
b"charset\0".as_ptr() as *mut c_char,
charset.as_ptr(),
) == 1
}
unsafe { FcPatternAddCharSet(self.as_ptr(), c"charset".as_ptr(), charset.as_ptr()) == 1 }
}

/// Get charset from the pattern.
pub fn get_charset(&self) -> Option<&CharSetRef> {
unsafe {
let mut charset = ptr::null_mut();

let result = FcPatternGetCharSet(
self.as_ptr(),
b"charset\0".as_ptr() as *mut c_char,
0,
&mut charset,
);
let result = FcPatternGetCharSet(self.as_ptr(), c"charset".as_ptr(), 0, &mut charset);

if result == FcResultMatch {
Some(&*(charset as *const CharSetRef))
Expand All @@ -585,12 +569,7 @@ impl PatternRef {
pub fn get_matrix(&self) -> Option<FcMatrix> {
unsafe {
let mut matrix = ptr::null_mut();
let result = FcPatternGetMatrix(
self.as_ptr(),
b"matrix\0".as_ptr() as *mut c_char,
0,
&mut matrix,
);
let result = FcPatternGetMatrix(self.as_ptr(), c"matrix".as_ptr(), 0, &mut matrix);

if result == FcResultMatch {
Some(*matrix)
Expand Down

0 comments on commit 118fe73

Please sign in to comment.