Skip to content

Commit

Permalink
Fontique: Use read-fonts instead of skrifa (#162)
Browse files Browse the repository at this point in the history
Fontique was previously depending on `skrifa` only to use it's re-export
of `read-fonts`. This PR makes `fontique` depend on `read-fonts`
directly.

I also bumped the versions of `skrifa` (parley still uses `skrifa`) and
`read-fonts` to the latest versions.
  • Loading branch information
nicoburns authored Nov 11, 2024
1 parent e8230d8 commit 0519176
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ fontique = { version = "0.2.0", default-features = false, path = "fontique" }
parley = { version = "0.2.0", default-features = false, path = "parley" }
peniko = { version = "0.2.0", default-features = false }
skrifa = { version = "0.22.3", default-features = false }
read-fonts = { version = "0.22.3", default-features = false }
swash = { version = "0.1.19", default-features = false }
6 changes: 3 additions & 3 deletions fontique/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ workspace = true

[features]
default = ["system"]
std = ["skrifa/std", "peniko/std", "dep:memmap2"]
libm = ["skrifa/libm", "peniko/libm", "dep:core_maths"]
std = ["read-fonts/std", "peniko/std", "dep:memmap2"]
libm = ["read-fonts/libm", "peniko/libm", "dep:core_maths"]
icu_properties = ["dep:icu_properties"]
unicode_script = ["dep:unicode-script"]
# Enables support for system font backends
system = ["std"]

[dependencies]
skrifa = { workspace = true }
read-fonts = { workspace = true }
peniko = { workspace = true }
smallvec = "1.13.2"
memmap2 = { version = "0.9.5", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion fontique/src/collection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use super::{
use alloc::{string::String, sync::Arc, vec::Vec};
use core::sync::atomic::AtomicU64;
use hashbrown::HashMap;
use read_fonts::types::NameId;
#[cfg(feature = "std")]
use std::sync::{atomic::Ordering, Mutex};

Expand Down Expand Up @@ -551,7 +552,6 @@ impl CommonData {
let mut family_name = String::default();
let data_id = SourceId::new();
super::scan::scan_memory(blob.as_ref(), |scanned_font| {
use skrifa::raw::types::NameId;
family_name.clear();
let family_chars = scanned_font
.english_or_first_name(NameId::TYPOGRAPHIC_FAMILY_NAME)
Expand Down
4 changes: 2 additions & 2 deletions fontique/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use super::attributes::{Stretch, Style, Weight};
use super::source::{SourceInfo, SourceKind};
use super::{source_cache::SourceCache, Blob};
use skrifa::raw::{types::Tag, FontRef, TableProvider as _};
use read_fonts::{types::Tag, FontRef, TableProvider as _};
use smallvec::SmallVec;

type AxisVec = SmallVec<[AxisInfo; 1]>;
Expand Down Expand Up @@ -332,7 +332,7 @@ impl Synthesis {
}

fn read_attributes(font: &FontRef) -> (Stretch, Style, Weight) {
use skrifa::raw::{
use read_fonts::{
tables::{
head::{Head, MacStyle},
os2::{Os2, SelectionFlags},
Expand Down
2 changes: 1 addition & 1 deletion fontique/src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::{
};
use alloc::string::String;
use hashbrown::HashMap;
use skrifa::raw::{tables::name, types::NameId, FileRef, FontRef, TableProvider as _};
use read_fonts::{tables::name, types::NameId, FileRef, FontRef, TableProvider as _};
use smallvec::SmallVec;
#[cfg(feature = "std")]
use {super::source::SourcePathMap, std::path::Path};
Expand Down

0 comments on commit 0519176

Please sign in to comment.