Ejemplo n.º 1
0
def p_font_style(key, value, context):
    style_attr = {}
    if key == 'font-family':
        style_attr['fontName'] = get_font_name(value)
    elif key == 'font-style':
        if value in ('italic', 'oblique'):
            context.style_tag_stack.append(('i'))
        elif value != 'normal':
            print '(WW) font-style not valid'
    elif key == 'font-size':
        style_attr['fontSize'] = font_value(value)
    elif key == 'font-weight':
        if len(value):
            if value[0].isalpha() and value in ('bold', 'bolder'):
                context.style_tag_stack.append(('b'))
            elif not get_int_value(value, 400) < 700:
                context.style_tag_stack.append(('b'))
    return style_attr
Ejemplo n.º 2
0
def p_font_style(key, value, context):
    style_attr = {}
    if key == 'font-family':
        style_attr['fontName'] = get_font_name(value)
    elif key == 'font-style':
        if value in ('italic', 'oblique'):
            context.style_tag_stack.append(('i'))
        elif value != 'normal':
            print '(WW) font-style not valid'
    elif key == 'font-size':
        style_attr['fontSize'] = font_value(value)
    elif key == 'font-weight':
        if len(value):
            if value[0].isalpha() and value in ('bold', 'bolder'):
                context.style_tag_stack.append(('b'))
            elif not get_int_value(value, 400) < 700:
                context.style_tag_stack.append(('b'))
    return style_attr
Ejemplo n.º 3
0
def inline_font_style(key, value, context):
    style = None
    if key == 'font-family':
        style = ('span', {(None, 'fontName'): get_font_name(value)})
    elif key == 'font-style':
        if value in ('italic', 'oblique'):
            style = ('i', {})
        elif value != 'normal':
            print '(WW) font-style not valid'
    elif key == 'font-size':
        style = ('span', {(None, 'fontSize'): font_value(value)})
    elif key == 'font-weight':
        if len(value):
            if value[0].isalpha() and value in ('bold', 'bolder'):
                style = ('b', {})
            elif not get_int_value(value, 400) < 700:
                style = ('b', {})
    return style
Ejemplo n.º 4
0
def inline_font_style(key, value, context):
    style = None
    if key == 'font-family':
        style = ('span', {(None, 'fontName'): get_font_name(value)})
    elif key == 'font-style':
        if value in ('italic', 'oblique'):
            style = ('i', {})
        elif value != 'normal':
            print '(WW) font-style not valid'
    elif key == 'font-size':
        style = ('span', {(None, 'fontSize'): font_value(value)})
    elif key == 'font-weight':
        if len(value):
            if value[0].isalpha() and value in ('bold', 'bolder'):
                style = ('b', {})
            elif not get_int_value(value, 400) < 700:
                style = ('b', {})
    return style