Skip to content

Add support for font previews #13648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
* - 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
Expand Down
3 changes: 2 additions & 1 deletion lib/private/preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ public static function registerProvider($class, $options = array()) {
* - OC\Preview\Illustrator
* - OC\Preview\Postscript
* - OC\Preview\Photoshop
* - OC\Preview\Font
*/
if(empty(self::$enabledProviders)) {
self::$enabledProviders = \OC::$server->getConfig()->getSystemValue('enabledPreviewProviders', array(
Expand Down Expand Up @@ -790,8 +791,8 @@ protected static function registerCoreProviders() {
'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) {
Expand Down
19 changes: 19 additions & 0 deletions lib/private/preview/font.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* @copyright Olivier Paroz 2015 <[email protected]>
* 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$)/';
}
}