'Make sure all fonts are embeddable. Also remove some fonts that causes problems.'

def process_fonts(self):

    from calibre.ebooks.oeb.base import urlnormalize
    from calibre.utils.fonts.utils import remove_embed_restriction
    processed = set()
    for item in list(self.oeb.manifest):
        if (not hasattr(item.data, 'cssRules')):
            continue
        for (i, rule) in enumerate(item.data.cssRules):
            if (rule.type == rule.FONT_FACE_RULE):
                try:
                    s = rule.style
                    src = s.getProperty('src').propertyValue[0].uri
                except:
                    continue
                path = item.abshref(src)
                ff = self.oeb.manifest.hrefs.get(urlnormalize(path), None)
                if (ff is None):
                    continue
                raw = nraw = ff.data
                if (path not in processed):
                    processed.add(path)
                    try:
                        nraw = remove_embed_restriction(raw)
                    except:
                        continue
                    if (nraw != raw):
                        ff.data = nraw
                        self.oeb.container.write(path, nraw)
            elif (iswindows and (rule.type == rule.STYLE_RULE)):
                from tinycss.fonts3 import parse_font_family, serialize_font_family
                s = rule.style
                f = s.getProperty(u'font-family')
                if (f is not None):
                    font_families = parse_font_family(f.propertyValue.cssText)
                    ff = [x for x in font_families if (x.lower() != u'courier')]
                    if (len(ff) != len(font_families)):
                        if ('courier' not in self.filtered_font_warnings):
                            self.filtered_font_warnings.add(u'courier')
                            self.log.warn(u'Removing    courier    font    family    as    it    does    not    render    on    windows')
                        f.propertyValue.cssText = serialize_font_family((ff or [u'monospace']))
