# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."


from .constants import GLYPHS_PREFIX
from glyphsLib.types import Point



LIB_KEY = GLYPHS_PREFIX + "hints"


def to_ufo_hints(self, ufo_glyph, layer):
    try:
        value = layer.hints
    except KeyError:
        return
    hints = []
    for hi in value:
        hint = {}
        for attr in ["horizontal", "options", "stem", "type"]:
            val = getattr(hi, attr, None)
            hint[attr] = val
        for attr in ["origin", "other1", "other2", "place", "scale", "target"]:
            val = getattr(hi, attr, None)
            if attr == "target" and val in ("up", "down"):
                hint[attr] = val
            elif val is not None and not any(v is None for v in val):
                hint[attr] = list(val)
        hints.append(hint)

    if hints:
        ufo_glyph.lib[LIB_KEY] = hints


def to_glyphs_hints(self, ufo_glyph, layer):

# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."


# Path: Lib/glyphsLib/builder/hints.py
from .constants import GLYPHS_PREFIX
from glyphsLib.types import Point




LIB_KEY = GLYPHS_PREFIX + "hints"


def to_ufo_hints(self, ufo_glyph, layer):
    try:
        value = layer.hints
    except KeyError:
        return
    hints = []
    for hi in value:
        hint = {}
        for attr in ["horizontal", "options", "stem", "type"]:
            val = getattr(hi, attr, None)
            hint[attr] = val
        for attr in ["origin", "other1", "other2", "place", "scale", "target"]:
            val = getattr(hi, attr, None)
            if attr == "target" and val in ("up", "down"):
                hint[attr] = val
            elif val is not None and not any(v is None for v in val):
                hint[attr] = list(val)
        hints.append(hint)

    if hints:
        ufo_glyph.lib[LIB_KEY] = hints


def to_glyphs_hints(self, ufo_glyph, layer):

    if LIB_KEY not in ufo_glyph.lib: