mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-19 03:12:07 +02:00
generate-glyph-info: Fix double entries
[why] Two glyphs may not have the same name (normally). Our glyphnames.json will break. [how] Do not add two entries with the same name but rather report the codepoints in the bottom. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
6932ff2d8f
commit
2fa45981ee
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# coding=utf8
|
||||
# Nerd Fonts Version: 3.1.1
|
||||
# Script Version: 1.1.1
|
||||
# Script Version: 1.2.0
|
||||
|
||||
# Example Usage:
|
||||
# ./generate-glyph-info-from-set.py --font ../../src/glyphs/materialdesignicons-webfont.ttf --start f001 --end f847 --offset 4ff --prefix mdi
|
||||
@ -66,9 +66,13 @@ elif args.symbolOffset:
|
||||
signedOffset = int(sign+'0x'+format(offset, 'X'), 16)
|
||||
hexPosition = args.symbolFontStart + signedOffset
|
||||
|
||||
symbolFont.selection.select((str("ranges"),str("unicode")),args.symbolFontStart,args.symbolFontEnd)
|
||||
|
||||
for index, sym_glyph in enumerate(symbolFont.selection.byGlyphs):
|
||||
allNames = {}
|
||||
suppressedEntries = []
|
||||
symbolFont.encoding = 'UnicodeFull'
|
||||
for index in range(args.symbolFontStart, args.symbolFontEnd + 1):
|
||||
if not index in symbolFont:
|
||||
continue
|
||||
sym_glyph = symbolFont[index]
|
||||
slot = format(sym_glyph.unicode, 'X')
|
||||
name = sym_glyph.glyphname
|
||||
sh_name = "i_" + args.prefix + "_" + name.replace("-", "_")
|
||||
@ -78,9 +82,18 @@ for index, sym_glyph in enumerate(symbolFont.selection.byGlyphs):
|
||||
else:
|
||||
char = chr(int('0x'+slot, 16) + signedOffset)
|
||||
|
||||
print("i='" + char + "' " + sh_name + "=$i")
|
||||
entryString = "i='" + char + "' " + sh_name + "=$i SLOT " + slot + ' ' + str(index)
|
||||
if name not in allNames:
|
||||
print(entryString)
|
||||
else:
|
||||
suppressedEntries.append(entryString)
|
||||
|
||||
ctr += 1
|
||||
hexPosition += 1
|
||||
allNames[name] = 1
|
||||
|
||||
print("Done, generated " + str(ctr) + " glyphs")
|
||||
|
||||
if len(suppressedEntries) > 0:
|
||||
print('FOLLOGING ENTRIES SUPPRESSED to prevent double names with different codepoints:')
|
||||
print('\n'.join(suppressedEntries))
|
||||
|
@ -151,7 +151,6 @@ i='' i_cod_folder_opened=$i
|
||||
i='' i_cod_gear=$i
|
||||
i='' i_cod_gift=$i
|
||||
i='' i_cod_gist_secret=$i
|
||||
i='' i_cod_file_code=$i
|
||||
i='' i_cod_git_commit=$i
|
||||
i='' i_cod_git_compare=$i
|
||||
i='' i_cod_git_merge=$i
|
||||
|
Loading…
x
Reference in New Issue
Block a user