Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] Hacer como google fonts

Estas en el tema de Hacer como google fonts en el foro de PHP en Foros del Web. Hola amigos, estoy desarrollando un php en el que quiero hacer algo similar a Google Fonts, y así evitarme repetir códigos de font face, en ...
  #1 (permalink)  
Antiguo 14/09/2014, 06:29
 
Fecha de Ingreso: abril-2010
Mensajes: 267
Antigüedad: 14 años
Puntos: 1
Hacer como google fonts

Hola amigos, estoy desarrollando un php en el que quiero hacer algo similar a Google Fonts, y así evitarme repetir códigos de font face, en concreto como hace esta url:

http://fonts.googleapis.com/css?family=Oswald|Roboto

Todo lo tengo perfectamente hecho, pero me falta una cosa, en concreto que el get me permita añadir mas de una fuente, separandola por | , como hace ese enlace, y repetir el font face, yo tengo hecho esta parte:

Código:
<?php

	header('Content-type: text/css');
	
	if($_GET['font'] != NULL && file_exists('fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.ttf')) {
	
		if($_GET['weight'] == 'bold') {
		
			$weight = $_GET['weight'];
		
		} else {
		
			$weight = 'normal';
		
		}
	
		echo '	@font-face {';
		echo '		font-family: \'' . $_GET['font'] . '\';';
		echo '		src: url(\'fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.eot\') format(\'eot\');';
		echo '		src: url(\'fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.eot?#iefix\') format(\'embedded-opentype\'),';
		echo '		url(\'fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.woff2\') format(\'woff2\'),';
		echo '		url(\'fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.woff\') format(\'woff\'),';
		echo '		url(\'fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.ttf\') format(\'truetype\'),';
		echo '		url(\'fonts/' . $_GET['font'] . '/' . $_GET['font'] . '.svg\') format(\'svg\');';
		echo '		font-weight: ' . $weight . ';';
		echo '		font-style: ' . $weight . ';';
		echo '	}';
	
	}

?>
Se agradece mucho la ayuda :)

¡Un Saludo!

Etiquetas: fonts, google
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:20.