Permalink
Browse files

Add font downloader tool.

Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
  • Loading branch information...
Sébastien Gross Sébastien Gross
Sébastien Gross authored and Sébastien Gross committed May 7, 2012
1 parent 3563a6c commit 45027fa5333167cd1325af62258f4dbfc5163531
View
@@ -28,7 +28,7 @@
#+HTML: <h1>o-blog</h1>
-A stand-alone blogging and publication tool for [[http://orgmode.org/][org-mode]].
+A stand-alone blog and publication tool for [[http://orgmode.org/][org-mode]].
#+HTML: </div>
@@ -155,6 +155,17 @@ This is a sample blog to explain how [[https://github.com/renard/o-blog][o-blog]
:PAGE: changelog.html
:END:
+- 2012-05-07
+ - Update to:
+ - less.js v1.0-547-ga2df119
+ - Bootstrap widgets:
+ - label
+ - badge
+ - progress bar
+ - well
+ - page header
+ - hero unit
+
- 2012-05-04
- Update to:
- bootstrap v2.0.3-5-gb261f97.
@@ -211,6 +222,7 @@ This is a sample blog to explain how [[https://github.com/renard/o-blog][o-blog]
- [[http://lesscss.org/][lesscss]] support
- [[http://jquery.com/][JQuery]] support
- HTML5 / CSS3 ready
+ - Custom [[http://www.google.com/webfonts][Google webfonts]] support.
- Blog
- Static pages
- [[file:{lisp}(ob:path-to-root){/lisp}/tags/index.html][Tag cloud]]
@@ -224,6 +236,7 @@ This is a sample blog to explain how [[https://github.com/renard/o-blog][o-blog]
- [[http://twitter.github.com/bootstrap/][Bootstrap]] extra
- Alert boxes
- Icons ([[http://glyphicons.com/][glyphicons]]) support
+ - widgets (labels, badges, progress bar, well, etc…)
** Templates
:PROPERTIES:
@@ -1277,7 +1290,7 @@ Some text
#+begin_o_blog_row 7
#+BEGIN_SRC text
- [[ob-badge:default][Label]]
+ [[ob-badge:default][Default]]
[[ob-badge:success][Success]]
[[ob-badge:warning][Warning]]
[[ob-badge:important][Important]]
@@ -1286,7 +1299,7 @@ Some text
#+END_SRC
#+o_blog_row_column 4
- - [[ob-badge:default][Label]]
+ - [[ob-badge:default][Default]]
- [[ob-badge:success][Success]]
- [[ob-badge:warning][Warning]]
- [[ob-badge:important][Important]]
@@ -1352,7 +1365,7 @@ Both example are given using the [[http://www.yanone.de/typedesign/kaffeesatz/][
The [[http://www.google.com/webfonts#QuickUsePlace:quickUse/Family:][quick use]] provides an import snippet such as:
#+BEGIN_SRC css
-@import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700&subset=latin,latin-ext);
+@import url("http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700&subset=latin,latin-ext");
#+END_SRC
That line should be included into the
@@ -1372,61 +1385,27 @@ And that's it.
That is less efficient in terms of network resources but provide a good
alternative for offline publications.
-First you need to download all fonts from
-http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700&subset=latin,latin-ext
-into the =templates/style/font= directory.
-#+BEGIN_SRC sh
-wget -O templates/style/font/yanone-kaffeesatz-regular.woff http://themes.googleusercontent.com/static/fonts/yanonekaffeesatz/v4/YDAoLskQQ5MOAgvHUQCcLcvyhSUCWNe0YoQkk3OBepg.woff
-wget -O templates/style/font/yanone-kaffeesatz-bold.woff http://themes.googleusercontent.com/static/fonts/yanonekaffeesatz/v4/We_iSDqttE3etzfdfhuPRWkfAKtHZKhf5n1BtpfNX_k.woff
-wget -O templates/style/font/yanone-kaffeesatz-light.woff http://themes.googleusercontent.com/static/fonts/yanonekaffeesatz/v4/We_iSDqttE3etzfdfhuPRYeadfj-6pacmJkCVgsbjK4.woff
-wget -O templates/style/font/yanone-kaffeesatz-extralight.woff http://themes.googleusercontent.com/static/fonts/yanonekaffeesatz/v4/We_iSDqttE3etzfdfhuPRem2G_Og_te2ADNUqKDN50k.woff
-#+END_SRC
+The script =get-font= does all needed jobs.
-Then you should declare them into =templates/style/less/o-blog-default.less=:
+#+O_BLOG_SOURCE: ../get-font sh
-#+BEGIN_SRC css
-@font-face {
- font-family: 'Yanone Kaffeesatz Regular';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Regular'),
- local('YanoneKaffeesatz-Regular'),
- url('../font/yanone-kaffeesatz-regular.woff') format('woff');
-}
+You can run:
-@font-face {
- font-family: 'Yanone Kaffeesatz Bold';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Bold'),
- local('YanoneKaffeesatz-Bold'),
- url('../font/yanone-kaffeesatz-bold.woff') format('woff');
-}
+#+BEGIN_SRC sh
+./get-font 'http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:400,200,300,700&subset=latin,latin-ext'
+#+END_SRC
-@font-face {
- font-family: 'Yanone Kaffeesatz Light';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Light'),
- local('YanoneKaffeesatz-Light'),
- url('../font/yanone-kaffeesatz-light.woff') format('woff');
-}
+And add the font declaration in =templates/style/less/o-blog-default.less=:
-@font-face {
- font-family: 'Yanone Kaffeesatz Extralight';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Extralight'),
- local('YanoneKaffeesatz-Extralight'),
- url('../font/yanone-kaffeesatz-extralight.woff') format('woff');
-}
+#+BEGIN_SRC css
+@import "font-Yanone-Kaffeesatz.less";
#+END_SRC
Add declare its use like in the Google API version:
#+BEGIN_SRC css
h1, h2, h3, h4, h5, h6 {
- font-family: "Yanone Kaffeesatz Regular", sans-serif;
+ font-family: "Yanone Kaffeesatz", sans-serif;
}
#+END_SRC
View
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if test -z "$1"; then
+ echo "Usage: $0 font-url"
+ exit 1
+fi
+
+FONT_DIR=templates/style/font
+LESS_DIR=templates/style/less
+
+FONT_URL="$1"
+LESS_FILE=$(echo "$FONT_URL" | sed -n 's/.*family=\([^:]\+\).*/\1/p' | sed 's/+/-/g')
+
+# Wee need to provide a valid user agent to get woff fonts
+UA='User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11'
+
+
+CSS=$(curl -H "${UA}" ${FONT_URL})
+
+echo "${CSS}" | sed -n "s#.*local('\([^']\+\)'), url('\([^']\+\)').*#curl -o ${FONT_DIR}/\1.woff \2#p" | sh -
+
+echo "${CSS}" | sed "s#\(.*\)local('\([^']\+\)'), url('\([^']\+\)')\(.*\)#\1local('\2'), url('../font/\2.woff')\4#" > "${LESS_DIR}/font-${LESS_FILE}.less"
+
+echo "You should add '@import \"font-${LESS_FILE}.less\";' to templates/style/less/o-blog-default.less"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,24 @@
+@font-face {
+ font-family: 'Nobile';
+ font-style: italic;
+ font-weight: normal;
+ src: local('Nobile Italic'), local('Nobile-Italic'), url('../font/Nobile-Italic.woff') format('woff');
+}
+@font-face {
+ font-family: 'Nobile';
+ font-style: normal;
+ font-weight: normal;
+ src: local('Nobile'), local('Nobile-Regular'), url('../font/Nobile-Regular.woff') format('woff');
+}
+@font-face {
+ font-family: 'Nobile';
+ font-style: italic;
+ font-weight: bold;
+ src: local('Nobile Bold Italic'), local('Nobile-BoldItalic'), url('../font/Nobile-BoldItalic.woff') format('woff');
+}
+@font-face {
+ font-family: 'Nobile';
+ font-style: normal;
+ font-weight: bold;
+ src: local('Nobile Bold'), local('Nobile-Bold'), url('../font/Nobile-Bold.woff') format('woff');
+}
@@ -0,0 +1,24 @@
+@font-face {
+ font-family: 'Yanone Kaffeesatz';
+ font-style: normal;
+ font-weight: 200;
+ src: local('Yanone Kaffeesatz ExtraLight'), local('YanoneKaffeesatz-ExtraLight'), url('../font/YanoneKaffeesatz-ExtraLight.woff') format('woff');
+}
+@font-face {
+ font-family: 'Yanone Kaffeesatz';
+ font-style: normal;
+ font-weight: 700;
+ src: local('Yanone Kaffeesatz Bold'), local('YanoneKaffeesatz-Bold'), url('../font/YanoneKaffeesatz-Bold.woff') format('woff');
+}
+@font-face {
+ font-family: 'Yanone Kaffeesatz';
+ font-style: normal;
+ font-weight: 400;
+ src: local('Yanone Kaffeesatz Regular'), local('YanoneKaffeesatz-Regular'), url('../font/YanoneKaffeesatz-Regular.woff') format('woff');
+}
+@font-face {
+ font-family: 'Yanone Kaffeesatz';
+ font-style: normal;
+ font-weight: 300;
+ src: local('Yanone Kaffeesatz Light'), local('YanoneKaffeesatz-Light'), url('../font/YanoneKaffeesatz-Light.woff') format('woff');
+}
@@ -7,42 +7,21 @@
@baseLineHeight: 25px;
*/
-@font-face {
- font-family: 'Yanone Kaffeesatz Regular';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Regular'),
- local('YanoneKaffeesatz-Regular'),
- url('../font/yanone-kaffeesatz-regular.woff') format('woff');
-}
-
-@font-face {
- font-family: 'Yanone Kaffeesatz Bold';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Bold'),
- local('YanoneKaffeesatz-Bold'),
- url('../font/yanone-kaffeesatz-bold.woff') format('woff');
-}
+@import "font-Yanone-Kaffeesatz.less";
+@import "font-Nobile.less";
-@font-face {
- font-family: 'Yanone Kaffeesatz Light';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Light'),
- local('YanoneKaffeesatz-Light'),
- url('../font/yanone-kaffeesatz-light.woff') format('woff');
-}
-
-@font-face {
- font-family: 'Yanone Kaffeesatz Extralight';
- font-style: normal;
- font-weight: 400;
- src: local('Yanone Kaffeesatz Extralight'),
- local('YanoneKaffeesatz-Extralight'),
- url('../font/yanone-kaffeesatz-extralight.woff') format('woff');
+h1, h2, h3, h4, h5, h6 {
+ font-family: "Yanone Kaffeesatz", sans-serif;
}
-h1, h2, h3, h4, h5, h6 {
- font-family: "Yanone Kaffeesatz Regular", sans-serif;
+#page.container {
+ .article-content {
+ p, ul {
+ font-family: "Nobile", sans-serif;
+ }
+ p, ul, li, dt, dd, blockquote small, address {
+ font-size: 18px;
+ line-height: 24px;
+ }
+ }
}

0 comments on commit 45027fa

Please sign in to comment.