mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 06:31:41 +00:00
PDF/.ai import: legacy TG, Xu and Tu with bad operands give no warning
A line breaking value (TG) or Japanese layout rules (Xu, Tu) with missing or non-numeric operands no longer mark the setting as set, so the next visible text object gives no warning about a setting the file did not specify.
This commit is contained in:
@@ -751,9 +751,10 @@ impl Reader<'_> {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
// `linebreak TG` and `prop cjkLayout cjkRoman cjkCjk Xu` (`Tu` the same, §22.6).
|
||||
"TG" => st.line_breaking = true,
|
||||
"Xu" | "Tu" => st.japanese_layout = true,
|
||||
// `linebreak TG` and `prop cjkLayout cjkRoman cjkCjk Xu` (`Tu` the same, §22.6). Either
|
||||
// one is set only when its operands are numbers.
|
||||
"TG" => st.line_breaking |= n0.is_some(),
|
||||
"Xu" | "Tu" => st.japanese_layout |= nums::<4>(vals).is_some(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4387,6 +4387,16 @@ fn legacy_line_breaking_and_japanese_layout_rules_are_warned_once() {
|
||||
assert_eq!(art_texts(&r.doc)[0].plain_text(), "Hi");
|
||||
}
|
||||
|
||||
/// `TG`, `Xu` and `Tu` with missing or non-numeric operands set nothing, so they give no warning.
|
||||
#[test]
|
||||
fn legacy_line_breaking_and_japanese_layout_rules_with_bad_operands_are_not_warned() {
|
||||
for attrs in ["TG", "(a) TG", "1 120 150 Xu", "0 1 (a) 150 Xu", "Tu", "0 1 120 (a) Tu"] {
|
||||
let r = legacy_read(&point_type(attrs, "a"));
|
||||
assert!(r.warnings.is_empty(), "{attrs}: {:?}", r.warnings);
|
||||
assert_eq!(art_texts(&r.doc)[0].plain_text(), "a", "{attrs}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Spacing is kept to the ranges the Justification options take, a Minimum, Desired and Maximum
|
||||
/// out of order go back to their defaults, and hyphenation's letter counts and limit to the ranges
|
||||
/// `text.setFormat` takes.
|
||||
|
||||
Reference in New Issue
Block a user