Skip to content

Commit 04eef93

Browse files
committed
Merge pull request #13648 from oparoz/sfnt-fonts-preview
Add support for font previews
2 parents cf25e6f + f49805e commit 04eef93

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
@@ -681,6 +681,7 @@
681681
* - OC\Preview\StarOffice
682682
* - OC\Preview\SVG
683683
* - OC\Preview\TIFF
684+
* - OC\Preview\Font
684685
*
685686
* .. note:: Troubleshooting steps for the MS Word previews are available
686687
* at the :doc:`../configuration_files/collaborative_documents_configuration`

lib/private/preview.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ public static function registerProvider($class, $options = array()) {
713713
* - OC\Preview\Illustrator
714714
* - OC\Preview\Postscript
715715
* - OC\Preview\Photoshop
716+
* - OC\Preview\Font
716717
*/
717718
if(empty(self::$enabledProviders)) {
718719
self::$enabledProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', array(
@@ -772,8 +773,8 @@ protected static function registerCoreProviders() {
772773
'PDF' => 'OC\Preview\PDF',
773774
'AI' => 'OC\Preview\Illustrator',
774775
'PSD' => 'OC\Preview\Photoshop',
775-
// Requires adding 'eps' => array('application/postscript', null), to lib/private/mimetypes.list.php
776776
'EPS' => 'OC\Preview\Postscript',
777+
'TTF' => 'OC\Preview\Font',
777778
);
778779

779780
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)