KonghaYao / cn-font-split

划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.

Home Page:https://chinese-font.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

【分包算法】分包陷落问题

KonghaYao opened this issue · comments

中层陷落问题是由于分包时,中文分包的最后几个字符没有进行处理,不过这些字符都是使用率非常低的字符

image
最新分包算法解决超重问题之后,需要解决较多分包碎片的问题

const skmeans = require("skmeans")
const data = [1,12,13,4,25,21,22,3,14,5,11,2,23,24,15];
const num = 3
const res = skmeans(data,num);

res.idxs.reduce(
    (col,cur,index)=>{
        col[cur] .push( data[index])
        return col
    },
    [...Array(num).keys()].map(i=>[])
)

[[25, 21, 22, 23, 24], [12, 13, 14, 11, 15], [1, 4, 3, 5, 2]]
可以尝试使用 kmeans 算法进行离群值分析,从而分出数值小的集群,然后合并

image
kmeans 算法只是聚合了相似的数据,但是对离群最小值没法处理干净

image
图中为理论分包数,而非实际分包数

z-score 算法能有效削减低分包值