💼 Text Wrap & Fill Tool
📐 計算公式 / 原理
字元模式:行數 = ⌈文本長度 / 寬度⌉,第 i 行 = 文本[i×寬度 : (i+1)×寬度](按碼點計數,emoji 不拆分);詞模式:按空白切詞並保留原段落換行,累計長度超過寬度即換行;取消「不截斷單詞」時超長詞按寬度強制切分,勾選時整詞保留可超寬
字元模式嚴格按定長切分,會切斷英文單詞與中文詞語,適合固定寬度裝置(如小票、終端)。詞模式保持單詞完整,行數略多但可讀性好,是正文排版的預設選擇。兩種模式均按 Unicode 字素簇計數,emoji 的 ZWJ 組合與組合音標不會被拆壞;勾選“保留原空格與縮排”時保留原文縮排與詞間空格,僅去掉行尾多餘空白。視覺寬度仍以實際渲染為準(CJK 全形字元約佔兩列);換行符可選 \n、\r\n 或 <br>,寫 HTML 片段用 <br>,生成 Windows 文本用 \r\n。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Line breaking | wrapping follows line break properties to avoid splitting inseparable units | Unicode UAX #14, line breaking |
| CJK breaking | Chinese breaks between most ideographs with punctuation placement rules | GB/T 15834-2011, punctuation usage |
| Width calculation | wrapping accumulates display width where fullwidth characters take two columns | Unicode UAX #11, East Asian width |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準