# Path: Lib/glyphsLib/builder/glyph.py
# SCRIPT_LIB_KEY = GLYPHLIB_PREFIX + "script"
# ORIGINAL_WIDTH_KEY = GLYPHLIB_PREFIX + "originalWidth"
# BACKGROUND_WIDTH_KEY = GLYPHLIB_PREFIX + "backgroundWidth"
# def _clone_layer(layer, paths=None, components=None):
# def to_ufo_glyph(self, ufo_glyph, layer, glyph, do_color_layers=True):  # noqa: C901
# def to_glyphs_glyph(self, ufo_glyph, ufo_layer, master):  # noqa: C901
# def to_ufo_glyph_height_and_vertical_origin(self, ufo_glyph, layer):
# def _get_typo_ascender_descender(master):
# def to_ufo_glyph_background(self, glyph, layer):
# def _to_glyphs_color(color):
# def to_glyphs_glyph_height_and_vertical_origin(self, ufo_glyph, master, layer):


import re
from .glyph import BRACKET_GLYPH_RE
            kerning = self.font.kerning[kerning_source]
            _to_ufo_kerning(self, self._sources[master_id].font, kerning)


def _to_ufo_kerning(self, ufo, kerning_data):
    """Add .glyphs kerning to an UFO."""

    warning_msg = "Non-existent glyph class %s found in kerning rules."

    for left, pairs in kerning_data.items():
        match = re.match(r"@MMK_L_(.+)", left)
        left_is_class = bool(match)
        if left_is_class:
            left = "public.kern1.%s" % match.group(1)
            if left not in ufo.groups:
                self.logger.warning(warning_msg % left)
        for right, kerning_val in pairs.items():
            match = re.match(r"@MMK_R_(.+)", right)
            right_is_class = bool(match)
            if right_is_class:
                right = "public.kern2.%s" % match.group(1)
                if right not in ufo.groups:
                    self.logger.warning(warning_msg % right)
            ufo.kerning[left, right] = kerning_val


def to_glyphs_kerning(self):
    """Add UFO kerning to GSFont."""
    for master_id, source in self._sources.items():
        for (left, right), value in source.font.kerning.items():

# Path: Lib/glyphsLib/builder/glyph.py
# SCRIPT_LIB_KEY = GLYPHLIB_PREFIX + "script"
# ORIGINAL_WIDTH_KEY = GLYPHLIB_PREFIX + "originalWidth"
# BACKGROUND_WIDTH_KEY = GLYPHLIB_PREFIX + "backgroundWidth"
# def _clone_layer(layer, paths=None, components=None):
# def to_ufo_glyph(self, ufo_glyph, layer, glyph, do_color_layers=True):  # noqa: C901
# def to_glyphs_glyph(self, ufo_glyph, ufo_layer, master):  # noqa: C901
# def to_ufo_glyph_height_and_vertical_origin(self, ufo_glyph, layer):
# def _get_typo_ascender_descender(master):
# def to_ufo_glyph_background(self, glyph, layer):
# def _to_glyphs_color(color):
# def to_glyphs_glyph_height_and_vertical_origin(self, ufo_glyph, master, layer):


# Path: Lib/glyphsLib/builder/kerning.py
import re
from .glyph import BRACKET_GLYPH_RE

            kerning = self.font.kerning[kerning_source]
            _to_ufo_kerning(self, self._sources[master_id].font, kerning)


def _to_ufo_kerning(self, ufo, kerning_data):
    """Add .glyphs kerning to an UFO."""

    warning_msg = "Non-existent glyph class %s found in kerning rules."

    for left, pairs in kerning_data.items():
        match = re.match(r"@MMK_L_(.+)", left)
        left_is_class = bool(match)
        if left_is_class:
            left = "public.kern1.%s" % match.group(1)
            if left not in ufo.groups:
                self.logger.warning(warning_msg % left)
        for right, kerning_val in pairs.items():
            match = re.match(r"@MMK_R_(.+)", right)
            right_is_class = bool(match)
            if right_is_class:
                right = "public.kern2.%s" % match.group(1)
                if right not in ufo.groups:
                    self.logger.warning(warning_msg % right)
            ufo.kerning[left, right] = kerning_val


def to_glyphs_kerning(self):
    """Add UFO kerning to GSFont."""
    for master_id, source in self._sources.items():
        for (left, right), value in source.font.kerning.items():

            if BRACKET_GLYPH_RE.match(left) or BRACKET_GLYPH_RE.match(right):