feat(图文处理): 优化图文缓存与导出处理
build.yaml / build (push) Successful in 52s

This commit is contained in:
xiaoqidun committed 2026-10-13 10:38:28 +08:00
1 parent 7df35ac122
commit 489db301c5
15 files changed
+304 -75

No files matched your search

+12 -1
View File
@@ -156,7 +156,7 @@ func (r *Renderer) renderText(ctx *canvas.Context, obj TextObject, pageH float64
textRun = r.pageText.addRun(obj)
}
if ff == nil {
if textRun != nil {
if textRun != nil && !r.textContentOnly {
box, _ := ParseBox(obj.Boundary)
boundaryCTM := TranslationMatrix(box.X, box.Y)
if parentCTM != nil {
@@ -194,6 +194,10 @@ func (r *Renderer) renderText(ctx *canvas.Context, obj TextObject, pageH float64
textRun.Boxes = make([]Box, len([]rune(text)))
}
}
if r.textOnly && r.textContentOnly {
ctx.Pop()
return
}
glyphTransforms := r.textObjectGlyphTransforms(fontID, obj)
hasUnderline := strings.Contains(obj.Decoration, "Underline")
_, shadedFill := fillPaint.(canvas.Gradient)
@@ -239,6 +243,13 @@ func (r *Renderer) renderText(ctx *canvas.Context, obj TextObject, pageH float64
positioned := textCodePositioned(tc, positioner.xs, positioner.ys)
drawAsPath := embeddedFont || face.FauxBold > 0 || positioned || fillClip != nil || shadedFill || fillPattern != nil || shouldStroke
for i, glyph := range glyphs {
if i%64 == 0 && r.pageContext != nil {
if err := r.pageContext.Err(); err != nil {
r.renderError = err
ctx.Pop()
return
}
}
str := glyph.Text
drawAsGlyphPath := drawAsPath || glyph.GlyphID >= 0
if !drawAsGlyphPath {