Re: Jittery text in successive PostScript sequences

Chris Liddell <[email protected]> Wed, 24 Jan 2018 07:41:09 +0000
Newsgroups gmane.comp.printing.ghostscript.devel
Message-ID <[email protected]>
At a guess (and it is a guess), I'd suggest the issue is the low
resolution. That will hamper both the accuracy of the stringwidth
operation, and the accuracy with which each glyph is placed.

It would be interesting to know if the same effect occurs at, say,
300dpi or higher.

I'd also try without the -dTextAlphaBits=4 simply to eliminate (or
confirm) that as an area of concern.


You have quite the morass of irrelevant command line options, there.
Most of them are totally irrelevant when producing rendered output
formats - they're not having any affect, but I would eliminate them,
nevertheless.

Chris

On 24/01/18 04:14, Paul Wessel wrote:
> Hi developers-
> 
> GMT (gmt.soest.hawaii.edu)uses PostScript to make maps and one application builds an animation from sequences of PostScript plots converted to PNG with ghostscript (9.22) and then to MP4 with ffmpeg.  We have found a problem that may be a ghostscript bug, or alternatively we are doing something wrong.  When using a rotating view (i.e., via a matrix concatenation to simulate different view azimuth (shown in TL corner) [here elevation is fixed at 90 degrees], the resulting text strings "jitter" when viewed as a movie, i.e., the individual letters “dance".  For an example, see www.soest.hawaii.edu/pwessel/jittery.mp4.  As the movie plays, you will see the INDIVIDUAL letters in the word HELL jitter relative to each other, despite being set via a single show command (shown here is just a sn
 ippet of our PostScript  code; setting currentpoint, font, etc. are omitted):
> 
> (HELL) dup dup stringwidth pop -2 div exch sh -2 div rmoveto show
> 
> where sh is defined as
> 
> /sh {gsave matrix setmatrix 0 0 moveto true charpath flattenpath pathbbox newpath 4 1 roll pop pop pop grestore} bind def
> 
> [a complete PS example of a single frame can be found here: www.soest.hawaii.edu/pwessel/jittery.ps.
> 
> At first we suspected flattenpath, but HELL (using Helvetica) has no curved segments (?).  We also tried to override the flattening with 0.2 setflat, but no difference.  We suspect some sort of roundoff but it affects the different letters in the word differently, and that does not appear to be under our control.  Could any of the operators we use above to center the string be subject to round-off that affect individual letters?  We are using maximum antialiasing (but these settings have no effect on the jitter).  An example of the full gs call to build one of the PNG frames is given here:
> 
> gs -q -dSAFER -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=2 -dTextAlphaBits=4 -sDEVICE=png16m  -g400x250 -r100 -sOutputFile=‘jittery_091.png' -f’jittery.ps'
> 
> We are hoping gs developers know where this may happen or if there is anything we can do on our side to remedy the problem.  As you can see there is no jittering for plotting a circle or lines.  The map frame annotations show the same jittering so it affects all text.
> 
> Thanks for any insight!  A zip file with all individual PS and PNG frames is available at www.soest.hawaii.edu/pwessel/jittery.zip.
> 
> FYI, we have tried both tif and jpg instead of png but no difference. We also made PDFs and used OS X Automator to build PNGs and made a movie using QuickTime Pro; same jittering (not sure if OS X High Sierra uses ghostscript in Preview, etc).  We have tried small to large (e.g., 4K) resolutions.  It seems that although all text (and lines) are correctly anti-aliased, the POSITION of the text items seems rounded to the nearest pixel on a per letter basis.  It is this per-letter variability that gives rise the jittery motion.
> 
> Paul Wessel
> Lead developer
> The Generic Mapping Tools
>