3 summary:: A font object
4 categories:: GUI>GUI-Tools
7 This is the object you pass to other gui objects to set their font name or size.
16 An instance of link::Classes/String::. Must coincide with the name of a font on the system. See link::#*availableFonts::.
18 An instance of link::Classes/Float::.
22 g = Font("Helvetica", 12);
25 method:: availableFonts
27 link::Classes/Array:: of the available fonts.
31 An instance of link::Classes/Boolean::. Default value is code::false::.
35 An instance of link::Classes/Boolean::. Default value is code::false::.
37 method:: defaultSansFace
39 The default sans serif face Font.
41 method:: defaultSerifFace
43 The default serif face Font.
45 method:: defaultMonoFace
47 The default monospace face Font.
50 Gets/sets the default Font.
53 Create a new sans serif face Font.
55 An instance of link::Classes/Float::.
58 Create a new monospace face Font.
60 An instance of link::Classes/Float::.
63 Create a new serif face Font.
65 An instance of link::Classes/Float::.
70 Gets/sets the name of a font.
72 An instance of link::Classes/String::.
75 Gets/sets the size of a font.
77 An instance of link::Classes/Float::.
80 Makes the current instance of Font the default.
84 Returns:: an link::Classes/Array::, code:: [ name, size ] ::.
88 note:: On the Cocoa GUI it appendes teletype::"-Bold":: to the name. This is only useful for fonts that have bold
92 Bold variant of the Font.
100 t = StaticText(w, w.view.bounds).align_(\center);
101 t.string=" SUPERCOLLIDER";
103 t.font = Font("Monaco", 24);
108 w = Window("Fonts", Rect(150, Window.screenBounds.height - 500, 400, 400)).front;
109 w.view.decorator = FlowLayout(w.view.bounds);
110 StaticText.new(w, Rect(5, 0, 30, 20)).string_("Font").align_(\rght);
111 m = PopUpMenu(w, Rect(40, 0, 250, 20));
112 m.items = Font.availableFonts;
114 StaticText.new(w, Rect(290, 0, 28, 20)).string_("Size").align_(\right);
115 y = PopUpMenu(w, Rect(322, 0, 50, 20));
116 y.items = ["6","7","8","9","10","12","13","14","18","24","36","48","60","72","96"];
118 t = TextView(w, Rect(10, 40, 380, 150));
119 t.string = "\nThe quick drowned fox jumped over the lazy blog. \n\n 0 1 2 3 4 5 6 7 8 9 ";
121 a = StaticText(w, 200@20).string_("The quick drowned fox").background_(Color.rand).align_(\center);
122 b = Button(w, 200@20).states_([["The quick drowned fox"]]).background_(Color.rand);
123 c = PopUpMenu(w, 200@20).items_(["The quick drowned fox"]).background_(Color.rand);
127 font = Font(m.items[m.value],y.items[y.value].asInteger);
128 a.font_(font).refresh;
129 b.font_(font).refresh;
130 c.font_(font).refresh;
131 t.font_(font).refresh;
144 w = Window("Fonts", Rect(128, 64, 340, 360));
145 w.view.decorator = f = FlowLayout(w.view.bounds,Point(4, 4),Point(4, 2));
155 var v, s, n, spec, p, height = 16;
157 v = StaticText(w, Rect(0, 0, 56, height + 2));
158 v.font = Font(name, 13);
161 s = Button(w, Rect(0, 0, 140, height + 2));
162 s.font = Font(name, 13);
165 n = NumberBox(w, Rect(0, 0, 56, height + 2));
166 n.font = Font(name, 13);
179 w = Window("Fonts", Rect(128, 64, 820, 760));
180 b = ScrollView(w, w.view.bounds);
182 b.decorator = f = FlowLayout(b.bounds, Point(4,4), Point(4,2));
184 Font.availableFonts.do({ arg name;
185 var v, s, n, spec, p, height = 16, font;
186 font = Font(name,13);
188 v = StaticText(b, Rect(0, 0, 56, height + 2));
192 s = Button(b, Rect(0, 0, 140, height + 2));
195 s.action = { font.asCompileString.postln; };
197 n = NumberBox(b, Rect(0, 0, 56, height + 2));
200 if( (i = i + 1) % 3 == 0,{