On 2014-01-13 10:04-0800 phil rosenberg wrote: > Hi All
> I've just had cause to try to eliminate some calls to plexit - something I'm sure we all agree to be a good thing. Basically I want to be able to move some exe files with plplot statically linked and using the wxWidgets driver. As the wxWidgets driver doesn't need the .fnt files I'd rather not have to mess around with these, but if they aren't found plplot calls plexit so up to now I've had to move copies of these round too. > I've attached a patch that deals gracefully with missing .fnt files. The new behaviour is a plabort call during initialisation when the files are not found. Then wherever the Hershey font data is used, a check is made to see if the data was initialised, if this fails then plabort is called and the function returns for plpoin, plpoin3 and pldeco, or the function simply returns doing nothing in the case of plcvec. > Unfortunately it seemed that even though wxWidgets does not use Hershey fonts, plstrl still used them for calculating string lengths, then wxWidgets just did not use the derived widths for justify text (it calculates justification on the fly to allow for newlines). This caused lots of annoying popups in the examples due to the plabort calls so I flagged wxWidgets to calculate it's own widths, although it just returns zero in all cases. It may be that other interactive drivers want to do the same thing if they don't already. > The final change was a bug fix for plstrl to avoid these string length driver calls ending up in the buffer. > I've tested the patch with the first few examples. With no .fnt files calls to plpoin generate an abort message, and the points are not drawn, but the plotting continues. > I hope the patch is okay to merge in. Hi Phil: I think the general idea of what you are trying to do is a good one; users of drivers that do not use Hershey fonts should not be forced to carry around the old-fashioned Hershey *.fnt files. But from your description above I would go a bit further and once we are assured that you have found every use of Hershey fonts within the code and put in the appropriate plabort call for them when those fonts are not initialized, then there is no reason for the original plabort call you described. In other words, for the case where the Hershey *.fnt font files cannot be found, there should be no plabort calls at all for drivers that do not use Hershey fonts in any way. (That may be what your patch does already, but your description of that first plabort call did not sound like it.) Based on your above description, there is one serious issue with your changes for wxwidgets which is it returns a length of zero to plstrl. The plstrl function results are used very heavily for pllegend so you will find this change makes a complete mess of examples 4, 26 and 33 which is, of course, not acceptable. So your revised patch should address this important issue by (1) providing a reasonable plabort result for the plstrl function when the Hershey fallback is used, but there are no Hershey fonts initialized, and (2) providing a good string-extent result from wxwidgets back to plstrl. (In fact, such a change should be quite an improvement on using the Hershey fonts to approximate the extent of the string that the unpatched wxwidgets device is currently using as a fallback.) I did a quick google search, and it appears that, for example, the wxDC::GetTextExtent function documented at http://docs.wxwidgets.org/trunk/classwx_d_c.html#ae55cbf1bc7b7e836cb192eb48d31efab provides the needed capability. Also, please split your revised patch into two parts consisting of PLplot core changes and wxwidgets device driver changes. The two patches should be evaluated separately. The goal of the core changes would be to smoothly (i.e., without run-time errors although plabort messages and empty results where Hershey fonts are needed would be expected) get through all standard examples for all devices if the *.fnt files are missing. A further goal of the core changes would be that the unchanged qt and cairo device drivers should produce the same good results as now (with no plabort messages) when *.fnt files are missing. The goal of the wxwidgets changes would be to follow what should already be implemented for the qt and cairo device drivers, i.e., give good-looking results without any plabort calls for all standard examples if the *.fnt files are missing. 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); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); 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 __________________________ ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Plplot-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/plplot-devel
