Here is a screen shot of the widget as it appears in Section 4, “fontselector: A small test driver”.
These are the components of a
A scrollablewidget containing the names of all the font families such as Times, Courier, and so forth. The label above this widget advises the user to click to select a font family.
times 16 bold italic”.
Because not all fonts are available in all sizes,
this field will reflect the actual font closest to
the selected values, not the selected values
A Beware of fonts that make it difficult or impossible to tell all these characters apart!field that displays a few characters in the selected font. The user can add or edit text in this field. The initial contents are: zero, letter O, digit 1, lowercase letter l, capital letter I, and the vertical bar symbol “|”.
A text Enter or Tab in that field.field for the font size in pixels, and an accompanying labeled “Set” that applies the font size value. The user can also apply the font size by pressing
A push-pushto specify whether the font is boldfaced or not.
A push-pushto specify whether the font is italic or not.
In the author's opinion, the most obvious design tradeoff is in the size of the listbox of family names. At this writing, there were over sixty names.
Making the listbox larger makes life easier for the user, who can see more names at once, and needs to do less scrolling to see all the names.
On the other hand, this widget may be included in a larger application where space is at a premium.
The design shown above can be adapted to smaller or larger screen sizes by changing the size of the listbox. Accordingly, in the widget constructor, we will allow the user to specify that size (overriding some reasonable default).