mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 18:10:01 -06:00
Type: Kerning has an Optical option that spaces characters by their shapes
Squashed from #4825 onto main.
This commit is contained in:
@@ -460,6 +460,20 @@ fn auto_leading_new_distinguishes_unset_attributes() {
|
||||
assert_eq!(s.doc().unwrap().doc.char_styles[2].attrs.get("leading"), Some(&Value::Null));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optical_character_style_captures_and_redefines_automatic_mode() {
|
||||
let (mut s, id) = session_with_text("III");
|
||||
s.execute("text.setRangeStyle", &json!({"id": id, "kerning": "optical"})).unwrap();
|
||||
s.execute("charStyle.new", &json!({"name": "Profile", "id": id})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().doc.char_styles[0].attrs.get("opticalKerning"), Some(&json!(true)));
|
||||
s.execute("text.setRangeStyle", &json!({"id": id, "kerning": "auto"})).unwrap();
|
||||
s.execute("charStyle.apply", &json!({"name": "Profile", "id": id})).unwrap();
|
||||
assert!(runs(&s, id)[0].style.optical_kerning);
|
||||
s.execute("text.setRangeStyle", &json!({"id": id, "kerning": "auto"})).unwrap();
|
||||
s.execute("charStyle.redefine", &json!({"name": "Profile", "id": id})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().doc.char_styles[0].attrs.get("opticalKerning"), Some(&json!(false)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paragraph_styles_and_survive_save() {
|
||||
let (mut s, id) = session_with_text("Body");
|
||||
|
||||
Reference in New Issue
Block a user