FontSelector
Copyright © 1997-1999 Marco Nelissen <marcone@xs4all.nl>
Requires liblayout to run.
(If you have SoundPlay installed, you already have
liblayout).
What is it?
FontSelector is an application that allows you to set the three system
default fonts, much like the 'Fonts' preference-application does.
The differences between Fonts and FontSelector are:
- FontSelector allows you to set the fontsize from 4 to 999, whereas Fonts
only goes from 9 to 12.
- FontSelector allows drag and drop of fonts. It uses Dianne Hackborn's excellent
FFont package for this.
- FontSelector does not allow you to change the font-cache sizes.
Supporting FontSelector in your application
Supporting the messages that FontSelector spews forth is easy. First you need
to download Dianne Hackborn's FFont package. It can be obtained from
her homepage.
Next, you need to know that all messages that FontSelector sends have the what
member set to !FNT (exclamation-FNT).
When the user clicks 'use', 'apply' or 'save' in FontSelector, it will broadcast
a BMessage containing three flattened fonts named be_plain_font, be_bold_font and
be_fixed_font, which contain the current plain, bold and fixed font settings.
When a BMessage is dropped onto your window, it contains only one of these, to
indicate the well that the font was dragged from. To make it easier for you, it
contains the same font again under the name "font".
To get at the font, you'd do something like:
BFont font;
FindMessageFont(mes, "font", 0, &font); // helper-function from FFont package
// use the font for whatever you like
That's all there is to it!
How you actually use the font is up to you. You may decide to ignore broadcasted
messages, and only respond to dropped messages, in which case you'll probably use
the font to change the appearance of some particular part of your application. Or you
may decide to honor the broadcasted messages as well, and update your entire GUI
to the new font-settings.
Copyright © 1997-1999 Marco Nelissen (marcone@xs4all.nl) All rights reserved.