Best way to use webfonts in GWT?

151 views
Skip to first unread message

RyanZA

unread,
Dec 21, 2012, 1:35:27 PM12/21/12
to google-we...@googlegroups.com
The GWT CSS (clean.css, chrome.css, etc) all have a ton of the following:

.gwt-TextBox {
    font-family: Arial Unicode MS,Arial,sans-serif;
}

What is the best way to overwrite these strange classes with a webfront family, so that it will conflict as little as possible with future GWT releases?

Options seem to be:
1) Subclass Textboxt and other standard widgets, and add a 'addClassName' with custom font class in the constructor.
2) Copy the clean.css file to gwt, and use a css resource with @NotStrict annotation

Any other methods that are nicer?

Jens

unread,
Dec 21, 2012, 1:59:19 PM12/21/12
to google-we...@googlegroups.com
I have done the 2nd option. If you want to keep all the little images of the clean theme you should inherit CleanResources.gwt.xml instead of Clean.gwt.xml so that the images will be copied to your war directory but no CSS will be included in your host html page. After that you only have to modify the image paths in your "Clean" CssResource css file and start modifying things the way you want it.

To keep things a bit separated its also nice to have a "Reset" CssResource that sets the style of common HTML tags to defaults you want and not what browsers think would be best.

-- J.
Reply all
Reply to author
Forward
0 new messages