[Biojava-l] getDepth() method - change required?

Dr S.M. Huen Dr S.M. Huen" <smh1008@cus.cam.ac.uk
Thu, 10 May 2001 23:12:12 +0100 (BST)


Currently, the getDepth method of renderer classes of various kinds take
SequenceRenderContext as the single argument.

However, it is not possible to go from a font returned by
SequenceRenderContext to information about the dimensions of that font
without creating a FontRenderContext.  That, in turn, requires the
Graphics2D object as the pixel dimensions of a font depends on the drawing
resolution of the display device.  We cannot exclude the possibility that
a single SequenceRenderContext may be used in more than one display with
varying resolutions.

Could we make the Graphics2D object become an argument of this method too?
If so, this modified method may have to be retrofitted to the interface as
all our getDepth() are called by LayeredRenderer with the same parameter
list.

I came across this problem when attempting to correct a bug in
SymbolSequenceRenderer.  As it stands, the getDepth of this class returns
a fixed value irrespective of whether the text is visible which will force
allocation of space for this renderer even when it has nothing to display.
However, it cannot determine font dimensions in the getDepth(0 method
without access to the graphics object.  We have not observed the effect os
this omission to date because the GUI uses the sequence renderer at the
bottom of the window.

Thanks,
David Huen, Univ. of Cambridge