diff --git a/go.mod b/go.mod index c4948d7..99b683a 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/go-text/render go 1.19 require ( - github.com/go-text/typesetting v0.3.0 - github.com/go-text/typesetting-utils v0.0.0-20250620161931-017769003e3c + github.com/go-text/typesetting v0.3.4-0.20260223162014-72238c6215e4 + github.com/go-text/typesetting-utils v0.0.0-20260223113751-2d88ac90dae3 github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef golang.org/x/image v0.23.0 diff --git a/go.sum b/go.sum index d886b3e..140fd4d 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -github.com/go-text/typesetting v0.3.0 h1:OWCgYpp8njoxSRpwrdd1bQOxdjOXDj9Rqart9ML4iF4= -github.com/go-text/typesetting v0.3.0/go.mod h1:qjZLkhRgOEYMhU9eHBr3AR4sfnGJvOXNLt8yRAySFuY= -github.com/go-text/typesetting-utils v0.0.0-20250620161931-017769003e3c h1:EkVgKYSt3+6Y2FdS5TDAe8WRSVpFzWaMoSk0KVzVy2c= -github.com/go-text/typesetting-utils v0.0.0-20250620161931-017769003e3c/go.mod h1:3/62I4La/HBRX9TcTpBj4eipLiwzf+vhI+7whTc9V7o= +github.com/go-text/typesetting v0.3.4-0.20260223162014-72238c6215e4 h1:d1OLEbU/cRwxS+zaer01/7eDAKUEbHz24EMiF6tYMNQ= +github.com/go-text/typesetting v0.3.4-0.20260223162014-72238c6215e4/go.mod h1:4qZCQphq4KSgGTAeI0uMEkVbROgfah8BuyF5LRYr7XY= +github.com/go-text/typesetting-utils v0.0.0-20260223113751-2d88ac90dae3 h1:drBZzMgdYPbmyXqOto4YhhJGrFIQCX94FpR4MzTCsos= +github.com/go-text/typesetting-utils v0.0.0-20260223113751-2d88ac90dae3/go.mod h1:3/62I4La/HBRX9TcTpBj4eipLiwzf+vhI+7whTc9V7o= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE= github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q= diff --git a/render.go b/render.go index 406245b..50f9375 100644 --- a/render.go +++ b/render.go @@ -122,7 +122,7 @@ func (r *Renderer) DrawShapedRunAt(run shaping.Output, img draw.Image, startX, s _ = r.drawSVG(g, format, img, xPos, yPos) } - x += fixed266ToFloat(g.XAdvance) * r.PixScale + x += fixed266ToFloat(g.Advance) * r.PixScale } f.Draw() r.filler = nil diff --git a/render_test.go b/render_test.go index f7066a2..975cd1d 100644 --- a/render_test.go +++ b/render_test.go @@ -56,8 +56,8 @@ func Test_Render(t *testing.T) { r.Color = color.NRGBA{R: 0xcc, G: 0x66, B: 0x33, A: 0xcc} r.DrawStringAt("\uE0A2░", img, 366, 164, f4) - data, _ = os.Open("testdata/cherry/cherry-10-r.otb") - f5, _ := font.ParseTTF(data) + content, _ := ot.Files.ReadFile("bitmap/cherry-10-r.otb") + f5, _ := font.ParseTTF(bytes.NewReader(content)) (&render.Renderer{FontSize: 10, PixScale: 1, Color: color.Black}).DrawStringAt("Hello, world!", img, 6, 10, f5) str = "Hello ज्या 😀! 🎁 fin." diff --git a/testdata/cherry/LICENSE b/testdata/cherry/LICENSE deleted file mode 100644 index e7ebbb5..0000000 --- a/testdata/cherry/LICENSE +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (C) 2023 by camille - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. diff --git a/testdata/cherry/cherry-10-r.otb b/testdata/cherry/cherry-10-r.otb deleted file mode 100644 index de6a29a..0000000 Binary files a/testdata/cherry/cherry-10-r.otb and /dev/null differ diff --git a/testdata/out.png b/testdata/out.png index 6ee9912..94548fc 100644 Binary files a/testdata/out.png and b/testdata/out.png differ