1XmFontSelector(3X) XmFontSelector(3X)
2
3
4
6 The Font Selector widget
7
9 #include <Xm/FontS.h>
10
12 The Font Selector widget allows users to easily choose a font by
13 selecting the font family and size of the font. The bold and italic
14 attributes may also be set for any font for which they are available.
15 Any font may be passed to the font selector by the application as the
16 initial value shown to the user. Advanced features greatly extend the
17 widget's functionality.
18
20 The font selector widget presents the user with two combination box
21 widgets, one with a list of choices for the font family, and the other
22 with the choices for the font size. In addition there are two indepen‐
23 dent toggle buttons that allow the user to make the font bold or italic
24 or bold/italic. Below the font choice area is a text widget that dis‐
25 plays sample text of the chosen font to the user. This text area is
26 editable, allowing the user to add or remove text to see how various
27 characters appear in the chosen font. For the novice user this set of
28 features allows access to all standard fonts on the system. The font
29 selector dynamically removes choices that are inappropriate so the user
30 is free to play around with different combinations and can always be
31 assured that once they have selected a font that it will exist on the
32 machine that the font selector is running on. For example if there is
33 no Times Roman 14 point font available, and the user selects a point
34 size of 14, then Times Roman will not be available in the family combi‐
35 nation box. Likewise, if the user had chosen Times Roman from the fam‐
36 ily dialog box then a size of 14 would not be shown. To have all
37 choices available simply choose a size and family of Any.
38
40 For the advanced user the font selector provides tremendous flexibility
41 in font choices. By activating the options button an additional panel
42 of controls is presented to the user. This allows the user to gain
43 access to non-XLFD fonts, control the resolutions of the fonts chosen,
44 choose from fixed or proportional fonts only, remove the use of font
45 scaling, allow non iso8859-1 fonts to be viewed, and see the XLFD name
46 the font selector is constructing.
47
49 By choosing the "Other Fonts" toggle from the option panel, the family
50 and size lists, as well as the bold and italic toggles, are replaced
51 with a combo box containing all non-XLFD fonts available on your sys‐
52 tem. This feature allows users to select non-XLFD fonts with the FontS‐
53 elector. The text field of the combination box may be edited by the
54 user and any string entered will be interpreted as a font name. It
55 should be noted that XLFD names can be typed in by hand here. This fea‐
56 ture allows the font selector to be used to get any font on the entire
57 system.
58
60 The font selector finds which of the two standard resolutions the cur‐
61 rent display is closest to and uses that as its default. To allow a
62 wider range of choices a user may choose to access fonts of a different
63 resolution, or both 75 and 100 dpi resolutions.
64
66 In most cases the fact that a font is fixed width or proportional is of
67 no great interest to the user. But some applications require a fixed
68 width font, such as terminal emulators, and most people find that pro‐
69 portional fonts look better. The Font selector allows users to limit
70 the font choices to fixed width or proportional or to allow both.
71
73 The font scaling technology that is available in X11R5 uses bitmap
74 scaling which, although useful in some cases, generally results in very
75 ugly fonts. We noticed that users often wanted to know which fonts are
76 scaled and which ones exist as hand crafted bitmaps. To remove the
77 scaled fonts from the list of choices, toggle the "Use Font Scaling"
78 button off. This value is resource controllable and defaults to on,
79 which uses font scaling.
80
82 The programmer can specify which encidings are valid selctions. These
83 encoding choices appear in an option menu. The list of font choices is
84 restricted to those which use the current selected coding.
85
87 Clicking the Show toggle displays the current font's XLFD name is shown
88 at the bottom of the font selector.
89
91 Name Class Type InitialValue
92 100DPIstring 100DPIString XmString "100 dpi"
93 75DPIstring 75DPIString XmString "75 dpi"
94 anyLowerString AnyLowerString XmString "any"
95 anyString AnyString XmString "Any"
96 boldString BoldString XmString "Bold"
97 bothString BothString XmString "Both"
98 currentFont String String NULL
99 defaultEncodingString DefaultEncodingString String "iso8859-1"
100 encodingList EncodingList StringTable "iso8859-1"
101 encodingString EncodingString XmString "Encoding"
102 familyString BothString XmString "Family"
103 italicString ItalicString XmString "Italic"
104 marginHeight Margin Dimension 0
105 monoSpaceString MonoSpaceString XmString "Fixed Width
106 Fonts"
107 optionString OptionString XmString "Options ..."
108 otherString OtherString XmString "Other Fonts"
109 propSpaceString PropSpaceString XmString "Proportional
110 Fonts"
111 sampleText SampleText XmString "abcdef..."
112 scalingString ScalingString XmString "Use Font
113 Scaling"
114 showFontName ShowFontName Boolean False
115 showNameString ShowNameString XmString "Show Font
116 Name"
117 sizeString SizeString XmSring "Size"
118 spacing Spacing Dimension 2
119 textRows TextRows Dimension 8
120 useScaling Boolean Boolean True
121 valueChangedCallback Callback XtCallbackList NULL
122 xlfdString XlfdString XmString "Xlfd Fonts"
123
124 All resource names begin with XmN and all resource class names begin
125 with XmC.
126
128 The label for the 100 DPI radio button.
129
131 The label for the 75 DPI radio button.
132
134 The label for the any button.
135
137 The label for the Any button.
138
140 The label for the Bold toggle button.
141
143 The labels for the Both radio buttons controlling both the dpi and
144 width of the fonts displayed. The same resource is used to ensure con‐
145 sistent labels.
146
148 This resource provides the main application input and output to the
149 font selector. If the programmer sets the value at creation time or
150 with XtSetValues then the currently displayed family, size, bold and
151 italic will be changed to correspond to the values shown in the current
152 font. Otherwise, the name of the font will be shown. The Font Selec‐
153 tor's mode will be set to correspond to the type of font passed.
154
155 Note: currentFont must contain 14 hyphens (-) to be considered an XLFD
156 font. This resource is also used to retrieve the font the user has
157 selected from the font selector. The value returned is only valid until
158 the next time XtGetValues is called on this instance of the font selec‐
159 tor widget.
160
162 This resource is the default selection from the Encoding options menu.
163
165 This resource is the list of encodings available from the FontSelector
166 Encoding options menu.
167
169 This resource is the default selection from the Encoding options menu.
170
172 This resource is the default selection from the Family options menu.
173
175 This resource controls and maintains the state of the iso8859-1 fonts
176 only toggle button.
177
179 This resource is the default selection from the Italic toggle button.
180
182 The margin height for all subwidgets of the Font Selector.
183
185 The label of the Fixed Width Fonts radio button.
186
188 The label for the Options... push button.
189
191 The label for the Other Fonts radio button.
192
194 The label for the Proportional Fonts radio button.
195
197 The string which appears in the sample text area.
198
200 The label for the Use Font Scaling toggle button.
201
203 This boolean resource controls and maintains the state of Show Font
204 Name toggle button.
205
207 The label of the Show Font Name toggle button.
208
210 The label for the Size option menu.
211
213 The space between the toggle indicator and the toggle label.
214
216 This resource controls the number of rows that are shown in the text
217 widget that displays sample text in the currently selected font. Since
218 this is a scrolled text widget it will never dynamically change size,
219 regardless of the font displayed. Unless the initial font is large
220 this value should be at least 4 or the user interaction may be poor.
221
223 This resource controls and maintains the state of the Use Font Scaling
224 toggle button.
225
227 The list of callbacks called when the XmNcurrentFont value is changed.
228
230 The label for the Xlfd Fonts radio button.
231
233
234
235
236
238 Widget XmCreateFontSelector(
239 Widget parent, /* Widget id of parent for FontSelector */
240 String name, /* Name of the created widget */
241 ArgList args, /* argument list */
242 Cardinal num_args /* number of items in argument list */
243 )
244
245
247 The font selector is composed of many sub-widgets. As with all widgets,
248 most values passed to this widget through the argument list at cre‐
249 ation time or via set values are passed to each of this widget's chil‐
250 dren. Get values requests must be made on a child by child basis. The
251 children of the font selector are listed below. The documentation for
252 each of the children should be consulted for a list of resources for
253 each child.
254
255 XiFontSelector<named by application>
256
257 XiPanedtopPane
258
259 XmComboBoxfamilies
260
261 < See XmComboBox for list of children >
262
263 XmSeparatorseparator
264
265 XiComboBoxsizes
266
267 < See XmComboBox for list of children >
268
269 XmSeparatorseparator
270
271 XmButtonBoxboldItalicBox
272
273 XmToggleButtonboldButton
274
275 XmToggleButtonitalicButton
276
277 XmSeparatorseparator
278
279 XmToggleButtonoptionButton
280
281 XmSeparatorseparator
282
283 XmPanedmiddlePane
284
285 XmPanedleftPane
286
287 XmButtonBoxchoiceBox
288
289 XmToggleButtonxlfdButton
290
291 XmToggleButtonotherButton
292
293 XmSeparatorseparator
294
295 XmButtonBoxresolutionBox
296
297 XmToggleButtondpi75Button
298
299 XmToggleButtondpi100Button
300
301 XmToggleButtonanyButton
302
303 XmSeparatorseparator
304
305 XmSeparatorseparator
306
307 XmButtonBoxspacingBox
308
309 XmToggleButtonproportionalButton
310
311 XmToggleButtonmonoButton
312
313 XmToggleButtonbothButton
314
315 XmSeparatorseparator
316
317 XmButtonBoxotherChoiceBox
318
319 XmToggleButtonscalingButton
320
321 XmToggleButtonisoButton
322
323 XmToggleButtonshowNameButton
324
325 XmRowColum encodingOptionMenu
326
327 XmLabelGadget OptionLabel
328
329 XmCascadeButtonGadget OptionButton
330
331 XmMenuShell menuShell
332
333 XmRowColum pulldownMenu
334
335 <dependent on XmNencoding>
336
337 XmSeparatorseparator
338
339 XmSeparatorseparator
340
341 XmButtonBoxbox
342
343 XmScrolledWindowtextSW
344
345 XmScrollBarvbar
346
347 XmTexttext
348
349 XmSeparatorseparator
350
351 XmLabelnameLabel
352
353 XmSeparatorseparator
354
356 Copyright (c) 1992 by Integrated Computer Solutions, Inc.
357
358
359
360 XmFontSelector(3X)