docs: def to_ufo_glyph(self, ufo_glyph, layer, glyph):
      """Add .glyphs metadata, paths, components, and anchors to a glyph."""
      ufo_glyph.unicodes = [int(uval, 16) for uval in glyph.unicodes]
  
      note = glyph.note
      if note is not None:
          ufo_glyph.note = note
  
      last_change = glyph.lastChange
      if last_change is not None:
          ufo_glyph.lib[GLYPHLIB_PREFIX + "lastChange"] = to_ufo_time(last_change)
  
      color_index = glyph.color
      if color_index is not None:
          # .3f is enough precision to round-trip uint8 to float losslessly.
          # https://github.com/unified-font-object/ufo-spec/issues/61
          # #issuecomment-389759127
          if (
              isinstance(color_index, list)
              and len(color_index) == 4
              and all(0 <= v < 256 for v in color_index)
          ):
              ufo_glyph.markColor = ",".join(
                  "{:.3f}".format(v / 255) for v in color_index
              )
          elif isinstance(color_index, int) and color_index in range(len(GLYPHS_COLORS)):
              ufo_glyph.markColor = GLYPHS_COLORS[color_index]
          else:
              logger.warning(
                  "Glyph {}, layer {}: Invalid color index/tuple {}".format(
                      glyph.name, layer.name, color_index
                  )
              )
  
      export = glyph.export
      if not export:
          if "public.skipExportGlyphs" not in self._designspace.lib:
              self._designspace.lib["public.skipExportGlyphs"] = []
          self._designspace.lib["public.skipExportGlyphs"].append(glyph.name)
  
      # FIXME: (jany) next line should be an API of GSGlyph?
      glyphinfo = glyphsLib.glyphdata.get_glyph(ufo_glyph.name)
      production_name = glyph.production or glyphinfo.production_name
      if production_name != ufo_glyph.name:
          postscriptNamesKey = PUBLIC_PREFIX + "postscriptNames"
          if postscriptNamesKey not in ufo_glyph.font.lib:
              ufo_glyph.font.lib[postscriptNamesKey] = dict()
          ufo_glyph.font.lib[postscriptNamesKey][ufo_glyph.name] = production_name
  
      for key in ["leftMetricsKey", "rightMetricsKey", "widthMetricsKey"]:
          value = getattr(layer, key, None)
          if value:
              ufo_glyph.lib[GLYPHLIB_PREFIX + "layer." + key] = value
          value = getattr(glyph, key, None)
          if value:
              ufo_glyph.lib[GLYPHLIB_PREFIX + "glyph." + key] = value
  
      if glyph.script is not None:
          ufo_glyph.lib[SCRIPT_LIB_KEY] = glyph.script
  
      # if glyph contains custom 'category' and 'subCategory' overrides, store
      # them in the UFO glyph's lib
      category = glyph.category
      if category is None:
          category = glyphinfo.category
      else:
          ufo_glyph.lib[GLYPHLIB_PREFIX + "category"] = category
      subCategory = glyph.subCategory
      if subCategory is None:
          subCategory = glyphinfo.subCategory
      else:
          ufo_glyph.lib[GLYPHLIB_PREFIX + "subCategory"] = subCategory
  
      # load width before background, which is loaded with lib data
      width = layer.width
      if width is None:
          pass
      elif category == "Mark" and subCategory == "Nonspacing" and width > 0:
          # zero the width of Nonspacing Marks like Glyphs.app does on export
          # TODO: (jany) check for customParameter DisableAllAutomaticBehaviour
          # FIXME: (jany) also don't do that when rt UFO -> glyphs -> UFO
          ufo_glyph.lib[ORIGINAL_WIDTH_KEY] = width
          ufo_glyph.width = 0
      else:
          ufo_glyph.width = width
  
      self.to_ufo_background_image(ufo_glyph, layer)
      self.to_ufo_guidelines(ufo_glyph, layer)
      self.to_ufo_glyph_background(ufo_glyph, layer)
      self.to_ufo_annotations(ufo_glyph, layer)
      self.to_ufo_hints(ufo_glyph, layer)
      self.to_ufo_glyph_user_data(ufo_glyph.font, glyph)
      self.to_ufo_layer_user_data(ufo_glyph, layer)
      self.to_ufo_smart_component_axes(ufo_glyph, glyph)
  
      self.to_ufo_paths(ufo_glyph, layer)
      self.to_ufo_components(ufo_glyph, layer)
      self.to_ufo_glyph_anchors(ufo_glyph, layer.anchors)