On 2015-11-27 16:57-0000 Peter Williams wrote:

> Hi Alan & Arjen
>
> Thanks for your attention. Hope I am posting this correctly. One of the first 
> things I did when I built Plplot5.11.1 was to run the c code examples. 
> Example x07c.c runs fine and displays the character #(855) – an  arrow  head 
> in a Postscript file. All very jolly! So, the fonts must be built into the 
> library. My program shows nothing. But maybe the comparison is false because 
> I plot using plptex while x07c.c uses a different method, which I confess I 
> am not clear about.  It does print some characters correctly e.g. #(766) - 
> the infinity symbol.
>
> I have been using Plplot for a long time starting with an ARM  Acorn 
> Archimedes.  I built Plplot5.00 back in the 90's using a collection of .bat 
> files.  I still have it and it plots #(855) fine. I thought it was time to 
> upgrade... I build using CMAKE 3.4.0-rc2 in its GUI form. It didn't seem to 
> want to left me build a pdf device. Maybe I am not using it correctly.
>
> A simplified version of my program is:
>
> /*
>  FontTest
> */
> #include <math.h>
> #include <plplot.h>
>
> int main()
> {
>    int i;
>    PLFLT x,y,dx,dy,theta,dTheta,xMin,xMax,yMin,yMax;
>
>    xMin = -4.0; xMax = 1.0; yMin = -2.0; yMax = 2.0;
>
> /* Set up viewport and window, but do not draw box */
>
>   " plinit();
>    plenv( xMin, xMax, yMin, yMax, 0, 0 );
>    plfontld(1);plfont(1);
>
>    x = -2.0; y = 2.0*exp(-x*x/4.0); dy = -x*exp(-x*x/4.0); /* Find arrow 
> slope */
>    plptex(x, y,1.0,dy,0.5,"#(855)"); /* C2 Arrow */
>    plptex(x,-y,dx,dy,0.5,"#(855)");  /* C1 Arrow */
>    plptex(x,0,-1.0,0.0,0.5,"#(855)"); /* Gamma Arrow */
>
>    plend();
>    return 1;
> }
>
> Best Wishes, Peter
>

Hi Peter:

Thanks very much for this more detailed report.  Including a simple
test like you did above is always a good motivator for us.  :-)

As far as I can tell there is nothing wrong with your above test
programme (aside from uninitialized dx which I fixed by setting that
variable to 0.).  With that fix in place, I have confirmed the issue
(arrow not rendered) on Linux (Debian Jessie) with the psc device.
After the dx fix, valgrind shows an absolutely clean result so the bad
rendering issue is unlikely to be caused by memory management
problems.

To investigate further I modified examples/c/x10c.c (which is our
simplest example that uses plptex) as follows:

--- a/examples/c/x10c.c
+++ b/examples/c/x10c.c
@@ -28,7 +28,7 @@ main( int argc, const char *argv[] )
      plsvpa( 50.0, 150.0, 50.0, 100.0 );
      plwind( 0.0, 1.0, 0.0, 1.0 );
      plbox( "bc", 0.0, 0, "bc", 0.0, 0 );
-    plptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" );
+    plptex( 0.5, 0.5, 1.0, 0.0, 0.5, "Hershey code #(855)" );
      plend();
      exit( 0 );
  }

The advantage of working with slightly modified standard examples like
this is our build system makes them extremely convenient to build and
run.

With the above change to standard example 10, I again confirmed the
issue (arrow not rendered) for -dev psc and -dev ps, but the following
devices did properly render the arrow: xwin, tk, xcairo, wxwidgets, qtwidget,
and even psttfc (which has similarities to -dev psc).  For the -dev
svg case (which is another device without external library
prerequisites which is convenient for you to also try on Windows) the
arrow was rendered as a question mark.

The conclusion is there is a specific bug for the ps device
driver for PostScript fonts, and also a specific bug for the svg device
(which is probably not related).  I will look into both of those.

Meanwhile for the psc (or ps) device there is a driver option which
allows you to replace the PostScript fonts with Hershey fonts. If you
have command-line parsing in place (which your above example does not,
but look at any of the example/c/x??c.c files to see how to implement
that with a change to the main arguments and inserting a call to
plparseopts), then use the -drvopt text=0 command-line option to try
the Hershey font possibility.  That works fine here (arrow rendered)
although the results are generally not as pretty as those rendered
with PostScript fonts.

Thanks again for reporting this bug.

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
__________________________

------------------------------------------------------------------------------
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to