Skip to content

Commit f49805e

Browse files
committed
Add support for font previews
1 parent 09a06e4 commit f49805e

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

config/config.sample.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@
679679
* - OC\Preview\StarOffice
680680
* - OC\Preview\SVG
681681
* - OC\Preview\TIFF
682+
* - OC\Preview\Font
682683
*
683684
* .. note:: Troubleshooting steps for the MS Word previews are available
684685
* at the :doc:`collaborative_documents_configuration` section

lib/private/preview.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ public static function registerProvider($class, $options = array()) {
731731
* - OC\Preview\Illustrator
732732
* - OC\Preview\Postscript
733733
* - OC\Preview\Photoshop
734+
* - OC\Preview\Font
734735
*/
735736
if(empty(self::$enabledProviders)) {
736737
self::$enabledProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', array(
@@ -790,8 +791,8 @@ protected static function registerCoreProviders() {
790791
'PDF' => 'OC\Preview\PDF',
791792
'AI' => 'OC\Preview\Illustrator',
792793
'PSD' => 'OC\Preview\Photoshop',
793-
// Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php
794794
'EPS' => 'OC\Preview\Postscript',
795+
'TTF' => 'OC\Preview\Font',
795796
);
796797

797798
foreach ($imagickProviders as $queryFormat => $provider) {

lib/private/preview/font.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* @copyright Olivier Paroz 2015 <[email protected]>
4+
* This file is licensed under the Affero General Public License version 3 or
5+
* later.
6+
* See the COPYING-README file.
7+
*/
8+
9+
namespace OC\Preview;
10+
11+
// .otf, .ttf and .pfb
12+
class Font extends Bitmap {
13+
/**
14+
* {@inheritDoc}
15+
*/
16+
public function getMimeType() {
17+
return '/application\/(?:font-sfnt|x-font$)/';
18+
}
19+
}

0 commit comments

Comments
 (0)