Include a header file required for build on mac 10.4
[supercollider.git] / Help / GUI / GUI-Tools / SCFont.html
blob419eaecf96199e845729b254b3468d8d9adc743b
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
14 p.p5 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
18 p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
19 p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
24 p.p15 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #000000}
25 p.p16 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
26 p.p17 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #606060}
27 p.p18 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Arial; color: #606060}
28 p.p19 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica; color: #606060}
29 p.p20 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Marker Felt; color: #606060}
30 span.s1 {font: 18.0px Helvetica}
31 span.s2 {color: #2040df}
32 span.s3 {color: #2b3d9c}
33 span.s4 {color: #2946d8}
34 span.s5 {color: #0000bf}
35 span.s6 {color: #007300}
36 span.s7 {color: #000000}
37 span.s8 {color: #606060}
38 span.s9 {font: 9.0px Monaco}
39 span.s10 {font: 9.0px Monaco; color: #000000}
40 span.s11 {font: 9.0px Marker Felt}
41 span.Apple-tab-span {white-space:pre}
42 </style>
43 </head>
44 <body>
45 <p class="p1"><span class="s1"><b>SCFont<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a font object</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
46 <p class="p2"><br></p>
47 <p class="p1"><b>Inherits from: </b><a href="../../Core/Object.html"><span class="s2"><b>Object</b></span></a></p>
48 <p class="p3"><br></p>
49 <p class="p1">This is the object you pass to other gui objects to set their font name or size.<span class="Apple-converted-space"> </span></p>
50 <p class="p2"><br></p>
51 <p class="p4"><b>Creation / Class Methods</b></p>
52 <p class="p5"><br></p>
53 <p class="p6"><b><span class="Apple-tab-span"> </span>*new (name, size)</b></p>
54 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
55 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>name </b>- An instance of String. Must coincide with the name of a font on the system. See *<b>availableFonts</b></p>
56 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>size </b>- An Instance of Float.</p>
57 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
58 <p class="p9"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>g = <span class="s3">Font</span>.new("Helvetica", 12);</p>
59 <p class="p5"><br></p>
60 <p class="p6"><b><span class="Apple-tab-span"> </span>*availableFonts</b></p>
61 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
62 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns an array of the available fonts.</p>
63 <p class="p5"><br></p>
64 <p class="p6"><b><span class="Apple-tab-span"> </span>*antiAliasing_ (flag)</b></p>
65 <p class="p6"><b><span class="Apple-tab-span"> </span></b>.</p>
66 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>flag </b>- An instance of <a href="../../Core/Boolean.html"><span class="s4">Boolean</span></a>. Default value is false.</p>
67 <p class="p5"><br></p>
68 <p class="p6"><b><span class="Apple-tab-span"> </span>*smoothing_ (flag)</b></p>
69 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
70 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>flag </b>- An instance of <a href="../../Core/Boolean.html"><span class="s4">Boolean</span></a>. Default value is false.</p>
71 <p class="p7"><br></p>
72 <p class="p6"><b><span class="Apple-tab-span"> </span>*defaultSansFace</b></p>
73 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
74 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns the default sans face Font.</p>
75 <p class="p5"><br></p>
76 <p class="p6"><b><span class="Apple-tab-span"> </span>*defaultSerifFace</b></p>
77 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
78 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns the default serif face Font.</p>
79 <p class="p5"><br></p>
80 <p class="p5"><br></p>
81 <p class="p6"><b><span class="Apple-tab-span"> </span>*defaultMonoFace</b></p>
82 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
83 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns the default mono face Font.</p>
84 <p class="p5"><br></p>
85 <p class="p5"><br></p>
86 <p class="p10"><b>Accessing Instance and Class Variables</b></p>
87 <p class="p11"><br></p>
88 <p class="p6"><b><span class="Apple-tab-span"> </span>*default</b></p>
89 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
90 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Class Variable. Gets/sets the default Font.</p>
91 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
92 <p class="p6"><b><span class="Apple-tab-span"> </span>name_(arg1)</b></p>
93 <p class="p6"><b><span class="Apple-tab-span"> </span>name</b></p>
94 <p class="p7"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
95 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Gets/sets the name of a font.</p>
96 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 - </b>An instance of <a href="../../Collections/String.html"><span class="s4">String</span></a>.</p>
97 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
98 <p class="p6"><b><span class="Apple-tab-span"> </span>size_(arg1)</b></p>
99 <p class="p6"><b><span class="Apple-tab-span"> </span>size</b></p>
100 <p class="p7"><b><span class="Apple-tab-span"> </span></b><span class="Apple-tab-span"> </span></p>
101 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Gets/sets the size of a font.</p>
102 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>arg1 - </b>An instance of <a href="../../Math/Float.html"><span class="s4">Float</span></a>.</p>
103 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
104 <p class="p6"><b><span class="Apple-tab-span"> </span>setDefault</b></p>
105 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
106 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Makes the current instance of Font the <b>default</b>.</p>
107 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
108 <p class="p6"><b><span class="Apple-tab-span"> </span>storeArgs</b></p>
109 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
110 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Returns an Array, [ name, size ].</p>
111 <p class="p5"><br></p>
112 <p class="p6"><b><span class="Apple-tab-span"> </span>boldVariant</b></p>
113 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
114 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Appendes "-Bold" to the name. This is only useful for fonts that have bold variants.</p>
115 <p class="p5"><br></p>
116 <p class="p5"><br></p>
117 <p class="p10"><b>Examples</b></p>
118 <p class="p12"><br></p>
119 <p class="p13">(</p>
120 <p class="p13">w=<span class="s5">SCWindow</span>.new.front;</p>
121 <p class="p13">t=<span class="s5">SCStaticText</span>(w, w.view.bounds).align_(<span class="s6">\center</span>);</p>
122 <p class="p14"><span class="s7">t.string=</span>" SUPERCOLLIDER"<span class="s7">;</span></p>
123 <p class="p13">)</p>
124 <p class="p13">t.font=<span class="s5">Font</span>(<span class="s8">"Monaco"</span>, 24);</p>
125 <p class="p12"><br></p>
126 <p class="p12"><br></p>
127 <p class="p12"><br></p>
128 <p class="p13">(</p>
129 <p class="p13"><span class="s5">var</span> updateFont;</p>
130 <p class="p13">w=<span class="s5">SCWindow</span>(<span class="s8">"Fonts"</span>, <span class="s5">Rect</span>(150,<span class="s5">SCWindow</span>.screenBounds.height-500, 400,400)).front;</p>
131 <p class="p15">w.view.decorator = <span class="s5">FlowLayout</span>( w.view.bounds);</p>
132 <p class="p13"><span class="s5">SCStaticText</span>.new(w, <span class="s5">Rect</span>(5,0,30,20)).string_(<span class="s8">"Font"</span>).align_(<span class="s6">\rght</span>);</p>
133 <p class="p13">m=<span class="s5">SCPopUpMenu</span>(w, <span class="s5">Rect</span>(40,0,250,20));</p>
134 <p class="p13">m.items = <span class="s5">Font</span>.availableFonts;</p>
135 <p class="p12"><br></p>
136 <p class="p13"><span class="s5">SCStaticText</span>.new(w, <span class="s5">Rect</span>(290,0,28,20)).string_(<span class="s8">"Size"</span>).align_(<span class="s6">\right</span>);</p>
137 <p class="p13">y=<span class="s5">SCPopUpMenu</span>(w, <span class="s5">Rect</span>(322,0,50,20));</p>
138 <p class="p14"><span class="s7">y.items = [</span>"6"<span class="s7">,</span>"7"<span class="s7">,</span>"8"<span class="s7">,</span>"9"<span class="s7">,</span>"10"<span class="s7">,</span>"12"<span class="s7">,</span>"13"<span class="s7">,</span>"14"<span class="s7">,</span>"18"<span class="s7">,</span>"24"<span class="s7">,</span>"36"<span class="s7">,</span>"48"<span class="s7">,</span>"60"<span class="s7">,</span>"72"<span class="s7">,</span>"96"<span class="s7">];</span></p>
139 <p class="p12"><br></p>
140 <p class="p13">t=<span class="s5">SCTextView</span>(w, <span class="s5">Rect</span>(10,40,380,150));</p>
141 <p class="p14"><span class="s7">t.string=</span>"\nThe quick drowned fox jumped over the lazy blog. \n\n 0 1 2 3 4 5 6 7 8 9 "<span class="s7">;</span></p>
142 <p class="p12"><br></p>
143 <p class="p13">a=<span class="s5">SCStaticText</span>(w, 200@20).string_(<span class="s8">"The quick drowned fox"</span>).background_(<span class="s5">Color</span>.rand).align_(<span class="s6">\center</span>);</p>
144 <p class="p13">b=<span class="s5">SCButton</span>(w, 200@20).states_([[<span class="s8">"The quick drowned fox"</span>]]).background_(<span class="s5">Color</span>.rand);</p>
145 <p class="p13">c=<span class="s5">SCPopUpMenu</span>(w, 200@20).items_([<span class="s8">"The quick drowned fox"</span>]).background_(<span class="s5">Color</span>.rand);</p>
146 <p class="p12"><br></p>
147 <p class="p13">y.action={</p>
148 <p class="p13"><span class="Apple-tab-span"> </span><span class="s5">var</span> font;</p>
149 <p class="p13"><span class="Apple-tab-span"> </span>font= <span class="s5">Font</span>(m.items[m.value],y.items[y.value].asInteger);</p>
150 <p class="p13"><span class="Apple-tab-span"> </span>a.font_(font).refresh;</p>
151 <p class="p13"><span class="Apple-tab-span"> </span>b.font_(font).refresh;</p>
152 <p class="p13"><span class="Apple-tab-span"> </span>c.font_(font).refresh;</p>
153 <p class="p13"><span class="Apple-tab-span"> </span>t.font_(font).refresh;</p>
154 <p class="p13"><span class="Apple-tab-span"> </span>};</p>
155 <p class="p12"><br></p>
156 <p class="p13">m.action=y.action;</p>
157 <p class="p12"><br></p>
158 <p class="p13">m.valueAction=3;</p>
159 <p class="p13">y.valueAction=5;</p>
160 <p class="p12"><br></p>
161 <p class="p13">)</p>
162 <p class="p12"><br></p>
163 <p class="p12"><br></p>
164 <p class="p13">(</p>
165 <p class="p13"><span class="s5">var</span> w,f;</p>
166 <p class="p12"><br></p>
167 <p class="p13">w = <span class="s5">SCWindow</span>(<span class="s8">"Fonts"</span>, <span class="s5">Rect</span>(128, 64, 340, 360));</p>
168 <p class="p13">w.view.decorator = f = <span class="s5">FlowLayout</span>(w.view.bounds,<span class="s5">Point</span>(4,4),<span class="s5">Point</span>(4,2));</p>
169 <p class="p12"><br></p>
170 <p class="p16">[</p>
171 <p class="p17"><span class="s9">"</span><b>Helvetica-Bold</b><span class="s9">"</span><span class="s10">,</span></p>
172 <p class="p17"><span class="s9">"</span>Helvetica<span class="s9">"</span><span class="s10">,</span></p>
173 <p class="p14">"Monaco"<span class="s7">,</span></p>
174 <p class="p18"><span class="s9">"</span>Arial<span class="s9">"</span><span class="s10">,</span></p>
175 <p class="p19"><span class="s9">"</span>Gadget<span class="s9">"</span><span class="s10">,</span></p>
176 <p class="p20"><span class="s9">"</span>MarkerFelt-Thin<span class="s11">"</span></p>
177 <p class="p12"><br></p>
178 <p class="p13">].do({ <span class="s5">arg</span> name;</p>
179 <p class="p13"><span class="Apple-tab-span"> </span><span class="s5">var</span> v, s, n, spec, p, height = 16;</p>
180 <p class="p12"><br></p>
181 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v = <span class="s5">SCStaticText</span>(w, <span class="s5">Rect</span>(0, 0, 56, height+2));</p>
182 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v.font = <span class="s5">Font</span>(name, 13);</p>
183 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v.string = name;</p>
184 <p class="p12"><br></p>
185 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s = <span class="s5">SCButton</span>(w, <span class="s5">Rect</span>(0, 0, 140, height+2));</p>
186 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.font = <span class="s5">Font</span>(name, 13);</p>
187 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.states = [[name]];</p>
188 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
189 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n = <span class="s5">SCNumberBox</span>(w, <span class="s5">Rect</span>(0, 0, 56, height+2));</p>
190 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.font = <span class="s5">Font</span>(name, 13);</p>
191 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.object = pi;</p>
192 <p class="p12"><br></p>
193 <p class="p13"><span class="Apple-tab-span"> </span>f.nextLine;</p>
194 <p class="p13">});</p>
195 <p class="p12"><br></p>
196 <p class="p13">w.front;</p>
197 <p class="p12"><br></p>
198 <p class="p13">)</p>
199 <p class="p12"><br></p>
200 <p class="p12"><br></p>
201 <p class="p13">(</p>
202 <p class="p13"><span class="s5">var</span> w,f,i=0;</p>
203 <p class="p12"><br></p>
204 <p class="p13">w = <span class="s5">SCWindow</span>(<span class="s8">"Fonts"</span>, <span class="s5">Rect</span>(128, 64, 820, 760));</p>
205 <p class="p13">b = <span class="s5">SCScrollView</span>(w, w.view.bounds);</p>
206 <p class="p12"><br></p>
207 <p class="p13">b.decorator = f = <span class="s5">FlowLayout</span>(b.bounds,<span class="s5">Point</span>(4,4),<span class="s5">Point</span>(4,2));</p>
208 <p class="p12"><br></p>
209 <p class="p13"><span class="s5">Font</span>.availableFonts.do({ <span class="s5">arg</span> name;</p>
210 <p class="p13"><span class="Apple-tab-span"> </span><span class="s5">var</span> v, s, n, spec, p, height = 16,font;</p>
211 <p class="p13"><span class="Apple-tab-span"> </span>font = <span class="s5">Font</span>(name,13);</p>
212 <p class="p12"><span class="Apple-tab-span"> </span></p>
213 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v = <span class="s5">SCStaticText</span>(b, <span class="s5">Rect</span>(0, 0, 56, height+2));</p>
214 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v.font = font;</p>
215 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>v.string = name;</p>
216 <p class="p12"><br></p>
217 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s = <span class="s5">SCButton</span>(b, <span class="s5">Rect</span>(0, 0, 140, height+2));</p>
218 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.font = font;</p>
219 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.states = [[name]];</p>
220 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>s.action = { font.asCompileString.postln; };</p>
221 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
222 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n = <span class="s5">SCNumberBox</span>(b, <span class="s5">Rect</span>(0, 0, 56, height+2));</p>
223 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.font = font;</p>
224 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>n.object = pi;</p>
225 <p class="p13"><span class="Apple-tab-span"> </span>if( (i = i + 1) % 3 == 0,{</p>
226 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>f.nextLine;</p>
227 <p class="p13"><span class="Apple-tab-span"> </span>});</p>
228 <p class="p13">});</p>
229 <p class="p12"><br></p>
230 <p class="p13">w.front;</p>
231 <p class="p12"><br></p>
232 <p class="p13">)</p>
233 <p class="p12"><br></p>
234 <p class="p12"><br></p>
235 </body>
236 </html>