From 025ed57c04b907c384511835a24456f901d00df5 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Mon, 5 Oct 2015 12:06:31 -0400 Subject: [PATCH] win32: use fontconfig/freetype on windows as well (for now) --- components/gfx/Cargo.toml | 6 ++++++ components/gfx/font_context.rs | 4 ++-- components/gfx/lib.rs | 9 ++++----- components/gfx/platform/freetype/font_list.rs | 7 +++++++ components/gfx/platform/mod.rs | 4 ++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index 4b731d76679..6350288e590 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -84,6 +84,9 @@ servo-fontconfig = "0.2" [target.arm-linux-androideabi.dependencies] servo-fontconfig = "0.2" +[target.x86_64-pc-windows-gnu.dependencies.fontconfig] +git = "https://github.com/servo/rust-fontconfig" + [target.i686-unknown-linux-gnu.dependencies.freetype] git = "https://github.com/servo/rust-freetype" @@ -99,6 +102,9 @@ git = "https://github.com/servo/rust-freetype" [target.arm-linux-androideabi.dependencies.freetype] git = "https://github.com/servo/rust-freetype" +[target.x86_64-pc-windows-gnu.dependencies.freetype] +git = "https://github.com/servo/rust-freetype" + [target.x86_64-unknown-linux-gnu.dependencies.simd] git = "https://github.com/huonw/simd" diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index 7f18c81cf67..1011d40112b 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -4,7 +4,7 @@ use app_units::Au; use azure::azure_hl::BackendType; -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] use azure::scaled_font::FontInfo; use azure::scaled_font::ScaledFont; use fnv::FnvHasher; @@ -30,7 +30,7 @@ use style::computed_values::{font_style, font_variant}; use util::cache::HashCache; use util::mem::HeapSizeOf; -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] fn create_scaled_font(template: &Arc, pt_size: Au) -> ScaledFont { ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes), pt_size.to_f32_px()) diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 6bc600d3d67..871e210f541 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -4,7 +4,7 @@ // For simd (currently x86_64/aarch64) #![cfg_attr(any(target_arch = "x86_64", target_arch = "aarch64"), feature(convert))] -#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(heap_api))] +#![cfg_attr(any(target_os = "linux", target_os = "android", target_os = "windows"), feature(heap_api))] #![feature(alloc)] #![feature(box_syntax)] @@ -34,10 +34,10 @@ extern crate canvas_traits; extern crate euclid; extern crate fnv; -// Linux and Android-specific library dependencies -#[cfg(any(target_os = "linux", target_os = "android"))] +// Platforms that use Freetype/Fontconfig library dependencies +#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] extern crate fontconfig; -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] extern crate freetype; extern crate gfx_traits; @@ -75,7 +75,6 @@ extern crate url; #[macro_use] extern crate util; - pub use paint_context::PaintContext; // Misc. diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs index e41f7c9fe26..3ec62008882 100644 --- a/components/gfx/platform/freetype/font_list.rs +++ b/components/gfx/platform/freetype/font_list.rs @@ -150,3 +150,10 @@ pub fn last_resort_font_families() -> Vec { pub fn last_resort_font_families() -> Vec { vec!("Roboto".to_owned()) } + +#[cfg(target_os = "windows")] +pub fn last_resort_font_families() -> Vec { + vec!( + "Arial".to_owned() + ) +} diff --git a/components/gfx/platform/mod.rs b/components/gfx/platform/mod.rs index 085da7cc932..729448c2586 100644 --- a/components/gfx/platform/mod.rs +++ b/components/gfx/platform/mod.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] pub use platform::freetype::{font, font_context, font_list, font_template}; #[cfg(target_os = "macos")] pub use platform::macos::{font, font_context, font_list, font_template}; -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] pub mod freetype { pub mod font; pub mod font_context;