v0.1.0 inital port from 'features/1-script-patch-fonts' branch on vim-webdevicons repo

This commit is contained in:
Ryan McIntyre 2014-12-04 23:29:54 -05:00
commit 199e1b1d69
20 changed files with 42957 additions and 0 deletions

22
LICENSE Normal file
View file

@ -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
changelog.md Normal file
View file

@ -0,0 +1,3 @@
- v0.1.0
-- release
-- inital port from 'features/1-script-patch-fonts' branch on vim-webdevicons repo

77
font-patcher Executable file
View file

@ -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

BIN
glyph-source-fonts/devicons.ttf Executable file

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

37
readme.md Normal file
View file

@ -0,0 +1,37 @@
nerd-filetype-glyphs-fonts-patcher
==================================
Adds filetype glyphs (icons) to any font you pass in or you can simply use one of the provided patched font (see list below)
Created for use with [vim-webdevicons](https://github.com/ryanoasis/vim-webdevicons)
## Usage
Typical install of the patched font or generate a patched font from your own font to get the additional new glyphs.
## Patched Fonts
| Currnetly Included Patched Fonts |
|--------------------------------------------------------|
| Anonymice Powerline Plus Nerd File Types |
| Droid Sans Mono for Powerline Plus Nerd File Types |
| Literation Mono Powerline Plus Nerd File Types |
| ProggyCleanTT Plus Nerd File Types |
| Sauce Code Powerline Plus Nerd File Types |
| Ubuntu Mono derivative Powerline Plus Nerd File Types |
Patching the font of your own choosing:
* requires: python2, python-fontforge package
* usage:
> ./font-patcher PATH_TO_FONT
e.g.
./font-patcher unpatched-sample-fonts/Droid\ Sans\ Mono\ for\ Powerline.otf
./font-patcher Inconsolata.otf
## License
see [LICENSE](LICENSE)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.