def convert_fontsize(length, unit, base_font_size=16.0, dpi=96.0):
 if (unit == u'px'):
  return (length / base_font_size)
 pt_to_px = (dpi / 72.0)
 pt_to_rem = (pt_to_px / base_font_size)
 return ((length * length_factors.get(unit, 1)) * pt_to_rem)

def convert_fontsize ( length , unit , base_font_size = 16.0 , dpi = 96.0 ) : if ( unit == u'px' ) : return ( length / base_font_size ) pt_to_px = ( dpi / 72.0 ) pt_to_rem = ( pt_to_px / base_font_size ) return ( ( length * length_factors . get ( unit , 1 ) ) * pt_to_rem )
convert font size to rem so that font size scaling works .