From 4846f9006f0fce5916a01f50656af0d669479497 Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Wed, 9 Sep 2015 16:57:29 +0200 Subject: [PATCH] [feaLib] Use fontTools wrapper class for otTable's GSUB/GPOS tables Resolves https://github.com/brawer/fonttools/commit/df740092d990e441550bf33fcd8bd15f5ae3dbc9#commitcomment-13138084 --- Lib/fontTools/feaLib/builder.py | 6 +- Lib/fontTools/feaLib/testdata/GSUB_3.ttx | 124 ++++----- .../feaLib/testdata/language_required.ttx | 248 ++++++++--------- Lib/fontTools/feaLib/testdata/spec4h1.ttx | 262 +++++++++--------- Lib/fontTools/feaLib/testdata/spec5d1.ttx | 124 ++++----- Lib/fontTools/feaLib/testdata/spec5d2.ttx | 116 ++++---- 6 files changed, 431 insertions(+), 449 deletions(-) diff --git a/Lib/fontTools/feaLib/builder.py b/Lib/fontTools/feaLib/builder.py index 4e7c27e68..745374bab 100644 --- a/Lib/fontTools/feaLib/builder.py +++ b/Lib/fontTools/feaLib/builder.py @@ -2,6 +2,7 @@ from __future__ import print_function, division, absolute_import from __future__ import unicode_literals from fontTools.feaLib.error import FeatureLibError from fontTools.feaLib.parser import Parser +from fontTools.ttLib import getTableClass from fontTools.ttLib.tables import otTables import warnings @@ -30,8 +31,9 @@ class Builder(object): def build(self): parsetree = Parser(self.featurefile_path).parse() parsetree.build(self) - self.gpos = self.font['GPOS'] = self.makeTable('GPOS') - self.gsub = self.font['GSUB'] = self.makeTable('GSUB') + for tag in ('GPOS', 'GSUB'): + fontTable = self.font[tag] = getTableClass(tag)() + fontTable.table = self.makeTable(tag) def get_lookup_(self, location, builder_class): if (self.cur_lookup_ and diff --git a/Lib/fontTools/feaLib/testdata/GSUB_3.ttx b/Lib/fontTools/feaLib/testdata/GSUB_3.ttx index 905d920f3..6e09715cb 100644 --- a/Lib/fontTools/feaLib/testdata/GSUB_3.ttx +++ b/Lib/fontTools/feaLib/testdata/GSUB_3.ttx @@ -2,73 +2,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + diff --git a/Lib/fontTools/feaLib/testdata/language_required.ttx b/Lib/fontTools/feaLib/testdata/language_required.ttx index d3447e222..8a366fc8f 100644 --- a/Lib/fontTools/feaLib/testdata/language_required.ttx +++ b/Lib/fontTools/feaLib/testdata/language_required.ttx @@ -2,135 +2,131 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + diff --git a/Lib/fontTools/feaLib/testdata/spec4h1.ttx b/Lib/fontTools/feaLib/testdata/spec4h1.ttx index cf16b833a..f3d97e80e 100644 --- a/Lib/fontTools/feaLib/testdata/spec4h1.ttx +++ b/Lib/fontTools/feaLib/testdata/spec4h1.ttx @@ -2,150 +2,146 @@ - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + diff --git a/Lib/fontTools/feaLib/testdata/spec5d1.ttx b/Lib/fontTools/feaLib/testdata/spec5d1.ttx index 001ab4bac..34ecbd346 100644 --- a/Lib/fontTools/feaLib/testdata/spec5d1.ttx +++ b/Lib/fontTools/feaLib/testdata/spec5d1.ttx @@ -2,73 +2,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + diff --git a/Lib/fontTools/feaLib/testdata/spec5d2.ttx b/Lib/fontTools/feaLib/testdata/spec5d2.ttx index f5cfa1090..a63b610a9 100644 --- a/Lib/fontTools/feaLib/testdata/spec5d2.ttx +++ b/Lib/fontTools/feaLib/testdata/spec5d2.ttx @@ -2,69 +2,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + +