{"id":19560036,"url":"https://github.com/plotdb/xfl","last_synced_at":"2026-03-03T13:39:05.121Z","repository":{"id":57137288,"uuid":"137720691","full_name":"plotdb/xfl","owner":"plotdb","description":"load large fonts by splitting font file according to word frequency.","archived":false,"fork":false,"pushed_at":"2024-04-10T00:22:53.000Z","size":1989,"stargazers_count":13,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T20:09:43.576Z","etag":null,"topics":["font","javascript"],"latest_commit_sha":null,"homepage":"https://plotdb.github.io/xl-fontload/","language":"Pug","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plotdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-18T07:15:02.000Z","updated_at":"2024-05-30T09:01:00.000Z","dependencies_parsed_at":"2025-06-26T20:09:45.986Z","dependency_job_id":"c986f750-f2b1-4866-82a6-a7833ab58614","html_url":"https://github.com/plotdb/xfl","commit_stats":null,"previous_names":["plotdb/xl-fontload"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/plotdb/xfl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fxfl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fxfl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fxfl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fxfl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plotdb","download_url":"https://codeload.github.com/plotdb/xfl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotdb%2Fxfl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021785,"owners_count":26087056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["font","javascript"],"created_at":"2024-11-11T05:05:42.295Z","updated_at":"2025-10-14T22:33:46.929Z","avatar_url":"https://github.com/plotdb.png","language":"Pug","funding_links":[],"categories":[],"sub_categories":[],"readme":"xl-fontload\n=======\n\n中文字型網路化。 依詞頻切割字型，並透過前端實作 lazy loading。 無需後端程式支援。\n\n * 字頻檔 ( word-frequency.csv )\n   示範檔來源: [教育部](http://language.moe.gov.tw/001/Upload/files/SITE_CONTENT/M0001/86NEWS/download/86rest17.TXT)\n * 列舉轉換字型. 放置在 fonts/ 目錄, 結構不拘. 自動搜尋所有 .ttf 結尾檔案.\n * 針對每一字型:\n   * 列舉所有支援字符\n   * 其中常用五百字、標點符號、英文字母、數字等，做為第一字型檔\n   * 接下來，剩餘字符有出現在詞頻表中者，依字頻每一百字組成一字型檔.\n   * 剩餘未對應字，每一百字組成一字型檔.\n   * 所有字型檔置於同一目錄中，檔名以數字區隔.\n   * 輸出字碼 / 字型檔編號對應表, 供前端快查.\n\n\n\nUsage / Compiler\n----------------\n\n * 此專案使用 nodejs, 請先安裝 nodejs 與 npm ，並利用 npm install 建利 node_modules 目錄。\n   參考指令: \n\n       curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -\n       npm install\n\n * 將欲轉換的字型整理至 fonts/ 目錄，目錄結構不拘。程式會自動掃出所有字型檔。\n   - 目前只吃 ttf 檔唷～啾咪。\n * 準備字型檔 word-frequency.csv\n * 執行轉換程式 compile.sh \n * 字型檔輸出於 assets/ 目錄.\n\n\n\nUsage / Frontend\n----------------\n\n基本使用方式：\n\n    xfl.load(\"http://path/to/scattered/font/folder/\", options, function(font) {\n        font.sync(stringToDisplay);\n    })\n\n\n根據即時內容動態載入字型的範例：\n\n    /* assume we have \"textarea\" variable to be an input box accepting user input */\n    xfl.load(\"http://path/to/scattered/font/folder/\", options, function(font) {\n       textarea.addEventListener(\"keyup\", function() {\n         font.sync(textarea.value);\n       });\n    })\n\n\n若你沒有打算自幹字型檔，可以使用我們透過 Github Pages 準備的一組字型檔，專案庫的位置在[這裡](https://github.com/plotdb/xl-fontset/)，欲使用則可以透過這個網址：[http://plotdb.github.io/xl-fontset/alpha/\u003c字型名稱\u003e](http://plotdb.github.io/xl-fontset/alpha/\u003c字型名稱\u003e)，例如：\n\n    xfl.load(\"http://plotdb.github.io/xl-fontset/alpha/瀨戶字体\", function(font) { ...\n\n請自行將「\u003c字型名稱\u003e」換成欲使用的字型即可。目前支援的字型一覽可在[這裡](https://github.com/plotdb/xl-fontset/tree/gh-pages/alpha)找到，包括王漢宗 42 字型、刻石錄、站酷、cwText-Q、瀨戶字体等共 57 種字型。\n\n要注意的是目前字型檔轉換時仍有些問題，可能因此導致部份字型有缺字狀況。此外並非所有字型都包含了完整的中文字，請自行斟酌使用。\n\n\nOptions:\n\n  * fontName - name used in font-family. default to be the basename of URL.\n  * (TBD) text - preload files that contains text in this option.\n\n\n\n未來方向\n--------\n\n * 傳輸最佳化 ( Optimization )\n   * 考慮到字符相關性，可透過萌典、特定語料庫建立字符空間，透過 clustering algorithm ( 如 K-means clustering ) 將相關字符分組做為字型切割依據，進而減少需要載入的檔案數量.\n   * 進一步做檔案尺寸最佳化。\n   * 提供 nginx 與 apache 組檔模組，讓瀏覽器可以透過單一 HTTP Request 取得必要檔案 ( 例如, GET https://path/to/font/1+2+3+4 ) \n * 品質問題 ( Quality )\n   * 缺字部份，可使用對抗式生成網路學習並自動補齊。\n   * 上述的對抗式生成網路亦可用於協助新字型生成。\n * 其它\n   * 設定參數化，在建立字型檔時可透過設定依自己的需求客製化字型集。\n * Google Font 已實作類似的技術用以載入中文字型. 請參見:\n   - https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/webfont-optimization\n   - 範例 CSS:\n     - https://fonts.googleapis.com/css?family=Zhi-Mang-Xing\u0026display=swap\n\n\nLICENSE\n--------\n\n * Font Files: All curated font files are separatedly placed in [another repo (xl-fontset)](https://github.com/plotdb/xl-fontset/) and are either GPL or SIL-OFL Licensed. (OK for Commercial Use)\n * Source codes are released under MIT License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotdb%2Fxfl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplotdb%2Fxfl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotdb%2Fxfl/lists"}