Remove some module aliases.

These aliases were there for old versions of resolve, and are no longer needed.
This commit is contained in:
Patrick Walton 2013-04-05 17:16:30 -07:00
parent b2f5ccfd5f
commit bd15317eae
12 changed files with 84 additions and 82 deletions

View file

@ -1,7 +1,6 @@
//! Implementation of the list of fonts. //! Implementation of the list of fonts.
use font::{CSSFontWeight, SpecifiedFontStyle}; use font::{CSSFontWeight, FontHandleMethods, SpecifiedFontStyle};
use gfx_font::FontHandleMethods;
use platform::font::FontHandle; use platform::font::FontHandle;
use platform::font_context::FontContextHandle; use platform::font_context::FontContextHandle;
use platform::font_list::FontListHandle; use platform::font_list::FontListHandle;
@ -16,6 +15,7 @@ trait FontListHandleMethods {
fn load_variations_for_family(&self, family: @mut FontFamily); fn load_variations_for_family(&self, family: @mut FontFamily);
} }
/// The platform-independent font list abstraction.
pub struct FontList { pub struct FontList {
family_map: FontFamilyMap, family_map: FontFamilyMap,
handle: FontListHandle, handle: FontListHandle,
@ -29,7 +29,7 @@ pub impl FontList {
family_map: HashMap::new(), family_map: HashMap::new(),
}; };
list.refresh(fctx); list.refresh(fctx);
return list; list
} }
priv fn refresh(&mut self, _: &FontContextHandle) { priv fn refresh(&mut self, _: &FontContextHandle) {
@ -46,19 +46,24 @@ pub impl FontList {
family_name: &str, family_name: &str,
style: &SpecifiedFontStyle) -> Option<@FontEntry> { style: &SpecifiedFontStyle) -> Option<@FontEntry> {
let family = self.find_family(family_name); let family = self.find_family(family_name);
let mut result : Option<@FontEntry> = None;
// TODO(Issue #192: handle generic font families, like 'serif' and 'sans-serif'. // TODO(Issue #192: handle generic font families, like 'serif' and 'sans-serif'.
// if such family exists, try to match style to a font // if such family exists, try to match style to a font
let mut result: Option<@FontEntry> = None;
for family.each |fam| { for family.each |fam| {
result = fam.find_font_for_style(&self.handle, style); result = fam.find_font_for_style(&self.handle, style);
} }
let decision = if result.is_some() { "Found" } else { "Couldn't find" }; let decision = if result.is_some() {
"Found"
} else {
"Couldn't find"
};
debug!("FontList: %s font face in family[%s] matching style", decision, family_name); debug!("FontList: %s font face in family[%s] matching style", decision, family_name);
return result; result
} }
priv fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> { priv fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> {
@ -79,22 +84,22 @@ pub struct FontFamily {
entries: ~[@FontEntry], entries: ~[@FontEntry],
} }
pub impl FontFamily { impl FontFamily {
fn new(family_name: &str) -> FontFamily { pub fn new(family_name: &str) -> FontFamily {
FontFamily { FontFamily {
family_name: str::from_slice(family_name), family_name: str::from_slice(family_name),
entries: ~[], entries: ~[],
} }
} }
priv fn load_family_variations(@mut self, list: &FontListHandle) { fn load_family_variations(@mut self, list: &FontListHandle) {
let this : &mut FontFamily = self; // FIXME: borrow checker workaround let this : &mut FontFamily = self; // FIXME: borrow checker workaround
if this.entries.len() > 0 { return; } if this.entries.len() > 0 { return; }
list.load_variations_for_family(self); list.load_variations_for_family(self);
assert!(this.entries.len() > 0); assert!(this.entries.len() > 0);
} }
fn find_font_for_style(@mut self, list: &FontListHandle, style: &SpecifiedFontStyle) pub fn find_font_for_style(@mut self, list: &FontListHandle, style: &SpecifiedFontStyle)
-> Option<@FontEntry> { -> Option<@FontEntry> {
self.load_family_variations(list); self.load_family_variations(list);
@ -113,15 +118,15 @@ pub impl FontFamily {
} }
} }
return None; None
} }
} }
// This struct summarizes an available font's features. In the future, /// This struct summarizes an available font's features. In the future, this will include fiddly
// this will include fiddly settings such as special font table handling. /// settings such as special font table handling.
///
// In the common case, each FontFamily will have a singleton FontEntry, or /// In the common case, each FontFamily will have a singleton FontEntry, or it will have the
// it will have the standard four faces: Normal, Bold, Italic, BoldItalic. /// standard four faces: Normal, Bold, Italic, BoldItalic.
pub struct FontEntry { pub struct FontEntry {
family: @mut FontFamily, family: @mut FontFamily,
face_name: ~str, face_name: ~str,
@ -131,8 +136,8 @@ pub struct FontEntry {
// TODO: array of OpenType features, etc. // TODO: array of OpenType features, etc.
} }
pub impl FontEntry { impl FontEntry {
fn new(family: @mut FontFamily, handle: FontHandle) -> FontEntry { pub fn new(family: @mut FontFamily, handle: FontHandle) -> FontEntry {
FontEntry { FontEntry {
family: family, family: family,
face_name: handle.face_name(), face_name: handle.face_name(),
@ -142,11 +147,11 @@ pub impl FontEntry {
} }
} }
fn is_bold(&self) -> bool { pub fn is_bold(&self) -> bool {
self.weight.is_bold() self.weight.is_bold()
} }
fn is_italic(&self) -> bool { pub fn is_italic(&self) -> bool {
self.italic self.italic
} }
} }

View file

@ -2,12 +2,12 @@
extern mod freetype; extern mod freetype;
use font::{CSSFontWeight, FontHandleMethods, FontMetrics, FontTable, FontTableMethods};
use font::{FontTableTag, FractionalPixel, SpecifiedFontStyle, UsedFontStyle, FontWeight100};
use font::{FontWeight200, FontWeight300, FontWeight400, FontWeight500, FontWeight600};
use font::{FontWeight700, FontWeight800, FontWeight900};
use geometry::Au; use geometry::Au;
use geometry; use geometry;
use gfx_font::{CSSFontWeight, FontHandleMethods, FontMetrics, FontTable, FontTableMethods};
use gfx_font::{FontTableTag, FractionalPixel, SpecifiedFontStyle, UsedFontStyle, FontWeight100};
use gfx_font::{FontWeight200, FontWeight300, FontWeight400, FontWeight500, FontWeight600};
use gfx_font::{FontWeight700, FontWeight800, FontWeight900};
use platform::font_context::{FreeTypeFontContextHandle, FontContextHandle}; use platform::font_context::{FreeTypeFontContextHandle, FontContextHandle};
use text::glyph::GlyphIndex; use text::glyph::GlyphIndex;
use text::util::{float_to_fixed, fixed_to_float}; use text::util::{float_to_fixed, fixed_to_float};
@ -270,7 +270,7 @@ impl FontHandleMethods for FreeTypeFontHandle {
} }
} }
fn get_table_for_tag(&self, _tag: FontTableTag) -> Option<FontTable> { fn get_table_for_tag(&self, _: FontTableTag) -> Option<FontTable> {
None None
} }
} }
@ -283,7 +283,6 @@ pub impl FreeTypeFontHandle {
} }
priv fn font_units_to_au(&self, value: float) -> Au { priv fn font_units_to_au(&self, value: float) -> Au {
let face = self.get_face_rec(); let face = self.get_face_rec();
// face.size is a *c_void in the bindings, presumably to avoid // face.size is a *c_void in the bindings, presumably to avoid
@ -300,3 +299,4 @@ pub impl FreeTypeFontHandle {
return geometry::from_frac_px(value * x_scale); return geometry::from_frac_px(value * x_scale);
} }
} }

