Skip to content

Commit deb2a5d

Browse files
authored
Add Harfbuzz bridge (#1312)
2 parents 3b602be + 7e62cb4 commit deb2a5d

9 files changed

Lines changed: 2320 additions & 16 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bridge_freetype2/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ links = "freetype2"
2222

2323
[dependencies]
2424
libc = "0.2"
25+
tectonic_bridge_png = { path = "../bridge_png", version = "0.0.0-dev.0" }
26+
tectonic_bridge_flate = { path = "../bridge_flate", version = "0.0.0-dev.0" }
2527

2628
[build-dependencies]
2729
tectonic_dep_support = { path = "../dep_support", version = "0.0.0-dev.0" }
2830

29-
[dev-dependencies]
30-
tectonic_bridge_png = { path = "../bridge_png", version = "0.0.0-dev.0" }
31-
tectonic_bridge_flate = { path = "../bridge_flate", version = "0.0.0-dev.0" }
32-
3331
[package.metadata.internal_dep_versions]
3432
tectonic_dep_support = "5faf4205bdd3d31101b749fc32857dd746f9e5bc"
3533
tectonic_bridge_png = "42a1f6a8027b2ef01436be16c6e1bc27918f293f"

crates/bridge_freetype2/src/lib.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ use std::{ptr, slice};
1717

1818
mod sys;
1919

20+
/// Import things from our bridge crates to ensure that we actually link with
21+
/// them.
22+
mod linkage {
23+
#[allow(unused_imports)]
24+
use tectonic_bridge_flate as clippyrenamehack1;
25+
#[allow(unused_imports)]
26+
use tectonic_bridge_png as clippyrenamehack2;
27+
}
28+
2029
pub use sys::FT_BBox as BBox;
2130
pub use sys::FT_Fixed as Fixed;
2231
pub use sys::FT_Glyph_BBox_Mode as BBoxMode;
@@ -610,22 +619,20 @@ impl Drop for Face {
610619
}
611620
}
612621

622+
// SAFETY: Functions that are not safe to share across threads (such as FT_Done_Face) are protected
623+
// by mutex to ensure they are only called once per thread.
624+
unsafe impl Send for Face {}
625+
// SAFETY: Functions that are not safe to share across threads (such as FT_Done_Face) are protected
626+
// by mutex to ensure they are only called once per thread.
627+
unsafe impl Sync for Face {}
628+
613629
#[cfg(test)]
614630
mod tests {
615631
use super::*;
616632
use std::ffi::CString;
617633
use std::fs;
618634
use std::path::{Path, PathBuf};
619635

620-
/// Import things from our bridge crates to ensure that we actually link with
621-
/// them.
622-
mod linkage {
623-
#[allow(unused_imports)]
624-
use tectonic_bridge_flate as clippyrenamehack1;
625-
#[allow(unused_imports)]
626-
use tectonic_bridge_png as clippyrenamehack2;
627-
}
628-
629636
fn assets_dir() -> PathBuf {
630637
Path::new(env!("CARGO_MANIFEST_DIR"))
631638
.join("../../tests/assets")

crates/bridge_harfbuzz/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,24 @@ links = "harfbuzz"
2222
exclude = ["/harfbuzz/docs/", "/harfbuzz/perf/", "/harfbuzz/test/"]
2323

2424
[dependencies]
25+
tectonic_bridge_freetype2 = { path = "../bridge_freetype2", version = "0.0.0-dev.0" }
2526
tectonic_bridge_graphite2 = { path = "../bridge_graphite2", version = "0.0.0-dev.0" }
27+
libc = "0.2"
2628

2729
[build-dependencies]
2830
cc = "^1.0.66"
2931
tectonic_dep_support = { path = "../dep_support", version = "0.0.0-dev.0" }
3032
tectonic_cfg_support = { path = "../cfg_support", version = "0.0.0-dev.0" }
3133

34+
[target.'cfg(target_os = "macos")'.dependencies]
35+
tectonic_mac_core = { path = "../mac_core", version = "0.0.0-dev.0" }
36+
3237
[features]
3338
external-harfbuzz = []
3439

3540
[package.metadata.internal_dep_versions]
41+
tectonic_bridge_freetype2 = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
3642
tectonic_bridge_graphite2 = "2722731f9e32c6963fe8c8566a201b33672c5c5a"
43+
tectonic_mac_core = "6932d5f15fec0fb5c219b887bdd11b72641af07a"
3744
tectonic_dep_support = "5faf4205bdd3d31101b749fc32857dd746f9e5bc"
3845
tectonic_cfg_support = "thiscommit:aeRoo7oa"

0 commit comments

Comments
 (0)