Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions c/mergefonts/source/mergeFonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,21 +1177,21 @@ static void stringStrip(char *str) {
if (end == 0)
return;

while (start < MAX_DICT_ENTRY_LEN) {
if ((str[start] == ' ') || (str[start] == '\t') || (str[start] == '(') || (str[start] == '\r') || (str[start] == '\n'))
start++;
while (end >= 0) {
if ((str[end] == ' ') || (str[end] == '\t') || (str[end] == ')') || (str[end] == '\r') || (str[end] == '\n'))
end--;
else
break;
}
str[end + 1] = 0;

while (end >= 0) {
if ((str[end] == ' ') || (str[end] == '\t') || (str[end] == ')') || (str[end] == '\r') || (str[end] == '\n'))
end--;
while (start < MAX_DICT_ENTRY_LEN) {
if ((str[start] == ' ') || (str[start] == '\t') || (str[start] == '(') || (str[start] == '\r') || (str[start] == '\n'))
start++;
else
break;
}

str[end + 1] = 0;
if (start > 0)
memmove(str, &str[start], (end - start) + 2);
if (strlen(str) == 0) {
Expand Down
9 changes: 9 additions & 0 deletions tests/mergefonts_data/input/cidwhitespace/cidfontinfo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FontName ( )
Registry Adobe
Ordering Identity
Supplement 0
FSType 4
Weight (Regular)
FamilyName (Source Sans)
version (2.20)
AdobeCopyright (Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'.)
18 changes: 18 additions & 0 deletions tests/mergefonts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,21 @@ def test_camel_case():
expected_path = generate_ps_dump(expected_path)

assert differ([expected_path, actual_path, '-s', r'%ADOt1write:'])


def test_cidwhitespace():
font1_filename = 'font1.pfa'
font2_filename = 'font2.pfa'
font3_filename = 'font3.pfa'
alias1_filename = 'alias1.txt'
alias2_filename = 'alias2.txt'
alias3_filename = 'alias3.txt'
fontinfo_filename = 'cidwhitespace/cidfontinfo.txt'
actual_path = get_temp_file_path()

# without fix this dies with <Signals.SIGSEGV: 11...>
runner(CMD + ['-o', 'cid', '-f', fontinfo_filename, actual_path,
alias1_filename, font1_filename,
alias2_filename, font2_filename,
alias3_filename, font3_filename])