harfbuzz: skip some unused bits

don't bother building the coretext or uniscribe bits of harfbuzz
This commit is contained in:
Wez Furlong committed 2020-12-05 14:19:47 -08:00
1 parent 0fa2edb1f4
commit ba9bc30b79
2 files changed
-65

No files matched your search

-19
View File
@@ -95,25 +95,6 @@ fn harfbuzz() {
cfg.define("HAVE_FT_Set_Var_Blend_Coordinates", Some("1"));
cfg.define("HAVE_FT_Done_MM_Var", Some("1"));
if target.contains("darwin") {
cfg.define("HAVE_CORETEXT", None);
cfg.file("harfbuzz/src/hb-coretext.cc");
}
if target.contains("windows") {
cfg.define("HAVE_DIRECTWRITE", None);
cfg.file("harfbuzz/src/hb-directwrite.cc");
println!("cargo:rustc-link-lib=dwrite");
cfg.define("HAVE_UNISCRIBE", None);
cfg.file("harfbuzz/src/hb-uniscribe.cc");
println!("cargo:rustc-link-lib=usp10");
println!("cargo:rustc-link-lib=gdi32");
println!("cargo:rustc-link-lib=rpcrt4");
println!("cargo:rustc-link-lib=user32");
}
// Import the include dirs exported from deps/freetype/build.rs
for inc in std::env::var("DEP_FREETYPE_INCLUDE").unwrap().split(";") {
cfg.include(inc);
-46
View File
@@ -1,7 +1,5 @@
//! Higher level harfbuzz bindings
#![allow(dead_code)]
#[cfg(target_os = "macos")]
use core_text::font::{CTFont, CTFontRef};
use freetype;
pub use harfbuzz::*;
@@ -15,31 +13,6 @@ use std::slice;
extern "C" {
fn hb_ft_font_set_load_flags(font: *mut hb_font_t, load_flags: i32);
}
#[cfg(windows)]
extern "C" {
fn hb_directwrite_face_create(face: *mut winapi::um::dwrite::IDWriteFontFace)
-> *mut hb_font_t;
}
#[cfg(target_os = "macos")]
extern "C" {
fn hb_coretext_font_create(ct_font: CTFontRef) -> *mut hb_font_t;
/*
HB_EXTERN hb_face_t *
hb_coretext_face_create (CGFontRef cg_font);
HB_EXTERN hb_font_t *
hb_coretext_font_create (CTFontRef ct_font);
HB_EXTERN CGFontRef
hb_coretext_face_get_cg_font (hb_face_t *face);
HB_EXTERN CTFontRef
hb_coretext_font_get_ct_font (hb_font_t *font);
*/
}
pub fn language_from_string(s: &str) -> Result<hb_language_t, Error> {
unsafe {
@@ -140,25 +113,6 @@ impl Font {
font: unsafe { hb_ft_font_create_referenced(face as _) },
}
}
#[cfg(target_os = "macos")]
/// Create a harfbuzz face from a freetype font
pub fn new_coretext(ct_font: &CTFont) -> Font {
// hb_ft_font_create_referenced always returns a
// pointer to something, or derefs a nullptr internally
// if everything fails, so there's nothing for us to
// test here.
use core_foundation::base::TCFType;
Font {
font: unsafe { hb_coretext_font_create(ct_font.as_concrete_TypeRef()) },
}
}
#[cfg(windows)]
pub fn new_directwrite(face: &dwrote::FontFace) -> Font {
Font {
font: unsafe { hb_directwrite_face_create(face.as_ptr()) },
}
}
/// Create a font from raw data
/// Harfbuzz doesn't know how to interpret this without registering