From 1dcd09e20c4df8f72743c32795ba79974a8aef6c Mon Sep 17 00:00:00 2001 From: Ahmed Nematallah Date: Sun, 17 May 2026 03:41:07 +0200 Subject: [PATCH] Update the postscript file to be able to support much more stipples The postscript template had a hardcoded stipple length of 29, any more stipples would cause problems with a postscript parser. This was particularly a problem since the default mos.24bit.dstyle has 36 stipples already. It also used a base-30 encoding. I have updated the template to fix both issues, it now uses base-10 encoding, and can support up to 255 stipples (which is the maximum length allowed by the current approach of using fonts) I was also wondering if it made more sense to encode this file directly into the C program as a literal, as half of it already is in the C program. (some "begin"s have an "end" in strings directly embedded in magic, so this file basically serves as a large string that has to be loaded each time from disk, while other parts of the string are stored normally in memory) --- magic/magicps.pro | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/magic/magicps.pro b/magic/magicps.pro index d0561dd8..7bf7e578 100644 --- a/magic/magicps.pro +++ b/magic/magicps.pro @@ -26,17 +26,19 @@ StipplePattern begin /FontMatrix [1 0 0 1 0 0] def /FontBBox [0 0 1 1] def /Encoding 256 array def - /PattName (P0) def - /tmpStr 1 string def + /PattName (P000) def + /tmpStr 3 string def /NoPatt {<00>} def 0 1 255 { Encoding exch /NoPatt put } for /BuildChar { 1 0 0 0 1 1 setcachedevice exch begin Encoding exch get load 64 64 true [64 0 0 64 0 0] 5 -1 roll imagemask end } def end -/dp { StipplePattern begin dup 30 tmpStr cvrs PattName exch 1 exch - putinterval PattName cvn dup Encoding exch 4 -1 roll exch put exch - store end } def +/dp { StipplePattern begin + dup 10 tmpStr cvrs /num exch def + PattName 1 num putinterval + PattName 0 num length 1 add getinterval cvn + dup Encoding exch 4 -1 roll exch put exch store end } def /sf { findfont exch scalefont setfont } bind def /sp { patterns setfont 2 setlinewidth } def /lb { gsave translate 0 0 moveto /just exch def gsave dup true charpath @@ -68,4 +70,3 @@ end x y moveto w y lineto w h lineto x h lineto closepath clip bx } def /tb {1 sub 3 1 roll gsave newpath moveto {lineto} repeat closepath clip pathbbox /h exch def /w exch def /y exch def /x exch def bx } def -