From 721f967b85a42cb4fa949bd742050c9903007863 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 26 Mar 2020 16:33:12 -0400 Subject: [PATCH] Update dwrote to 0.11.0. --- Cargo.lock | 18 ++++++++++++++---- webrender/Cargo.toml | 2 +- webrender/src/platform/windows/font.rs | 5 ++++- wrench/Cargo.toml | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7758842697..de93402774 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -447,7 +447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "dwrote" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -455,6 +455,7 @@ dependencies = [ "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1801,7 +1802,7 @@ dependencies = [ "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cstr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1941,6 +1942,14 @@ dependencies = [ "x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wr_malloc_size_of" version = "0.0.1" @@ -1961,7 +1970,7 @@ dependencies = [ "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", - "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "font-loader 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2094,7 +2103,7 @@ dependencies = [ "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" "checksum downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "18df8ce4470c189d18aa926022da57544f31e154631eb4cfe796aea97051fe6c" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" -"checksum dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bd1369e02db5e9b842a9b67bce8a2fcc043beafb2ae8a799dd482d46ea1ff0d" +"checksum dwrote 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a" "checksum euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4786521fec183792e755bf32cd0188e4e7628c6d0fcfd51426435b9081a106" @@ -2258,6 +2267,7 @@ dependencies = [ "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" "checksum winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d233301129ddd33260b47f76900b50e154b7254546e2edba0e5468a1a5fe4de3" +"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" "checksum ws 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6f5bb86663ff4d1639408410f50bf6050367a8525d644d49a6894cd618a631" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "940586acb859ea05c53971ac231685799a7ec1dee66ac0bccc0e6ad96e06b4e3" diff --git a/webrender/Cargo.toml b/webrender/Cargo.toml index cb051db475..b212a69960 100644 --- a/webrender/Cargo.toml +++ b/webrender/Cargo.toml @@ -62,7 +62,7 @@ freetype = { version = "0.4", default-features = false } libc = "0.2" [target.'cfg(target_os = "windows")'.dependencies] -dwrote = "0.9" +dwrote = "0.11" [target.'cfg(target_os = "macos")'.dependencies] core-foundation = "0.6" diff --git a/webrender/src/platform/windows/font.rs b/webrender/src/platform/windows/font.rs index 2ab2d7e678..7f39245bf5 100644 --- a/webrender/src/platform/windows/font.rs +++ b/webrender/src/platform/windows/font.rs @@ -36,6 +36,9 @@ struct CachedFont { file: dwrote::FontFile, } +// FontFile contains a ComPtr, but DWrite font files are threadsafe. +unsafe impl Send for CachedFont {} + impl PartialEq for CachedFont { fn eq(&self, other: &CachedFont) -> bool { self.key == other.key @@ -392,7 +395,7 @@ impl FontContext { .first() .map(|metrics| { let em_size = size / 16.; - let design_units_per_pixel = face.metrics().designUnitsPerEm as f32 / 16. as f32; + let design_units_per_pixel = face.metrics().metrics0().designUnitsPerEm as f32 / 16. as f32; let scaled_design_units_to_pixels = em_size / design_units_per_pixel; let advance = metrics.advanceWidth as f32 * scaled_design_units_to_pixels; diff --git a/wrench/Cargo.toml b/wrench/Cargo.toml index 5f16b129d0..d97da94a27 100644 --- a/wrench/Cargo.toml +++ b/wrench/Cargo.toml @@ -46,7 +46,7 @@ headless = [ "osmesa-sys", "osmesa-src" ] software = [ "swgl" ] [target.'cfg(target_os = "windows")'.dependencies] -dwrote = "0.9" +dwrote = "0.11" mozangle = {version = "0.3.1", features = ["egl"]} [target.'cfg(all(unix, not(target_os = "android")))'.dependencies]