Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sfntdiff] Support diff'ing different font formats
Browse files Browse the repository at this point in the history
Fixes #626
miguelsousa committed Mar 14, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 112b6aa commit 2a26b82
Showing 5 changed files with 18 additions and 21 deletions.
20 changes: 1 addition & 19 deletions c/sfntdiff/source/Dmain.c
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ IntN main(IntN argc, Byte8 *argv[]) {

volatile IntX i = 0;
IntN argi;
Card32 value, value2;
Card32 value;
Byte8 *filename1;
Byte8 *filename2;
IntN name1isDir, name2isDir;
@@ -152,12 +152,6 @@ IntN main(IntN argc, Byte8 *argv[]) {

/* See if we can recognize the file type */
value = fileSniff(1);
value2 = fileSniff(2);
if (value != value2) {
fileClose(1);
fileClose(2);
fatal("file1 [%s] is not the same type as file2 [%s]\n", filename1, filename2);
}

switch (value) {
case bits_:
@@ -212,12 +206,6 @@ IntN main(IntN argc, Byte8 *argv[]) {

/* See if we can recognize the file type */
value = fileSniff(1);
value2 = fileSniff(2);
if (value != value2) {
fileClose(1);
fileClose(2);
fatal("file1 [%s] is not the same type as file2 [%s]\n", fil1, fil2);
}

switch (value) {
case bits_:
@@ -270,12 +258,6 @@ IntN main(IntN argc, Byte8 *argv[]) {

/* See if we can recognize the file type */
value = fileSniff(1);
value2 = fileSniff(2);
if (value != value2) {
fileClose(1);
fileClose(2);
fatal("file1 [%s] is not the same type as file2 [%s]\n", filename1, fil2);
}

switch (value) {
case bits_:
8 changes: 8 additions & 0 deletions tests/sfntdiff_data/expected_output/bug626.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Thu Mar 14 02:59:39 2019
sfntdiff (2.21217) (-d 0) files:
< SourceSerifPro-It.otf
> SourceSerifPro-It.ttf
'sfnt' differs.
'head' differs.
'maxp' differs.
'post' differs.
Binary file added tests/sfntdiff_data/input/SourceSerifPro-It.otf
Binary file not shown.
Binary file added tests/sfntdiff_data/input/SourceSerifPro-It.ttf
Binary file not shown.
11 changes: 9 additions & 2 deletions tests/sfntdiff_test.py
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
from test_utils import get_expected_path

TOOL = 'sfntdiff'
CMD = ['-t', TOOL]


# -----
@@ -41,7 +42,13 @@ def test_exit_unknown_option(arg):
def test_diff(args, txt_filename):
if args:
args.insert(0, '-o')
actual_path = runner(
['-t', TOOL, '-s', '-f', 'regular.otf', 'bold.otf'] + args)
actual_path = runner(CMD + ['-s', '-f', 'regular.otf', 'bold.otf'] + args)
expected_path = get_expected_path(txt_filename)
assert differ([expected_path, actual_path, '-l', '1-4'])


def test_diff_otf_vs_ttf_bug626():
actual_path = runner(CMD + ['-s', '-f', 'SourceSerifPro-It.otf',
'SourceSerifPro-It.ttf'])
expected_path = get_expected_path('bug626.txt')
assert differ([expected_path, actual_path, '-l', '1-4'])

0 comments on commit 2a26b82

Please sign in to comment.