Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Changing the global font
Changing the global font [message #854306] Mon, 23 April 2012 21:35 Go to next message
Benjamin Wolff is currently offline Benjamin WolffFriend
Messages: 115
Registered: July 2009
Senior Member
Hi,

I'm wondering if there is a concise way to change the global font-size for all widgets using a theme contribution. In earlier RAP versions (<1.5) I used the following CSS rule in an own them:

* {
font: 12px Arial;
}

Unfortunately this doesn't seem to be respected any longer. The new default font (is it 14px??) is a bit too big and oversizes the layout for smaller screens. However, the current default theme of RAP looks much much nicer and I'd like to use it for the main widgets. Changing the font for every particular widget in an own CSS file would be a bit overkill and hard to maintain. Are there maybe more suitable solutions?

Thank you!

Cheers,
Ben
Re: Changing the global font [message #854647 is a reply to message #854306] Tue, 24 April 2012 05:51 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Ben,
this CSS rule is respected if the "font" property is not defined for the
particular widget. We have plans to remove the support for the "*"
selector. That's why the font property (and not only) is defined per widget.
Best,
Ivan

On 4/24/2012 12:35 AM, Benjamin Wolff wrote:
> Hi,
>
> I'm wondering if there is a concise way to change the global font-size
> for all widgets using a theme contribution. In earlier RAP versions
> (<1.5) I used the following CSS rule in an own them:
>
> * {
> font: 12px Arial;
> }
>
> Unfortunately this doesn't seem to be respected any longer. The new
> default font (is it 14px??) is a bit too big and oversizes the layout
> for smaller screens. However, the current default theme of RAP looks
> much much nicer and I'd like to use it for the main widgets. Changing
> the font for every particular widget in an own CSS file would be a bit
> overkill and hard to maintain. Are there maybe more suitable solutions?
>
> Thank you!
>
> Cheers,
> Ben

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Changing the global font [message #854774 is a reply to message #854306] Tue, 24 April 2012 08:20 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Ben,

Glad that you like the new theme ;-)

The problem with the *-selector is that it really applies to all widgets
and sub-widgets. This has often some unwanted implications. Therefore
the default theme specifies properties specifically for every single widget.

This means that a *-rule in a theme contribution does not override the
default properties, because this is less specific. So currently, the
only way to override the fonts is to add a selector for every widget you
want to change, sorry.

Button,
Combo,
Label,
Shell-TitleBar,
.... {
font: 12px ...;
}

We'd have plans to look into less [1], which allows for variables in CSS
and see if this could help removing the redundancy.

Hope this makes it more clear.

Regards, Ralf


[1] http://lesscss.org/

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Changing the global font [message #855432 is a reply to message #854774] Tue, 24 April 2012 20:26 Go to previous messageGo to next message
Benjamin Wolff is currently offline Benjamin WolffFriend
Messages: 115
Registered: July 2009
Senior Member
Hi,

thanks for the clarification.

So then I'm going to identify the widgets that have a font and adjust these accordingly. Setting an overall font-size in px could indead lead to unwanted implications, as you mentioned it, so it seems that this is the best way to go for now. At least it should be an one time effort ;).

Nice would be some a ratio (em) based layout, where it would be possible to set the base font size and the other fonts would adapt. However, as I understand the RAP layouting is based on px, so I'd guess this is currently not possible...

Cheers,
Ben


Am 24.04.2012 10:20, schrieb Ralf Sternberg:
> Hi Ben,
>
> Glad that you like the new theme ;-)
>
> The problem with the *-selector is that it really applies to all widgets and sub-widgets. This has often some unwanted implications. Therefore the default theme specifies properties specifically for every single widget.
>
> This means that a *-rule in a theme contribution does not override the default properties, because this is less specific. So currently, the only way to override the fonts is to add a selector for every widget you want to change, sorry.
>
> Button,
> Combo,
> Label,
> Shell-TitleBar,
> .... {
> font: 12px ...;
> }
>
> We'd have plans to look into less [1], which allows for variables in CSS and see if this could help removing the redundancy.
>
> Hope this makes it more clear.
>
> Regards, Ralf
>
>
> [1] http://lesscss.org/
>
Re: Changing the global font [message #855898 is a reply to message #855432] Wed, 25 April 2012 07:34 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

> Nice would be some a ratio (em) based layout, where it would be possible to set the base font size and the other fonts would adapt. However, as I understand the RAP layouting is based on px, so I'd guess this is currently not possible...

Yes, the layout is based on pixels. And if we applied the percentages on
the server, we'd probably get some weird rounding issues. So, let's keep
this idea in mind for later ;-)

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Changing the global font [message #868199 is a reply to message #855898] Tue, 01 May 2012 17:45 Go to previous message
Benjamin Wolff is currently offline Benjamin WolffFriend
Messages: 115
Registered: July 2009
Senior Member
I dug through the default.css theme and through the *.default.css files for the particular widgets to determine which fonts settings I have to adjust. So here are the CSS rules that should cover all font settings for the current RWT widget set (taken from the bundle org.eclipse.rap.rwt, RAP v1.5.0 M6). It should safe some time if someone else also wants to change the global font sizes:


*,
Button,
Combo, Combo[BORDER],
CCombo,
CLabel,
CTabItem,
Display,
DateTime, DateTime-Calendar-Navbar,
FileUpload,
Label,
Link,
List, List-Item,
Shell-Titlebar,
Spinner,
TabFolder,
Table, TableColumn,
Text,
ToolBar,
ToolTip, ToolTip-Message,
TreeColumn,
Widget-ToolTip {
font: 14px Verdana, "Lucida Sans", Arial, Helvetica, sans-serif;
}

Group {
font: 10px Verdana, "Lucida Sans", Arial, Helvetica, sans-serif;
}

ToolTip-Text {
font: bold 14px Verdana, "Lucida Sans", Arial, Helvetica, sans-serif;
}

Display {
rwt-fontlist: 14px 'Segoe UI', Corbel, Calibri, Tahoma, 'Lucida Sans Unicode';
}


Cheers,
Ben


Am 25.04.2012 09:34, schrieb Ralf Sternberg:
>> Nice would be some a ratio (em) based layout, where it would be possible to set the base font size and the other fonts would adapt. However, as I understand the RAP layouting is based on px, so I'd guess this is currently not possible...
>
> Yes, the layout is based on pixels. And if we applied the percentages on the server, we'd probably get some weird rounding issues. So, let's keep this idea in mind for later ;-)
>
> Regards, Ralf
>
Previous Topic:Tutorial &quot;Single sourcing for databases management with RAP, EMF and Teneo&quot;
Next Topic:how to persist the tableviewer column size after adjusting?
Goto Forum:
  


Current Time: Mon Dec 06 21:48:08 GMT 2021

Powered by FUDForum. Page generated in 0.02061 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top