• 解决访问 jar 包里面的字体报错:OTS parsing error: incorrect file size in WOFF header


    前言:jar 包里面的字体加载,浏览器 console 中报警告信息,这里记录一下解决方案。

    附:自己的一个 jar 包源码 https://github.com/yuleGH/querydb

    错误问题:

      谷歌浏览器 console 中报警告信息:

      Failed to decode downloaded font: http://localhost:8080/font/element-icons.woff?v=230-rc1
      OTS parsing error: incorrect file size in WOFF header

    原因:

      网上说是由于使用 maven 的 resource 插件开启 filtering 功能后,会破坏有二进制内容的文件。

    解决方案:

      我把我的 jar 包里面的代码贴出来,亲测可用

                <!--配置打包时字体文件不被maven拷贝,导致字体文件破坏-->
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>true</filtering>
                    <includes>
                        <include>**/*.properties</include>
                        <include>**/*.html</include>
                        <include>**/*.js</include>
                        <include>**/*.css</include>
                        <include>**/*.xml</include>
                    </includes>
                    <excludes>
                        <exclude>**/*.ttf</exclude>
                        <exclude>**/*.woff</exclude>
                    </excludes>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <filtering>false</filtering>
                    <includes>
                        <include>**/*.ttf</include>
                        <include>**/*.woff</include>
                    </includes>
                </resource>

      

  • 相关阅读:
    010_STM32CubeMXADC
    009_STM32CubeMXPWM
    008_STM32CubeMX定时器中断
    007_STM32CubeMX外部中断
    006_STM32CubeMX按键输入
    005_STM32CubeMX串口
    004_STM32CubeMX官方例程
    003_STM32CubeMX点灯
    002_STM32CubeMX配置基础工程
    006_word发表博客到博客园中
  • 原文地址:https://www.cnblogs.com/yuxiaole/p/9739814.html
Copyright © 2020-2023  润新知