Ticket #11796 (reopened Bug)

Opened 5 years ago

Last modified 11 months ago

Support for Web Fonts in skins DirectoryViews

Reported by: gweis Owned by:
Priority: minor Milestone: 4.x
Component: General Version: 4.1
Keywords: CMFCore, patch Cc:

Description

We just had troubles to find out why our webfonts did not appear in our skins folder.

After a quick debugging session we found that Products.CMFCore.DirectoryView.DirectoryRegistry has no knowledge about font file extensions.

With recent CSS3 developments, we think that web fonts are an important element of skinning and should therefore be supported by file system directory views in the portal_skins tool.

Following file extensions are most popular to be used for fonts.

.ttf
.woff (application/font-woff ...  http://www.w3.org/TR/WOFF/)
.eot (application/vnd.ms-fontobject ...  http://www.iana.org/assignments/media-types/application/vnd.ms-fontobject)
.svg

Except for the two new mimetypes it sholud be enough to just add additional registerFileExtension lines no Products.CMFCore.FSFile.py

cheers

(happy to supply a patch if this would speed up things)

Attachments

web_font_mimetypes.diff Download (1.0 KB) - added by gweis 4 years ago.
Add the additional mimetypes to Products.MimetypesRegistry
web_font_extensions.diff Download (517 bytes) - added by gweis 4 years ago.
Add requested file extensions to Products.CMFCore.FSFile

Change History

comment:1 Changed 5 years ago by kleist

  • Component changed from Unknown to Infrastructure
  • Milestone set to 4.x

upstream?

Changed 4 years ago by gweis

Add the additional mimetypes to Products.MimetypesRegistry

Changed 4 years ago by gweis

Add requested file extensions to Products.CMFCore.FSFile

comment:2 Changed 4 years ago by gweis

Hi, I created two patches in the hope to bring some movement into this.

web_font_extensions.dff adds the requested file extensions to Products.CMFCore.FSFile

and

web_font_mimetypes.diff adds the additional mimetypes to Products.MimetypesRegistry.

both patches are against current master/trunk of these packages.

cheers

comment:3 Changed 4 years ago by davisagli

  • Component changed from Infrastructure to General

comment:4 Changed 4 years ago by kleist

  • Status changed from new to closed
  • Keywords CMFCore, patch added; CMFCore removed
  • Version set to 4.1
  • Resolution set to fixed

In Plone 4.2 coredev buildout, ZMI /mimetypes_registry contains .ttf .woff .eot .svg

Assuming that the other patch has been applied as well.

comment:6 Changed 14 months ago by rafaelbco

  • Status changed from closed to reopened
  • Resolution fixed deleted

I tested on Plone 4.3 and the problem persists.

ZMI/mimetypes_registry is OK, however Products.CFMCore is not good. I applied the patch to FSFile.py locally and it worked. It seems we need someone with commit rights on Zope to fix this in Products.CMFCore.

comment:7 Changed 11 months ago by flipmcf

The patch to Products.MimetypesRegistry is sufficient in my opinion, and is enough to resolve the issue and can stand on it's own.

However, you must add this to the init of your own product or plone site. I prefer this because it's using (not editing) the tools CMFCore provides.

from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore import FSFile

registerFileExtension('ttf', FSFile)
registerFileExtension('woff', FSFile)
registerFileExtension('eot', FSFile)
registerFileExtension('svg', FSFile)
Note: See TracTickets for help on using tickets.