From ed2e407df16a1f451eb6dad2f7c6a9dde308edb5 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 23 Mar 2019 11:53:45 -0700 Subject: [PATCH] enable harfbuzz on windows --- Cargo.toml | 2 +- deps/freetype/build.rs | 12 ++++++++++-- src/font/mod.rs | 3 --- src/font/rtype.rs | 2 -- src/font/system.rs | 3 --- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 26fca4544..b85df3894 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,9 +33,9 @@ varbincode = { path = "varbincode" } lazy_static = "1.3" leb128 = "0.2" zstd = "0.4" +harfbuzz = { path = "deps/harfbuzz" } [target.'cfg(unix)'.dependencies] -harfbuzz = { path = "deps/harfbuzz" } mio = "~0.6" mio-extras = "~2.0" diff --git a/deps/freetype/build.rs b/deps/freetype/build.rs index f626a4e6e..a5bece2b6 100644 --- a/deps/freetype/build.rs +++ b/deps/freetype/build.rs @@ -5,14 +5,22 @@ fn zlib() { let mut config = Config::new("zlib"); let dst = config.profile("Release").build(); println!("cargo:rustc-link-search=native={}/lib", dst.display()); - println!("cargo:rustc-link-lib=static=z"); + if cfg!(unix) { + println!("cargo:rustc-link-lib=static=z"); + } else { + println!("cargo:rustc-link-lib=static=zlibstatic"); + } } fn libpng() { let mut config = Config::new("libpng"); let dst = config.profile("Release").build(); println!("cargo:rustc-link-search=native={}/lib", dst.display()); - println!("cargo:rustc-link-lib=static=png"); + if cfg!(unix) { + println!("cargo:rustc-link-lib=static=png"); + } else { + println!("cargo:rustc-link-lib=static=libpng16_static"); + } } fn freetype() { diff --git a/src/font/mod.rs b/src/font/mod.rs index f32fb2803..0cd01309a 100644 --- a/src/font/mod.rs +++ b/src/font/mod.rs @@ -1,9 +1,7 @@ use failure::Error; use serde_derive::*; mod ftfont; -#[cfg(unix)] mod hbwrap; -#[cfg(unix)] use self::hbwrap as harfbuzz; use std::cell::RefCell; @@ -254,7 +252,6 @@ impl FontConfiguration { } #[allow(dead_code)] -#[cfg(unix)] pub fn shape_with_harfbuzz( font: &mut NamedFont, font_idx: system::FallbackIdx, diff --git a/src/font/rtype.rs b/src/font/rtype.rs index 202a1bf0e..b8f1b8850 100644 --- a/src/font/rtype.rs +++ b/src/font/rtype.rs @@ -1,6 +1,5 @@ //! Systems using rust native rasterizer -#[cfg(unix)] use super::hbwrap as harfbuzz; use crate::font::{Font, FontMetrics, RasterizedGlyph}; use failure::Error; @@ -56,7 +55,6 @@ fn bounds(g: &PositionedGlyph) -> Rect { } impl<'a> Font for RustTypeFontImpl<'a> { - #[cfg(unix)] fn harfbuzz_shape( &self, _buf: &mut harfbuzz::Buffer, diff --git a/src/font/system.rs b/src/font/system.rs index 403b95fb3..b368b5cc6 100644 --- a/src/font/system.rs +++ b/src/font/system.rs @@ -1,7 +1,6 @@ //! Abstracts over the font selection system for the system use super::super::config::{Config, TextStyle}; -#[cfg(unix)] use super::hbwrap as harfbuzz; use failure::Error; @@ -41,7 +40,6 @@ pub struct GlyphInfo { impl GlyphInfo { #[allow(dead_code)] - #[cfg(unix)] pub fn new( text: &str, font_idx: usize, @@ -121,7 +119,6 @@ pub trait Font { /// Perform shaping on the supplied harfbuzz buffer. /// This is really just a proxy for calling the harfbuzz::Font::shape() /// method on the contained harfbuzz font instance. - #[cfg(unix)] fn harfbuzz_shape( &self, buf: &mut harfbuzz::Buffer,