[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-width error?



At 08:54 2/7/95, John R. Gersh wrote:
>
>A little testing reveals that string-width only uses the first 255
>characters in its argument string to calculate the pixel width; any
>characters beyond that are ignored. This is probably a reasonable limit for
>most screen and font sizes, but it seems to be an undocumented one.
>

The name string-width suggests (without proof) that this function uses the
Toolbox call StringWidth.  In C:  short StringWidth (const unsigned char
*).  That parameter is in fact a "Pascal string", limited to 255 characters
by its included one-byte length indicator.

The toolbox also has a TextWidth call, which takes a pointer to text, an
offset from that as a starting point, and a byte count.  The latter two
parameters are limited to 32,767.  I don't off hand know whether MCL as
shipped provides that call...it could certainly be added.

   --John

--
   Isn't C fun?
jwbaxter@pt.olympus.net (John W. Baxter)  Port Ludlow, WA