Source-Repo: https://github.com/servo/servo
Source-Revision: 3ffbaaaa47d64e8e28310fe0cc9b1a943c6f9c69
This commit is contained in:
Brian Anderson 2012-06-21 17:42:43 -07:00
Родитель 350e638fad
Коммит 4d3b2ea91a
4 изменённых файлов: 79 добавлений и 0 удалений

Просмотреть файл

@ -62,10 +62,21 @@ mod platform {
}
mod text {
export glyph;
export text_run;
export font;
export shaper;
mod glyph;
mod text_run;
mod font;
mod shaper;
mod native_font {
#[cfg(target_os = "macos")]
mod quartz_native_font;
#[cfg(target_os = "linux")]
mod ft_native_font;
}
}
mod util {

Просмотреть файл

@ -0,0 +1,36 @@
#[doc = "
NativeFont encapsulates access to the platform's font API,
e.g. quartz, FreeType. It provides access to metrics and tables
needed by the text shaper as well as access to the underlying
font resources needed by the graphics layer to draw glyphs.
"];
export NativeFont, create_test_native_font;
#[cfg(target_os = "macos")]
type NativeFont/& = quartz_native_font::NativeFont;
#[cfg(target_os = "linux")]
type NativeFont/& = ft_native_font::NativeFont;
fn create_test_native_font() -> NativeFont {
fail;
}
#[test]
#[ignore]
fn should_get_glyph_indexes() {
let font = create_test_native_font();
let idx = font.glyph_index('w');
assert idx == some(40u);
}
#[test]
#[ignore]
fn should_get_glyph_h_advance() {
let font = create_test_native_font();
let adv = font.glyph_h_advance(40u);
assert adv == 15;
}

Просмотреть файл

@ -0,0 +1,16 @@
import glyph::GlyphIndex;
class NativeFont/& {
let bogus: int;
new() { self.bogus = 0; }
fn glyph_index(_codepoint: char) -> option<GlyphIndex> {
fail;
}
// FIXME: What unit is this returning? Let's have a custom type
fn glyph_h_advance(_glyph: GlyphIndex) -> int {
fail;
}
}

Просмотреть файл

@ -0,0 +1,16 @@
import glyph::GlyphIndex;
class NativeFont/& {
let bogus: int;
new() { self.bogus = 0; }
fn glyph_index(_codepoint: char) -> option<GlyphIndex> {
fail;
}
// FIXME: What unit is this returning? Let's have a custom type
fn glyph_h_advance(_glyph: GlyphIndex) -> int {
fail;
}
}