[merge] Map GSUB/GPOS feature / lookup indices properly
diff --git a/Lib/fontTools/merge.py b/Lib/fontTools/merge.py
index 6f8c20f..c744108 100644
--- a/Lib/fontTools/merge.py
+++ b/Lib/fontTools/merge.py
@@ -362,7 +362,7 @@
 		l.LangSys.mapFeatures(featureMap)
 
 @_add_method(otTables.ScriptList)
-def mapFeatures(self, feature_indices):
+def mapFeatures(self, featureMap):
 	for s in self.ScriptRecord:
 		if not s or not s.Script: continue
 		s.Script.mapFeatures(featureMap)
@@ -537,20 +537,43 @@
 
 	def _preMerge(self, font):
 
-		return
 		GDEF = font.get('GDEF')
 		GSUB = font.get('GSUB')
 		GPOS = font.get('GPOS')
 
 		for t in [GSUB, GPOS]:
-			if not t or not t.table.LookupList or not t.table.FeatureList: continue
-			lookupMap = dict(enumerate(t.table.LookupList.Lookup))
-			t.table.FeatureList.mapLookups(lookupMap)
+			if not t: continue
 
+			if t.table.LookupList and t.table.FeatureList:
+				lookupMap = dict(enumerate(t.table.LookupList.Lookup))
+				t.table.FeatureList.mapLookups(lookupMap)
+
+			if t.table.FeatureList and t.table.ScriptList:
+				featureMap = dict(enumerate(t.table.FeatureList.FeatureRecord))
+				t.table.ScriptList.mapFeatures(featureMap)
+
+		# TODO GDEF/Lookup MarkFilteringSets
 		# TODO FeatureParams nameIDs
 
 	def _postMerge(self, font):
-		pass
+
+		GDEF = font.get('GDEF')
+		GSUB = font.get('GSUB')
+		GPOS = font.get('GPOS')
+
+		for t in [GSUB, GPOS]:
+			if not t: continue
+
+			if t.table.LookupList and t.table.FeatureList:
+				lookupMap = dict((v,i) for i,v in enumerate(t.table.LookupList.Lookup))
+				t.table.FeatureList.mapLookups(lookupMap)
+
+			if t.table.FeatureList and t.table.ScriptList:
+				featureMap = dict((v,i) for i,v in enumerate(t.table.FeatureList.FeatureRecord))
+				t.table.ScriptList.mapFeatures(featureMap)
+
+		# TODO GDEF/Lookup MarkFilteringSets
+		# TODO FeatureParams nameIDs
 
 
 class Logger(object):
diff --git a/Lib/fontTools/ttLib/tables/otBase.py b/Lib/fontTools/ttLib/tables/otBase.py
index 6a7a63b..ad1eb56 100644
--- a/Lib/fontTools/ttLib/tables/otBase.py
+++ b/Lib/fontTools/ttLib/tables/otBase.py
@@ -496,6 +496,9 @@
 
 class BaseTable(object):
 
+	def __hash__(self):
+		return id(self)
+
 	def __getattr__(self, attr):
 		reader = self.__dict__.get("reader")
 		if reader:
@@ -507,7 +510,6 @@
 
 		raise AttributeError(attr)
 
-
 	"""Generic base class for all OpenType (sub)tables."""
 	
 	def getConverters(self):