forked from 1b-agent/opencadstudio-upstream
fix(text): address PR #180 review
Follow-up cleanups on the merged TTF-fill work: - Drop the unconditional resolve_text_style log line — it fired for every text style and spammed ~7k stderr lines opening a single real drawing. - Drop the per-glyph tessellation-error eprintln; a malformed font would otherwise log once per character. The glyph still falls back silently. - Tessellate glyph fills with the nonzero winding rule (lyon defaults to even-odd, which mis-fills TrueType outlines whose contours overlap). - Make the sysfont prefix fallback deterministic (sorted) and require ≥3 chars so a 1–2 letter request can't grab an arbitrary family. - Remove the unrelated windows-gnu --exclude-all-symbols linker flag that slipped into .cargo/config.toml. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
e9cb9af924
commit
dee5a05652
4 files changed
+34
-23
No files matched your search
@@ -74,12 +74,22 @@ pub fn canonical_family_name(family: &str) -> Option<String> {
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Try matching prefix/subset case-insensitively
|
||||
if let Some(matched) = fonts().families.iter().find(|&f| {
|
||||
let f_low = f.to_lowercase();
|
||||
f_low.starts_with(&family_lower) || family_lower.starts_with(&f_low)
|
||||
}) {
|
||||
return Some(matched.clone());
|
||||
// 4. Try matching prefix/subset case-insensitively. Require at least 3
|
||||
// chars so a 1–2 letter request can't grab an arbitrary family by the
|
||||
// first iteration order. Iterating sorted keeps the pick deterministic.
|
||||
if family_lower.len() >= 3 {
|
||||
let mut candidates: Vec<&String> = fonts()
|
||||
.families
|
||||
.iter()
|
||||
.filter(|&f| {
|
||||
let f_low = f.to_lowercase();
|
||||
f_low.starts_with(&family_lower) || family_lower.starts_with(&f_low)
|
||||
})
|
||||
.collect();
|
||||
candidates.sort();
|
||||
if let Some(matched) = candidates.first() {
|
||||
return Some((*matched).clone());
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user