PDA

View Full Version : Platform independent GUI



bnilsson
18th June 2009, 17:08
I am sure this question must have been handled may times, but I have not found any answer in the forum.

What is the best way to get a platform independent GUI regarding font size, if you have a lack of real estate?
If I design by Windows Designer the Mac GUI will show label and button fonts too big to suit my layout, and vice versa if I design on Mac they will be too small if I view the resulting GUI on Windows.
Also, i.e. Arial 12 does not have the same size, on Windows it is really big, on Mac it is small.
Is there any font that will have a platform independent size?

Any hints for a strategy?
Except having completely different ui files for Mac and Windows, which will be a mess to maintain.

BN

nakkore
1st July 2009, 17:51
Very often interesting question has no answer, i'm investigating for the same issue...

wysota
1st July 2009, 21:15
Qt uses sensible defaults so if you don't modify the fonts in the ui files from their defaults, the output should look sensible on all platforms.

nakkore
2nd July 2009, 09:32
It's not exactly like this.
On Windows if you put in the designer a label on a widget it takes
, by default, point size 8 and Ms Shell Dlg 2 and the surrounding rect has about width 46 , height 14 with text "TextLabel".
On Mac the same label, by default, has point size 13 and Lucida Grande and the surrounding rect has about width 61 height 17.
So it looks quite different and using the defaults does not solve the problem.
Besides, if on Windows you set the font size to , for example, 11 it renders of course quite bigger than 8 on Windows but on Mac where the default is 13 it renders still smaller!!!.

wysota
2nd July 2009, 10:01
It's not exactly like this.
On Windows if you put in the designer a label on a widget it takes
, by default, point size 8 and Ms Shell Dlg 2 and the surrounding rect has about width 46 , height 14 with text "TextLabel".
On Mac the same label, by default, has point size 13 and Lucida Grande and the surrounding rect has about width 61 height 17.
So it looks quite different and using the defaults does not solve the problem.
Besides, if on Windows you set the font size to , for example, 11 it renders of course quite bigger than 8 on Windows but on Mac where the default is 13 it renders still smaller!!!.

I didn't say the size in milimetres (or any other unit) would be the same. I said it will look sensibly alright on all platforms, not the same on all platforms (and resolutions). You can change the defaults for each of the platform by manipulating configuration files, if you need that. Run the qtconfig program if you have it and play with it.

nakkore
2nd July 2009, 14:01
Wysota,
i can understand your point of view about "sensibly alright" but to deliver the application it's not enough and if you do not face the problem directly it's not enough say "use qtconfig"..
to do what ? if i use qtconfig to alter the defaults (but anyway i do not want to change defaults) all qt applications change their defaults isn't it ? i just want my application handles fonts in a consistent way across platforms so that it's not necessary to hack the code or the ui to obtain these results. This was the initial question that still has no answer.

wysota
2nd July 2009, 14:15
If you don't want to change the system defaults then don't. Modify font settings for your application and that's it (QApplication::setFont()). I really don't see the problem :)

ntp
27th August 2009, 23:05
I think the issue here is that what people (including myself) are trying to do if to find a font and size that will look the same across platforms. I am applying stylesheets to get my look and feel and, as part of that, I have to set a font and size. I agree that arial 12 looks very different on mac and windows. In addition there are quirks using Arial. For example, the word "down" on windows looks fine but on mac looks like "dow n". Users on mac assume that this is a typo when it isn't.

Has anyone found a font and size that looks the same (or at least really close) across platforms?

wysota
28th August 2009, 00:31
Has anyone found a font and size that looks the same (or at least really close) across platforms?

That's not enough. If a user has poor eye-sight and increased the font size in system settings to let's say 24px and you force a 12px font in your application I assure you the user won't be satisfied regardless of the platform and font family. If you're interested in your users feeling good with your application, force as few things as possible - let the user choose the font he likes best, not the one you like best.

microwaveman
24th November 2009, 12:11
I agree, but then why can I not find a way to set a default label font size in Qt Designer, for example?

wysota
24th November 2009, 14:49
Because the default label font is QApplication::font().

