aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/varLib/featureVars.py
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2021-01-25 19:23:39 -0800
committerHaibo Huang <hhb@google.com>2021-01-26 12:43:36 -0800
commitf8d82f7a26154921102824802b7c16b9ac722f85 (patch)
tree7e436bb43355218e783d501f0bd394bb9a19bc24 /Lib/fontTools/varLib/featureVars.py
parente7b287f76cb1898590bcccd533663f6e5830b24b (diff)
downloadfonttools-f8d82f7a26154921102824802b7c16b9ac722f85.tar.gz
Upgrade fonttools to 4.19.0
Test: make Change-Id: I94aa7732ede5deb42a281dd99302c2e3140af4a4
Diffstat (limited to 'Lib/fontTools/varLib/featureVars.py')
-rw-r--r--Lib/fontTools/varLib/featureVars.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/fontTools/varLib/featureVars.py b/Lib/fontTools/varLib/featureVars.py
index 76e8cc4a..45f3d839 100644
--- a/Lib/fontTools/varLib/featureVars.py
+++ b/Lib/fontTools/varLib/featureVars.py
@@ -10,7 +10,7 @@ from fontTools.ttLib.tables import otTables as ot
from fontTools.otlLib.builder import buildLookup, buildSingleSubstSubtable
from collections import OrderedDict
-from .errors import VarLibValidationError
+from .errors import VarLibError, VarLibValidationError
def addFeatureVariations(font, conditionalSubstitutions, featureTag='rvrn'):
@@ -298,6 +298,11 @@ def addFeatureVariationsRaw(font, conditionalSubstitutions, featureTag='rvrn'):
varFeatureIndex = gsub.FeatureList.FeatureRecord.index(varFeature)
for scriptRecord in gsub.ScriptList.ScriptRecord:
+ if scriptRecord.Script.DefaultLangSys is None:
+ raise VarLibError(
+ "Feature variations require that the script "
+ f"'{scriptRecord.ScriptTag}' defines a default language system."
+ )
langSystems = [lsr.LangSys for lsr in scriptRecord.Script.LangSysRecord]
for langSys in [scriptRecord.Script.DefaultLangSys] + langSystems:
langSys.FeatureIndex.append(varFeatureIndex)