Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Label sizes calculated wrong for some fonts on Chrome(Bauhaus 93 on Chrome gets wrong size Label)
Label sizes calculated wrong for some fonts on Chrome [message #1436219] Thu, 02 October 2014 11:17 Go to next message
Eclipse UserFriend
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...
index.php/fa/19363/0/

Thanks, John
Re: Label sizes calculated wrong for some fonts on Chrome [message #1438634 is a reply to message #1436219] Mon, 06 October 2014 05:48 Go to previous messageGo to next message
Eclipse UserFriend
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/
Re: Label sizes calculated wrong for some fonts on Chrome [message #1438648 is a reply to message #1436219] Mon, 06 October 2014 06:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
It's reproducible for me with RAP from master. Only in IE11 the size of
the label is correct. In Firefox, Chrome and Opera the label is cut-off.
The "Bauhaus 93" font exists in my Windows 7 x64 installation. I have no
idea what's wrong with this font. Please open a bugzilla about this issue.
Thanks,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Label sizes calculated wrong for some fonts on Chrome [message #1443781 is a reply to message #1436219] Mon, 13 October 2014 03:50 Go to previous message
Eclipse UserFriend
The issue is fixed in master with change https://git.eclipse.org/r/34649.

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Clipboard
Next Topic:RAP 2.3.1 - Application crashes when Button is clicked on Shell fadeOut
Goto Forum:
  


Current Time: Sun Jul 27 08:10:18 EDT 2025

Powered by FUDForum. Page generated in 0.26336 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top