text,widget,opentype: change text.Face.Shape to return a clip.PathSpec

With this change, the Shape function returns a clip.PathSpec
instead of a clip.Outline op. It is then possible to create
a clip.Outline or clip.Stroke op to fill the text path or
draw its stroke.

Signed-off-by: Christophe Meessen <meessen@cppm.in2p3.fr>
This commit is contained in:
Christophe Meessen
2021-12-16 17:15:01 +01:00
committed by Elias Naur
parent 3db11cbaad
commit a34e239c04
8 changed files with 25 additions and 28 deletions
+4 -4
View File
@@ -26,7 +26,7 @@ type layoutElem struct {
type path struct {
next, prev *path
key pathKey
val clip.Op
val clip.PathSpec
}
type layoutKey struct {
@@ -81,16 +81,16 @@ func (l *layoutCache) insert(lt *layoutElem) {
lt.next.prev = lt
}
func (c *pathCache) Get(k pathKey) (clip.Op, bool) {
func (c *pathCache) Get(k pathKey) (clip.PathSpec, bool) {
if v, ok := c.m[k]; ok {
c.remove(v)
c.insert(v)
return v.val, true
}
return clip.Op{}, false
return clip.PathSpec{}, false
}
func (c *pathCache) Put(k pathKey, v clip.Op) {
func (c *pathCache) Put(k pathKey, v clip.PathSpec) {
if c.m == nil {
c.m = make(map[pathKey]*path)
c.head = new(path)