servo / font-kit

A cross-platform font loading library written in Rust
Apache License 2.0
685 stars 103 forks source link

select_font tests fail when other fonts present on the system #217

Open jayvdb opened 10 months ago

jayvdb commented 10 months ago

I am seeing the following errors, because the tests are expecting DejaVu fonts to be the result. I have DejaVu fonts installed, but other fonts are being selected. My guess is that the results I am getting are "correct" for my system.

---- test::select_best_match_sans_serif stdout ----
thread 'test::select_best_match_sans_serif' panicked at tests/select_font.rs:57:13:
assertion `left == right` failed
  left: Some("arial.ttf")
 right: Some("DejaVuSans.ttf")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- test::select_best_match_bold_sans_serif stdout ----
thread 'test::select_best_match_bold_sans_serif' panicked at tests/select_font.rs:57:13:
assertion `left == right` failed
  left: Some("arialbd.ttf")
 right: Some("DejaVuSans-Bold.ttf")

---- test::select_best_match_monospace stdout ----
thread 'test::select_best_match_monospace' panicked at tests/select_font.rs:57:13:
assertion `left == right` failed
  left: Some("SourceCodePro-Regular.otf")
 right: Some("DejaVuSansMono.ttf")

---- test::select_best_match_serif stdout ----
thread 'test::select_best_match_serif' panicked at tests/select_font.rs:57:13:
assertion `left == right` failed
  left: Some("times.ttf")
 right: Some("DejaVuSerif.ttf")
jayvdb commented 10 months ago

Also seeing these failures which look like the same problem

thread 'get_glyph_advance_and_origin' panicked at tests/tests.rs:555:5:
assertion `left == right` failed
  left: Ok(Vector2F(<1139, 0>))
 right: Ok(Vector2F(<1255, 0>))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- get_font_metrics stdout ----
thread 'get_font_metrics' panicked at tests/tests.rs:599:5:
assertion `left == right` failed
  left: 1854.0
 right: 1901.0

---- get_vertically_hinted_glyph_outline stdout ----
thread 'get_vertically_hinted_glyph_outline' panicked at tests/tests.rs:238:5:
assertion `left == right` failed
  left: Outline { contours: [Contour { positions: [Vector2F(<128, 1280>), Vector2F(<128, 1536>), Vector2F(<256, 1536>), Vector2F(<256, 1280>)], flags: [(empty), (empty), (empty), (empty)] }, Contour { positions: [Vector2F(<128, 0>), Vector2F(<128, 1152>), Vector2F(<256, 1152>), Vector2F(<256, 0>)], flags: [(empty), (empty), (empty), (empty)] }] }
 right: Outline { contours: [Contour { positions: [Vector2F(<136, 1316>), Vector2F(<136, 1536>), Vector2F(<316, 1536>), Vector2F(<316, 1316>)], flags: [(empty), (empty), (empty), (empty)] }, Contour { positions: [Vector2F(<136, 0>), Vector2F(<136, 1152>), Vector2F(<316, 1152>), Vector2F(<316, 0>)], flags: [(empty), (empty), (empty), (empty)] }] }

---- get_fully_hinted_glyph_outline stdout ----
thread 'get_fully_hinted_glyph_outline' panicked at tests/tests.rs:329:5:
assertion `left == right` failed
  left: Outline { contours: [Contour { positions: [Vector2F(<204.8, 1228.8>), Vector2F(<204.8, 1433.6>), Vector2F(<409.6, 1433.6>), Vector2F(<409.6, 1228.8>)], flags: [(empty), (empty), (empty), (empty)] }, Contour { positions: [Vector2F(<204.8, 0>), Vector2F(<204.8, 1024>), Vector2F(<409.6, 1024>), Vector2F(<409.6, 0>)], flags: [(empty), (empty), (empty), (empty)] }] }
 right: Outline { contours: [Contour { positions: [Vector2F(<137.6, 1228.8>), Vector2F(<137.6, 1433.6>), Vector2F(<316.80002, 1433.6>), Vector2F(<316.80002, 1228.8>)], flags: [(empty), (empty), (empty), (empty)] }, Contour { positions: [Vector2F(<137.6, 0>), Vector2F(<137.6, 1024>), Vector2F(<316.80002, 1024>), Vector2F(<316.80002, 0>)], flags: [(empty), (empty), (empty), (empty)] }] }

---- get_glyph_typographic_bounds stdout ----
thread 'get_glyph_typographic_bounds' panicked at tests/tests.rs:508:5:
assertion `left == right` failed
  left: Ok(RectF(<74, -24, 1052, 1086>))
 right: Ok(RectF(<123, -29, 1069, 1147>))

---- get_glyph_outline stdout ----
thread 'get_glyph_outline' panicked at tests/tests.rs:192:5:
assertion `left == right` failed
  left: Outline { contours: [Contour { positions: [Vector2F(<136, 1259>), Vector2F(<136, 1466>), Vector2F(<316, 1466>), Vector2F(<316, 1259>)], flags: [(empty), (empty), (empty), (empty)] }, Contour { positions: [Vector2F(<136, 0>), Vector2F(<136, 1062>), Vector2F(<316, 1062>), Vector2F(<316, 0>)], flags: [(empty), (empty), (empty), (empty)] }] }
 right: Outline { contours: [Contour { positions: [Vector2F(<193, 1120>), Vector2F(<377, 1120>), Vector2F(<377, 0>), Vector2F(<193, 0>)], flags: [(empty), (empty), (empty), (empty)] }, Contour { positions: [Vector2F(<193, 1556>), Vector2F(<377, 1556>), Vector2F(<377, 1323>), Vector2F(<193, 1323>)], flags: [(empty), (empty), (empty), (empty)] }] }