You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnOk(Status::just_one_fail("lacks-table","No name table."));
44
+
}
45
+
let config = context.local_config("name/family_and_style_max_length");
46
+
let full_name_length:usize = config
47
+
.get("FULL_NAME")
48
+
.and_then(|v| v.as_u64())
49
+
.unwrap_or(32)asusize;
50
+
51
+
let postscript_name_length:usize = config
52
+
.get("POSTSCRIPT_NAME")
53
+
.and_then(|v| v.as_u64())
54
+
.unwrap_or(27)asusize;
55
+
56
+
let instance_name_length:usize = config
57
+
.get("INSTANCE_NAME")
58
+
.and_then(|v| v.as_u64())
59
+
.unwrap_or(32)asusize;
60
+
42
61
letmut problems = vec![];
43
-
if f.get_name_entry_strings(NameId::FULL_NAME)
44
-
.any(|name| strip_ribbi(&name).len() > 32)
45
-
{
46
-
problems.push(Status::fail(
62
+
for name in f.get_name_entry_strings(NameId::FULL_NAME){
63
+
ifstrip_ribbi(&name).len() > full_name_length {
64
+
let chars_too_long_count = strip_ribbi(&name).len() - full_name_length;
65
+
let chars_too_long = chars_too_long_count.to_string();
66
+
problems.push(Status::fail(
47
67
"nameid4-too-long",
48
-
"Name ID 4 'Full Font Name' exceeds 32 characters. This has been found to cause problems with the dropdown menu in old versions of Microsoft Word as well as shaping issues for some accented letters in Microsoft Word on Windows 10 and 11.",
68
+
&format!(
69
+
"Name ID 4 'Full Font Name' exceeds {} characters ({} characters too long). This has been found to cause problems with the dropdown menu in old versions of Microsoft Word as well as shaping issues for some accented letters in Microsoft Word on Windows 10 and 11.",
70
+
full_name_length,
71
+
chars_too_long
72
+
),
49
73
));
74
+
}
50
75
}
51
-
if f.get_name_entry_strings(NameId::POSTSCRIPT_NAME)
52
-
.any(|name| name.len() > 27)
53
-
{
54
-
problems.push(Status::warn(
55
-
"nameid6-too-long",
56
-
"Name ID 6 'PostScript Name' exceeds 27 characters. This has been found to cause problems with PostScript printers, especially on Mac platforms.",
57
-
));
76
+
for name in f.get_name_entry_strings(NameId::POSTSCRIPT_NAME){
77
+
if name.len() > postscript_name_length {
78
+
let chars_too_long_count = name.len() - postscript_name_length;
79
+
let chars_too_long = chars_too_long_count.to_string();
80
+
problems.push(Status::warn(
81
+
"nameid6-too-long",
82
+
&format!(
83
+
"Name ID 6 'PostScript Name' exceeds {} characters ({} characters too long). This has been found to cause problems with PostScript printers, especially on Mac platforms.",
84
+
postscript_name_length,
85
+
chars_too_long
86
+
),
87
+
));
88
+
}
58
89
}
59
90
let name = f.font().name()?;
60
91
let typo_family_names:HashMap<(u16,u16,u16),String> =
let family_name = typo_family_names.get(key).unwrap_or(string);
71
102
let full_instance_name = format!("{family_name} {instance_name}");
72
-
if full_instance_name.len() > 32{
103
+
if full_instance_name.len() > instance_name_length {
104
+
let chars_too_long_count = full_instance_name.len() - instance_name_length;
105
+
let chars_too_long = chars_too_long_count.to_string();
73
106
problems.push(Status::fail(
74
107
"instance-too-long",
75
108
&format!(
76
-
"Variable font instance name '{}' formed by space-separated concatenation of font family name (nameID {}) and instance subfamily nameID {} exceeds 32 characters.\n\nThis has been found to cause shaping issues for some accented letters in Microsoft Word on Windows 10 and 11.",
109
+
"Variable font instance name '{}' formed by space-separated concatenation of font family name (nameID {}) and instance subfamily nameID {} exceeds {} characterss ({} characters too long).\n\nThis has been found to cause shaping issues for some accented letters in Microsoft Word on Windows 10 and 11.",
0 commit comments