diff --git a/examples/pylab_examples/fonts_demo.py b/examples/pylab_examples/fonts_demo.py index 002eed72b850..a49ca221057b 100644 --- a/examples/pylab_examples/fonts_demo.py +++ b/examples/pylab_examples/fonts_demo.py @@ -14,7 +14,7 @@ alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} # Show family options -family = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] +families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] font1 = font0.copy() font1.set_size('large') @@ -22,69 +22,67 @@ t = text(-0.8, 0.9, 'family', fontproperties=font1, **alignment) -yp = [0.7, 0.5, 0.3, 0.1, -0.1, -0.3, -0.5] +yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] -for k in range(5): +for k, family in enumerate(families): font = font0.copy() - font.set_family(family[k]) - if k == 2: - font.set_name('Script MT') - t = text(-0.8, yp[k], family[k], fontproperties=font, + font.set_family(family) + t = text(-0.8, yp[k], family, fontproperties=font, **alignment) # Show style options -style = ['normal', 'italic', 'oblique'] +styles = ['normal', 'italic', 'oblique'] t = text(-0.4, 0.9, 'style', fontproperties=font1, **alignment) -for k in range(3): +for k, style in enumerate(styles): font = font0.copy() font.set_family('sans-serif') - font.set_style(style[k]) - t = text(-0.4, yp[k], style[k], fontproperties=font, + font.set_style(style) + t = text(-0.4, yp[k], style, fontproperties=font, **alignment) # Show variant options -variant = ['normal', 'small-caps'] +variants = ['normal', 'small-caps'] t = text(0.0, 0.9, 'variant', fontproperties=font1, **alignment) -for k in range(2): +for k, variant in enumerate(variants): font = font0.copy() font.set_family('serif') - font.set_variant(variant[k]) - t = text(0.0, yp[k], variant[k], fontproperties=font, + font.set_variant(variant) + t = text(0.0, yp[k], variant, fontproperties=font, **alignment) # Show weight options -weight = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] +weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] t = text(0.4, 0.9, 'weight', fontproperties=font1, **alignment) -for k in range(7): +for k, weight in enumerate(weights): font = font0.copy() - font.set_weight(weight[k]) - t = text(0.4, yp[k], weight[k], fontproperties=font, + font.set_weight(weight) + t = text(0.4, yp[k], weight, fontproperties=font, **alignment) # Show size options -size = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] +sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', + 'x-large', 'xx-large'] t = text(0.8, 0.9, 'size', fontproperties=font1, **alignment) -for k in range(7): +for k, size in enumerate(sizes): font = font0.copy() - font.set_size(size[k]) - t = text(0.8, yp[k], size[k], fontproperties=font, + font.set_size(size) + t = text(0.8, yp[k], size, fontproperties=font, **alignment) # Show bold italic @@ -93,21 +91,21 @@ font.set_style('italic') font.set_weight('bold') font.set_size('x-small') -t = text(0, 0.1, 'bold italic', fontproperties=font, +t = text(-0.4, 0.1, 'bold italic', fontproperties=font, **alignment) font = font0.copy() font.set_style('italic') font.set_weight('bold') font.set_size('medium') -t = text(0, 0.2, 'bold italic', fontproperties=font, +t = text(-0.4, 0.2, 'bold italic', fontproperties=font, **alignment) font = font0.copy() font.set_style('italic') font.set_weight('bold') font.set_size('x-large') -t = text(0, 0.3, 'bold italic', fontproperties=font, +t = text(-0.4, 0.3, 'bold italic', fontproperties=font, **alignment) axis([-1, 1, 0, 1]) diff --git a/examples/pylab_examples/fonts_demo_kw.py b/examples/pylab_examples/fonts_demo_kw.py index d29e0edcc8dc..08c49abc85cf 100644 --- a/examples/pylab_examples/fonts_demo_kw.py +++ b/examples/pylab_examples/fonts_demo_kw.py @@ -12,61 +12,57 @@ # Show family options -family = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] +families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] t = text(-0.8, 0.9, 'family', size='large', **alignment) -yp = [0.7, 0.5, 0.3, 0.1, -0.1, -0.3, -0.5] +yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] -for k in range(5): - if k == 2: - t = text(-0.8, yp[k], family[k], family=family[k], - name='Script MT', **alignment) - else: - t = text(-0.8, yp[k], family[k], family=family[k], **alignment) +for k, family in enumerate(families): + t = text(-0.8, yp[k], family, family=family, **alignment) # Show style options -style = ['normal', 'italic', 'oblique'] +styles = ['normal', 'italic', 'oblique'] t = text(-0.4, 0.9, 'style', **alignment) -for k in range(3): - t = text(-0.4, yp[k], style[k], family='sans-serif', style=style[k], +for k, style in enumerate(styles): + t = text(-0.4, yp[k], style, family='sans-serif', style=style, **alignment) # Show variant options -variant = ['normal', 'small-caps'] +variants = ['normal', 'small-caps'] t = text(0.0, 0.9, 'variant', **alignment) -for k in range(2): - t = text(0.0, yp[k], variant[k], family='serif', variant=variant[k], +for k, variant in enumerate(variants): + t = text(0.0, yp[k], variant, family='serif', variant=variant, **alignment) # Show weight options -weight = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] +weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] t = text(0.4, 0.9, 'weight', **alignment) -for k in range(7): - t = text(0.4, yp[k], weight[k], weight=weight[k], +for k, weight in enumerate(weights): + t = text(0.4, yp[k], weight, weight=weight, **alignment) # Show size options -size = ['xx-small', 'x-small', 'small', 'medium', 'large', - 'x-large', 'xx-large'] +sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', + 'x-large', 'xx-large'] t = text(0.8, 0.9, 'size', **alignment) -for k in range(7): - t = text(0.8, yp[k], size[k], size=size[k], +for k, size in enumerate(sizes): + t = text(0.8, yp[k], size, size=size, **alignment) -x = 0 +x = -0.4 # Show bold italic t = text(x, 0.1, 'bold italic', style='italic', weight='bold', size='x-small', diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 6193f02386f4..67724f1e4c01 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -541,9 +541,10 @@ def __call__(self, s): 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif'], validate_stringlist], 'font.cursive': [['Apple Chancery', 'Textile', 'Zapf Chancery', - 'Sand', 'cursive'], validate_stringlist], + 'Sand', 'Script MT', 'cursive'], validate_stringlist], 'font.fantasy': [['Comic Sans MS', 'Chicago', 'Charcoal', 'Impact' - 'Western', 'fantasy'], validate_stringlist], + 'Western', 'Humor Sans', 'fantasy'], + validate_stringlist], 'font.monospace': [['Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace'], diff --git a/matplotlibrc.template b/matplotlibrc.template index 3fceeff5c7f9..89529327f4b6 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -149,8 +149,8 @@ backend : %(backend)s #font.size : 12.0 #font.serif : Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif #font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif -#font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive -#font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western, fantasy +#font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, cursive +#font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western, Humor Sans, fantasy #font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace ### TEXT