I’ve tryed several methods to use Google Web Fonts, but there’s something I’m not doing allright, because I only get Arial.
First,
@StyleSheet("http://fonts.googleapis.com/css?family=Titillium+Web:600,300")
found on forums, but Eclipse says that “The attribute value is undefinedfor the annotation type StyleSheet”.
After that, I tryed to add head line with a BootStrapListener, like:
public static class Servlet extends VaadinServlet
{
@Override
protected void servletInitialized() throws ServletException {
super.servletInitialized();
getService().addSessionInitListener(new SessionInitListener() {
@Override
public void sessionInit(SessionInitEvent event) {
event.getSession().addBootstrapListener(new BootstrapListener() {
@Override
public void modifyBootstrapPage(BootstrapPageResponse response) {
response.getDocument().head().prependElement("link").attr("type", "text/css").attr("rel", "styleshhet").attr("href","http://fonts.googleapis.com/css?family=Titillium+Web:600,300");
}
@Override
public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
}
});
}
});
}
}
That worked partially. HTML contains:
<link href="http://fonts.googleapis.com/css?family=Titillium+Web:600,300" rel="styleshhet" type="text/css">
</link>
and font is set in myapp.scss like:
.titulo_principal
{
font-family: 'Titillium Web', Calibri, Tahoma, Arial, sans-serif;
font-size: 24px;
font-weight: bold;
padding-top: 10px;
padding-left: 10px;
}
but font is not shown, even when “Titillium Web” appears a the font-family rules of that element in the browser.
Any suggestions? What’s wrong?
Thank you!