git.lucas.co / website
source for lucas.co

archive/fonts/abhaya-libre/How_to_use_webfonts.html (9.9K)

  1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3 
  4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5 <head>
  6 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7 
  8 	<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />
  9 
 10 	<style type="text/css" media="screen">
 11 		/*-- RESET ------*/
 12 		html, body, div, span, applet, object, iframe,
 13 		h1, h2, h3, h4, h5, h6, p, blockquote, pre,
 14 		a, abbr, acronym, address, big, cite, code,
 15 		del, dfn, em, font, img, ins, kbd, q, s, samp,
 16 		small, strike, strong, sub, sup, tt, var,
 17 		b, u, i, center, dl, dt, dd, ol, ul, li,
 18 		fieldset, form, label, legend, table, 
 19 		caption, tbody, tfoot, thead, tr, th, td 
 20 		                  {margin: 0;padding: 0;border: 0;outline: 0;
 21 		                  font-size: 100%;vertical-align: baseline;
 22 		                  background: transparent;}
 23 		body              {line-height: 1;}
 24 		ol, ul            {list-style: none;}
 25 		blockquote, q     {quotes: none;}
 26 		blockquote:before, blockquote:after,
 27 		q:before, q:after {content: '';	content: none;}
 28 		:focus            {outline: 0;}
 29 		ins               {text-decoration: none;}
 30 		del               {text-decoration: line-through;}
 31 		table             {border-collapse: collapse;border-spacing: 0;}
 32 		
 33 		/*-- GRID -----*/
 34 		.section {margin-bottom: 18px;
 35 		}
 36 		.section:after	{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
 37 		.section 		{*zoom: 1;}
 38 
 39 		.section .firstcolumn,
 40 		.section .firstcol {margin-left: 0;}
 41 		
 42 		.grid1, .grid1_2cols, .grid1_3cols, .grid1_4cols, .grid2, .grid2_3cols, .grid2_4cols, .grid3, .grid3_2cols, .grid3_4cols, .grid4, .grid4_3cols, .grid5, .grid5_2cols, .grid5_3cols, .grid5_4cols, .grid6, .grid6_4cols, .grid7, .grid7_2cols, .grid7_3cols, .grid7_4cols, .grid8, .grid8_3cols, .grid9, .grid9_2cols, .grid9_4cols, .grid10, .grid10_3cols, .grid10_4cols, .grid11, .grid11_2cols, .grid11_3cols, .grid11_4cols, .grid12
 43 		{margin-left: 15px;float: left;display: inline; overflow: hidden;}
 44 		.width5, .grid5, .span-5 {width: 335px;}
 45 		.width5_2cols,.grid5_2cols {width: 160px;}
 46 		.width5_3cols,.grid5_3cols  {width: 101px;}
 47 		.width5_4cols,.grid5_4cols  {width: 72px;}
 48 		.input_width5 {width: 329px;}
 49 
 50 		.width6, .grid6, .span-6 {width: 405px;}
 51 		.width6_4cols,.grid6_4cols  {width: 90px;}
 52 		.input_width6 {width: 399px;}
 53 
 54 		.width7, .grid7, .span-7 {width: 475px;}
 55 		.width7_2cols,.grid7_2cols {width: 230px;}
 56 		.width7_3cols,.grid7_3cols  {width: 148px;}
 57 		.width7_4cols,.grid7_4cols  {width: 107px;}
 58 		.input_width7 {width: 469px;}
 59 		
 60 		/*-- STYLES -----*/
 61 		body {
 62 			color: #000;
 63 			background-color: #dcdcdc;
 64 			font: 13px Arial, sans-serif;
 65 		}
 66 
 67 		a {
 68 			text-decoration: none;
 69 			color: #1883ba;
 70 		}
 71 
 72 		h1{
 73 			font-size: 32px;
 74 			font-weight: normal;
 75 			font-style: normal;
 76 			margin-bottom: 18px;
 77 		}
 78 
 79 		h2{
 80 			font-size: 18px;
 81 		}
 82 
 83 		#container {
 84 			width: 865px;
 85 			margin: 0px auto;
 86 		}
 87 		
 88 
 89 
 90 		#header {
 91 			height:109px;
 92 			font-size: 36px;
 93 			background-color: #000;
 94 			color: #fff;
 95 			text-indent:-9999px;
 96 			background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASoAAABtCAMAAAAhztx9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADBQTFRFz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Y3V7EsS1Q0X1cZJW3FdeXnHJX1OU8Iqcj/pPJnOHVU8Yw1N0UxzoMUJzavDpalMvcwWKC6Z1H076i8yrSS6pxTkCG0UuWJXlkqT+Va7vQLVNVpXeSoXGWqm6iupOO3HVVePkjmuOP2TOXSGS3nql+nSkfAV7l1WDVTnY805qgGb5T0p8vRkF+gcqlOFkfA0V6LdKNaKqm2M7V/QGUfRaUrC1SV5rw0zM4lqmsYfKyraBeqqmo96JjsI6rp9deq8gzNpzJhDVukOofBx2q9E1XFHDBe6PuEirZS2T57T+XKVNaUPM4BO1FVrCzw6Oyfd8Aaqm3wTyxT3QVccWWhE1XFehWPGdupxjCtV1HJpwVjEo8ZT+tVnagqVkF53GFrqILZn927IVsbVZB0lJ+A4nqchlTJKmgvqvdr6wGVYHVUZJikm/sZ5ZbJZSuV8pY6g2opmbqQ9WFt3U2RulC93bHhaY+toIrryWlrpdq8tmgz1zAVqNwKfdolvehC9XYfkL+tWiuo6NZONXqNka7BYg3JzM2f9gE7Ub3ZXU5qCV1DJQOradw+oHL1pcmtwZPMuPEwV2/ZXY7fUUhaln1nYc69s5B9aSE9S+cmy9S+saDCfSZVeokgefHAvt9gXpOUaXqdl1xhTN5ZGF/vLJimRRgEqEAFKlCBClQIUIEKVKACFahAhQAVqEAFKlCBCgEqUIEKVKACFQJUoAIVqEAFKgSoQAUqUIEKVKBCgApUfx3/BBgAeuw63hnBp0AAAAAASUVORK5CYII=) no-repeat left center;
 97 			background-color: #31a7e0;
 98 			
 99 		}
