The FE 'Font Selector'
The FE Font Selector GUI ---
with a list of 'discovered' fonts
in the listbox on the left.
Larger, hi-res image is below.
! Note !
This description may be revised ---
if I ever significantly change this utility.
A HELP GUIDE FOR THE
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'.
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, 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).
Hence 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' (or 'UseIt') 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.]
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
shown using another instance of 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 monitor 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' :
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 --- one of the FE (Freedom Environment) systems.
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.
INVOCATION / IMPLEMENTATION
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.
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 --- and look for the string 'select_tkFont.tk', if he/she is interested.
Happy font browsing and font selection!
END OF GUIDE for the
Poke this image to see the
Font-Selector GUI in a different color 'palette'
--- in a separate browser window or tab.
(Changing the 'palette' of the Tk window
changes the color of ALL the widgets.)
Use of the FE Font Selector
The image above is of 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 'ColorMe' button
The Font-Selector GUI, like the 'xpg' GUI, has a 'Color' button, which when clicked invokes an FE RGB Color-Selector GUI.
That 'ColorMe' button is used to change the 'color palette' of the FE Font Selector GUI --- ALL of its widgets.
Tcl-Tk 8.5 (or higher) for
These screenshots were taken of Tk GUI's rendered with Tcl-Tk 8.4.
With Tcl-Tk 8.5 comes the possibility of rendering the Tk window (in particular, the fonts) with the 'Xft' anti-aliasing system on Linux.
Much nicer displays of fonts should be possible with Tcl-Tk 8.5 --- similar to the display quality seen with Linux font-viewing utilities such as 'gnome-specimen', 'gnome-font-viewer', and KDE 'fontmatrix'.
Bottom of this
FE = Freedom Environment
To return to a previously visited web page, click on the
Back button of your web browser a sufficient number of times.
OR, use a History-list option of your web browser.
Page was created 2010 Aug 29.