# Path: Lib/glyphsLib/builder/constants.py
# PUBLIC_PREFIX = "public."
# 
# FONT_CUSTOM_PARAM_PREFIX = GLYPHS_PREFIX + "customParameter.GSFont."
# 
# GLYPHLIB_PREFIX = GLYPHS_PREFIX + "Glyphs."
# 
# Path: Lib/glyphsLib/builder/axes.py
# WEIGHT_AXIS_DEF = defaults_factory.get("wght", "Weight")
# 
# WIDTH_AXIS_DEF = defaults_factory.get("wdth", "Width")
# 
# def find_base_style(masters):
#     """Find a base style shared between all masters.
#     Return empty string if none is found.
#     """
#     if not masters:
#         return ""
#     base_style = (masters[0].name or "").split()
#     for master in masters:
#         style = master.name.split()
#         base_style = [s for s in style if s in base_style]
#     base_style = " ".join(base_style)
#     return base_style
# 
# def class_to_value(axis, ufo_class):
#     """
#     >>> class_to_value('wdth', 7)
#     125
#     """
#     if axis == "wght":
#         # 600.0 => 600, 250 => 250
#         return int(ufo_class)
#     elif axis == "wdth":
#         return WIDTH_CLASS_TO_VALUE[int(ufo_class)]
# 
#     raise NotImplementedError


from collections import OrderedDict, defaultdict
from functools import partial
from textwrap import dedent
from typing import Any, Dict
from fontTools import designspaceLib
from glyphsLib import classes, glyphdata, util
from .constants import (
    PUBLIC_PREFIX,
    FONT_CUSTOM_PARAM_PREFIX,
    GLYPHLIB_PREFIX,
)
from .axes import WEIGHT_AXIS_DEF, WIDTH_AXIS_DEF, find_base_style, class_to_value
            from io import BytesIO
    from .anchors import to_ufo_propagate_font_anchors, to_ufo_glyph_anchors
    from .annotations import to_ufo_annotations
    from .axes import to_designspace_axes
    from .background_image import to_ufo_background_image
    from .blue_values import to_ufo_blue_values
    from .color_layers import to_ufo_color_layers
    from .common import to_ufo_time
    from .components import to_ufo_components, to_ufo_smart_component_axes
    from .custom_params import to_ufo_custom_params
    from .features import regenerate_gdef, to_ufo_master_features
    from .font import to_ufo_font_attributes
    from .groups import to_ufo_groups
    from .guidelines import to_ufo_guidelines
    from .hints import to_ufo_hints
    from .instances import to_designspace_instances
    from .kerning import to_ufo_kerning
    from .layers import to_ufo_layer, to_ufo_background_layer, to_ufo_color_layer_names
    from .masters import to_ufo_master_attributes
    from .names import to_ufo_names
    from .paths import to_ufo_paths
    from .sources import to_designspace_sources
    from .glyph import (
        to_ufo_glyph,
        to_ufo_glyph_background,
        to_ufo_glyph_height_and_vertical_origin,
    )
    from .user_data import (
        to_designspace_family_user_data,
        to_ufo_family_user_data,
        to_ufo_master_user_data,
        to_ufo_glyph_user_data,
        to_ufo_layer_lib,
        to_ufo_layer_user_data,
        to_ufo_node_user_data,
    )
    from .anchors import to_glyphs_glyph_anchors
    from .annotations import to_glyphs_annotations
    from .axes import to_glyphs_axes
    from .background_image import to_glyphs_background_image
    from .blue_values import to_glyphs_blue_values
    from .components import to_glyphs_components, to_glyphs_smart_component_axes
    from .custom_params import to_glyphs_custom_params
    from .features import to_glyphs_features
    from .font import to_glyphs_font_attributes, to_glyphs_ordered_masters
    from .glyph import to_glyphs_glyph, to_glyphs_glyph_height_and_vertical_origin
    from .groups import to_glyphs_groups
    from .guidelines import to_glyphs_guidelines
    from .hints import to_glyphs_hints
    from .instances import to_glyphs_instances
    from .kerning import to_glyphs_kerning
    from .layers import to_glyphs_layer, to_glyphs_layer_order
    from .masters import to_glyphs_master_attributes
    from .names import to_glyphs_family_names, to_glyphs_master_names
    from .paths import to_glyphs_paths
    from .sources import to_glyphs_sources
    from .user_data import (
        to_glyphs_family_user_data_from_designspace,
        to_glyphs_family_user_data_from_ufo,
        to_glyphs_master_user_data,
        to_glyphs_glyph_user_data,
        to_glyphs_layer_lib,
        to_glyphs_layer_user_data,
        to_glyphs_node_user_data,
    )
import logging
import os
import re
            import ufoLib2 as ufo_module
                import ufoLib2 as ufo_module
# 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.





GLYPH_ORDER_KEY = PUBLIC_PREFIX + "glyphOrder"

