是否可以使用 PHP GD 创建上标字体?

发布于 2024-11-16 02:30:11 字数 116 浏览 15 评论 0原文

有没有办法使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稀香 2024-11-23 02:30:11

您可能需要单独绘制上标文本。您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文