Bug 562099 - Text fields in toolbar contributions are too small to display text on larger scaling
Summary: Text fields in toolbar contributions are too small to display text on larger ...
Status: CLOSED DUPLICATE of bug 465732
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-14 06:16 EDT by Matthias Paul Scholz CLA
Modified: 2020-06-04 15:03 EDT (History)
1 user (show)

See Also:


Attachments
Sample rcp app to reproduce the bug (9.46 KB, application/zip)
2020-04-14 06:16 EDT, Matthias Paul Scholz CLA
no flags Details
Screenshot of corrupted text field in toolbar (5.95 KB, image/png)
2020-04-14 06:17 EDT, Matthias Paul Scholz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Paul Scholz CLA 2020-04-14 06:16:03 EDT
Created attachment 282434 [details]
Sample rcp app to reproduce the bug

When adding a Tool Control with an internal text field to the Toolbar of a Window in an RCP application and running the application on 100% scaling on Windows, the content of the text field is correctly displayed.

When running the application on, for example, a resolution 3840 x 2160 and a scaling of 225%, the text field is not resized accordingly to match the enlarged content. As a result, the content of the text field cannot be read by the user any more.

For an reproduction, run the attached sample rcp app (which contains a single Tool control as describes above only) on Windows with the said resolution (or smaller) and a scaling of 225%.
Comment 1 Matthias Paul Scholz CLA 2020-04-14 06:17:42 EDT
Created attachment 282435 [details]
Screenshot of corrupted text field in toolbar
Comment 2 Rolf Theunissen CLA 2020-04-16 02:11:40 EDT
Are only the fonts in the toolbar affected?? To me it seems that the scaling factor is ignored for *all* fonts.
Comment 3 Matthias Paul Scholz CLA 2020-04-21 10:12:20 EDT
(In reply to Rolf Theunissen from comment #2)
> Are only the fonts in the toolbar affected?? To me it seems that the scaling
> factor is ignored for *all* fonts.

Hi Rolf,

Thanks for your response. Only text fields in toolbars are affected in our application; other fonts are scaled correctly. 

Is there any workaround until the issue is officially fixed? 
Any help would be appreciated.

Best,
  MP
Comment 4 Matthias Paul Scholz CLA 2020-04-22 04:45:06 EDT
Besides, the text in text fields in toolbars of the RCP app gets correctly scaled when using the compatibility mode for the app's exe on Windows and switching the "High DPI scaling" to "System" (instead of of the default "application").

Is it possible to configure the RCP app programmatically accordingly?
Comment 5 Rolf Theunissen CLA 2020-04-22 04:52:35 EDT
One workaround is to manually apply the scaling to your Widgets in the ToolControl. I have not investigated any root cause, but the following snippet in the seems to correct the font.

 Label label = new Label(parent, SWT.NONE);
 label.setText("My Label");

 FontDescriptor descriptor = FontDescriptor.createFrom(label.getFont());
 int height = descriptor.getFontData()[0].getHeight();
 int scaledHeight = DPIUtil.autoScaleUp(height);
 FontDescriptor scaledDescriptor = descriptor.setHeight(scaledHeight);
 Font scaledFont = scaledDescriptor.createFont(label.getDisplay());
		
 label.setFont(scaledFont);
Comment 6 Matthias Paul Scholz CLA 2020-04-23 09:41:27 EDT
(In reply to Rolf Theunissen from comment #5)
> One workaround is to manually apply the scaling to your Widgets in the
> ToolControl. I have not investigated any root cause, but the following
> snippet in the seems to correct the font.

Hi Rolf,

Thanks for the sample code.
When including it in our application and logging the scaled height, the value seems to be correct.

However, the size of the font is not the issue - also without the sample code included it gets computed correctly for the text field in the tool bar.
The issue is with the size of the text field in the toolbar: its height does not get resized to match the height of the font, hence the content of the field is clipped vertically.
Comment 7 Rolf Theunissen CLA 2020-04-23 12:41:36 EDT
This could be a duplicate of Bug 465732, however, that does not depend on the scaling factor.
Is the ToolControl the first item in the ToolBar? Or does it become the first one to be rendered on different scaling factors due to missing items, see referenced bugs?
Comment 8 Matthias Paul Scholz CLA 2020-04-24 04:04:09 EDT
(In reply to Rolf Theunissen from comment #7)
> This could be a duplicate of Bug 465732, however, that does not depend on
> the scaling factor.
> Is the ToolControl the first item in the ToolBar? Or does it become the
> first one to be rendered on different scaling factors due to missing items,
> see referenced bugs?

It is the frist item in the toolbar indeed.
However, as described in the initial bug report, we do encounter the issue in our RCP app on some scaling factors only.
Comment 9 Matthias Paul Scholz CLA 2020-04-24 07:47:53 EDT
Yet, the issue we see with the sample app that I have attached to this issue for reproduction seems to be the same as described in the #465732 indeed.

So I'd be ok with the issue at hand being marked as a duplicate.
Comment 10 Rolf Theunissen CLA 2020-06-04 15:03:07 EDT

*** This bug has been marked as a duplicate of bug 465732 ***