mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
Add tool to find problematic glyphs
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
94d6c0ffcf
commit
8047f40372
3 changed files with 155 additions and 0 deletions
81
bin/scripts/name_parser/check_glyphs
Executable file
81
bin/scripts/name_parser/check_glyphs
Executable file
|
@ -0,0 +1,81 @@
|
|||
#!/usr/bin/env python3
|
||||
# coding=utf8
|
||||
#
|
||||
# Usually called via
|
||||
# $ fontforge check_glyphs fontfile1.tff [fontfile2.ttf ...] 2>/dev/null
|
||||
#
|
||||
# The output differs depending on number of specified fonts.
|
||||
# If only one font is examined full detail is shown.
|
||||
# If more fonts are specified only a summary for each font is listed.
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
import fontforge
|
||||
|
||||
count_o = 0
|
||||
count_i = 0
|
||||
count_d = 0
|
||||
|
||||
def val_to_text(v):
|
||||
global count_o
|
||||
global count_i
|
||||
global count_d
|
||||
parts = [ ]
|
||||
if v & 2:
|
||||
parts += ['open']
|
||||
count_o += 1
|
||||
else:
|
||||
parts += [' ']
|
||||
if v & 4:
|
||||
parts += ['intersect']
|
||||
count_i += 1
|
||||
else:
|
||||
parts += [' ']
|
||||
if v & 8:
|
||||
parts += ['direction']
|
||||
count_d += 1
|
||||
else:
|
||||
parts += [' ']
|
||||
return ' '.join(parts)
|
||||
|
||||
###### Let's go!
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: {} font_name [font_name ...]\n'.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
print('Examining {} font files'.format(len(sys.argv) - 1))
|
||||
batch_mode = len(sys.argv) > 2
|
||||
if batch_mode:
|
||||
print('Batch mode enabled')
|
||||
print('| {:40} | {:5} | {:4} | {:4} | {:4} |'.format('file', '#glyp', 'open', 'self', 'dir'))
|
||||
|
||||
for filename in sys.argv[1:]:
|
||||
fullfile = os.path.basename(filename)
|
||||
fname = os.path.splitext(fullfile)[0]
|
||||
font = fontforge.open(filename, 1)
|
||||
# print('======== {} ========'.format(fullfile))
|
||||
|
||||
font.encoding = 'UnicodeFull'
|
||||
count = 0
|
||||
count_o = 0
|
||||
count_i = 0
|
||||
count_d = 0
|
||||
for c in range (1, 0xffffff):
|
||||
if not c in font:
|
||||
continue
|
||||
font[c].unlinkRef()
|
||||
font[c].removeOverlap()
|
||||
val = val_to_text(font[c].validate(True))
|
||||
if font[c].validation_state & 0xE:
|
||||
if not batch_mode:
|
||||
print(' {:04X} {:08X} {} {}'.format(c, font[c].validation_state, val, font[c].glyphname))
|
||||
font[c].correctDirection()
|
||||
|
||||
count += 1
|
||||
if not batch_mode:
|
||||
print('======== {} ========'.format(fullfile))
|
||||
print('Sum of problems: open {}, intersect {}, direction {} (for a total of {} glyphs)'.format(count_o, count_i, count_d, count))
|
||||
else:
|
||||
print('| {:40} | {:5} | {:4} | {:4} | {:4} |'.format(fullfile, count, count_o, count_i, count_d))
|
||||
font.close()
|
10
src/unpatched-fonts/README.md
Normal file
10
src/unpatched-fonts/README.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
## Sourcefonts for Releases
|
||||
|
||||
Here reside all source fonts that are used for releases. These fonts
|
||||
are fully supported, following renaming schemes and having possible specific
|
||||
patch-flags that must be used for best results (in their `config.*` files).
|
||||
|
||||
To try things out on all fonts here is also a list of one specimen each for
|
||||
all the fonts in `fontfilenames`. This can be used via
|
||||
|
||||
$ cat fontfilenames | xargs fontforge .....
|
64
src/unpatched-fonts/fontnames
Normal file
64
src/unpatched-fonts/fontnames
Normal file
|
@ -0,0 +1,64 @@
|
|||
0xProto/0xProto-Regular.ttf
|
||||
3270/Regular/3270-Regular.ttf
|
||||
Agave/Agave-Regular.ttf
|
||||
AnonymousPro/Regular/Anonymous\ Pro.ttf
|
||||
Arimo/Regular/Arimo-Regular.ttf
|
||||
AurulentSansMono/AurulentSansMono-Regular.otf
|
||||
BigBlueTerminal/BigBlue_TerminalPlus.ttf
|
||||
BitstreamVeraSansMono/Regular/VeraMono.ttf
|
||||
CascadiaCode/Regular/CascadiaCode-Regular-vtt.ttf
|
||||
CascadiaMono/CascadiaMono-Regular-vtt.ttf
|
||||
CodeNewRoman/Regular/Code\ New\ Roman-Regular.otf
|
||||
ComicShannsMono/ComicShannsMono-Regular.otf
|
||||
CommitMono/CommitMono-400-Regular.otf
|
||||
Cousine/Regular/Cousine-Regular.ttf
|
||||
D2Coding/D2Coding-Ver1.3.2-20180524-ligature.ttf
|
||||
DaddyTimeMono/DaddyTimeMono.otf
|
||||
DejaVuSansMono/Regular/DejaVuSansMono.ttf
|
||||
DroidSansMono/Droid\ Sans\ Mono\ for\ Powerline.otf
|
||||
EnvyCodeR/Envy\ Code\ R.ttf
|
||||
FantasqueSansMono/Regular/FantasqueSansMono-Regular.ttf
|
||||
FiraCode/Regular/FiraCode-Regular.ttf
|
||||
FiraMono/Regular/FiraMono-Regular.otf
|
||||
GeistMono/Regular/GeistMono-Regular.otf
|
||||
Gohu/uni-14/gohufont-uni-14.ttf
|
||||
Go-Mono/Regular/Go-Mono.ttf
|
||||
Hack/Regular/Hack-Regular.ttf
|
||||
Hasklig/Regular/Hasklig-Regular.otf
|
||||
HeavyData/heavy_data.ttf
|
||||
Hermit/Regular/Hermit-Regular.otf
|
||||
iA-Writer/Mono/Regular/iAWriterMonoS-Regular.ttf
|
||||
IBMPlexMono/Mono/IBMPlexMono-Regular.ttf
|
||||
Inconsolata/Inconsolata-Regular.ttf
|
||||
InconsolataGo/Regular/InconsolataGo-Regular.ttf
|
||||
InconsolataLGC/Regular/Inconsolata-LGC.ttf
|
||||
IntelOneMono/Regular/intelone-mono-font-family-regular.ttf
|
||||
Iosevka/Regular/iosevka-regular.ttf
|
||||
IosevkaTerm/Regular/iosevka-term-regular.ttf
|
||||
IosevkaTermSlab/iosevka-term-slab-regular.ttf
|
||||
JetBrainsMono/Ligatures/Regular/JetBrainsMono-Regular.ttf
|
||||
Lekton/Regular/Lekton-Regular.ttf
|
||||
LiberationMono/LiberationMono-Regular.ttf
|
||||
Lilex/Lilex-Regular.ttf
|
||||
MartianMono/Std/MartianMono-Regular.ttf
|
||||
Meslo/M/Regular/Meslo\ LG\ M\ Regular\ for\ Powerline.ttf
|
||||
Monaspace/Neon/MonaspaceNeon-Regular.otf
|
||||
Monofur/Regular/Monofur\ for\ Powerline.ttf
|
||||
Monoid/Regular/Monoid-Regular.ttf
|
||||
Mononoki/Regular/mononoki-Regular.ttf
|
||||
MPlus/M_Plus_1_code/Mplus1Code-Regular.ttf
|
||||
Noto/Mono/NotoMono-Regular.ttf
|
||||
Noto/Sans-Mono/NotoSansMono-Regular.ttf
|
||||
OpenDyslexic/Regular/OpenDyslexic-Regular.otf
|
||||
Overpass/Mono/Regular/overpass-mono-regular.otf
|
||||
ProFont/profontiix/ProFontIIx.ttf
|
||||
ProggyClean/Regular/ProggyClean.ttf
|
||||
RobotoMono/Regular/RobotoMono-Regular.ttf
|
||||
ShareTechMono/ShareTechMono-Regular.ttf
|
||||
SourceCodePro/SourceCodePro-Regular.ttf
|
||||
SpaceMono/Regular/SpaceMono-Regular.ttf
|
||||
Terminus/Regular/TerminusTTF-4.49.2.ttf
|
||||
Tinos/Regular/Tinos-Regular.ttf
|
||||
Ubuntu/Regular/Ubuntu-R.ttf
|
||||
UbuntuMono/Regular/UbuntuMono-R.ttf
|
||||
VictorMono/Regular/VictorMono-Regular.ttf
|
Loading…
Reference in a new issue