def create_traitsfont ( value ):
    if isinstance( value, wx.Font ):
        value = font_to_str( value )

    point_size = None
    family     = wx.DEFAULT
    style      = wx.NORMAL
    weight     = wx.NORMAL
    underline  = 0
    facename   = []
    for word in value.split():
        lword = word.lower()
        if font_families.has_key( lword ):
            family = font_families[ lword ]
        elif font_styles.has_key( lword ):
            style = font_styles[ lword ]
        elif font_weights.has_key( lword ):
            weight = font_weights[ lword ]
        elif lword == 'underline':
            underline = 1
        elif lword not in font_noise:
            if point_size is None:
                try:
                    point_size = int( lword )
                    continue
                except:
                    pass
            facename.append( word )
    return TraitsFont( point_size or 10, family, style, weight, underline,
                    ' '.join( facename ) )

#-------------------------------------------------------------------------------
#  'TraitsFont' class:
#-------------------------------------------------------------------------------
Create a TraitFont object from a string description.
dataset/ETHPy150Open enthought/traitsui/traitsui/wx/font_trait.py/create_traitsfont