2012-01-29 37 views
2

我打算为我的Django网络应用程序使用Ubuntu字体。我在这里下载了字体:http://font.ubuntu.com/。到目前为止,我设法通过将链接放到Google API来启用字体;通过在我的HTML文件中粘贴这行代码<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin">在我的网络应用程序上使用ubuntu字体

但是,我的网络应用程序的服务器不会连接到互联网,因为它只能在内部使用。上述方法仍然以这种方式工作吗?如果不是,我如何将下载的字体嵌入到我的Web应用程序中?

+0

可为空是一个很好的观点。客户端是否连接到interent? – Joe 2012-01-29 23:17:29

回答

1

您真正需要哪种字体的字体?

这是非常简单: http://fonts.googleapis.com/css?family=Ubuntu:regular,bold,italic 回报:

@media screen { 
@font-face { 
    font-family: 'Ubuntu'; 
    font-style: italic; 
    font-weight: normal; 
    src: local('Ubuntu Italic'), local('Ubuntu-Italic'), url('http://themes.googleusercontent.com/static/fonts/ubuntu/v4/kbP_6ONYVgE-bLa9ZRbvvvesZW2xOQ-xsNqO47m55DA.woff') format('woff'); 
} 
} 
@media screen { 
@font-face { 
    font-family: 'Ubuntu'; 
    font-style: normal; 
    font-weight: normal; 
    src: local('Ubuntu'), url('http://themes.googleusercontent.com/static/fonts/ubuntu/v4/_xyN3apAT_yRRDeqB3sPRg.woff') format('woff'); 
} 
} 
@media screen { 
@font-face { 
    font-family: 'Ubuntu'; 
    font-style: normal; 
    font-weight: bold; 
    src: local('Ubuntu Bold'), local('Ubuntu-Bold'), url('http://themes.googleusercontent.com/static/fonts/ubuntu/v4/0ihfXUL2emPh0ROJezvraD8E0i7KZn-EPnyo3HZu7kw.woff') format('woff'); 
} 
} 

下载每个WOFF的文件要使用,由“SRC”属性所看到,并把这些在静态目录,并在CSS中更改'src'网址以匹配您自己的网址。

例如,对于正常的字体,你应该下载:http://themes.googleusercontent.com/static/fonts/ubuntu/v4/_xyN3apAT_yRRDeqB3sPRg.woff 将其放入/static/ubuntu_normal.woff

并创建以下CSS:

@media screen { 
@font-face { 
    font-family: 'Ubuntu'; 
    font-style: normal; 
    font-weight: normal; 
    src: local('Ubuntu'), url('/static/ubuntu_normal.woff') format('woff'); 
} 
} 

您将需要添加的每您希望使用的字体样式或字体样式,粗体,斜体等。

1

CSS运行客户端。只要客户连接到互联网,它就可以工作。

相关问题