envbvs@epb2.lbl.gov (Brian V. Smith) (05/05/89)
Sorry if this has already been solved, but here is a patch to x10tox11
protocol converter to compute correct font widths. The current version
of x10tox11 is apparently based on R2 fonts and incorrectly uses the
(rbearing - lbearing) calculation to calculate character spacing.
Thanks to the article that Jim Fulton posted about ink metrics, I was
able to change x10to x11 to use the (obvious) "width" component of the
font structure.
*** x10tox11/proto4.c.orig Tue Oct 11 15:10:42 1988
--- x10tox11/proto4.c Fri May 5 08:53:59 1989
***************
*** 112,119
fstruct = finfo->info;
rep->param.s[0] = finfo->ascent + finfo->descent;/* height */
! rep->param.s[1] = fstruct->max_bounds.rbearing /* "average" width */
! - fstruct->max_bounds.lbearing;
rep->param.s[2] = fstruct->min_char_or_byte2; /* 1st character */
rep->param.s[3] = fstruct->max_char_or_byte2; /* last character */
rep->param.s[4] = finfo->descent; /* baseline */
--- 112,118 -----
fstruct = finfo->info;
rep->param.s[0] = finfo->ascent + finfo->descent;/* height */
! rep->param.s[1] = fstruct->max_bounds.width; /* max width * /
rep->param.s[2] = fstruct->min_char_or_byte2; /* 1st character */
rep->param.s[3] = fstruct->max_char_or_byte2; /* last character */
rep->param.s[4] = finfo->descent; /* baseline */
***************
*** 273,279
if (fillBackground) {
XTextExtents(fp->info, string, length, &direction,
&junkAscent, &junkDescent, &overall);
! xExtent = overall.rbearing - overall.lbearing;
}
} else {
index = 0;
--- 272,278 -----
if (fillBackground) {
XTextExtents(fp->info, string, length, &direction,
&junkAscent, &junkDescent, &overall);
! xExtent = overall.width;
}
} else {
index = 0;
***************
*** 325,331
if (fillBackground) {
XTextExtents(fp->info, pitem->chars, pitem->nchars,
&direction, &junkAscent, &junkDescent, &overall);
! xExtent += overall.rbearing - overall.lbearing;
xExtent += pitem->delta;
}
--- 324,330 -----
if (fillBackground) {
XTextExtents(fp->info, pitem->chars, pitem->nchars,
&direction, &junkAscent, &junkDescent, &overall);
! xExtent += overall.width;
xExtent += pitem->delta;
}
_____________________________________
Brian V. Smith (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
We don't need no signatures!