3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cssでイラレの合成フォントみたいなことをする。

Posted at

合成フォントで指示が来たので調べました。
一カ所ずつ指定するとかではなく、全角はこのフォント、数字はこのフォント、みたいなやつです。

ex.)
全角文字:ヒラギノ角ゴ Pro W3
半角文字:Lato Reguler

ヒラギノはブラウザ標準で指定可、Latoはないのでfont-faceでつくります。

@font-face {
  font-family: "Lato-Light";
  src: url("/fonts/Lato/Lato-Light.eot");
  src: url("/fonts/Lato/Lato-Light.ttf") format("truetype"),  
       url("/fonts/Lato/Lato-Light.woff2") format("woff2"),
       url("/fonts/Lato/Lato-Light.woff") format("woff");
  unicode-range: U+0030-0039, U+0041-007A;
}
@font-face {
  font-family: "Lato-Regular";
  src: url("/fonts/Lato/Lato-Regular.eot");
  src: url("/fonts/Lato/Lato-Regular.ttf") format("truetype"),  
       url("/fonts/Lato/Lato-Regular.woff2") format("woff2"),
       url("/fonts/Lato/Lato-Regular.woff") format("woff");
  unicode-range: U+0030-0039, U+0041-007A;
}

unicode-range: U+0030-0039, U+0041-007A;

この記述で、フォントを適応する文字を指定しています。

U+0030-0039が数字
U+0041-007Aが英字

あとはfont-familyで、適応を絞ってるフォントを先に指定します。

body {
  font-family: "Lato-Regular", "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", Arial, Helvetica, sans-serif;
}
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?