add woff2 fonts

This commit is contained in:
Adam Bradley
2016-01-11 15:39:03 -06:00
parent 79302a0b9d
commit ecb0d5c96e
12 changed files with 26 additions and 13 deletions
+10 -2
View File
@@ -12,7 +12,7 @@ import copy
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
INPUT_SVG_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'src')
OUTPUT_FONT_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'fonts')
OUTPUT_FONT_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'dist', 'fonts')
MANIFEST_PATH = os.path.join(SCRIPT_PATH, '..', 'manifest.json')
BUILD_DATA_PATH = os.path.join(SCRIPT_PATH, '..', 'build_data.json')
AUTO_WIDTH = True
@@ -158,7 +158,11 @@ else:
f.fontname = font_name
f.familyname = font_name
f.fullname = font_name
print 'Generate TTF Font File'
f.generate(fontfile + '.ttf')
print 'Generate SVG Font File'
f.generate(fontfile + '.svg')
# Fix SVG header for webkit
@@ -179,12 +183,16 @@ else:
subprocess.call(['sfnt2woff', fontfile + '.ttf'])
# eotlitetool.py script to generate IE7-compatible .eot fonts
print 'Generate EOT Font File'
subprocess.call('python ' + scriptPath + '/eotlitetool.py ' + fontfile + '.ttf -o ' + fontfile + '.eot', shell=True)
subprocess.call('mv ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
# Hint the TTF file
print 'Hint TTF file'
subprocess.call('ttfautohint -s -f -n ' + fontfile + '.ttf ' + fontfile + '-hinted.ttf > /dev/null 2>&1 && mv ' + fontfile + '-hinted.ttf ' + fontfile + '.ttf', shell=True)
print 'Generate WOFF2 Font File'
subprocess.call('woff2_compress ' + fontfile + '.ttf', shell=True)
manifest_data['icons'] = sorted(manifest_data['icons'], key=lambda k: k['name'])
build_data['icons'] = sorted(build_data['icons'], key=lambda k: k['name'])
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -5,7 +5,7 @@
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<metadata>
Created by FontForge 20150913 at Mon Jan 11 12:47:11 2016
Created by FontForge 20150913 at Mon Jan 11 15:33:02 2016
By Adam Bradley
Copyright (c) 2016, Adam Bradley
</metadata>

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1
View File
@@ -18,6 +18,7 @@
font-family: $ionicons-font-family;
src:url("#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}");
src:url("#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}#iefix") format("embedded-opentype"),
url("#{$ionicons-font-path}/ionicons.woff2?v=#{$ionicons-version}") format("woff2"),
url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"),
url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype"),
url("#{$ionicons-font-path}/ionicons.svg?v=#{$ionicons-version}#Ionicons") format("svg");
+10 -6
View File
@@ -28,25 +28,29 @@ You can use [ionicons.com](http://ionicons.com) to easily find the icon you want
## Build Instructions
This repo already comes with all the files built and ready to go, but can also build the fonts from the source. Requires Python, FontForge and Sass:
This repo already comes with all the files built and ready to go, but can also build the fonts from the source. Requires Python, FontForge, WOFF2, SVGO and Sass:
1) Install FontForge, which is the program that creates the font files from the SVG files:
$ brew install fontforge ttfautohint
2) Install [Sass](http://sass-lang.com/)
2) Install Google's WOFF2 font compressor
https://github.com/google/woff2
3) Install [Sass](http://sass-lang.com/)
$ gem install sass
3) Install [SVGO](https://github.com/svg/svgo)
4) Install [SVGO](https://github.com/svg/svgo)
$ npm install -g svgo
4) Add or subtract files from the `src/` folder you'd like to be apart of the font files.
5) Add or subtract files from the `src/` folder you'd like to be apart of the build.
5) Modify any settings in the `builder/manifest.json` file. You can change the name of the font-family and CSS classname prefix.
6) Modify any settings in the `builder/manifest.json` file. You can change the name of the font-family and CSS classname prefix.
6) Run the build command:
7) Run the build command:
python ./builder/generate.py