PHP RFC: imagettf* deprecation/removal
- Version: 1.0
- Date: 2014-07-26
- Author: Lonny Kapelushnik, firstname.lastname@example.org
- Status: Under Discussion
- First Published at: http://wiki.php.net/rfc/imagettf_deprecation
There are imagettftext and imagettfbbox functions that are used for writing text on an image. Those functions are functional subsets of the imagefttext and imageftbbox functions and seem to only exist for legacy reasons.
As far as I can tell the original reason for having both functions was because PHP LIBGD is a custom implementation of LIBGD that had additional functionality from the actual LIBGD. While this is still the case it seems that now the required functions (gdImageStringFT and gdImageStringFTEx) exist in both libraries.
The only difference between imagettf* and imageft* functions is the imagettf* functions do not provide the optional ‘extrainfo’ parameter
I propose deprecating and then removing the imagettftext and imagettfbbox functions.
The reasons I would like to deprecate them are:
- They're functionality is a subset of imagefttext and imageftbbox
- The imagettf* functions have the same requirements as the imageft* functions
- The imagettf* functions parameters are compatible with the imageft* functions parameters
- The imagettf* function names and docs incorrectly imply/state that the functions are for TrueType fonts only
Though this is a small change I believe it will bring significant value to the PHP community.
The first and most important effect of this change is that it makes the userland API cleaner. By removing the possibility of using the older functions we remove any confusion or question about what functions to use. Both new and experienced userland users can work quicker because there will be no options to weigh.
The second effect of this change is that it makes the php-src code cleaner. By removing the two ways to call the same internal function we are able to clean up the internal code and provide clarity on where to add new functionality.
The only step to migrate from the imagettf* functions to imageft* functions is to change the function names from ‘imagettf*’ to ‘imageft*'
Backward Incompatible Changes
The imagettf* functions will first send an E_DEPRECATED error message and then no longer exist. The justification for this is cleaning up our code and providing guidance to both userland and internal users on what to use.
Proposed PHP Version(s)
- E_DEPRECATED imagettftext and imagettfbbox functions in PHP 5.6.y+1
- Remove imagettftext and imagettfbbox functions in PHP.next
Proposed Voting Choices
We will be voting on if we should mark the imagettftext and imagettfbbox functions as E_DEPRECATED in PHP 5.6.y+1 and removed in PHP.next. The vote will require a 2/3 majority.
Originally proposed w/o RFC on the mailing list: http://markmail.org/message/b354f4s3rmvhl5vw