def atFontFace(self, declarations):
        """
        Embed fonts
        """
        result = self.ruleset([self.selector('*')], declarations)
        data = list(result[0].values())[0]
        if "src" not in data:
            # invalid - source is required, ignore this specification
            return {}, {}
        names = data["font-family"]

        # Font weight
        fweight = str(data.get("font-weight", "normal")).lower()
        bold = fweight in ("bold", "bolder", "500", "600", "700", "800", "900")
        if not bold and fweight != "normal":
            log.warn(
                self.c.warning("@fontface, unknown value font-weight '%s'", fweight))

        # Font style
        italic = str(
            data.get("font-style", "")).lower() in ("italic", "oblique")

        # The "src" attribute can be a CSS group but in that case
        # ignore everything except the font URI
        uri = data['src']
        if not isinstance(data['src'], str):
            for part in uri:
                if isinstance(part, str):
                    uri = part
                    break

        src = self.c.getFile(uri, relative=self.c.cssParser.rootPath)
        self.c.loadFont(
            names,
            src,
            bold=bold,
            italic=italic)
        return {}, {}
Embed fonts