mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
text: convert clip.Ops to op.CallOp
MacroOp is about to lose the ability to run a different operation list than the one it was recorded on. Text shape caches rely on that property, and must use the new CallOp operation added for purpose. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -42,7 +42,7 @@ func (f *Font) Layout(ppem fixed.Int26_6, str string, opts text.LayoutOptions) *
|
||||
return layoutText(&f.buf, ppem, str, &opentype{Font: f.font, Hinting: font.HintingFull}, opts)
|
||||
}
|
||||
|
||||
func (f *Font) Shape(ppem fixed.Int26_6, str text.String) clip.Op {
|
||||
func (f *Font) Shape(ppem fixed.Int26_6, str text.String) op.CallOp {
|
||||
return textPath(&f.buf, ppem, &opentype{Font: f.font, Hinting: font.HintingFull}, str)
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func layoutText(buf *sfnt.Buffer, ppem fixed.Int26_6, str string, f *opentype, o
|
||||
return &text.Layout{Lines: lines}
|
||||
}
|
||||
|
||||
func textPath(buf *sfnt.Buffer, ppem fixed.Int26_6, f *opentype, str text.String) clip.Op {
|
||||
func textPath(buf *sfnt.Buffer, ppem fixed.Int26_6, f *opentype, str text.String) op.CallOp {
|
||||
var lastPos f32.Point
|
||||
var builder clip.Path
|
||||
ops := new(op.Ops)
|
||||
@@ -188,7 +188,8 @@ func textPath(buf *sfnt.Buffer, ppem fixed.Int26_6, f *opentype, str text.String
|
||||
x += str.Advances[advIdx]
|
||||
advIdx++
|
||||
}
|
||||
return builder.End()
|
||||
builder.End().Add(ops)
|
||||
return op.CallOp{Ops: ops}
|
||||
}
|
||||
|
||||
func (f *opentype) GlyphAdvance(buf *sfnt.Buffer, ppem fixed.Int26_6, r rune) (advance fixed.Int26_6, ok bool) {
|
||||
|
||||
Reference in New Issue
Block a user