From 5e360507b0b61e2dfc654943baf26f888d0145d4 Mon Sep 17 00:00:00 2001 From: taniiicom Date: Wed, 24 Apr 2024 11:57:39 +0900 Subject: [PATCH] =?UTF-8?q?up:=20vertical-position-of-text=20^^=20-=20?= =?UTF-8?q?=E6=9C=80=E5=88=9D=E3=81=AE=201=20=E8=A1=8C=E3=82=82=E7=B8=A6?= =?UTF-8?q?=E6=96=B9=E5=90=91=E4=B8=AD=E5=A4=AE=E6=8F=83=E3=81=88=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=20^^?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/domain/TextEmoji/service.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/domain/TextEmoji/service.go b/src/domain/TextEmoji/service.go index cd33c62..2e57109 100644 --- a/src/domain/TextEmoji/service.go +++ b/src/domain/TextEmoji/service.go @@ -110,7 +110,6 @@ func drawText(c *freetype.Context, font *truetype.Font, text string, width int) // fontSize, yPos: y 座標 を定義 var fontSize float64 - var yPos float64 // fontSize, yPos を計算 if len(lines) == 0 { @@ -118,7 +117,6 @@ func drawText(c *freetype.Context, font *truetype.Font, text string, width int) return fmt.Errorf("too few lines") } else if len(lines) < 4 { fontSize = (CANVAS_HEIGHT) / float64(len(lines)) - yPos = float64(fontSize) } else { // err return fmt.Errorf("too many lines") @@ -145,7 +143,7 @@ func drawText(c *freetype.Context, font *truetype.Font, text string, width int) // スケールに基づいてフォントサイズを調整 c.SetFontSize(fontSize * scale) // テキストを中央揃えで描画するための開始ポイントを計算 - pt := freetype.Pt(int(math.Round((float64(CANVAS_WIDTH)-(float64(txtWidth)*scale))/2)), int(yPos)+i*int(fontSize*scale)) + pt := freetype.Pt(int(math.Round((float64(CANVAS_WIDTH)-(float64(txtWidth)*scale))/2)), (i+1)*int(fontSize*scale)) _, err := c.DrawString(line, pt) if err != nil { return err