Open graphemecluster opened 2 years ago
用 css-line-break 之類的 library 來人手計算也不是不行啦,但這會導致執行速度變慢,而且綾香曾經説過希望讓這些東西留給 rendering engine。
The problem is that many of these libraries are outdated; I can’t find any UAX 14 implementations that align with Unicode 16.0 in npm. The ideal solution would be a polyfill of https://github.com/tc39/proposal-intl-segmenter-v2, but there doesn’t seem to be one at the moment.
無論新版還是舊版也有這個標點符號換行(禁則処理)問題。刪除這行的一些 consequences 是:
.getBoundingClientRect()
並不會考慮 rt 的 dimension。traverse element 的所有 child 並計算 minimum bounding box 也許可以解決這個問題。新版
https://github.com/nk2028/qieyun-autoderiver/blob/e06b116690f1995d710b78337468c8656e9c2509/src/Components/TooltipChar.tsx#L43
舊版
https://github.com/nk2028/qieyun-autoderiver/blob/0aa83ddb796ce743aefcf6d0a800f57f8f931e2d/src/App.scss#L319