Skip to content

Upgrade core foundation #2299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 65 additions & 79 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions webrender/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "webrender"
version = "0.56.1"
version = "0.57.0"
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
license = "MPL-2.0"
repository = "https://github.com/servo/webrender"
Expand Down Expand Up @@ -42,7 +42,7 @@ ron = { optional = true, version = "0.1.7" }
angle = {git = "https://github.com/servo/angle", branch = "servo"}
env_logger = "0.4"
rand = "0.3" # for the benchmarks
servo-glutin = "0.13" # for the example apps
servo-glutin = "0.14" # for the example apps

[target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies]
freetype = { version = "0.3", default-features = false }
Expand All @@ -51,6 +51,6 @@ freetype = { version = "0.3", default-features = false }
dwrote = "0.4.1"

[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.4.6"
core-graphics = "0.12.3"
core-text = { version = "8.0", default-features = false }
core-foundation = "0.5"
core-graphics = "0.13"
core-text = { version = "9.0", default-features = false }
19 changes: 9 additions & 10 deletions webrender/src/platform/macos/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use api::{GlyphKey, SubpixelDirection};
use app_units::Au;
use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::base::TCFType;
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
use core_foundation::dictionary::CFDictionary;
use core_foundation::number::{CFNumber, CFNumberRef};
use core_foundation::string::{CFString, CFStringRef};
use core_graphics::base::{kCGImageAlphaNoneSkipFirst, kCGImageAlphaPremultipliedFirst};
Expand Down Expand Up @@ -171,17 +171,16 @@ fn new_ct_font_with_variations(cg_font: &CGFont, size: f64, variations: &[FontVa
if axes_ref.is_null() {
return ct_font;
}
let axes: CFArray = TCFType::wrap_under_create_rule(axes_ref);
let axes: CFArray<CFDictionary> = TCFType::wrap_under_create_rule(axes_ref);
let mut vals: Vec<(CFString, CFNumber)> = Vec::with_capacity(variations.len() as usize);
for axis_ptr in axes.iter() {
let axis: CFDictionary = TCFType::wrap_under_get_rule(axis_ptr as CFDictionaryRef);
if !axis.instance_of::<CFDictionaryRef, CFDictionary>() {
for axis in axes.iter() {
if !axis.instance_of::<CFDictionary>() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this check is needed. Well, if it's not needed now it was not needed before either, so maybe it covers some case I don't know about. But the documentation for CTFontCopyVariationAxes states that it returns an array of dictionaries, so not sure what item in the array might trigger this if branch.

return ct_font;
}
let tag_val = match axis.find(kCTFontVariationAxisIdentifierKey as *const _) {
Some(tag_ptr) => {
let tag: CFNumber = TCFType::wrap_under_get_rule(tag_ptr as CFNumberRef);
if !tag.instance_of::<CFNumberRef, CFNumber>() {
if !tag.instance_of::<CFNumber>() {
return ct_font;
}
match tag.to_i64() {
Expand All @@ -200,14 +199,14 @@ fn new_ct_font_with_variations(cg_font: &CGFont, size: f64, variations: &[FontVa
Some(name_ptr) => TCFType::wrap_under_get_rule(name_ptr as CFStringRef),
None => return ct_font,
};
if !name.instance_of::<CFStringRef, CFString>() {
if !name.instance_of::<CFString>() {
return ct_font;
}

let min_val = match axis.find(kCTFontVariationAxisMinimumValueKey as *const _) {
Some(min_ptr) => {
let min: CFNumber = TCFType::wrap_under_get_rule(min_ptr as CFNumberRef);
if !min.instance_of::<CFNumberRef, CFNumber>() {
if !min.instance_of::<CFNumber>() {
return ct_font;
}
match min.to_f64() {
Expand All @@ -220,7 +219,7 @@ fn new_ct_font_with_variations(cg_font: &CGFont, size: f64, variations: &[FontVa
let max_val = match axis.find(kCTFontVariationAxisMaximumValueKey as *const _) {
Some(max_ptr) => {
let max: CFNumber = TCFType::wrap_under_get_rule(max_ptr as CFNumberRef);
if !max.instance_of::<CFNumberRef, CFNumber>() {
if !max.instance_of::<CFNumber>() {
return ct_font;
}
match max.to_f64() {
Expand All @@ -233,7 +232,7 @@ fn new_ct_font_with_variations(cg_font: &CGFont, size: f64, variations: &[FontVa
let def_val = match axis.find(kCTFontVariationAxisDefaultValueKey as *const _) {
Some(def_ptr) => {
let def: CFNumber = TCFType::wrap_under_get_rule(def_ptr as CFNumberRef);
if !def.instance_of::<CFNumberRef, CFNumber>() {
if !def.instance_of::<CFNumber>() {
return ct_font;
}
match def.to_f64() {
Expand Down
6 changes: 3 additions & 3 deletions webrender_api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "webrender_api"
version = "0.56.1"
version = "0.57.0"
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
license = "MPL-2.0"
repository = "https://github.com/servo/webrender"
Expand All @@ -22,8 +22,8 @@ serde_derive = { version = "=1.0.27", features = ["deserialize_in_place"] }
time = "0.1"

[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.4.6"
core-graphics = "0.12.3"
core-foundation = "0.5"
core-graphics = "0.13"

[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.4.1"
10 changes: 5 additions & 5 deletions wrench/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wrench"
version = "0.2.6"
version = "0.3.0"
authors = ["Vladimir Vukicevic <vladimir@pobox.com>"]
build = "build.rs"
license = "MPL-2.0"
Expand All @@ -12,7 +12,7 @@ byteorder = "1.0"
env_logger = { version = "0.4", optional = true }
euclid = "0.16"
gleam = "0.4"
servo-glutin = "0.13"
servo-glutin = "0.14"
app_units = "0.6"
image = "0.17"
clap = { version = "2", features = ["yaml"] }
Expand All @@ -30,8 +30,8 @@ webrender_api = {path = "../webrender_api", features=["debug-serialization"]}
serde = {version = "1.0", features = ["derive"] }

[target.'cfg(target_os = "macos")'.dependencies]
core-graphics = "0.12.4"
core-foundation = "0.4"
core-graphics = "0.13"
core-foundation = "0.5"

[features]
headless = [ "osmesa-sys", "osmesa-src" ]
Expand All @@ -41,4 +41,4 @@ logging = [ "env_logger" ]
dwrote = "0.4.1"

[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
font-loader = "0.5"
font-loader = "0.6"
3 changes: 2 additions & 1 deletion wrench/src/cgfont_to_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ pub fn font_to_data(font: CGFont) -> Result<Vec<u8>, std::io::Error> {
let mut offset: u32 = 0;
offset += 4 * 3;
offset += 4 * 4 * (count as u32);
for tag in tags.iter() {
for tag_ref in tags.iter() {
let tag = *tag_ref;
if tag == CFF_TAG {
cff = true;
}
Expand Down