bunjee
24th November 2009, 15:00
That's not enough. If a user has poor eye-sight and increased the font size in system settings to let's say 24px and you force a 12px font in your application I assure you the user won't be satisfied regardless of the platform and font family. If you're interested in your users feeling good with your application, force as few things as possible - let the user choose the font he likes best, not the one you like best.

That's a point, but I wouldn't say that's the single best option.
From my perspective, letting the user dictate the graphical behavior of an app can be a double edged sword, since it might be a trade-off between clarity and ergonomic.

That philosophy comes from the received idea that the OS should dictate the look and feel of an application. As a result many apps are still using some old rusty OS specific widgets while the web apps uses CSS, vectorial graphics and makes us look last century.

If you let the user control the look and feel, you're giving him a tool for messing up the whole user experience.
If a "forced" graphic choice is made for the sake of simplicity and ergonomic it's a good choice.

wysota
24th November 2009, 17:11
From my perspective, letting the user dictate the graphical behavior of an app can be a double edged sword, since it might be a trade-off between clarity and ergonomic.
That's the user's choice, don't you think?


That philosophy comes from the received idea that the OS should dictate the look and feel of an application. As a result many apps are still using some old rusty OS specific widgets while the web apps uses CSS, vectorial graphics and makes us look last century.
...thus upgrading the way the OS draws those rusty widgets will upgrade the looks of all applications. Do you think web browsers shouldn't have a default font and default styles set up? If you had to do everything from scratch and at the same time embed some application into another (like a google gadget into a webpage) the embedded part would stand out which probably wouldn't look good. You need to have standards and you need to obey them. If the standards are old - upgrade the standards instead of abandoning them.


If you let the user control the look and feel, you're giving him a tool for messing up the whole user experience.
If a "forced" graphic choice is made for the sake of simplicity and ergonomic it's a good choice.

You are contradicting yourself. Forced graphic choice would mean no CSS (i.e. the producer of a web browser says "all webpages should look like this for sake of simplicity and ergonomy") and yet you say we should use CSS to get rid of old rusty graphics. My opinion is that you should always find a "golden division" - so that both sides are satisfied. Otherwise you would ruin a fragile balance. If you allow too many changes, you may frighten your users but if you limit the changes too much, you may reduce your target audience. So why not have two modes - simplified (or default) where everything is set up the way the author likes and advanced (or customized) when it is set up the way the user likes.

Can you honestly say you know what is best for all of your potential users? There is a company in Redmond that used to act like that...

bunjee
24th November 2009, 20:57
That's the user's choice, don't you think?

I don't share that.


...thus upgrading the way the OS draws those rusty widgets will upgrade the looks of all applications. Do you think web browsers shouldn't have a default font and default styles set up? If you had to do everything from scratch and at the same time embed some application into another (like a google gadget into a webpage) the embedded part would stand out which probably wouldn't look good. You need to have standards and you need to obey them. If the standards are old - upgrade the standards instead of abandoning them.

I don't like the idea of the application being tied to the OS. I admit you must "obey" standards.
For instance, if an OS has a glossy window frame by default, just put the glossy window by default. As for the content of the window itself, one could be able to choose what's best for the user.
I honestly think the standards you're talking about are a key reason to the lack of innovation in the application field.

About CSS I'm saying that it bypasses the native uglyness of the HTML to make it look appealing and in "some" cases user friendly.


Can you honestly say you know what is best for all of your potential users? There is a company in Redmond that used to act like that...

Two things:
First, that Redmond company you're talking about is 90% of the market, so if we talk about users, let's talk about Microsoft.
At the same time, the lack of innovation I was talking before is tied to that.

Second, I'm not sure I know what's best for users, but I'm sure they don't know what's best for them.

wysota
24th November 2009, 22:43
About CSS I'm saying that it bypasses the native uglyness of the HTML to make it look appealing and in "some" cases user friendly.
CSS is part of HTML since like.... 9 years and 11 months now?


First, that Redmond company you're talking about is 90% of the market,
Which means they don't do mistakes or that they don't learn on their mistakes? Because I don't see your point...


