aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/@font-face/src/index.html
blob: c7c64789164c5309b07ab13715278f594c5ee792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
title: src
slug: Web/CSS/@font-face/src
tags:
  - '@font-face'
  - アットルール記述子
  - CSS
  - CSS Descriptor
  - CSS Fonts
  - CSS Property
  - リファレンス
translation_of: Web/CSS/@font-face/src
---
{{CSSRef}}

<strong>`src`</strong>  CSS における {{cssxref("@font-face")}} 規則の 記述子でフォントデータを含むリソースを指定します `@font-face` 規則を有効にするためには必要です

## 構文

<pre class="brush: css notranslate">/* &lt;url&gt;  */
src: url(https://somewebsite.com/path/to/font.woff); /* 絶対 URL */
src: url(path/to/font.woff);                         /* 相対 URL */
src: url(path/to/font.woff) format("woff");          /* 明示的な書式 */
src: url('path/to/font.woff');                       /* 引用符付きの URL */
src: url(path/to/svgfont.svg#example);               /* フラグメントで識別するフォント */

/* &lt;font-face-name&gt; 値 */
src: local(font);      /* 引用符なしの名前 */
src: local(some font); /* 空白が入った名前 */
src: local("font");    /* 引用符付きの名前 */

/* 複数の項目 */
src: local(font), url(path/to/font.svg) format("svg"),
     url(path/to/font.woff) format("woff"),
     url(path/to/font.otf) format("opentype");
</pre>

<h3 id="Values" name="Values"></h3>

- `&lt;url&gt; [ format( &lt;string&gt;# ) ]?`
  - : {{cssxref("&lt;url&gt;")}} 続けて任意で <code id="format()">format()</code> 関数で URL で参照するフォントリソースの形式を記述して外部参照を指定します形式のヒントには知られているフォント形式を示す書式文字列をカンマで区切ったリストを指定しますユーザーエージェントが指定した形式に対応していない場合はフォントリソースをのダウンロードを飛ばします形式のヒントが指定されていない場合はフォントリソースはが常にダウンロードされます
- `&lt;font-face-name&gt;`
  - : <code id="local()">local()</code> を使用してローカルに導入されたフォントフェイスをより大きなフォントファミリ内で単一のフォントフェイスを一意に識別する名前で指定します任意で名前を引用符で囲むことができます

<h2 id="Description" name="Description">解説</h2>

値は外部参照またはローカルにインストールされたフォントフェイス名をカンマで区切った優先度付きリストですフォントが必要になった時{{glossary("user agent", "ユーザーエージェント")}}はリスト上の参照を走査しアクティブ化に成功した最初の物を使用します無効なデータを持ったフォントや見つからないローカルのフォントは無視されユーザーエージェントはリスト上の次のフォントを読み込みます

CSS のその他の URL と同様に相対 URL を使用することができこの場合は `@font-face` 規則を含むスタイルシートの位置からの相対になります SVG フォントの場合 URL  SVG フォント定義を含む文書内の要素を指します要素への参照が省略された場合は参照は最初に定義されたフォントを含みます同様に複数のフォントを持つフォントコンテナー形式では `@font-face` 規則で指定された一つだけを読み込みます読み込むフォントを示すためにはフラグメント識別子を使用しますコンテナー形式がフラグメントで識別する方法を持たない場合は1から始まる添字 (例えば "font-collection#1" が最初のフォント "font-collection#2" が二番目のフォントなど) が使用されます

<h2 id="Formal_definition" name="Formal_definition">公式定義</h2>

{{cssinfo}}

<h2 id="Formal_syntax" name="Formal_syntax">形式文法</h2>

{{csssyntax}}

## 

<h3 id="Specifying_font_resources_using_url_and_local" name="Specifying_font_resources_using_url_and_local">url()  local() を使用したフォントリソースの指定</h3>

<pre class="brush: css notranslate">@font-face {
  font-family: examplefont;
  src: local(Example Font),
       url('examplefont.woff') format("woff"),
       url('examplefont.otf') format("opentype");
}
</pre>

## 仕様書

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Fonts', '#src-desc', 'src')}}</td>
   <td>{{Spec2('CSS3 Fonts')}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

{{Compat("css.at-rules.font-face.src")}}

## 関連情報

<ul>
- {{cssxref("@font-face/font-display", "font-display")}}
- {{cssxref("@font-face/font-family", "font-family")}}
- {{cssxref("@font-face/font-stretch", "font-stretch")}}
- {{cssxref("@font-face/font-style", "font-style")}}
- {{cssxref("@font-face/font-weight", "font-weight")}}
- {{cssxref("@font-face/font-variant", "font-variant")}}
- {{cssxref("font-feature-settings", "font-feature-settings")}}
- {{cssxref("@font-face/font-variation-settings", "font-variation-settings")}}
- {{cssxref("@font-face/unicode-range", "unicode-range")}}
</ul>