summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile58
-rwxr-xr-xinit.sh45
-rwxr-xr-xmisc/fontbuild11
-rwxr-xr-xmisc/fontbuild26
-rw-r--r--misc/ufo2ft-2.5.0-outlineCompiler.patch18
-rw-r--r--requirements2.txt17
6 files changed, 49 insertions, 106 deletions
diff --git a/Makefile b/Makefile
index 695678998..23d6cc6f9 100644
--- a/Makefile
+++ b/Makefile
@@ -96,72 +96,28 @@ all_ufo_masters = $(Thin_ufo_d) \
$(FONTDIR)/var/%.var.ttf: src/%.designspace $(all_ufo_masters)
misc/fontbuild compile-var -o $@ $<
-
-# ---------- begin workaround for issue #110 -----------
-
-# $(FONTDIR)/const/Inter-UI-Thin.%: src/Inter-UI.designspace $(Thin_ufo_d)
-# misc/fontbuild compile -o $@ src/Inter-UI-Thin.ufo
-
-# $(FONTDIR)/const/Inter-UI-ThinItalic.%: src/Inter-UI.designspace $(ThinItalic_ufo_d)
-# misc/fontbuild compile -o $@ src/Inter-UI-ThinItalic.ufo
-
-# $(FONTDIR)/const/Inter-UI-Regular.%: src/Inter-UI.designspace $(Regular_ufo_d)
-# misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo
-
-# $(FONTDIR)/const/Inter-UI-Italic.%: src/Inter-UI.designspace $(Italic_ufo_d)
-# misc/fontbuild compile -o $@ src/Inter-UI-Italic.ufo
-
-# $(FONTDIR)/const/Inter-UI-Black.%: src/Inter-UI.designspace $(Black_ufo_d)
-# misc/fontbuild compile -o $@ src/Inter-UI-Black.ufo
-
-# $(FONTDIR)/const/Inter-UI-BlackItalic.%: src/Inter-UI.designspace $(BlackItalic_ufo_d)
-# misc/fontbuild compile -o $@ src/Inter-UI-BlackItalic.ufo
-
-
-$(FONTDIR)/const/Inter-UI-Thin.ttf: src/Inter-UI.designspace $(Thin_ufo_d)
+$(FONTDIR)/const/Inter-UI-Thin.%: src/Inter-UI.designspace $(Thin_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-Thin.ufo
-$(FONTDIR)/const/Inter-UI-ThinItalic.ttf: src/Inter-UI.designspace $(ThinItalic_ufo_d)
+$(FONTDIR)/const/Inter-UI-ThinItalic.%: src/Inter-UI.designspace $(ThinItalic_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-ThinItalic.ufo
-$(FONTDIR)/const/Inter-UI-Regular.ttf: src/Inter-UI.designspace $(Regular_ufo_d)
+$(FONTDIR)/const/Inter-UI-Regular.%: src/Inter-UI.designspace $(Regular_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo
-$(FONTDIR)/const/Inter-UI-Italic.ttf: src/Inter-UI.designspace $(Italic_ufo_d)
+$(FONTDIR)/const/Inter-UI-Italic.%: src/Inter-UI.designspace $(Italic_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-Italic.ufo
-$(FONTDIR)/const/Inter-UI-Black.ttf: src/Inter-UI.designspace $(Black_ufo_d)
+$(FONTDIR)/const/Inter-UI-Black.%: src/Inter-UI.designspace $(Black_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-Black.ufo
-$(FONTDIR)/const/Inter-UI-BlackItalic.ttf: src/Inter-UI.designspace $(BlackItalic_ufo_d)
+$(FONTDIR)/const/Inter-UI-BlackItalic.%: src/Inter-UI.designspace $(BlackItalic_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-BlackItalic.ufo
-$(FONTDIR)/const/Inter-UI-Thin.otf: src/Inter-UI.designspace $(Thin_ufo_d)
- misc/fontbuild2 compile -o $@ src/Inter-UI-Thin.ufo
-
-$(FONTDIR)/const/Inter-UI-ThinItalic.otf: src/Inter-UI.designspace $(ThinItalic_ufo_d)
- misc/fontbuild2 compile -o $@ src/Inter-UI-ThinItalic.ufo
-
-$(FONTDIR)/const/Inter-UI-Regular.otf: src/Inter-UI.designspace $(Regular_ufo_d)
- misc/fontbuild2 compile -o $@ src/Inter-UI-Regular.ufo
-
-$(FONTDIR)/const/Inter-UI-Italic.otf: src/Inter-UI.designspace $(Italic_ufo_d)
- misc/fontbuild2 compile -o $@ src/Inter-UI-Italic.ufo
-
-$(FONTDIR)/const/Inter-UI-Black.otf: src/Inter-UI.designspace $(Black_ufo_d)
- misc/fontbuild2 compile -o $@ src/Inter-UI-Black.ufo
-
-$(FONTDIR)/const/Inter-UI-BlackItalic.otf: src/Inter-UI.designspace $(BlackItalic_ufo_d)
- misc/fontbuild2 compile -o $@ src/Inter-UI-BlackItalic.ufo
-
-# ---------- end workaround for issue #110 -----------
-
-
# Instance UFO -> OTF, TTF
-
$(FONTDIR)/const/Inter-UI-%.otf: build/ufo/Inter-UI-%.ufo
- misc/fontbuild2 compile -o $@ $<
+ misc/fontbuild compile -o $@ $<
$(FONTDIR)/const/Inter-UI-%.ttf: build/ufo/Inter-UI-%.ufo
misc/fontbuild compile -o $@ $<
diff --git a/init.sh b/init.sh
index 5e702c676..f0dcd4cd9 100755
--- a/init.sh
+++ b/init.sh
@@ -108,31 +108,11 @@ else
done
fi
- # --------------------
- # ISSUE #110 (bug in ufo2ft) requires Python 2 for OTF CFF compilation
- # See also: https://github.com/googlei18n/ufo2ft/issues/306
- PYTHON2=
- if (which python2 >/dev/null); then
- PYTHON2=$(which python2)
- elif (which python >/dev/null) && (python --version | grep -q 'ython 2'); then
- PYTHON2=$(which python)
- else
- echo "Unable to find Python 2 (tried python2 and python)." >&2
- echo "Python 2 is required to compile OTF files because of a Python-3 bug in a third-party library." >&2
- exit 1
- fi
- # ln -svf "$PYTHON2" "$VENV_DIR/bin/python2"
- VENV2_DIR=$BUILD_DIR/venv2
- if [[ ! -d "$VENV2_DIR/bin" ]]; then
- require_virtualenv
- $virtualenv "--python=$PYTHON2" "$VENV2_DIR"
- fi
# ——————————————————————————————————————————————————————————————————
- # check pip requirements
+ # python dependencies
-
- # primary env
+ # install if deps changed
REQUIREMENTS_FILE=$SRCDIR/requirements.txt
UPDATE_TIMESTAMP_FILE="$VENV_DIR/last-pip-run.mark"
if [ "$REQUIREMENTS_FILE" -nt "$UPDATE_TIMESTAMP_FILE" ]; then
@@ -141,21 +121,24 @@ else
date '+%s' > "$UPDATE_TIMESTAMP_FILE"
fi
- # secondary env (Python 2)
- REQUIREMENTS2_FILE=$SRCDIR/requirements2.txt
- UPDATE_TIMESTAMP2_FILE="$VENV2_DIR/last-pip-run.mark"
- if [ "$REQUIREMENTS2_FILE" -nt "$UPDATE_TIMESTAMP2_FILE" ]; then
- echo "$VENV2_DIR/bin/pip install -r $REQUIREMENTS2_FILE"
- "$VENV2_DIR/bin/pip" install -r "$REQUIREMENTS2_FILE"
- date '+%s' > "$UPDATE_TIMESTAMP2_FILE"
+ # patch ufo2ft [BUG #110]
+ P1_FILE="$VENV_DIR/lib/python/site-packages/ufo2ft/outlineCompiler.py"
+ P1_BACKUP="$P1_FILE.orig"
+ if [[ ! -f "$P1_BACKUP" ]]; then
+ echo "Patching $P1_FILE (backup at $P1_BACKUP)"
+ mv "$P1_FILE" "$P1_BACKUP"
+ patch "$P1_BACKUP" -o "$P1_FILE" -u -i misc/ufo2ft-2.5.0-outlineCompiler.patch
fi
+
# ——————————————————————————————————————————————————————————————————
- # active primary env (Python 3)
+ # activate env (for rest of this script)
source "$VENV_DIR/bin/activate"
+
# ——————————————————————————————————————————————————————————————————
- # deps
+ # other toolchain dependencies
+
DEPS_DIR=$BUILD_DIR/deps
PATCH_DIR=$(pwd)/misc/patches
mkdir -p "$DEPS_DIR"
diff --git a/misc/fontbuild b/misc/fontbuild
index cf5d21f68..8b3e924fd 100755
--- a/misc/fontbuild
+++ b/misc/fontbuild
@@ -197,7 +197,16 @@ def setFontInfo(font, weight):
#
family = font.info.familyName # i.e. "Inter UI"
style = font.info.styleName # e.g. "Medium Italic"
- isitalic = font.info.italicAngle != 0
+
+ # Patch italicAngle to be either positive zero or single-decimal precision
+ # floating-point number.
+ # This value can go wrong since we are using floating-point numbers.
+ isitalic = False
+ if font.info.italicAngle != 0:
+ isitalic = True
+ font.info.italicAngle = round(font.info.italicAngle, 1)
+ else:
+ font.info.italicAngle = 0
# weight
font.info.openTypeOS2WeightClass = weight
diff --git a/misc/fontbuild2 b/misc/fontbuild2
deleted file mode 100755
index bece1063c..000000000
--- a/misc/fontbuild2
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-pushd "$(dirname "$0")/.." >/dev/null
-SRCDIR=$(PWD)
-popd >/dev/null
-
-"$SRCDIR/build/venv2/bin/python" misc/fontbuild "$@"
diff --git a/misc/ufo2ft-2.5.0-outlineCompiler.patch b/misc/ufo2ft-2.5.0-outlineCompiler.patch
new file mode 100644
index 000000000..dd500992c
--- /dev/null
+++ b/misc/ufo2ft-2.5.0-outlineCompiler.patch
@@ -0,0 +1,18 @@
+--- a/ufo2ft/outlineCompiler.py
++++ b/ufo2ft/outlineCompiler.py
+@@ -983,7 +983,14 @@
+ topDict.UnderlineThickness = otRound(underlineThickness)
+ # populate font matrix
+ unitsPerEm = otRound(getAttrWithFallback(info, "unitsPerEm"))
+- topDict.FontMatrix = [1.0 / unitsPerEm, 0, 0, 1.0 / unitsPerEm, 0, 0]
++ topDict.FontMatrix = [
++ round(1.0 / unitsPerEm, 14),
++ 0,
++ 0,
++ round(1.0 / unitsPerEm, 14),
++ 0,
++ 0
++ ]
+ # populate the width values
+ if not any(hasattr(info, attr) and getattr(info, attr) is not None
+ for attr in ("postscriptDefaultWidthX",
diff --git a/requirements2.txt b/requirements2.txt
deleted file mode 100644
index 44db5e3fd..000000000
--- a/requirements2.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# for secondry env (Python 2)
-# should match requirements.txt except from the "Python 2 specific" section.
-
-glyphsLib==3.1.4
-skia-pathops==0.2.0.post2
-fontmake==1.8.0
-fs==2.2.0
-
-# for fontTools/varLib/interpolatable.py
-numpy==1.15.4
-scipy==1.2.0
-munkres==1.0.12
-
-# Python 2 specific
-enum34==1.1.6
-typing==3.6.6
-backports.os==0.1.1