def find_font_face_rules(sheet, oeb):
 ans = []
 try:
  rules = sheet.data.cssRules
 except AttributeError:
  rules = sheet.cssRules
 for (i, rule) in enumerate(rules):
  if (rule.type != rule.FONT_FACE_RULE):
   continue
  props = get_font_properties(rule, default=u'normal')
  if ((not props[u'font-family']) or (not props[u'src'])):
   continue
  try:
   path = sheet.abshref(props[u'src'])
  except AttributeError:
   path = props[u'src']
  ff = oeb.manifest.hrefs.get(urlnormalize(path), None)
  if (not ff):
   continue
  props[u'item'] = ff
  if (props[u'font-weight'] in {u'bolder', u'lighter'}):
   props[u'font-weight'] = u'400'
  props[u'weight'] = int(props[u'font-weight'])
  props[u'rule'] = rule
  props[u'chars'] = set()
  ans.append(props)
 return ans

def find_font_face_rules ( sheet , oeb ) : ans = [ ] try : rules = sheet . data . cssRules except AttributeError : rules = sheet . cssRules for ( i , rule ) in enumerate ( rules ) : if ( rule . type != rule . FONT_FACE_RULE ) : continue props = get_font_properties ( rule , default = u'normal' ) if ( ( not props [ u'font-family' ] ) or ( not props [ u'src' ] ) ) : continue try : path = sheet . abshref ( props [ u'src' ] ) except AttributeError : path = props [ u'src' ] ff = oeb . manifest . hrefs . get ( urlnormalize ( path ) , None ) if ( not ff ) : continue props [ u'item' ] = ff if ( props [ u'font-weight' ] in { u'bolder' , u'lighter' } ) : props [ u'font-weight' ] = u'400' props [ u'weight' ] = int ( props [ u'font-weight' ] ) props [ u'rule' ] = rule props [ u'chars' ] = set ( ) ans . append ( props ) return ans
find all @font-face rules in the given sheet and extract the relevant info from them .