Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into hb-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
songww committed Mar 19, 2023
2 parents c5ee228 + e44d6f1 commit b94076b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
13 changes: 11 additions & 2 deletions harfbuzz-sys/Cargo.toml
Expand Up @@ -33,11 +33,20 @@ core-graphics = "0.22"
core-text = "19"
foreign-types = "0.3"

[target.'cfg(target_family = "windows")'.dependencies.winapi]
version = "0.3"
features = ["dwrite"]

[target.'cfg(any(target_os = "android", all(unix, not(target_vendor = "apple"))))'.dependencies]
freetype = { version = "0.7", default-features = false }

[dependencies.freetype]
version = "0.7"
default-features = false
optional = true

[features]
default = ["build-native-harfbuzz", "build-native-freetype"]
bindgen = ["bindgen_", "regex"]
build-native-harfbuzz = ["cc"]
build-native-freetype = ["freetype/freetype-sys"]
build-native-harfbuzz = ["cc", "pkg-config"]
build-native-freetype = ["freetype", "freetype/freetype-sys"]
4 changes: 4 additions & 0 deletions harfbuzz-sys/build.rs
Expand Up @@ -97,6 +97,10 @@ fn main() {
cfg.define("HAVE_CORETEXT", "1");
}

if target.contains("windows") {
cfg.define("HAVE_DIRECTWRITE", "1");
}

if target.contains("windows-gnu") {
cfg.flag("-Wa,-mbig-obj");
}
Expand Down
9 changes: 9 additions & 0 deletions harfbuzz-sys/src/directwrite.rs
@@ -0,0 +1,9 @@
extern crate winapi;

use hb_face_t;

use self::winapi::um::dwrite::IDWriteFontFace;

extern "C" {
pub fn hb_directwrite_face_create(font_face: *mut IDWriteFontFace) -> *mut hb_face_t;
}
7 changes: 5 additions & 2 deletions harfbuzz-sys/src/lib.rs
@@ -1,10 +1,13 @@
#[cfg(any(target_os = "android", all(unix, not(target_vendor = "apple"))))]
#[cfg(any(target_os = "android", all(unix, not(target_vendor = "apple")), feature="build-native-freetype"))]
extern crate freetype;

#[cfg(target_vendor = "apple")]
pub mod coretext;

#[cfg(any(target_os = "android", all(unix, not(target_vendor = "apple"))))]
#[cfg(target_family = "windows")]
pub mod directwrite;

#[cfg(any(target_os = "android", all(unix, not(target_vendor = "apple")), feature="build-native-freetype"))]
extern "C" {
pub fn hb_ft_font_create_referenced(face: freetype::freetype::FT_Face) -> *mut hb_font_t;
}
Expand Down

0 comments on commit b94076b

Please sign in to comment.