From f49805eea56dcd607871fda5f31b42e02f1b1361 Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Sat, 24 Jan 2015 16:33:29 +0100 Subject: Add support for font previews --- lib/private/preview.php | 3 ++- lib/private/preview/font.php | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lib/private/preview/font.php (limited to 'lib') diff --git a/lib/private/preview.php b/lib/private/preview.php index c276fa5489a..5b47b34f05b 100644 --- a/lib/private/preview.php +++ b/lib/private/preview.php @@ -731,6 +731,7 @@ class Preview { * - OC\Preview\Illustrator * - OC\Preview\Postscript * - OC\Preview\Photoshop + * - OC\Preview\Font */ if(empty(self::$enabledProviders)) { self::$enabledProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', array( @@ -790,8 +791,8 @@ class Preview { 'PDF' => 'OC\Preview\PDF', 'AI' => 'OC\Preview\Illustrator', 'PSD' => 'OC\Preview\Photoshop', - // Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php 'EPS' => 'OC\Preview\Postscript', + 'TTF' => 'OC\Preview\Font', ); foreach ($imagickProviders as $queryFormat => $provider) { diff --git a/lib/private/preview/font.php b/lib/private/preview/font.php new file mode 100644 index 00000000000..58d64e8264d --- /dev/null +++ b/lib/private/preview/font.php @@ -0,0 +1,19 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\Preview; + +// .otf, .ttf and .pfb +class Font extends Bitmap { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/application\/(?:font-sfnt|x-font$)/'; + } +} \ No newline at end of file -- cgit v1.2.3