<Swing Dev> [9] Review request for 8132119 Provide public API for text related methods in SwingUtilities2
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Tue Apr 26 20:39:01 UTC 2016
On 26.04.16 23:31, Alexander Scherbatiy wrote:
>>> Now it is possible that width1 is not equal to width2.
>>
>> Absolutely true. And it is something Swing needs to handle.
>
> Even more, it is not will be possible to rely on the fact that width
> of number of chars is just sum of each char width.
>
> For example, on graphics configuration with transform 2 the glyph
> xAdvance can be 13 and the char width in user space will be calculated
> as 13 / 2 = 6.5.
> FontMetrics. charWidth('a') will return 7 and charsWidth(array of 10
> 'a' ) will be 65 wich is not 7 * 10.
13 / 2 = 6.5 is a fractional data in the user's space and actually such
data is a "bug" when the fractional metrics are off. This was discussed
a few times when this bug was fixed on OSX. and CStrike code on osx was
changed to handle fraction on/off in terms of user's space(not the
actual device space=pixels). I guess there is no other solution other
than that.
--
Best regards, Sergey.
More information about the swing-dev
mailing list