Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 928329 of FontFace

  • Revision slug: Web/API/FontFace
  • Revision title: FontFace
  • Revision id: 928329
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{APIRef("CSS Font Loading API")}}{{SeeCompatTable}}

The FontFace interface represents a single usable font face. It allows to control the source of the font face, being an URL to an external resource, or a buffer; it also allows to control when the font face is loaded and its current status.

Constructor

{{domxref("FontFace.FontFace", "FontFace()")}}
Constructs and returns a new FontFace object, build from an external resource described by an URL or from an {{domxref("ArrayBuffer")}}.

Properties

This interface doesn't inherits any property.

{{domxref("FontFace.family")}}
Is a {{domxref("DOMString")}} containint the family of the font. It is equivalent of the {{cssxref("@font-face/family", "family")}} descriptor.
{{domxref("FontFace.style")}}
Is a {{domxref("DOMString")}} containint the style of the font. It is equivalent of the {{cssxref("@font-face/style", "style")}} descriptor.
{{domxref("FontFace.weight")}}
Is a {{domxref("DOMString")}} containint the weight of the font. It is equivalent of the {{cssxref("@font-face/weight", "weight")}} descriptor.
{{domxref("FontFace.stretch")}}
Is a {{domxref("DOMString")}} containint how the font stretches. It is equivalent of the {{cssxref("@font-face/stretch", "stretch")}} descriptor.
{{domxref("FontFace.unicodeRange")}}
Is a {{domxref("DOMString")}} containint the range of code contained in the font. It is equivalent of the {{cssxref("@font-face/unicode-range", "unicode-range")}} descriptor.
{{domxref("FontFace.variant")}}
Is a {{domxref("DOMString")}} containint the variant of the font. It is equivalent of the {{cssxref("@font-face/range", "range")}} descriptor.
{{domxref("FontFace.featureSettings")}}
Is a {{domxref("DOMString")}} containint the features of the font. It is equivalent of the {{cssxref("@font-face/feature-settings", "feature-settings")}} descriptor.
{{domxref("FontFace.status")}} {{readonlyinline}}
Returns an enumerated value indicating the status of the font. It can be one of the following: "unloaded", "loading", "loaded", or "error".
{{domxref("FontFace.loaded")}} {{readonlyinline}}
Returning a {{domxref("Promise")}} of a FontFace that fulfills when the font is completely loaded and rejects when an error happens.

Methods

This interface doesn't inherits any method.

{{domxref("FontFace.load()")}}
Loads the font, returning a {{domxref("Promise")}} of a FontFace that fulfills when the font is completely loaded and rejects when an error happens.

Specifications

Specification Status Comment
{{SpecName('CSS3 Font Loading','#FontFace-interface','FontFaceSet')}} {{Spec2('CSS3 Font Loading')}} Initial definition

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(35.0)}} {{CompatGeckoDesktop(41)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatChrome(35.0)}} {{CompatGeckoMobile(41)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatChrome(35.0)}}

Revision Source

<p>{{APIRef("CSS Font Loading API")}}{{SeeCompatTable}}</p>

<p>The <code><strong>FontFace</strong></code> interface represents a single usable font face. It allows to control the source of the font face, being an URL to an external resource, or a buffer; it also allows to control when the font face is loaded and its current status.</p>

<h2 id="Constructor">Constructor</h2>

<dl>
 <dt>{{domxref("FontFace.FontFace", "FontFace()")}}</dt>
 <dd>Constructs and returns a new <code>FontFace</code> object, build from an external resource described by an URL or from an {{domxref("ArrayBuffer")}}.</dd>
</dl>

<h2 id="Properties">Properties</h2>

<p><em>This interface doesn't inherits any property.</em></p>

<dl>
 <dt>{{domxref("FontFace.family")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint the <em>family</em> of the font. It is equivalent of the {{cssxref("@font-face/family", "family")}} descriptor.</dd>
 <dt>{{domxref("FontFace.style")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint the <em>style</em> of the font. It is equivalent of the {{cssxref("@font-face/style", "style")}} descriptor.</dd>
 <dt>{{domxref("FontFace.weight")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint the <em>weight</em> of the font. It is equivalent of the {{cssxref("@font-face/weight", "weight")}} descriptor.</dd>
 <dt>{{domxref("FontFace.stretch")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint how the font <em>stretches</em>. It is equivalent of the {{cssxref("@font-face/stretch", "stretch")}} descriptor.</dd>
 <dt>{{domxref("FontFace.unicodeRange")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint the <em>range of code</em> contained in the font. It is equivalent of the {{cssxref("@font-face/unicode-range", "unicode-range")}} descriptor.</dd>
 <dt>{{domxref("FontFace.variant")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint the <em>variant</em> of the font. It is equivalent of the {{cssxref("@font-face/range", "range")}} descriptor.</dd>
 <dt>{{domxref("FontFace.featureSettings")}}</dt>
 <dd>Is a {{domxref("DOMString")}} containint the <em>features</em> of the font. It is equivalent of the {{cssxref("@font-face/feature-settings", "feature-settings")}} descriptor.</dd>
 <dt>{{domxref("FontFace.status")}} {{readonlyinline}}</dt>
 <dd>Returns an enumerated value indicating the status of the font. It can be one of the following: <code>"unloaded"</code>, <code>"loading"</code>, <code>"loaded"</code>, or <code>"error"</code>.</dd>
 <dt>{{domxref("FontFace.loaded")}} {{readonlyinline}}</dt>
 <dd>Returning a {{domxref("Promise")}} of a <code>FontFace</code> that fulfills when the font is completely loaded and rejects when an error happens.</dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>This interface doesn't inherits any method.</em></p>

<dl>
 <dt>{{domxref("FontFace.load()")}}</dt>
 <dd>Loads the font, returning a {{domxref("Promise")}} of a <code>FontFace</code> that fulfills when the font is completely loaded and rejects when an error happens.</dd>
</dl>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('CSS3 Font Loading','#FontFace-interface','FontFaceSet')}}</td>
   <td>{{Spec2('CSS3 Font Loading')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(35.0)}}</td>
   <td>{{CompatGeckoDesktop(41)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatChrome(35.0)}}</td>
   <td>{{CompatGeckoMobile(41)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatChrome(35.0)}}</td>
  </tr>
 </tbody>
</table>
</div>
Revert to this revision