Second, I'm not sure I know what's best for users, but I'm sure they don't know what's best for them.
That's why you provide defaults and let them modify the configuration. If you provide a 10 or 12pt font as the only choice for your application, you immediately stop many people with disabilities or big screens from using your app. Imagine what would happen if you couldn't have changed the default font in Windows, because some programmer in Redmond thought "he knew better". That's also why in most schools in Poland (and I assume not only here) in "Computer Science" class children are taught how to use Notepad and Word, because someone "up there" knows what's best for them (hey, why learn something useful, let's learn how to underline a sentence in Word!). That's the same reason why there is a single application (Windows only) available in Poland which is an obligatory way of sending data to the tax office for even small companies - because someone knew better. You would probably find similarities in your country if you looked for them.

bunjee
25th November 2009, 10:04
Which means they don't do mistakes or that they don't learn on their mistakes? Because I don't see your point...

There is a lot of bad things about Microsoft. I wouldn't say their UI is part of them.


That's why you provide defaults and let them modify the configuration. If you provide a 10 or 12pt font as the only choice for your application, you immediately stop many people with disabilities or big screens from using your app. Imagine what would happen if you couldn't have changed the default font in Windows, because some programmer in Redmond thought "he knew better". That's also why in most schools in Poland (and I assume not only here) in "Computer Science" class children are taught how to use Notepad and Word, because someone "up there" knows what's best for them (hey, why learn something useful, let's learn how to underline a sentence in Word!). That's the same reason why there is a single application (Windows only) available in Poland which is an obligatory way of sending data to the tax office for even small companies - because someone knew better. You would probably find similarities in your country if you looked for them.

Indeed, these childrens are lucky they could have a course about Open Office.

Ahhh... The font size argument, very effective emotionally since it brings your grandparents into the equation :-).
Well let's say you're right for the font, it's convenient to be able to change the font or to adapt to the default desktop's font.

Aside from this, everytime you give a choice to the user, you give him a chance to screw up the experience. It's better to intend creating the very best user experience than skipping it for the sake of "I can customize it anyway".

The default and customize approach you talked about gives the user 50% chances of making a bad choice for him.

Someone said: the biggest problem for human being is: "life gave us choice".

It's almost a biblical image, Adam wanted to be 100% free, even in his knowledge of good and evil. If you can prevent the user from biting the apple, would you do it ?

I see an application as one's vision of what's best to solve a problem in a humainized way. By essence the GUI is a tradeof between possibilities and accessibility, it's a form of art.
It's your proposal to solve a problem, you cannot be every proposal at the same time.

A very good example of that is the situation on Linux.
A lot of people can customize (and screw up in the process) their user experience.
All of this just for the sake of coolness and being free.

I'm sorry, but I'll stay away from that apple.

wysota
25th November 2009, 10:33
There is a lot of bad things about Microsoft. I wouldn't say their UI is part of them.
I didn't say that. I said Microsoft used to act like they knew better what their users wanted. Fortunately it seems they stopped doing that some time ago.


Indeed, these childrens are lucky they could have a course about Open Office.
They could also have a course on Computer Science, as written in the course name. I don't think the only alternative to teaching Word is teaching another text writing software which children most often know better how to handle than their teachers. To me it would seem Computer Science should be more involved into "how this thing works".


Ahhh... The font size argument, very effective emotionally since it brings your grandparents into the equation :-).
I don't think I got that... I had a friend in high school who was almost blind and he had to have very large fonts and very high contrast of the UI (black and white only in practise) to be able to see anything on the screen. And now who looks stupid? Certainly not my grandparents.


Aside from this, everytime you give a choice to the user, you give him a chance to screw up the experience.
His choice. He might as well improve the experience. Odds are the same both ways. This is what we call Freedom.


It's better to intend creating the very best user experience than skipping it for the sake of "I can customize it anyway".
You can create what you think is best for the users and then let them decide if you were right. You don't have to force them to see your point of view.


The default and customize approach you talked about gives the user 50% chances of making a bad choice for him.
And 50% chances of making a good choice.


Someone said: the biggest problem for human being is: "life gave us choice".
Someone said "640kB of memory will be sufficient for everyone". People say many stupid things.


