Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340146

Summary: Display problems with fonts in custom stylesheets.
Product: [RT] RAP Reporter: Stefan Ruzitschka <icepuma>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fr.appel
Version: 1.3Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Screenshot
none
Demo Application none

Description Stefan Ruzitschka CLA 2011-03-16 08:32:14 EDT
Build Identifier: 20100917-0705

When using custom fonts in RAP sometimes labels have cut off the last part of the text on the label. The view has to be restored to fix the display problem.

Reproducible: Always

Steps to Reproduce:
1. Use a custom stylesheet with an alternating font.
Comment 1 Ivan Furnadjiev CLA 2011-03-16 08:50:40 EDT
Stefan, could you provide a self-running snippet to reproduce it? Is this happen only first time (after server startup) when you start the application? If reloading the application fixes the problem, it's probably a TextSizeDetermination issue. Thanks.
Comment 2 Stefan Ruzitschka CLA 2011-03-16 09:55:22 EDT
Sorry I couldn't provide a code example. But I attached a screenshot. After reopen the dialog the label fits.
Comment 3 Stefan Ruzitschka CLA 2011-03-16 09:55:54 EDT
Created attachment 191302 [details]
Screenshot
Comment 4 Ivan Furnadjiev CLA 2011-03-16 10:41:45 EDT
Stefan, I understand what is the problem, but without a code snippet to reproduce the issue it's impossible to trace it down and fix it.
Comment 5 Ralf Sternberg CLA 2011-03-16 14:29:34 EDT
Stefan, does this happen with a JFace Dialog? If so, you could try to overwrite the Dialog#configureShell() method as follows:

  protected void configureShell( Shell shell ) {
    super.configureShell( shell );
    // Workaround for RWT Text Size Determination
    shell.addControlListener( new ControlAdapter() {
      public void controlResized( ControlEvent e ) {
        initializeBounds();
      }
    } );
  }

Does this fix the problem?
Comment 6 Stefan Ruzitschka CLA 2011-05-04 07:10:20 EDT
This is the part from our my custom theme css:

* {
	font: 10px "Verdana", "Lucida Sans", "Arial", "Helvetica", "sans-serif";	
}

The problem happens each time I use the element.setText("") - method in handlers.
The handlers are extending the org.eclipse.core.commands.AbstractHandler and implementing the org.eclipse.ui.commands.IElementUpdater. The setText("") - method is used in the updateElement - method. This is used for the translation of the buttons:

public void updateElement(final UIElement element, @SuppressWarnings("rawtypes") final Map parameters)
{
   element.setText("");
   element.setIcon();
}

I need your help to provide a self running code example. Can someone explain it for me.
Thx
Stefan R.
Comment 7 Frank Appel CLA 2011-05-06 09:44:13 EDT
> I need your help to provide a self running code example. Can someone explain it
> for me.

Stefan, it is difficult and time consuming to reproduce problems without knowing exactly what to look for. Therefore it would be helpful if you could extract a demo bundle that reproduces the problem. Add this bundle afterwards as attachment to this bug. You may have a look at https://bugs.eclipse.org/bugs/show_bug.cgi?id=344822 as an example.

In your case I would suggest the bundle would start a simple workbench containing a custom stylesheet, the mentioned Command-/Handler-/ElementUpdater- combination and what ever is needed to reproduce your problem.

After that we are able to download this bundle, include it in our workspace, launch it and debug the problem.
Comment 8 Ivan Furnadjiev CLA 2011-12-12 05:44:02 EST
Stefan, do you have an update (test snippet/project) on this issue?
Comment 9 Stefan Ruzitschka CLA 2012-02-28 08:33:51 EST
Created attachment 211726 [details]
Demo Application

The only thing I can reproduce is the toolbar button in our views. It has the text "Unlink View" and the "w" is cut off a little bit.

Our theme.css is stored in the resources folder.

Sorry for the long time to upload the snippet.

Greetings
Stefan R.
Comment 10 Ivan Furnadjiev CLA 2012-03-21 05:52:23 EDT
(In reply to comment #9)
> The only thing I can reproduce is the toolbar button in our views. It has the
> text "Unlink View" and the "w" is cut off a little bit.
I can reproduce it too with RAP 1.5M5. Thanks for the snippet.
Comment 11 Ivan Furnadjiev CLA 2012-10-03 05:40:04 EDT
Still valid with 2.0M2.
Comment 12 Ivan Furnadjiev CLA 2014-11-24 06:52:19 EST
I can't reproduce it anymore with RAP 3.0M3. Probably it's fixed meanwhile. Please reopen if the issue persists.