mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
ui: move macro recording from Ops to MacroOp
Move the Record and Stop methods from Ops to MacroOp itself. Before this change, Ops.Stop stopped the recording of the most recent macro, which could be a different macro than intended. After this change, there is no such confusion. As a bonus, the Ops API becomes less cluttered. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -234,7 +234,8 @@ func textPath(ppem fixed.Int26_6, f *opentype, str text.String) ui.MacroOp {
|
||||
builder.Init(ops)
|
||||
var x fixed.Int26_6
|
||||
var advIdx int
|
||||
ops.Record()
|
||||
var m ui.MacroOp
|
||||
m.Record(ops)
|
||||
for _, r := range str.String {
|
||||
if !unicode.IsSpace(r) {
|
||||
segs, ok := f.LoadGlyph(ppem, r)
|
||||
@@ -287,5 +288,6 @@ func textPath(ppem fixed.Int26_6, f *opentype, str text.String) ui.MacroOp {
|
||||
advIdx++
|
||||
}
|
||||
builder.End()
|
||||
return ops.Stop()
|
||||
m.Stop()
|
||||
return m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user