diff options
Diffstat (limited to 'dviware/beebe/src/fixpos.h')
-rw-r--r-- | dviware/beebe/src/fixpos.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dviware/beebe/src/fixpos.h b/dviware/beebe/src/fixpos.h new file mode 100644 index 0000000000..a4bbb80678 --- /dev/null +++ b/dviware/beebe/src/fixpos.h @@ -0,0 +1,36 @@ +/* -*-C-*- fixpos.h */ +/*-->fixpos*/ +/**********************************************************************/ +/******************************* fixpos *******************************/ +/**********************************************************************/ +COORDINATE +fixpos(cc,c,cnvfac) +register COORDINATE cc; /* coordinates in device pixels */ +register INT32 c; /* coordinates in DVI units */ +register float cnvfac; /* converts DVI units to pixels */ +{ + register COORDINATE ccc; + + /* + A sequence of consecutive rules, or consecutive characters in a + fixed-width font whose width is not an integer number of pixels, can + cause |cc| to drift far away from a correctly rounded value. We + follow DVITYPE Version 2.6 to ensure that the amount of drift will + never exceed MAXDRIFT pixels. DVITYPE Version 2.0 did not do this, + and the results could be visibly AWFUL!! + */ + + ccc = PIXROUND(c,cnvfac); + if (ABS(ccc-cc) > MAXDRIFT) + { /* drag cc toward the correctly rounded value ccc */ + if (ccc > cc) + { + cc = ccc - MAXDRIFT; + } + else + { + cc = ccc + MAXDRIFT; + } + } + return (cc); +} |