tmo
V2EX  ›  CSS

有什么字体文件切块的工具嘛

  •  
  •   tmo · Oct 20, 2022 · 2461 views
    This topic created in 1315 days ago, the information mentioned may be changed or developed.

    如题,想要在网站使用中文字体,几十 mb ,用 css font-face unicode-range 似乎可以实现切块,但是不知道用什么工具来生成

    例如小米网站的 misans: https://font.sec.miui.com/font/css?family=MiSans:300,450,500,650,800:Chinese_Simplify,Latin&display=swap

    6 replies    2022-10-21 14:24:00 +08:00
    tool2d
        1
    tool2d  
       Oct 20, 2022
    这又没办法乱切,每个有可能用到的文字,都是程序根据使用的文本预生成的。

    老老实实写代码吧。
    duan602728596
        2
    duan602728596  
       Oct 21, 2022
    可以试试 Font-spider
    wsph123
        3
    wsph123  
       Oct 21, 2022
    试下来还是 fontmin 勉强能用,虽然性能很差
    tmo
        4
    tmo  
    OP
       Oct 21, 2022 via Android
    @tool2d 好的

    @duan602728596 看 github 介绍,Font-spider 是根据网页内容生成 font 文件的吧,有没有可以实现只是把文件切成数个小文件然后用 css 组合起来的工具呢


    @wsph123 谢谢,一会试试看
    wsph123
        5
    wsph123  
       Oct 21, 2022
    我现在是把页面用的字生成一份用于首屏加载
    常见字在首屏加载完成之后用户使用之前加载
    其余字用户用到再通过 API 实时取
    gydi
        6
    gydi  
       Oct 21, 2022
    可以看看我这个 https://github.com/zzzgydi/font-pack 传入字体和需要的文字,将这个字体切成包含这些文字的一个字体和不包含这些字体的另一份字体,同时生成 css 。不过好像有点小 bug 一直没管,感兴趣可以看看。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1025 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 22:36 · PVG 06:36 · LAX 15:36 · JFK 18:36
    ♥ Do have faith in what you're doing.