是否可以使用 PHP GD 创建上标字体?
有没有办法使用 GD/PHP 创建上标文本。我想创建 6 月 20 日的日期格式,其中“th”是上标,但我找不到方法来执行此操作。我已经尝试过 th
但这只是按原样显示。
Is there a way to create superscript text using GD/PHP. I want to create a date format of 20th June where the "th" is superscript however I can't find a way to do this. I have tried <sup>th</sup>
but this just displays it as it is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要单独绘制上标文本。您可以使用 imageftbbox() 检测原始文本的结束位置,然后使用结果来计算使用较小字体大小绘制上标文本的位置。
You may have to draw the superscript text separately. You can detect where the original text ends by using imageftbbox() and then using the result to calculate where to draw the superscript text using a smaller font size.