You can explicitly set the font you want using CSS to get consistent display of fonts across different systems and browsers. I can think of it in two ways:
One of them is to specify the CSS font style, with the default fallback font being serif . For example, to add the Droid Serif font from Google Fonts and use it as the main body font style:
<link href='http://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'> <style> body { font-family: 'Droid Serif', serif; } </style>
Droid Serif will appear in all modern browsers, by default on serif on Heroku, as well as devices with older / simpler web browsers. The downside is that the fonts will look in the browser in one direction, but different in your PDF format, since Heroku will use the default serif font.
The second way is to encode the Base64 font ( you can use this tool ) and include it in your CSS:
@font-face { font-family: 'OpenSans'; src: url(data:font/truetype;charset=utf-8;base64,AAEAAAATAQA... }
It will also work in all modern browsers, with the added bonus of also working on Heroku to give you consistent font rendering. This method is especially convenient because you get consistency not only in browsers, but also in your development environment and Heroku, since you do not need git-push fonts and mess with local / absolute paths in CSS.
source share