remove @ in LayoutTask.FontContext

This commit is contained in:
patrick kim 2013-12-09 16:28:41 +09:00
parent 55771bc307
commit 0026eb0899
11 changed files with 73 additions and 49 deletions

View file

@ -31,7 +31,6 @@ pub fn dummy_style() -> FontStyle {
}
pub trait FontContextHandleMethods {
fn clone(&self) -> FontContextHandle;
fn create_font_from_identifier(&self, ~str, UsedFontStyle) -> Result<FontHandle, ()>;
}

View file

@ -8,7 +8,6 @@ use font::{CSSFontWeight, FontHandleMethods, FontMetrics, FontTableMethods};
use font::{FontTableTag, FractionalPixel, SpecifiedFontStyle, UsedFontStyle, FontWeight100};
use font::{FontWeight200, FontWeight300, FontWeight400, FontWeight500, FontWeight600};
use font::{FontWeight700, FontWeight800, FontWeight900};
use font_context::FontContextHandleMethods;
use servo_util::geometry::Au;
use servo_util::geometry;
use platform::font_context::FontContextHandle;
@ -79,7 +78,7 @@ impl FontHandleMethods for FontHandle {
buf: ~[u8],
style: &SpecifiedFontStyle)
-> Result<FontHandle, ()> {
let ft_ctx: FT_Library = fctx.ctx.ctx;
let ft_ctx: FT_Library = fctx.ctx.get().ctx;
if ft_ctx.is_null() { return Err(()); }
let face_result = do buf.as_imm_buf |bytes: *u8, len: uint| {
@ -292,7 +291,7 @@ impl<'self> FontHandle {
pub fn new_from_file(fctx: &FontContextHandle, file: &str,
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
unsafe {
let ft_ctx: FT_Library = fctx.ctx.ctx;
let ft_ctx: FT_Library = fctx.ctx.get().ctx;
if ft_ctx.is_null() { return Err(()); }
let mut face: FT_Face = ptr::null();
@ -320,7 +319,7 @@ impl<'self> FontHandle {
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
-> Result<FontHandle, ()> {
unsafe {
let ft_ctx: FT_Library = fctx.ctx.ctx;
let ft_ctx: FT_Library = fctx.ctx.get().ctx;
if ft_ctx.is_null() { return Err(()); }
let mut face: FT_Face = ptr::null();

View file

@ -18,6 +18,7 @@ struct FreeTypeLibraryHandle {
ctx: FT_Library,
}
#[deriving(Clone)]
pub struct FontContextHandle {
ctx: Arc<FreeTypeLibraryHandle>,
}
@ -35,7 +36,7 @@ impl FontContextHandle {
pub fn new() -> FontContextHandle {
unsafe {
let ctx: FT_Library = ptr::null();
let result = FT_Init_FreeType(ptr::to_unsafe_ptr(&ctx));
let result = FT_Init_FreeType(&ctx);
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
FontContextHandle {
ctx: Arc::new(FreeTypeLibraryHandle { ctx: ctx }),
@ -45,12 +46,6 @@ impl FontContextHandle {
}
impl FontContextHandleMethods for FontContextHandle {
fn clone(&self) -> FontContextHandle {
FontContextHandle {
ctx: self.ctx.clone()
}
}
fn create_font_from_identifier(&self, name: ~str, style: UsedFontStyle)
-> Result<FontHandle, ()> {
debug!("Creating font handle for {:s}", name);

View file

@ -19,7 +19,6 @@ use fontconfig::fontconfig::{
use font::{FontHandleMethods, UsedFontStyle};
use font_context::FontContextHandleMethods;
use font_list::{FontEntry, FontFamily, FontFamilyMap};
use platform::font::FontHandle;
use platform::font_context::FontContextHandle;

View file

@ -8,10 +8,12 @@ use platform::macos::font::FontHandle;
use core_text;
#[deriving(Clone)]
pub struct FontContextHandle {
ctx: ()
}
#[deriving(Clone)]
impl FontContextHandle {
// this is a placeholder until NSFontManager or whatever is bound in here.
pub fn new() -> FontContextHandle {
@ -20,12 +22,6 @@ impl FontContextHandle {
}
impl FontContextHandleMethods for FontContextHandle {
fn clone(&self) -> FontContextHandle {
FontContextHandle {
ctx: self.ctx
}
}
fn create_font_from_identifier(&self,
name: ~str,
style: UsedFontStyle)