[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string-width error?
- To: email@example.com
- Subject: Re: string-width error?
- From: firstname.lastname@example.org (Peter Stone)
- Date: Wed, 8 Feb 1995 21:35:54 +0100
- Sender: email@example.com
>On Wed, 8 Feb 1995, Peter Stone wrote:
>> Thanks for advice for everybody. The width problem was endeed caused
>> by string exceeding the build-in Mac OS limit, which was undocumented
>> in the MCL manual.
>> Natural-size works fine when the text to be sized contains newlines at
>> the end of each row. But the string I'm sizing is "a very long string
>> without newlines". Its width must be calculated in chunks. Here is the
>> unlimited length version of string-width.
>All string-width really does is multiply the length of the string by
>the char width. You can do this yourself rather than using string-width
>repeatedly. (If you are using a variable-width font, either approach will
>give increasingly erroneous results and the length of the string increases.)
If string-width only multiplies the length then the following results
would be the same, so the chunking option gives better approximation.
4 > (string-width "aa.." '("times" 12 :plain))
4 > (string-width "aa.a" '("times" 12 :plain))