]> _ Git - cubeextranet.git/commitdiff
Add woof2 to webfont kits | wip #1892 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Jan 2018 13:55:40 +0000 (13:55 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Jan 2018 13:55:40 +0000 (13:55 +0000)
inc/commons/class.common.tools.php

index a9f2e1de207628954ba3afac3d71d01dc9dd41a3..4d89f4c0456f259e48e551d7114721110321a959 100644 (file)
@@ -385,7 +385,7 @@ class commonTools {
                        $fontFile = $tmp . '/' . strtolower($name);
                        move_uploaded_file($tmp_name, $fontFile);
 
-                       $ext = array('ttf', 'woff', 'eot', 'php');
+                       $ext = array('ttf', 'woff', 'woff2', 'eot', 'php');
 
                        foreach ($ext as $e) {
                                $out = $tmp . '/' . $fontName . '.' . $e;
@@ -405,6 +405,9 @@ class commonTools {
                                } else if ($e == 'eot') {
                                        $ttf = $tmp . '/' . $fontName . '.ttf';
                                        `/usr/local/bin/ttf2eot < $ttf > $out`;
+                               } else if ($e == 'woff2') {
+                                       $ttf = $tmp . '/' . $fontName . '.ttf';
+                                       `cat $ttf | ttf2woff2 >> $out`;
                                } else if ($e == 'php') {
                                        $ttf = $tmp . '/' . $fontName . '.ttf';
                                        include ROOT . '/inc/cube/externals/fpdf/makefont/makefont.php';
@@ -418,6 +421,7 @@ class commonTools {
     font-family: '$fontName';
     src: url('$fontName.eot');
     src: url('$fontName.eot?#iefix') format('embedded-opentype'),
+         url('$fontName.woff2') format('woff2'),
          url('$fontName.woff') format('woff'),
          url('$fontName.ttf') format('truetype');
     font-weight: normal;