Skip to content

Commit

Permalink
Fix uni042b glyph in Roman weights.
Browse files Browse the repository at this point in the history
This solves issue google/fonts#7.

There is a newer release of Playfair but the GF version and upstream version have different proportions. @davelab6 suggested a quick hotfix since this issue is urgent.;
  • Loading branch information
m4rc1e committed Aug 22, 2017
1 parent 6cce75d commit b878fd6
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
Binary file added PlayfairDisplay-Black.ttf
Binary file not shown.
Binary file added PlayfairDisplay-BlackItalic.ttf
Binary file not shown.
Binary file added PlayfairDisplay-Bold.ttf
Binary file not shown.
Binary file added PlayfairDisplay-BoldItalic.ttf
Binary file not shown.
Binary file added PlayfairDisplay-Italic.ttf
Binary file not shown.
Binary file added PlayfairDisplay-Regular.ttf
Binary file not shown.
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Fix glyph uni042b. The components need swapping
python fix_uni042b.py

# Update font version number
FONTS=$(ls *.ttf)
fontbakery update-version $FONTS 1.002 1.003



rm $FONTS
FONTS_VERSION_BUMPED=$(ls *.fix)
# replace .fix with .ttf
for font in $FONTS_VERSION_BUMPED
do
mv $font "${font%.*}"
done
36 changes: 36 additions & 0 deletions fix_uni042b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
Fixes issue: https://github.com/google/fonts/issues/7
"""

import os
from fontTools.ttLib import TTFont


BAD_GLYPH = 'uni042B'

NEW_COORDS = {
'PlayfairDisplay-Black.ttf': {'uni042C': 0, 'I': 1393},
'PlayfairDisplay-Bold.ttf': {'uni042C': 0, 'I': 1311},
'PlayfairDisplay-Regular.ttf': {'uni042C': 0, 'I': 1188},

}

def main():
fonts_paths = [p for p in os.listdir('.')
if p.endswith('.ttf') and not
'Italic' in p]
for font_path in fonts_paths:
font = TTFont(font_path)

for i, component in enumerate(font['glyf'][BAD_GLYPH].components):
c_name = component.glyphName
if c_name in NEW_COORDS[font_path]:
font['glyf'][BAD_GLYPH].components[i].x = NEW_COORDS[font_path][c_name]

os.remove(font_path)
print('Rewriting ttf %s' % font_path)
font.save(font_path)
print 'Done!'

if __name__ == '__main__':
main()

0 comments on commit b878fd6

Please sign in to comment.