ETO differences Windows-Mac

After starting debugging a plugin under macOS, I realised how different can eto UI look like on different platform. After some work, there are still one-two problems that I cannot fix, no matter what.

First example Window sizes (solved)
All my windows are correctly sized on Windows, but look like having a supplementary margin on MacOS (see the two following pictures). This happends on all of my windows (they herit Eto.Forms.Form).


For these forms, I have already locked their size, bounds and set their padding to 0. Are there any margin (or other) parameters that I am missing anywhere ?

Second example text size
On some labels, and the one above is a good example, I have a big inconsistencies on the output size of a text. Although I have blocked many parameters (see code below) :

public Label welcomeMessage = new Label()
    {
        Text = "Welcome by [...] plugin for Rhino. \n" +
            "This plugin will help you interpret a geometry for further energy modelling. \n" +
            "As a first step, please import the csv database file exported by [...] for your project.",
        Font = new Eto.Drawing.Font(SystemFont.Default,10,FontDecoration.None),
        TextAlignment = TextAlignment.Left
    };

Congratulations
Finally I must say that ALL the rest of the plugin is working perfectly well on macOS, althought we developed 100% on Windows. Aside from this problem, it was very few efforts to have this working : congratulations and thanks to thoses behind this. :slight_smile:

I have part of the solution for those who are interested. In your class inherited from Form (I didn’t test the others), instead of changing the Size parameter, change the clientSize of the parentWindow :

        ParentWindow.ClientSize = new Eto.Drawing.Size(575,120);

This will give the same window size on both Windows and macOS. I couldn’t get any satisfying documentation of the structure behind these windows/parents/client and so on, but this works (almost no idea why). If someone has a good documentation, a share would be much appreciated.

And if someone has an idea on why are the font sizes for Labels so different on Windows and macOS, please inform here.

For having text-sizes homogeneous on all plateform, I’m trying to use the attribute PointsPerPixel proposed by Eto.

I’m struggling with a detail :
There is no way I can fin anything in Eto.Drawing.Graphics. It is completely empty. (see figure under).
image

Whereas I can see everything in the Object browser (in Solution Explorer : References > Eto). I’m wondering if I’m missing something basic or if there is a bug here.

Help would be much appreciated !

@curtisw, can you jump in here?

No idea of what ETO does under the hood, but I’ve had problems developing cross platform apps in the past when Mac laptops had a higher DPI, maybe that is the problem?

On Windows, Eto uses WPF. On the Mac, Eto uses Cocoa.

– Dale

Hi @em.rudelle, yes setting the ClientSize is one solution here as each platform does have differences in all control sizes.

What I recommend with Eto.Forms is to only set padding/spacing/sizes for the controls themselves when necessary, and let the form auto size. For example if you remove the line setting the ClientSize, then simply set the width of the TextBox to the desired size (not the height, it’s different).

As for the font size, it is different on macOS and Windows as the base DPI is different (72 on macOS and 96 on Windows). The size is in points, which you can use Screen.Scale to calculate the points per pixel size.

Hope this helps!

All this functionned correctly indeed. Thanks for your help !

Little precision : I had to force the use of the same font on macOS and Windows instead of using the default one. Indeed, macOS and windows have very different default font on their system, and at the same size, macOS ones looked much massiver and bigger.

Final result is the following :

button.Font = new Eto.Drawing.Font("Arial", (float) 11.6 / Screen.PrimaryScreen.Scale,Eto.Drawing.FontStyle.None,Eto.Drawing.FontDecoration.None);
1 Like