~eliasnaur/gio

font/opentype: disable word wrapping when MaxWidth is negative v1 PROPOSED

aarzilli
aarzilli: 1
 font/opentype: disable word wrapping when MaxWidth is negative

 1 files changed, 3 insertions(+), 1 deletions(-)
aarzilli
Yes, that's ok.

On Wed, Nov 06, 2019 at 10:14:01AM +0100, Elias Naur wrote:
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio/patches/8972/mbox | git am -3
Learn more about email & git

[PATCH] font/opentype: disable word wrapping when MaxWidth is negative Export this patch

aarzilli
Without this or a similar mechanism there is no way to obtain a
truncated rendering.
---
 font/opentype/opentype.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/font/opentype/opentype.go b/font/opentype/opentype.go
index ac83f46..6ae2c3d 100644
--- a/font/opentype/opentype.go
+++ b/font/opentype/opentype.go
@@ -58,7 +58,9 @@ func layoutText(buf *sfnt.Buffer, ppem fixed.Int26_6, str string, f *opentype, o
	}
	var lines []text.Line
	maxDotX := fixed.Int26_6(math.MaxInt32)
	maxDotX = fixed.I(opts.MaxWidth)
	if opts.MaxWidth >= 0 {
		maxDotX = fixed.I(opts.MaxWidth)
	}
	type state struct {
		r     rune
		advs  []fixed.Int26_6
-- 
2.17.1
View this thread in the archives