可在 o-blog 中用两种方式使用 Google webfonts:使用 google API 或者在 templates/style 目录中提供资源。

Caution

使用许多字体样式会让你的页面变得很慢,因此仅选择那些你页面中实际需要的字体样式。

Both example are given using the Yanone Kaffeesatz font.

Using Google API

The quick use provides an import snippet such as:

@import url("http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700&subset=latin,latin-ext");

That line should be included into the templates/style/less/o-blog-default.less file in which you should also add something like:

h1, h2, h3, h4, h5, h6 {
    font-family: "Yanone Kaffeesatz", sans-serif;
}

And that's it.

Providing resources

That is less efficient in terms of network resources but provide a good alternative for offline publications.

The script get-font does all needed jobs.

You can run:

./get-font 'http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700&subset=latin,latin-ext'

And add the font declaration in templates/style/less/o-blog-default.less:

@import "font-Yanone-Kaffeesatz.less";

Add declare its use like in the Google API version:

h1, h2, h3, h4, h5, h6 {
    font-family: "Yanone Kaffeesatz", sans-serif;
}
blog comments powered by Disqus