100 		
101 		#main_content {
102 			background-color: #fff;
103 			padding: 20px 20px 20px;
104 		}
105 
106 
107 		#footer p {
108 			margin: 0;
109 			padding-top: 10px;
110 			padding-bottom: 50px;
111 			color: #333;
112 			font: 10px Arial, sans-serif;
113 		}
114 		code {
115 			white-space: pre;
116 			background-color: #eee;
117 			display: block;
118 			padding: 10px;
119 			margin-bottom: 18px;
120 			overflow: auto;
121 		}
122 
123 		.box  { 
124 		  padding: 18px; 
125 		  margin-bottom: 18px; 
126 		  background: #eee; 
127 		}
128 		.bottom,.last 	{margin-bottom:0 !important; padding-bottom:0 !important;}
129 		
130 
131 		
132 		p{
133 			line-height: 1.2em;
134 			margin-bottom: 18px;
135 			font: 13px Arial, sans-serif;
136 		}
137 
138 
139 
140 		h3{
141 			font-size: 15px;
142 			margin-top: 18px;
143 		}
144 		
145 		.sidebar p{
146 			font-size: 12px;
147 			line-height: 1.4em;
148 		}
149 		
150 	</style>
151 
152 <title>How to Use Webfonts</title>
153 	
154 </head>
155 
156 <body>
157 <div id="container">
158 	<div id="header">
159 		Fontspring
160 	</div>
161 	<div id="main_content">
162 			<div class="section">
163 				<div class="grid7 firstcol">
164 					<h1>Installing Webfonts</h1>
165 					
166 					<p>Webfonts are supported by all major browser platforms but not all in the same way. There are currently four different font formats that must be included in order to target all browsers. This includes TTF, WOFF, EOT and SVG.</p>
167 					
168 					<h2>1. Upload your webfonts</h2>
169 					<p>You must upload your webfont kit to your website. They should be in or near the same directory as your CSS files.</p>
170 					
171 					<h2>2. Include the webfont stylesheet</h2>
172 					<p>A special CSS @font-face declaration helps the various browsers select the appropriate font it needs without causing you a bunch of headaches. Learn more about this syntax by reading the <a href="https://www.fontspring.com/blog/further-hardening-of-the-bulletproof-syntax">Fontspring blog post</a> about it. The code for it is as follows:</p>
173 
174 
175 <code>
176 @font-face{ 
177 	font-family: 'MyWebFont';
178 	src: url('WebFont.eot');
179 	src: url('WebFont.eot?iefix') format('eot'),
180 	     url('WebFont.woff') format('woff'),
181 	     url('WebFont.ttf') format('truetype'),
182 	     url('WebFont.svg#webfont') format('svg');
183 }
184 </code>
185 	<p>We've already gone ahead and generated the code for you. All you have to do is link to the stylesheet in your HTML, like this:</p>
186 	<code>&lt;link rel=&quot;stylesheet&quot; href=&quot;stylesheet.css&quot; type=&quot;text/css&quot; charset=&quot;utf-8&quot; /&gt;</code>
187 
188 					<h2>3. Modify your own stylesheet</h2>
189 					<p>To take advantage of your new fonts, you must tell your stylesheet to use them. Look at the original @font-face declaration above and find the property called "font-family." The name linked there will be what you use to reference the font. Prepend that webfont name to the font stack in the "font-family" property, inside the selector you want to change. For example:</p>
190 <code>p { font-family: 'MyWebFont', Arial, sans-serif; }</code>
191 
192 <h2>4. Test</h2>
193 <p>Getting webfonts to work cross-browser <em>can</em> be tricky. Use the information in the sidebar to help you if you find that fonts aren't loading in a particular browser.</p>
194 				</div>
195 				
196 				<div class="grid5 sidebar">
197 					<div class="box">
198 						<h2>Troubleshooting<br />Font-Face Problems</h2>
199 						<p>Having trouble getting your webfonts to load in your new website? Here are some tips to sort out what might be the problem.</p>
200 
201 						<h3>Fonts not showing in any browser</h3>
202 
203 						<p>This sounds like you need to work on the plumbing. You either did not upload the fonts to the correct directory, or you did not link the fonts properly in the CSS. If you've confirmed that all this is correct and you still have a problem, take a look at your .htaccess file and see if requests are getting intercepted.</p>
204 
205 						<h3>Fonts not loading in iPhone or iPad</h3>
206 
207 						<p>The most common problem here is that you are serving the fonts from an IIS server. IIS refuses to serve files that have unknown MIME types. If that is the case, you must set the MIME type for SVG to "image/svg+xml" in the server settings. Follow these instructions from Microsoft if you need help.</p>
208 
209 						<h3>Fonts not loading in Firefox</h3>
210 
211 						<p>The primary reason for this failure? You are still using a version Firefox older than 3.5. So upgrade already! If that isn't it, then you are very likely serving fonts from a different domain. Firefox requires that all font assets be served from the same domain. Lastly it is possible that you need to add WOFF to your list of MIME types (if you are serving via IIS.)</p>
212 
213 						<h3>Fonts not loading in IE</h3>
214 
215 						<p>Are you looking at Internet Explorer on an actual Windows machine or are you cheating by using a service like Adobe BrowserLab? Many of these screenshot services do not render @font-face for IE. Best to test it on a real machine.</p>
216 
217 						<h3>Fonts not loading in IE9</h3>
218 
219 						<p>IE9, like Firefox, requires that fonts be served from the same domain as the website. Make sure that is the case.</p>
220 					</div>
221 				</div>
222 			</div>
223 			
224 		</div>
225 	
226 	</div>
227 	
228 </div>
229 </body>
230 </html>