Stop Std14::recognise mapping sans-serif font names to Times

Found while testing crates/fonts/src/std14.rs:84

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
NetterSilver
2026-10-20 19:36:57 +02:00
co-authored by Claude Haiku 5.5
parent 22bedbf2af
commit ab815b50a6
+7 -1
View File
@@ -81,7 +81,7 @@ impl Std14 {
if has("times") {
return Some((times(), Match::Alias));
}
if has("serif") || has("roman") {
if (has("serif") && !has("sans")) || has("roman") {
return Some((times(), Match::FamilyHint));
}
if has("helvetica") || has("arial") {
@@ -125,6 +125,12 @@ impl Std14 {
mod tests {
use super::*;
#[test]
fn sans_serif_names_are_not_mapped_to_times() {
assert!(!matches!(Std14::recognise("SansSerif"), Some((Std14::TimesRoman, _))));
assert_eq!(Std14::recognise("Arial-SansSerif"), Some((Std14::Helvetica, Match::Alias)));
}
/// Widths from the published Core14 metrics, typed in here by hand so the table is checked
/// against the specification rather than against whatever produced it.
#[test]