View file

@ -1,7 +1,7 @@
extern mod freetype; extern mod freetype;
extern mod fontconfig; extern mod fontconfig;
use gfx_font::{FontHandle, UsedFontStyle}; use font::{FontHandle, UsedFontStyle};
use platform::font::FreeTypeFontHandle; use platform::font::FreeTypeFontHandle;
use platform::font_context::FontContextHandleMethods; use platform::font_context::FontContextHandleMethods;
use platform::font_list::path_from_identifier; use platform::font_list::path_from_identifier;

View file

@ -3,9 +3,9 @@
extern mod freetype; extern mod freetype;
extern mod fontconfig; extern mod fontconfig;
use gfx_font::FontHandleMethods; use font::FontHandleMethods;
use gfx_font_context::FontContextHandleMethods; use font_context::FontContextHandleMethods;
use gfx_font_list::{FontEntry, FontFamily, FontFamilyMap}; use font_list::{FontEntry, FontFamily, FontFamilyMap};
use platform::font::FreeTypeFontHandle; use platform::font::FreeTypeFontHandle;
use platform::font_context::{FontContextHandle, FreeTypeFontContextHandle}; use platform::font_context::{FontContextHandle, FreeTypeFontContextHandle};

View file

@ -4,11 +4,15 @@ extern mod core_foundation;
extern mod core_graphics; extern mod core_graphics;
extern mod core_text; extern mod core_text;
use font::{CSSFontWeight, FontHandleMethods, FontMetrics, FontTableMethods};
use font::{FontTableTag, FontWeight100, FontWeight200, FontWeight300, FontWeight400};
use font::{FontWeight500, FontWeight600, FontWeight700, FontWeight800, FontWeight900};
use font::{FractionalPixel, SpecifiedFontStyle};
use geometry::Au; use geometry::Au;
use gfx_font::{CSSFontWeight, FontHandleMethods, FontMetrics, FontTableMethods}; use platform::macos::font_context::FontContextHandle;
use gfx_font::{FontTableTag, FontWeight100, FontWeight200, FontWeight300, FontWeight400}; use platform;
use gfx_font::{FontWeight500, FontWeight600, FontWeight700, FontWeight800, FontWeight900}; use text::glyph::GlyphIndex;
use gfx_font::{FractionalPixel, SpecifiedFontStyle};
use platform::macos::font::core_foundation::base::{CFIndex, CFWrapper}; use platform::macos::font::core_foundation::base::{CFIndex, CFWrapper};
use platform::macos::font::core_foundation::data::CFData; use platform::macos::font::core_foundation::data::CFData;
use platform::macos::font::core_foundation::string::UniChar; use platform::macos::font::core_foundation::string::UniChar;
@ -19,9 +23,6 @@ use platform::macos::font::core_text::font::{CTFont, CTFontMethods, CTFontMethod
use platform::macos::font::core_text::font_descriptor::{SymbolicTraitAccessors}; use platform::macos::font::core_text::font_descriptor::{SymbolicTraitAccessors};
use platform::macos::font::core_text::font_descriptor::{TraitAccessors}; use platform::macos::font::core_text::font_descriptor::{TraitAccessors};
use platform::macos::font::core_text::font_descriptor::{kCTFontDefaultOrientation}; use platform::macos::font::core_text::font_descriptor::{kCTFontDefaultOrientation};
use platform::macos::font_context::FontContextHandle;
use platform;
use text::glyph::GlyphIndex;
pub struct FontTable { pub struct FontTable {
data: CFData, data: CFData,

View file

@ -2,9 +2,8 @@ extern mod core_foundation;
extern mod core_graphics; extern mod core_graphics;
extern mod core_text; extern mod core_text;
use gfx_font::UsedFontStyle; use font::UsedFontStyle;
use gfx_font_context::FontContextHandleMethods; use font_context::FontContextHandleMethods;
use platform::macos::font::FontHandle; use platform::macos::font::FontHandle;
use platform; use platform;

View file

@ -1,9 +1,9 @@
extern mod core_foundation; extern mod core_foundation;
extern mod core_text; extern mod core_text;
use gfx_font::FontHandleMethods; use font::FontHandleMethods;
use gfx_font_context::FontContextHandleMethods; use font_context::FontContextHandleMethods;
use gfx_font_list::{FontEntry, FontFamily, FontFamilyMap}; use font_list::{FontEntry, FontFamily, FontFamilyMap};
use platform::macos::font::FontHandle; use platform::macos::font::FontHandle;
use platform::macos::font_context::FontContextHandle; use platform::macos::font_context::FontContextHandle;

View file

@ -1,3 +1,5 @@
//! Graphics and resource loading module for Servo.
#[link(name = "servo_gfx", #[link(name = "servo_gfx",
vers = "0.1", vers = "0.1",
uuid = "0106bb54-6ea9-45bf-a39e-a738621f15e5", uuid = "0106bb54-6ea9-45bf-a39e-a738621f15e5",
@ -10,14 +12,6 @@ extern mod http_client;
extern mod stb_image; extern mod stb_image;
extern mod std; extern mod std;
pub use servo_util = util;
pub use gfx_font = font;
pub use gfx_font_context = font_context;
pub use gfx_font_list = font_list;
pub use servo_gfx_font = font;
pub use servo_gfx_font_list = font_list;
pub use servo_gfx_util = util;
priv mod render_context; priv mod render_context;
// Rendering // Rendering
@ -71,3 +65,4 @@ pub mod util {
pub mod url; pub mod url;
pub mod vec; pub mod vec;
} }

View file

@ -1,8 +1,10 @@
use geometry::Au; //! A platform-independent representation of a glyph.
use servo_gfx_util::range::Range;
use servo_gfx_util::vec::*;
use geometry::Au;
use geometry; use geometry;
use util::range::Range;
use util::vec::*;
use core; use core;
use core::cmp::{Ord, Eq}; use core::cmp::{Ord, Eq};
use core::num::NumCast; use core::num::NumCast;
@ -10,18 +12,17 @@ use core::u16;
use geom::point::Point2D; use geom::point::Point2D;
use std::sort; use std::sort;
/// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing
// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing /// glyph data compactly.
// glyph data compactly. ///
// /// In the common case (reasonable glyph advances, no offsets from the
// In the common case (reasonable glyph advances, no offsets from the /// font em-box, and one glyph per character), we pack glyph advance,
// font em-box, and one glyph per character), we pack glyph advance, /// glyph id, and some flags into a single u32.
// glyph id, and some flags into a single u32. ///
// /// In the uncommon case (multiple glyphs per unicode character, large
// In the uncommon case (multiple glyphs per unicode character, large /// glyph index/advance, or glyph offsets), we pack the glyph count
// glyph index/advance, or glyph offsets), we pack the glyph count /// into GlyphEntry, and store the other glyph information in
// into GlyphEntry, and store the other glyph information in /// DetailedGlyphStore.
// DetailedGlyphStore.
struct GlyphEntry { struct GlyphEntry {
value: u32 value: u32
} }

View file

@ -4,12 +4,11 @@ use geom::Point2D;
use geometry::Au; use geometry::Au;
use font::{Font, FontTableMethods, FontTableTag}; use font::{Font, FontHandleMethods, FontTableMethods, FontTableTag};
use platform::font::FontTable; use platform::font::FontTable;
use text::glyph::{GlyphStore, GlyphIndex, GlyphData}; use text::glyph::{GlyphStore, GlyphIndex, GlyphData};
use text::shaper::ShaperMethods; use text::shaper::ShaperMethods;
use gfx_font::{FontHandleMethods, FontTableMethods};
use util::range::Range; use util::range::Range;

View file

@ -1,10 +1,9 @@
/** //! Shaper encapsulates a specific shaper, such as Harfbuzz,
Shaper encapsulates a specific shaper, such as Harfbuzz, /// Uniscribe, Pango, or Coretext.
Uniscribe, Pango, or Coretext. ///
/// Currently, only harfbuzz bindings are implemented.
Currently, only harfbuzz bindings are implemented. use font::Font;
*/
use gfx_font::Font;
use text::glyph::GlyphStore; use text::glyph::GlyphStore;
use text::harfbuzz; use text::harfbuzz;

View file

@ -1,17 +1,20 @@
//! The text run abstraction. A text run is a word-wrapped line of text of the same font family,
/// style, and size.
use font::{Font, FontDescriptor, RunMetrics};
use font_context::FontContext; use font_context::FontContext;
use geometry::Au; use geometry::Au;
use text::glyph::{BreakTypeNormal, GlyphStore}; use text::glyph::{BreakTypeNormal, GlyphStore};
use servo_gfx_font::{Font, FontDescriptor, RunMetrics}; use util::range::Range;
use servo_gfx_util::range::Range;
/// A text run.
pub struct TextRun { pub struct TextRun {
text: ~str, text: ~str,
font: @mut Font, font: @mut Font,
glyphs: GlyphStore, glyphs: GlyphStore,
} }
// This is a hack until TextRuns are normally sendable, or /// This is a hack until TextRuns are normally sendable, or we instead use ARC<TextRun> everywhere.
// we instead use ARC<TextRun> everywhere.
pub struct SendableTextRun { pub struct SendableTextRun {
text: ~str, text: ~str,
font: FontDescriptor, font: FontDescriptor,