Thursday 6 August 2015

Maven build and Webfonts.

The build of a Maven project containing WEB fonts may be broken.



I'm using Twitter Bootstrap for the display of my WEB application. Suddenly the glyphicons disappear or are replaced by a ugly placeholder.

The problem affects Google Chrome and Firefox (the current versions) on Windows Vista. On the same computer Safari works as expected.

Chrome, on the console, displays «Failed to decode downloaded font» an the URL of the font. The message doesn't help very much. Firefox is more verbose and tells me that there is something wrong with the file size.

I check the size of the original WEB font file and discover that Maven (3.3.3) expands the EOT and the WOFF files during the build of the WAR archive.

I place my font files into the resources folder. It seems that  Maven (the resources plugin) recognizes a part of the files as text and converts it to UTF-8, which is my default encoding.

I don't remember any changes in my code or build environment between the last successfully display and the first time the glyphicons fail.

Anyway the solution of the problem is simple: I add a «nonFilteredFileExtensions» section containing all the extensions of the WEB fonts and the WEB application works again with all browsers.

No comments:

Post a Comment