Update for language changes

This commit is contained in:
Patrick Walton
2012-12-13 18:39:35 -08:00
parent 87af01643f
commit e777e17f05
4 changed files with 45 additions and 126 deletions
+12 -55
View File
@@ -1,62 +1,19 @@
extern mod core_foundation;
extern mod core_graphics;
use libc::c_uint;
use font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation};
use font_descriptor::{CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors};
use font_descriptor::{
CTFontDescriptorRef,
CTFontOrientation,
CTFontSymbolicTraits,
CTFontTraits,
SymbolicTraitAccessors,
TraitAccessors,
};
use cf = core_foundation;
use cf::array::{
CFArrayRef,
};
use cf::base::{
AbstractCFTypeRef,
CFIndex,
CFOptionFlags,
CFTypeID,
CFTypeRef,
CFWrapper,
};
use cf::data::{
CFData,
CFDataRef,
};
use cf::dictionary::{
CFDictionaryRef,
UntypedCFDictionary,
};
use cf::string::{
CFStringGetTypeID,
CFString,
CFStringRef,
UniChar
};
use cg = core_graphics;
use cg::base::{
CGAffineTransform,
CGFloat,
};
use cg::font::{
CGGlyph,
CGFont,
CGFontRef,
};
use cg::geometry::{
CGRect,
CGSize,
};
use font_descriptor::{
CTFontDescriptor
};
use core::libc::c_uint;
use core_foundation::array::{CFArrayRef};
use core_foundation::base::{AbstractCFTypeRef, CFIndex, CFOptionFlags, CFTypeID, CFTypeRef};
use core_foundation::base::{CFWrapper};
use core_foundation::data::{CFData, CFDataRef};
use core_foundation::dictionary::{CFDictionaryRef, UntypedCFDictionary};
use core_foundation::string::{CFStringGetTypeID, CFString, CFStringRef, UniChar};
use core_graphics::base::{CGAffineTransform, CGFloat};
use core_graphics::font::{CGGlyph, CGFont, CGFontRef};
use core_graphics::geometry::{CGRect, CGSize};
pub type CTFontUIFontType = u32;
// kCTFontNoFontType: CTFontUIFontType = -1;
+12 -26
View File
@@ -1,29 +1,15 @@
use cf = core_foundation;
use cf::array::{CFArray, CFArrayRef};
use cf::base::{
AbstractCFTypeRef,
CFAllocatorRef,
CFIndex,
CFRange,
CFTypeID,
CFTypeRef,
CFWrapper,
kCFAllocatorDefault,
};
use cf::dictionary::{CFDictionary, CFDictionaryRef, UntypedCFDictionary};
use cf::number::CFNumber;
use cf::set::CFSet;
use cf::string::{CFString, CFStringRef};
use font_descriptor::{
CTFontAttributes,
CTFontDescriptor,
CTFontDescriptorCreateMatchingFontDescriptors,
CTFontDescriptorRef,
};
use font_descriptor::{CTFontAttributes, CTFontDescriptor};
use font_descriptor::{CTFontDescriptorCreateMatchingFontDescriptors, CTFontDescriptorRef};
use font_manager::CTFontManagerCopyAvailableFontFamilyNames;
use libc::c_void;
use core::libc::c_void;
use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::base::{AbstractCFTypeRef, CFAllocatorRef, CFIndex, CFRange, CFTypeID};
use core_foundation::base::{CFTypeRef, CFWrapper, kCFAllocatorDefault};
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef, UntypedCFDictionary};
use core_foundation::number::CFNumber;
use core_foundation::set::CFSet;
use core_foundation::string::{CFString, CFStringRef};
struct __CTFontCollection { private: () }
pub type CTFontCollectionRef = *__CTFontCollection;
@@ -41,7 +27,7 @@ pub trait CTFontCollectionMethods {
pub impl CTFontCollection : CTFontCollectionMethods {
pure fn get_descriptors() -> CFArray<CTFontDescriptorRef> unsafe {
use cf::base::CFRetain;
use core_foundation::base::CFRetain;
// surprise! this function follows the Get rule, despite being named *Create*.
// So we have to addRef it to avoid CTFontCollection from double freeing it later.
@@ -110,4 +96,4 @@ extern {
options: CFDictionaryRef) -> CTFontCollectionRef;
//fn CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback;
fn CTFontCollectionGetTypeID() -> CFTypeID;
}
}
+18 -41
View File
@@ -1,38 +1,12 @@
use cf = core_foundation;
use cf::array::CFArrayRef;
use cf::base::{
AbstractCFTypeRef,
CFAllocatorRef,
CFIndex,
CFGetTypeID,
CFRange,
CFType,
CFTypeID,
CFTypeRef,
CFWrapper,
kCFAllocatorDefault,
};
use cf::dictionary::{
CFDictionary,
CFDictionaryRef,
UntypedCFDictionary,
};
use cf::number::{CFNumber, CFNumberRef};
use cf::set::CFSetRef;
use cf::string::{
CFString,
CFStringRef,
CFStringGetTypeID,
};
use cf::url::{
CFURL,
CFURLRef,
CFURLGetTypeID,
};
use cg = core_graphics;
use cg::base::CGFloat;
use core_foundation::array::CFArrayRef;
use core_foundation::base::{AbstractCFTypeRef, CFAllocatorRef, CFIndex, CFGetTypeID, CFRange};
use core_foundation::base::{CFType, CFTypeID, CFTypeRef, CFWrapper, kCFAllocatorDefault};
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef, UntypedCFDictionary};
use core_foundation::number::{CFNumber, CFNumberRef};
use core_foundation::set::CFSetRef;
use core_foundation::string::{CFString, CFStringRef, CFStringGetTypeID};
use core_foundation::url::{CFURL, CFURLRef, CFURLGetTypeID};
use core_graphics::base::CGFloat;
use libc::c_void;
/*
@@ -142,7 +116,7 @@ priv trait TraitAccessorPrivate {
impl CTFontTraits: TraitAccessorPrivate {
priv fn extract_number_for_key(key: CFStringRef) -> CFNumber {
let value = self.get(&key);
CFWrapper::wrap_shared(cf::base::downcast::<CFNumberRef>(value))
CFWrapper::wrap_shared(core_foundation::base::downcast::<CFNumberRef>(value))
}
}
@@ -212,7 +186,8 @@ impl CTFontDescriptor: CTFontDescriptorMethodsPrivate {
let value = CTFontDescriptorCopyAttribute(self.obj, attribute);
if value.is_null() { return None; }
Some(CFWrapper::wrap_owned(cf::base::downcast::<CFStringRef>(value)).to_str())
Some(CFWrapper::wrap_owned(core_foundation::base::downcast::<CFStringRef>(
value)).to_str())
}
}
@@ -242,12 +217,14 @@ pub impl CTFontDescriptor : CTFontDescriptorMethods {
let value = CTFontDescriptorCopyAttribute(self.obj, kCTFontURLAttribute);
assert value.is_not_null();
CFWrapper::wrap_owned(cf::base::downcast::<CFURLRef>(value)).to_str()
CFWrapper::wrap_owned(core_foundation::base::downcast::<CFURLRef>(value)).to_str()
}
}
pub fn new_from_attributes(attributes: &CFWrapper<CFDictionaryRef, CFStringRef, CFTypeRef>) -> CTFontDescriptor {
let result : CTFontDescriptorRef = CTFontDescriptorCreateWithAttributes(*attributes.borrow_ref());
pub fn new_from_attributes(attributes: &CFWrapper<CFDictionaryRef, CFStringRef, CFTypeRef>)
-> CTFontDescriptor {
let result: CTFontDescriptorRef =
CTFontDescriptorCreateWithAttributes(*attributes.borrow_ref());
CFWrapper::wrap_owned(result)
}
@@ -322,4 +299,4 @@ extern {
fn CTFontDescriptorCreateWithAttributes(attributes: CFDictionaryRef) -> CTFontDescriptorRef;
fn CTFontDescriptorCreateWithNameAndSize(name: CFStringRef, size: CGFloat) -> CTFontDescriptorRef;
fn CTFontDescriptorGetTypeID() -> CFTypeID;
}
}
+3 -4
View File
@@ -1,6 +1,5 @@
use cf = core_foundation;
use cf::array::CFArrayRef;
use cf::url::CFURLRef;
use core_foundation::array::CFArrayRef;
use core_foundation::url::CFURLRef;
extern {
/*
@@ -29,4 +28,4 @@ extern {
//fn CTFontManagerUnregisterFontsForURL
//fn CTFontManagerUnregisterFontsForURLs
//fn CTFontManagerUnregisterGraphicsFont
}
}