Wednesday, 24 August 2016

Failed to decode downloaded font

When accessing AEM pages fonts may not be loaded properly

Error: 
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT




Solution:
Add below plugin in pom.xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-content-resources</id>
            <phase>process-resources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/vault-work</outputDirectory>
                
                <nonFilteredFileExtensions>
                    <nonFilteredFileExtension>jpg</nonFilteredFileExtension>
                    <nonFilteredFileExtension>jpeg</nonFilteredFileExtension>
                    <nonFilteredFileExtension>gif</nonFilteredFileExtension>
                    <nonFilteredFileExtension>png</nonFilteredFileExtension>
                    <nonFilteredFileExtension>ico</nonFilteredFileExtension>
                    <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                    <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                    <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                    <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                    <nonFilteredFileExtension>otf</nonFilteredFileExtension>
                    <nonFilteredFileExtension>eot</nonFilteredFileExtension>
                    <nonFilteredFileExtension>jar</nonFilteredFileExtension>
                    <nonFilteredFileExtension>zip</nonFilteredFileExtension>
                </nonFilteredFileExtensions>
                
                <resources>
                    <resource>
                        <directory>${basedir}/src/main/content</directory>
                        <filtering>true</filtering>
                        <excludes>
                            <exclude>/etc/designs/${project.parent.artifactId}/jcr:content(/.*)?</exclude>
                            <exclude>**/*.eot</exclude>
                            <exclude>**/*.svg</exclude>
                            <exclude>**/*.ttf</exclude>
                            <exclude>**/*.woff</exclude>
                            <exclude>**/*.woff2</exclude>
                            <exclude>**/*.otf</exclude>
                            <exclude>**/.svn</exclude>
                            <exclude>**/.vlt</exclude>
                            <exclude>**/.vltignore</exclude>
                            <exclude>**/.DS_Store</exclude>
                        </excludes>
                    </resource>
                    <resource>
                        <directory>${basedir}/src/main/content</directory>
                        <filtering>false</filtering>
                        <includes>
                            <include>/etc/designs/${project.parent.artifactId}/jcr:content(/.*)?</include>
                            <include>**/*.eot</include>
                            <include>**/*.svg</include>
                            <include>**/*.ttf</include>
                            <include>**/*.woff</include>
                            <include>**/*.woff2</include>
                            <include>**/*.otf</include>
                        </includes>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

No comments :

Post a comment