Bug 289270 - All dialogs are too wide on many Japanese Windows systems
Summary: All dialogs are too wide on many Japanese Windows systems
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-11 19:22 EDT by Mike Morearty CLA
Modified: 2019-09-06 16:11 EDT (History)
0 users

See Also:


Attachments
screenshot 1 (86.57 KB, image/png)
2009-09-11 19:23 EDT, Mike Morearty CLA
no flags Details
screenshot 2 (214.55 KB, image/jpeg)
2009-09-11 19:26 EDT, Mike Morearty CLA
no flags Details
screenshot 3 (229.66 KB, image/jpeg)
2009-09-11 19:26 EDT, Mike Morearty CLA
no flags Details
screenshot 4 (165.78 KB, image/jpeg)
2009-09-11 19:27 EDT, Mike Morearty CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Morearty CLA 2009-09-11 19:22:38 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: 20090619-0625

Notice that the buttons and dialogs in the attached screenshots are all very wide.  On Japanese Vista, the font used in dialogs is called "メイリオ" (I know, that comes out displayed in the bugbase as a bunch of HTML entities -- oh well). That font reports its average character width as 12 pixels, which is twice as wide as the font used in English Vista.

Eclipse relies heavily on the average character width as an important metric in deciding how to lay out all dialogs.

See http://support.microsoft.com/kb/145994 for the description of how to calculate the size of "Dialog Units", which is what Microsoft recommends as the unit to use in setting the size of dialogs and controls.  Of course, I realize that switching entirely to dialog units would be an enormous and unacceptable change for Eclipse; but perhaps you could, instead of relying on average character width, rely on something that is somehow related to dialog units.

Also see bug 284205, which is related but is not the same issue.

Reproducible: Always

Steps to Reproduce:
1. Install Eclipse on Japanese Vista
2. Bring up any dialog
Comment 1 Mike Morearty CLA 2009-09-11 19:23:42 EDT
Created attachment 147013 [details]
screenshot 1
Comment 2 Mike Morearty CLA 2009-09-11 19:26:35 EDT
Created attachment 147014 [details]
screenshot 2
Comment 3 Mike Morearty CLA 2009-09-11 19:26:47 EDT
Created attachment 147015 [details]
screenshot 3
Comment 4 Mike Morearty CLA 2009-09-11 19:27:00 EDT
Created attachment 147016 [details]
screenshot 4
Comment 5 Prakash Rangaraj CLA 2009-09-15 02:12:56 EDT
Does this happen on simple SWT snippets as well?(http://www.eclipse.org/swt/snippets/) Or only in Eclipse IDE?
Comment 6 Mike Morearty CLA 2009-09-15 15:32:52 EDT
It doesn't reproduce with bare SWT snippets, but it should reproduce with bare SWT+JFace apps, because the actual problematic code is in JFace -- e.g. this code in org.eclipse.jface.dialogs.Dialog:

    public static int convertHorizontalDLUsToPixels(FontMetrics fontMetrics,
            int dlus) {
        // round to the nearest pixel
        return (fontMetrics.getAverageCharWidth() * dlus + HORIZONTAL_DIALOG_UNIT_PER_CHAR / 2)
                / HORIZONTAL_DIALOG_UNIT_PER_CHAR;
    }

That code looks good, and is consistent with the first part of the "More Information" section of http://support.microsoft.com/kb/145994 .  I am not quite sure what's going on here -- not sure if perhaps Eclipse is not using the default system font (I bring that up because the Microsoft page goes on to say, "However, if you aren't using the system font, you need to do some additional calculations to get the right coordinates. Here are two methods...").

Bottom line, I'm not really sure what the solution is here.  Eclipse is the only app I've seen on Japanese Vista that has this problem, so that leads me to think that Eclipse needs to change somehow, but like I said, the above code appears to be correct to me, so I don't know.
Comment 7 Susan McCourt CLA 2009-09-16 12:37:42 EDT
> Notice that the buttons and dialogs in the attached screenshots are all very
> wide.  On Japanese Vista, the font used in dialogs is called
> "メイリオ" (I know, that comes out displayed in the
> bugbase as a bunch of HTML entities -- oh well). That font reports its average
> character width as 12 pixels, which is twice as wide as the font used in
> English Vista.

I think the wide font is the crux of the problem.  
Eclipse uses dialog units/character widths extensively for layout.  (The only difference between the two is that dialog units are a fraction of character widths).  The net effect is the same...if the font is extremely wide, and character widths are used to compute dialog sizes, then you get wide dialogs.  So a "30 character wide" wizard in English with a small font looks good, in a very wide font, it looks wide.  

SWT snippets may or may not exhibit the problem, depending on the nature of the layout used.  Any snippet that uses dialog units or character widths to compute sizes would exhibit the problem.  Using pixels or platform default sizes would get different results.  However, using pixels leads to the opposite problem:  truncation.

Bottom line is that the font is simply too wide.  Can you try changing the JFace dialog font in the preferences to something smaller and see if you get better results?  We use properties files to manage the default font for various NL platforms, it may be that we need to ensure a smaller font is used.
Comment 8 Eclipse Webmaster CLA 2019-09-06 16:11:49 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.