It's almost a biblical image, Adam wanted to be 100% free, even in his knowledge of good and evil. If you can prevent the user from biting the apple, would you do it ?
Yet, God gave us free will. If God prevented Adam from going astray, Adam would merely be a puppet in the hand of its Creator. Do you want your users to be such puppets? I know I don't - this is something that kills innovation you have brought up earlier.


I see an application as one's vision of what's best to solve a problem in a humainized way. By essence the GUI is a tradeof between possibilities and accessibility, it's a form of art.
Art is subjective. If you think of your UI as art, make a screenshot and post it on your website. But let others make different screenshots. UI is not to be looked at, it is to be used.


A lot of people can customize (and screw up in the process) their user experience.
All of this just for the sake of coolness and being free.
A lot of people can customize sucessfully their user experience. All of this just for sake of usability. And many others stay with default settings happy they don't have to do anything. Both parties are satisfied. If you don't know how to do something and you're not willing to learn - then don't do it. Simple as that.


I'm sorry, but I'll stay away from that apple.
That's your choice. Would you be happy if someone told you you had to do it?

bunjee
25th November 2009, 23:14
I didn't say that. I said Microsoft used to act like they knew better what their users wanted. Fortunately it seems they stopped doing that some time ago.


Last time I checked Office 2007 wasn't customizable.


They could also have a course on Computer Science, as written in the course name. I don't think the only alternative to teaching Word is teaching another text writing software which children most often know better how to handle than their teachers. To me it would seem Computer Science should be more involved into "how this thing works".

I have no oppinion on this topic. Aside from the fact that a generic computer science makes no sense to me. It's all about specializing.


I don't think I got that... I had a friend in high school who was almost blind and he had to have very large fonts and very high contrast of the UI (black and white only in practise) to be able to see anything on the screen. And now who looks stupid? Certainly not my grandparents.

From my perspective that's the OS task with the accessibility options.


His choice. He might as well improve the experience. Odds are the same both ways. This is what we call Freedom.

Sounds like the latest Linux campaign.


You can create what you think is best for the users and then let them decide if you were right. You don't have to force them to see your point of view.

You can do that.


And 50% chances of making a good choice.

True. Still those 50% making a wrong choice are disturbing me.


Someone said "640kB of memory will be sufficient for everyone". People say many stupid things.

I suggest taking a look at this : http://www.ted.com/talks/barry_schwartz_on_the_paradox_of_choice.html


Yet, God gave us free will. If God prevented Adam from going astray, Adam would merely be a puppet in the hand of its Creator.

I agree 100%, we've found one agreement.


Do you want your users to be such puppets? I know I don't

I don't want users to be my puppets.
I think, if you sail on a boat, you should trust the captain.

We should stop blaming ourselves for keeping the user away from customizing and start learning what they really need.


- this is something that kills innovation you have brought up earlier.

Indeed it doesn't.
If you don't share my view, go program another equivalent application.
It happens quite a lot : take a look a google chrome, if Firefox was the ultimate open ended browser why would google care about doing another one ?

In some cases, I even think the opposite.
Targeting something to be the ultimate application for everyone ultimately kills creativity since no one will try something else.

Why wouldn't we do something that fits 100% the expectations of 10 users, before hurting ourselves thinking about 100 others that might not like the background color.

Doing a great application that we would use ourselves is a good start.


Art is subjective. If you think of your UI as art, make a screenshot and post it on your website. But let others make different screenshots. UI is not to be looked at, it is to be used.

Linus Torvald said on an interview:
"Programming is poetry".

The ultimate paradox pragmatic coders are facing is the fact that ultimately they are contributing to a greater picture we're drawing together.

All of this is no perfect science, look at all the bugs around us ?

Now what if the bugs could turn into features ? What if all those imprecision came together and became something poetic, artistic.

No, really, coding is an art form.


A lot of people can customize sucessfully their user experience. All of this just for sake of usability. And many others stay with default settings happy they don't have to do anything. Both parties are satisfied. If you don't know how to do something and you're not willing to learn - then don't do it. Simple as that.

