eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mkencodingtable 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/python3
  2. # Copyright (C) 2017 Reece H. Dunn
  3. #
  4. # This file is part of ucd-tools.
  5. #
  6. # ucd-tools is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # ucd-tools is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with ucd-tools. If not, see <http://www.gnu.org/licenses/>.
  18. import os
  19. import sys
  20. def readtable(filename):
  21. with open(filename) as f:
  22. for line in f:
  23. if line == '\n' or line.startswith('#'):
  24. continue
  25. yield line.split()[0:2]
  26. table = {}
  27. for code, mapped in readtable(sys.argv[1]):
  28. table[int(code, 0)] = mapped.lower()
  29. for code in range(0x80, 0x100):
  30. if (code % 8 == 0):
  31. print('\t', end='')
  32. print('%s, ' % table.get(code, '0xfffd'), end='')
  33. if (code % 8 == 7):
  34. print('// %02x\n' % (code - 7), end='')