Since my message below has not been sent to me by the groff list (after 1 hour), nor has appeared in the archives, I am re-sending it (and taking the opportunity to add a further comment -- se at end).
-----FW: <xfmail.110204102135.ted.hard...@wlandres.net>----- Date: Fri, 04 Feb 2011 10:21:35 -0000 (GMT) From: (Ted Harding) <ted.hard...@wlandres.net> To: groff@gnu.org Subject: Re: [Groff] Misformatting of CR font in PIC macros Cc: rle...@codelibre.net On 04-Feb-11 09:48:42, Werner LEMBERG wrote: >> The left-hand boxes in the figure contain "Filename" in Roman and >> below it "hash.c" in Courier. While in the pic macros both have the >> same x offset, "hash.c" is offset further to the right than >> "Filename", when both were expected to be exactly left-aligned. >> Note that changing \fC to \fR results in perfect alignment. > > The difference in formatting is due to the different width of spaces > in the two fonts. You shouldn't write > > \fR foo \fP... > \fC bar \fP... > > but rather > > \fRfoo\fP... > \fCbar\fP... > > groff is not LaTeX :-) spaces after a `\fX' command are *not* > suppressed. > Werner And, if you really need a left-space to separate the text from the left-hand edge of the box, and preserve alignment, use a space in the samse font (TR) both times -- like: "\s12\fR \fP\fChash.c\fP" at 1.062,8.721 ljust "\s12\fR Filename\fP" at 1.062,9.096 ljust and *not* # "\s12\fC hash.c\fP" at 1.062,8.721 ljust # "\s12\fR Filename\fP" at 1.062,9.096 ljust Hoping this helps! Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@wlandres.net> Fax-to-email: +44 (0)870 094 0861 Date: 04-Feb-11 Time: 10:21:31 ------------------------------ XFMail ------------------------------ --------------End of forwarded message------------------------- FURTHER COMMENT: Note that Courier uses a fixed-width "box" for each character, but a character will be centred in its box. Hence a character with a narrow visible glyph (like "l") will have more visible space either side of it than a wide one (like "W"). You will probably see this effect in your example, since the "h" in "hash" is on the narrow side, while the "F" in "Filename" will be quite a wide character (and in Times will have less space anyway because of the variable box width). Therefore the result of your code above will probably show the "h" apparently somewhat to the right of the "F". If that bothers you, then you will have to fudge it "by hand" by using an explicit horizontal displacement in your string. For example (not tested): "\s12\fR \fP\h'-0.125n'\fChash.c\fP" at 1.062,8.721 ljust "\s12\fR Filename\fP" at 1.062,9.096 ljust Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@wlandres.net> Fax-to-email: +44 (0)870 094 0861 Date: 04-Feb-11 Time: 11:33:10 ------------------------------ XFMail ------------------------------