[Xy-pic] (no subject)

Ross Moore ross@ics.mq.edu.au
Thu, 15 Aug 2002 20:52:23 +1000 (EST)

Hello Alexander,

> Hi. I am new to XY-pic. Feature-wise, this looks like the package of
> choice for producing diagrams, but to use it I need to solve the
> following problem. Perhaps someone can help, or, if it has been
> discussed/solved already, please point me in that direction. (I read
> through all old digests of this list and found no mention of it.)
> The problem concerns arrow tips, which are almost always misaligned.
> For example, on our unmodified RedHat Linux installation, if I open
>  ../texmf/doc/generic/xypic/xyguide.ps in GhostView,

One version of the Xy-pic PostScript fonts had all the glyphs wrong
by one position. This error was fixed for the Type-1 fonts
available for free at Y&Y-TeX's website:  www.yandy.com .

> already on the first page the arrow tips in the diagram are
> misaligned. This becomes increasingly noticeable as one increases the
> magnification. However, *which* tips are misaligned, and *how* badly,
> changes from one magnification to another. The misalignment can be
> seen without a magnifying glass on a laser printout.

> For another example, the cm tips in Exercise 15 on p.9 of that same
> document look good onscreen, but in the printout the tips are
> misaligned (they are slightly raised). Again, no magnifying glass is
> required. The misalignment catches my eye immediately.

Is it the tips that are misaligned, or horizontal arrow stems?
This could be largely the dvips problem of not doing rules correctly.
That is the question of whether the rectangular shape of a rule should
sit wholly above the baseline, or be bisected by it.
If the \UseRules option has been used in the document, then although
this saves on memory and processing, the dvips "bug" may come into play.

One way to avoid this is to use \NoRules and the \xyoption{ps} backend driver,
whereby all pieces of diagrams are constructed using PostScript \special commands.
This gives very nice diagrams with all pieces fitting "perfectly".

The default driver uses font pieces which are required to be fitted
together. So yes, there could well be rounding errors this way, and any
(possibly platform-dependent) errors in the dvi to PS conversion may have
an effect on the result.

> Because the nature of the misalignment is different at different
> magnifications, it appears to be some kind of rounding issue. In
> composing an arrow out of a tail and two pieces for the tip, are the
> coordinates of such low resolution that rounding will shift things by
> full pixels? Is this a problem everyone is experiencing, or is it
> local?

No, the accuracy in Xy-pic is much better than that.
However, the rules themselves may be out by half their width.

There is another effect that may come into play if you have the Xy-pic
PostScript fonts.
This is the "hinting", which is to ensure that individual font characters
are drawn as best as possible to match the raster grid.
When several font pieces are placed next to each other, it is possible
that the optimisation for each character individually need not be best
for the group as a whole. Thus 1-pixel mis-matches could indeed result.

In short, it is extremely difficult -- indeed impossible --
to program Xy-pic to get it perfect in all situations.

> Thanks.

Hope this helps,

	Ross Moore

> Alexander Perlis
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> _______________________________________________
> Xy-pic mailing list
> http://tug.org/mailman/listinfo/xy-pic