On Tue, 4 Jul 2023 14:30:35 GMT, Alexey Ivanov <[email protected]> wrote:

>> @prrace @aivanov-jdk I don't see much impact w.r.t to Label position/width 
>> for different scaling factors. 
>> The width is computed in 
>> [stringWidth(String)](https://github.com/openjdk/jdk/blob/48e61c1df53c11ed49603abd70a3dd62a25f7be5/src/java.desktop/share/classes/sun/font/FontDesignMetrics.java#L457)
>>  which is same for all scaling factors (though their are slight differences 
>> between scaling factor, its corrected due to 0.5 addition at the end). The 
>> position is computed in 
>> [layoutCompoundLabelImpl()](https://github.com/openjdk/jdk/blame/526dba1a2942e444bf11d03d8eaf014b5ef20ccf/src/java.desktop/share/classes/javax/swing/SwingUtilities.java#L1073)
>>  which seems to be correct, since the calculation for XPos which is `dx = 
>> (viewR.x + viewR.width) - (labelR_x + labelR_width);` seems straight 
>> forward. 
>> Is there anything else which I should check or can we move ahead with 
>> current fix i.e., setting margin to 2pixels for RIGHT Aligned header text 
>> for Metal L&F?
>> Parallelly I will raise a bug and PR for header border alignment.
>
> @TejeshR13 I agree it looks correct, I can't spot any differences. Does 
> `JLabel` always position the text correctly? If you make `JLabel` 
> right-aligned, do you see any pixels which aren't painted as expected?

@aivanov-jdk @kumarabhi006 Please let me know if there are any more review 
suggestions.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14464#issuecomment-1655480573

Reply via email to