text-rendering

  • Revision slug: CSS/text-rendering
  • Revision title: text-rendering
  • Revision id: 24999
  • Created:
  • Creator: Jürgen Jeka
  • Is current revision? No
  • Comment 54 words added, 9 words removed

Revision Content

{{ CSSRef() }} {{ gecko_minversion_header("1.9") }}

Summary

The text-rendering property is used to provide information to the rendering engine about what sorts of tradeoffs to make when rendering text, in order to optimize speed or legibility.

One very visible effect is: optimizeLegibility enables ligatures (ff, fi, fl etc.) in text smaller than 20px for some fonts (e.g. Microsoft's Calibri, Candara, Constantia and Corbel that ship with Windows Vista).

  • {{ Xref_cssinitial() }}: auto
  • Applies to: all elements
  • {{ Xref_cssinherited() }}: yes
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: ?

Syntax

text-rendering:  auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit

Values

auto
The browser will make educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text.
In practice, Gecko desktop browsers like Firefox use optimizeLegibility if font size is 20px or larger. Otherwise optimizeSpeed for smaller text.
optimizeSpeed
Gecko will emphasize rendering speed over legibility and geometric precision while drawing text. Disables kerning and ligatures.
optimizeLegibility
Gecko will emphasize legibility over rendering speed and geometric precision. This enables kerning and optional ligatures.
geometricPrecision
Gecko will emphasize geometric precision over rendering speed and legibility, currently the same as optimizeLegibility.

Examples

{{ CSSRefExampleLink("text-rendering") }}

/* make sure all fonts in the HTML document display in all its glory,
   but avoid inadequate ligatures in class foo elements */

body  { text-rendering: optimizeLegibility; }
.foo  { text-rendering: optimizeSpeed; }

Notes

The 20px threshold value of the auto keyword can be changed by editing about:config
browser.display.auto_quality_min_font_size

Specifications

This is a SVG property, it is not defined in any CSS standard. Gecko (Firefox) applies text-rendering also to HTML and XML content.

Browser compatibility

Browser Lowest Version
Internet Explorer ---
Firefox (Gecko) 3.0 (1.9)
Opera ---
Safari (WebKit) ---

See also

{{ CSS_Reference:Text() }}

Revision Source

<p>{{ CSSRef() }} {{ gecko_minversion_header("1.9") }}</p>
<h3 name="Summary">Summary</h3>
<p>The<code> text-rendering </code>property is used to provide information to the rendering engine about what sorts of tradeoffs to make when rendering text, in order to optimize speed or legibility.</p>
<p>One very visible effect is:<code> optimizeLegibility </code>enables ligatures (ff, fi, fl etc.) in text smaller than 20px for some fonts (e.g. Microsoft's<em> Calibri, Candara, Constantia and Corbel</em> that ship with Windows Vista).<code><br>
</code></p>
<ul> <li>{{ Xref_cssinitial() }}: auto</li> <li>Applies to: all elements</li> <li>{{ Xref_cssinherited() }}: yes</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}: ?</li>
</ul>
<h3 name="Syntax">Syntax</h3>
<pre class="eval">text-rendering:  auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit
</pre>
<h3 name="Values">Values</h3>
<dl> <dt>auto</dt><dd>The browser will make educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text.</dd><dd>In practice, Gecko desktop browsers like Firefox use<code> optimizeLegibility </code>if font size is <strong>20px </strong>or larger. Otherwise<code> optimizeSpeed </code>for smaller text.<br>
</dd><dt>optimizeSpeed</dt><dd>Gecko will emphasize rendering speed over legibility and geometric precision while drawing text. Disables kerning and ligatures.<br>
</dd><dt>optimizeLegibility</dt><dd> Gecko will emphasize legibility over rendering speed and geometric precision. This enables <strong>kerning</strong> and optional <strong>ligatures</strong>. </dd><dt>geometricPrecision</dt><dd> Gecko will emphasize geometric precision over rendering speed and legibility, currently the same as<code> optimizeLegibility</code>. </dd></dl>
<h3 name="Examples">Examples</h3>
<p>{{ CSSRefExampleLink("text-rendering") }}</p>
<pre>/* make sure all fonts in the HTML document display in all its glory,
   but avoid inadequate ligatures in class foo elements */

body  { text-rendering: optimizeLegibility; }
.foo  { text-rendering: optimizeSpeed; }
</pre>
<h3 name="Specifications">Notes</h3>
<p>The 20px threshold value of the<code> auto </code>keyword can be changed by editing <em>about:config</em><br>
<code>browser.display.auto_quality_min_font_size</code></p>
<h3 name="Specifications">Specifications</h3>
<p>This is a SVG property, it is not defined in any CSS standard. Gecko (Firefox) applies<code> text-rendering </code>also to HTML and XML content.</p>
<ul> <li><a class="external" href="http://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty" title="http://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty">SVG 1.1 Painting #text-rendering</a></li>
</ul>
<h3 name="Browser_compatibility">Browser compatibility</h3>
<table class="standard-table"> <tbody> <tr> <th>Browser</th> <th>Lowest Version</th> </tr> <tr> <td>Internet Explorer</td> <td>---</td> </tr> <tr> <td>Firefox (Gecko)</td> <td><strong>3.0</strong> (1.9)</td> </tr> <tr> <td>Opera</td> <td>---</td> </tr> <tr> <td>Safari (WebKit)</td> <td>---</td> </tr> </tbody>
</table>
<h3 name="See_also">See also</h3>
<p>{{ CSS_Reference:Text() }}</p>
Revert to this revision