Skip to main content
Inspiring
Jun 19, 2019 4:55 PM UTC
Question

shfill trouble

The PostScript program below draws 13 vertical bars with smooth shading (shfill).

The rendering works as expected. On top of each bar are 2 numbers. For the first

of these bars, #0, the text by Showtext is correct. The other 12 bars don't show

numbers, but as tested by Illustrator, the paths exist, but they are not filled.

If shfill is blocked (% shfill) then all numbers are rendered correctly.

What might be wrong?

http://docs-hoffmann.de/swatch22112002.pdf

A final result is shown on p.18 here, but it was achieved by using an extra procedure

for the numbers.

Best regards --Gernot Hoffmann

%!PS-Adobe-3.0  EPSF-3.0

%%BoundingBox:  0 0 1191 842

%%Creator:      Gernot Hoffmann

%%Title:        K-Bars Smooth shades

%%CreationDate: June 19 2019

/mm  {2.834646 mul} def

/tx1 [(1.0  ) (1.1  ) (1.2  ) (1.3  ) (1.4  ) (1.5  ) (1.6  )

      (1.7  ) (1.8  ) (1.9  ) (2.0  ) (2.1  ) (2.2  )] def

/tx2 [(1.000) (0.909) (0.833) (0.769) (0.714) (0.667) (0.625)

      (0.588) (0.555) (0.526) (0.500) (0.476) (0.455)] def      

                    

/xa  20 mm def      % Reference left

/ye 270 mm def      % Reference top 

/ya  16 mm def 

/bx  20 mm def      % Width    

/by  ye ya sub def  % Height

/sx  23 mm def      % Distance of boxes

/fo  12 def         % Font size

/Showtext {moveto show} def   

/Bars

{/Helvetica findfont fo scalefont setfont

  0 0 0 1 setcmykcolor

/x0 xa def

/y0 ya def

/y1 ye def

/y2 y1 6 mm add def

0 1 12

{/k exch def

/ig tx2 k get cvr def

/x1 x0 bx add def

/x2 x0 9.5 mm add def

<<

/ShadingType 2

/ColorSpace /DeviceCMYK

/Coords [x0 y0 x0 y1]

/BBox   [x0 y0 x1 y1]

/Function

  <<

  /FunctionType 2

  /Domain [0 1] % for t 

  /C0 [0 0 0 1] % t=0 black

  /C1 [0 0 0 0] % t=1 white

  /N  ig        % C=C0+(C1-C0)t^N

  >>

>>

shfill

  tx1 k get x0 y2 Showtext

  tx2 k get x2 y2 Showtext

/x0 x0 sx add def

} for

} def

Bars

showpage

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Legend
Jun 19, 2019 8:18 PM UTC

shfill is documented as not using or changing the current colour. We might hope it also doesn't affect the current font. However... I took your PostScript and distilled it with Distiller 10. The result showed all the text you describe. What do you do with your PS/EPS file? Illustrator isn't a general purpose EPS/PDF editor, so if your workflow funnels advanced PostScript concepts through it, that's probably the cause.

Translate
Inspiring
Jun 20, 2019 7:00 AM UTC

Thanks for thinking about my problem.

The eps is part of this  PDF, made by InDesign:

http://docs-hoffmann.de/swatch22112002.pdf

Illustrator was used only for tests: shows the correct path generation for the text,

but fill is missing. All tests by Photoshop, InDesign and Illustrator CS2 and CS6 fail.

Acrobat 8 renders correctly.

I had tried variations: setfont and setcmykcolor immediately in front of Showtext,

gsave/grestore. Nothing helps.

Yes, shfill doesn't change the graphics state, according to PLRM. So far we have

only one explanation: shfill is not correctly implemented in the mentioned programs.

Best regards --Gernot Hoffmann

Translate
Inspiring
Jun 27, 2019 4:28 PM UTC

The problem is caused by /BBox. It works after replacement by rectclip:

...

  <<

/ShadingType 2

/ColorSpace /DeviceCMYK

/Coords [x0 y0 x0 y1]

%/BBox   [x0 y0 x1 y1]

/Function

  <<

  /FunctionType 2

  /Domain [0 1] % for t

  /C0 [0 0 0 1] % t=0 black

  /C1 [0 0 0 0] % t=1 white

  /N  tt2 cvr   % C=C0+(C1-C0)t^N

  >>

>>

gsave

x0 y0 bx by rectclip

shfill

grestore

...

G.Hoffmann

Translate