export : define [createGsubLookupFromGr gsub glyphStore gr ignoreGr] : begin
	local mapping {.}
	foreach { gnSrc glyph } [glyphStore.namedEntries] : begin
		local gnDst : gr.get glyph
		local glyphDst : glyphStore.queryByName gnDst
		local fIgnore : ignoreGr && [ignoreGr.get glyph]
		if (!fIgnore && glyphDst) : set mapping.(gnSrc) gnDst

	return : gsub.createLookup {.type 'gsub_single' .substitutions mapping}

export : define [buildGrFeature gsub glyphStore gr ignoreGr] : begin
	local rec : gsub.beginBlock

	local lookup1 : createGsubLookupFromGr gsub glyphStore gr ignoreGr
	if [objectIsNotEmpty lookup1.substitutions] : begin
		define feature1 : gsub.addCommonFeature : gsub.createFeature gr.otlTag
		feature1.addLookup lookup1

	gsub.endBlock rec

define [objectIsNotEmpty obj] : obj && [Object.keys obj].length
