Label sizes calculated wrong for some fonts on Chrome [message #1436219] |
Thu, 02 October 2014 15:17 |
|
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!");
}
}
A screen shot to help explain...
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
Re: Label sizes calculated wrong for some fonts on Chrome [message #1438634 is a reply to message #1436219] |
Mon, 06 October 2014 09:48 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
If it's reproduceable in RAP 2.3 or later, just open a bugzilla entry
with that snippet and possibly instructions how to get that font.
Greetings,
Tim
Am 02.10.2014 17:17, schrieb John Gymer:
> 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!");
> }
>
> }
>
>
> A screen shot to help explain...
>
>
> Thanks, John
>
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03174 seconds