Skip to content

Commit

Permalink
Update NF version 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
saumyajyoti-mukherjee committed Dec 15, 2024
1 parent f2d17be commit c98cc78
Show file tree
Hide file tree
Showing 42 changed files with 1,149 additions and 107 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Create Custom Nerd Fonts

## Font details
### Miosevka
Added Custom Iosevka Font and patched with Nerdfont symbols.
Added Custom Iosevka Font and patched with [NerdFont](https://github.com/ryanoasis/nerd-fonts) symbols.

Added
- IOSEVKA build plan. 2 variants with wide chars, namely Miosevka and Riosevka (Rounded variants).
- Nerdfont Commands and script for patching, Nerd Fonts Version: 3.2.1
- Nerdfont Commands and script for patching, Nerd Fonts Version: 3.3.0.
- Patched Fonts

### Sample Image (V11)
Expand Down
4 changes: 2 additions & 2 deletions bin/nerdfont/bin/scripts/name_parser/FontnameTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def postscript_char_filter(name):
( '(.*dyslexic ?m)ono', r'\1'), # Open Dyslexic Mono -> Open Dyslexic M
( '(overpass ?m)ono', r'\1'), # Overpass Mono -> Overpass M
( '(proggyclean) ?tt', r'\1'), # Remove TT from ProggyClean
( '(terminess) ?\(ttf\)', r'\1'), # Remove TTF from Terminus (after renamed to Terminess)
( r'(terminess) ?\(ttf\)', r'\1'), # Remove TTF from Terminus (after renamed to Terminess)
( '(.*ne)on', r'\1'), # Monaspace shorten face name
( '(.*ar)gon', r'\1'), # Monaspace shorten face name
( '(.*kr)ypton', r'\1'), # Monaspace shorten face name
Expand Down Expand Up @@ -399,7 +399,7 @@ def parse_font_name(name):
('Bold-Italic', 'BoldItalic'), # Terminus
]:
name = re.sub(r'\b' + special[0] + r'\b', special[1], name, 1, re.IGNORECASE)
name = re.sub('[_\s]+', ' ', name)
name = re.sub(r'[_\s]+', ' ', name)
matches = re.match(r'([^-]+)(?:-(.*))?', name)
familyname = FontnameTools.camel_casify(matches.group(1))
style = matches.group(2)
Expand Down
286 changes: 194 additions & 92 deletions bin/nerdfont/font-patcher

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bin/nerdfont/glyphnames.json

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions bin/nerdfont/src/glyphs/devicons/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Devicons

For more information have a look at the upstream website: https://github.com/vorillaz/devicons
From the Devicons the non-linemark versions are selected and assembled into a custom
icon font. This font guarantees that the codepoints of existing icons do not change
when other icons are added or removed.

This is taken directly from the repository default branch, which is ahead of release 1.8.0.
We call it 1.8.1 here, but there is no such release.
For more information have a look at the upstream website: https://github.com/devicons/devicon

## Source bugs fixed
The helper scripts need to be called in this order (note the individual prerequisites):
* `analyze`
* `generate` (possibly via `fontforge`)

Glyph 0xE6B6 is defective in the original font. We hand optimized and fixed that.

Version: 1.8.1
Version: 2.16.0.custom
159 changes: 159 additions & 0 deletions bin/nerdfont/src/glyphs/devicons/analyze
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#!/usr/bin/env python3
# coding=utf8

# Create a new mapping file by combining the information from
# the old mapping and checking which icons got dropped; are new;
# or get a different svg file.

# PREREQUISITES:
# $ curl -OL https://github.com/devicons/devicon/archive/refs/tags/v2.16.0.tar.gz
# $ tar zxf v2.16.0.tar.gz
# $ mv devicon-*/icons .
# $ cp -r vorillaz icons

import re, os, sys

vectorsdir = 'icons'

def filename_from_name(filename):
""" Some icons have a name that is not the svg filename """
# Returns '-' if the icon is to be removed
# Giving a full pathname selects a certain svg variant
return {
'awk': 'fixed/awk-plain.svg', # added as fixed icon
'bower': 'bower/bower-line.svg',
'c_lang': 'c',
'clojure': 'clojure/clojure-line.svg',
'composer': 'composer/composer-line.svg',
'css3_full': 'css3/css3-plain-wordmark.svg',
'djangorest': 'djangorest/djangorest-plain-wordmark.svg',
'dotnet': 'dot-net',
'ghost': 'ghost/ghost-original-wordmark.svg',
'github_full': 'github/github-original-wordmark.svg',
'go': 'go/go-line.svg',
'grunt': 'grunt/grunt-line.svg',
'ie': 'ie10',
'jenkins': 'jenkins/jenkins-line.svg',
'meteorfull': 'meteor/meteor-plain-wordmark.svg',
'nodejs': 'nodejs/nodejs-plain-wordmark.svg',
'nodejs_small': 'nodejs',
'windows': 'windows8',
}.get(filename, filename)

