to stretch the string to fit the expected width.
scalefont setfont
} def
-% draw aligned label in bounding box aligned to current point
-/alignedtext { % width adj text
+% draw text fitted to its expected width
+/alignedtext { % width text
/text exch def
- /adj exch def
/width exch def
gsave
width 0 gt {
- text stringwidth pop adj mul 0 rmoveto
+ [] 0 setdash
+ text stringwidth pop width exch sub text length div 0 text ashow
} if
- [] 0 setdash
- text show
grestore
} def