From cf0dbfffc3603469c70a29092192bd27a2eca300 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 06:47:14 +0000 Subject: [PATCH] Bump golang.org/x/image from 0.6.0 to 0.9.0 Bumps [golang.org/x/image](https://github.com/golang/image) from 0.6.0 to 0.9.0. - [Commits](https://github.com/golang/image/compare/v0.6.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/image dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- vendor/golang.org/x/image/font/font.go | 79 +++++++------------ .../x/image/font/opentype/opentype.go | 19 ++--- vendor/modules.txt | 2 +- 5 files changed, 42 insertions(+), 64 deletions(-) diff --git a/go.mod b/go.mod index 8314828636..6797608c7b 100644 --- a/go.mod +++ b/go.mod @@ -90,7 +90,7 @@ require ( go.opentelemetry.io/otel/trace v1.16.0 golang.org/x/crypto v0.11.0 golang.org/x/exp v0.0.0-20221026004748-78e5e7837ae6 - golang.org/x/image v0.6.0 + golang.org/x/image v0.9.0 golang.org/x/net v0.12.0 golang.org/x/oauth2 v0.10.0 golang.org/x/sync v0.2.0 diff --git a/go.sum b/go.sum index 493031951a..5c80c15500 100644 --- a/go.sum +++ b/go.sum @@ -1763,8 +1763,8 @@ golang.org/x/exp v0.0.0-20221026004748-78e5e7837ae6/go.mod h1:cyybsKvd6eL0RnXn6p golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4= -golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0= +golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g= +golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/vendor/golang.org/x/image/font/font.go b/vendor/golang.org/x/image/font/font.go index d1a75350d9..6b9b9bc89c 100644 --- a/vendor/golang.org/x/image/font/font.go +++ b/vendor/golang.org/x/image/font/font.go @@ -38,7 +38,10 @@ type Face interface { // glyph at the sub-pixel destination location dot, and that glyph's // advance width. // - // It returns !ok if the face does not contain a glyph for r. + // It returns !ok if the face does not contain a glyph for r. This includes + // returning !ok for a fallback glyph (such as substituting a U+FFFD glyph + // or OpenType's .notdef glyph), in which case the other return values may + // still be non-zero. // // The contents of the mask image returned by one Glyph call may change // after the next Glyph call. Callers that want to cache the mask must make @@ -49,7 +52,10 @@ type Face interface { // GlyphBounds returns the bounding box of r's glyph, drawn at a dot equal // to the origin, and that glyph's advance width. // - // It returns !ok if the face does not contain a glyph for r. + // It returns !ok if the face does not contain a glyph for r. This includes + // returning !ok for a fallback glyph (such as substituting a U+FFFD glyph + // or OpenType's .notdef glyph), in which case the other return values may + // still be non-zero. // // The glyph's ascent and descent are equal to -bounds.Min.Y and // +bounds.Max.Y. The glyph's left-side and right-side bearings are equal @@ -60,7 +66,10 @@ type Face interface { // GlyphAdvance returns the advance width of r's glyph. // - // It returns !ok if the face does not contain a glyph for r. + // It returns !ok if the face does not contain a glyph for r. This includes + // returning !ok for a fallback glyph (such as substituting a U+FFFD glyph + // or OpenType's .notdef glyph), in which case the other return values may + // still be non-zero. GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) // Kern returns the horizontal adjustment for the kerning pair (r0, r1). A @@ -150,14 +159,10 @@ func (d *Drawer) DrawBytes(s []byte) { if prevC >= 0 { d.Dot.X += d.Face.Kern(prevC, c) } - dr, mask, maskp, advance, ok := d.Face.Glyph(d.Dot, c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue + dr, mask, maskp, advance, _ := d.Face.Glyph(d.Dot, c) + if !dr.Empty() { + draw.DrawMask(d.Dst, dr, d.Src, image.Point{}, mask, maskp, draw.Over) } - draw.DrawMask(d.Dst, dr, d.Src, image.Point{}, mask, maskp, draw.Over) d.Dot.X += advance prevC = c } @@ -170,14 +175,10 @@ func (d *Drawer) DrawString(s string) { if prevC >= 0 { d.Dot.X += d.Face.Kern(prevC, c) } - dr, mask, maskp, advance, ok := d.Face.Glyph(d.Dot, c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue + dr, mask, maskp, advance, _ := d.Face.Glyph(d.Dot, c) + if !dr.Empty() { + draw.DrawMask(d.Dst, dr, d.Src, image.Point{}, mask, maskp, draw.Over) } - draw.DrawMask(d.Dst, dr, d.Src, image.Point{}, mask, maskp, draw.Over) d.Dot.X += advance prevC = c } @@ -227,16 +228,12 @@ func BoundBytes(f Face, s []byte) (bounds fixed.Rectangle26_6, advance fixed.Int if prevC >= 0 { advance += f.Kern(prevC, c) } - b, a, ok := f.GlyphBounds(c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue + b, a, _ := f.GlyphBounds(c) + if !b.Empty() { + b.Min.X += advance + b.Max.X += advance + bounds = bounds.Union(b) } - b.Min.X += advance - b.Max.X += advance - bounds = bounds.Union(b) advance += a prevC = c } @@ -251,16 +248,12 @@ func BoundString(f Face, s string) (bounds fixed.Rectangle26_6, advance fixed.In if prevC >= 0 { advance += f.Kern(prevC, c) } - b, a, ok := f.GlyphBounds(c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue + b, a, _ := f.GlyphBounds(c) + if !b.Empty() { + b.Min.X += advance + b.Max.X += advance + bounds = bounds.Union(b) } - b.Min.X += advance - b.Max.X += advance - bounds = bounds.Union(b) advance += a prevC = c } @@ -278,13 +271,7 @@ func MeasureBytes(f Face, s []byte) (advance fixed.Int26_6) { if prevC >= 0 { advance += f.Kern(prevC, c) } - a, ok := f.GlyphAdvance(c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue - } + a, _ := f.GlyphAdvance(c) advance += a prevC = c } @@ -298,13 +285,7 @@ func MeasureString(f Face, s string) (advance fixed.Int26_6) { if prevC >= 0 { advance += f.Kern(prevC, c) } - a, ok := f.GlyphAdvance(c) - if !ok { - // TODO: is falling back on the U+FFFD glyph the responsibility of - // the Drawer or the Face? - // TODO: set prevC = '\ufffd'? - continue - } + a, _ := f.GlyphAdvance(c) advance += a prevC = c } diff --git a/vendor/golang.org/x/image/font/opentype/opentype.go b/vendor/golang.org/x/image/font/opentype/opentype.go index 231fdbea97..694ac47bfe 100644 --- a/vendor/golang.org/x/image/font/opentype/opentype.go +++ b/vendor/golang.org/x/image/font/opentype/opentype.go @@ -133,8 +133,8 @@ func (f *Face) Metrics() font.Metrics { // Kern satisfies the font.Face interface. func (f *Face) Kern(r0, r1 rune) fixed.Int26_6 { - x0 := f.index(r0) - x1 := f.index(r1) + x0, _ := f.f.GlyphIndex(&f.buf, r0) + x1, _ := f.f.GlyphIndex(&f.buf, r1) k, err := f.f.Kern(&f.buf, x0, x1, fixed.Int26_6(f.f.UnitsPerEm()), f.hinting) if err != nil { return 0 @@ -251,22 +251,19 @@ func (f *Face) Glyph(dot fixed.Point26_6, r rune) (dr image.Rectangle, mask imag } f.rast.Draw(&f.mask, f.mask.Bounds(), image.Opaque, image.Point{}) - return dr, &f.mask, f.mask.Rect.Min, advance, true + return dr, &f.mask, f.mask.Rect.Min, advance, x != 0 } // GlyphBounds satisfies the font.Face interface. func (f *Face) GlyphBounds(r rune) (bounds fixed.Rectangle26_6, advance fixed.Int26_6, ok bool) { - bounds, advance, err := f.f.GlyphBounds(&f.buf, f.index(r), f.scale, f.hinting) - return bounds, advance, err == nil + x, _ := f.f.GlyphIndex(&f.buf, r) + bounds, advance, err := f.f.GlyphBounds(&f.buf, x, f.scale, f.hinting) + return bounds, advance, (err == nil) && (x != 0) } // GlyphAdvance satisfies the font.Face interface. func (f *Face) GlyphAdvance(r rune) (advance fixed.Int26_6, ok bool) { - advance, err := f.f.GlyphAdvance(&f.buf, f.index(r), f.scale, f.hinting) - return advance, err == nil -} - -func (f *Face) index(r rune) sfnt.GlyphIndex { x, _ := f.f.GlyphIndex(&f.buf, r) - return x + advance, err := f.f.GlyphAdvance(&f.buf, x, f.scale, f.hinting) + return advance, (err == nil) && (x != 0) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 0b77b76335..a317cd1fe1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1934,7 +1934,7 @@ golang.org/x/crypto/ssh/knownhosts ## explicit; go 1.18 golang.org/x/exp/constraints golang.org/x/exp/slices -# golang.org/x/image v0.6.0 +# golang.org/x/image v0.9.0 ## explicit; go 1.12 golang.org/x/image/bmp golang.org/x/image/ccitt