RFR: 4516654: Metalworks Demo: Window title not displayed fully in Low Vision Theme [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Jun 9 05:42:40 UTC 2023
On Fri, 9 Jun 2023 05:33:19 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> In Metalworks demo in Low Vision theme, window title is not diplayed fully in this theme. The first letter of the title, that is letter "M", is cut vertically
>>
>> 
>>
>> It is because the iconsize is hardcoded to be 30 and windows titlePane title is rendered at same place irrespective of theme (only font size is made bigger from normal pt 12 to 24 for Low Vision theme) so icon width overlaps the title.
>> Icon width is made to be 24 in demo in sync with window title font size which made it work ok
>>
>> 
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix
The issue actually is caused by non-updation of `xOffSet` with correct value..
In MetalTitlePane, the initial `xOffset` is calculated with IMAGE_WIDTH value which is hardcoded to `16` so xOffset was 5+ 16 + 5 = 26 to draw the title string so we just about manage to draw the string outside the bounds of icon width which is `24 ` in `Metalworks Low Vision demo` but when icon image size is increased to `30` same xOffset of `26` is not sufficient so title string is drawn at xOffset 26 but [fillRect](https://github.com/openjdk/jdk/blob/6f492e800597c9ce332b9d5b54c00f551f145a0d/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTitlePane.java#L852-L857) happens for width `30` so icon area fillect clears few pixels from string area and overlap of icon area and string happened.
Fix is to make sure `x Offset` is calculated with correct width so it will become 5 +30 (icon width) + 5 = 40
Issue of not getting large icon proportional to icon size is another issue and will be tackled separately.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14346#issuecomment-1584004417
More information about the client-libs-dev
mailing list