Skip to content

Commit

Permalink
v0.1.0 inital port from 'features/1-script-patch-fonts' branch on vim…
Browse files Browse the repository at this point in the history
…-webdevicons repo
  • Loading branch information
ryanoasis committed Dec 5, 2014
0 parents commit 199e1b1
Show file tree
Hide file tree
Showing 20 changed files with 42,957 additions and 0 deletions.
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 Ryan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- v0.1.0
-- release
-- inital port from 'features/1-script-patch-fonts' branch on vim-webdevicons repo
77 changes: 77 additions & 0 deletions font-patcher
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env python2

import sys
import psMat
import re
import os.path

try:
#Load the module
import fontforge

except ImportError:
sys.stderr.write("FontForge module could not be loaded. Try installing fontforge python bindings\n")
sys.exit(1)

print "using fontforge package version: " + str(fontforge.__version__)

sourceFont = fontforge.open(sys.argv[1])

# rename font
fontname, style = re.match("^([^-]*)(?:(-.*))?$", sourceFont.fontname).groups()
sourceFont.familyname = sourceFont.familyname + " Plus Nerd File Types"
sourceFont.fullname = sourceFont.fullname + " Plus Nerd File Types"
sourceFont.fontname = fontname + 'PlusNerdFileTypes'
sourceFont.appendSFNTName('English (US)', 'Preferred Family', sourceFont.familyname)
sourceFont.appendSFNTName('English (US)', 'Compatible Full', sourceFont.fullname)

# glyph font

sourceFont_em_original = sourceFont.em

# glyph fonts

#Open a font
glyphFont1=fontforge.open("glyph-source-fonts/original-source.otf")

#select unicodes:
glyphFont1.selection.select(("ranges","unicode"),0xE500,0xE51D)
#Copy those glyphs into the clipboard:
glyphFont1.copy()

#select unicodes:
sourceFont.selection.select(("ranges","unicode"),0xE600,0xE61D)
#paste the glyphs above in:
sourceFont.paste()

### even more glyphs

##Open a font
glyphFont2=fontforge.open("glyph-source-fonts/devicons.ttf")
## @todo improve/fix
sourceFont.em = glyphFont2.em
##select unicodes:
glyphFont2.selection.select(("ranges","unicode"),0xE600,0xE6A4)
##Copy those glyphs into the clipboard
glyphFont2.copy()
#
#
## #select unicodes
sourceFont.selection.select(("ranges","unicode"),0xE700,0xE7A4)
##paste the glyphs above in:
sourceFont.paste()

# fix scaling of glyphs
sourceFont.em = sourceFont_em_original

extension = os.path.splitext(sourceFont.path)[1]

# @todo later add option to generate the sfd?
#sourceFont.save(sourceFont.fullname + ".sfd")

sourceFont.generate(sourceFont.fullname + extension)

print "Generated"
print sourceFont.fullname
print sourceFont.fontname

Binary file added glyph-source-fonts/devicons.ttf
Binary file not shown.
Loading

0 comments on commit 199e1b1

Please sign in to comment.