Noto Serif(源ノ明朝)のCSS指定
CSS HTML font NotoSans NotoSerif
はじめに
最近提供されたばかりのNoto Serif(源ノ明朝)を試してみた。 まだCDN提供されていないので、現状はfont-faceでローカルファイルを指定しなければいけない。
フォントのダウンロード
https://www.google.com/get/noto/#serif-jpan からフォントをダウンロードして、fonts/NotoSerifCJKjp/などのディレクトリにファイルを展開する
ソースコードの記述
CSSなどに下記ソースコードを記述する srcのディレクトリは環境に合わせて変更する
@font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 100; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-ExtraLight.otf) format('opentype'); } @font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 200; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-Light.otf) format('opentype'); } @font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 400; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-Regular.otf) format('opentype'); } @font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 500; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-Medium.otf) format('opentype'); } @font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 600; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-SemiBold.otf) format('opentype'); } @font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 700; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-Bold.otf) format('opentype'); } @font-face { font-family: 'Noto Serif Japanese'; font-style: normal; font-weight: 900; src: url(../fonts/NotoSerifCJKjp/NotoSerifCJKjp-Black.otf) format('opentype'); } body{ font-family: 'Noto Serif Japanese', serif; } ```