Date: 04/21/98
- Next message: rasmus: "[PHP-DEV] CVS update: php3"
- Previous message: Bug Database: "[PHP-DEV] Bug #294 Updated: cannot found httpd.h but it is there"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: cmv <email protected>
Operating system: Linux 2.0.27 Slackware
PHP version: 3.0 Latest CVS
PHP Bug Type: Feature/Change Request
Bug description:
It has been noted that the TTF text function is of
limited use because, once you've created the text you
want, there is no way to access the "bounding box" of
the generated text (so you could crop your image down
to size, for example).
A cursory look at gdttf.c seems to show that everytime
a glyph is generated and added to the final image, the
function "knows" what the bounding box of the current
glyph is.
I don't know C, but imagine that adding some kind of
tracking mechanism on a glyph by glyph basis could be
used to provide the bounding box of the entire image.
For example (pseudo-code):
set overallbox to null;
for each glyph {
calculate the bounding box of the glyph -> glyphbox;
generate the glyph;
compare the glyphbox to the overallbox ->
if (glyphbox.min_x < overallbox.min_x) {
overallbox.min_x = glyphbox.min_x; }
if (glyphbox.min_y < overallbox.min_y) {
overallbox.min_y = glyphbox.min_y; }
if (glyphbox.max_x > overallbox.max_x) {
overallbox.max_x = glyphbox.max_x; }
if (glyphbox.max_y > overallbox.max_y) {
overallbox.max_y = glyphbox.max_y; }
}
Then, make the values of the overall boundingbox
availble, through a PHP function like:
$array = ImageTTFBoundingBox();
Anyone up for the challenge? ;)
- Next message: rasmus: "[PHP-DEV] CVS update: php3"
- Previous message: Bug Database: "[PHP-DEV] Bug #294 Updated: cannot found httpd.h but it is there"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

