Justifying a line in PostScript is possible by calculating the SpaceMod and using widthhow:
/SpaceMod % calculated from line width and stringwidth
/h { 0 32 } def
/Times-Roman findfont
14 scalefont setfont
SpaceMod h (This line with single font is justified) widthshow
But how can we use this method for a line with different fonts? A simple example is to have a bold part in the line as
/Times-Roman findfont
14 scalefont setfont
X h (How to) widthshow
/Times-Roman-Bold findfont
14 scalefont setfont
X h justify this line) widthshow
/Times-Roman findfont
14 scalefont setfont
X h (with multi fonts) widthshow
The problem is that we do not have a single string for the entire line to fetch stringwidth. Even if calculating it based on individual strings, how we can calculate/set SpaceMod?
Or we need to use another approach for justification of line with multi-fonts?
Brute force..
No doubt this can be tightend up a bit..
Edit, another take as I said tightend up a good bit.