Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Label Text Vertical Alignment Problem
Label Text Vertical Alignment Problem [message #521615] |
Thu, 18 March 2010 09:37 |
Cheney Messages: 12 Registered: March 2010 |
Junior Member |
|
|
This is a multi-part message in MIME format.
--------------080309060800070705000008
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Hi,
I am try to align some label text vertically. The text need to display
in different language, e.g English,Chinese,Japanese,Korean...
But the problem is that: The same sample code,in my computer 1, the text
layout is OK, but in my computer 2, the text layout is wrong,see attached.
The sample code as I used is below:
public class Snippet143 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
CLabel chinese = new CLabel(shell, SWT.BORDER);
chinese.setAlignment(SWT.CENTER);
chinese.setText("中文");
chinese.setBackground(display.getSystemColor(SWT.COLOR_YELLO W));
CLabel english = new CLabel(shell, SWT.BORDER);
english.setAlignment(SWT.CENTER);
english.setText("English");
english.setBackground(display.getSystemColor(SWT.COLOR_YELLO W));
CLabel japanese = new CLabel(shell, SWT.BORDER);
japanese.setAlignment(SWT.CENTER);
japanese.setText("日本語");
japanese.setBackground(display.getSystemColor(SWT.COLOR_YELL OW));
CLabel korean = new CLabel(shell, SWT.BORDER);
korean.setAlignment(SWT.CENTER);
korean.setText("한글");
korean.setBackground(display.getSystemColor(SWT.COLOR_YELLOW ));
shell.setSize(180, 200);
shell.open();
// Set up the event loop.
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
// If no more entries in event queue
display.sleep();
}
}
display.dispose();
}
}
I run the code base on org.eclipse.swt_3.5.1.v3555a.jar, and my two
computer is the same configuration:os.arch=amd64 os.name=Linux
os.version=2.6.25.5-1.1-default.
Dose anybody know what cause the problem?
Best Regards,
Cheney
--------------080309060800070705000008
Content-Type: image/png;
name="OnOS1.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="OnOS1.png"
iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAi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YgEAsYCZQM87MAT0vANDQM87MBD0vAPGoOcdGAJ63oEh oOcdGAJ63oEh
yPa8axPr1SOf4nMEavg/OIZ9SbigV1cAAAAASUVORK5CYII=
--------------080309060800070705000008
Content-Type: image/png;
name="OnOS2.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="OnOS2.png"
iVBORw0KGgoAAAANSUhEUgAAALQAAADICAYAAABBLcuIAAAAAXNSR0IArs4c 6QAAAAZiS0dE
AP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oDEgkV K1YZVPYAAAAZ
dEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAALSklEQVR42u2c fYwU5R3HvzO7
5x26AldK7kBjpPXwrQLBK9G2GusLFLS5RmttE1LQs6loQwDf6pH4BwZQrmJD fauCVmPsH1qI
AdNqmrY2jVRDfCEtVWmq8U5A0NwJd3jHwU3/2LfZudndmX3f5z6f5LKzM7sz l53P/e77PPs8
j+U4jiMXcxZ2CqDWeeePW3z3R70idyxZzqcFNU/SV6/YluM4zpyFnSmRd//3 QPKQLCu5JSWf
jN1OvDaxndjy2c48Z+a2ZGU9f9BrpTeCXmvsdTPPX9i1/M8vSe5/hpnbkuQo 8eDZTjxzkk+z
bec/f3HXir/Zbzv4tdLnL/xa8dfOOqtVkvTSM5sypLZmf+8mp2PJcr27d39W CRAaoWtN6OT2
7LbWDKlt/nmBSdjp6gxQf7y7d786lixPZWoqNJhVofkIwCSiuQ72vb1NkZMm uFqG6UbWmF2J
HYPD0ulzF8qK8LcCNSZ0kz2i/YetUCc8cqhH02dfqUikkU/XEPa99+bYngd5 ezakaWd/M9R5
Bz7fp4HP9kmSWmZemHHs07275EiKTZmuU5qnlUbo6+ZfpAXz58uybdm2Lcuy ZduWbDv+GH9u
y7as1GuW3blGR3HAOLrvWurZ4+5Wk+544OnQ5xz4fJ8e6uqUI2nVus1qaWtP yfxQ182SpBXr
NocSOmcusCwr/A/3H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/QAAAABJRU5ErkJggg==
--------------080309060800070705000008--
|
|
|
Re: Label Text Vertical Alignment Problem [message #522685 is a reply to message #521615] |
Tue, 23 March 2010 15:29 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Cheney,
I would assume that there's a different font being used in some cases
between the two machines. Try adding a listener like the one below to each
of your CLabels, and then compare the output between your two machines. Is
there a difference?
chinese.addListener(SWT.Paint, new Listener() {
public void handleEvent(Event event) {
System.out.println("----\nChinese font height: " +
event.gc.getFontMetrics().getHeight());
System.out.println("font: " +
event.gc.getFont().getFontData()[0].toString());
}
});
Grant
"Cheney Chen" <cheney_chen@i-len.com> wrote in message
news:hnss9a$n0e$1@build.eclipse.org...
> Hi,
>
> I am try to align some label text vertically. The text need to display
> in different language, e.g English,Chinese,Japanese,Korean...
>
> But the problem is that: The same sample code,in my computer 1, the text
> layout is OK, but in my computer 2, the text layout is wrong,see attached.
>
> The sample code as I used is below:
>
> public class Snippet143 {
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
> shell.setLayout(new GridLayout(1, false));
> CLabel chinese = new CLabel(shell, SWT.BORDER);
> chinese.setAlignment(SWT.CENTER);
> chinese.setText("??");
> chinese.setBackground(display.getSystemColor(SWT.COLOR_YELLO W));
>
> CLabel english = new CLabel(shell, SWT.BORDER);
> english.setAlignment(SWT.CENTER);
> english.setText("English");
> english.setBackground(display.getSystemColor(SWT.COLOR_YELLO W));
>
> CLabel japanese = new CLabel(shell, SWT.BORDER);
> japanese.setAlignment(SWT.CENTER);
> japanese.setText("???");
> japanese.setBackground(display.getSystemColor(SWT.COLOR_YELL OW));
>
> CLabel korean = new CLabel(shell, SWT.BORDER);
> korean.setAlignment(SWT.CENTER);
> korean.setText("??");
> korean.setBackground(display.getSystemColor(SWT.COLOR_YELLOW ));
>
> shell.setSize(180, 200);
> shell.open();
> // Set up the event loop.
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) {
> // If no more entries in event queue
> display.sleep();
> }
> }
> display.dispose();
> }
> }
>
>
> I run the code base on org.eclipse.swt_3.5.1.v3555a.jar, and my two
> computer is the same configuration:os.arch=amd64 os.name=Linux
> os.version=2.6.25.5-1.1-default.
>
> Dose anybody know what cause the problem?
>
> Best Regards,
> Cheney
>
------------------------------------------------------------ ----------------
----
------------------------------------------------------------ ----------------
----
|
|
| |
Re: Label Text Vertical Alignment Problem [message #522922 is a reply to message #522830] |
Wed, 24 March 2010 09:32 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Can you try setting the font for each CLabel to a font that definitely
contains the characters to be shown? My theory is that Sans does not
contain some of the chinese/japanese/korean characters you're using, and
different fonts are being automatically substituted on the two machines for
drawing them. This could be an swt problem (eg.- the wrong font metrics
being used when a font is substituted), but it would be helpful to know if
choosing fonts that don't require substitution will help your case.
Grant
"Cheney Chen" <cheney_chen@i-len.com> wrote in message
news:hocak2$dfu$1@build.eclipse.org...
> Hi Grant,
>
> Yes, your are right.Previous, the two machines' font height is not the
> same. Then I configurate the two machines as the same font, but the
> problem is still exist.
>
> The font in two machines is:
> ----
> Chinese font height: 18
> font: 1|Sans|10.0|0|GTK|1|
>
> any hints?
>
> Best Regards,
> Cheney
>
> Grant Gayed wrote:
> > Hi Cheney,
> >
> > I would assume that there's a different font being used in some cases
> > between the two machines. Try adding a listener like the one below to
each
> > of your CLabels, and then compare the output between your two machines.
Is
> > there a difference?
> >
> > chinese.addListener(SWT.Paint, new Listener() {
> > public void handleEvent(Event event) {
> > System.out.println("----\nChinese font height: " +
> > event.gc.getFontMetrics().getHeight());
> > System.out.println("font: " +
> > event.gc.getFont().getFontData()[0].toString());
> > }
> > });
> >
> > Grant
> >
|
|
|
Goto Forum:
Current Time: Thu Dec 26 11:20:11 GMT 2024
Powered by FUDForum. Page generated in 0.03746 seconds
|