# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."
# 
# GLYPHLIB_PREFIX = GLYPHS_PREFIX + "Glyphs."
# 
# PUBLIC_PREFIX = "public."
# 
# UFO2FT_FEATURE_WRITERS_KEY = "com.github.googlei18n.ufo2ft.featureWriters"
# 
# DEFAULT_FEATURE_WRITERS = [
#     {"class": "KernFeatureWriter", "options": {"mode": "append"}},
#     {"class": "MarkFeatureWriter", "options": {"mode": "skip"}},
# ]
# 
# DEFAULT_LAYER_NAME = PUBLIC_PREFIX + "default"


import os
import posixpath
from .constants import (
    GLYPHS_PREFIX,
    GLYPHLIB_PREFIX,
    PUBLIC_PREFIX,
    UFO2FT_FEATURE_WRITERS_KEY,
    DEFAULT_FEATURE_WRITERS,
    DEFAULT_LAYER_NAME,
)
        from glyphsLib.types import BinaryData
    if key in master.userData.keys():
        ufo_layer.lib.update(master.userData[key])
        if LAYER_NAME_KEY in ufo_layer.lib:
            layer_name = ufo_layer.lib.pop(LAYER_NAME_KEY)
            # ufoLib2
            if hasattr(ufo, "renameLayer") and callable(ufo.renameLayer):
                ufo.renameLayer(ufo_layer.name, layer_name)
            # defcon
            else:
                ufo_layer.name = layer_name


def to_ufo_layer_user_data(self, ufo_glyph, layer):
    user_data = layer.userData
    for key in user_data.keys():
        if _user_data_has_no_special_meaning(key):
            ufo_glyph.lib[key] = user_data[key]


def to_ufo_node_user_data(self, ufo_glyph, node, user_data: dict):
    if user_data:
        path_index, node_index = node._indices()
        key = f"{NODE_USER_DATA_KEY}.{path_index}.{node_index}"
        ufo_glyph.lib[key] = user_data


def to_glyphs_family_user_data_from_designspace(self):
    """Set the GSFont userData from the designspace family-wide lib data."""
    target_user_data = self.font.userData
    for key, value in self.designspace.lib.items():

# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."
# 
# GLYPHLIB_PREFIX = GLYPHS_PREFIX + "Glyphs."
# 
# PUBLIC_PREFIX = "public."
# 
# UFO2FT_FEATURE_WRITERS_KEY = "com.github.googlei18n.ufo2ft.featureWriters"
# 
# DEFAULT_FEATURE_WRITERS = [
#     {"class": "KernFeatureWriter", "options": {"mode": "append"}},
#     {"class": "MarkFeatureWriter", "options": {"mode": "skip"}},
# ]
# 
# DEFAULT_LAYER_NAME = PUBLIC_PREFIX + "default"


# Path: Lib/glyphsLib/builder/user_data.py
import os
import posixpath
from .constants import (
    GLYPHS_PREFIX,
    GLYPHLIB_PREFIX,
    PUBLIC_PREFIX,
    UFO2FT_FEATURE_WRITERS_KEY,
    DEFAULT_FEATURE_WRITERS,
    DEFAULT_LAYER_NAME,
)
        from glyphsLib.types import BinaryData

    if key in master.userData.keys():
        ufo_layer.lib.update(master.userData[key])
        if LAYER_NAME_KEY in ufo_layer.lib:
            layer_name = ufo_layer.lib.pop(LAYER_NAME_KEY)
            # ufoLib2
            if hasattr(ufo, "renameLayer") and callable(ufo.renameLayer):
                ufo.renameLayer(ufo_layer.name, layer_name)
            # defcon
            else:
                ufo_layer.name = layer_name


def to_ufo_layer_user_data(self, ufo_glyph, layer):
    user_data = layer.userData
    for key in user_data.keys():
        if _user_data_has_no_special_meaning(key):
            ufo_glyph.lib[key] = user_data[key]


def to_ufo_node_user_data(self, ufo_glyph, node, user_data: dict):
    if user_data:
        path_index, node_index = node._indices()
        key = f"{NODE_USER_DATA_KEY}.{path_index}.{node_index}"
        ufo_glyph.lib[key] = user_data


def to_glyphs_family_user_data_from_designspace(self):
    """Set the GSFont userData from the designspace family-wide lib data."""
    target_user_data = self.font.userData
    for key, value in self.designspace.lib.items():

        if key == UFO2FT_FEATURE_WRITERS_KEY and value == DEFAULT_FEATURE_WRITERS: