docs: def to_glyphs_glyph(self, ufo_glyph, ufo_layer, master):
      """Add UFO glif metadata, paths, components, and anchors to a GSGlyph.
      If the matching GSGlyph does not exist, then it is created,
      else it is updated with the new data.
      In all cases, a matching GSLayer is created in the GSGlyph to hold paths.
      """
  
      # FIXME: (jany) split between glyph and layer attributes
      #        have a write the first time, compare the next times for glyph
      #        always write for the layer
  
      if ufo_glyph.name in self.font.glyphs:
          glyph = self.font.glyphs[ufo_glyph.name]
      else:
          glyph = self.glyphs_module.GSGlyph(name=ufo_glyph.name)
          # FIXME: (jany) ordering?
          self.font.glyphs.append(glyph)
  
      if ufo_glyph.unicodes:
          glyph.unicodes = ["{:04X}".format(c) for c in ufo_glyph.unicodes]
      glyph.note = ufo_glyph.note or ""
      if GLYPHLIB_PREFIX + "lastChange" in ufo_glyph.lib:
          last_change = ufo_glyph.lib[GLYPHLIB_PREFIX + "lastChange"]
          # We cannot be strict about the dateformat because it's not an official
          # UFO field mentioned in the spec so it could happen to have a timezone
          glyph.lastChange = from_loose_ufo_time(last_change)
      if ufo_glyph.markColor:
          glyph.color = _to_glyphs_color(ufo_glyph.markColor)
  
      # The export flag can be stored in the glyph's lib key (for upgrading legacy
      # sources) or the Designspace-level public.skipExportGlyphs lib key (canonical
      # place to store the information). The UFO level lib key is ignored.
      if GLYPHLIB_PREFIX + "Export" in ufo_glyph.lib:
          glyph.export = ufo_glyph.lib[GLYPHLIB_PREFIX + "Export"]
      if ufo_glyph.name in self.designspace.lib.get("public.skipExportGlyphs", []):
          glyph.export = False
  
      ps_names_key = PUBLIC_PREFIX + "postscriptNames"
      if (
          ps_names_key in ufo_glyph.font.lib
          and ufo_glyph.name in ufo_glyph.font.lib[ps_names_key]
      ):
          glyph.production = ufo_glyph.font.lib[ps_names_key][ufo_glyph.name]
          # FIXME: (jany) maybe put something in glyphinfo? No, it's readonly
          #        maybe don't write in glyph.production if glyphinfo already
          #        has something
          # glyphinfo = glyphsLib.glyphdata.get_glyph(ufo_glyph.name)
          # production_name = glyph.production or glyphinfo.production_name
  
      glyphinfo = glyphsLib.glyphdata.get_glyph(ufo_glyph.name)
  
      layer = self.to_glyphs_layer(ufo_layer, glyph, master)
  
      for key in ["leftMetricsKey", "rightMetricsKey", "widthMetricsKey"]:
          # Also read the old version of the key that didn't have a prefix and
          # store it on the layer (because without the "glyph"/"layer" prefix we
          # didn't know whether it originally came from the layer of the glyph,
          # so it's easier to put it back on the most specific level, i.e. the
          # layer)
          for prefix, glyphs_object in (
              ("glyph.", glyph),
              ("", layer),
              ("layer.", layer),
          ):
              full_key = GLYPHLIB_PREFIX + prefix + key
              if full_key in ufo_glyph.lib:
                  value = ufo_glyph.lib[full_key]
                  setattr(glyphs_object, key, value)
  
      if SCRIPT_LIB_KEY in ufo_glyph.lib:
          glyph.script = ufo_glyph.lib[SCRIPT_LIB_KEY]
  
      if GLYPHLIB_PREFIX + "category" in ufo_glyph.lib:
          # TODO: (jany) store category only if different from glyphinfo?
          category = ufo_glyph.lib[GLYPHLIB_PREFIX + "category"]
          glyph.category = category
      else:
          category = glyphinfo.category
      if GLYPHLIB_PREFIX + "subCategory" in ufo_glyph.lib:
          sub_category = ufo_glyph.lib[GLYPHLIB_PREFIX + "subCategory"]
          glyph.subCategory = sub_category
      else:
          sub_category = glyphinfo.subCategory
  
      # load width before background, which is loaded with lib data
      if hasattr(layer, "foreground"):
          if ufo_glyph.width:
              # Don't store "0", it's the default in UFO.
              # Store in userData because the background's width is not relevant
              # in Glyphs.
              layer.userData[BACKGROUND_WIDTH_KEY] = ufo_glyph.width
      else:
          layer.width = ufo_glyph.width
      if category == "Mark" and sub_category == "Nonspacing" and layer.width == 0:
          # Restore originalWidth
          if ORIGINAL_WIDTH_KEY in ufo_glyph.lib:
              layer.width = ufo_glyph.lib[ORIGINAL_WIDTH_KEY]
              # TODO: (jany) check for customParam DisableAllAutomaticBehaviour?
  
      self.to_glyphs_background_image(ufo_glyph, layer)
      self.to_glyphs_guidelines(ufo_glyph, layer)
      self.to_glyphs_annotations(ufo_glyph, layer)
      self.to_glyphs_hints(ufo_glyph, layer)
      self.to_glyphs_glyph_user_data(ufo_glyph.font, glyph)
      self.to_glyphs_layer_user_data(ufo_glyph, layer)
      self.to_glyphs_smart_component_axes(ufo_glyph, glyph)
  
      self.to_glyphs_paths(ufo_glyph, layer)
      self.to_glyphs_components(ufo_glyph, layer)
      self.to_glyphs_glyph_anchors(ufo_glyph, layer)