mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
Added version, comment and fontlog (with changelog notes) to fonts, bumped version, misc clean-up
This commit is contained in:
parent
aa148b24b8
commit
9ab7706012
1 changed files with 14 additions and 7 deletions
21
font-patcher
21
font-patcher
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
# version: 0.4.0
|
# version: 0.4.1
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import psMat
|
import psMat
|
||||||
|
@ -32,7 +32,8 @@ args = parser.parse_args()
|
||||||
#print type(fontforge.version())
|
#print type(fontforge.version())
|
||||||
#print int(fontforge.version())
|
#print int(fontforge.version())
|
||||||
|
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
|
changelog = open("changelog.md", "r")
|
||||||
minimumVersion = 20141231
|
minimumVersion = 20141231
|
||||||
actualVersion = int(fontforge.version())
|
actualVersion = int(fontforge.version())
|
||||||
#actualVersion = 20120731 # for testing invalid version
|
#actualVersion = 20120731 # for testing invalid version
|
||||||
|
@ -97,13 +98,20 @@ def replace_all(text, dic):
|
||||||
# comply with SIL Open Font License (OFL)
|
# comply with SIL Open Font License (OFL)
|
||||||
reservedFontNameReplacements = {'source': 'sauce', 'Source': 'Sauce', 'hermit': 'hurmit', 'Hermit': 'Hurmit'}
|
reservedFontNameReplacements = {'source': 'sauce', 'Source': 'Sauce', 'hermit': 'hurmit', 'Hermit': 'Hurmit'}
|
||||||
|
|
||||||
|
projectInfo = "Patched with 'Nerd Fonts Patcher' (https://github.com/ryanoasis/nerd-fonts)"
|
||||||
|
|
||||||
sourceFont.familyname = replace_all(familyname, reservedFontNameReplacements)
|
sourceFont.familyname = replace_all(familyname, reservedFontNameReplacements)
|
||||||
sourceFont.fullname = replace_all(fullname, reservedFontNameReplacements)
|
sourceFont.fullname = replace_all(fullname, reservedFontNameReplacements)
|
||||||
sourceFont.fontname = replace_all(fontname, reservedFontNameReplacements)
|
sourceFont.fontname = replace_all(fontname, reservedFontNameReplacements)
|
||||||
sourceFont.appendSFNTName('English (US)', 'Preferred Family', sourceFont.familyname)
|
sourceFont.appendSFNTName('English (US)', 'Preferred Family', sourceFont.familyname)
|
||||||
sourceFont.appendSFNTName('English (US)', 'Compatible Full', sourceFont.fullname)
|
sourceFont.appendSFNTName('English (US)', 'Compatible Full', sourceFont.fullname)
|
||||||
|
sourceFont.comment = projectInfo
|
||||||
|
sourceFont.fontlog = projectInfo + "\n\n" + changelog.read()
|
||||||
|
|
||||||
sourceFont.version = version
|
# todo version not being set for all font types (e.g. ttf)
|
||||||
|
#print "Version was " + sourceFont.version
|
||||||
|
sourceFont.version += ";Nerd Fonts " + version
|
||||||
|
#print "Version now is " + sourceFont.version
|
||||||
|
|
||||||
# glyph font
|
# glyph font
|
||||||
|
|
||||||
|
@ -350,15 +358,14 @@ if args.octicons:
|
||||||
if args.pomicons:
|
if args.pomicons:
|
||||||
copy_glyphs(sourceFont, sourceFontPomiconsStart, sourceFontPomiconsEnd, pomicons, symbolsPomiconsRangeStart, symbolsPomiconsRangeEnd)
|
copy_glyphs(sourceFont, sourceFontPomiconsStart, sourceFontPomiconsEnd, pomicons, symbolsPomiconsRangeStart, symbolsPomiconsRangeEnd)
|
||||||
|
|
||||||
if args.pomicons:
|
|
||||||
copy_glyphs(sourceFont, sourceFontRange3Start, sourceFontRange3End, pomicons, pomiconsRangeStart, pomiconsRangeEnd)
|
|
||||||
|
|
||||||
extension = os.path.splitext(sourceFont.path)[1]
|
extension = os.path.splitext(sourceFont.path)[1]
|
||||||
|
|
||||||
# @todo later add option to generate the sfd?
|
# @todo later add option to generate the sfd?
|
||||||
#sourceFont.save(sourceFont.fullname + ".sfd")
|
#sourceFont.save(sourceFont.fullname + ".sfd")
|
||||||
|
|
||||||
sourceFont.generate(sourceFont.fullname + extension)
|
# the `PfEd-comments` flag is required for Fontforge to save
|
||||||
|
# '.comment' and '.fontlog'.
|
||||||
|
sourceFont.generate(sourceFont.fullname + extension, flags=('PfEd-comments',))
|
||||||
|
|
||||||
print "Generated"
|
print "Generated"
|
||||||
print sourceFont.fullname
|
print sourceFont.fullname
|
||||||
|
|
Loading…
Reference in a new issue