From 25e708fd11e09cc02286e6cf7f064620c0cda672 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 21 Jul 2018 12:54:38 -0400 Subject: [PATCH] Bug 1477400. Update Cargo lockfiles and re-vendor rust dependencies --- Cargo.lock | 18 ++++---- .../rust/core-graphics/.cargo-checksum.json | 2 +- third_party/rust/core-graphics/Cargo.toml | 3 +- third_party/rust/core-graphics/src/base.rs | 6 +++ third_party/rust/core-graphics/src/context.rs | 3 +- .../rust/core-graphics/src/data_provider.rs | 13 +++++- third_party/rust/core-graphics/src/event.rs | 2 + third_party/rust/core-graphics/src/image.rs | 45 ++++++++++++++++++- third_party/rust/core-graphics/src/path.rs | 2 +- .../rust/core-text/.cargo-checksum.json | 2 +- third_party/rust/core-text/Cargo.toml | 4 +- third_party/rust/core-text/src/font.rs | 17 +++++-- .../rust/core-text/src/font_collection.rs | 2 +- .../rust/core-text/src/font_descriptor.rs | 2 +- 14 files changed, 98 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7b432eaa35f..59ffdab670bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -349,7 +349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "core-graphics" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -360,11 +360,11 @@ dependencies = [ [[package]] name = "core-text" -version = "10.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2346,8 +2346,8 @@ dependencies = [ "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-text 10.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2375,7 +2375,7 @@ dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2391,7 +2391,7 @@ dependencies = [ "app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2560,8 +2560,8 @@ dependencies = [ "checksum cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "746858cae4eae40fff37e1998320068df317bc247dc91a67c6cfa053afdc2abb" "checksum core-foundation 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7caa6cb9e76ddddbea09a03266d6b3bc98cd41e9fb9b017c473e7cca593ec25" "checksum core-foundation-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b2a53cce0ddcf7e7e1f998738d757d5a3bf08bf799a180e50ebe50d298f52f5a" -"checksum core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e54c4ab33705fa1fc8af375bb7929d68e1c1546c1ecef408966d8c3e49a1d84a" -"checksum core-text 10.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f59bff773954e5cd058a3f5983406b52bec7cc65202bef340ba64a0c40ac91" +"checksum core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055" +"checksum core-text 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "157ff38a92496dc676ce36d9124554e9ac66f1c1039f952690ac64f71cfa5968" "checksum cose 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72fa26cb151d3ae4b70f63d67d0fed57ce04220feafafbae7f503bef7aae590d" "checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94" "checksum crc 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5d02c0aac6bd68393ed69e00bbc2457f3e89075c6349db7189618dc4ddc1d7" diff --git a/third_party/rust/core-graphics/.cargo-checksum.json b/third_party/rust/core-graphics/.cargo-checksum.json index 84aa6f9c1d48..4c8bbbb5b779 100644 --- a/third_party/rust/core-graphics/.cargo-checksum.json +++ b/third_party/rust/core-graphics/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"8858a9ce62839ea4f8addacfb0d228d8ae1f015a0c233d38afe68eb72763aa18","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"10f3eeae06c6dd25cdf3e11b7e2fbbe5d003469ebb4aa1b069625a1637633879","src/color_space.rs":"bada04ad391869474428070ad9ae5dbb5e7f5e03646226fab0b03e8e84240bfa","src/context.rs":"601cb85abd122422abdbcbd8f6116ee4622009aee717cb478f6f0937d481b212","src/data_provider.rs":"78e9fc5c1c609bfb6a29136cd334575b77c6f4c994e444291dbccc52cfd35363","src/display.rs":"3ca38e1ff0200409c95941fcb64afa043310d1c0855c7614fd236c4f83e5a343","src/event.rs":"551a228faa5a938928ee6f7030a2bfc1e40574a93e80eccaea31e3c3ff348e15","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"63b7e50243a56254c800421df586abee59aead84f735f7df838ae04693aedf4b","src/geometry.rs":"b94e50a16b8540dc6f37bfe4b1549ac68974cd6ba6c0bbd9209559f8a46d86eb","src/image.rs":"fb77ae359b918cf3341662cb858cde6111eaa358f60fdd1ebbf264e023d25401","src/lib.rs":"19d5e558cec5596d546f1753529a8e3cf951993f4500ee12fad0d7eb2dc86bc8","src/path.rs":"d8dccd0bc2a1888a0a598fcca25067e932451e220dbec75999982cef9477d3ab","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"27e00f7ad7645af05014f35939128833456cac766a2978c5da295c3757708a86"},"package":"e54c4ab33705fa1fc8af375bb7929d68e1c1546c1ecef408966d8c3e49a1d84a"} \ No newline at end of file +{"files":{".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"e191715db0c5bf37d5981f2a3b7ae5d0e53ab9cc39f2438d31e798b1fbf3ddec","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"5faaadaf17d93c370a20f358be6c3f12958ab7d3f99ccc634421e28758fec88b","src/color_space.rs":"bada04ad391869474428070ad9ae5dbb5e7f5e03646226fab0b03e8e84240bfa","src/context.rs":"6cc8d083eea0d73ece30c1c405a74b43ca3f3a8f55917cdcd27c238a393f3de2","src/data_provider.rs":"258fef8d18ba4a79e7dbe7c23a41401924efa0c159e178f0bd9fa7c4ff9f131a","src/display.rs":"3ca38e1ff0200409c95941fcb64afa043310d1c0855c7614fd236c4f83e5a343","src/event.rs":"f2ade1c2c112bae7bc4f5df1eda63c13d1c32e5db255228f139ce17fb37c1a4b","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"63b7e50243a56254c800421df586abee59aead84f735f7df838ae04693aedf4b","src/geometry.rs":"b94e50a16b8540dc6f37bfe4b1549ac68974cd6ba6c0bbd9209559f8a46d86eb","src/image.rs":"40e744f28ef338b4c0138e05e0e191411518611bedb19deea2aa3a6e59f36567","src/lib.rs":"19d5e558cec5596d546f1753529a8e3cf951993f4500ee12fad0d7eb2dc86bc8","src/path.rs":"405032914ef806ac2d2e0ccda5987ed3176bfec0e2e8bd409b176a9c23f49885","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"27e00f7ad7645af05014f35939128833456cac766a2978c5da295c3757708a86"},"package":"92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055"} \ No newline at end of file diff --git a/third_party/rust/core-graphics/Cargo.toml b/third_party/rust/core-graphics/Cargo.toml index 432e11654f1b..7524dfed3b91 100644 --- a/third_party/rust/core-graphics/Cargo.toml +++ b/third_party/rust/core-graphics/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "core-graphics" -version = "0.14.0" +version = "0.16.0" authors = ["The Servo Project Developers"] description = "Bindings to Core Graphics for OS X" homepage = "https://github.com/servo/core-graphics-rs" @@ -33,3 +33,4 @@ version = "0.2" [features] default = [] elcapitan = [] +highsierra = [] diff --git a/third_party/rust/core-graphics/src/base.rs b/third_party/rust/core-graphics/src/base.rs index f5c954d81718..e7b7a198611e 100644 --- a/third_party/rust/core-graphics/src/base.rs +++ b/third_party/rust/core-graphics/src/base.rs @@ -42,6 +42,12 @@ pub const kCGBitmapByteOrder32Little: u32 = (2 << 12); pub const kCGBitmapByteOrder16Big: u32 = (3 << 12); pub const kCGBitmapByteOrder32Big: u32 = (4 << 12); +pub const kCGRenderingIntentDefault: u32 = 0; +pub const kCGRenderingIntentAbsoluteColorimetric: u32 = 1; +pub const kCGRenderingIntentRelativeColorimetric: u32 = 2; +pub const kCGRenderingIntentPerceptual: u32 = 3; +pub const kCGRenderingIntentSaturation: u32 = 4; + #[cfg(target_endian = "big")] pub const kCGBitmapByteOrder16Host: u32 = kCGBitmapByteOrder16Big; #[cfg(target_endian = "big")] diff --git a/third_party/rust/core-graphics/src/context.rs b/third_party/rust/core-graphics/src/context.rs index 2030b0f5e327..5f36b24f4386 100644 --- a/third_party/rust/core-graphics/src/context.rs +++ b/third_party/rust/core-graphics/src/context.rs @@ -12,7 +12,8 @@ use color_space::CGColorSpace; use core_foundation::base::{CFRelease, CFRetain, CFTypeID}; use font::{CGFont, CGGlyph}; use geometry::CGPoint; -use libc::{c_void, c_int, size_t}; +use libc::{c_int, size_t}; +use std::os::raw::c_void; use std::cmp; use std::ptr; diff --git a/third_party/rust/core-graphics/src/data_provider.rs b/third_party/rust/core-graphics/src/data_provider.rs index 9a104968d5f9..9a50b297d2fa 100644 --- a/third_party/rust/core-graphics/src/data_provider.rs +++ b/third_party/rust/core-graphics/src/data_provider.rs @@ -10,9 +10,11 @@ use core_foundation::base::{CFRelease, CFRetain, CFTypeID, TCFType}; use core_foundation::data::{CFData, CFDataRef}; -use libc::{c_void, size_t, off_t}; +use libc::{size_t, off_t}; use std::mem; +use std::ptr; use std::sync::Arc; +use std::os::raw::c_void; use foreign_types::{ForeignType, ForeignTypeRef}; @@ -61,6 +63,15 @@ impl CGDataProvider { drop(mem::transmute::<*mut c_void, Arc>>(info)) } } + + /// Creates a data prvider from a given slice. The data provider does not own the slice in this + /// case, so it's up to the user to ensure the memory safety here. + pub unsafe fn from_slice(buffer: &[u8]) -> Self { + let ptr = buffer.as_ptr() as *const c_void; + let len = buffer.len() as size_t; + let result = CGDataProviderCreateWithData(ptr::null_mut(), ptr, len, None); + CGDataProvider::from_ptr(result) + } } impl CGDataProviderRef { diff --git a/third_party/rust/core-graphics/src/event.rs b/third_party/rust/core-graphics/src/event.rs index 7f16b97e8590..9d9ca18d843a 100644 --- a/third_party/rust/core-graphics/src/event.rs +++ b/third_party/rust/core-graphics/src/event.rs @@ -443,6 +443,7 @@ impl CGEvent { } } + #[cfg(feature = "highsierra")] pub fn new_scroll_event( source: CGEventSource, units: CGScrollEventUnit, @@ -584,6 +585,7 @@ extern { /// /// This function allows you to create a scrolling event and customize the /// event before posting it to the event system. + #[cfg(feature = "highsierra")] fn CGEventCreateScrollWheelEvent2( source: ::sys::CGEventSourceRef, units: CGScrollEventUnit, diff --git a/third_party/rust/core-graphics/src/image.rs b/third_party/rust/core-graphics/src/image.rs index 93eb807f5acf..32173351e1ca 100644 --- a/third_party/rust/core-graphics/src/image.rs +++ b/third_party/rust/core-graphics/src/image.rs @@ -1,7 +1,10 @@ +use std::ptr; + +use base::CGFloat; use core_foundation::base::{CFRetain, CFTypeID}; use core_foundation::data::CFData; use color_space::CGColorSpace; -use data_provider::CGDataProviderRef; +use data_provider::{CGDataProviderRef, CGDataProvider}; use libc::size_t; use foreign_types::{ForeignType, ForeignTypeRef}; @@ -36,6 +39,34 @@ foreign_type! { } impl CGImage { + pub fn new(width: size_t, + height: size_t, + bits_per_component: size_t, + bits_per_pixel: size_t, + bytes_per_row: size_t, + colorspace: &CGColorSpace, + bitmap_info: u32, + provider: &CGDataProvider, + should_interpolate: bool, + rendering_intent: u32) + -> Self { + unsafe { + let result = CGImageCreate(width, + height, + bits_per_component, + bits_per_pixel, + bytes_per_row, + colorspace.as_ptr(), + bitmap_info, + provider.as_ptr(), + ptr::null_mut(), + should_interpolate, + rendering_intent); + assert!(!result.is_null()); + Self::from_ptr(result) + } + } + pub fn type_id() -> CFTypeID { unsafe { CGImageGetTypeID() @@ -103,6 +134,18 @@ extern { fn CGImageGetColorSpace(image: ::sys::CGImageRef) -> ::sys::CGColorSpaceRef; fn CGImageGetDataProvider(image: ::sys::CGImageRef) -> ::sys::CGDataProviderRef; fn CGImageRelease(image: ::sys::CGImageRef); + fn CGImageCreate(width: size_t, + height: size_t, + bitsPerComponent: size_t, + bitsPerPixel: size_t, + bytesPerRow: size_t, + space: ::sys::CGColorSpaceRef, + bitmapInfo: u32, + provider: ::sys::CGDataProviderRef, + decode: *const CGFloat, + shouldInterpolate: bool, + intent: u32) + -> ::sys::CGImageRef; //fn CGImageGetAlphaInfo(image: ::sys::CGImageRef) -> CGImageAlphaInfo; //fn CGImageCreateCopyWithColorSpace(image: ::sys::CGImageRef, space: ::sys::CGColorSpaceRef) -> ::sys::CGImageRef diff --git a/third_party/rust/core-graphics/src/path.rs b/third_party/rust/core-graphics/src/path.rs index 4e60c59f0037..f25c618b3758 100644 --- a/third_party/rust/core-graphics/src/path.rs +++ b/third_party/rust/core-graphics/src/path.rs @@ -10,7 +10,7 @@ use core_foundation::base::{CFRelease, CFRetain, CFTypeID}; use foreign_types::ForeignType; use geometry::CGPoint; -use libc::c_void; +use std::os::raw::c_void; use std::fmt::{self, Debug, Formatter}; use std::marker::PhantomData; use std::ops::Deref; diff --git a/third_party/rust/core-text/.cargo-checksum.json b/third_party/rust/core-text/.cargo-checksum.json index 0e3e659ccf45..a53f3243c768 100644 --- a/third_party/rust/core-text/.cargo-checksum.json +++ b/third_party/rust/core-text/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"78c71afee9b093b27d65bb9acef96349c9a172b111bd29a84015cd25ac70f1e1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"446485c979c0c0fed05750970b665976c7297e08207bf5ee75c2bf922bba2427","src/font_collection.rs":"b2697e5212639eb6746546893e13604766b2a1adc3918cac0481ed856fc4843f","src/font_descriptor.rs":"171b8a43f555960ae93ef0e608a83111e13d698702c1808cfee0dcdba53f94ed","src/font_manager.rs":"de5e22620528322d6811d01f03975c53b676ec743297590de5e17a45393df0f1","src/lib.rs":"bd072cf53ebb643e4d21379d4487e60745999d20eab9caee8e56daa430cb65ca"},"package":"81f59bff773954e5cd058a3f5983406b52bec7cc65202bef340ba64a0c40ac91"} \ No newline at end of file +{"files":{".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"671ed3c074224599fe05a7ab61a48c305842c9fc60e0dd486f4363bd4521fb8e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"1f747432402a00e7fc70227a5c0c49463638137fc804e2eb3c8fc74908b0875f","src/font_collection.rs":"e7e2facf1f5ec0661d61c230f84d6821e513315d7e311d2077443fb4e83c6f5d","src/font_descriptor.rs":"03439b11628c4aa5b8ac4aa68de25a2dd9da442755c0d91964170aca4a18c6d7","src/font_manager.rs":"de5e22620528322d6811d01f03975c53b676ec743297590de5e17a45393df0f1","src/lib.rs":"bd072cf53ebb643e4d21379d4487e60745999d20eab9caee8e56daa430cb65ca"},"package":"157ff38a92496dc676ce36d9124554e9ac66f1c1039f952690ac64f71cfa5968"} \ No newline at end of file diff --git a/third_party/rust/core-text/Cargo.toml b/third_party/rust/core-text/Cargo.toml index 639f5c57c36a..1d33612dab51 100644 --- a/third_party/rust/core-text/Cargo.toml +++ b/third_party/rust/core-text/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "core-text" -version = "10.0.0" +version = "11.0.0" authors = ["The Servo Project Developers"] description = "Bindings to the Core Text framework." license = "MIT/Apache-2.0" @@ -21,7 +21,7 @@ repository = "https://github.com/servo/core-foundation-rs" version = "0.6" [dependencies.core-graphics] -version = "0.14" +version = "0.16" [dependencies.foreign-types] version = "0.3" diff --git a/third_party/rust/core-text/src/font.rs b/third_party/rust/core-text/src/font.rs index 45d8b3553c48..128120c3ade8 100644 --- a/third_party/rust/core-text/src/font.rs +++ b/third_party/rust/core-text/src/font.rs @@ -14,7 +14,7 @@ use font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; use font_descriptor::{CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors}; use core_foundation::array::{CFArray, CFArrayRef}; -use core_foundation::base::{CFIndex, CFOptionFlags, CFTypeID, CFTypeRef, TCFType}; +use core_foundation::base::{CFIndex, CFOptionFlags, CFType, CFTypeID, CFTypeRef, TCFType}; use core_foundation::data::{CFData, CFDataRef}; use core_foundation::dictionary::{CFDictionary, CFDictionaryRef}; use core_foundation::number::CFNumber; @@ -27,7 +27,8 @@ use core_graphics::geometry::{CGAffineTransform, CGPoint, CGRect, CGSize}; use core_graphics::path::CGPath; use foreign_types::ForeignType; -use libc::{self, size_t, c_void}; +use libc::{self, size_t}; +use std::os::raw::c_void; use std::ptr; type CGContextRef = *mut ::CType; @@ -316,6 +317,16 @@ impl CTFont { } } + pub fn get_variation_axes(&self) -> Option>> { + unsafe { + let axes = CTFontCopyVariationAxes(self.0); + if axes.is_null() { + return None; + } + Some(TCFType::wrap_under_create_rule(axes)) + } + } + pub fn create_path_for_glyph(&self, glyph: CGGlyph, matrix: &CGAffineTransform) -> Result { unsafe { @@ -491,7 +502,7 @@ extern { //fn CTFontGetVerticalTranslationsForGlyphs /* Working With Font Variations */ - //fn CTFontCopyVariationAxes + fn CTFontCopyVariationAxes(font: CTFontRef) -> CFArrayRef; //fn CTFontCopyVariation /* Getting Font Features */ diff --git a/third_party/rust/core-text/src/font_collection.rs b/third_party/rust/core-text/src/font_collection.rs index 76da27beecc2..0d9b51aa1f94 100644 --- a/third_party/rust/core-text/src/font_collection.rs +++ b/third_party/rust/core-text/src/font_collection.rs @@ -18,7 +18,7 @@ use core_foundation::number::CFNumber; use core_foundation::set::CFSet; use core_foundation::string::{CFString, CFStringRef}; -use libc::c_void; +use std::os::raw::c_void; #[repr(C)] pub struct __CTFontCollection(c_void); diff --git a/third_party/rust/core-text/src/font_descriptor.rs b/third_party/rust/core-text/src/font_descriptor.rs index 27e57febbee7..b00a9f82380f 100644 --- a/third_party/rust/core-text/src/font_descriptor.rs +++ b/third_party/rust/core-text/src/font_descriptor.rs @@ -18,7 +18,7 @@ use core_foundation::string::{CFString, CFStringRef}; use core_foundation::url::CFURL; use core_graphics::base::CGFloat; -use libc::c_void; +use std::os::raw::c_void; use std::mem; use std::path::PathBuf;