On 2010-01-13 16:15+0100 Alain Baeckeroot wrote: > Hi > > I would like to draw a box containing the legend of the graph, in a box > with semi transparent background. So i need to know the lenght > (in pixel or win coordinates) of the string, in order to size the box. > > I tried `lenght = number_of_char(text) * 8 + 30; # pixels` > which does not work because the font is not fixed-width > > Is there a way to do do this ?
Hi Alain: This is a most interesting topic. As I recall, the high-level octave interface does have some legend functionality (you might want to take a look at its use in the "p" examples), but it has never worked very well because of the issue of string size. Would you be willing to try implementing some pllegend capability in C to see how well plstrl (mentioned by Arjen) satisfies the string-size requirements of pllegend? Once we have a satisfactory pllegend implemented for our core C library, then it is straightforward to propagate it to all our languages including octave. That is also true of plstrl if there is any need for it beyond its internal use by the C version of pllegend. My own feeling is that plstrl should give accurate results for our older drivers (e.g., xwin) that use Hershey fonts. However, that accuracy might be as much as say 30 per cent off for our modern devices that use a large variety of different TrueType fonts accessible on various user platforms. So initially pllegend should probably be conservative about relying on the accuracy of the results from plstrl. Later on, it might be possible to upgrade plstrl to interrogate our various modern devices for the potential plotted size of the string argument to plstrl. But we can deal with that issue later, and the interesting issue now is implementing a C version of pllegend that uses plstrl internally to estimate the plotted size of strings. Alain, if you don't have the needed C skills and/or time to implement pllegend in C, let us know, and hopefully someone else will volunteer. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Plplot-general mailing list Plplot-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-general