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.
Files changed (318) hide show
  1. package/-3Uh.woff2 +0 -0
  2. package/-XyM.woff2 +0 -0
  3. package/-cMN.woff2 +0 -0
  4. package/-cdB.woff2 +0 -0
  5. package/0T_u.woff2 +0 -0
  6. package/0iJj.woff2 +0 -0
  7. package/0ztE.woff2 +0 -0
  8. package/15pB.woff2 +0 -0
  9. package/18RQ.woff2 +0 -0
  10. package/1EtS.woff2 +0 -0
  11. package/1pzg.woff2 +0 -0
  12. package/2-pP.woff2 +0 -0
  13. package/2EmK.woff2 +0 -0
  14. package/2_ZR.woff2 +0 -0
  15. package/2iUm.woff2 +0 -0
  16. package/33Hv.woff2 +0 -0
  17. package/3bVl.woff2 +0 -0
  18. package/46Sm.woff2 +0 -0
  19. package/46TS.woff2 +0 -0
  20. package/4l5w.woff2 +0 -0
  21. package/58Db.woff2 +0 -0
  22. package/5Dkj.woff2 +0 -0
  23. package/5JBo.woff2 +0 -0
  24. package/5SiX.woff2 +0 -0
  25. package/5TIG.woff2 +0 -0
  26. package/5nIn.woff2 +0 -0
  27. package/6CEg.woff2 +0 -0
  28. package/6Gnc.woff2 +0 -0
  29. package/6kAt.woff2 +0 -0
  30. package/7LPF.woff2 +0 -0
  31. package/7_8i.woff2 +0 -0
  32. package/8Ppr.woff2 +0 -0
  33. package/8QJX.woff2 +0 -0
  34. package/8X-F.woff2 +0 -0
  35. package/8iHl.woff2 +0 -0
  36. package/8kLc.woff2 +0 -0
  37. package/8xAn.woff2 +0 -0
  38. package/8xnu.woff2 +0 -0
  39. package/8yhR.woff2 +0 -0
  40. package/9Gj4.woff2 +0 -0
  41. package/9MPt.woff2 +0 -0
  42. package/9XT7.woff2 +0 -0
  43. package/9dxL.woff2 +0 -0
  44. package/9xYe.woff2 +0 -0
  45. package/A5sX.woff2 +0 -0
  46. package/AOae.woff2 +0 -0
  47. package/AnL6.woff2 +0 -0
  48. package/B7XM.woff2 +0 -0
  49. package/BAum.woff2 +0 -0
  50. package/BNuK.woff2 +0 -0
  51. package/BQVW.woff2 +0 -0
  52. package/BVL8.woff2 +0 -0
  53. package/BWvz.woff2 +0 -0
  54. package/B_Ks.woff2 +0 -0
  55. package/BbU7.woff2 +0 -0
  56. package/CZfI.woff2 +0 -0
  57. package/Cjb5.woff2 +0 -0
  58. package/CmJA.woff2 +0 -0
  59. package/CsUQ.woff2 +0 -0
  60. package/Cyzz.woff2 +0 -0
  61. package/DDOv.woff2 +0 -0
  62. package/DMt7.woff2 +0 -0
  63. package/DNLy.woff2 +0 -0
  64. package/DR27.woff2 +0 -0
  65. package/DZ7Q.woff2 +0 -0
  66. package/DnzW.woff2 +0 -0
  67. package/E4sy.woff2 +0 -0
  68. package/EUtD.woff2 +0 -0
  69. package/Eboz.woff2 +0 -0
  70. package/EmoS.woff2 +0 -0
  71. package/ExsS.woff2 +0 -0
  72. package/F175.woff2 +0 -0
  73. package/F7SA.woff2 +0 -0
  74. package/FT7_.woff2 +0 -0
  75. package/FaFd.woff2 +0 -0
  76. package/FsCw.woff2 +0 -0
  77. package/G3Kg.woff2 +0 -0
  78. package/G6Pj.woff2 +0 -0
  79. package/G8EN.woff2 +0 -0
  80. package/GMIu.woff2 +0 -0
  81. package/GOEl.woff2 +0 -0
  82. package/GrzI.woff2 +0 -0
  83. package/Gy2k.woff2 +0 -0
  84. package/Gz2v.woff2 +0 -0
  85. package/HCa9.woff2 +0 -0
  86. package/HRGc.woff2 +0 -0
  87. package/Hant.woff2 +0 -0
  88. package/HcYk.woff2 +0 -0
  89. package/IUKD.woff2 +0 -0
  90. package/J-rp.woff2 +0 -0
  91. package/J2_Z.woff2 +0 -0
  92. package/JBr8.woff2 +0 -0
  93. package/JzDj.woff2 +0 -0
  94. package/KBhF.woff2 +0 -0
  95. package/KCyu.woff2 +0 -0
  96. package/KH3S.woff2 +0 -0
  97. package/KUfc.woff2 +0 -0
  98. package/KWeL.woff2 +0 -0
  99. package/KbZ1.woff2 +0 -0
  100. package/KhUK.woff2 +0 -0
  101. package/LC3T.woff2 +0 -0
  102. package/LI5G.woff2 +0 -0
  103. package/LSlb.woff2 +0 -0
  104. package/LfwY.woff2 +0 -0
  105. package/Lj__.woff2 +0 -0
  106. package/M0BG.woff2 +0 -0
  107. package/MGzp.woff2 +0 -0
  108. package/MO_W.woff2 +0 -0
  109. package/MQdW.woff2 +0 -0
  110. package/MY7O.woff2 +0 -0
  111. package/Mbb7.woff2 +0 -0
  112. package/NDjQ.woff2 +0 -0
  113. package/NLeq.woff2 +0 -0
  114. package/NMlK.woff2 +0 -0
  115. package/NWxh.woff2 +0 -0
  116. package/Nf88.woff2 +0 -0
  117. package/Nx68.woff2 +0 -0
  118. package/Nxcy.woff2 +0 -0
  119. package/Ny-z.woff2 +0 -0
  120. package/OiPo.woff2 +0 -0
  121. package/OlDi.woff2 +0 -0
  122. package/Or-w.woff2 +0 -0
  123. package/OsBq.woff2 +0 -0
  124. package/PCtq.woff2 +0 -0
  125. package/PDd_.woff2 +0 -0
  126. package/Pe_P.woff2 +0 -0
  127. package/Pf-f.woff2 +0 -0
  128. package/PqJg.woff2 +0 -0
  129. package/QAxi.woff2 +0 -0
  130. package/QUNT.woff2 +0 -0
  131. package/QVyZ.woff2 +0 -0
  132. package/Qjcg.woff2 +0 -0
  133. package/Qo6Y.woff2 +0 -0
  134. package/RCbC.woff2 +0 -0
  135. package/README.md +221 -3
  136. package/RLNy.woff2 +0 -0
  137. package/RPwS.woff2 +0 -0
  138. package/RdOM.woff2 +0 -0
  139. package/RiLH.woff2 +0 -0
  140. package/RmLy.woff2 +0 -0
  141. package/Slgl.woff2 +0 -0
  142. package/SmUX.woff2 +0 -0
  143. package/T4Oo.woff2 +0 -0
  144. package/TR3D.woff2 +0 -0
  145. package/U0dX.woff2 +0 -0
  146. package/U1td.woff2 +0 -0
  147. package/U4KI.woff2 +0 -0
  148. package/UBEX.woff2 +0 -0
  149. package/UZOR.woff2 +0 -0
  150. package/UnJd.woff2 +0 -0
  151. package/V3y3.woff2 +0 -0
  152. package/V6v-.woff2 +0 -0
  153. package/VILN.woff2 +0 -0
  154. package/VPQT.woff2 +0 -0
  155. package/VWrT.woff2 +0 -0
  156. package/WQtc.woff2 +0 -0
  157. package/WwNi.woff2 +0 -0
  158. package/X0EV.woff2 +0 -0
  159. package/XLH2.woff2 +0 -0
  160. package/XO3j.woff2 +0 -0
  161. package/XcYc.woff2 +0 -0
  162. package/Xrko.woff2 +0 -0
  163. package/XsTQ.woff2 +0 -0
  164. package/Y0Aq.woff2 +0 -0
  165. package/YM8k.woff2 +0 -0
  166. package/YS7S.woff2 +0 -0
  167. package/YWWb.woff2 +0 -0
  168. package/YgHp.woff2 +0 -0
  169. package/YjQg.woff2 +0 -0
  170. package/Yxa9.woff2 +0 -0
  171. package/Z8iw.woff2 +0 -0
  172. package/ZJqm.woff2 +0 -0
  173. package/ZK_d.woff2 +0 -0
  174. package/ZX1B.woff2 +0 -0
  175. package/ZaAT.woff2 +0 -0
  176. package/Zpnf.woff2 +0 -0
  177. package/_.css +2 -0
  178. package/_EKX.woff2 +0 -0
  179. package/_MND.woff2 +0 -0
  180. package/_YMO.woff2 +0 -0
  181. package/ajo4.woff2 +0 -0
  182. package/azpT.woff2 +0 -0
  183. package/b-Pf.woff2 +0 -0
  184. package/bFGB.woff2 +0 -0
  185. package/bGIE.woff2 +0 -0
  186. package/bKcl.woff2 +0 -0
  187. package/bsyu.woff2 +0 -0
  188. package/bzA-.woff2 +0 -0
  189. package/c-gP.woff2 +0 -0
  190. package/c.css +1 -0
  191. package/c0t0.woff2 +0 -0
  192. package/c0vP.woff2 +0 -0
  193. package/c978.woff2 +0 -0
  194. package/cOnJ.woff2 +0 -0
  195. package/cR5u.woff2 +0 -0
  196. package/c_zx.woff2 +0 -0
  197. package/cvXG.woff2 +0 -0
  198. package/d7D5.woff2 +0 -0
  199. package/dsMI.woff2 +0 -0
  200. package/dtyD.woff2 +0 -0
  201. package/e-1b.woff2 +0 -0
  202. package/eDmS.woff2 +0 -0
  203. package/eivr.woff2 +0 -0
  204. package/eySP.woff2 +0 -0
  205. package/f1mD.woff2 +0 -0
  206. package/fEE1.woff2 +0 -0
  207. package/fQyD.woff2 +0 -0
  208. package/fSg2.woff2 +0 -0
  209. package/fleI.woff2 +0 -0
  210. package/ftah.woff2 +0 -0
  211. package/gCUE.woff2 +0 -0
  212. package/gNVS.woff2 +0 -0
  213. package/gbx7.woff2 +0 -0
  214. package/gjfn.woff2 +0 -0
  215. package/gnEg.woff2 +0 -0
  216. package/gwUy.woff2 +0 -0
  217. package/h9gv.woff2 +0 -0
  218. package/hWwS.woff2 +0 -0
  219. package/hh-l.woff2 +0 -0
  220. package/hhR6.woff2 +0 -0
  221. package/hwE7.woff2 +0 -0
  222. package/iP-U.woff2 +0 -0
  223. package/idYt.woff2 +0 -0
  224. package/ie2e.woff2 +0 -0
  225. package/istW.woff2 +0 -0
  226. package/iySI.woff2 +0 -0
  227. package/j2Ix.woff2 +0 -0
  228. package/j9It.woff2 +0 -0
  229. package/jC_7.woff2 +0 -0
  230. package/jNTq.woff2 +0 -0
  231. package/jqLk.woff2 +0 -0
  232. package/k0-i.woff2 +0 -0
  233. package/k8cB.woff2 +0 -0
  234. package/kNq4.woff2 +0 -0
  235. package/kc0f.woff2 +0 -0
  236. package/ks3H.woff2 +0 -0
  237. package/kvtB.woff2 +0 -0
  238. package/l096.woff2 +0 -0
  239. package/l6xJ.woff2 +0 -0
  240. package/l9Sk.woff2 +0 -0
  241. package/lMaK.woff2 +0 -0
  242. package/lPzz.woff2 +0 -0
  243. package/lZ7T.woff2 +0 -0
  244. package/lfc_.woff2 +0 -0
  245. package/lkAp.woff2 +0 -0
  246. package/lqz_.woff2 +0 -0
  247. package/m8fe.woff2 +0 -0
  248. package/mThg.woff2 +0 -0
  249. package/mmow.woff2 +0 -0
  250. package/mv3H.woff2 +0 -0
  251. package/n-Hs.woff2 +0 -0
  252. package/nBhF.woff2 +0 -0
  253. package/nH_q.woff2 +0 -0
  254. package/nOaG.woff2 +0 -0
  255. package/nUkR.woff2 +0 -0
  256. package/nYed.woff2 +0 -0
  257. package/nu5b.woff2 +0 -0
  258. package/oq9D.woff2 +0 -0
  259. package/p5EI.woff2 +0 -0
  260. package/pCBa.woff2 +0 -0
  261. package/pZwL.woff2 +0 -0
  262. package/package.json +24 -1
  263. package/pdlV.woff2 +0 -0
  264. package/q0a9.woff2 +0 -0
  265. package/q7FU.woff2 +0 -0
  266. package/q7zs.woff2 +0 -0
  267. package/qCOQ.woff2 +0 -0
  268. package/qFqQ.woff2 +0 -0
  269. package/qOem.woff2 +0 -0
  270. package/qWlm.woff2 +0 -0
  271. package/qn7_.woff2 +0 -0
  272. package/qwhx.woff2 +0 -0
  273. package/r-OT.woff2 +0 -0
  274. package/rDsB.woff2 +0 -0
  275. package/rFOk.woff2 +0 -0
  276. package/rLiZ.woff2 +0 -0
  277. package/rMMd.woff2 +0 -0
  278. package/rSp-.woff2 +0 -0
  279. package/rcpk.woff2 +0 -0
  280. package/rlvg.woff2 +0 -0
  281. package/s0qq.woff2 +0 -0
  282. package/sH1v.woff2 +0 -0
  283. package/sLHc.woff2 +0 -0
  284. package/suuy.woff2 +0 -0
  285. package/syw0.woff2 +0 -0
  286. package/szA5.woff2 +0 -0
  287. package/t.css +1 -0
  288. package/t0U3.woff2 +0 -0
  289. package/t612.woff2 +0 -0
  290. package/tE5M.woff2 +0 -0
  291. package/tdmZ.woff2 +0 -0
  292. package/u5Sv.woff2 +0 -0
  293. package/ugvG.woff2 +0 -0
  294. package/ulKx.woff2 +0 -0
  295. package/uqrW.woff2 +0 -0
  296. package/vqlJ.woff2 +0 -0
  297. package/vus4.woff2 +0 -0
  298. package/wMTF.woff2 +0 -0
  299. package/wTua.woff2 +0 -0
  300. package/wYch.woff2 +0 -0
  301. package/wg6F.woff2 +0 -0
  302. package/wkD_.woff2 +0 -0
  303. package/x9_w.woff2 +0 -0
  304. package/xQaz.woff2 +0 -0
  305. package/yV2w.woff2 +0 -0
  306. package/yYCf.woff2 +0 -0
  307. package/yYYx.woff2 +0 -0
  308. package/ydvJ.woff2 +0 -0
  309. package/ytVL.woff2 +0 -0
  310. package/zZdA.woff2 +0 -0
  311. package/0.css +0 -1
  312. package/0.js +0 -1
  313. package/1.css +0 -1
  314. package/1.js +0 -16
  315. package/2.js +0 -1
  316. package/3.js +0 -16
  317. package/4.js +0 -1
  318. 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
- # 18s
1
+ [English](#en) | [中文](#zh)
2
2
 
3
- i18n.site self
3
+ ---
4
4
 
5
- see [https://atomgit.com/i18n/site/tree/dev](https://atomgit.com/i18n/site/tree/dev) for more
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