Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

关于所有文字显示问题的回答 #299

Description

@ZipCz

问题描述

3bdeb03b43f3e7d9e4f327356fceff67

一、在 控制台 安装字蛛(font-spider)(需要安装nodejs)

npm install font-spider -g

二、新建文件

在你的电脑中新建一个文件夹,在文件夹中新建两个文件第一个1.html,第二个font.css。

(一)新建1.html

<html>
    <head>
          <link rel="stylesheet" href="font.css">
    </head>
    <body>
          <!-- 填写要保留的文字-->
          <p class="ttf">16a4cnOopswWcdeirstvyHSW</p>
    </body>
</html>

(二)新建 font.css

@font-face {
  font-family: 'sf-pro-text_regular';
  /* src引入需要精简的ttf字体文件 */
  src: url('./Pacifico-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}
body {
  font-family: "sf-pro-text_regular";
}
.ttf {
  font-family: 'sf-pro-text_regular';
}

三、修改文件内容

1. 修改 src 引入需要精简的ttf字体文件名

例:src: url('./Pacifico-Regular.ttf') format('truetype');

2.直接将Pacifico-Regular.ttf放入根目录即可

3.修改1.html 中要保留的文字

例:<p class="ttf">16a4cnOopswWcdeirstvyHSW(这里就是需要保留的文字)</p>

四、在控制台 执行字蛛

font-spider 1.html

五、其他说明

特别注意:根目录 .font-spider 为原始备份文件

1. imsyy主页项目,目录中的 Pacifico-Regular-all.ttf 是全部的字体文件。

2. (本文第三项 - 第3条中)16a4cnOopswWcdeirstvyHSW 这一段要保留的字体要全部包含你网站中需要修改的字体。

说明:首页显示为6a4,则上方需要包含。反之则不需要包含在内。

3.若不想使用字蛛请直接将 Pacifico-Regular-all.ttf 重命名为 Pacifico-Regular.ttf 即可

补充信息

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions