oops, replied to Konstantin only, sorry. Really need this reply-to-all field!
2009/11/24 Konstantin Tokarev firstname.lastname@example.org:
24.11.09, 06:32, “Benoit Jacob” email@example.com:
(argh, could you set a reply-to field to the list?)
2009/11/23 Geoffrey Hutchison :
Avogadro::Painter have no interface to set fonts. I’ve looked inside text renderer, and my first wish was to overload draw() to accept QFont.
I’d add methods to TextRenderer to set the font and/or size explicitly. This way, the existing calls to draw() can remain the same – I think this approach is more in keeping with Qt API as well.
Just one note about the TextRenderer, assuming that didnt change since
my days: it assumes a single font/size to be used throughout, in the
following sense: the hash-table where textrenderer stores glyphs, is
indexed by QChar’s, so it is not aware of font and font size. So if
you render a ‘Z’ with size 12, then afterwards when you want to print
’Zorro’ in size 14, it will use the cached ‘Z’ of size 12.
So if you want TextRenderer to be aware of multiple fonts/sizes, you
need to make that part of the indexes used in the Hash table.
Not sure what the best way to do this is; either you find an efficient
way of getting a single hash value for a (QFont,QChar) pair, or
perhaps instead it’s better to have a “hash table of hash tables”, the
big table indexed by QFont, the small tables are like the existing one
indexed by QChar …?
Oh and you could discuss that with kgllib / Gluon people who are using
a variant of TextRenderer.
I think it would be rather ineffective to store all chars of all fonts in hash. Maybe it’s possible to change them dynamicaly? There will be no more then two fonts and two font sizes simultaniously in the view (atom and bond labels_
I don’t know exactly how expensive QFont::hash() is but keep in mind
that one needs to do that only once per rendered string, not once per
However if that’s too expensive then perhaps a better design is to
have our own Font class, and let the user specify a Font object
explicitly or even move the text-drawing function to that Font class,
Can’t say more