mirror of
https://github.com/servo/servo.git
synced 2025-06-22 08:08:59 +01:00
That min_width calculation was totally wrong
This commit is contained in:
parent
397c049c71
commit
ddcc11069e
1 changed files with 2 additions and 9 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue