

@ensure_tag(['p'])
def get_font_size(p, styles_dict):
    w_namespace = get_namespace(p, 'w')
    r = p.find(('%sr' % w_namespace))
    if (r is None):
        return None
    rpr = r.find(('%srPr' % w_namespace))
    if (rpr is None):
        return None
    size = rpr.find(('%ssz' % w_namespace))
    if (size is None):
        pPr = p.find(('%spPr' % w_namespace))
        if (pPr is None):
            return None
        pStyle = pPr.find(('%spStyle' % w_namespace))
        if (pStyle is None):
            return None
        pStyle = pStyle.get(('%sval' % w_namespace))
        font_size = None
        style_value = styles_dict.get(pStyle, None)
        if (style_value is None):
            return None
        if ('font_size' in style_value):
            font_size = styles_dict[pStyle]['font_size']
        while (font_size is None):
            old_pStyle = pStyle
            if (pStyle not in styles_dict):
                break
            if ('based_on' not in styles_dict[pStyle]):
                break
            pStyle = styles_dict[pStyle]['based_on']
            if (old_pStyle == pStyle):
                break
            if (pStyle not in styles_dict):
                break
            font_size = rpr[pStyle]['font_size']
        return font_size
    return size.get(('%sval' % w_namespace))

dataset/ETHPy150Open PolicyStat/docx2html/docx2html/core.py get_font_size/VarMisuse@295/426 `styles_dict`->`rpr`