Text mismeasured at certain Windows DPI levels
Kevin Rushforth
kevin.rushforth at oracle.com
Mon Mar 12 15:02:00 UTC 2018
Since you have a simple test program that reproduces this bug, can you
please file a bug report?
http://bugreport.java.com/
Thanks.
-- Kevin
Chris Nahr wrote:
> After some more experimentation I added some details and a screenshot
> (from another test program) to this blog post:
> http://news.kynosarges.org/2018/03/11/windows-gui-dpi-scaling-in-2018/
>
> That's about a small test suite for DPI scaling, and it's where I
> first saw this bug. Like the repro program below these test programs
> are quite simple. The bug does not seem to occur in more complex
> real-world programs, but it's reproducible when it does occur and also
> affects labeled controls other than checkboxes (saw it in buttons).
>
> As I wrote in the blog post: My present guess is that on DPI scales
> that are not multiples of 100%, there is a small discrepancy in the
> initial measurement between a label's required width and the width
> provided by its container. In complex windows this gets eventually
> fixed by subsequent layout passes, but in simple windows the error
> persists and manifests as an ellipsis.
>
> -- Christoph Nahr
>
>
> On 2018-03-09 10:58, Chris Nahr wrote:
>> I've found a pretty serious issue with CheckBox labels on Windows DPI
>> levels other than 100% or 200%. Apparently the label mismeasures
>> itself during layout, so its text is cut off with an ellipsis.
>>
>> I've attached a simple program to reproduce this. Running with
>> -Dglass.win.uiScale=100%, 125%, 150%, 175%, 200% cuts off all
>> CheckBox labels on any DPI scale between 100% and 200%. My
>> environment is Java SE 9.0.4 on Windows 10 Creators Update.
>>
>> The only workaround I found was to set an explicit minimum width for
>> the CheckBox. In that case the incorrect self-measurement of the
>> label text is ignored and the full text displayed.
>>
>> Best regards,
>> Christoph Nahr
>>
>>
>> ----- Test Program -----
>>
>> import javafx.application.*;
>> import javafx.scene.*;
>> import javafx.scene.control.*;
>> import javafx.scene.layout.*;
>> import javafx.stage.*;
>>
>> public class CheckBoxLabel extends Application {
>>
>> public static void main(String[] args) {
>> Application.launch(args);
>> }
>>
>> @Override
>> public void start(Stage stage) {
>> final HBox box = new HBox();
>> for (int i = 0; i < 4; i++)
>> box.getChildren().add(new CheckBox("Check"));
>>
>> stage.setScene(new Scene(box));
>> stage.show();
>> }
>> }
>>
More information about the openjfx-dev
mailing list