I see that differently.
My end users don't want to be aware about customizing.
All they care about is have an application answering their need.

As for changing the look and feel, it's on the programming side.


That's your choice. Would you be happy if someone told you you had to do it?

Nobody forces you to use a given application.
Either share captain's vision on how to solve a problem or switch to another boat.

wysota
26th November 2009, 00:47
Last time I checked Office 2007 wasn't customizable.
Last time I checked Office 2007 was not the only application released by Microsoft.


I have no oppinion on this topic. Aside from the fact that a generic computer science makes no sense to me. It's all about specializing.
Yes, specialization is especially good for 10 year old children.


From my perspective that's the OS task with the accessibility options.
I don't know how you want the OS to intervene if you force a 12pt font, force colours, etc. Accessibility needs to be handled by applications too, you know. QAccessible (and family) is not there just to increase the number of Qt classes so that Nokia can brag about it during Developer Days.


Sounds like the latest Linux campaign.
You got me lost here... I don't see your point.


You can do that.
I know I can :) I'm offering that option to you.


True. Still those 50% making a wrong choice are disturbing me.
I see. Out of 6 billion people half of them are "bad", so let's nuke the other half as well... That's a good point of view indeed.



I suggest taking a look at this : http://www.ted.com/talks/barry_schwartz_on_the_paradox_of_choice.html
Again, people say stupid things. It's obvious that the welfare of individual doesn't go in line with welfare of masses. But this is a different case - what one of users of your app does doesn't influence others. Modern world tends to go for personalization but of course you are free to do otherwise.


I don't want users to be my puppets.
But you want to make decisions for your users... That certainly makes a lot of sense.


I think, if you sail on a boat, you should trust the captain.
If you cosider yourself a leader of your users, chosen or designated based on your skills certified by other trusted leaders of the domain in question then this case might apply here. But even a captain on a boat can be replaced by his first officer if he's incapable of doing his job. And it is the responsibility and privilege of his officers to decide on that.


We should stop blaming ourselves for keeping the user away from customizing and start learning what they really need.
You won't learn if you don't let them tell you what they (think they) need.



If you don't share my view, go program another equivalent application.
This would be a good argument if all your users were software developers.


It happens quite a lot : take a look a google chrome, if Firefox was the ultimate open ended browser why would google care about doing another one ?
Answer to that is obvious. Why does google do anything? Certainly not for fame and glory.


Targeting something to be the ultimate application for everyone ultimately kills creativity since no one will try something else.
No one will try anything else if you keep telling them it's not possible to do what they want because this way it's better.


Why wouldn't we do something that fits 100% the expectations of 10 users, before hurting ourselves thinking about 100 others that might not like the background color.
If you like 9% of your customers being happy and 91% of them unhappy there is a chance you will lose those 91%. Considering the fact that you can rarely find software that has development costs lower than 9% of its final price you are likely to fall out of business. Remember we're not talking only about colours here but choice in general.


Doing a great application that we would use ourselves is a good start.
Believe me - not really :) Unless you are writing software for people like you, of course.


Linus Torvald said on an interview:
"Programming is poetry".

The ultimate paradox pragmatic coders are facing is the fact that ultimately they are contributing to a greater picture we're drawing together.
Yes, these things do look nice in interviews... Too bad reality is different.



My end users don't want to be aware about customizing.
All they care about is have an application answering their need.
If you are targeting a particular group of people, designing and implementing software tailored for this particular group of people then that's perfectly understandable. But if you will try to sell the same piece of software to a different group of people (company?) working in the same domain, you will notice their expectations are a bit different than those of the first group. Adjusting the software to the needs of this second group means either making the first group dissatisfied or maintaining two different lines of the same product which is a pain in the neck at least.


Nobody forces you to use a given application.
That's a very nice thought but unfortunately in many cases it is plain wrong. In many cases you are forced to use a particular application/solution/system by external conditions.

bunjee
26th November 2009, 09:22
I see your point, you see my point.

Let's cut the "endless" debate here.

Indeed we might both be right.
We both have strong reasons and examples. So I guess it's a balance to find on a day per day basis.

