[comp.lang.postscript] bizarre bbox behaviour

stone@unmvax.cs.unm.edu (Andrew Stone) (08/14/89)

Enlightenment, please!

I have a procedure which charpath's characters, passes the character width
to a function which clips and then does a special fill into a rect whose
width is the passed-in width [the vertical part works].
It works fine except for the letter "f" in Times-Roman, the
top right part of the f does not get filled. It must overhang its bounding
box, a poor computer scientist's ligature device? Or is the stringwidth of
a character different from the bbox?
	
	______
	|  ___|  <---
	| |  ^
	|  ] 
	| |
	| |


Is this the only character that does this? Can I access
the sidebearing data? Platform is the NeXT, so NXFontMetric replies 
preferred, but plain PostScript also welcome.

Thanks,
andrew 
||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||
!!         Andrew Stone             !!       Stone Design Software      !!
!!      stone@hydra.unm.edu         <>      Albuquerque, New Mexico     !!
||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>|| 

greid@adobe.com (Glenn Reid) (08/15/89)

In article <281@unmvax.unm.edu> stone@unmvax.cs.unm.edu (Andrew Stone) writes:
>Enlightenment, please!
>
>It works fine except for the letter "f" in Times-Roman, the
>top right part of the f does not get filled. It must overhang its bounding
>box, a poor computer scientist's ligature device? Or is the stringwidth of
>a character different from the bbox?

The stringwidth of a character is the amount by which the current
point is displaced.  It has nothing to do with the bounding box,
other than coincidence (Take a look at the Sonata font if you want
to see a strong example of this).

What you want is to use the bounding box information directly.  This
is found in the font metrics files (AFM files) which are avaiable
on NeXT.  I think it should be available through the NXFontMetrics
or whatever the call is, but I've not tried it.

You get four numbers, LLx, LLy, URx, URy (lower-left, upper-right).
These numbers are expressed from the origin of the character.

Many italic characters actually extend somewhat to the right of their
width and to the left of their origins, for better visual placement.

Glenn Reid
Adobe Systems