diff --git a/internal/ui/render.go b/internal/ui/render.go index bcf3e56..ce6e84d 100644 --- a/internal/ui/render.go +++ b/internal/ui/render.go @@ -230,9 +230,9 @@ func (r *Renderer) drawTruncatedText(gtx layout.Context, shp *text.Shaper, str s } } - // Re-layout truncated text and draw + // Re-layout truncated text and draw glyphs directly shp.LayoutString(text.Parameters{PxPerEm: fixed.I(gtx.Sp(size))}, fullStr) - r.drawText(gtx, shp, fullStr, size, x, y, col) + r.drawLineText(gtx, shp, x, y, col) } // drawText draws text using the same approach as Gio's textView: @@ -240,8 +240,11 @@ func (r *Renderer) drawTruncatedText(gtx layout.Context, shp *text.Shaper, str s func (r *Renderer) drawText(gtx layout.Context, shp *text.Shaper, str string, size unit.Sp, x, y unit.Dp, col color.NRGBA) { // Layout text shp.LayoutString(text.Parameters{PxPerEm: fixed.I(gtx.Sp(size))}, str) + r.drawLineText(gtx, shp, x, y, col) +} - // Draw glyphs using the same approach as Gio's textView +// drawLineText draws already-laid-out glyphs using shaper.Shape() and shaper.Bitmaps(). +func (r *Renderer) drawLineText(gtx layout.Context, shp *text.Shaper, x, y unit.Dp, col color.NRGBA) { var glyphs [32]text.Glyph line := glyphs[:0] for g, ok := shp.NextGlyph(); ok; g, ok = shp.NextGlyph() { diff --git a/pad b/pad index ec4535e..b8e33c7 100755 Binary files a/pad and b/pad differ