Beside, it's obvious you're more the scientific kind, I'm more the artistic kind. Luckiliy I happen to think we need both.

Interesting topic, let's shake hands :).

wysota
26th November 2009, 09:53
One final question - do you use layouts in your applications?

nish
26th November 2009, 12:46
Ahh... no one wins from this man..

bunjee
26th November 2009, 13:53
One final question - do you use layouts in your applications?

I do.

(10 characters long)

ubuntudevelop78
26th November 2009, 14:17
I am sure this question must have been handled may times, but I have not found any answer in the forum.

What is the best way to get a platform independent GUI regarding font size, if you have a lack of real estate?
If I design by Windows Designer the Mac GUI will show label and button fonts too big to suit my layout, and vice versa if I design on Mac they will be too small if I view the resulting GUI on Windows.
Also, i.e. Arial 12 does not have the same size, on Windows it is really big, on Mac it is small.
Is there any font that will have a platform independent size?

Any hints for a strategy?
Except having completely different ui files for Mac and Windows, which will be a mess to maintain.

BN

Why not using images or pixmaps with text?, or font metrics, I didn't use it but maybe it could help you.

wysota
26th November 2009, 15:18
I do.
Why?


(10 characters long)
Ditto.

bunjee
26th November 2009, 17:06
One word, convenience.

wysota
26th November 2009, 17:11
Isn't it more convenient not to use it? Simply position widgets on the form and voilla?

bunjee
26th November 2009, 17:34
It's simpler to do :


layout->addWidget(myWidget);

than


myWidget->move(posX, posY);

wysota
26th November 2009, 20:05
It's simpler to run Designer and setup everything there.

bunjee
26th November 2009, 20:06
There is another thing you're not going to like : I never use Qt Designer.

:-).

wysota
26th November 2009, 21:39
Which is strange considering everything you said earlier. Another question in that case - do you allow your users to resize windows of your applications and why?

john_god
26th November 2009, 21:52
Regarding the font size I also notice that size is different in KDE from Gnome, also the lineedit boxes are very smaller in KDE, than in Gnome. I also had problems whit translation. Some setences can become bigger in different languages so in portuguese, my labels where "cutting" the words. I had to enlarge the size of the labels in the Qtdesigner. I'll have to check if there's a way to get the size of the text ant set the label size based on that

squidge
26th November 2009, 21:55
I'd be lost without layouts. I can't be bothered to find out the exact pixel co-ordinates to set all the widgets to, it's far easier to throw in some layout components and let Qt do all the work for me.

squidge
26th November 2009, 21:57
I'll have to check if there's a way to get the size of the text ant set the label size based on thatQFontMetrics ?

john_god
26th November 2009, 22:08
Thanks I'll check that.

Also I use a lot layouts, they are very usefull.

wysota
26th November 2009, 22:52
Some setences can become bigger in different languages so in portuguese, my labels where "cutting" the words. I had to enlarge the size of the labels in the Qtdesigner.

The only explanation for this is that you didn't use layouts properly or you encountered a known bug (or misfeature) in QLabel related to word wrapping. But if you have word wrapping disabled, you're certainly using layouts incorrectly.

bunjee
27th November 2009, 10:28
Which is strange considering everything you said earlier. Another question in that case - do you allow your users to resize windows of your applications and why?

I tend to limit window resizing to when it's needed. If an application doesn't need to be resized, just don't make that option available.

Again, if resizing a window gives the user a way to screw up the interface, it's not good.

john_god
28th November 2009, 00:11
The only explanation for this is that you didn't use layouts properly or you encountered a known bug (or misfeature) in QLabel related to word wrapping. But if you have word wrapping disabled, you're certainly using layouts incorrectly.

There's another explanation, it was late, I was tired and sleppy when I wrote the post, because I have layouts in the main window but not in that particulary dialog :p ... I need vacations...........

wysota
28th November 2009, 08:51
So you were not using layouts properly :)

john_god
28th November 2009, 11:00
Nop......

But last night after posting I start reading again chapter 1 and 2 of "C++ GUI Programming with Qt4".

AH...... What a great book :cool: (thinking out loud: it will never stop amazing me with my ignorance) :p