| Summary: | Label sizes calculated wrong for some fonts on Chrome | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | John Gymer <jgymer> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ivan, rsternberg |
| Version: | 2.3 | ||
| Target Milestone: | 3.0 M3 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | sr232 | ||
Strange... if you add another dummy empty label the measurement is correct. Still under investigation why the client measure the size of this element wrong. Actually, the issue is related to fonts with spaces in their names. There is a bug in FontSizeCalculation.js#_measureItem where the array with font names sent by the server is not correctly converted to valid CSS font family. Pending change - https://git.eclipse.org/r/#/c/34649/. Fixed in master with change – https://git.eclipse.org/r/#/c/34649/. +1 for backporting to 2.3.2 Backported to 2.3-maintenance branch with change https://git.eclipse.org/r/40523 |
RAP appears to calculate the width/height of a Label incorrectly on Chrome (37) for certain fonts. I used "Bauhaus 93" font, and for an instance the Label displays the full text, then after a momentary delay, it shrinks the size of the Label hiding the last word of text in the Label as a consequence. Here is a snippet: /* DEMONSTRATES RAP issue with unusual font sizes/styles - label not big enough */ package bug.snippet; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class Bugsy { private Display display; private Shell shell; private static Label lab; public void begin() { System.out.println("BugSnippy Starting..."); // create the Shell display = new Display(); shell = new Shell(display, SWT.TITLE|SWT.CLOSE|SWT.RESIZE); shell.setText("Shell"); shell.setFullScreen(true); shell.setBackground(new Color(null, new RGB(255,192,255))); FormLayout layout = new FormLayout(); shell.setLayout(layout); //create the label lab = new Label(shell, SWT.NONE); lab.setText("Wonderful stuff is great and fab"); FontData fontData; fontData = new FontData(); fontData.setName("Bauhaus 93"); fontData.setStyle(SWT.NONE); fontData.setHeight(20); Font font = new Font(display, fontData); lab.setFont(font); //set label's position FormData fd = new FormData(); fd.left = new FormAttachment(0, 5); fd.top = new FormAttachment(0, 50); lab.setLayoutData(fd); shell.open(); System.out.println("BugSnippy Done!"); } } See forum issue for screen shot: https://www.eclipse.org/forums/index.php?t=msg&th=823251& Specific to Chrome and Bauhau93 font! Thanks, John