On Thu, 26 Mar 2026 16:28:35 GMT, Marius Hanl <[email protected]> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextFieldSkin.java
>>  line 257:
>> 
>>> 255: 
>>> 256:                 if (caretPath.getElements().size() != 0) {
>>> 257:                     caretWidth = 
>>> Math.round(caretPath.getLayoutBounds().getWidth());
>> 
>> I wonder if this should be `Region.snapSizeX()` instead of `Math.round()`:
>> not only Math.round() may round downward, but also produce mid-pixel results 
>> on systems with fractional scale.
>> 
>> Can you double check it on Windows at fractional scales (125%, 150%, 175%, 
>> 225%)?
>
> Since `caretWidth` is not directly used here, but rather in other code to 
> calculate the translation or related, it is very likely fine here, but the 
> target values in the other calculations may need to be snapped.

The caretWidth value is included in various calculations, and the results of 
those are snapped. So I think this works correctly. This PR just restores the 
old behaviour before it was broken.

I will check on Windows for various scales

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2128#discussion_r2996214521

Reply via email to