Custom fonts on the web?

I recently stumbled upon a webpage using the font ff-tisa-web-pro-1 (specified in their CSS file).

How it works? I definitely do not have this font on my computer, but it was displayed.

+11
css fonts font-face
Jun 03 '10 at 20:00
source share
5 answers

You can use CSS to embed fonts in web pages.

Want to get away from β€œWeb Safe Fonts” for some attractive titles? And do it without using an image? Use CSS 3 and paste the font!

http://www.zenelements.com/blog/css3-embed-font-face/

+5
Jun 03 2018-10-06T00:
source share

As Simon noted, CSS @ font-face can be used to implement traditionally unsafe fonts on your site. If you want to try it yourself, be sure to check out Paul Irish, the now famous bulletproof font implementation that references the FontSquirrel Font File Generator . Now it supports a cross browser with the correct implementation, although with most fonts you will have to deal with licensing, and constant rendering is still a problem.

The site you requested uses Typekit , one of several new services that will host and maintain font files for you (for a fee), and offers you an easy implementation that masks @ font-face complexity. The Google Font API is similar, although it is free and contains only hosts / serves a small selection of free fonts.

In addition, incorrect alternative methods for embedding fonts existed for some time (although they were not specified in CSS), see cufon and sIFR .

+11
Jun 03 '10 at 20:11
source share

Here is an example of a page I recently played with to view math formulas in Firefox. The most interesting for you is the css @font-face declaration at the top, and style="font-family: DejaVu Serif Web;" - tags <div> and <math> .

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>mathy fonts test</title> <style type="text/css"> @font-face { font-family: DejaVu Serif Web; src: url(/fonts/DejaVu/ttf/DejaVuSerif.ttf) format("truetype"); } </style> </head> <body> <h1>DejaVu Serif</h1> <div style="font-family: DejaVu Serif Web;"> <p> Nulla eu commodo neque. Donec nec nisi libero. Integer sollicitudin leo vel arcu elementum mattis. Vivamus eu sodales odio. Curabitur eu auctor leo. Pellentesque adipiscing nulla iaculis ante commodo aliquet. Donec egestas tincidunt tincidunt. Nunc ut condimentum orci. Aenean in egestas tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur suscipit, sapien ut dignissim pellentesque, lacus risus facilisis odio, et tristique nunc quam et mauris. Quisque pellentesque nulla et dui bibendum suscipit. Aenean consectetur adipiscing nulla, a molestie nunc semper non. Quisque at ipsum quis turpis gravida commodo et vel felis. Integer lobortis augue eu tortor aliquet nec mattis nulla aliquam. Sed ornare cursus urna et congue. </p> <p> <math style="font-family: DejaVu Serif Web;" mode="display" xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mo form="prefix">&#x2212;<!-- &minus; --></mo> <mi>b</mi> <mo>&#x00B1;<!-- &PlusMinus; --></mo> <msqrt> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>&#x2212;<!-- &minus; --></mo> <mn>4</mn> <mo>&#x2062;<!-- &InvisibleTimes; --></mo> <mi>a</mi> <mo>&#x2062;<!-- &InvisibleTimes; --></mo> <mi>c</mi> </msqrt> </mrow> <mrow> <mn>2</mn> <mo>&#x2062;<!-- &InvisibleTimes; --></mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> </p> </div> </body> </html> 

If you are viewing locally, it needs to be saved as .xhtml, not just the .html that got me a little bit. This, of course, is due to the mathematical material, and not to the font, so this is only a note if you are trying to use this code in its entirety.




There is a decent list of fonts that you can (legally) include in your document here .

Typekit also provides a great way to embed fonts that require licensing deals with types of foundries. They currently offer the option to use one font (of your choice) for free.

Binding fonts has been around for quite some time; the problem was which format you could use. Microsoft, of course, supported its own font format, but Mozilla did not. Sigh

+2
Jun 03 '10 at 20:29
source share

The Google Font Reference is an interesting resource for understanding the direction of web fonts:

http://code.google.com/webfonts/preview

+2
Jun 03 '10 at 20:37
source share

Google recently released the Font API , it may come in handy.

+2
Jun 03 2018-10-06T00:
source share



All Articles