win32: use fontconfig/freetype on windows as well (for now)

This commit is contained in:
Vladimir Vukicevic 2015-10-05 12:06:31 -04:00 committed by Lars Bergstrom
parent 6663f28f0d
commit 025ed57c04
5 changed files with 21 additions and 9 deletions

View file

@ -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"

View file

@ -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<FontTemplateData>, pt_size: Au) -> ScaledFont {
ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes),
pt_size.to_f32_px())

View file

@ -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.

View file

@ -150,3 +150,10 @@ pub fn last_resort_font_families() -> Vec<String> {
pub fn last_resort_font_families() -> Vec<String> {
vec!("Roboto".to_owned())
}
#[cfg(target_os = "windows")]
pub fn last_resort_font_families() -> Vec<String> {
vec!(
"Arial".to_owned()
)
}

View file

@ -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;