]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add support for font previews
authorOlivier Paroz <github@oparoz.com>
Sat, 24 Jan 2015 15:33:29 +0000 (16:33 +0100)
committerOlivier Paroz <github@oparoz.com>
Tue, 24 Feb 2015 21:00:54 +0000 (22:00 +0100)
config/config.sample.php
lib/private/preview.php
lib/private/preview/font.php [new file with mode: 0644]

index 10b079caa8ab9cab665924eaa4538c07b3840c8c..342269101b1f96a77b9a81fcf182052eee1e213a 100644 (file)
@@ -679,6 +679,7 @@ $CONFIG = array(
  *  - OC\Preview\StarOffice
  *  - OC\Preview\SVG
  *  - OC\Preview\TIFF
+ *  - OC\Preview\Font
  *
  * .. note:: Troubleshooting steps for the MS Word previews are available
  *    at the :doc:`collaborative_documents_configuration` section
index c276fa5489a007b4da6360bd06398fe636183c85..5b47b34f05bc7224f78eca0d7bc9b7dc9f58cb34 100644 (file)
@@ -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 (file)
index 0000000..58d64e8
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/**
+ * @copyright Olivier Paroz 2015 <owncloud@interfasys.ch>
+ * 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