-
Notifications
You must be signed in to change notification settings - Fork 4
/
mendekikakui.py
226 lines (208 loc) · 7.13 KB
/
mendekikakui.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import base
# import transliterate
# import transrule_ccp
import json
import logging
import os
import sys
import urllib
import webapp2
from google.appengine.ext.webapp import template
LanguageCode = 'men'
Language = 'Mende'
encoding_font_list = [
{
'font_path':'/fonts/MendeKikakui/jgmende.ttf',
'source':'/fonts/MendeKikakui/jgmende.ttf',
'font_name':'JGMende',
'family': 'JGMende',
'longName': 'JGMende PUA',
'display_name': 'JG Mende PUA',
'Source location': 'http://glavyfonts.com/african.html',
},
]
unicode_font_list = [
{
# Contains both Unicode and JG
'family': 'KikakuiSansPro',
'longName': 'Kikakui Sans Pro',
'source': '/fonts/MendeKikakui/KikakuiSansPro.ot.ttf',
'encoding': 'PUA',
},
{
'family': 'NotoSansMendeKikakui',
'longName': 'Noto Sans Mende Kikakui',
'source': '/fonts/MendeKikakui/NotoSansMendeKikakui-Regular.ttf',
'encoding': 'unicode',
},
encoding_font_list[0],
]
links = [
{'linkText': 'Keyboard',
'ref': '/men/'
},\
{'linkText': 'Keyboard conversions',
'ref': '/' + 'men' + '/kbtransforms/'
},
{'linkText': 'Phonetic table',
'ref': '/' + LanguageCode + '/phonetickb/'
},
{'linkText': 'Converter',
'ref': '/men/convertUI/'
},
{'linkText': 'Font conversion summary',
'ref': '/men/encodingRules/'
},
{'linkText': 'Resources',
'ref': '/men/downloads/'
},
{'linkText': 'Unicode Page',
'ref': 'https://www.unicode.org/charts/PDF/U1E800.pdf'
},
{'linkText': 'Unicode proposal 2012',
'ref': 'https://www.unicode.org/L2/L2012/12023-n4167-mende.pdf'
},
{'linkText': 'Language Wikipedia',
'ref': 'https://en.wikipedia.org/wiki/Mende_language'
},
{'linkText': 'Athinkra Character Picker',
'ref': 'http://athinkra.github.io/mende-kikakui/tools/#?load=0x1e800-mende_kikakui.json'
},
{'linkText': 'Digital Orientalist',
'ref': 'https://digitalorientalist.com/2021/01/22/building-tools-with-bete-mende-and-kpelle-users/'
},
{'linkText': 'Jason Glavy fonts',
'ref': 'http://glavyfonts.com/african.html'
},
{'linkText': 'YouTube video about Ki-ka-kui',
'ref': 'https://youtu.be/THQYjoVjZlQ?si=0Astt8p3kFvx4BmC'
}
]
class langInfo():
def __init__(self):
self.LanguageCode = 'men'
self.Language = 'Mende'
self.Language_native = u''
self.direction = 'rtl'
self.insert_text = u'\u202e' # Force RTL
if sys.maxunicode >= 0x10000:
logging.info('WIDE SYSTEM BUILD!!!')
self.diacritic_list = [unichr(x) for x in range(0x16af0, 0x16af5)]
else:
logging.info('NARROW SYSTEM BUILD!!!')
self.diacritic_list = [unichr(0xd81a) + unichr(0xde00 + x) for x in range(0xf0, 0xf5)]
self.base_consonant = u'𞠀'
self.baseHexUTF16 = u'\ud81a\udee7'
self.lang_list = [
{ 'shortName': self.LanguageCode,
'longName': self.Language,
}
]
self.encoding_font_list = encoding_font_list
self.kb_list = [
{
'shortName': 'menphone3',
'longName': 'Mende Phonetic 3',
'jsName': 'menphone3',
'instructions': 'Updated 14-Feb-2023. Use / to end a syllable.',
'font': 'MendeKikakuiFonts',
'fontFamilyToApply': ['NotoSansMendeKikakui', 'JGMende'],
'fontFamily': 'KikakuiSansPro',
},
# {
# 'shortName': 'menphone2',
# 'longName': 'Mende Phonetic2',
# 'jsName': 'menphone2',
# 'instructions': 'Updated 17-Nov-2022',
# 'font': 'MendeKikakuiFonts',
# 'fontFamilyToApply': ['NotoSansMendeKikakui', 'JGMende'],
# 'fontFamily': 'KikakuiSansPro',
# },
# {
# 'shortName': 'menphone2_old',
# 'longName': 'Mende Phonetic2 Old',
# 'jsName': 'menphone2',
# 'instructions': 'Updated 17-Nov-2022',
# 'font': 'MendeKikakuiFonts',
# 'fontFamilyToApply': ['NotoSansMendeKikakui', 'JGMende'],
# 'fontFamily': 'KikakuiSansPro',
# },
# {
# 'shortName': self.LanguageCode + "PhonePUA",
# 'longName': 'Mende:Phonetic + PUA',
# 'jsName': self.LanguageCode + "PhonePUA",
# 'instructions': 'Private Use Area',
# 'font': 'MendeKikakuiFonts',
# 'fontFamilyToApply': ['NotoSansMendeKikakui', 'JGMende'],
# 'fontFamily': 'KikakuiSansPro',
# #'fontFamily': 'MendeKikakuiFonts',
# },
# {
# 'shortName': self.LanguageCode + "Phone",
# 'longName': 'Mende Phonetic',
# 'jsName': self.LanguageCode + "Phone",
# 'instructions': None,
# 'font': 'JGMende',
# },
# {
# 'shortName': self.LanguageCode,
# 'longName': 'Mende',
# 'jsName': self.LanguageCode,
# 'instructions': None,
# 'font': 'NotoSansMendeKikakui',
# 'fontFamily': 'MendeKikakuiFonts',
# },
]
# For attaching sorting, etc
self.text_functions = 'js/men.js'
self.links = links
self.text_file_list = [
{
'name': 'KeyMan 1.3 Mende Kikakui - RTL ',
'source': '/resources/men/mende_kikakui_1.3.kmp',
'description': 'Keyboard 1.3 with digigs for Mobile & Desktop, 6-Dec-2023',
'instructions': 'Phonetic: https://languagetools-153419.appspot.com/men/kbtransforms/',
},
{
'name': 'KeyMan 1.20 Mende Kikakui - RTL ',
'source': '/resources/men/mende_kikakui.1.2.kmp',
'description': 'Keyboard for Mobile & Desktop 21-oct-2023',
'instructions': 'Phonetic: https://languagetools-153419.appspot.com/men/kbtransforms/',
}
]
self.unicode_font_list = unicode_font_list
# Pointer to Unicode data for this script, e.g.,
# 1E800;MENDE KIKAKUI SYLLABLE M001 KI;Lo;0;R;;;;;N;;;;;
self.unicode_database = 'unicode_data/UnicodeData14.0.MendeKikakui.txt'
# Lists of test characters for the various encodings
self.test_chars = ' '.join([unichr(x) for x in range(0xe000, 0xe103)])
# Global in this file.
langInstance = langInfo()
app = webapp2.WSGIApplication(
[('/men/', base.LanguagesHomeHandler),
('/men/convertUI/', base.ConvertUIHandler),
('/men/downloads/', base.Downloads),
('/men/converter/', base.ConvertHandler),
('/men/encodingRules/', base.EncodingRules),
('/men/diacritic/', base.DiacriticHandler),
('/men/phonetickb/', base.PhoneticKbHandler),
# ('/' + langInstance.LanguageCode + '/kbtransforms/', base.KeyboardTransforms),
('/' + langInstance.LanguageCode + '/kbtransforms/', base.KeyboardTransforms2),
], debug=True,
config={'langInfo': langInstance}
)