mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -1476,8 +1476,6 @@ func nullLayout(rr io.RuneReader) ([]text.Line, error) {
|
||||
Runes: text.Range{
|
||||
Count: n,
|
||||
},
|
||||
Text: buf.String(),
|
||||
Advances: make([]fixed.Int26_6, n),
|
||||
},
|
||||
},
|
||||
}, rerr
|
||||
|
||||
@@ -966,8 +966,14 @@ func (q *testQueue) Events(_ event.Tag) []event.Event {
|
||||
}
|
||||
|
||||
func printLines(e *Editor) {
|
||||
for n, line := range e.lines {
|
||||
text := strings.TrimSuffix(line.Layout.Text, "\n")
|
||||
for _, line := range e.lines {
|
||||
start := e.runeOffset(line.Layout.Runes.Offset)
|
||||
buf := make([]byte, 0, 4*line.Layout.Runes.Count)
|
||||
e.Seek(int64(start), 0)
|
||||
n, _ := e.Read(buf)
|
||||
buf = buf[:n]
|
||||
asStr := string([]rune(string(buf))[:line.Layout.Runes.Count])
|
||||
text := strings.TrimSuffix(asStr, "\n")
|
||||
fmt.Printf("%d: %s\n", n, text)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user