# Path: Lib/glyphsLib/builder/axes.py
# def font_uses_axis_locations(font):
#     # It's possible for fonts to have the 'Axes' parameter but to NOT specify
#     # the master locations using 'Axis Location', in which case we have to
#     # resort to using instances or other old tricks to get the mapping.
#     # https://github.com/googlefonts/glyphsLib/issues/409
#     # https://github.com/googlefonts/glyphsLib/issues/411
#     return font.axes and all(
#         master.customParameters["Axis Location"] for master in font.masters
#     )
# 
# def get_axis_definitions(font):
#     axesParameter = font.customParameters["Axes"]
#     if axesParameter is None:
#         return DEFAULT_AXES_DEFS
# 
#     factory = AxisDefinitionFactory()
#     return [factory.get(axis.get("Tag"), axis["Name"]) for axis in axesParameter]
# 
# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."
# 
# GLYPHLIB_PREFIX = GLYPHS_PREFIX + "Glyphs."
# 
# UFO_FILENAME_CUSTOM_PARAM = "UFO Filename"


import os
from .axes import font_uses_axis_locations, get_axis_definitions
from .constants import GLYPHS_PREFIX, GLYPHLIB_PREFIX, UFO_FILENAME_CUSTOM_PARAM
        if not any(
            k in custom_params for k in ("vheaVertLineGap", "vheaVertTypoLineGap")
        ):
            ufo.info.openTypeVheaVertTypoLineGap = font_upm

    self.to_ufo_blue_values(ufo, master)
    self.to_ufo_guidelines(ufo, master)
    self.to_ufo_master_user_data(ufo, master)
    # Note: master's custom parameters will be applied later on, after glyphs and
    # features have been generated (see UFOBuilder::masters method).

    master_id = master.id
    if self.minimize_glyphs_diffs:
        ufo.lib[MASTER_ID_LIB_KEY] = master_id


def to_glyphs_master_attributes(self, source, master):
    ufo = source.font

    # Glyphs ensures that the master ID is unique by simply making up a new one when
    # finding a duplicate.
    ufo_master_id_lib_key = ufo.lib.get(MASTER_ID_LIB_KEY)
    if ufo_master_id_lib_key and not self.font.masters[ufo_master_id_lib_key]:
        master.id = ufo_master_id_lib_key

    if source.filename is not None and self.minimize_ufo_diffs:
        master.customParameters[UFO_FILENAME_CUSTOM_PARAM] = source.filename
    elif ufo.path and self.minimize_ufo_diffs:
        # Don't be smart, we don't know where the UFOs come from so we can't make them
        # relative to anything.

# Path: Lib/glyphsLib/builder/axes.py
# def font_uses_axis_locations(font):
#     # It's possible for fonts to have the 'Axes' parameter but to NOT specify
#     # the master locations using 'Axis Location', in which case we have to
#     # resort to using instances or other old tricks to get the mapping.
#     # https://github.com/googlefonts/glyphsLib/issues/409
#     # https://github.com/googlefonts/glyphsLib/issues/411
#     return font.axes and all(
#         master.customParameters["Axis Location"] for master in font.masters
#     )
# 
# def get_axis_definitions(font):
#     axesParameter = font.customParameters["Axes"]
#     if axesParameter is None:
#         return DEFAULT_AXES_DEFS
# 
#     factory = AxisDefinitionFactory()
#     return [factory.get(axis.get("Tag"), axis["Name"]) for axis in axesParameter]
# 
# Path: Lib/glyphsLib/builder/constants.py
# GLYPHS_PREFIX = "com.schriftgestaltung."
# 
# GLYPHLIB_PREFIX = GLYPHS_PREFIX + "Glyphs."
# 
# UFO_FILENAME_CUSTOM_PARAM = "UFO Filename"


# Path: Lib/glyphsLib/builder/masters.py
import os
from .axes import font_uses_axis_locations, get_axis_definitions
from .constants import GLYPHS_PREFIX, GLYPHLIB_PREFIX, UFO_FILENAME_CUSTOM_PARAM

        if not any(
            k in custom_params for k in ("vheaVertLineGap", "vheaVertTypoLineGap")
        ):
            ufo.info.openTypeVheaVertTypoLineGap = font_upm

    self.to_ufo_blue_values(ufo, master)
    self.to_ufo_guidelines(ufo, master)
    self.to_ufo_master_user_data(ufo, master)
    # Note: master's custom parameters will be applied later on, after glyphs and
    # features have been generated (see UFOBuilder::masters method).

    master_id = master.id
    if self.minimize_glyphs_diffs:
        ufo.lib[MASTER_ID_LIB_KEY] = master_id


def to_glyphs_master_attributes(self, source, master):
    ufo = source.font

    # Glyphs ensures that the master ID is unique by simply making up a new one when
    # finding a duplicate.
    ufo_master_id_lib_key = ufo.lib.get(MASTER_ID_LIB_KEY)
    if ufo_master_id_lib_key and not self.font.masters[ufo_master_id_lib_key]:
        master.id = ufo_master_id_lib_key

    if source.filename is not None and self.minimize_ufo_diffs:
        master.customParameters[UFO_FILENAME_CUSTOM_PARAM] = source.filename
    elif ufo.path and self.minimize_ufo_diffs:
        # Don't be smart, we don't know where the UFOs come from so we can't make them
        # relative to anything.

        master.customParameters[UFO_FILENAME_CUSTOM_PARAM] = os.path.basename(ufo.path)