Using fonts with Rails asset pipeline

If your Rails version is between > 3.1.0 and < 4, place your fonts in any of the these folders: app/assets/fonts lib/assets/fonts vendor/assets/fonts For Rails versions > 4, you must place your fonts in the app/assets/fonts folder. Note: To place fonts outside of these designated folders, use the following configuration: config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/ For Rails … Read more

How to change font face of Webview in Android?

There’s a working example of this in this project. It boils down to: In your assets/fonts folder, place the desired OTF or TTF font (here MyFont.otf) Create a HTML file that you’ll use for the WebView’s content, inside the assets folder (here inside assets/demo/my_page.html): <html> <head> <style type=”text/css”> @font-face { font-family: MyFont; src: url(“file:///android_asset/fonts/MyFont.otf”) } … Read more

Using custom fonts using CSS?

Generically, you can use a custom font using @font-face in your CSS. Here’s a very basic example: @font-face { font-family: ‘YourFontName’; /*a name to be used later*/ src: url(‘http://domain.com/fonts/font.ttf’); /*URL to font*/ } Then, trivially, to use the font on a specific element: .classname { font-family: ‘YourFontName’; } (.classname is your selector). Note that certain … Read more

How to add some non-standard font to a website?

This could be done via CSS: <style type=”text/css”> @font-face { font-family: “My Custom Font”; src: url(http://www.example.org/mycustomfont.ttf) format(“truetype”); } p.customfont { font-family: “My Custom Font”, Verdana, Tahoma; } </style> <p class=”customfont”>Hello world!</p> It is supported for all of the regular browsers if you use TrueType-Fonts (TTF), the Web Open Font Format (WOFF) or Embedded Opentype (EOT).