mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rewrite the Core Foundation wrapper system.
This commit is contained in:
parent
d3debc6bf8
commit
51461cd104
8 changed files with 18 additions and 18 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 93ac0efc6b353c33b71fda579b7793c00173f9d4
|
||||
Subproject commit 070bc3e50d29b54c3e2f9604592f73a4482970e1
|
|
@ -1 +1 @@
|
|||
Subproject commit 9cb470e80897a854096bc07b88857e379945f421
|
||||
Subproject commit 255ddca46619a6f2bc7c50e1da37096752a07545
|
|
@ -1 +1 @@
|
|||
Subproject commit 4914947bb5663f1b3f83757edc5be38f8f6f6d0d
|
||||
Subproject commit a3f597bbbc02d47151a3058905af3fcf6c7482a8
|
|
@ -1 +1 @@
|
|||
Subproject commit 8602b259882444aa468a4b98d387cd9818940e14
|
||||
Subproject commit 257e99dbcaa97519e8a6d50431712cf9bafe45c9
|
|
@ -5,8 +5,6 @@ extern mod core_text;
|
|||
use cf = core_foundation;
|
||||
use cf::base::{
|
||||
CFIndex,
|
||||
CFRelease,
|
||||
CFTypeOps,
|
||||
CFTypeRef,
|
||||
};
|
||||
use cf::data::{CFData, CFDataRef};
|
||||
|
@ -83,13 +81,13 @@ pub impl QuartzFontHandle {
|
|||
static fn new_from_buffer(_fctx: &QuartzFontContextHandle, buf: ~[u8],
|
||||
style: &SpecifiedFontStyle) -> Result<QuartzFontHandle, ()> {
|
||||
let fontprov = vec::as_imm_buf(buf, |cbuf, len| {
|
||||
CGDataProvider::new_from_buffer(cbuf, len)
|
||||
cg::data_provider::new_from_buffer(cbuf, len)
|
||||
});
|
||||
|
||||
let cgfont = CGFontCreateWithDataProvider(fontprov.get_ref());
|
||||
let cgfont = CGFontCreateWithDataProvider(*fontprov.borrow_ref());
|
||||
if cgfont.is_null() { return Err(()); }
|
||||
|
||||
let ctfont = CTFont::new_from_CGFont(cgfont, style.pt_size);
|
||||
let ctfont = ct::font::new_from_CGFont(cgfont, style.pt_size);
|
||||
|
||||
let result = Ok(QuartzFontHandle {
|
||||
cgfont : Some(cgfont),
|
||||
|
|
|
@ -28,7 +28,7 @@ pub impl QuartzFontContextHandle : FontContextHandleMethods {
|
|||
}
|
||||
|
||||
fn create_font_from_identifier(name: ~str, style: UsedFontStyle) -> Result<FontHandle, ()> {
|
||||
let ctfont_result = CTFont::new_from_name(move name, style.pt_size);
|
||||
let ctfont_result = ct::font::new_from_name(move name, style.pt_size);
|
||||
do result::chain(move ctfont_result) |ctfont| {
|
||||
QuartzFontHandle::new_from_CTFont(&self, move ctfont)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ extern mod core_text;
|
|||
|
||||
use cf = core_foundation;
|
||||
use cf::array::CFArray;
|
||||
use cf::string::CFString;
|
||||
use cf::base::CFWrapper;
|
||||
use cf::string::{CFString, CFStringRef};
|
||||
|
||||
use ct = core_text;
|
||||
use ct::font::{CTFont, debug_font_names, debug_font_traits};
|
||||
|
@ -28,10 +29,10 @@ pub impl QuartzFontListHandle {
|
|||
}
|
||||
|
||||
fn get_available_families() -> FontFamilyMap {
|
||||
let family_names = CTFontCollection::get_family_names();
|
||||
let family_names = ct::font_collection::get_family_names();
|
||||
let mut family_map : FontFamilyMap = linear::LinearMap();
|
||||
for family_names.each |family_name_cfstr: &CFString| {
|
||||
let family_name = family_name_cfstr.to_str();
|
||||
for family_names.each |strref: &CFStringRef| {
|
||||
let family_name = CFWrapper::wrap_shared(*strref).to_str();
|
||||
debug!("Creating new FontFamily for family: %s", family_name);
|
||||
|
||||
let new_family = @FontFamily::new(family_name);
|
||||
|
@ -44,9 +45,10 @@ pub impl QuartzFontListHandle {
|
|||
let family_name = &family.family_name;
|
||||
debug!("Looking for faces of family: %s", *family_name);
|
||||
|
||||
let family_collection = CTFontCollection::create_for_family(*family_name);
|
||||
for family_collection.get_descriptors().each |desc: &CTFontDescriptor| {
|
||||
let font = CTFont::new_from_descriptor(desc, 0.0);
|
||||
let family_collection = ct::font_collection::create_for_family(*family_name);
|
||||
for family_collection.get_descriptors().each |descref: &CTFontDescriptorRef| {
|
||||
let desc = CFWrapper::wrap_shared(*descref);
|
||||
let font = ct::font::new_from_descriptor(&desc, 0.0);
|
||||
let handle = result::unwrap(QuartzFontHandle::new_from_CTFont(&self.fctx, move font));
|
||||
|
||||
debug!("Creating new FontEntry for face: %s", handle.face_name());
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 10e9efa78b62931ea613789f8be537d8461526f4
|
||||
Subproject commit ae156b89bd6ab4f2ce46f8c0a25cc02af4d799b1
|
Loading…
Add table
Add a link
Reference in a new issue