feat(编辑阅读): 完善保真编辑与跨文档复制,优化后端缓存和大文件性能
build.yaml / build (push) Successful in 41s

This commit is contained in:
xiaoqidun committed 2026-09-24 13:48:48 +08:00
1 parent 06b5df9173
commit 697a059162
18 files changed
+694 -130

No files matched your search

+14
View File
@@ -20,6 +20,8 @@ import (
"slices"
"strings"
"unicode/utf8"
"golang.org/x/text/unicode/bidi"
)
// LayoutText 按自有字体度量重排横向文字,保留绘制属性,可显式启用字体塑形
@@ -76,6 +78,18 @@ func LayoutText(obj *TextObject, value string, options TextLayout, metrics FontM
if lineHeight == 0 {
lineHeight = math.Max(obj.Size, float64(int(ascender)+int(descender)+int(gap))*unit)
}
if options.AutoBidi && !options.Shaping.Bidi {
for _, char := range value {
properties, _ := bidi.LookupRune(char)
switch properties.Class() {
case bidi.R, bidi.AL, bidi.RLE, bidi.RLO, bidi.RLI, bidi.FSI:
options.Shaping.Bidi = true
}
if options.Shaping.Bidi {
break
}
}
}
if options.Shape || options.Shaping != (TextShapeOptions{}) {
return layoutShapedText(obj, value, options, metrics, width, lineHeight, hScale, float64(ascender)*unit)
}