Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot - Font Awesome OTS parsing error: Failed to convert

Problem with Fonts not working correctly within a Spring Boot / Spring MVC Application.

The problem is that all of the font files show various errors such as below

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.woff2?v=4.4.0
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.woff?v=4.4.0
OTS parsing error: incorrect file size in WOFF header

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.ttf?v=4.4.0
OTS parsing error: incorrect entrySelector for table directory
like image 984
code Avatar asked Dec 02 '15 07:12

code


1 Answers

The issue is that Maven was filtering the font files and corrupting them.

    <resource>
        <directory>${project.basedir}/src/main/resources</directory>
        <filtering>true</filtering>
    </resource>

The fix was to make the following changes to the pom.xml

    <resource>
        <directory>${project.basedir}/src/main/resources</directory>
        <filtering>true</filtering>
        <excludes>
            <exclude>static/fonts/**</exclude>
        </excludes>
    </resource>

    <resource>
        <directory>${project.basedir}/src/main/resources</directory>
        <filtering>false</filtering>
        <includes>
            <include>static/fonts/**</include>
        </includes>
    </resource>

This change allows for the fonts to not be filtered during packaging.

like image 147
code Avatar answered Sep 19 '22 14:09

code