mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Remove unused code path - simplifies other refactoring.
This commit is contained in:
parent
ab94fea87a
commit
1eb03e6006
4 changed files with 1 additions and 48 deletions
|
@ -43,8 +43,6 @@ pub trait FontHandleMethods {
|
|||
fn is_italic(&self) -> bool;
|
||||
fn boldness(&self) -> font_weight::T;
|
||||
|
||||
fn clone_with_style(&self, fctx: &FontContextHandle, style: &UsedFontStyle)
|
||||
-> Result<FontHandle, ()>;
|
||||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId>;
|
||||
fn glyph_h_advance(&self, GlyphId) -> Option<FractionalPixel>;
|
||||
fn get_metrics(&self) -> FontMetrics;
|
||||
|
@ -253,19 +251,6 @@ impl<'a> Font {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_from_existing_handle(fctx: &FontContext, handle: &FontHandle,
|
||||
style: &SpecifiedFontStyle, backend: BackendType)
|
||||
-> Result<Rc<RefCell<Font>>,()> {
|
||||
|
||||
// TODO(Issue #179): convert between specified and used font style here?
|
||||
let styled_handle = match handle.clone_with_style(&fctx.handle, style) {
|
||||
Ok(result) => result,
|
||||
Err(()) => return Err(())
|
||||
};
|
||||
|
||||
return Ok(Rc::new(RefCell::new(Font::new_from_adopted_handle(fctx, styled_handle, style, backend))));
|
||||
}
|
||||
|
||||
fn make_shaper(&'a mut self) -> &'a Shaper {
|
||||
// fast path: already created a shaper
|
||||
match self.shaper {
|
||||
|
|
|
@ -160,19 +160,6 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
fn clone_with_style(&self,
|
||||
fctx: &FontContextHandle,
|
||||
style: &UsedFontStyle) -> Result<FontHandle, ()> {
|
||||
match self.source {
|
||||
FontSourceMem(ref buf) => {
|
||||
FontHandleMethods::new_from_buffer(fctx, buf.clone(), style)
|
||||
}
|
||||
FontSourceFile(ref file) => {
|
||||
FontHandle::new_from_file(fctx, file.as_slice(), style)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn glyph_index(&self,
|
||||
codepoint: char) -> Option<GlyphId> {
|
||||
assert!(self.face.is_not_null());
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
extern crate freetype;
|
||||
|
||||
use font::{FontHandleMethods, FontMetrics, FontTableMethods};
|
||||
use font::{FontTableTag, FractionalPixel, SpecifiedFontStyle, UsedFontStyle};
|
||||
use font::{FontTableTag, FractionalPixel, SpecifiedFontStyle};
|
||||
use servo_util::geometry::Au;
|
||||
use servo_util::geometry;
|
||||
use platform::font_context::FontContextHandle;
|
||||
|
@ -160,19 +160,6 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
fn clone_with_style(&self,
|
||||
fctx: &FontContextHandle,
|
||||
style: &UsedFontStyle) -> Result<FontHandle, ()> {
|
||||
match self.source {
|
||||
FontSourceMem(ref buf) => {
|
||||
FontHandleMethods::new_from_buffer(fctx, buf.clone(), style)
|
||||
}
|
||||
FontSourceFile(ref file) => {
|
||||
FontHandle::new_from_file(fctx, file.as_slice(), style)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn glyph_index(&self,
|
||||
codepoint: char) -> Option<GlyphId> {
|
||||
assert!(self.face.is_not_null());
|
||||
|
|
|
@ -119,12 +119,6 @@ impl FontHandleMethods for FontHandle {
|
|||
return font_weight::Weight900;
|
||||
}
|
||||
|
||||
fn clone_with_style(&self, fctx: &FontContextHandle, style: &SpecifiedFontStyle)
|
||||
-> Result<FontHandle,()> {
|
||||
let new_font = self.ctfont.clone_with_font_size(style.pt_size);
|
||||
return FontHandle::new_from_CTFont(fctx, new_font);
|
||||
}
|
||||
|
||||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
||||
let characters: [UniChar, ..1] = [codepoint as UniChar];
|
||||
let glyphs: [CGGlyph, ..1] = [0 as CGGlyph];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue