remove FontContxtHandle.clone

This commit is contained in:
patrick kim 2013-12-10 11:42:22 +09:00
parent 301df201c3
commit e1e59ac3b6
5 changed files with 4 additions and 16 deletions

View file

@ -31,7 +31,6 @@ pub fn dummy_style() -> FontStyle {
} }
pub trait FontContextHandleMethods { pub trait FontContextHandleMethods {
fn clone(&self) -> FontContextHandle;
fn create_font_from_identifier(&self, ~str, UsedFontStyle) -> Result<FontHandle, ()>; 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::{FontTableTag, FractionalPixel, SpecifiedFontStyle, UsedFontStyle, FontWeight100};
use font::{FontWeight200, FontWeight300, FontWeight400, FontWeight500, FontWeight600}; use font::{FontWeight200, FontWeight300, FontWeight400, FontWeight500, FontWeight600};
use font::{FontWeight700, FontWeight800, FontWeight900}; use font::{FontWeight700, FontWeight800, FontWeight900};
use font_context::FontContextHandleMethods;
use servo_util::geometry::Au; use servo_util::geometry::Au;
use servo_util::geometry; use servo_util::geometry;
use platform::font_context::FontContextHandle; use platform::font_context::FontContextHandle;

View file

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

View file

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

View file

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