From 69e1cd9b6419187e300b33b2e400d4f0546517f5 Mon Sep 17 00:00:00 2001 From: RTAkland Date: Tue, 17 Sep 2024 12:41:09 +0800 Subject: [PATCH] fix: fix font pixel --- .../commands/lookup/DomainPriceCommand.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/lookup/DomainPriceCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/lookup/DomainPriceCommand.kt index 98c6e65..ebf8325 100644 --- a/src/main/kotlin/cn/rtast/fancybot/commands/lookup/DomainPriceCommand.kt +++ b/src/main/kotlin/cn/rtast/fancybot/commands/lookup/DomainPriceCommand.kt @@ -24,13 +24,13 @@ import java.awt.image.BufferedImage class DomainPriceCommand : BaseCommand() { override val commandNames = listOf("/domain") - private val canvasWidth = 300 - private val canvasHeight = 200 + private val canvasWidth = 400 + private val canvasHeight = 300 private val backgroundColor = Color(255, 250, 200) private val secondLayerColor = Color(240, 255, 240) private val textColor = Color.BLACK private val domainApi = "https://dnspod.cloud.tencent.com" - private val font = Font("Serif", Font.PLAIN, 13) + private val font = Font("Serif", Font.PLAIN, 20) private fun createCommonCanvas(): BufferedImage { val canvas = BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB) @@ -48,9 +48,9 @@ class DomainPriceCommand : BaseCommand() { val g2d = canvas.createGraphics() g2d.font = font g2d.color = textColor - g2d.drawString("域名后缀: $suffix 首年注册价格: ${domainPrice.first}元", 50, 80) - g2d.drawString("续费价格: ${domainPrice.second}元", 50, 100) - g2d.drawString("数据来源: 腾讯云", 50, 120) + g2d.drawString("域名后缀: $suffix 首年注册价格: ${domainPrice.first}元", 50, 130) + g2d.drawString("续费价格: ${domainPrice.second}元", 50, 150) + g2d.drawString("数据来源: 腾讯云", 50, 170) g2d.dispose() return canvas.toByteArray().encodeToBase64() } @@ -65,11 +65,11 @@ class DomainPriceCommand : BaseCommand() { val g2d = canvas.createGraphics() g2d.font = font g2d.color = textColor - g2d.drawString("域名$domain${if (available) "可以注册" else "已被注册"}", 50, 60) - g2d.drawString("${if (premium) "是" else "不是"}白金域名", 50, 80) - g2d.drawString("首年年注册价格: ${domainPrice.first}元", 50, 100) - g2d.drawString("续费价格: ${domainPrice.second}元", 50, 120) - g2d.drawString("数据来源: 腾讯云", 50, 140) + g2d.drawString("域名$domain${if (available) "可以注册" else "已被注册"}", 50, 110) + g2d.drawString("${if (premium) "是" else "不是"}白金域名", 50, 130) + g2d.drawString("首年年注册价格: ${domainPrice.first}元", 50, 150) + g2d.drawString("续费价格: ${domainPrice.second}元", 50, 170) + g2d.drawString("数据来源: 腾讯云", 50, 190) g2d.dispose() return canvas.toByteArray().encodeToBase64() }