From b6abec986f26d11e657d17ab6c28fed944f30fb0 Mon Sep 17 00:00:00 2001 From: Jany Belluz Date: Mon, 10 Jul 2017 18:47:01 +0200 Subject: [PATCH] Update the build system to bake in the non-looped k --- .gitignore | 9 +- CHANGELOG.md | 111 +++++++++ Makefile | 51 +--- README.md | 90 ++----- Scripts/build.py | 55 +++++ Scripts/fontbuilder.py | 223 ++++++++++++++++++ .../generate-css-decl | 39 +-- Scripts/generate-font-variants | 16 ++ Scripts/generate-other-formats | 14 ++ Scripts/validate-font | 32 +++ Scripts/zip-all-variants | 17 ++ Webfonts/README.md | 4 - pkg.sh | 19 +- 13 files changed, 514 insertions(+), 166 deletions(-) create mode 100644 CHANGELOG.md create mode 100755 Scripts/build.py create mode 100644 Scripts/fontbuilder.py rename validate-generate => Scripts/generate-css-decl (58%) create mode 100755 Scripts/generate-font-variants create mode 100755 Scripts/generate-other-formats create mode 100755 Scripts/validate-font create mode 100755 Scripts/zip-all-variants delete mode 100644 Webfonts/README.md diff --git a/.gitignore b/.gitignore index 5f6c4f4..a8996fb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,13 +4,8 @@ TeX *.deb *.rpm *~ -Webfonts/*.woff -Webfonts/*.woff2 -Webfonts/*.svg -Webfonts/*.eot -Webfonts/*.css -OTF/*.otf -TTF/*.ttf Specimen/*.svg Sources/*.sfd-* +Variants +*.pyc diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a6b5c7d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,111 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). + +## Unreleased + +### Changed +- Upgrade the build system to have a proper version of the font with + a built-in stylistic set `ss01` (no-loop `k`) + + Thanks to the [Monoid](https://github.com/larsenwork/monoid) project + for open-sourcing their build scripts. + +## 1.7.1 +- **Add a stylistic set to replace the looped lowercase `k` with + a straight version.** +- Adjust curly quotes so they behave better as apostrophes. +- Also, since nobody complained about the new Cyrillic characters, + I declare this is their official release! (I did not change + anything since 1.7.0 though). + +## 1.7.0 + +Beta version for the 1.7 series. + +- **Add Cyrillic alphabet to the four fonts.** +- Add some real sub/supscript numbers and fractions. +- Revamp straight and curly quotes. +- Fix some Windows rendering issues. +- Move accents around (why do I do that every time?) +- Add `fontdiff` script which generates font diffs. + +## 1.6.5 +- Make italics visible on Windows. + +## 1.6.4 +- Fix line height on Mac. +- Move all the italic glyphs to the left. +- Adjust some accents. + +## 1.6.3 +- Add block characters. +- Make the underscore visible on Windows. +- Generate better CSS. + +## 1.6.2 +- Make `+` symmetrical, align dots in `:` and `;`. + +## 1.6.1 +- Simplify @ to make it look sharp at all sizes. +- Various fixes. + +## 1.6 +- Add bold italic version. + +## 1.5 +- Add regular italic version. +- Some small changes (Q, w, y, n). + +## 1.4.1 +- Drop Reserved Font Name. **You can now subset, compress, hint and + whatnot without worrying about renaming**. +- Many small improvements (8, s , t, a, e, {, }, W, i, l, g...). + +## 1.4 +- Rename font to **Fantasque Sans**, because *fantasque is the new cosmic*. +- Make W look symmetrical at big size. + +## 1.3.2 +- Various fixes: playing again with bold m, moving accents again, taking + care again of Powerline symbols, clean 8 and R. +- Add a few box drawing characters (for use with vim-indentline). +- Generate webfonts (goal: this font used for code samples on all cool + languages' websites). +- Add a WIP medium version of the proportional font. + +## 1.3.1 +- Various fixes: still cleaning m and w, reworked all ogoneks, changed a + bit the dollar, moved some accents, eliminated glitches around + Powerline symbols. +- TTF fonts are now hinted using Freetype's `ttfautohint`, which should + give much better results on Windows (and maybe in Java apps and others + contexts). In case this is a problem, please let me know and I will + provide also an unhinted version. + + **Windows users should use the TTF (TrueType) files.** + +## 1.3 +- Very slight change of metrics to add space between characters and lines. +- Various small changes : curlier curly brackets, more difference between +- various quotes, cleaner W, w, m, and rounder @. +- Windows compatibility. +- More latin accents. +- Greek letters. +- Powerline characters. + +## 1.2.1 +- Minor adjustments. + +## 1.2 +- Add the bold version. +- Various minor adjustments, new paragraph symbol, slanted dollar. + +## 1.1.1 +- Make slashes longer, ensure parenthesis and brackets are rendered at + the same height, and some other minor adjustments. + +## 1.1 +First release. diff --git a/Makefile b/Makefile index b18aad1..230c279 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,21 @@ -SOURCES=$(wildcard Sources/*.sfdir) +SOURCES=$(wildcard Sources/FantasqueSansMono*.sfdir) BASENAMES=$(patsubst Sources/%.sfdir,%,$(SOURCES)) -TTF_FILES=$(patsubst %,TTF/%.ttf,$(BASENAMES)) -OTF_FILES=$(patsubst %,OTF/%.otf,$(BASENAMES)) -SVG_FILES=$(patsubst %,Webfonts/%.svg,$(BASENAMES)) -WOFF_FILES=$(patsubst %,Webfonts/%.woff,$(BASENAMES)) -WOFF2_FILES=$(patsubst %,Webfonts/%.woff2,$(BASENAMES)) -EOT_FILES=$(patsubst %,Webfonts/%.eot,$(BASENAMES)) -CSS_FRAGMENTS=$(patsubst %,Webfonts/%-decl.css,$(BASENAMES)) -CSS_FILE=Webfonts/stylesheet.css +TTF_FILES=$(patsubst %,Variants/Normal/TTF/%.ttf,$(BASENAMES)) +ZIP_FILE=Variants/Normal/FantasqueSansMono.zip INSTALLED_TTF_FILES=$(patsubst %,~/.fonts/%.ttf,$(BASENAMES)) -all: $(TTF_FILES) +all: $(ZIP_FILE) -OTF/%.otf TTF/%.ttf Webfonts/%.svg Webfonts/%.eot Webfonts/%.woff Webfonts/%.woff2 Webfonts/%-decl.css: Sources/%.sfdir - mkdir -p OTF TTF Webfonts - ./validate-generate "$*" - # TODO determine perfect parameters - ttfautohint "TTF/$*.ttf" "TTF/$*.hinted.ttf" - mv "TTF/$*.hinted.ttf" "TTF/$*.ttf" - sfnt2woff "OTF/$*.otf" - mv "OTF/$*.woff" Webfonts - woff2_compress "TTF/$*.ttf" - mv "TTF/$*.woff2" Webfonts - ttf2eot "TTF/$*.ttf" > "Webfonts/$*.eot" +$(ZIP_FILE): $(TTF_FILES) + Scripts/zip-all-variants Variants -$(CSS_FILE): $(CSS_FRAGMENTS) - cat $(foreach v,$(CSS_FRAGMENTS),$(if $(findstring Mono,$v),$v)) > $(CSS_FILE) +Variants/Normal/TTF/%.ttf: Sources/%.sfdir + mkdir -p Variants + Scripts/validate-font "$<" + Scripts/generate-font-variants "$<" Variants -.PHONY: install clean zips zip-mono zip-prop +.PHONY: install clean install: $(INSTALLED_TTF_FILES) $(INSTALLED_TTF_FILES): $(TTF_FILES) @@ -36,19 +23,5 @@ $(INSTALLED_TTF_FILES): $(TTF_FILES) cp $^ ~/.fonts/ fc-cache -f -zips: zip-mono zip-prop - -zip-mono: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(WOFF2_FILES) $(SOURCES) $(CSS_FILE) - zip FantasqueSansMono.zip LICENSE.txt README.md Webfonts/README.md $(CSS_FILE) $(foreach v,$^,$(if $(findstring Mono,$v),$v)) - tar czvf FantasqueSansMono.tar.gz LICENSE.txt README.md Webfonts/README.md $(CSS_FILE) $(foreach v,$^,$(if $(findstring Mono,$v),$v)) - - -zip-prop: $(TTF_FILES) $(OTF_FILES) $(SVG_FILES) $(EOT_FILES) $(WOFF_FILES) $(WOFF2_FILES) $(SOURCES) - zip FantasqueSans.zip LICENSE.txt README.md Webfonts/README.md $(foreach v,$^,$(if $(findstring Mono,$v),,$v)) - tar czvf FantasqueSans.tar.gz LICENSE.txt README.md Webfonts/README.md $(foreach v,$^,$(if $(findstring Mono,$v),,$v)) - clean: - rm -f TTF/*.ttf *.zip OTF/* Webfonts/*.eot Webfonts/*.woff Webfonts/*.woff2 Webfonts/*.svg Webfonts/*.css - -test: $(INSTALLED_TTF_FILES) - gvim -f ~/Developpement/Système/kernel-base/shared/printf.c + rm -rf Variants diff --git a/README.md b/README.md index 3a1f58a..49f5b31 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Stylistic set(s) ### `ss01`: nondescript `k` No ~~distractive~~ lovely loop. -[Get the pre-activated version here](https://github.com/belluzj/fantasque-sans/releases/download/v1.7.1/FantasqueSansMono_ss01.zip) +[Get the pre-activated version here](https://github.com/belluzj/fantasque-sans/releases/download/v1.7.2-alpha/FantasqueSansMono_NoLoopK.zip) or see the [issue #67](https://github.com/belluzj/fantasque-sans/issues/67) for techniques to activate the stylistic set. @@ -95,81 +95,19 @@ and update the font cache. It comes in handy while modifying the font. [![](Specimen/Specimen.png)](Specimen/Specimen.pdf) +Webfonts +-------- + +Each variant has a `Webfonts/` folder which contains various font formats for +use on the web, along with the matching CSS font declarations. To use them, +you must combine in the same folder: +* a custom `.css` file that you can assemble from the `*-decl.css` fragments + (you can only pick the styles that you need, e.g. normal and bold) +* the matching `.svg`, `.woff`, `.woff2`, `.eot` files from `Webfonts/` +* the matching `.ttf` files from the `TTF/` folder +* the matching `.otf` files from the `OTF/` folder. + Versions -------- -1.1 - First release. - -1.1.1 - Make slashes longer, ensure parenthesis and brackets are rendered at - the same height, and some other minor adjustments. - -1.2 - Add the bold version. - Various minor adjustments, new paragraph symbol, slanted dollar. - -1.2.1 - Minor adjustments. - -1.3 - Very slight change of metrics to add space between characters and lines. - Various small changes : curlier curly brackets, more difference between - various quotes, cleaner W, w, m, and rounder @. - Windows compatibility. - More latin accents. - Greek letters. - Powerline characters. - -1.3.1 - Various fixes: still cleaning m and w, reworked all ogoneks, changed a - bit the dollar, moved some accents, eliminated glitches around - Powerline symbols. - TTF fonts are now hinted using Freetype's `ttfautohint`, which should - give much better results on Windows (and maybe in Java apps and others - contexts). In case this is a problem, please let me know and I will - provide also an unhinted version. - **Windows users should use the TTF (TrueType) files.** - -1.3.2 - Various fixes: playing again with bold m, moving accents again, taking - care again of Powerline symbols, clean 8 and R. - Add a few box drawing characters (for use with vim-indentline). - Generate webfonts (goal: this font used for code samples on all cool - languages' websites). - Add a WIP medium version of the proportional font. - -1.4 - Rename font to **Fantasque Sans**, because *fantasque is the new cosmic*. - Make W look symetrical at big size. - -1.4.1 - Drop Reserved Font Name. **You can now subset, compress, hint and - whatnot without worrying about renaming**. - Many small improvements (8, s , t, a, e, {, }, W, i, l, g...). - -1.5 - Add regular italic version. - Some small changes (Q, w, y, n). - -1.6 - Add bold italic version. - -1.6.1 - Simplify @ to make it look sharp at all sizes. - Various fixes. - -1.6.2 - Make `+` symmetrical, align dots in `:` and `;`. - -1.6.3 - Add block characters. - Make the underscore visible on Windows. - Generate better CSS. - -1.6.4 - Fix line height on Mac. - Move all the italic glyphs to the left. - Adjust some accents. - -1.6.5 - Make italics visible on Windows. - -1.7.0 - Beta version for the 1.7 series. - **Add Cyrillic alphabet to the four fonts.** - Add some real sub/supscript numbers and fractions. - Revamp straight and curly quotes. - Fix some Windows rendering issues. - Move accents around (why do I do that every time?) - Add `fontdiff` script which generates font diffs. - -1.7.1 - **Add a stylistic set to replace the looped lowercase `k` with - a straight version.** - Adjust curly quotes so they behave better as apostrophes. - Also, since nobody complained about the new Cyrillic characters, - I declare this is their official release! (I did not change - anything since 1.7.0 though). +[Check out the changelog](CHANGELOG.md). diff --git a/Scripts/build.py b/Scripts/build.py new file mode 100755 index 0000000..4547df5 --- /dev/null +++ b/Scripts/build.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python2.7 +# Adapted from https://github.com/larsenwork/monoid +# Copyright (c) 2015, Andreas Larsen and contributors. +# vim: sts=4 sw=4 ts=4 et + +import sys +if len(sys.argv) < 5: + usage = """Build should be run with 4 arguments: + + First: The total possible number of parallel processes (1+) + Second: The parallel batch number (0+) + Third: The .sfdir for the font + Fourth: The output directory + """ + print >> sys.stderr, usage + exit(1) + +from fontbuilder import * + +# Output directory +output = sys.argv[4] + +# # Options to generate +# conflicting( +# style('Loose', Bearing(right=128)), +# style('HalfLoose', Bearing(right=64)), +# # style('normal', Bearing(left=0)), +# style('HalfTight', Bearing(left=-64)), +# style('Tight', Bearing(left=-128)) +# ) + +# conflicting( +# option('XtraSmall', '13px', Line(1536, 256)), +# option('Small', '14px', Line(1536, 384)), +# # option('medium', 15px', Line(1664, 384)), +# option('Large', '16px', Line(1664, 512)), +# option('XtraLarge', '17px', Line(1792, 512)) +# ) + +# ss01 +option('NoLoopK', 'No loop k', SwapLookup('ss01')) +# option('Dollar', 'Alt $', Swap("dollar", "dollar.empty")) +# # ss03 +# option('0', 'Alt 0', Swap("zero", "zero.dot")) +# # ss05 +# option('1', 'Alt 1', Swap("one", "one.base")) +# # ss08 +# option('l', 'Alt l', Swap("l", "l.zstyle")) +# # ss14 +# # option('Squeeze', 'Squeezed capitals with diacritics', SwapLookup("ss14")) +# # no calt +# option('NoCalt', 'Turn off contextual alternates', DropCAltAndLiga()) + +# Build options in +build_batch(output, sys.argv[3], int(sys.argv[1]), int(sys.argv[2])) diff --git a/Scripts/fontbuilder.py b/Scripts/fontbuilder.py new file mode 100644 index 0000000..570e36b --- /dev/null +++ b/Scripts/fontbuilder.py @@ -0,0 +1,223 @@ +# Adapted from https://github.com/larsenwork/monoid +# Copyright 2015 Chase Colman (chase@colman.io) +# LICENSE: MIT +# vim: sts=4 sw=4 ts=4 et + +import fontforge +from itertools import compress +import os +from os.path import basename, splitext, join +import subprocess + +SCRIPTS = os.path.dirname(os.path.realpath(__file__)) + +def mkdir_p(path): + normalized = os.path.normpath(path) + try: + os.makedirs(normalized) + except OSError: + pass + +# Builder +def style(name, does): + if not isinstance(does, list): + does = [does] + option(name, name, [Variation(name)] + does) + + return name + +def option(abrv, name, does): + if not isinstance(does, list): + does = [does] + option.operations[abrv] = does + option.abrvs.append(abrv) + option.names[abrv] = name + + return abrv + +# Initialize the operations map, abbreviation list, and name map +option.operations = {} +option.abrvs = [] +option.names = {} + +def conflicting(*abrvs): + """Wrap the abbreviations as a tuple in the option abbreviation list""" + # Assumes last #abrvs abbreviations are conflicting options + option.abrvs = option.abrvs[:-len(abrvs)] + [tuple(abrvs)] + +def _expand_options(bitmap): + # Apply the bitmap to the options + opts = compress(option.abrvs, bitmap) + + # Expand the permutations for all options + expanded = [[]] + for opt in opts: + if isinstance(opt, tuple): + expanded = [items + [prmtn] for items in expanded for prmtn in opt] + else: + expanded = [items + [opt] for items in expanded] + + return expanded + +def permutations(): + """Yields all possible permutations from the options list""" + count = len(option.abrvs) + + # Each option is a binary choice, so we use an int as a quick bitmap. + # To iterate over every possible permutation, all we have to do is increment + # up to the maximum value 2^(#options) + bitmap_max = 1 << count + + # Iterate over all possible permutations + for i in xrange(bitmap_max): + # Map the iteration's permutations using a bitmap + bitmap = [i >> n & 1 for n in xrange(count)] + for opts in _expand_options(bitmap): + yield(int(float(i)/bitmap_max*100), opts) + +def _build(dstdir, font, permutations): + for prcnt, opts in permutations: + # Open the original font + fnt = fontforge.open(font) + + # Get the base name for the font + name = splitext(basename(font))[0] + + # Build a variant name based on applied options + variants = [] + + for opt in opts: + # Append this option to the font name + variants.append(str(opt)) + # Run all the operations for this option + for oper in option.operations[opt]: + oper(fnt) + + variant = '-'.join(variants) or 'Normal' + variant_dir = join(dstdir, variant) + + print('Generating ' + variant_dir) + + mkdir_p(join(variant_dir, 'TTF')) + mkdir_p(join(variant_dir, 'OTF')) + mkdir_p(join(variant_dir, 'Webfonts')) + + # Output the files and cleanup + fnt.generate(join(variant_dir, 'TTF', name + '.ttf'), flags=("opentype", "dummy-dsig")) + fnt.generate(join(variant_dir, 'OTF', name + '.otf'), flags=("opentype", "dummy-dsig")) + fnt.generate(join(variant_dir, 'Webfonts', name + '.svg')) + fnt.close() + + # Output other formats and the CSS declaration + subprocess.check_call( + [join(SCRIPTS, 'generate-other-formats'), font], + cwd=variant_dir + ) + subprocess.check_call( + [join(SCRIPTS, 'generate-css-decl'), font], + cwd=variant_dir + ) + +def build(dstdir, font): + _build(dstdir, font, permutations()) + +def build_batch(dstdir, font, total_nodes, node_number): + # Starting at (i) node_number, build option every (n) total_nodes + _build(dstdir, font, list(permutations())[node_number::total_nodes]) + +# Operations +## NOTE: +## All operations return a closure with the 1st argument being a fontforge.font +def Line(ascent, descent): + """Sets the ascent and/or descent of the font's line""" + def line_op(fnt): + fnt.os2_winascent = fnt.os2_typoascent = fnt.hhea_ascent = ascent + fnt.os2_windescent = descent + fnt.os2_typodescent = fnt.hhea_descent = -descent + return line_op + +def Bearing(left=0, right=0): + """Adjusts the left and/or right bearings of all glyphs""" + def bearing_op(fnt): + for glyph in fnt.glyphs(): + if left != 0: + glyph.left_side_bearing += left + if right != 0: + glyph.right_side_bearing += right + return bearing_op + +def Swap(glyph1, glyph2): + """Swaps the places of two glyphs""" + def swap_op(fnt): + # Unlike selections, glyph layer data is returned as a copy + swp = fnt[glyph1].foreground + fnt[glyph1].foreground = fnt[glyph2].foreground + fnt[glyph2].foreground = swp + return swap_op + +def SwapLookup(target_lookup): + """Swaps the places of glyphs based on an OpenType lookup table""" + def swaplookup_op(fnt): + # Get every subtable for every matching lookup + lookups = [i for i in fnt.gsub_lookups if fnt.getLookupInfo(i)[2][0][0] == target_lookup] + subtables = [] + for lookup in lookups: + for subtable in fnt.getLookupSubtables(lookup): + subtables.append(subtable) + + for glyph in fnt.glyphs(): + subbed = False + + for subtable in subtables: + posSub = glyph.getPosSub(subtable) + if not subbed and posSub and posSub[0][1] == "Substitution": + subbed = True # Don't double tap if there are duplicates + + sub = posSub[0][2] + swp = glyph.foreground + glyph.foreground = fnt[sub].foreground + fnt[sub].foreground = swp + + return swaplookup_op + +def DropCAltAndLiga(): + """Removes Contextual Alternates and Ligatures""" + def dropcaltandliga_op(fnt): + for lookup in fnt.gsub_lookups: + if fnt.getLookupInfo(lookup)[0] in ['gsub_ligature', 'gsub_contextchain']: + fnt.removeLookup(lookup) + + return dropcaltandliga_op + +def Variation(name): + """Changes the subfamily/variation of the font""" + def variation_op(fnt): + # Get the SFNT information as dictionary {property: value} + # where English (US) is the language... Here be dragons. + # + # o + # /\ + # /::\ + # /::::\ + # ,a_a /\::::/\ + # {/ ''\_ /\ \::/\ \ + # {\ ,_oo) /\ \ \/\ \ \ + # {/ (_^____/ \ \ \ \ \ \ + # .=. {/ \___)))*) \ \ \ \ \/ + # (.=.`\ {/ /=; ~/ \ \ \ \/ + # \ `\{/( \/\ / \ \ \/ + # \ `. `\ ) ) \ \/ + # \ // /_/_ \/ + # '==''---)))) + sfnt_dict = {sfnt[1]: sfnt[2] for sfnt in fnt.sfnt_names if sfnt[0] == 'English (US)'} + + fnt.familyname = sfnt_dict['Family'] + ' ' + name + fnt.fullname = fnt.familyname + ' ' + sfnt_dict['SubFamily'] + fnt.fontname = fnt.fullname.replace(' ', '-') + + fnt.appendSFNTName('English (US)', 'Family', fnt.familyname) + fnt.appendSFNTName('English (US)', 'Fullname', fnt.fullname) + fnt.appendSFNTName('English (US)', 'PostScriptName', fnt.fontname) + fnt.appendSFNTName('English (US)', 'SubFamily', sfnt_dict['SubFamily']) + fnt.appendSFNTName('English (US)', 'UniqueID', sfnt_dict['UniqueID'] + ' : ' + name) + return variation_op diff --git a/validate-generate b/Scripts/generate-css-decl similarity index 58% rename from validate-generate rename to Scripts/generate-css-decl index a91650b..a7d4add 100755 --- a/validate-generate +++ b/Scripts/generate-css-decl @@ -1,19 +1,17 @@ #!/usr/bin/env bash -# Generate font files with FontForge, and a CSS declaration for this font. +# Generate a CSS declaration for the given font if ! type fontforge &> /dev/null; then echo "ERROR: Missing dependency: fontforge" 1>&2; exit 1; fi -basename=$1 -ttf="${basename}.ttf" -otf="OTF/${basename}.otf" +fullname=$1 +basename=$(basename "$fullname" .sfdir) -echo -e "\e[1;37mGenerating ${basename}... \e[0m" - -output=$(fontforge -lang=py -script - < Webfonts/${basename}-decl.css < "Webfonts/${basename}-decl.css" < Webfonts/${basename}-decl.css < /dev/null; then echo "ERROR: Missing dependency: fontforge" 1>&2; exit 1; fi + +path="$(pwd)/$1" +basename=$(basename "$path" .sfdir) +output_dir=$2 + +echo -e "\e[1;37mGenerating ${basename} variants... \e[0m" + +fontforge --quiet -lang=py -script "$SCRIPTS/build.py" 1 0 "$path" "$output_dir" || exit 1 + +echo -e "\e[1;32m${basename} OK.\e[0m" diff --git a/Scripts/generate-other-formats b/Scripts/generate-other-formats new file mode 100755 index 0000000..291f7c9 --- /dev/null +++ b/Scripts/generate-other-formats @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +SCRIPTS=$(cd "$(dirname $0)" && pwd) + +name=$1 +basename=$(basename "$name" .sfdir) + +# TODO determine perfect parameters +ttfautohint "TTF/${basename}.ttf" "TTF/${basename}.hinted.ttf" +mv "TTF/${basename}.hinted.ttf" "TTF/${basename}.ttf" +sfnt2woff "OTF/${basename}.otf" +mv "OTF/${basename}.woff" Webfonts +woff2_compress "TTF/${basename}.ttf" +mv "TTF/${basename}.woff2" Webfonts +ttf2eot "TTF/${basename}.ttf" > "Webfonts/${basename}.eot" diff --git a/Scripts/validate-font b/Scripts/validate-font new file mode 100755 index 0000000..73fc77b --- /dev/null +++ b/Scripts/validate-font @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Validate a font file with FontForge. + +if ! type fontforge &> /dev/null; then echo "ERROR: Missing dependency: fontforge" 1>&2; exit 1; fi + +name=$1 +basename=$(basename "$name" .sfdir) + +echo -e "\e[1;37mValidating ${basename}... \e[0m" + +output=$(fontforge --quiet -lang=py -script - "$name" < /dev/null || exit 1 + echo "Targzing $name" + tar czvf "../FantasqueSansMono-$name.tar.gz" * > /dev/null || exit 1 + ) +done diff --git a/Webfonts/README.md b/Webfonts/README.md deleted file mode 100644 index 93c2790..0000000 --- a/Webfonts/README.md +++ /dev/null @@ -1,4 +0,0 @@ -In order to use the included CSS rules, upload in the same folder: -* the contents of `Webfonts/` -* mixed with the `.ttf` files from the `TTF/` folder -* mixed with the `.otf` files from the `OTF/` folder. diff --git a/pkg.sh b/pkg.sh index 22bd18d..352828d 100755 --- a/pkg.sh +++ b/pkg.sh @@ -19,14 +19,15 @@ fpm -s dir -t ${pkg} -a all \ --url ${url} \ --description "${desc}" \ --license OFL \ - TTF/FantasqueSansMono-Regular.ttf=/usr/share/fonts/truetype/${name}/ \ - TTF/FantasqueSansMono-Bold.ttf=/usr/share/fonts/truetype/${name}/ \ - TTF/FantasqueSansMono-Italic.ttf=/usr/share/fonts/truetype/${name}/ \ - TTF/FantasqueSansMono-BoldItalic.ttf=/usr/share/fonts/truetype/${name}/ \ - OTF/FantasqueSansMono-Regular.otf=/usr/share/fonts/opentype/${name}/ \ - OTF/FantasqueSansMono-Bold.otf=/usr/share/fonts/opentype/${name}/ \ - OTF/FantasqueSansMono-Italic.otf=/usr/share/fonts/opentype/${name}/ \ - OTF/FantasqueSansMono-BoldItalic.otf=/usr/share/fonts/opentype/${name}/ \ + Variants/Normal/TTF/FantasqueSansMono-Regular.ttf=/usr/share/fonts/truetype/${name}/ \ + Variants/Normal/TTF/FantasqueSansMono-Bold.ttf=/usr/share/fonts/truetype/${name}/ \ + Variants/Normal/TTF/FantasqueSansMono-Italic.ttf=/usr/share/fonts/truetype/${name}/ \ + Variants/Normal/TTF/FantasqueSansMono-BoldItalic.ttf=/usr/share/fonts/truetype/${name}/ \ + Variants/Normal/OTF/FantasqueSansMono-Regular.otf=/usr/share/fonts/opentype/${name}/ \ + Variants/Normal/OTF/FantasqueSansMono-Bold.otf=/usr/share/fonts/opentype/${name}/ \ + Variants/Normal/OTF/FantasqueSansMono-Italic.otf=/usr/share/fonts/opentype/${name}/ \ + Variants/Normal/OTF/FantasqueSansMono-BoldItalic.otf=/usr/share/fonts/opentype/${name}/ \ LICENSE.txt=/usr/share/doc/${name}/copyright \ README.md=/usr/share/doc/${name}/ \ - Specimen=/usr/share/doc/${name}/ + CHANGELOG.md=/usr/share/doc/${name}/ \ + Specimen=/usr/share/doc/${name}/