开发者

@font-face in 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?

Th开发者_C百科anks...


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)


Because of the limitation Thomas has noted I've developed a small project to define font resources into GWT clientbundle's. It's still a beta but hopes you like it.

It's on http://code.google.com/p/gwt-webfonts/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