Skip to content

Commit 199e1b1

Browse files
committed
v0.1.0 inital port from 'features/1-script-patch-fonts' branch on vim-webdevicons repo
0 parents  commit 199e1b1

20 files changed

+42957
-0
lines changed

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Ryan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- v0.1.0
2+
-- release
3+
-- inital port from 'features/1-script-patch-fonts' branch on vim-webdevicons repo

font-patcher

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env python2
2+
3+
import sys
4+
import psMat
5+
import re
6+
import os.path
7+
8+
try:
9+
#Load the module
10+
import fontforge
11+
12+
except ImportError:
13+
sys.stderr.write("FontForge module could not be loaded. Try installing fontforge python bindings\n")
14+
sys.exit(1)
15+
16+
print "using fontforge package version: " + str(fontforge.__version__)
17+
18+
sourceFont = fontforge.open(sys.argv[1])
19+
20+
# rename font
21+
fontname, style = re.match("^([^-]*)(?:(-.*))?$", sourceFont.fontname).groups()
22+
sourceFont.familyname = sourceFont.familyname + " Plus Nerd File Types"
23+
sourceFont.fullname = sourceFont.fullname + " Plus Nerd File Types"
24+
sourceFont.fontname = fontname + 'PlusNerdFileTypes'
25+
sourceFont.appendSFNTName('English (US)', 'Preferred Family', sourceFont.familyname)
26+
sourceFont.appendSFNTName('English (US)', 'Compatible Full', sourceFont.fullname)
27+
28+
# glyph font
29+
30+
sourceFont_em_original = sourceFont.em
31+
32+
# glyph fonts
33+
34+
#Open a font
35+
glyphFont1=fontforge.open("glyph-source-fonts/original-source.otf")
36+
37+
#select unicodes:
38+
glyphFont1.selection.select(("ranges","unicode"),0xE500,0xE51D)
39+
#Copy those glyphs into the clipboard:
40+
glyphFont1.copy()
41+
42+
#select unicodes:
43+
sourceFont.selection.select(("ranges","unicode"),0xE600,0xE61D)
44+
#paste the glyphs above in:
45+
sourceFont.paste()
46+
47+
### even more glyphs
48+
49+
##Open a font
50+
glyphFont2=fontforge.open("glyph-source-fonts/devicons.ttf")
51+
## @todo improve/fix
52+
sourceFont.em = glyphFont2.em
53+
##select unicodes:
54+
glyphFont2.selection.select(("ranges","unicode"),0xE600,0xE6A4)
55+
##Copy those glyphs into the clipboard
56+
glyphFont2.copy()
57+
#
58+
#
59+
## #select unicodes
60+
sourceFont.selection.select(("ranges","unicode"),0xE700,0xE7A4)
61+
##paste the glyphs above in:
62+
sourceFont.paste()
63+
64+
# fix scaling of glyphs
65+
sourceFont.em = sourceFont_em_original
66+
67+
extension = os.path.splitext(sourceFont.path)[1]
68+
69+
# @todo later add option to generate the sfd?
70+
#sourceFont.save(sourceFont.fullname + ".sfd")
71+
72+
sourceFont.generate(sourceFont.fullname + extension)
73+
74+
print "Generated"
75+
print sourceFont.fullname
76+
print sourceFont.fontname
77+

glyph-source-fonts/devicons.ttf

117 KB
Binary file not shown.

0 commit comments

Comments
 (0)