On Wed, 13 Dec 2006 12:23:34 +0200
"George Birbilis" <[EMAIL PROTECTED]> wrote:
> > > I'm not an font expert, so I don't know, what properties
> > are needed by
> > > TFont to make it cross platform (if this is possible).
> >
> > I have to agree, that it is quite difficult to handle fonts
> > on multiple platforms. fpGUI handles this in a very
> > rudimentary way doing some basic mapping.
> >
> > TGfxFontClass = (fcSerif, fcSansSerif, fcTypewriter, fcDingbats);
Only enums?
How can a user define a font not in the enums?
> >
> > Querying the font based in any of these 4 font classes, will
> > work fine cross-platform. Specifying a specific font will
> > not be 100% cross-platform.
> >
> > ... Each platform will implement how the font class maps to a font.
> > Here is the X11 code ...
> >
> > class function TX11Font.GetDefaultFontName(const AFontClass:
> > TGfxFontClass): String;
> > const
> > FontNames: array[TGfxFontClass] of String = (
> > 'times', 'bitstream vera sans', 'courier', 'symbol'); begin
> > Result := FontNames[AFontClass];
> > end;
> >
> >
> > Fonts seem to be a tricky thing to handle. I haven't looked
> > yet, but anybody know how Qt handles this on multiple platforms?
>
> What I need to do is
> 1) get list of available font names (this seems to already be done by
> the TFont property editor used at the Object Inspector)
Yes. This can be quite slow.
> 2) create onwer drawn drop-down list (instead of the standard one
> used now at Tfont property editor)
Easy. See the TColorPropertyEditor for an example.
> 3) when dropdown list / combobox calls me back to draw an item (it
> should do that not for all its items, but only for the visible ones
> if it's good dd list implementation), I'll do:
AFAIK this is the case the gtk and the win32 interface.
> 3.1) given that item text (which is a font name), and a font size
> (say 8 [whatever size the rest of the OI text uses at that time -
> maybe this is an IDE option?]),
Nah. The IDE uses the current theme. The text size on a button can be
different than the title or the size in a TMemo or TLabel.
> measure the text with that font and
> size the item or the whole list (if dd list supports changing its
> dropdown size to fit the biggest item or in generally be wider than
> the edit box / label that is placed above the dropdown [recent dd
> lists in Windows GUI seem to do that, but not sure if they're the
> classic combobox windows control or other new impl by MS])
Resizing the combobox dropdown works under gtk not very well, but it
works.
> 3.2) draw the item (will result in cropping it if at 3.1 no resize of
> list was done)
>
> For 3.1 & 3.2 I could use an autosizing TLabel (is it
> cross-platform?) I suppose if TFont class doesn't have measure method
No. Just use the Canvas methods to measure and paint the font name.
> Will also need to look the Tcolor property editor to do how it does
> the owner-drawn dropdown list
Mattias
P.S.: Can you tell your virus scanner to write less spam?
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives