From 830d4bdd21201985bba34404086e7fbdcf8134fd Mon Sep 17 00:00:00 2001 From: vicanso Date: Sun, 11 Dec 2022 14:59:37 +0800 Subject: [PATCH] fix: fix test for text roration --- painter.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/painter.go b/painter.go index 71d205f..8f43940 100644 --- a/painter.go +++ b/painter.go @@ -685,13 +685,16 @@ func (p *Painter) MultiText(opt MultiTextOption) *Painter { } else { values = autoDivide(width, count) } + isTextRotation := opt.TextRotation != 0 offset := opt.Offset for index, text := range opt.TextList { if opt.Unit != 0 && index%opt.Unit != showIndex { continue } - p.ClearTextRotation() - p.SetTextRotation(opt.TextRotation) + if isTextRotation { + p.ClearTextRotation() + p.SetTextRotation(opt.TextRotation) + } box := p.MeasureText(text) start := values[index] if positionCenter { @@ -716,7 +719,9 @@ func (p *Painter) MultiText(opt MultiTextOption) *Painter { y += offset.Top p.Text(text, x, y) } - p.ClearTextRotation() + if isTextRotation { + p.ClearTextRotation() + } return p }