<?php

	if (is_link(dirname($_SERVER['SCRIPT_FILENAME']))) {
		define('_PS_ROOT_DIR_', dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));

	}


	if (is_link(dirname($_SERVER['SCRIPT_FILENAME']))) {
		require_once dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . '/config/config.inc.php';

	} else {
		require_once __DIR__ . '/../../config/config.inc.php';
	}

    require_once __DIR__ . '/require.php';

	use SwissStyle\Glob\Controller\Glob as GC;

	header('Content-type: text/css');

    $request_type="";
    if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='off')
        $request_type = 'SSL';
	
	//$base = ( ( $request_type == 'SSL' ) ? HTTPS_SERVER : HTTP_SERVER ) . "fonts/custom/";

    $config = GC::getConfig();

    $fontFamilies = parse_ini_file($config->builder->font_path . 'fonts.ini');
	$fontFace = '';
    $fonts_src = $config->builder->font_src;
	foreach ($fontFamilies as $fontFamily) {
		$fontFace = $fontFace . "\n\n" . "@font-face {".
		    "font-family: '$fontFamily';".
		    "src: url('" . $fonts_src . "custom/{$fontFamily}.eot');".
		    "src: local('☺'),".
		         "url('" . $fonts_src . "custom/{$fontFamily}.woff') format('woff'),".
		         "url('" . $fonts_src . "custom/{$fontFamily}.ttf') format('truetype'),".
		         "url('" . $fonts_src . "custom/{$fontFamily}.svg#".base64_encode($fontFamily)."') format('svg');".
		    "font-weight: normal !important;".
		    "font-style: normal !important;".
		"}";
	}
	echo $fontFace;
?>