~eliasnaur

~eliasnaur/gio-patches

Last active 3 days ago

~eliasnaur/gio

Last active 6 days ago
View more

Recent activity

[PATCH 2/2] all: proof of concept of iterator-based text layout and shaping API 3 days ago

From Elias Naur to ~eliasnaur/gio-patches

---
 font/opentype/opentype.go |    8 +
 text/reader.go            |  161 +++++
 text/shaper.go            |   21 +-
 text/shaper2.go           | 1231 ++++++++++++++++++++++++++++++++++++
 text/text.go              |    2 +
 widget/editor2.go         | 1245 +++++++++++++++++++++++++++++++++++++
 widget/index.go           |   91 +++
 widget/label2.go          |  114 ++++
 widget/material/editor.go |   64 ++
 widget/material/label.go  |    4 +-
 10 files changed, 2938 insertions(+), 3 deletions(-)
 create mode 100644 text/reader.go
 create mode 100644 text/shaper2.go
[message trimmed]

[PATCH 1/2] text: delete unused BreaksParagraph 3 days ago

From Elias Naur to ~eliasnaur/gio-patches

Signed-off-by: Elias Naur <mail@eliasnaur.com>
---
 text/shaper.go | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git text/shaper.go text/shaper.go
index b4758bdf..904d0b68 100644
--- text/shaper.go
@@ -187,27 +187,6 @@ func (c *Cache) LayoutRunes(params Parameters, minWidth, maxWidth int, lc system
	return c.layoutText(params, minWidth, maxWidth, lc, nil, string(str))
}

// BreaksParagraph returns whether r is a paragraph separator.
[message trimmed]

[PATCH 0/2] Proof of concept iterative text layout and shaping API 3 days ago

From Elias Naur to ~eliasnaur/gio-patches

This is a proof-of-concept of an iterator-based API for text layout and
shaping. It builds upon Chris' latest patch that implements bidirectional
layout and font fallback.

The main API is the text.Layouter, constructed with text.NewLayouter. It's
Layout method takes a RuneReader and prepares for returning text.Glyphs from
its ReadGlyph method. Note that a Layouter is intended to be shared among
widgets, and is stateful only for iterating through glyphs.

The other major change is that positioning has been moved back to package
widget. I've rebuilt a bit of the indexing logic, but perhaps it's better
to use some of the old code from before Chris patch. Positioning can be
made cluster aware through a flag on text.Glyph, so caret movement works
as expected. A layered layout cache will probably need a flag for marking

Re: [PATCH gio v5 1/1] font/{gofont,opentype},text,widget{,/material}: [API] add font fallback and bidi support 17 days ago

From Elias Naur to ~eliasnaur/gio-patches

On Sun, 20 Nov 2022 at 08:49, Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:
>
> On Fri, Nov 18, 2022 at 9:51 PM Elias Naur <mail@eliasnaur.com> wrote:
> >
> > On Fri, 18 Nov 2022 at 17:48, Chris Waldon
> > <christopher.waldon.dev@gmail.com> wrote:
> >
> > > +func (l *document) Lines(viewport image.Rectangle) text.Lines {
> > > +       startIdx := 0
> > > +       endIdx := len(l.lines)
> > > +       for i, line := range l.lines {
> > > +               if l.LineIsAbove(line, viewport.Min.Y) {
> > > +                       startIdx = i + 1

Re: [PATCH gio v5 1/1] font/{gofont,opentype},text,widget{,/material}: [API] add font fallback and bidi support 19 days ago

From Elias Naur to ~eliasnaur/gio-patches

On Fri, 18 Nov 2022 at 17:48, Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:

> +func (l *document) Lines(viewport image.Rectangle) text.Lines {
> +       startIdx := 0
> +       endIdx := len(l.lines)
> +       for i, line := range l.lines {
> +               if l.LineIsAbove(line, viewport.Min.Y) {
> +                       startIdx = i + 1
> +               }
> +               if l.LineIsBelow(line, viewport.Max.Y) {
> +                       endIdx = i
> +                       break
> +               }

Re: [PATCH gio v3 1/1] font/{gofont,opentype},text,widget{,/material}: [API] add font fallback and bidi support 26 days ago

From Elias Naur to ~eliasnaur/gio-patches

Thank you!

On Fri, 11 Nov 2022 at 10:50, ~whereswaldon <whereswaldon@git.sr.ht> wrote:
>
> Fixes: https://todo.sr.ht/~eliasnaur/gio/425
> Fixes: https://todo.sr.ht/~eliasnaur/gio/211
>

Drop extra newline to please SourceHut.

> diff --git a/font/opentype/opentype.go b/font/opentype/opentype.go
> index 87d76507..2a05bcfc 100644
> --- a/font/opentype/opentype.go
> +++ b/font/opentype/opentype.go

Re: [PATCH gio] widget: fix gap buffer reading data from gap 26 days ago

From Elias Naur to ~eliasnaur/gio-patches

On Wed, 9 Nov 2022 at 14:38, Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:
>
> On Wed, Nov 9, 2022 at 1:54 PM Elias Naur <mail@eliasnaur.com> wrote:
> >
> > On Wed, 9 Nov 2022 at 12:21, Chris Waldon
> > <christopher.waldon.dev@gmail.com> wrote:
> > >
> > > This commit fixes two different ways in which the gap buffer could be
> > > tricked by invalid utf8 input into reading bytes from within the gap.
> > >
> > > Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
> > > ---
> > >  widget/buffer.go      | 19 ++++++++++++++++--

Re: [PATCH gio] widget: fix gap buffer reading data from gap 29 days ago

From Elias Naur to ~eliasnaur/gio-patches

On Wed, 9 Nov 2022 at 12:21, Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:
>
> This commit fixes two different ways in which the gap buffer could be
> tricked by invalid utf8 input into reading bytes from within the gap.
>
> Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
> ---
>  widget/buffer.go      | 19 ++++++++++++++++--
>  widget/buffer_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 62 insertions(+), 2 deletions(-)
>  create mode 100644 widget/buffer_test.go
>
> diff --git a/widget/buffer.go b/widget/buffer.go

Re: [PATCH gio 4/4] font/{gofont,opentype},text,widget{,/material}: [API] add font fallback and bidi support 29 days ago

From Elias Naur to ~eliasnaur/gio-patches

Great work! Comments below

Needs a Fixes/References header?

Elias

On Tue, 8 Nov 2022 at 14:54, ~whereswaldon <whereswaldon@git.sr.ht> wrote:
>
> From: Chris Waldon <christopher.waldon.dev@gmail.com>
> diff --git a/app/window.go b/app/window.go
> index dac0b9e6..90938945 100644
> --- a/app/window.go
> +++ b/app/window.go
> @@ -143,7 +143,7 @@ func NewWindow(options ...Option) *Window {