That min_width calculation was totally wrong

This commit is contained in:
Brian Anderson 2012-09-13 20:14:49 -07:00
parent 397c049c71
commit ddcc11069e

View file

@ -51,18 +51,11 @@ fn glyph_run_size(glyphs: &[Glyph]) -> Size2D<au> {
/// If there are breaking opportunities inside a string, then
/// returns the width of the text up to the first break. Otherwise None.
fn calc_min_width(font: &Font, text: &str) -> Option<au> {
match str::find(text, |c| char::is_whitespace(c)) {
Some(offset) => {
let short_text = str::view(text, 0, offset);
let glyphs = shape_text(font, short_text);
let size = glyph_run_size(glyphs);
Some(size.width)
}
None => None
}
None
}
#[test]
#[ignore]
fn test_calc_min_width_with_breaking() {
let flib = FontLibrary();
let font = flib.get_test_font();