The FE 'Font Selector' GUI utility
a Description (a Guide)
(FE = Freedom Environment)
! Preliminary ! This description may be touched up or revised occasionally.
A HELP GUIDE FOR THE 'FE Font Selector' GUI UTILITY
of the FE (Freedom Environment) system
Written: 2010 aug 27
This HTML file is based on the text file
That text help file is shown via the 'Help' button
TABLE OF CONTENTS
INTRODUCTION to the 'FE Font Selector' utility :
The 'FE Font Selector' utility is a GUI (Graphical User Interface) mini-application that provides 'widgets' (listbox, checkbuttons, sample text area, action buttons) to help a user quickly
This utility is implemented via a Tcl-Tk script called 'select_tkFont.tk'. Hence, we sometimes refer to this utility as 'select_tkFont.tk' or simply 'select_tkFont' --- or more generically as the 'tkFontSelector' or the 'FE Font Selector' or simply the 'Font Selector'.
(Note: The quality of font display will be much better in Tcl-Tk 8.5 than in Tcl-Tk 8.4 --- because the Linux Xft anti-aliasing system is available in 8.5.)
FONT SPECIFICATIONS in the Tk GUI-making language
When specifying a font for a widget in a Tk GUI, the developer can specify the font by using (up to) six attributes.
The fastest way to indicate how these attributes are used is to simply show a single line of Tk code for assigning a font for the text in a widget, like a label or a button widget.
label .frame1.label2 -text "Hello world!" -font \ -family arial -size 12 -weight bold -slant italic
[The back-slash indicates the command continues on the next line.]
[In this example, since the specifiers '-underline 1' and '-overstrike 1' do not appear, it is assumed that underline and overstrike are not wanted.]
[In fact, if the 'bold' and 'italic' specifications are left off, it is as if '-weight normal' and '-slant roman' were specified. They are the defaults.]
In actual programming practice, since a GUI may have a lot of labels and buttons (and entry-fields and list-boxes and other widgets that can have text associated with them, including checkbuttons and radiobuttons), it is good practice to use a Tk 'font create' command to create a (temporary) fontname to be used to specify a common font for labels and/or buttons, say.
So the above example would become something like the following.
font create font4labsANDbutts -family arial -size 12 \ -weight bold -slant italic ... label .frame1.label2 -text "Hello world!" -font font4labsANDbutts
So there you have it --- the reason why the 'FE Font Selector' GUI has facilities for specifying a font via SIX widgets (8 actually) :
FEATURES of the 'FE Font Selector' utility
When the user selects any of the six basic attributes (or the units for the size attribute - an additional attribute), by a mouse click, the sample text area of the 'FE Font Selector' GUI immediately updates showing the sample text in a font with the currently specified font attributes.
The Buttons on the FE Font Selector :
If the user settles on a font he/she likes (for the application calling this GUI script), a click on the 'OK' button returns the font attributes to the application.
[The first application using this 'FE Font Selector' was the FE 'xpg' text browsing/searching/extract-all-matches GUI utility of the FE (Freedom Environment) system(s).]
In fact, a string like
-family arial -size -12 -weight bold -slant italic -underline 0 -overstrike 0
is returned to the application.
[A negative integer for size indicates units of 'pixels', rather than 'points'.
If a user is just 'browsing the fonts' with the 'Font Selector', he/she can simply click the 'Cancel' button.
[Clicking the 'Cancel' button returns an empty string to a calling application. The application can respond accordingly --- usually, by not changing a font or fonts in the application.]
[Note that this 'Font Selector' can also be used as a 'Font Browser'.]
A click on the 'Help' button shows a help text file --- the file [FE-install-dir]/helps/select_tkFont.hlp --- using the FE 'xpg' text-browser utility.
A click on the 'ColorMe' button brings up another FE Tk GUI --- an 'FE Color Selector' GUI --- by which the user may preview colors (via 3 slider bars, for red, green, blue). When the user clicks the OK/Accept button on that GUI, the color scheme (Tk 'palette') of the 'Font Selector' GUI is immediately changed according to the color shown in the 'Color Selector' GUI when the Ok/Accept button was clicked.
[One nice feature of this color change is that if the user selects a very dark color, all the text in the GUI is automatically changed from black to white --- for readability.]
The 'DwnWin' button :
If the user displays a really large font size, like 48 or 60 or 72 points, the display window will go to maximum size. This may 'hog' the whole screen.
To downsize the window quickly, the user can click on the 'DwnWin' button. At each click, the 'FE Font Selector' window will be decreased in size about 10%, in both the x and y dimensions. --- down to a minimum size of about 650x400 pixels.
If that reduction of the window is too much, the user can simply grab a corner or side of the window with the mouse, and stretch the window out to a desired amount.
In the future, the way the 'DwnWin' button works may be changed somewhat, if it appears that there is a better way to implement that function.
Or, if that function does not really seem to be necessary, and a better function for a button arise, the function of that button may be changed.
Note that another feature of the GUI, to help handle display of huge font sizes, is the horizontal and vertical scroll bars that were added to the text widget that displays the sample text.
SOME APPLICATIONS of the 'FE Font Selector' : (in 'xpg', for example)
The 'FE Font Selector' utility was originally written to be used to offer the user a way to reset the font of the text area on the GUI of the 'xpg' utility of the FE (Freedom Environment) system.
The 'xpg' utility is meant for general users --- and for application supporters and developers --- and for Linux system administrators --- to quickly browse/search/extract-and-show-all-matching-lines in text files --- such as
As an interesting side note (well, to me it's interesting), note that Tk GUI scripts can call each other. Example:
INVOCATION/IMPLEMENTATION of 'FE Font Selector' :
You can see an example of implementing the 'select_tkFont.tk' Tk script by looking at the source code for the Tk script 'shofil.tk' --- which is the 'guts' of the 'xpg' text browse/search/extract-all-matches utility of the FE (Freedom Environment) system.
To avoid getting too technical for this introductory guide, we do not reproduce the pertinent (several) lines of code here. We leave it to the reader to look at the 'shofil.tk' script, if he/she is interested.
Happy font browsing and font selection!
END OF GUIDE to the 'FE Font Selector' GUI utility
This is the Font-Selector GUI that is invoked when
the 'TxtFont' button on the 'xpg' GUI is clicked.
This is to change ONLY the font of the text widget, NOT the fonts
of the button, label, entry, and other widgets of the 'xpg' GUI.
The Font-Selector GUI, like the 'xpg' GUI, has a 'Color'
button, which when clicked invokes the FE Color-Selector GUI.
Click on this image to see the Font-Selector GUI in a different color 'palette'.
NOTE: These screenshots were taken of Tk GUIs rendered with Tcl-Tk 8.4.
With 8.5 comes the possibility of rendering the Tk window (in particular, the fonts)
with the Linux Xft anti-aliasing system. Much nicer displays of fonts
should be possible with Tcl-Tk 8.5 --- similar to the display quality
seen with gnome-specimen, gnome-font-viewer, and KDE fontmatrix.
Bottom of the 'FE Font Selector' utility Description page.
FE = Freedom Environment
To return to a previously visited web page, click on the
Page created 2010 Aug 29. Changed 2010 Aug 31.