From ba9bc30b79d792bf3f7941fea38a45743b8e5422 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 5 Dec 2020 14:19:47 -0800 Subject: [PATCH] harfbuzz: skip some unused bits don't bother building the coretext or uniscribe bits of harfbuzz --- deps/harfbuzz/build.rs | 19 ---------------- wezterm-font/src/hbwrap.rs | 46 -------------------------------------- 2 files changed, 65 deletions(-) diff --git a/deps/harfbuzz/build.rs b/deps/harfbuzz/build.rs index 3f954b191..82e80c567 100644 --- a/deps/harfbuzz/build.rs +++ b/deps/harfbuzz/build.rs @@ -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); diff --git a/wezterm-font/src/hbwrap.rs b/wezterm-font/src/hbwrap.rs index c0b1e85d1..a0636aae5 100644 --- a/wezterm-font/src/hbwrap.rs +++ b/wezterm-font/src/hbwrap.rs @@ -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 { 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