Next / Previous / Contents / Shipman's homepage

26. font(): Dictionary of font properties

See Section 4.20, “font(): Dictionary of font properties”.

fohelpers.py
# - - -   f o n t

fontArgMap = {
    'fontFamily': 'font-family',    'fontSize': 'font-size',
    'fontStyle': 'font-style',      'fontWeight': 'font-weight',
    'fontVariant': 'font-variant',  'fontStretch': 'font-stretch' }
def font(**kw):
    '''Return a dictionary of font properties.
    '''
    result = {}
    for key in kw:
        result[fontArgMap[key]] = kw[key]
    return result