みかづきブログ その3

本ブログは更新を終了しました。通算140万ユーザーの方に観覧頂くことができました。長い間、ありがとうございました。

👆

引越し先はこちらです!

Google Fonts をつかってみる

Google Fonts

WEBフォントをつかったことがなかったので調べてみました。



手順を簡単にまとめると、

  1. @font-face を設定する
  2. スタイルを設定する

の2点なのですが、Google Fontに関しては、@font-faceを設定したCSSを提供してくれているのでそれを読み込むだけで@font-faceの設定が終わります。

すべてHTML上に書くのであれば、

<!--@font-faceを設定するCSSの読み込み-->
<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css' />

<!--styleの設定-->
<style>
    body {
        font-family: 'Poiret One', cursive;
    }
</style>

的な感じで、OKです。

驚くほど簡単につかえますね。

ちなみに http://fonts.googleapis.com/css?family=Poiret+One の中身は、

/* cyrillic */
@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  src: local('Poiret One'), local('PoiretOne-Regular'), url(http://fonts.gstatic.com/s/poiretone/v4/cKr_e199f0xMkxMkRbEJXwsYbbCjybiHxArTLjt7FRU.woff2) format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  src: local('Poiret One'), local('PoiretOne-Regular'), url(http://fonts.gstatic.com/s/poiretone/v4/3Annd_XP-99FcGbOpm6fVAsYbbCjybiHxArTLjt7FRU.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  src: local('Poiret One'), local('PoiretOne-Regular'), url(http://fonts.gstatic.com/s/poiretone/v4/HrI4ZJpJ3Fh0wa5ofYMK8QsYbbCjybiHxArTLjt7FRU.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}

こんな感じになってました。
和文に対応したフォントが見当たらないのが残念ですが、機会があれば積極的に活用していきたいです。