-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestAdlamRoundTrip.py
57 lines (43 loc) · 1.44 KB
/
testAdlamRoundTrip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Test Adlam and Latin conversions round tripping
import ff_sample_text
import adlamConversion
import difflib
import sys
def compareLatin(l0, l1):
print('l0: %s' % l0)
print('l1: %s' % l1)
d = difflib.ndiff(l0, l1)
print(''.join(d), end="")
#sys.stdout.writelines(d)
def compareAdlam(al0, a1):
# Convert differences to hex?
return
def roundTripALA(converter):
# Get Latin text
latin0 = ff_sample_text.kaalden_latin_text0
adlam0 = ff_sample_text.kaalden_adlam_text0
adlam1 = converter.convertText(latin0,
fontIndex=adlamConversion.LATIN2ADLAM)
#print('ADLAM1 = %s' % adlam1)
#compareAdlam(adlam0, aadlam1)
# get Adlam text
latin1 = converter.convertText(adlam0,
fontIndex=adlamConversion.ADLAM2LATIN)
#print('LATIN1 = %s' % latin1)
# Compare latin0 and latin1
compareLatin(latin0, latin1)
# Compare adlam0 and adlam1
adlam2 = converter.convertText(latin1,
fontIndex=adlamConversion.LATIN2ADLAM)
#print('ADLAM2 = %s' % adlam2)
# convert back to Latin
latin2 = converter.convertText(adlam2,
fontIndex=adlamConversion.ADLAM2LATIN)
#print('LATIN2 = %s' % latin2)
# compare them
return
def main(argv):
converter = adlamConversion.AdlamConverter()
roundTripALA(converter)
if __name__ == '__main__':
main(sys.argv)