From c95f3b9d9edc8ac38963437d03e6300ca6f68140 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 1 Nov 2013 20:38:30 -0700 Subject: [PATCH 1/2] Update for the Core Foundation bindings revamp --- scaled_font.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scaled_font.rs b/scaled_font.rs index 66520b3..7ca350a 100644 --- a/scaled_font.rs +++ b/scaled_font.rs @@ -23,6 +23,7 @@ use scaled_font::android::*; #[cfg(target_os="macos")] pub mod macos { + extern mod core_foundation = "rust-core-foundation"; extern mod core_graphics = "rust-core-graphics"; extern mod core_text = "rust-core-text"; @@ -101,6 +102,7 @@ impl ScaledFont { pub fn new(backend: BackendType, native_font: &CGFont, size: AzFloat) -> ScaledFont { use azure::AZ_NATIVE_FONT_MAC_FONT_FACE; use azure_hl::{CoreGraphicsBackend,CoreGraphicsAcceleratedBackend}; + use scaled_font::macos::core_foundation::base::TCFType; let mut azure_native_font = struct__AzNativeFont { mType: 0, @@ -111,7 +113,7 @@ impl ScaledFont { CoreGraphicsBackend | CoreGraphicsAcceleratedBackend | SkiaBackend => { azure_native_font.mType = AZ_NATIVE_FONT_MAC_FONT_FACE; unsafe { - azure_native_font.mFont = cast::transmute(*native_font.contents.borrow_ref()); + azure_native_font.mFont = cast::transmute(native_font.as_concrete_TypeRef()); } } _ => { From b5d5554965404039528b4f0b1a32a6b519b21e70 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 8 Nov 2013 16:27:13 -0800 Subject: [PATCH 2/2] Update for multiprocess on Linux --- azure_hl.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure_hl.rs b/azure_hl.rs index 97842a0..30f146f 100644 --- a/azure_hl.rs +++ b/azure_hl.rs @@ -37,6 +37,7 @@ use layers::platform::surface::{NativeGraphicsMetadata, NativePaintingGraphicsCo use std::libc::types::common::c99::{uint8_t, uint16_t}; use std::libc::size_t; use std::cast; +use std::c_str::CString; use std::ptr; use std::ptr::{null, to_unsafe_ptr}; use std::vec; @@ -676,7 +677,10 @@ pub fn current_display() -> *c_void { pub fn current_graphics_metadata() -> NativeGraphicsMetadata { use xlib::xlib::XDisplayString; unsafe { - XDisplayString(current_display()) + let c_str = CString::new(XDisplayString(current_display()), false); + NativeGraphicsMetadata { + display: c_str.as_str().unwrap().to_str(), + } } }