aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/@font-face/font-weight/index.html
blob: 54fb37c0db20733146c9e831ea3894b187c2ce22 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
---
title: font-weight
slug: Web/CSS/@font-face/font-weight
tags:
  - '@font-face'
  - At-rule descriptor
  - CSS
  - Reference
  - descriptor
  - font-weight
translation_of: Web/CSS/@font-face/font-weight
---
<p>{{CSSRef}}</p>

<p><strong><code>font-weight</code></strong>  CSS の記述子で {{cssxref("@font-face")}} 規則で指定されたフォントの太さを指定することができます別に {{cssxref("font-weight")}} プロパティを使用してテキストを表示する文字の太さや細さを設定することができます</p>

<p>特定のフォントファミリについて同じフォントファミリの異なるスタイルに対応する様々なフォントフェイスをダウンロードできるようにすることができ <code>font-weight</code> 記述子を使用してフォントフェイスの太さを正確に指定することができます CSS 記述子の値は対応する font プロパティと同じです</p>

<p>一般に特定のフォントファミリには限られた太さのみが利用できます指定された太さが存在しない場合近い太さが使用されます太字がないフォントではふつうはユーザーエージェントが合成しますこれを抑止するには {{cssxref('font-synthesis')}} プロパティを使用してください</p>

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="notranslate">/* 単一の値 */
font-weight: normal;
font-weight: bold;
font-weight: 400;

/* 複数の値 */
font-weight: normal bold;
font-weight: 300 500;
</pre>

<p><code>font-weight</code> プロパティは以下に挙げる値のうちの一つを使用して記述します</p>

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

<dl>
 <dt><code>normal</code></dt>
 <dd>通常のフォントの太さです <code>400</code> と同じです</dd>
 <dt><code>bold</code></dt>
 <dd>太字のフォントの太さです <code>700</code> と同じです</dd>
 <dt><code>&lt;number&gt;</code></dt>
 <dd>1 以上 1000 以下の {{cssxref("&lt;number&gt;")}} 値です数値が大きいと数値が小さい物より太さが太い (又は同じ) ことを表しますよく使用される値は以下の<a href="#Common_weight_name_mapping">一般的な太さ名との対応</a>にあるように共通の太さ名に対応しています</dd>
</dl>

<p><code>font-weight</code> 仕様書の古いバージョンではこのプロパティはキーワード値と数値 100, 200, 300, 400, 500, 600, 700, 800, 900 のみを受け付けていました可変フォント以外では実際にはこれらのセット値しか利用できませんただし可変フォント以外では細かい値 (例えば 451) これらの値のいずれかに変換されます</p>

<p>CSS Fonts レベル 4 では構文を拡張して 1 から 1000 までの任意の数値を受け付けるようになり{{anch("Variable fonts", "可変フォント")}}が導入されフォントの太さにもっと細かい範囲を使用することができるようになりました</p>

<h3 id="Common_weight_name_mapping" name="Common_weight_name_mapping">良くある太さ名の対応</h3>

<p><code>100</code> から <code>900</code> の数値はおおよそ以下の太さ名に対応します</p>

<table>
 <thead>
  <tr>
   <th scope="col"></th>
   <th scope="col">太さ名</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>100</td>
   <td>Thin (Hairline)</td>
  </tr>
  <tr>
   <td>200</td>
   <td>Extra Light (Ultra Light)</td>
  </tr>
  <tr>
   <td>300</td>
   <td>Light</td>
  </tr>
  <tr>
   <td>400</td>
   <td>Normal</td>
  </tr>
  <tr>
   <td>500</td>
   <td>Medium</td>
  </tr>
  <tr>
   <td>600</td>
   <td>Semi Bold (Demi Bold)</td>
  </tr>
  <tr>
   <td>700</td>
   <td>Bold</td>
  </tr>
  <tr>
   <td>800</td>
   <td>Extra Bold (Ultra Bold)</td>
  </tr>
  <tr>
   <td>900</td>
   <td>Black (Heavy)</td>
  </tr>
 </tbody>
</table>

<h3 id="Variable_fonts" name="Variable_fonts">可変フォント</h3>

<p>多くのフォントは<a href="#Common_weight_name_mapping">一般的な太さ名との対応</a>の中の数値の一つに対応する特定の太さを持っていますしかし可変フォントと呼ばれる一部のフォントはもっと高い又は低い粒度の太さの範囲に対応しておりこれによりデザイナーは選択した太さをより詳細に制御することができます</p>

<p>TrueType  OpenType の可変フォントでは "wght" バリエーションが様々な幅を実装するために使用されます</p>

<h2 id="Accessibility_concerns" name="Accessibility_concerns">アクセシビリティの考慮</h2>

<p>弱視の人は <code>font-weight</code> の値が <code>100</code> (Thin/Hairline) または <code>200</code> (Extra Light) の場合特にフォントの<a href="/en-US/docs/Web/CSS/color#Accessibility_concerns">コントラスト比が低い場合</a>テキストを読むのが難しくなることがあります</p>

<ul>
 <li><a href="/ja/docs/Web/Accessibility/Understanding_WCAG/Perceivable#Guideline_1.4_Make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background">MDN "WCAG を理解する ― ガイドライン 1.4 の解説"</a></li>
 <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-visual-presentation.html" rel="noopener">Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0</a></li>
</ul>

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

<p>{{cssinfo}}</p>

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

{{csssyntax}}

<h2 id="Examples" name="Examples"></h2>

<h3 id="Setting_normal_font_weight_in_a_font-face_rule" name="Setting_normal_font_weight_in_a_font-face_rule">@font-face 規則における通常のフォントの太さの設定</h3>

<p>以下の例はローカルの Open Sans フォントを見つけるかまたはそれをインポートして通常の太さのフォントを使用することができます</p>

<pre class="notranslate">@font-face {
  font-family: "Open Sans";
  src: local("Open Sans") format("woff2"),
       url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
  font-weight: 400;
}</pre>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS4 Fonts', '#font-prop-desc', 'font-weight')}}</td>
   <td>{{Spec2('CSS4 Fonts')}}</td>
   <td></td>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Fonts', '#font-prop-desc', 'font-weight')}}</td>
   <td>{{Spec2('CSS3 Fonts')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

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

<div class="hidden">このページの互換性一覧表は構造化データから生成されていますデータに協力していただけるのであれば <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>

<p>{{Compat("css.at-rules.font-face.font-weight")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

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