|
14 | 14 | alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'}
|
15 | 15 | # Show family options
|
16 | 16 |
|
17 |
| -family = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] |
| 17 | +families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] |
18 | 18 |
|
19 | 19 | font1 = font0.copy()
|
20 | 20 | font1.set_size('large')
|
21 | 21 |
|
22 | 22 | t = text(-0.8, 0.9, 'family', fontproperties=font1,
|
23 | 23 | **alignment)
|
24 | 24 |
|
25 |
| -yp = [0.7, 0.5, 0.3, 0.1, -0.1, -0.3, -0.5] |
| 25 | +yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2] |
26 | 26 |
|
27 |
| -for k in range(5): |
| 27 | +for k, family in enumerate(families): |
28 | 28 | font = font0.copy()
|
29 |
| - font.set_family(family[k]) |
30 |
| - if k == 2: |
31 |
| - font.set_name('Script MT') |
32 |
| - t = text(-0.8, yp[k], family[k], fontproperties=font, |
| 29 | + font.set_family(family) |
| 30 | + t = text(-0.8, yp[k], family, fontproperties=font, |
33 | 31 | **alignment)
|
34 | 32 |
|
35 | 33 | # Show style options
|
36 | 34 |
|
37 |
| -style = ['normal', 'italic', 'oblique'] |
| 35 | +styles = ['normal', 'italic', 'oblique'] |
38 | 36 |
|
39 | 37 | t = text(-0.4, 0.9, 'style', fontproperties=font1,
|
40 | 38 | **alignment)
|
41 | 39 |
|
42 |
| -for k in range(3): |
| 40 | +for k, style in enumerate(styles): |
43 | 41 | font = font0.copy()
|
44 | 42 | font.set_family('sans-serif')
|
45 |
| - font.set_style(style[k]) |
46 |
| - t = text(-0.4, yp[k], style[k], fontproperties=font, |
| 43 | + font.set_style(style) |
| 44 | + t = text(-0.4, yp[k], style, fontproperties=font, |
47 | 45 | **alignment)
|
48 | 46 |
|
49 | 47 | # Show variant options
|
50 | 48 |
|
51 |
| -variant = ['normal', 'small-caps'] |
| 49 | +variants = ['normal', 'small-caps'] |
52 | 50 |
|
53 | 51 | t = text(0.0, 0.9, 'variant', fontproperties=font1,
|
54 | 52 | **alignment)
|
55 | 53 |
|
56 |
| -for k in range(2): |
| 54 | +for k, variant in enumerate(variants): |
57 | 55 | font = font0.copy()
|
58 | 56 | font.set_family('serif')
|
59 |
| - font.set_variant(variant[k]) |
60 |
| - t = text(0.0, yp[k], variant[k], fontproperties=font, |
| 57 | + font.set_variant(variant) |
| 58 | + t = text(0.0, yp[k], variant, fontproperties=font, |
61 | 59 | **alignment)
|
62 | 60 |
|
63 | 61 | # Show weight options
|
64 | 62 |
|
65 |
| -weight = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] |
| 63 | +weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] |
66 | 64 |
|
67 | 65 | t = text(0.4, 0.9, 'weight', fontproperties=font1,
|
68 | 66 | **alignment)
|
69 | 67 |
|
70 |
| -for k in range(7): |
| 68 | +for k, weight in enumerate(weights): |
71 | 69 | font = font0.copy()
|
72 |
| - font.set_weight(weight[k]) |
73 |
| - t = text(0.4, yp[k], weight[k], fontproperties=font, |
| 70 | + font.set_weight(weight) |
| 71 | + t = text(0.4, yp[k], weight, fontproperties=font, |
74 | 72 | **alignment)
|
75 | 73 |
|
76 | 74 | # Show size options
|
77 | 75 |
|
78 |
| -size = ['xx-small', 'x-small', 'small', 'medium', 'large', |
79 |
| - 'x-large', 'xx-large'] |
| 76 | +sizes = ['xx-small', 'x-small', 'small', 'medium', 'large', |
| 77 | + 'x-large', 'xx-large'] |
80 | 78 |
|
81 | 79 | t = text(0.8, 0.9, 'size', fontproperties=font1,
|
82 | 80 | **alignment)
|
83 | 81 |
|
84 |
| -for k in range(7): |
| 82 | +for k, size in enumerate(sizes): |
85 | 83 | font = font0.copy()
|
86 |
| - font.set_size(size[k]) |
87 |
| - t = text(0.8, yp[k], size[k], fontproperties=font, |
| 84 | + font.set_size(size) |
| 85 | + t = text(0.8, yp[k], size, fontproperties=font, |
88 | 86 | **alignment)
|
89 | 87 |
|
90 | 88 | # Show bold italic
|
|
93 | 91 | font.set_style('italic')
|
94 | 92 | font.set_weight('bold')
|
95 | 93 | font.set_size('x-small')
|
96 |
| -t = text(0, 0.1, 'bold italic', fontproperties=font, |
| 94 | +t = text(-0.4, 0.1, 'bold italic', fontproperties=font, |
97 | 95 | **alignment)
|
98 | 96 |
|
99 | 97 | font = font0.copy()
|
100 | 98 | font.set_style('italic')
|
101 | 99 | font.set_weight('bold')
|
102 | 100 | font.set_size('medium')
|
103 |
| -t = text(0, 0.2, 'bold italic', fontproperties=font, |
| 101 | +t = text(-0.4, 0.2, 'bold italic', fontproperties=font, |
104 | 102 | **alignment)
|
105 | 103 |
|
106 | 104 | font = font0.copy()
|
107 | 105 | font.set_style('italic')
|
108 | 106 | font.set_weight('bold')
|
109 | 107 | font.set_size('x-large')
|
110 |
| -t = text(0, 0.3, 'bold italic', fontproperties=font, |
| 108 | +t = text(-0.4, 0.3, 'bold italic', fontproperties=font, |
111 | 109 | **alignment)
|
112 | 110 |
|
113 | 111 | axis([-1, 1, 0, 1])
|
|
0 commit comments