mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-22 02:15:24 +01:00
Tests: set the retype tests' type in a bundled font
Outlined text without a font took the system's default face, so a near match of round glyphs depended on the machine's installed fonts. The outlined helper now sets such text in Source Sans 3.
This commit is contained in:
1 parent
67fa32374d
commit
62ff5832d4
1 file changed
+7
-1
@@ -10,7 +10,13 @@ fn session() -> Session {
|
||||
}
|
||||
|
||||
/// Point text, outlined: the id of the outlines' group.
|
||||
fn outlined(s: &mut Session, p: serde_json::Value) -> u64 {
|
||||
fn outlined(s: &mut Session, mut p: serde_json::Value) -> u64 {
|
||||
// A text without a font is set in the system's default face, which differs from machine to
|
||||
// machine and decides which glyphs a near match can tell apart.
|
||||
if p.get("font").is_none() {
|
||||
p["font"] = json!("Source Sans 3");
|
||||
p["style"] = json!("Regular");
|
||||
}
|
||||
let id = s.execute("text.create", &p).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
s.execute("type.createOutlines", &json!({})).unwrap()["ids"][0].as_u64().unwrap()
|
||||
|
||||
Reference in new issue
Block a user