apply CSS based on your browser's text rendering engine
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist Update website and prebuilt libraries. Aug 5, 2014
src Add suspected Opera version with DirectWrite support. Jun 17, 2014
vendor/google Update dependencies. May 24, 2014
website More header tweaks (part 2). Aug 5, 2014
.gitignore initial commit Nov 19, 2013
LICENSE Update copyright. Aug 5, 2014
bower.json Distribute a minified and unminified version of the JS. Dec 26, 2013
browsers.json Add automated testing setup. Dec 1, 2013
package.json v1.1.0 Aug 5, 2014

Type Rendering Mix

Bower version devDependency Status

Type Rendering Mix website

Type Rendering Mix detects your browser’s text rasterizer and antialiasing method by parsing the user agent string. It will then add two classes to your HTML element. One class will describe the text rasterizer and the other the antialiasing method it is using:

<html class="tr-coretext tr-aa-subpixel">

The text rasterizer class name can take the following values:

  • tr-coretext for OS X and iOS;
  • tr-gdi for Windows XP and Windows Vista SP1;
  • tr-directwrite for Windows Vista SP2 and above;
  • tr-freetype for Android and Linux.

The antialiasing method class name will be one of the following:

  • tr-aa-none when no antialiasing is applied;
  • tr-aa-grayscale when grayscale antialiasing is applied;
  • tr-aa-subpixel when subpixel antialiasing is applied.

If Type Rendering Mix can’t determine the antialiasing method with absolute certainty it will attempt to guess. In this case unknown will be added to the class name:

  • tr-aa-unknown-none when no antialiasing is guessed;
  • tr-aa-unknown-grayscale when grayscale antialiasing is guessed;
  • tr-aa-unknown-subpixel when subpixel antialiasing is guessed.

When it is impossible to determine or guess the text rasterizer and antialiasing method tr-unknown and tr-aa-unknown will be used to indicate an unknown text rasterizer and antialiasing method.


Download the latest version at and include it in your page:

<script src="trmix.js"></script>

If you are using Bower you can install Type Rendering Mix using:

bower install trmix

Copyright and License

This library is licensed under the two-clause BSD license. Copyright 2013-2014 Tim Brown, Bram Stein. All rights reserved.