dongmeng2509 2012-09-09 09:46
浏览 242

PHP中的“imagettfbbox()”如何工作?

Could you please explain what exactly the return value of imagettfbbox() mean? The manual says:

imagettfbbox() returns an array with 8 elements representing four points making the bounding box of the text on success and FALSE on error. [...Table of points here...] The points are relative to the text regardless of the angle, so "upper left" means in the top left-hand corner seeing the text horizontally.

But, I found it not very clear. For example, the return value:

array(-1, 1, 61, 1, 61, -96, -1, -96)

means the following points:

(-1, -96) ------ (61, -96)
    |                |
    |                |
    |                |
    |                |
    |                |
    |                |
 (-1, 1) -------- (61, 1)              

How should I interpret them?

Why there are negative values?

  • 写回答

3条回答 默认 最新

  • douyu5679 2012-09-09 10:17
    关注

    The following resource explains this: http://www.tuxradar.com/practicalphp/11/2/6

    Just use abs(). This is from the resource above: "[the function] returns its values from the lower-left corner of the baseline of the text string, not the absolute lower-left corner. The baseline of a letter is where it would sit if you were hand writing it on lined paper"

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100