From 86f8168c1dfb311b31467234736d4c11ee9d8097 Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Mon, 12 Nov 2012 14:57:39 -0800 Subject: [PATCH] servo: Update some TODO comments and other cleanup. Source-Repo: https://github.com/servo/servo Source-Revision: ad353c3161c05d0211212a0307d8bd9e11a5f0da --- servo/src/servo-gfx/font.rs | 36 +++++++-------------- servo/src/servo-gfx/quartz/font.rs | 2 +- servo/src/servo-gfx/text/harfbuzz/shaper.rs | 6 +--- 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/servo/src/servo-gfx/font.rs b/servo/src/servo-gfx/font.rs index e466c075227e..09694edac8b2 100644 --- a/servo/src/servo-gfx/font.rs +++ b/servo/src/servo-gfx/font.rs @@ -35,10 +35,10 @@ pub trait FontHandleMethods { fn get_table_for_tag(FontTableTag) -> Option<~[u8]>; } -// TODO: `new` should be part of trait FontHandleMethods - // TODO(Issue #163): this is a workaround for static methods and // typedefs not working well together. It should be removed. +// +// `new` should be part of trait FontHandleMethods. impl FontHandle { #[cfg(target_os = "macos")] @@ -82,7 +82,7 @@ struct FontMetrics { max_advance: Au } -// TODO: use enum from CSS bindings +// TODO(Issue #200): use enum from CSS bindings for 'font-weight' enum CSSFontWeight { FontWeight100, FontWeight200, @@ -105,10 +105,10 @@ pub impl CSSFontWeight { } } -// TODO: eventually this will be split into the specified and used -// font styles. specified contains uninterpreted CSS font property -// values, while 'used' is attached to gfx::Font to descript the -// instance's properties. +// TODO(Issue #179): eventually this will be split into the specified +// and used font styles. specified contains uninterpreted CSS font +// property values, while 'used' is attached to gfx::Font to descript +// the instance's properties. // // For now, the cases are differentiated with a typedef pub struct FontStyle { @@ -117,7 +117,7 @@ pub struct FontStyle { italic: bool, oblique: bool, families: ~str, - // TODO: font-stretch, text-decoration, font-variant, size-adjust + // TODO(Issue #198): font-stretch, text-decoration, font-variant, size-adjust } // TODO(Issue #181): use deriving for trivial cmp::Eq implementations @@ -137,7 +137,7 @@ pub impl FontStyle : cmp::Eq { pub type SpecifiedFontStyle = FontStyle; pub type UsedFontStyle = FontStyle; -// TODO: move me to layout +// FIXME: move me to layout struct ResolvedFont { group: @FontGroup, style: SpecifiedFontStyle, @@ -339,20 +339,6 @@ impl Font { self.azure_font = Some(azure_scaled_font); azure_scaled_font - /* - // TODO: these cairo-related things should be in rust-cairo. - // creating a cairo font/face from a native font resource - // should be part of the NativeFont API, not exposed here. - #[cfg(target_os = "linux")] - fn get_cairo_face(font: &Font) -> *cairo_font_face_t { - use cairo::cairo_ft::bindgen::{cairo_ft_font_face_create_for_ft_face}; - - let ftface = font.handle.face; - let cface = cairo_ft_font_face_create_for_ft_face(ftface, 0 as c_int); - // FIXME: error handling - return cface; - } - */ } } @@ -425,7 +411,7 @@ pub impl Font : FontMethods { mNumGlyphs: azglyph_buf_len as uint32_t }}; - // TODO: this call needs to move into azure_hl.rs + // TODO(Issue #64): this call needs to move into azure_hl.rs AzDrawTargetFillGlyphs(target.azure_draw_target, azfont, ptr::to_unsafe_ptr(&glyphbuf), @@ -438,7 +424,7 @@ pub impl Font : FontMethods { //assert range.is_valid_for_string(run.text); //debug!("measuring text range '%s'", run.text.substr(range.begin(), range.length())); - // TODO: alter advance direction for RTL + // TODO(Issue #199): alter advance direction for RTL // TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text let mut advance = Au(0); for run.glyphs.iter_glyphs_for_range(range) |_i, glyph| { diff --git a/servo/src/servo-gfx/quartz/font.rs b/servo/src/servo-gfx/quartz/font.rs index b60cb83852bd..98a8d76d8e93 100644 --- a/servo/src/servo-gfx/quartz/font.rs +++ b/servo/src/servo-gfx/quartz/font.rs @@ -166,7 +166,7 @@ pub impl QuartzFontHandle : FontHandleMethods { let metrics = FontMetrics { underline_size: Au::from_pt(self.ctfont.underline_thickness() as float), - // TODO: underline metrics are not reliable. Have to pull out of font table directly. + // TODO(Issue #201): underline metrics are not reliable. Have to pull out of font table directly. // see also: https://bugs.webkit.org/show_bug.cgi?id=16768 // see also: https://bugreports.qt-project.org/browse/QTBUG-13364 underline_offset: Au::from_pt(self.ctfont.underline_position() as float), diff --git a/servo/src/servo-gfx/text/harfbuzz/shaper.rs b/servo/src/servo-gfx/text/harfbuzz/shaper.rs index 9a8580492792..f23bab73a6fb 100644 --- a/servo/src/servo-gfx/text/harfbuzz/shaper.rs +++ b/servo/src/servo-gfx/text/harfbuzz/shaper.rs @@ -102,10 +102,6 @@ pub impl HarfbuzzShaper { */ pub fn shape_text(text: &str, glyphs: &GlyphStore) { debug!("shaping text '%s'", text); - - // TODO(Issue #94): harfbuzz fonts and faces should be cached on the - // Shaper object, which is owned by the Font instance. - let hb_buffer: *hb_buffer_t = hb_buffer_create(); hb_buffer_set_direction(hb_buffer, HB_DIRECTION_LTR); @@ -140,7 +136,7 @@ pub impl HarfbuzzShaper { Au::from_frac_px(HarfbuzzShaper::fixed_to_float(y)))) }; // TODO: convert pos.y_advance into offset adjustment - // TODO: handle multiple glyphs per char, ligatures, etc. + // TODO(Issue #93, #95): handle multiple glyphs per char, ligatures, etc. // NB. this debug statement is commented out, as it must be checked for every shaped char. //debug!("glyph %?: index %?, advance %?, offset %?", i, codepoint, advance, offset);