Despite adding the
width parameter to the
//SETFONT GDI printing directive, there have been continuing complaints about fixed pitch variability. For example, a form will be worked out on one printer, only to discover that when printed on another, the horizontal character spacing is slightly more or less, causing the columns to the right of the page to no longer line up with the form.
There was a
lengthy discussion of this issue awhile back which led to the addition of the
width parameter, which solved most of the problems, but oddly, not for the Courier font. (The Courier font has always mysteriously misbehaved; as just one example, the bold version is often narrower than the normal version.)
To get to the point, I've finally come up with what appears to be a more reliable and precise way to force it (and any fixed pitch font) to render itself at the exact requested size (in terms of characters per inch). The technique essentially consists of explicitly positioning each character, rather than just using the natural font tracking, so it makes the CPU work harder, but the difference in effort will not be perceptible. The question is, whether this new logic should be considered a bug fix and just applied universally, or, since it might result in changes to existing GDI report spacing that has been worked out by trial-and-error, should it be some kind of new option?
To help decide, here's an updated version of the sample document used in the above mentioned thread. The examples at the top of the page show the natural font spacing for three common fixed-pitch fonts at 12 points, in normal, bold, and italic. (The intent being to show that even though they are all 12 point fixed pitch fonts, the actual characters per inch varies with the font face and style attributes.) At the bottom of the page are the same examples, but using the
width parameter to specify a width of 72 (tenths of points), which should give us exactly 10 characters per inch. The vertical dotted line shows where each line should end if the spacing was exactly 10 CPI.
First, this is how it works now (i.e. thru 5.1.1148.0). Notice that the line lengths are all the same in the bottom section, except for two problems: 1) they are all slightly too short, coming in at about 9.9 CPI instead of 10.0, and 2) Courier is misbehaving. (The reason for the spacing being slightly less than 10 CPI is that the technique involved adjusting the font cell width, one pixel at a time, until a 50 character sample line came out as close as possible but not beyond the target length, so, depending on various factors, it will be either perfect or slightly short.)
And here's how it looks with the new technique. Notice that now the lines at the bottom are all exactly the right length:
So to repeat the $64 question: should I just apply the fix? Or should we add some new switch to //SETFONT which you have to specify to make the
width parameter work precisely and reliably? One idea would be to set the width to the negative value, which would be easy to implement, but might seem a little weird or counter intuitive. Another would be to add a new bit flag to teh
pitch-and-family or
style parameters. Or, we could just apply the new formula and call it a fix.