7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2024-11-23 15:05:03 +00:00
kicad/tools/newstroke/gen_all_codepoints.py
John Beard 1ea5671228 Newstroke: replace font.pro with a new project that shows all codepoints
It also has all the libraries as project libraries for easier opening.
2024-08-14 14:28:54 +01:00

32 lines
589 B
Python

#! /usr/bin/env python
"""
Generates a list of all codepoints in the Unicode range, skipping the surrogate range.
This is useful for generating a list of codepoints to test the newstroke tool.
"""
s = ""
# Skip the surrogate range
ranges = [
(0x0000, 0xD800),
(0xE000, 0xFFEF),
]
for rng in ranges:
for i in range(rng[0], rng[1]):
if i % 256 == 0:
if i != 0:
s += "\n"
s += f"U+{i:04X} "
elif i % 16 == 0:
s += " "
if i < 32:
s += " "
else:
s += chr(i)
print(s)