def get_aliases(names):
""" For some icons we would like to have aliases """
# Returns a list with aliases, first element is main name and glyphname
name = names[0]
return {
'c': [ 'c_lang', 'c' ],
'github_badge': [ 'github', 'github_badge' ],
'javascript_badge': [ 'javascript', 'javascript_badge' ],
'krakenjs_badge': [ 'krakenjs', 'krakenjs_badge' ],
'symfony_badge': [ 'symfony', 'symfony_badge' ],
'unifiedmodelinglanguage': [ 'unifiedmodelinglanguage', 'uml' ],
}.get(name, names)

def file_with_ending(files, ending):
""" Return the (first) file out of a list of files that has the desired ending """
# Returns False if no match at all
matches = [ file for file in files if file.endswith(ending) ]
if not matches:
return False
return matches[0]

def suggest_new_filename(name):
""" Return a specific svg filename for one icon, preferring some svg filename endings """
name = filename_from_name(name)
subdir = os.path.join(vectorsdir, name)
if not os.path.exists(subdir):
return False
if os.path.isfile(subdir):
# For translation to direct filename hits
return name
svgs = os.listdir(subdir)
filename = file_with_ending(svgs, 'plain.svg')
if not filename:
filename = file_with_ending(svgs, 'original.svg')
if not filename:
filename = file_with_ending(svgs, 'plain-wordmark.svg')
if not filename:
filename = file_with_ending(svgs, 'original-wordmark.svg')
if not filename:
return False
return os.path.join(name, filename)

remix_mapping = []
with open('mapping', 'r') as f:
for line in f.readlines():
if line.startswith('#'):
continue
c1, c2, n, *f = re.split(' +', line.strip())
remix_mapping.append((int(c1, 16), int(c2, 16), n, *f))

new_names = os.listdir(vectorsdir)
new_names.sort()
new_names.remove('vorillaz') # If this fails one prerequisite step is missing
if 'fixed' in new_names:
# This can exist after a generate run
new_names.remove('fixed')

print('Found {} mapping entries and {} devicon directories'.format(
len(remix_mapping), len(new_names)))

notes1 = ''
notes2 = ''
mapping = []
for orig_point, dest_point, filename, *names in remix_mapping:
if not os.path.isfile(os.path.join(vectorsdir, filename)):
newfilename = suggest_new_filename(names[0])
if newfilename:
notes1 += '# SVG change: code: {:04X} name: {}, old: {}, new: {}\n'.format(
orig_point, names[0], filename, newfilename)
filename = newfilename
if filename:
mapping.append((orig_point, dest_point, filename, *names))
dirname = os.path.dirname(filename)
if dirname.endswith('fixed'):
# Translate dirname for fixed icons
dirname = names[0]
if dirname in new_names:
new_names.remove(dirname)
continue

notes2 += '# Icon dropped: code: {:04X} name: {}\n'.format(
orig_point, names[0])

index = 0xE700
taken_codes = set([ e[1] for e in mapping ])
for iconname in new_names:
filename = suggest_new_filename(iconname)
if not filename:
sys.exit('Can not find svg for "{}"'.format(iconname))
while index in taken_codes:
index = index + 1
mapping.append((index - 0x0100, index, filename, iconname))
taken_codes.add(index)

with open('mapping', 'w', encoding = 'utf8') as f:
f.write('# Devicons mapping file\n')
f.write('#\n')
f.write('# DEV-code NF-code filename name [alias [...]]\n')
f.write('#\n')

mapping.sort(key=(lambda x: x[1]))
unique_names = set()
for orig_point, dest_point, filename, *names in mapping:
aliases = get_aliases(names)
for n in aliases:
if n not in unique_names:
unique_names.add(n)
else:
sys.exit('ERROR name duplicate found: {}'.format(n))
f.write('{:04X} {:04X} {} {}\n'.format(orig_point, dest_point, filename, ' '.join(aliases)))

if notes1:
print(notes1)
if notes2:
print(notes2)

print('Generated new mapping with {} entries'.format(len(mapping)))
Binary file modified bin/nerdfont/src/glyphs/devicons/devicons.ttf
Binary file not shown.
5 changes: 5 additions & 0 deletions bin/nerdfont/src/glyphs/devicons/fixed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This folder contains some modified icons, where the 2.16.0 svg file of Devicons had some import problem.

These files will be preferred over the filenames specified in the mapping file.

Be careful on Devicon updates.
1 change: 1 addition & 0 deletions bin/nerdfont/src/glyphs/devicons/fixed/angularjs-plain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions bin/nerdfont/src/glyphs/devicons/fixed/awk-plain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions bin/nerdfont/src/glyphs/devicons/fixed/bash-plain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c98cc78

Please sign in to comment.