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!