def to_ufo_guidelines(self, ufo_obj, glyphs_obj):
    """Set guidelines."""
    guidelines = glyphs_obj.guides
    if not guidelines:
        return
    new_guidelines = []
    for guideline in guidelines:
        new_guideline = {}
        x, y = guideline.position
        angle = guideline.angle % 360
        if _is_vertical(x, y, angle):
            new_guideline["x"] = x
        elif _is_horizontal(x, y, angle):
            new_guideline["y"] = y
        else:
            new_guideline["x"] = x
            new_guideline["y"] = y
            new_guideline["angle"] = angle
        name = guideline.name
        if name is not None:
            # Identifier
            m = IDENTIFIER_NAME_RE.match(name)
            if m:
                new_guideline["identifier"] = m.group(2)
                name = name[: -len(m.group(1))]
            # Color
            m = COLOR_NAME_RE.match(name)
            if m:
                new_guideline["color"] = m.group(2)
                name = name[: -len(m.group(1))]
        if guideline.locked:
            name = (name or "") + LOCKED_NAME_SUFFIX
        if name:
            new_guideline["name"] = name
        new_guidelines.append(new_guideline)
    ufo_obj.guidelines = new_guidelines