From: Chris Barker
Kevin Altis wrote:
> This is part of the fix I want for wxFont. You should be able
to specify a
> font list like CSS (Garamond, Times, Times Roman) with a
font-family (serif,
> sansSerif, monospace, script, decorative) as a last resort.
<snip>
>there is currently no
> way in wxWindows to get a list of fonts based on family, nor is
there a way
> to determine the family given a face name, so I can't even wrap up the
> functionality.
Is there a way to do that on any platform other than X-windows?? If
you're going to support it in wxWindows, it needs to be supported by the
platforms it runs on.
Good question, but I don't know the answer. However, I believe I've been
thinking about this problem bass ackwards. wxFont currently requires the
point size, family, style, and weight to be specified at initialization.
Furthermore, I think the faceName which is an optional parameter, does
override the family. If a wrapped version of wxFont is used, like the Font
class in PythonCard, then the init method could check for the availablity of
the faceNames in the list before resorting to just using the family. The
subclass init could also take care of the default size. Hmm...
> On a related note, even if you use sizers, it seems that in order for a
> layout to be usable you need to be able to vary the font size based on a
> user setting. Different themes, screen resolutions on various
monitor sizes,
> etc. can make using a default size either too big or too small.
What is the default now? wouldn't it be the default that is currently
active in whatever toolkit is being used? That would mean that it would
use whatever theme is being used by GTK, and it would use"big fonts" or
"small fonts" on windows, depending on the user settings. Isn't that
exactly what you would want?
Maybe yes, maybe no. The default on Windows is 8 point if you haven't
changed the scheme, which is actually pretty small, but what is generally
used for dialogs, toolbars, and menus. Anyway, a lot of apps provide their
own settings independent of the system setting, so the user can choose a
default size and the font to use for different text styles. Sometimes, like
in the browser, the size is proportional: Smallest, Smaller, Medium, Larger,
Largest. In the case of IE you can also set the default text encoding.
Having a dialog and preference like this would be a nice addition to the
basic framework.
We probably need to try a number of different types of layout and see how
they look on various machines. We did a bit of this with PythonCard. I was
sort of waiting for wxPython Mac before coming up with a real solution.
On a related note, I am currently working on a UI, using wxDesigner, and
have found that the default button size is larger than I want. The
problem is that if I give the buttons a defined size in pixels, I have
no idea whether it will work on other platforms, with other fonts.
If I find out later that I have made the buttons too small, I'll have to
go it and change them all by hand, which would be a pain. Has anyone
come up with a nifty solution to this?
I think what I want is to set a size, but have the button stretch itself
if the text on it is too large for the size I have set. Is there any way
to do that??
If you use wxDefaultSize (-1, -1) for the size, then I believe it expands so
that the text fits with ample whitespace around the text. If you're using a
sizer, then the font and size would need to be set prior to adding the
control to the sizer or the minimum size is going to be messed up. If you
want less whitespace, then you probably need to do your own text extent
calculation and set the minimum size yourself.
I haven't used the sizing routines much inside a sizer control, so the above
info could be completely wrong. I defer to Robin...
ka