mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-14 22:42:46 +00:00
Respect PostScript delimiters after literal names
This commit is contained in:
1 parent
24a011ae59
commit
ab51daff1a
1 file changed
+9
-5
@@ -133,11 +133,7 @@ fn find_eexec(ps: &[u8], from: usize) -> Option<usize> {
|
||||
pos += 1;
|
||||
}
|
||||
while pos < ps.len() && !is_white(ps[pos]) && !is_delimiter(ps[pos]) {
|
||||
if ps[pos] == b'\\' {
|
||||
pos = pos.saturating_add(2).min(ps.len());
|
||||
} else {
|
||||
pos += 1;
|
||||
}
|
||||
pos += 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -262,4 +258,12 @@ mod tests {
|
||||
assert_eq!(super::name_after(&source, b"/FontName").as_deref(), Some("Test"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn literal_name_backslash_does_not_escape_a_comment_delimiter() {
|
||||
let ps = b"%!PS-AdobeFont-1.0: Test\n/FontName /Test def\n/unused\\%(\npop\ncurrentfile eexec\n0000\ncleartomark\n";
|
||||
let fonts = embedded_font_programs(ps);
|
||||
assert_eq!(fonts.len(), 1);
|
||||
assert_eq!(fonts[0].name.as_deref(), Some("Test"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user