42

I noticed this woo theme for example has it set on the HTML tag and therefore the whole site's text has it set. I read that it can cause performance problems but that was a while ago. Some people suggested only adding it to headers and big text.

Have the rules changed now? Do browsers perform well with it?

L84
  • 45,514
  • 58
  • 177
  • 257
firefusion
  • 1,087
  • 2
  • 14
  • 26
  • The site lags a bit for me when scrolling. I'm running Chrome 16.0.904 on 64-bit Linux – Blender Nov 01 '11 at 15:33
  • Could also be all the css3 transparency and dropdown shadows. I understand go through the graphics card; which on Linux might be more of a problem. – firefusion Nov 01 '11 at 15:51
  • I have hardware acceleration with my 9800GT. – Blender Nov 01 '11 at 15:54
  • 2
    It's worth noting that "text-rendering: optimizelegibility;" is broken on Android 2.2 and 2.3: http://code.google.com/p/android/issues/detail?id=15067 :( – John Carter Jan 26 '12 at 03:54
  • 1
    (and fallout from that bug: http://stackoverflow.com/search?q=%5Bandroid%5D+optimizelegibility ) – John Carter Apr 11 '12 at 05:37
  • 4
    I wish more information could be added to these answers for 2014/2015. Most Googling is still turning up conversations from 2011! – Eric L. Sep 26 '14 at 19:46

6 Answers6

36

No: there have been many bugs over the years on various platforms which cause text not to be displayed or displayed incorrectly (see below). If your goal is to enable ligatures, there's actually standard property font-variant-ligatures defined in CSS Fonts Level 3 which offers full control:

font-variant-ligatures: common-ligatures;
font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures;

See font-variant for other typographic features which can be enabled such as small caps, alternate letter forms, etc.

History

Before font-variant-ligatures & the related properties were added, the older font-feature-settings property allowed the same feature to be enabled. This is a lower-level interface and is no longer recommended except to enable OpenType features which do not have a higher-level interface.

http://blog.fontdeck.com/post/15777165734/opentype-1 has a simple example:

h1 {
    -webkit-font-feature-settings: "liga", "dlig";
    -moz-font-feature-settings: "liga=1, dlig=1";
    -ms-font-feature-settings: "liga", "dlig";
    font-feature-settings: "liga", "dlig";
}

http://elliotjaystocks.com/blog/the-fine-flourish-of-the-ligature/ has more discussion as well.

Bug Gallery

The popular HTML5 Boilerplate project removed it two years ago due to various rendering problems:

https://github.com/h5bp/html5-boilerplate/issues/78

Two Chromium bugs which I just fixed this morning caused Chrome 21 on Windows XP to either fail to perform font substitution at all, displaying the missing character symbol rather than using one from a different font, and displaying text incorrectly overlapping other elements:

http://code.google.com/p/chromium/issues/detail?id=114719

http://code.google.com/p/chromium/issues/detail?id=149548

See http://aestheticallyloyal.com/public/optimize-legibility/ for a few other concerns.

http://bocoup.com/weblog/text-rendering/ highlighted compatibility problems on Android and general performance issues

Chris Adams
  • 4,966
  • 1
  • 30
  • 28
  • 1
    Please be aware that there has never been support for [`-o-font-feature-settings` in Presto](http://www.opera.com/docs/specs/presto2.12/css/fonts/). By switching to Blink Opera 15 started supporting `-webkit-font-feature-settings`. – Volker E. Jun 18 '15 at 10:28
  • @VolkerE. – Thanks – I just removed that line. Hopefully people will use `font-variant-ligatures` now in any case. – Chris Adams Jun 18 '15 at 19:05
25

from the MDN text-rendering page, last updated on 18:27, 29 Apr 2012, it reads:

The text-rendering CSS property provides information to the rendering engine about what to optimize for when rendering text. The browser makes trade-offs among speed, legibility, and geometric precision. The text-rendering property is an SVG property that is not defined in any CSS standard. However, Gecko and WebKit browsers let you apply this property to HTML and XML content on Windows, Mac OS X and Linux.

which tels us that it is not defined in any CSS standard, thus leading to cross-browser issues, as seen on the Browser compatibility table.

By default

The browser makes educated guesses about when to optimize for speed, legibility, and geometric precision while drawing text.

So, is safe to assume that the best option is to let the browser take care of details like this, since this feature is not a standard (yet), and most browsers don't support it.

Zuul
  • 16,217
  • 6
  • 61
  • 88
8

text-rendering: optimizeLegibility; was used in one of our web apps. it rendered properly in all browsers, except one - chrome (64) on windows 7.

Had to remove the property as most of our end users were from that category.

Volker E.
  • 5,911
  • 11
  • 47
  • 64
RoRRe
  • 291
  • 2
  • 10
  • 2
    me too. Especially since "not rendering properly" meant words would actually *not* be rendered at all if the HTML text contained tab characters – tardate Aug 14 '13 at 11:14
4

I've just fixed a bug where Chrome was refusing to render web fonts (it always fell back to a non-web one, for no reason we could discern). In the end - after considerable amount of head-scratching - the problem was fixed by setting text-rendering from optimizeLegibility (which had been set by Twitter Bootstrap, for what it's worth) to auto.

So I would say for the moment the answer is probably "no". Which isn't to say don't use it, but don't apply it to everything. Use it where needed and test it carefully for weirdnesses or unexpected effects (especially in Chrome!).

Nick F
  • 9,781
  • 7
  • 75
  • 90
2

using "text-rendering: optimizelegibility" also causes rendering errors in android native browser (4.2 & 4.3). If you use this attribute in combination with loading new fonts via @font-face, the font will not display at all (only fallback). without "text-rendering: optimizelegibility" and @font-face the font loads and gets displayed as expected.

Kris
  • 768
  • 1
  • 8
  • 19
0

CSS text-rendering looks shaky. Instead of grinding time with a poor CSS property, it may be worthwhile to go with this...

If Javascript is an option for you, Kerning.js looks promising, a javascript approach to kerning and kerning pairs hosted on Github.

http://kerningjs.com

Also worth noting, if you are getting serious about typography, there is Font Squirrel free use web fonts.

http://www.fontsquirrel.com

unidentified-1
  • 131
  • 1
  • 7