mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Update the list of nerd font names when updating other unicode data as well
No longer need to store the list of names in our source code
This commit is contained in:
@@ -13,6 +13,6 @@ for attr in ('linguist-generated', 'linguist-vendored'):
|
|||||||
fname = line.split(':', 1)[0]
|
fname = line.split(':', 1)[0]
|
||||||
all_files.discard(fname)
|
all_files.discard(fname)
|
||||||
|
|
||||||
all_files -= {'gen/nerd-fonts-glyphs.txt', 'gen/rowcolumn-diacritics.txt'}
|
all_files -= {'gen/rowcolumn-diacritics.txt'}
|
||||||
cp = subprocess.run(['cloc', '--list-file', '-'], input='\n'.join(all_files).encode())
|
cp = subprocess.run(['cloc', '--list-file', '-'], input='\n'.join(all_files).encode())
|
||||||
raise SystemExit(cp.returncode)
|
raise SystemExit(cp.returncode)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -43,8 +43,7 @@ if len(non_characters) != 66:
|
|||||||
emoji_skin_tone_modifiers = frozenset(range(0x1f3fb, 0x1F3FF + 1))
|
emoji_skin_tone_modifiers = frozenset(range(0x1f3fb, 0x1F3FF + 1))
|
||||||
|
|
||||||
|
|
||||||
def get_data(fname: str, folder: str = 'UCD') -> Iterable[str]:
|
def fetch_url(url: str) -> str:
|
||||||
url = f'https://www.unicode.org/Public/{folder}/latest/{fname}'
|
|
||||||
bn = os.path.basename(url)
|
bn = os.path.basename(url)
|
||||||
local = os.path.join('/tmp', bn)
|
local = os.path.join('/tmp', bn)
|
||||||
if os.path.exists(local):
|
if os.path.exists(local):
|
||||||
@@ -54,7 +53,12 @@ def get_data(fname: str, folder: str = 'UCD') -> Iterable[str]:
|
|||||||
data = urlopen(url).read()
|
data = urlopen(url).read()
|
||||||
with open(local, 'wb') as f:
|
with open(local, 'wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
for line in data.decode('utf-8').splitlines():
|
return data.decode()
|
||||||
|
|
||||||
|
|
||||||
|
def get_data(fname: str, folder: str = 'UCD') -> Iterable[str]:
|
||||||
|
url = f'https://www.unicode.org/Public/{folder}/latest/{fname}'
|
||||||
|
for line in fetch_url(url).splitlines():
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line and not line.startswith('#'):
|
if line and not line.startswith('#'):
|
||||||
yield line
|
yield line
|
||||||
@@ -151,13 +155,14 @@ def parse_ucd() -> None:
|
|||||||
# the future.
|
# the future.
|
||||||
marks.add(codepoint)
|
marks.add(codepoint)
|
||||||
|
|
||||||
with open('gen/nerd-fonts-glyphs.txt') as f:
|
gndata = fetch_url('https://raw.githubusercontent.com/ryanoasis/nerd-fonts/refs/heads/master/glyphnames.json')
|
||||||
for line in f:
|
for name, val in json.loads(gndata).items():
|
||||||
line = line.strip()
|
if name != 'METADATA':
|
||||||
if not line or line.startswith('#'):
|
codepoint = int(val['code'], 16)
|
||||||
continue
|
category, sep, name = name.rpartition('-')
|
||||||
code, category, name = line.split(' ', 2)
|
name = name or category
|
||||||
codepoint = int(code, 16)
|
name = name.replace('_', ' ')
|
||||||
|
print(11111111, name)
|
||||||
if name and codepoint not in name_map:
|
if name and codepoint not in name_map:
|
||||||
name_map[codepoint] = name.upper()
|
name_map[codepoint] = name.upper()
|
||||||
for word in name.lower().split():
|
for word in name.lower().split():
|
||||||
|
|||||||
3157
tools/unicode_names/names.txt
generated
3157
tools/unicode_names/names.txt
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user