コード例 #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
コード例 #2
0
ファイル: style.py プロジェクト: kennym/itools
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
コード例 #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
コード例 #4
0
ファイル: style.py プロジェクト: kennym/itools
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