code: def _rename_glyphs_from_ufo(self):
          
          rename_map = self._build_production_names()
  
          otf = self.otf
          otf.setGlyphOrder([rename_map.get(n, n) for n in otf.getGlyphOrder()])
  
          # we need to compile format 2 'post' table so that the 'extraNames'
          # attribute is updated with the list of the names outside the
          # standard Macintosh glyph order; otherwise, if one dumps the font
          # to TTX directly before compiling first, the post table will not
          # contain the extraNames.
          if 'post' in otf and otf['post'].formatType == 2.0:
              otf['post'].compile(self.otf)
  
          if 'CFF ' in otf:
              cff = otf['CFF '].cff.topDictIndex[0]
              char_strings = cff.CharStrings.charStrings
              cff.CharStrings.charStrings = {
                  rename_map.get(n, n): v for n, v in char_strings.items()}
              cff.charset = [rename_map.get(n, n) for n in cff.charset]
docs: Rename glyphs using ufo.lib.public.postscriptNames in UFO.