feat(功能强化): 支持页面文字选择复制,优化选区显示
build.yaml / build (push) Successful in 38s

This commit is contained in:
xiaoqidun committed 2026-09-12 23:18:49 +08:00
1 parent 2ea937b7be
commit 1c7f3c03e9
6 files changed
+189 -11

No files matched your search

+9
View File
@@ -179,6 +179,10 @@ func (r *Renderer) renderText(ctx *canvas.Context, obj TextObject, pageH float64
return
}
face := ff.Face(sizePt, fillPaint, fontStyle, canvas.FontNormal)
var metrics canvas.FontMetrics
if textRun != nil {
metrics = face.Metrics()
}
glyphTransforms := r.textObjectGlyphTransforms(fontID, obj)
hasUnderline := strings.Contains(obj.Decoration, "Underline")
_, shadedFill := fillPaint.(canvas.Gradient)
@@ -291,6 +295,11 @@ func (r *Renderer) renderText(ctx *canvas.Context, obj TextObject, pageH float64
for j := spans[i][0]; j < spans[i][1]; j++ {
textRun.Boxes[textPos+j] = unionTextBox(textRun.Boxes[textPos+j], box)
}
bounds := canvas.Rect{Y0: -metrics.Descent, X1: glyphWidth, Y1: metrics.Ascent}
if !glyphPath.Empty() {
bounds = bounds.Add(glyphPath.Bounds())
}
textRun.addSpan(textPos+spans[i][0], textPos+spans[i][1], bounds, m.Scale(scaleX, 1), clipPath, pageH)
}
continue
}