Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@font-face in GWT

Tags:

font-face

gwt

I was trying to use following code with GWT 2.2.0:

//in my UiBinderFile
<ui:style field="myStyle" src="MyCssFile.css"/>
.
.
<g:Label ui:field="aboutMainHeader" styleName="{myStyle.decorFont}"></g:Label>

and also in MyCssFile.css in same directory as UiBInder xml,

//entire MyCssFile.css
@font-face {
    font-family: cool_font;
    src: url('cool_font.ttf');
}
.decorFont{
    font-family: cool_font; /* no .ttf */
}

When I try to compile this, I get some NPE in UiBinder parser, right afer call of method that does font face parsing. I don't know what is wrong. Has anyone tried face-fonts with GWT, and could you please post working example?

Thanks...

like image 881
azec-pdx Avatar asked Apr 07 '26 19:04

azec-pdx


1 Answers

See http://code.google.com/p/google-web-toolkit/issues/detail?id=5247

You'd have to put your @font-face declaration in an external (not-CssResource) stylesheet (could be inlined in you HTML host page for instance)

like image 140
Thomas Broyer Avatar answered Apr 11 '26 01:04

Thomas Broyer