From 0643097008c5489ad6a3d526a8ed63ca8c8f6807 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 23 Jan 2018 13:55:40 +0000 Subject: [PATCH] Add woof2 to webfont kits | wip #1892 @0.25 --- inc/commons/class.common.tools.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index a9f2e1de2..4d89f4c04 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -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; -- 2.39.5