Register font is corrupting .TTF file

后端 未结 2 1362
情话喂你
情话喂你 2020-12-11 18:34

On my system I need to register two external font .TTF files:

HamletOrNot.ttf (74 KB)
MorrisRoman-Black.ttf (67 KB)

Before creating the Fon

相关标签:
2条回答
  • 2020-12-11 19:02

    Found it! The maven was corrupting .TTF files when doing the deploy code. To fix, you need to add the extensions that will not be filtered through nonFilteredFileExtension command in pom.xml (maven-resources-plugin).

    <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <version>2.5</version>
      <configuration>
        <encoding>UTF-8</encoding>
        <nonFilteredFileExtensions>
          <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
      </configuration>
    </plugin>
    

    Thank you! xD, ... was lucky!

    0 讨论(0)
  • 2020-12-11 19:02
     <resources>
                        <resource>
                            <directory>src/main/resources</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <excludes>
                                <exclude>**/xyz.properties</exclude>
                                <exclude>**/ehcache-myApp.xml</exclude>
                                <exclude>**/log4j-myApp.xml</exclude>
                                <exclude>**/*.ttf</exclude>
                            </excludes>
                            <filtering>true</filtering>
                        </resource>
                        <resource>
                            <directory>src/main/resources</directory>
                            <includes>
                                <include>**/*.ttf</include>
                            </includes>
                        </resource>
                    </resources>
    

    Broke the fonts as it copies over resources but font file sizes are altered and hence corrupted. This below fixed for Maven 3.0.4 and maven-resources-plugin 3.0.1.

     <plugins>
                <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
                </plugin>
    
    0 讨论(0)
提交回复
热议问题