Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复BuildImage类text居中类型bug;修复原神今日素材有时发不出图片的问题 #1317

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

McElaga
Copy link
Contributor

@McElaga McElaga commented Mar 14, 2023

修复BuildImage类text居中类型bug

问题概括:不应该对字符串对象text直接self.getsize(text)。因为含\n的字符串在展示(发送出去)后是会分行的,而这样直接self.getsize(text)获得的是总长度和高度。以致于ttf_w过长,ttf_h过短,最终导致居中类型根据此数据计算出的wh错误。
图片说明
3b41dc367c2ce37
修改前,w过小(甚至为负),h过大,导致文字位置不合理(文字的右下部分在图片左下角)。
-32d66432e5c20d67
修改后,恢复正常。
修改说明:原代码是通过整张图片大小乘以某个百分比计算出的文字位置,并非真正居中。而居中功能出现bug,通过将文字大小分行(按\n划分)计算即可解决。

修复原神今日素材有时发不出图片的问题

问题概括:貌似只是Message的构造方式有问题,不过顺便精细了一下其它内容。

@HibiKier HibiKier merged commit 0c0803d into HibiKier:main Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants