Which font for all platforms? [message #492753] |
Wed, 21 October 2009 11:08  |
Eclipse User |
|
|
|
Hi there,
How do I correctly enter a font name that is platform independent? I
want to set a font explicitly such that it is correct for all platforms
Windows/Linux/Mac.
So what is a platform independent font?
If I do not set any font at all, the different platforms use different
default fonts (Windows=Tahoma, Linux=Sans, Mac=Lucida). Is there any way
to get the same font for different platforms?
What's the right way to do it?
Cheers,
Hauke
|
|
|
Re: Which font for all platforms? [message #492966 is a reply to message #492753] |
Thu, 22 October 2009 10:14   |
Eclipse User |
|
|
|
Hi Hauke,
Of course the first standard question is, are you sure you want to do this?
The fonts that are used by default on the various platforms come from the
OS, and should generally be used by apps in order to appear visually
consistent with other native apps. Additionally, some users may have
specifically changed these default fonts in their OS, either for aestetics
or for practical reasons (eg.- accessibility).
That being said, if you still want to do this, you'll just need to find a
font that you like that's commonly-available. All you need is a common face
name, then use Device.getFontList(...) to get the available sizes. There
are many available fonts in common between my Windows 2000 and OSX 10.5
machines: Arial, Comic Sans MS, Courier, Courier New, Georgia, Impact,
others... However when I also look at RHEL4 the only one I see in common is
Courier.
HTH,
Grant
"Hauke Fuhrmann" <haf@informatik.uni-kiel.de> wrote in message
news:hbn85f$3d9$1@build.eclipse.org...
> Hi there,
>
> How do I correctly enter a font name that is platform independent? I
> want to set a font explicitly such that it is correct for all platforms
> Windows/Linux/Mac.
>
> So what is a platform independent font?
>
> If I do not set any font at all, the different platforms use different
> default fonts (Windows=Tahoma, Linux=Sans, Mac=Lucida). Is there any way
> to get the same font for different platforms?
>
> What's the right way to do it?
>
> Cheers,
> Hauke
|
|
|
Re: Which font for all platforms? [message #493907 is a reply to message #492753] |
Wed, 28 October 2009 09:16  |
Eclipse User |
|
|
|
All control are created with the correct font for the platform.
To obtain the default font for the platform use Device#getSystemFont().
If you really need to force the same font on all platforms, the only reliable way to do that is to ship your own (true type) font with your product and use Device#loadFont(String) to make it usuable from SWT.
Felipe
|
|
|
Powered by
FUDForum. Page generated in 0.23727 seconds