php / php/php-src

Inconsistent Results with imagettfbbox

オープン
#9,073 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: gd Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

The following code (run in a directory containing FreeMono.ttf) gives different results on Linux vs Windows:

<?php
$fontFileName = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'FreeMono.ttf');
var_dump(md5_file($fontFileName)); // to show using same file
var_dump(imagettfbbox(10.0, 0.0, $fontFileName, 'Hello'));

Resulted in this output on Windows:

C:\git\ExactFont\testfont.php:3:
string(32) "ec48e99df5d46035b62ef0d825b43336"
C:\git\ExactFont\testfont.php:4:
array(8) {
  [0] =>
  int(0)
  [1] =>
  int(0)
  [2] =>
  int(39)
  [3] =>
  int(0)
  [4] =>
  int(39)
  [5] =>
  int(-9)
  [6] =>
  int(0)
  [7] =>
  int(-9)
}

But I got this output on a Linux Ubuntu system:

C:\git\ExactFont\testfont.php:3:
string(32) "ec48e99df5d46035b62ef0d825b43336"
C:\git\ExactFont\testfont.php:4:
array(8) {
  [0] =>
  int(0)
  [1] =>
  int(1)
  [2] =>
  int(41)
  [3] =>
  int(1)
  [4] =>
  int(41)
  [5] =>
  int(-9)
  [6] =>
  int(0)
  [7] =>
  int(-9)
}

PHP Version

7.4.3 and 8.1.8 on Linux; 7.4.26 and 8.0.13 and 8.1.0 on Windows

Operating System

Ubuntu 20.04.4 LTS; Windows 10 Enterprise 19044.1826

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、記載された Ubuntu および Windows の各バージョンで、提供された imagettfbbox の例を FreeMono.ttf とともに実行し、一致する md5_file ハッシュと異なるバウンディングボックス配列を確認します。プラットフォーム固有の結果を調査し、報告された再現を維持したまま差異を説明または修正することを完了条件(done)とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
computer-graphics
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。