On Thu, 14 Dec 2006 10:28:01 +0200
"George Birbilis" <[EMAIL PROTECTED]> wrote:
> >> > 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.
>
> I'll try to do it once at creation, instead of at each update (I hope
> the Object Inspector doesn't recreate the property editors at each
> refresh, does it?),
Not at every update, but frequently.
> a thing is though if I could hook into the system
> to get notification for new fonts added (maybe even Windows doesn't
> provide such [unless possibly one asks for a shell filesystem change
> notification for the windows fonts folder - assuming one can ask the
> system where that "folder" is, if it's not just some virtual folder
> view in explorer as afaik I think it is])
>
> > > > > 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?
>
> Maybe one can just say what font family they want there? A bit limited
> indeed
>
> > > 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.
>
> I guess I can return immediately for items that our out of view (the
> dropdown list should have a property saying how many items the
> drop-down list shows I suppose) myself (will have to add a test check
> to see if they callme back to draw each item [they might be calling
> me back the first time to measure each item to make the dropdown list
> have enough width to fit all items in case the user scrolls in it,
> but I might heuristically decide to return the length of the biggest
> fontname times some fixed value - since the biggest length is the one
> when you type something in monospace style])
>
> > > 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.
>
> I'd expect the IDE options to also allow setting (or overriding the
> system defaults) the font size for the IDE
>
> > > 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.
>
> Depends on how complex it will be, could instead copy the canvas of
> that label into the ownerdrawn item if I see it's easier (if one
> reuses the same Tlabel instance it should be quick and clean in
> resources)
Copying canvas in this way is not supported under gtk.
> > P.S.: Can you tell your virus scanner to write less spam?
>
> Unfortunately I've forgotten its pwd, will try to uninstall/reinstall
> it :o(
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives