zoukankan      html  css  js  c++  java
  • 解决访问 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>

      

  • 相关阅读:
    题解 P3071 【[USACO13JAN]座位Seating】
    [luogu]P3398 仓鼠找sugar
    快速输入输出
    Luogu P3939 数颜色
    HEOI2016/TJOI2016 排序
    POI2011 DYN-Dynamite
    USACO17JAN Promotion Counting
    AHOI2008 聚会
    Luogu P4907 A换B problem
    网络流24题 骑士共存问题
  • 原文地址:https://www.cnblogs.com/yuxiaole/p/9739814.html
Copyright © 2011-2022 走看看