[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: How to calculate character widths?

Bob Foster wrote:

I wasn't aware that single characters have a 'true width'.  You can write a
string of characters and find out how wide it is, or calculate same without
drawing. But except for mono-space fonts, the result is not the same, in
general, as adding up the widths of the individual characters.

Call it like you want, but I think, I need all three widths shown in my "screenshot" to correctly render glphys. I'm very well aware of the fact, that the extent of a string of characters isn't equals to the sum of the extents of the single characters. Unfortuntely, GC#stringExtent called for single character strings doesn't return the width but the advance (which for the most often usage makes perfectly sense). So stringText for single chars doesn't give you more information that getCharWidth and getCharAdvance. Still no way to calculate the missing A and C values.


bye
--
Stefan Matthias Aust   //
www.3plus4software.de // Inter Deum Et Diabolum Semper Musica Est