Example #1
0
<?php

require_once '../source/fontproxy.php';
require_once '../source/fonttypes.php';
$proxy = new FontProxy();
$proxy->addFont('LuxiSans-Regular', FontTypes::OTF, '../fonts/LuxiSans-Regular.otf');
$proxy->addFont('LuxiSans-Bold', FontTypes::OTF, '../fonts/LuxiSans-Bold.otf');
$proxy->addFont('LuxiSans-BoldOblique', FontTypes::OTF, '../fonts/LuxiSans-BoldOblique.otf');
$proxy->addFont('LuxiSans-Regular', FontTypes::EOT, '../fonts/LuxiSans-Regular.eot');
$proxy->addFont('LuxiSans-Bold', FontTypes::EOT, '../fonts/LuxiSans-Bold.eot');
$proxy->addFont('LuxiSans-BoldOblique', FontTypes::EOT, '../fonts/LuxiSans-BoldOblique.eot');
$proxy->addFontTypes('LuxiSans - Bold Italic', array(FontTypes::OTF => '../fonts/LuxiSans-BoldIt.otf', FontTypes::EOT => '../fonts/LuxiSans-BoldIt.eot'));
$proxy->addTypeFonts(FontTypes::TTF, array('LuxiSans-Regular' => '../fonts/LuxiSans-Regular.ttf', 'LuxiSans-Bold' => '../fonts/LuxiSans-Bold.ttf', 'LuxiSans-Oblique' => '../fonts/LuxiSans-Oblique.ttf', 'LuxiSans-BoldOblique' => '../fonts/LuxiSans-BoldOblique.ttf'));
print_r($proxy);
$font = $proxy->getFont('BoldOblique-Regular', FontTypes::OTF);
print_r($font);
$support = $proxy->detectSupport($_SERVER['HTTP_USER_AGENT']);
print_r($support);
$serve = $proxy->serve('BoldOblique-BoldOblique', $_SERVER['HTTP_USER_AGENT']);
print_r($serve);
Example #2
0
<?php

require_once '../source/fontproxy.php';
require_once '../source/fonttypes.php';
$proxy = new FontProxy();
$proxy->addFontTypes('LuxiSans-Regular', array(FontTypes::OTF => '../fonts/LuxiSans-Regular.otf', FontTypes::EOT => '../fonts/LuxiSans-Regular.eot', FontTypes::TTF => '../fonts/LuxiSans-Regular.ttf'))->addFontTypes('LuxiSans-Bold', array(FontTypes::OTF => '../fonts/LuxiSans-Bold.otf', FontTypes::EOT => '../fonts/LuxiSans-Bold.eot', FontTypes::TTF => '../fonts/LuxiSans-Bold.ttf'))->addFontTypes('LuxiSans-Oblique', array(FontTypes::OTF => '../fonts/LuxiSans-Oblique.otf', FontTypes::EOT => '../fonts/LuxiSans-Oblique.eot', FontTypes::TTF => '../fonts/LuxiSans-Oblique.ttf'))->addFontTypes('LuxiSans-BoldOblique', array(FontTypes::OTF => '../fonts/LuxiSans-BoldOblique.otf', FontTypes::EOT => '../fonts/LuxiSans-BoldOblique.eot', FontTypes::TTF => '../fonts/LuxiSans-BoldOblique.ttf'));
$declarations = '';
$sniff = $proxy->sniff($_SERVER['HTTP_USER_AGENT']);
$fonts = isset($_GET['font']) ? explode('|', urldecode($_GET['font'])) : array();
if (sizeof($fonts) > 0) {
    foreach ($fonts as $font) {
        $extra = '-Regular';
        $weight = '';
        $style = '';
        $font = explode(':', $font);
        if (sizeof($font) > 1) {
            switch (strtolower($font[1])) {
                case 'b':
                case 'bold':
                    $weight = 'bold';
                    $extra = '-Bold';
                    break;
                case 'i':
                case 'italic':
                case 'o':
                case 'oblique':
                    $style = 'oblique';
                    $extra = '-Oblique';
                    break;
                case 'bi':
                case 'bold italic':