def input_from_name(self, name, features=None):
        """Given glyph name, return input to harbuzz to render this glyph in the
        form of a (features, text) tuple, where `features` is a list of feature
        tags to activate and `text` is an input string.
        """

        if features is None:
            features = []

        # see if this glyph has a simple unicode mapping
        if name in self.reverse_cmap:
            return features, unichr(self.reverse_cmap[name])

        # nope, check the substitution features
        if 'GSUB' not in self.font:
            return
        gsub = self.font['GSUB'].table
        for lookup_index, lookup in enumerate(gsub.LookupList.Lookup):
            for st in lookup.SubTable:

                # see if this glyph can be a single-glyph substitution
                if lookup.LookupType == 1:
                    for glyph, subst in st.mapping.items():
                        if subst == name:
                            return self._input_with_context(
                                gsub, glyph, lookup_index, features)

                # see if this glyph is a ligature
                elif lookup.LookupType == 4:
                    for prefix, ligatures in st.ligatures.items():
                        for ligature in ligatures:
                            if ligature.LigGlyph == name:
                                glyphs = [prefix] + ligature.Component
                                return self._sequence_from_glyph_names(
                                    glyphs, features)
dataset/ETHPy150Open googlei18n/nototools/nototools/hb_input.py/HbInputGenerator.input_from_name/original