When trying to use Glyphicons with Algular inside a Spring-boot Java project created through maven, icons are not shown, and these following errors can be seen in console:
Failed to decode downloaded font: <URL> ..
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
OTS parsing error: incorrect file size in WOFF header
OTS parsing error: incorrect entrySelector for table directory
There are some solutions around here, but none of them considers Spring-Boot Maven scenario.
It seems like Maven build resources somehow corrupts those files and Bootstrap can not decode them anymore properly, resulting in these errors. One workaround I have found is to add nonFilteredFileExtensions in maven-resources-plugin:
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
Here, we can add all extensions of font/icon files that maven is corrupting, and it should solve the issue.
Plugin section should have something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
For angular + aws, add this: 'image/svg+xml', 'font/ttf', 'font/woff', 'font/woff2',
to binaryMimeTypes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With