BRACKET_GLYPH_TEMPLATE = "{glyph_name}.{rev}BRACKET.{location}"
REVERSE_BRACKET_LABEL = "REV_"
BRACKET_GLYPH_RE = re.compile(
    r"(?P<glyph_name>.+)\.(?P<rev>{})?BRACKET\.(?P<location>\d+)$".format(

# Path: Lib/glyphsLib/builder/constants.py
# PUBLIC_PREFIX = "public."
# 
# FONT_CUSTOM_PARAM_PREFIX = GLYPHS_PREFIX + "customParameter.GSFont."
# 
# GLYPHLIB_PREFIX = GLYPHS_PREFIX + "Glyphs."
# 
# Path: Lib/glyphsLib/builder/axes.py
# WEIGHT_AXIS_DEF = defaults_factory.get("wght", "Weight")
# 
# WIDTH_AXIS_DEF = defaults_factory.get("wdth", "Width")
# 
# def find_base_style(masters):
#     """Find a base style shared between all masters.
#     Return empty string if none is found.
#     """
#     if not masters:
#         return ""
#     base_style = (masters[0].name or "").split()
#     for master in masters:
#         style = master.name.split()
#         base_style = [s for s in style if s in base_style]
#     base_style = " ".join(base_style)
#     return base_style
# 
# def class_to_value(axis, ufo_class):
#     """
#     >>> class_to_value('wdth', 7)
#     125
#     """
#     if axis == "wght":
#         # 600.0 => 600, 250 => 250
#         return int(ufo_class)
#     elif axis == "wdth":
#         return WIDTH_CLASS_TO_VALUE[int(ufo_class)]
# 
#     raise NotImplementedError


# Path: Lib/glyphsLib/builder/builders.py
from collections import OrderedDict, defaultdict
from functools import partial
from textwrap import dedent
from typing import Any, Dict
from fontTools import designspaceLib
from glyphsLib import classes, glyphdata, util
from .constants import (
    PUBLIC_PREFIX,
    FONT_CUSTOM_PARAM_PREFIX,
    GLYPHLIB_PREFIX,
)
from .axes import WEIGHT_AXIS_DEF, WIDTH_AXIS_DEF, find_base_style, class_to_value
            from io import BytesIO
    from .anchors import to_ufo_propagate_font_anchors, to_ufo_glyph_anchors
    from .annotations import to_ufo_annotations
    from .axes import to_designspace_axes
    from .background_image import to_ufo_background_image
    from .blue_values import to_ufo_blue_values
    from .color_layers import to_ufo_color_layers
    from .common import to_ufo_time
    from .components import to_ufo_components, to_ufo_smart_component_axes
    from .custom_params import to_ufo_custom_params
    from .features import regenerate_gdef, to_ufo_master_features
    from .font import to_ufo_font_attributes
    from .groups import to_ufo_groups
    from .guidelines import to_ufo_guidelines
    from .hints import to_ufo_hints
    from .instances import to_designspace_instances
    from .kerning import to_ufo_kerning
    from .layers import to_ufo_layer, to_ufo_background_layer, to_ufo_color_layer_names
    from .masters import to_ufo_master_attributes
    from .names import to_ufo_names
    from .paths import to_ufo_paths
    from .sources import to_designspace_sources
    from .glyph import (
        to_ufo_glyph,
        to_ufo_glyph_background,
        to_ufo_glyph_height_and_vertical_origin,
    )
    from .user_data import (
        to_designspace_family_user_data,
        to_ufo_family_user_data,
        to_ufo_master_user_data,
        to_ufo_glyph_user_data,
        to_ufo_layer_lib,
        to_ufo_layer_user_data,
        to_ufo_node_user_data,
    )
    from .anchors import to_glyphs_glyph_anchors
    from .annotations import to_glyphs_annotations
    from .axes import to_glyphs_axes
    from .background_image import to_glyphs_background_image
    from .blue_values import to_glyphs_blue_values
    from .components import to_glyphs_components, to_glyphs_smart_component_axes
    from .custom_params import to_glyphs_custom_params
    from .features import to_glyphs_features
    from .font import to_glyphs_font_attributes, to_glyphs_ordered_masters
    from .glyph import to_glyphs_glyph, to_glyphs_glyph_height_and_vertical_origin
    from .groups import to_glyphs_groups
    from .guidelines import to_glyphs_guidelines
    from .hints import to_glyphs_hints
    from .instances import to_glyphs_instances
    from .kerning import to_glyphs_kerning
    from .layers import to_glyphs_layer, to_glyphs_layer_order
    from .masters import to_glyphs_master_attributes
    from .names import to_glyphs_family_names, to_glyphs_master_names
    from .paths import to_glyphs_paths
    from .sources import to_glyphs_sources
    from .user_data import (
        to_glyphs_family_user_data_from_designspace,
        to_glyphs_family_user_data_from_ufo,
        to_glyphs_master_user_data,
        to_glyphs_glyph_user_data,
        to_glyphs_layer_lib,
        to_glyphs_layer_user_data,
        to_glyphs_node_user_data,
    )
import logging
import os
import re
            import ufoLib2 as ufo_module
                import ufoLib2 as ufo_module

# 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.





GLYPH_ORDER_KEY = PUBLIC_PREFIX + "glyphOrder"

BRACKET_GLYPH_TEMPLATE = "{glyph_name}.{rev}BRACKET.{location}"
REVERSE_BRACKET_LABEL = "REV_"
BRACKET_GLYPH_RE = re.compile(
    r"(?P<glyph_name>.+)\.(?P<rev>{})?BRACKET\.(?P<location>\d+)$".format(

        REVERSE_BRACKET_LABEL