Tag Archives: Springboot OTS parsing error

How to Solve Springboot OTS parsing error: Failed to convert WOFF 2.0 font to SFNT

After the font and other files are added to the springboot project, the page cannot be recognized, and the browser debugging window reports the following error:

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

The solution is to add the following contents to the POM file without filtering the font file

<build>
  <plugins>  
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-resources-plugin</artifactId>
     <configuration>
          <nonFilteredFileExtensions>
               <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
               <nonFilteredFileExtension>woff</nonFilteredFileExtension>
               <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
     </configuration>
    </plugin>
  </plugins>
</build>

Finally, don’t forget to restart the project!! Clear browser cache