mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
This commit is contained in:
1 parent
2ea937b7be
commit
1c7f3c03e9
6 files changed
+189
-11
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user