-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@GROUP = [ f g h ]; | ||
|
||
pos [ a b c d e ] [ a b c d e ] -42; # 25 | ||
pos x [ a b c d e ] -42; # 5 | ||
pos [ a b c d e ] x -42; # 5 | ||
pos [ a b c ] @GROUP -42; # 9 | ||
pos @GROUP [ a b c ] -42; # 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# comment | ||
# comment | ||
|
||
asd # invalid line | ||
@GROUP = [ grouped_1 grouped_2 ]; # comment | ||
|
||
pos A [four.dnom] -42; | ||
pos [ a b c ] A -42; | ||
pos [ a b c ] @GROUP -42; | ||
pos @GROUP @GROUP -42; | ||
subtable; | ||
pos [ a b c ] [four.dnom] -42; | ||
pos [fraction divisionslash] [four.dnom] -42; | ||
pos [fraction divisionslash] [a b c] -42; | ||
pos [x y z] [x y z] 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@GROUP = [ x y z ]; | ||
|
||
enum pos [ a b c ] d -42; # 3 | ||
enum pos [ d e f ] [ g h i ] -42; # 9 | ||
enum pos j [ k @GROUP ] -42; # 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@GROUP_1 = [ a b c d e ]; | ||
@GROUP_2 = [ a b c d e ]; | ||
|
||
pos @GROUP_1 @GROUP_2 -42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
a a -42 | ||
a b -42 | ||
a c -42 | ||
a d -42 | ||
a e -42 | ||
a f -42 | ||
a g -42 | ||
a h -42 | ||
a x -42 | ||
b a -42 | ||
b b -42 | ||
b c -42 | ||
b d -42 | ||
b e -42 | ||
b f -42 | ||
b g -42 | ||
b h -42 | ||
b x -42 | ||
c a -42 | ||
c b -42 | ||
c c -42 | ||
c d -42 | ||
c e -42 | ||
c f -42 | ||
c g -42 | ||
c h -42 | ||
c x -42 | ||
d a -42 | ||
d b -42 | ||
d c -42 | ||
d d -42 | ||
d e -42 | ||
d x -42 | ||
e a -42 | ||
e b -42 | ||
e c -42 | ||
e d -42 | ||
e e -42 | ||
e x -42 | ||
f a -42 | ||
f b -42 | ||
f c -42 | ||
g a -42 | ||
g b -42 | ||
g c -42 | ||
h a -42 | ||
h b -42 | ||
h c -42 | ||
x a -42 | ||
x b -42 | ||
x c -42 | ||
x d -42 | ||
x e -42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
A four.dnom -42 | ||
a A -42 | ||
a four.dnom -42 | ||
a grouped_1 -42 | ||
a grouped_2 -42 | ||
b A -42 | ||
b four.dnom -42 | ||
b grouped_1 -42 | ||
b grouped_2 -42 | ||
c A -42 | ||
c four.dnom -42 | ||
c grouped_1 -42 | ||
c grouped_2 -42 | ||
divisionslash a -42 | ||
divisionslash b -42 | ||
divisionslash c -42 | ||
divisionslash four.dnom -42 | ||
fraction a -42 | ||
fraction b -42 | ||
fraction c -42 | ||
fraction four.dnom -42 | ||
grouped_1 grouped_1 -42 | ||
grouped_1 grouped_2 -42 | ||
grouped_2 grouped_1 -42 | ||
grouped_2 grouped_2 -42 | ||
x x 42 | ||
x y 42 | ||
x z 42 | ||
y x 42 | ||
y y 42 | ||
y z 42 | ||
z x 42 | ||
z y 42 | ||
z z 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
a d -42 | ||
b d -42 | ||
c d -42 | ||
d g -42 | ||
d h -42 | ||
d i -42 | ||
e g -42 | ||
e h -42 | ||
e i -42 | ||
f g -42 | ||
f h -42 | ||
f i -42 | ||
j k -42 | ||
j x -42 | ||
j y -42 | ||
j z -42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
A four.dnom -42 | ||
a A -42 | ||
a four.dnom -42 | ||
a grouped_1 -42 | ||
a grouped_2 -42 | ||
b A -42 | ||
b four.dnom -42 | ||
b grouped_1 -42 | ||
b grouped_2 -42 | ||
c A -42 | ||
c four.dnom -42 | ||
c grouped_1 -42 | ||
c grouped_2 -42 | ||
divisionslash a -42 | ||
divisionslash b -42 | ||
divisionslash c -42 | ||
divisionslash four.dnom -42 | ||
fraction a -42 | ||
fraction b -42 | ||
fraction c -42 | ||
fraction four.dnom -42 | ||
grouped_1 grouped_1 -42 | ||
grouped_1 grouped_2 -42 | ||
grouped_2 grouped_1 -42 | ||
grouped_2 grouped_2 -42 | ||
x x 42 | ||
x y 42 | ||
x z 42 | ||
y x 42 | ||
y y 42 | ||
y z 42 | ||
z x 42 | ||
z y 42 | ||
z z 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
a a -42 | ||
a b -42 | ||
a c -42 | ||
a d -42 | ||
a e -42 | ||
b a -42 | ||
b b -42 | ||
b c -42 | ||
b d -42 | ||
b e -42 | ||
c a -42 | ||
c b -42 | ||
c c -42 | ||
c d -42 | ||
c e -42 | ||
d a -42 | ||
d b -42 | ||
d c -42 | ||
d d -42 | ||
d e -42 | ||
e a -42 | ||
e b -42 | ||
e c -42 | ||
e d -42 | ||
e e -42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
f_l c -42 | ||
f_l cacute -42 | ||
f_l ccaron -42 | ||
f_l ccedilla -42 | ||
ffl c -42 | ||
ffl cacute -42 | ||
ffl ccaron -42 | ||
ffl ccedilla -42 | ||
fl c -42 | ||
fl cacute -42 | ||
fl ccaron -42 | ||
fl ccedilla -42 | ||
l c -42 | ||
l cacute -42 | ||
l ccaron -42 | ||
l ccedilla -42 | ||
lacute c -42 | ||
lacute cacute -42 | ||
lacute ccaron -42 | ||
lacute ccedilla -42 | ||
lcaron c -42 | ||
lcaron cacute -42 | ||
lcaron ccaron -42 | ||
lcaron ccedilla -42 | ||
lcommaaccent c -42 | ||
lcommaaccent cacute -42 | ||
lcommaaccent ccaron -42 | ||
lcommaaccent ccedilla -42 | ||
lslash c -42 | ||
lslash cacute -42 | ||
lslash ccaron -42 | ||
lslash ccedilla -42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@C_LC = [c ccedilla cacute ccaron]; | ||
@L_LC = [l lslash lacute lcaron lcommaaccent]; | ||
@L_LC_LEFT = [@L_LC ffl fl f_l]; | ||
|
||
pos @L_LC_LEFT @C_LC -42; # 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
if '..' not in sys.path: | ||
sys.path.append('..') # https://stackoverflow.com/a/16985066 | ||
|
||
import getKerningPairsFromFEA as gkp | ||
|
||
TEST_DIR = Path(__file__).parent | ||
REFERENCE_DIR = TEST_DIR / 'kerndumps_expected' | ||
|
||
|
||
def read_file(path): | ||
''' | ||
Read a file, return the data | ||
''' | ||
|
||
with open(path, 'r', encoding='utf-8') as f: | ||
data = f.read() | ||
return data | ||
|
||
|
||
def test_group_group(): | ||
input_file = TEST_DIR / 'group_group_test.fea' | ||
dump_file = REFERENCE_DIR / input_file.with_suffix('.kerndump').name | ||
kfr = gkp.FEAKernReader(input_file) | ||
assert('\n'.join(kfr.output) == read_file(dump_file)) | ||
assert len(kfr.output) == 5 * 5 | ||
|
||
|
||
def test_ad_hoc_groups(): | ||
input_file = TEST_DIR / 'ad_hoc_group_test.fea' | ||
dump_file = REFERENCE_DIR / input_file.with_suffix('.kerndump').name | ||
kfr = gkp.FEAKernReader(input_file) | ||
assert('\n'.join(kfr.output) == read_file(dump_file)) | ||
assert len(kfr.output) == 53 | ||
|
||
|
||
def test_enum(): | ||
input_file = TEST_DIR / 'enum_test.fea' | ||
dump_file = REFERENCE_DIR / input_file.with_suffix('.kerndump').name | ||
kfr = gkp.FEAKernReader(input_file) | ||
assert('\n'.join(kfr.output) == read_file(dump_file)) | ||
assert len(kfr.output) == 16 | ||
|
||
|
||
def test_nested_groups(): | ||
input_file = TEST_DIR / 'nested_group_test.fea' | ||
dump_file = REFERENCE_DIR / input_file.with_suffix('.kerndump').name | ||
kfr = gkp.FEAKernReader(input_file) | ||
assert('\n'.join(kfr.output) == read_file(dump_file)) | ||
assert len(kfr.output) == 32 | ||
|
||
|
||
def test_catchall(): | ||
input_file = TEST_DIR / 'catchall_test.fea' | ||
dump_file = REFERENCE_DIR / input_file.with_suffix('.kerndump').name | ||
kfr = gkp.FEAKernReader(input_file) | ||
assert('\n'.join(kfr.output) == read_file(dump_file)) |