18s 0.1.5 → 0.2.15
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/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/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/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/QQlP.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 +225 -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/a6CQ.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/rd6A.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/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/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/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/QQlP.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,227 @@
|
|
|
1
|
-
#
|
|
1
|
+
[English](#en) | [中文](#zh)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<a id="en"></a>
|
|
6
|
+
# 18s : Chinese font subsetting packages for the WebC component library
|
|
7
|
+
|
|
8
|
+
WebC is a Web Components library designed for AI-assisted development. This package provides Chinese font subsetting support for WebC.
|
|
9
|
+
|
|
10
|
+
Online Preview: [https://webc-zh.github.io](https://webc-zh.github.io)
|
|
11
|
+
|
|
12
|
+
* [Features](#features)
|
|
13
|
+
* [Directory Structure](#directory-structure)
|
|
14
|
+
* [Design & Process](#design--process)
|
|
15
|
+
* [Tech Stack](#tech-stack)
|
|
16
|
+
* [Usage](#usage)
|
|
17
|
+
* [History & Background](#history--background)
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Chinese Font Subsetting**: Splits Chinese fonts (CJK) into WOFF2 chunks (128KB) to reduce loading times.
|
|
22
|
+
- **Cache Busting**: Uses MD5 hashes of chunk content as filenames to prevent collision and improve caching.
|
|
23
|
+
- **Variable Fonts**: Includes Source Han Sans SC (`t`) and JetBrains Mono (`c`).
|
|
24
|
+
- **CSS**: Outputs minimized CSS containing `@font-face` rules mapping character ranges to chunks.
|
|
25
|
+
|
|
26
|
+
## Directory Structure
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
.
|
|
30
|
+
├── gen/ # Generation workspace containing raw TTF files and processing scripts
|
|
31
|
+
│ ├── lib/ # Processing modules (font splitting, CSS minification)
|
|
32
|
+
│ ├── ttf/ # Source TrueType Font (.ttf) files and configurations
|
|
33
|
+
│ ├── gen.js # Subsetting execution script
|
|
34
|
+
│ └── gen.sh # Setup and FFI dependencies download script
|
|
35
|
+
├── woff2/ # Output distribution directory containing published assets
|
|
36
|
+
│ ├── *.woff2 # Content-addressed subset font chunks
|
|
37
|
+
│ ├── t.css # Source Han Sans SC Font-face mappings
|
|
38
|
+
│ ├── c.css # JetBrains Mono Font-face mappings
|
|
39
|
+
│ └── _.css # Merged Font-face mappings for all fonts
|
|
40
|
+
├── readme/ # Project documentation
|
|
41
|
+
│ ├── en.md # English README
|
|
42
|
+
│ └── zh.md # Chinese README
|
|
43
|
+
├── package.json # Project configuration metadata
|
|
44
|
+
└── README.mdt # Compilation template for root README
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Design & Process
|
|
48
|
+
|
|
49
|
+
The compiler processes fonts defined in `gen/ttf/gen.yml`, splitting them and preparing CSS and font chunks.
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
graph TD
|
|
53
|
+
A[Font files: SourceHanSansSC / JetBrainsMono] --> B[fontSplit / cn-font-split]
|
|
54
|
+
B --> C[Generate WOFF2 subsets & result.css]
|
|
55
|
+
C --> D[Rename WOFF2 subsets to MD5 Base64url hashes]
|
|
56
|
+
D --> E[Rewrite CSS font-family & URLs]
|
|
57
|
+
E --> F[Output woff2/t.css, woff2/c.css & woff2/_.css]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
1. **Splitting**: Fonts are subsetted using `cn-font-split` into WOFF2 chunks.
|
|
61
|
+
2. **Hashing**: Each chunk is renamed to its MD5 base64url hash (starting at length 4, expanding on conflict).
|
|
62
|
+
3. **Rewriting**: CSS is parsed to replace font-family names with aliases (`t` and `c`), omit local paths, and update chunk URLs.
|
|
63
|
+
4. **Publishing**: CSS and WOFF2 chunks are output to `woff2/` for npm publication.
|
|
64
|
+
|
|
65
|
+
## Tech Stack
|
|
66
|
+
|
|
67
|
+
- **Runtime**: Bun
|
|
68
|
+
- **Font Splitter**: `cn-font-split`
|
|
69
|
+
- **CSS Minifier**: `lightningcss`
|
|
70
|
+
- **Hash Function**: `@3-/base64url`
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
### Installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install 18s
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Importing Fonts
|
|
81
|
+
|
|
82
|
+
Import the required CSS file in web components or application entries:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// Import all fonts at once (merged CSS)
|
|
86
|
+
import '18s/_.css';
|
|
87
|
+
|
|
88
|
+
// Or import individual fonts as needed
|
|
89
|
+
// Import Source Han Sans SC
|
|
90
|
+
import '18s/t.css';
|
|
91
|
+
|
|
92
|
+
// Import JetBrains Mono
|
|
93
|
+
import '18s/c.css';
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Apply in CSS stylesheets:
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
body {
|
|
100
|
+
font-family: t, sans-serif;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
code {
|
|
104
|
+
font-family: c, monospace;
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## History & Background
|
|
109
|
+
|
|
110
|
+
CJK font files are large (10MB to 50MB) as they contain tens of thousands of glyphs. Loading them in browsers causes rendering latency. Previously, developers embedded static character subsets or relied on system defaults, limiting design options.
|
|
111
|
+
|
|
112
|
+
Source Han Sans, introduced by Adobe and Google in 2014, solved CJK typeface quality issues but still had large file sizes. Font splitters like `cn-font-split` split these typefaces into chunks based on character frequency. Browsers fetch chunks containing characters present on the page, improving performance.
|
|
113
|
+
|
|
114
|
+
JetBrains Mono, released in 2020, is designed for readability. Project `18s` bundles these typefaces as variable fonts to provide Chinese font support for WebC.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
<a id="zh"></a>
|
|
119
|
+
# 18s : WebC 组件库中文字体分片包
|
|
120
|
+
|
|
121
|
+
WebC 是面向 AI 辅助开发的 Web Components 组件库。本包为 WebC 提供中文字体分片支持。
|
|
122
|
+
|
|
123
|
+
组件库在线浏览地址:[https://webc-zh.github.io](https://webc-zh.github.io)
|
|
124
|
+
|
|
125
|
+
* [功能特性](#功能特性)
|
|
126
|
+
* [目录结构](#目录结构)
|
|
127
|
+
* [设计思路与调用流程](#设计思路与调用流程)
|
|
128
|
+
* [技术堆栈](#技术堆栈)
|
|
129
|
+
* [使用指南](#使用指南)
|
|
130
|
+
* [历史背景](#历史背景)
|
|
131
|
+
|
|
132
|
+
## 功能特性
|
|
133
|
+
|
|
134
|
+
- **中文字体分片**:将中文字体(CJK)切分为 WOFF2 分片(默认 128KB),降低加载时延。
|
|
135
|
+
- **防止冲突**:基于分片内容生成 MD5 哈希作为文件名,解决缓存冲突并提升缓存命中率。
|
|
136
|
+
- **可变字重**:提供思源黑体(`t`)与 JetBrains Mono(`c`)可变字重版本。
|
|
137
|
+
- **CSS**:输出压缩的 CSS 代码,内置 `@font-face` 规则,映射字符区间至对应字体分片。
|
|
138
|
+
|
|
139
|
+
## 目录结构
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
.
|
|
143
|
+
├── gen/ # 字体构建工作区,包含原始 TTF 文件与处理脚本
|
|
144
|
+
│ ├── lib/ # 分片处理与 CSS 压缩模块
|
|
145
|
+
│ ├── ttf/ # 原始字体文件及配置
|
|
146
|
+
│ ├── gen.js # 字体分片执行脚本
|
|
147
|
+
│ └── gen.sh # 依赖拉取与构建脚本
|
|
148
|
+
├── woff2/ # 编译分发目录,包含最终发布资源
|
|
149
|
+
│ ├── *.woff2 # 内容寻址的 WOFF2 字体分片
|
|
150
|
+
│ ├── t.css # 思源黑体字体映射表
|
|
151
|
+
│ ├── c.css # JetBrains Mono 字体映射表
|
|
152
|
+
│ └── _.css # 合并所有字体的映射表
|
|
153
|
+
├── readme/ # 文档目录
|
|
154
|
+
│ ├── en.md # 英文文档
|
|
155
|
+
│ └── zh.md # 中文文档
|
|
156
|
+
├── package.json # 项目元数据配置
|
|
157
|
+
└── README.mdt # 主 README 模板文件
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## 设计思路与调用流程
|
|
161
|
+
|
|
162
|
+
构建系统读取 `gen/ttf/gen.yml` 配置,处理字体并生成发布资源。
|
|
163
|
+
|
|
164
|
+
```mermaid
|
|
165
|
+
graph TD
|
|
166
|
+
A[Font files: SourceHanSansSC / JetBrainsMono] --> B[fontSplit / cn-font-split]
|
|
167
|
+
B --> C[生成 WOFF2 分片与 result.css]
|
|
168
|
+
C --> D[将 WOFF2 分片重命名为 MD5 Base64url 哈希]
|
|
169
|
+
D --> E[重写 CSS 字体族名称与分片路径]
|
|
170
|
+
E --> F[输出 woff2/t.css、woff2/c.css 与 woff2/_.css]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
1. **分片处理**:调用 `cn-font-split` 工具,将字体切分为 WOFF2 片段。
|
|
174
|
+
2. **哈希映射**:计算分片内容的 MD5 base64url 哈希作为文件名(长度从 4 开始,遇冲突时递增),实现内容寻址。
|
|
175
|
+
3. **样式重写**:解析 CSS,将 font-family 替换为别名(`t` 或 `c`),移除本地路径(`local`)查询,更新字体分片 URL 引用。
|
|
176
|
+
4. **资源输出**:将 CSS 及字体分片写入发布目录 `woff2/`,进行 npm 发布。
|
|
177
|
+
|
|
178
|
+
## 技术堆栈
|
|
179
|
+
|
|
180
|
+
- **运行环境**:Bun
|
|
181
|
+
- **分片工具**:`cn-font-split`
|
|
182
|
+
- **样式压缩**:`lightningcss`
|
|
183
|
+
- **哈希算法**:`@3-/base64url`
|
|
184
|
+
|
|
185
|
+
## 使用指南
|
|
186
|
+
|
|
187
|
+
### 安装依赖
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm install 18s
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 导入字体
|
|
194
|
+
|
|
195
|
+
在 Web 组件或应用入口中引入 CSS 文件:
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
// 一次性引入所有字体(合并后的 CSS)
|
|
199
|
+
import '18s/_.css';
|
|
200
|
+
|
|
201
|
+
// 或者按需引入单个字体
|
|
202
|
+
// 引入思源黑体
|
|
203
|
+
import '18s/t.css';
|
|
204
|
+
|
|
205
|
+
// 引入 JetBrains Mono
|
|
206
|
+
import '18s/c.css';
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
在样式表中应用对应的字体族:
|
|
210
|
+
|
|
211
|
+
```css
|
|
212
|
+
body {
|
|
213
|
+
font-family: t, sans-serif;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
code {
|
|
217
|
+
font-family: c, monospace;
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## 历史背景
|
|
222
|
+
|
|
223
|
+
CJK 字体由于文件大(10MB 至 50MB),直接加载会导致白屏或字体闪烁。以往开发多采用系统默认字体,或通过静态抽字工具仅保留部分字词,限制了动态内容展示。
|
|
224
|
+
|
|
225
|
+
2014 年,Adobe 与 Google 推出 CJK 字体思源黑体(Source Han Sans),但体积问题依旧存在。随着分片技术(如 `cn-font-split`)出现,字体文件能按字符使用频率切分为数百个分片。浏览器按需下载分片,优化了中文字体加载体验。
|
|
226
|
+
|
|
227
|
+
JetBrains Mono 是 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
|
package/X0EV.woff2
ADDED
|
Binary file
|
package/XLH2.woff2
ADDED
|
Binary file
|