18s 0.1.5 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/-3Uh.woff2 +0 -0
- package/-XyM.woff2 +0 -0
- package/-cMN.woff2 +0 -0
- package/-cdB.woff2 +0 -0
- package/0T_u.woff2 +0 -0
- package/0iJj.woff2 +0 -0
- package/0ztE.woff2 +0 -0
- package/15pB.woff2 +0 -0
- package/18RQ.woff2 +0 -0
- package/1EtS.woff2 +0 -0
- package/1pzg.woff2 +0 -0
- package/2-pP.woff2 +0 -0
- package/2EmK.woff2 +0 -0
- package/2_ZR.woff2 +0 -0
- package/2iUm.woff2 +0 -0
- package/33Hv.woff2 +0 -0
- package/3bVl.woff2 +0 -0
- package/46Sm.woff2 +0 -0
- package/46TS.woff2 +0 -0
- package/4l5w.woff2 +0 -0
- package/58Db.woff2 +0 -0
- package/5Dkj.woff2 +0 -0
- package/5JBo.woff2 +0 -0
- package/5SiX.woff2 +0 -0
- package/5TIG.woff2 +0 -0
- package/5nIn.woff2 +0 -0
- package/6CEg.woff2 +0 -0
- package/6Gnc.woff2 +0 -0
- package/6kAt.woff2 +0 -0
- package/7LPF.woff2 +0 -0
- package/7_8i.woff2 +0 -0
- package/8Ppr.woff2 +0 -0
- package/8QJX.woff2 +0 -0
- package/8X-F.woff2 +0 -0
- package/8iHl.woff2 +0 -0
- package/8kLc.woff2 +0 -0
- package/8xAn.woff2 +0 -0
- package/8xnu.woff2 +0 -0
- package/8yhR.woff2 +0 -0
- package/9Gj4.woff2 +0 -0
- package/9MPt.woff2 +0 -0
- package/9XT7.woff2 +0 -0
- package/9dxL.woff2 +0 -0
- package/9xYe.woff2 +0 -0
- package/A5sX.woff2 +0 -0
- package/AOae.woff2 +0 -0
- package/AnL6.woff2 +0 -0
- package/B7XM.woff2 +0 -0
- package/BAum.woff2 +0 -0
- package/BNuK.woff2 +0 -0
- package/BQVW.woff2 +0 -0
- package/BVL8.woff2 +0 -0
- package/BWvz.woff2 +0 -0
- package/B_Ks.woff2 +0 -0
- package/BbU7.woff2 +0 -0
- package/CZfI.woff2 +0 -0
- package/Cjb5.woff2 +0 -0
- package/CmJA.woff2 +0 -0
- package/CsUQ.woff2 +0 -0
- package/Cyzz.woff2 +0 -0
- package/DDOv.woff2 +0 -0
- package/DMt7.woff2 +0 -0
- package/DNLy.woff2 +0 -0
- package/DR27.woff2 +0 -0
- package/DZ7Q.woff2 +0 -0
- package/DnzW.woff2 +0 -0
- package/E4sy.woff2 +0 -0
- package/EUtD.woff2 +0 -0
- package/Eboz.woff2 +0 -0
- package/EmoS.woff2 +0 -0
- package/ExsS.woff2 +0 -0
- package/F175.woff2 +0 -0
- package/F7SA.woff2 +0 -0
- package/FT7_.woff2 +0 -0
- package/FaFd.woff2 +0 -0
- package/FsCw.woff2 +0 -0
- package/G3Kg.woff2 +0 -0
- package/G6Pj.woff2 +0 -0
- package/G8EN.woff2 +0 -0
- package/GMIu.woff2 +0 -0
- package/GOEl.woff2 +0 -0
- package/GrzI.woff2 +0 -0
- package/Gy2k.woff2 +0 -0
- package/Gz2v.woff2 +0 -0
- package/HCa9.woff2 +0 -0
- package/HRGc.woff2 +0 -0
- package/Hant.woff2 +0 -0
- package/HcYk.woff2 +0 -0
- package/IUKD.woff2 +0 -0
- package/J-rp.woff2 +0 -0
- package/J2_Z.woff2 +0 -0
- package/JBr8.woff2 +0 -0
- package/JzDj.woff2 +0 -0
- package/KBhF.woff2 +0 -0
- package/KCyu.woff2 +0 -0
- package/KH3S.woff2 +0 -0
- package/KUfc.woff2 +0 -0
- package/KWeL.woff2 +0 -0
- package/KbZ1.woff2 +0 -0
- package/KhUK.woff2 +0 -0
- package/LC3T.woff2 +0 -0
- package/LI5G.woff2 +0 -0
- package/LSlb.woff2 +0 -0
- package/LfwY.woff2 +0 -0
- package/Lj__.woff2 +0 -0
- package/M0BG.woff2 +0 -0
- package/MGzp.woff2 +0 -0
- package/MO_W.woff2 +0 -0
- package/MQdW.woff2 +0 -0
- package/MY7O.woff2 +0 -0
- package/Mbb7.woff2 +0 -0
- package/NDjQ.woff2 +0 -0
- package/NLeq.woff2 +0 -0
- package/NMlK.woff2 +0 -0
- package/NWxh.woff2 +0 -0
- package/Nf88.woff2 +0 -0
- package/Nx68.woff2 +0 -0
- package/Nxcy.woff2 +0 -0
- package/Ny-z.woff2 +0 -0
- package/OiPo.woff2 +0 -0
- package/OlDi.woff2 +0 -0
- package/Or-w.woff2 +0 -0
- package/OsBq.woff2 +0 -0
- package/PCtq.woff2 +0 -0
- package/PDd_.woff2 +0 -0
- package/Pe_P.woff2 +0 -0
- package/Pf-f.woff2 +0 -0
- package/PqJg.woff2 +0 -0
- package/QAxi.woff2 +0 -0
- package/QUNT.woff2 +0 -0
- package/QVyZ.woff2 +0 -0
- package/Qjcg.woff2 +0 -0
- package/Qo6Y.woff2 +0 -0
- package/RCbC.woff2 +0 -0
- package/README.md +221 -3
- package/RLNy.woff2 +0 -0
- package/RPwS.woff2 +0 -0
- package/RdOM.woff2 +0 -0
- package/RiLH.woff2 +0 -0
- package/RmLy.woff2 +0 -0
- package/Slgl.woff2 +0 -0
- package/SmUX.woff2 +0 -0
- package/T4Oo.woff2 +0 -0
- package/TR3D.woff2 +0 -0
- package/U0dX.woff2 +0 -0
- package/U1td.woff2 +0 -0
- package/U4KI.woff2 +0 -0
- package/UBEX.woff2 +0 -0
- package/UZOR.woff2 +0 -0
- package/UnJd.woff2 +0 -0
- package/V3y3.woff2 +0 -0
- package/V6v-.woff2 +0 -0
- package/VILN.woff2 +0 -0
- package/VPQT.woff2 +0 -0
- package/VWrT.woff2 +0 -0
- package/WQtc.woff2 +0 -0
- package/WwNi.woff2 +0 -0
- package/X0EV.woff2 +0 -0
- package/XLH2.woff2 +0 -0
- package/XO3j.woff2 +0 -0
- package/XcYc.woff2 +0 -0
- package/Xrko.woff2 +0 -0
- package/XsTQ.woff2 +0 -0
- package/Y0Aq.woff2 +0 -0
- package/YM8k.woff2 +0 -0
- package/YS7S.woff2 +0 -0
- package/YWWb.woff2 +0 -0
- package/YgHp.woff2 +0 -0
- package/YjQg.woff2 +0 -0
- package/Yxa9.woff2 +0 -0
- package/Z8iw.woff2 +0 -0
- package/ZJqm.woff2 +0 -0
- package/ZK_d.woff2 +0 -0
- package/ZX1B.woff2 +0 -0
- package/ZaAT.woff2 +0 -0
- package/Zpnf.woff2 +0 -0
- package/_.css +2 -0
- package/_EKX.woff2 +0 -0
- package/_MND.woff2 +0 -0
- package/_YMO.woff2 +0 -0
- package/ajo4.woff2 +0 -0
- package/azpT.woff2 +0 -0
- package/b-Pf.woff2 +0 -0
- package/bFGB.woff2 +0 -0
- package/bGIE.woff2 +0 -0
- package/bKcl.woff2 +0 -0
- package/bsyu.woff2 +0 -0
- package/bzA-.woff2 +0 -0
- package/c-gP.woff2 +0 -0
- package/c.css +1 -0
- package/c0t0.woff2 +0 -0
- package/c0vP.woff2 +0 -0
- package/c978.woff2 +0 -0
- package/cOnJ.woff2 +0 -0
- package/cR5u.woff2 +0 -0
- package/c_zx.woff2 +0 -0
- package/cvXG.woff2 +0 -0
- package/d7D5.woff2 +0 -0
- package/dsMI.woff2 +0 -0
- package/dtyD.woff2 +0 -0
- package/e-1b.woff2 +0 -0
- package/eDmS.woff2 +0 -0
- package/eivr.woff2 +0 -0
- package/eySP.woff2 +0 -0
- package/f1mD.woff2 +0 -0
- package/fEE1.woff2 +0 -0
- package/fQyD.woff2 +0 -0
- package/fSg2.woff2 +0 -0
- package/fleI.woff2 +0 -0
- package/ftah.woff2 +0 -0
- package/gCUE.woff2 +0 -0
- package/gNVS.woff2 +0 -0
- package/gbx7.woff2 +0 -0
- package/gjfn.woff2 +0 -0
- package/gnEg.woff2 +0 -0
- package/gwUy.woff2 +0 -0
- package/h9gv.woff2 +0 -0
- package/hWwS.woff2 +0 -0
- package/hh-l.woff2 +0 -0
- package/hhR6.woff2 +0 -0
- package/hwE7.woff2 +0 -0
- package/iP-U.woff2 +0 -0
- package/idYt.woff2 +0 -0
- package/ie2e.woff2 +0 -0
- package/istW.woff2 +0 -0
- package/iySI.woff2 +0 -0
- package/j2Ix.woff2 +0 -0
- package/j9It.woff2 +0 -0
- package/jC_7.woff2 +0 -0
- package/jNTq.woff2 +0 -0
- package/jqLk.woff2 +0 -0
- package/k0-i.woff2 +0 -0
- package/k8cB.woff2 +0 -0
- package/kNq4.woff2 +0 -0
- package/kc0f.woff2 +0 -0
- package/ks3H.woff2 +0 -0
- package/kvtB.woff2 +0 -0
- package/l096.woff2 +0 -0
- package/l6xJ.woff2 +0 -0
- package/l9Sk.woff2 +0 -0
- package/lMaK.woff2 +0 -0
- package/lPzz.woff2 +0 -0
- package/lZ7T.woff2 +0 -0
- package/lfc_.woff2 +0 -0
- package/lkAp.woff2 +0 -0
- package/lqz_.woff2 +0 -0
- package/m8fe.woff2 +0 -0
- package/mThg.woff2 +0 -0
- package/mmow.woff2 +0 -0
- package/mv3H.woff2 +0 -0
- package/n-Hs.woff2 +0 -0
- package/nBhF.woff2 +0 -0
- package/nH_q.woff2 +0 -0
- package/nOaG.woff2 +0 -0
- package/nUkR.woff2 +0 -0
- package/nYed.woff2 +0 -0
- package/nu5b.woff2 +0 -0
- package/oq9D.woff2 +0 -0
- package/p5EI.woff2 +0 -0
- package/pCBa.woff2 +0 -0
- package/pZwL.woff2 +0 -0
- package/package.json +24 -1
- package/pdlV.woff2 +0 -0
- package/q0a9.woff2 +0 -0
- package/q7FU.woff2 +0 -0
- package/q7zs.woff2 +0 -0
- package/qCOQ.woff2 +0 -0
- package/qFqQ.woff2 +0 -0
- package/qOem.woff2 +0 -0
- package/qWlm.woff2 +0 -0
- package/qn7_.woff2 +0 -0
- package/qwhx.woff2 +0 -0
- package/r-OT.woff2 +0 -0
- package/rDsB.woff2 +0 -0
- package/rFOk.woff2 +0 -0
- package/rLiZ.woff2 +0 -0
- package/rMMd.woff2 +0 -0
- package/rSp-.woff2 +0 -0
- package/rcpk.woff2 +0 -0
- package/rlvg.woff2 +0 -0
- package/s0qq.woff2 +0 -0
- package/sH1v.woff2 +0 -0
- package/sLHc.woff2 +0 -0
- package/suuy.woff2 +0 -0
- package/syw0.woff2 +0 -0
- package/szA5.woff2 +0 -0
- package/t.css +1 -0
- package/t0U3.woff2 +0 -0
- package/t612.woff2 +0 -0
- package/tE5M.woff2 +0 -0
- package/tdmZ.woff2 +0 -0
- package/u5Sv.woff2 +0 -0
- package/ugvG.woff2 +0 -0
- package/ulKx.woff2 +0 -0
- package/uqrW.woff2 +0 -0
- package/vqlJ.woff2 +0 -0
- package/vus4.woff2 +0 -0
- package/wMTF.woff2 +0 -0
- package/wTua.woff2 +0 -0
- package/wYch.woff2 +0 -0
- package/wg6F.woff2 +0 -0
- package/wkD_.woff2 +0 -0
- package/x9_w.woff2 +0 -0
- package/xQaz.woff2 +0 -0
- package/yV2w.woff2 +0 -0
- package/yYCf.woff2 +0 -0
- package/yYYx.woff2 +0 -0
- package/ydvJ.woff2 +0 -0
- package/ytVL.woff2 +0 -0
- package/zZdA.woff2 +0 -0
- package/0.css +0 -1
- package/0.js +0 -1
- package/1.css +0 -1
- package/1.js +0 -16
- package/2.js +0 -1
- package/3.js +0 -16
- package/4.js +0 -1
- package/_.js +0 -1
package/-3Uh.woff2
ADDED
|
Binary file
|
package/-XyM.woff2
ADDED
|
Binary file
|
package/-cMN.woff2
ADDED
|
Binary file
|
package/-cdB.woff2
ADDED
|
Binary file
|
package/0T_u.woff2
ADDED
|
Binary file
|
package/0iJj.woff2
ADDED
|
Binary file
|
package/0ztE.woff2
ADDED
|
Binary file
|
package/15pB.woff2
ADDED
|
Binary file
|
package/18RQ.woff2
ADDED
|
Binary file
|
package/1EtS.woff2
ADDED
|
Binary file
|
package/1pzg.woff2
ADDED
|
Binary file
|
package/2-pP.woff2
ADDED
|
Binary file
|
package/2EmK.woff2
ADDED
|
Binary file
|
package/2_ZR.woff2
ADDED
|
Binary file
|
package/2iUm.woff2
ADDED
|
Binary file
|
package/33Hv.woff2
ADDED
|
Binary file
|
package/3bVl.woff2
ADDED
|
Binary file
|
package/46Sm.woff2
ADDED
|
Binary file
|
package/46TS.woff2
ADDED
|
Binary file
|
package/4l5w.woff2
ADDED
|
Binary file
|
package/58Db.woff2
ADDED
|
Binary file
|
package/5Dkj.woff2
ADDED
|
Binary file
|
package/5JBo.woff2
ADDED
|
Binary file
|
package/5SiX.woff2
ADDED
|
Binary file
|
package/5TIG.woff2
ADDED
|
Binary file
|
package/5nIn.woff2
ADDED
|
Binary file
|
package/6CEg.woff2
ADDED
|
Binary file
|
package/6Gnc.woff2
ADDED
|
Binary file
|
package/6kAt.woff2
ADDED
|
Binary file
|
package/7LPF.woff2
ADDED
|
Binary file
|
package/7_8i.woff2
ADDED
|
Binary file
|
package/8Ppr.woff2
ADDED
|
Binary file
|
package/8QJX.woff2
ADDED
|
Binary file
|
package/8X-F.woff2
ADDED
|
Binary file
|
package/8iHl.woff2
ADDED
|
Binary file
|
package/8kLc.woff2
ADDED
|
Binary file
|
package/8xAn.woff2
ADDED
|
Binary file
|
package/8xnu.woff2
ADDED
|
Binary file
|
package/8yhR.woff2
ADDED
|
Binary file
|
package/9Gj4.woff2
ADDED
|
Binary file
|
package/9MPt.woff2
ADDED
|
Binary file
|
package/9XT7.woff2
ADDED
|
Binary file
|
package/9dxL.woff2
ADDED
|
Binary file
|
package/9xYe.woff2
ADDED
|
Binary file
|
package/A5sX.woff2
ADDED
|
Binary file
|
package/AOae.woff2
ADDED
|
Binary file
|
package/AnL6.woff2
ADDED
|
Binary file
|
package/B7XM.woff2
ADDED
|
Binary file
|
package/BAum.woff2
ADDED
|
Binary file
|
package/BNuK.woff2
ADDED
|
Binary file
|
package/BQVW.woff2
ADDED
|
Binary file
|
package/BVL8.woff2
ADDED
|
Binary file
|
package/BWvz.woff2
ADDED
|
Binary file
|
package/B_Ks.woff2
ADDED
|
Binary file
|
package/BbU7.woff2
ADDED
|
Binary file
|
package/CZfI.woff2
ADDED
|
Binary file
|
package/Cjb5.woff2
ADDED
|
Binary file
|
package/CmJA.woff2
ADDED
|
Binary file
|
package/CsUQ.woff2
ADDED
|
Binary file
|
package/Cyzz.woff2
ADDED
|
Binary file
|
package/DDOv.woff2
ADDED
|
Binary file
|
package/DMt7.woff2
ADDED
|
Binary file
|
package/DNLy.woff2
ADDED
|
Binary file
|
package/DR27.woff2
ADDED
|
Binary file
|
package/DZ7Q.woff2
ADDED
|
Binary file
|
package/DnzW.woff2
ADDED
|
Binary file
|
package/E4sy.woff2
ADDED
|
Binary file
|
package/EUtD.woff2
ADDED
|
Binary file
|
package/Eboz.woff2
ADDED
|
Binary file
|
package/EmoS.woff2
ADDED
|
Binary file
|
package/ExsS.woff2
ADDED
|
Binary file
|
package/F175.woff2
ADDED
|
Binary file
|
package/F7SA.woff2
ADDED
|
Binary file
|
package/FT7_.woff2
ADDED
|
Binary file
|
package/FaFd.woff2
ADDED
|
Binary file
|
package/FsCw.woff2
ADDED
|
Binary file
|
package/G3Kg.woff2
ADDED
|
Binary file
|
package/G6Pj.woff2
ADDED
|
Binary file
|
package/G8EN.woff2
ADDED
|
Binary file
|
package/GMIu.woff2
ADDED
|
Binary file
|
package/GOEl.woff2
ADDED
|
Binary file
|
package/GrzI.woff2
ADDED
|
Binary file
|
package/Gy2k.woff2
ADDED
|
Binary file
|
package/Gz2v.woff2
ADDED
|
Binary file
|
package/HCa9.woff2
ADDED
|
Binary file
|
package/HRGc.woff2
ADDED
|
Binary file
|
package/Hant.woff2
ADDED
|
Binary file
|
package/HcYk.woff2
ADDED
|
Binary file
|
package/IUKD.woff2
ADDED
|
Binary file
|
package/J-rp.woff2
ADDED
|
Binary file
|
package/J2_Z.woff2
ADDED
|
Binary file
|
package/JBr8.woff2
ADDED
|
Binary file
|
package/JzDj.woff2
ADDED
|
Binary file
|
package/KBhF.woff2
ADDED
|
Binary file
|
package/KCyu.woff2
ADDED
|
Binary file
|
package/KH3S.woff2
ADDED
|
Binary file
|
package/KUfc.woff2
ADDED
|
Binary file
|
package/KWeL.woff2
ADDED
|
Binary file
|
package/KbZ1.woff2
ADDED
|
Binary file
|
package/KhUK.woff2
ADDED
|
Binary file
|
package/LC3T.woff2
ADDED
|
Binary file
|
package/LI5G.woff2
ADDED
|
Binary file
|
package/LSlb.woff2
ADDED
|
Binary file
|
package/LfwY.woff2
ADDED
|
Binary file
|
package/Lj__.woff2
ADDED
|
Binary file
|
package/M0BG.woff2
ADDED
|
Binary file
|
package/MGzp.woff2
ADDED
|
Binary file
|
package/MO_W.woff2
ADDED
|
Binary file
|
package/MQdW.woff2
ADDED
|
Binary file
|
package/MY7O.woff2
ADDED
|
Binary file
|
package/Mbb7.woff2
ADDED
|
Binary file
|
package/NDjQ.woff2
ADDED
|
Binary file
|
package/NLeq.woff2
ADDED
|
Binary file
|
package/NMlK.woff2
ADDED
|
Binary file
|
package/NWxh.woff2
ADDED
|
Binary file
|
package/Nf88.woff2
ADDED
|
Binary file
|
package/Nx68.woff2
ADDED
|
Binary file
|
package/Nxcy.woff2
ADDED
|
Binary file
|
package/Ny-z.woff2
ADDED
|
Binary file
|
package/OiPo.woff2
ADDED
|
Binary file
|
package/OlDi.woff2
ADDED
|
Binary file
|
package/Or-w.woff2
ADDED
|
Binary file
|
package/OsBq.woff2
ADDED
|
Binary file
|
package/PCtq.woff2
ADDED
|
Binary file
|
package/PDd_.woff2
ADDED
|
Binary file
|
package/Pe_P.woff2
ADDED
|
Binary file
|
package/Pf-f.woff2
ADDED
|
Binary file
|
package/PqJg.woff2
ADDED
|
Binary file
|
package/QAxi.woff2
ADDED
|
Binary file
|
package/QUNT.woff2
ADDED
|
Binary file
|
package/QVyZ.woff2
ADDED
|
Binary file
|
package/Qjcg.woff2
ADDED
|
Binary file
|
package/Qo6Y.woff2
ADDED
|
Binary file
|
package/RCbC.woff2
ADDED
|
Binary file
|
package/README.md
CHANGED
|
@@ -1,5 +1,223 @@
|
|
|
1
|
-
#
|
|
1
|
+
[English](#en) | [中文](#zh)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<a id="en"></a>
|
|
6
|
+
# 18s : High-performance subsetted font packages for the WebC component library
|
|
7
|
+
|
|
8
|
+
Online Preview: [https://webc-zh.github.io](https://webc-zh.github.io)
|
|
9
|
+
|
|
10
|
+
* [Features](#features)
|
|
11
|
+
* [Directory Structure](#directory-structure)
|
|
12
|
+
* [Design & Process](#design--process)
|
|
13
|
+
* [Tech Stack](#tech-stack)
|
|
14
|
+
* [Usage](#usage)
|
|
15
|
+
* [History & Background](#history--background)
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Dynamic Subsetting**: Splits large CJK fonts into small WOFF2 chunks (typically 128KB) to minimize browser loading times.
|
|
20
|
+
- **Cache Busting**: Uses MD5 hashes of chunk content as filenames to prevent cache collision and maximize caching efficiency.
|
|
21
|
+
- **Font Varieties**: Includes variable font versions of Source Han Sans SC (`t`) and JetBrains Mono (`c`).
|
|
22
|
+
- **Clean CSS**: Output minimized CSS containing subsetted `@font-face` rules mapping local character ranges to the respective chunks.
|
|
23
|
+
|
|
24
|
+
## Directory Structure
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
.
|
|
28
|
+
├── gen/ # Generation workspace containing raw TTF files and processing scripts
|
|
29
|
+
│ ├── lib/ # Processing modules (font splitting, CSS minification)
|
|
30
|
+
│ ├── ttf/ # Source TrueType Font (.ttf) files and configurations
|
|
31
|
+
│ ├── gen.js # Subsetting execution script
|
|
32
|
+
│ └── gen.sh # Setup and FFI dependencies download script
|
|
33
|
+
├── woff2/ # Output distribution directory containing published assets
|
|
34
|
+
│ ├── *.woff2 # Content-addressed subset font chunks
|
|
35
|
+
│ ├── t.css # Source Han Sans SC Font-face mappings
|
|
36
|
+
│ ├── c.css # JetBrains Mono Font-face mappings
|
|
37
|
+
│ └── _.css # Merged Font-face mappings for all fonts
|
|
38
|
+
├── readme/ # Project documentation
|
|
39
|
+
│ ├── en.md # English README
|
|
40
|
+
│ └── zh.md # Chinese README
|
|
41
|
+
├── package.json # Project configuration metadata
|
|
42
|
+
└── README.mdt # Compilation template for root README
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Design & Process
|
|
46
|
+
|
|
47
|
+
The compiler processes fonts defined in `gen/ttf/gen.yml`, splitting them and preparing production-ready CSS and font chunks.
|
|
48
|
+
|
|
49
|
+
```mermaid
|
|
50
|
+
graph TD
|
|
51
|
+
A[Font TTF Source files: SourceHanSansSC / JetBrainsMono] --> B[fontSplit / cn-font-split]
|
|
52
|
+
B --> C[Generate WOFF2 character subsets & result.css]
|
|
53
|
+
C --> D[Rename WOFF2 subsets to unique MD5 Base64url hashes]
|
|
54
|
+
D --> E[Rewrite result.css font-family & subset URLs]
|
|
55
|
+
E --> F[Output optimized woff2/t.css, woff2/c.css & woff2/_.css]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
1. **Splitting**: Fonts are subsetted using `cn-font-split` into WOFF2 chunks.
|
|
59
|
+
2. **Hashing**: Each chunk filename is renamed to its MD5 base64url hash prefix (starting at length 4, resolving conflicts by expanding length).
|
|
60
|
+
3. **Rewriting**: The generated CSS file is parsed to replace original font-family names with short aliases (`t` and `c`), omit local search paths, and update chunk URLs.
|
|
61
|
+
4. **Publishing**: Minimized CSS (both individual files and the merged `_.css`) and hashed WOFF2 chunks are output to `woff2/` for direct npm publication.
|
|
62
|
+
|
|
63
|
+
## Tech Stack
|
|
64
|
+
|
|
65
|
+
- **Runtime**: Bun
|
|
66
|
+
- **Font Splitter**: `cn-font-split`
|
|
67
|
+
- **CSS Minifier**: `lightningcss`
|
|
68
|
+
- **Hash Function**: `@3-/base64url`
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install 18s
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Importing Fonts
|
|
79
|
+
|
|
80
|
+
Import the required CSS file in web components or application entries:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
// Import all fonts at once (merged CSS)
|
|
84
|
+
import '18s/_.css';
|
|
85
|
+
|
|
86
|
+
// Or import individual fonts as needed
|
|
87
|
+
// Import Source Han Sans SC
|
|
88
|
+
import '18s/t.css';
|
|
89
|
+
|
|
90
|
+
// Import JetBrains Mono
|
|
91
|
+
import '18s/c.css';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Apply in CSS stylesheets:
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
body {
|
|
98
|
+
font-family: t, sans-serif;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
code {
|
|
102
|
+
font-family: c, monospace;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## History & Background
|
|
107
|
+
|
|
108
|
+
CJK (Chinese, Japanese, Korean) font files are traditionally large (often 10MB to 50MB) because they contain tens of thousands of glyphs. Directly loading them in browsers causes severe rendering latency. Historically, developers embedded static, hand-selected character subsets or relied on system defaults, limiting design options.
|
|
109
|
+
|
|
110
|
+
Source Han Sans, introduced jointly by Adobe and Google in 2014, solved the CJK typeface quality problem but still suffered from file size issues. The advent of modern dynamic subsetting, exemplified by tools like `cn-font-split`, split these typefaces into hundreds of micro-chunks based on character frequency. Browsers only fetch chunks containing characters actually present on the page, unlocking high-fidelity, performant CJK web typography.
|
|
111
|
+
|
|
112
|
+
JetBrains Mono, released in 2020, focuses on readability for developers. Project `18s` bundles these optimized typefaces as variable fonts, ensuring lightweight integration for the WebC component library.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
<a id="zh"></a>
|
|
117
|
+
# 18s : 面向 WebC 组件库的高性能分片字体包
|
|
118
|
+
|
|
119
|
+
组件库在线浏览地址:[https://webc-zh.github.io](https://webc-zh.github.io)
|
|
120
|
+
|
|
121
|
+
* [功能特性](#功能特性)
|
|
122
|
+
* [目录结构](#目录结构)
|
|
123
|
+
* [设计思路与调用流程](#设计思路与调用流程)
|
|
124
|
+
* [技术堆栈](#技术堆栈)
|
|
125
|
+
* [使用指南](#使用指南)
|
|
126
|
+
* [历史背景](#历史背景)
|
|
127
|
+
|
|
128
|
+
## 功能特性
|
|
129
|
+
|
|
130
|
+
- **动态分片**:将庞大 CJK 字体切分为微小 WOFF2 分片(默认 128KB),大幅降低首屏字体加载时延。
|
|
131
|
+
- **防止冲突**:基于分片内容生成 MD5 哈希作为文件名,解决缓存冲突并提升缓存命中率。
|
|
132
|
+
- **可变字重**:提供思源黑体(`t`)与 JetBrains Mono(`c`)可变字重版本。
|
|
133
|
+
- **轻量 CSS**:输出压缩后的 CSS 代码,内置 `@font-face` 规则,精确映射字符区间至对应字体分片。
|
|
134
|
+
|
|
135
|
+
## 目录结构
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
.
|
|
139
|
+
├── gen/ # 字体构建工作区,包含原始 TTF 文件与处理脚本
|
|
140
|
+
│ ├── lib/ # 分片处理与 CSS 压缩模块
|
|
141
|
+
│ ├── ttf/ # 原始字体文件及配置
|
|
142
|
+
│ ├── gen.js # 字体分片执行脚本
|
|
143
|
+
│ └── gen.sh # 依赖拉取与构建脚本
|
|
144
|
+
├── woff2/ # 编译分发目录,包含最终发布资源
|
|
145
|
+
│ ├── *.woff2 # 内容寻址的 WOFF2 字体分片
|
|
146
|
+
│ ├── t.css # 思源黑体字体映射表
|
|
147
|
+
│ ├── c.css # JetBrains Mono 字体映射表
|
|
148
|
+
│ └── _.css # 合并所有字体的映射表
|
|
149
|
+
├── readme/ # 文档目录
|
|
150
|
+
│ ├── en.md # 英文文档
|
|
151
|
+
│ └── zh.md # 中文文档
|
|
152
|
+
├── package.json # 项目元数据配置
|
|
153
|
+
└── README.mdt # 主 README 模板文件
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 设计思路与调用流程
|
|
157
|
+
|
|
158
|
+
构建系统读取 `gen/ttf/gen.yml` 配置,处理字体并生成发布资源。
|
|
159
|
+
|
|
160
|
+
```mermaid
|
|
161
|
+
graph TD
|
|
162
|
+
A[字体 TTF 源文件: SourceHanSansSC / JetBrainsMono] --> B[fontSplit / cn-font-split]
|
|
163
|
+
B --> C[生成 WOFF2 字符分片与 result.css]
|
|
164
|
+
C --> D[将 WOFF2 分片重命名为唯一 MD5 Base64url 哈希]
|
|
165
|
+
D --> E[重写 CSS 字体族名称与分片路径]
|
|
166
|
+
E --> F[输出压缩后的 woff2/t.css、woff2/c.css 与 woff2/_.css]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
1. **分片处理**:调用 `cn-font-split` 工具,将原始字体切分为 WOFF2 格式片段。
|
|
170
|
+
2. **哈希映射**:计算各分片内容的 MD5 base64url 哈希值,以此作为文件名(初始长度 4,遇冲突时递增长度),实现内容寻址。
|
|
171
|
+
3. **样式重写**:解析 CSS,将默认 font-family 替换为简短别名(`t` 或 `c`),移除本地路径(`local`)查询,更新字体分片 URL 引用。
|
|
172
|
+
4. **资源输出**:将 CSS(包含各字体独立文件以及合并后的 `_.css`)及字体分片写入发布目录 `woff2/`,以便独立进行 npm 发布。
|
|
173
|
+
|
|
174
|
+
## 技术堆栈
|
|
175
|
+
|
|
176
|
+
- **运行环境**:Bun
|
|
177
|
+
- **分片工具**:`cn-font-split`
|
|
178
|
+
- **样式压缩**:`lightningcss`
|
|
179
|
+
- **哈希算法**:`@3-/base64url`
|
|
180
|
+
|
|
181
|
+
## 使用指南
|
|
182
|
+
|
|
183
|
+
### 安装依赖
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm install 18s
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 导入字体
|
|
190
|
+
|
|
191
|
+
在 Web 组件或应用入口中引入 CSS 文件:
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
// 一次性引入所有字体(合并后的 CSS)
|
|
195
|
+
import '18s/_.css';
|
|
196
|
+
|
|
197
|
+
// 或者按需引入单个字体
|
|
198
|
+
// 引入思源黑体
|
|
199
|
+
import '18s/t.css';
|
|
200
|
+
|
|
201
|
+
// 引入 JetBrains Mono
|
|
202
|
+
import '18s/c.css';
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
在样式表中应用对应的字体族:
|
|
206
|
+
|
|
207
|
+
```css
|
|
208
|
+
body {
|
|
209
|
+
font-family: t, sans-serif;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
code {
|
|
213
|
+
font-family: c, monospace;
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## 历史背景
|
|
218
|
+
|
|
219
|
+
汉字、日文和韩文(CJK)字体由于字符繁多,文件大小通常在 10MB 至 50MB 之间。直接在网页中加载此类字体会导致严重的白屏或字体闪烁问题。早期 Web 开发多采用系统默认字体,或通过繁琐的静态抽字工具仅保留特定字词,限制了动态内容的展示。
|
|
220
|
+
|
|
221
|
+
2014 年,Adobe 与 Google 联合推出开源 CJK 字体思源黑体(Source Han Sans),解决了多语种排版设计问题,但体积瓶颈依旧存在。随着动态分片技术(如 `cn-font-split`)出现,字体文件能按字符使用频率和字符集关联动态切分为数百个微小分片。浏览器仅按需下载当前页面渲染所需的字型分片,极大地优化了中文字体在 Web 端的加载体验。
|
|
222
|
+
|
|
223
|
+
JetBrains Mono 是 JetBrains 于 2020 年发布的专为代码阅读设计的开源编程字体。本项目 `18s` 将思源黑体与 JetBrains Mono 作为可变字体整合分片,旨在为 WebC 组件库提供轻量、美观、一致的视觉呈现。
|
package/RLNy.woff2
ADDED
|
Binary file
|
package/RPwS.woff2
ADDED
|
Binary file
|
package/RdOM.woff2
ADDED
|
Binary file
|
package/RiLH.woff2
ADDED
|
Binary file
|
package/RmLy.woff2
ADDED
|
Binary file
|
package/Slgl.woff2
ADDED
|
Binary file
|
package/SmUX.woff2
ADDED
|
Binary file
|
package/T4Oo.woff2
ADDED
|
Binary file
|
package/TR3D.woff2
ADDED
|
Binary file
|
package/U0dX.woff2
ADDED
|
Binary file
|
package/U1td.woff2
ADDED
|
Binary file
|
package/U4KI.woff2
ADDED
|
Binary file
|
package/UBEX.woff2
ADDED
|
Binary file
|
package/UZOR.woff2
ADDED
|
Binary file
|
package/UnJd.woff2
ADDED
|
Binary file
|
package/V3y3.woff2
ADDED
|
Binary file
|
package/V6v-.woff2
ADDED
|
Binary file
|
package/VILN.woff2
ADDED
|
Binary file
|
package/VPQT.woff2
ADDED
|
Binary file
|
package/VWrT.woff2
ADDED
|
Binary file
|
package/WQtc.woff2
ADDED
|
Binary file
|
package/WwNi.woff2
ADDED
|
Binary file
|