# 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
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




MASTER_ID_LIB_KEY = GLYPHS_PREFIX + "fontMasterID"
UFO_FILENAME_KEY = GLYPHLIB_PREFIX + "ufoFilename"
UFO_YEAR_KEY = GLYPHLIB_PREFIX + "ufoYear"
UFO_NOTE_KEY = GLYPHLIB_PREFIX + "ufoNote"


def to_ufo_master_attributes(self, source, master):
    ufo = source.font
    ufo.info.ascender = master.ascender
    ufo.info.capHeight = master.capHeight

# 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

# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




MASTER_ID_LIB_KEY = GLYPHS_PREFIX + "fontMasterID"
UFO_FILENAME_KEY = GLYPHLIB_PREFIX + "ufoFilename"
UFO_YEAR_KEY = GLYPHLIB_PREFIX + "ufoYear"
UFO_NOTE_KEY = GLYPHLIB_PREFIX + "ufoNote"


def to_ufo_master_attributes(self, source, master):
    ufo = source.font
    ufo.info.ascender = master.ascender
    ufo.info.capHeight = master.capHeight

    ufo.info.descender = master.descender