Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Fixed compatibility issues with fontpatcher #194

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions fontpatcher/fontpatcher
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ from __future__ import division
import argparse import argparse
import os import os
import sys import sys
import re


try: try:
import fontforge import fontforge
Expand All @@ -42,6 +43,8 @@ parser = argparse.ArgumentParser(description='Font patcher for Powerline. Create
parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+') parser.add_argument('fonts', help='font file to patch', metavar='font', nargs='+')
parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename') parser.add_argument('--no-rename', help='don\'t add " for Powerline" to the font name', default=True, action='store_false', dest='rename')
parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0])) parser.add_argument('--symbol-font', help='font file with symbols', metavar='font', dest='symbol_font', default='{0}/PowerlineSymbols.sfd'.format(sys.path[0]))
parser.add_argument('--fix-mono', help='fixes some mono-fonts which have glyphs of 0 widths', default=False, action='store_true', dest='fixmono')
parser.add_argument('--fix-win', help='modifies font names such that Windows correctly recognizes font families', default=False, action='store_true', dest='fixwin')


args = parser.parse_args() args = parser.parse_args()


Expand Down Expand Up @@ -78,6 +81,8 @@ for font_path in args.fonts:
font.fontname += 'ForPowerline' font.fontname += 'ForPowerline'
font.appendSFNTName('English (US)', 'Preferred Family', font.familyname) font.appendSFNTName('English (US)', 'Preferred Family', font.familyname)
font.appendSFNTName('English (US)', 'Compatible Full', font.fullname) font.appendSFNTName('English (US)', 'Compatible Full', font.fullname)
if args.fixwin:
font.fontname = re.sub(r'\W', '', font.familyname)


# Force the em size to be equal # Force the em size to be equal
symbols.em = font.em symbols.em = font.em
Expand Down Expand Up @@ -222,6 +227,9 @@ for font_path in args.fonts:
if extension.lower() not in ['ttf', 'otf']: if extension.lower() not in ['ttf', 'otf']:
# Default to OpenType if input is not TrueType/OpenType # Default to OpenType if input is not TrueType/OpenType
extension = 'otf' extension = 'otf'
if args.fixmono:
for glyph in font.glyphs():
if glyph.width == 0: glyph.width = font_dim['width']


if onlybitmaps: if onlybitmaps:
# Generate BDF font # Generate BDF font
Expand Down