text: [API] remove Text and Advances from Layout

These fields are no longer needed with the new text shaper.
Advances is redundant to the glyph information, and Text
should never be used during layout, as you should
traverse the cluster list instead. This commit also removed
the now-unused string field from the path LRU cache key.

References: https://todo.sr.ht/~eliasnaur/gio/146
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2022-03-16 16:01:40 -04:00
committed by Elias Naur
parent 01276238df
commit 9576b659d7
7 changed files with 10 additions and 11 deletions
-1
View File
@@ -40,7 +40,6 @@ type layoutKey struct {
type pathKey struct {
ppem fixed.Int26_6
str string
gidHash uint64
}
+2 -2
View File
@@ -24,10 +24,10 @@ func TestLayoutLRU(t *testing.T) {
func TestPathLRU(t *testing.T) {
c := new(pathCache)
put := func(i int) {
c.Put(pathKey{str: strconv.Itoa(i), gidHash: uint64(i)}, Layout{Runes: Range{Count: i}}, clip.PathSpec{})
c.Put(pathKey{gidHash: uint64(i)}, Layout{Runes: Range{Count: i}}, clip.PathSpec{})
}
get := func(i int) bool {
_, ok := c.Get(pathKey{str: strconv.Itoa(i), gidHash: uint64(i)}, Layout{Runes: Range{Count: i}})
_, ok := c.Get(pathKey{gidHash: uint64(i)}, Layout{Runes: Range{Count: i}})
return ok
}
testLRU(t, put, get)
-1
View File
@@ -168,7 +168,6 @@ func (f *faceCache) shape(ppem fixed.Int26_6, layout Layout) clip.PathSpec {
}
pk := pathKey{
ppem: ppem,
str: layout.Text,
gidHash: f.hashGIDs(layout),
}
if clip, ok := f.pathCache.Get(pk, layout); ok {
-2
View File
@@ -92,8 +92,6 @@ type Layout struct {
// so the first cluster will describe the beginning of the text and may
// refer to the final glyphs in the Glyphs field if the text is RTL.
Clusters []GlyphCluster
Text string
Advances []fixed.Int26_6
// Runes describes the position of the text data this layout represents
// within the overall body of text being shaped.
Runes Range