Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/11/2007, 21:25
aspmasterman
 
Fecha de Ingreso: agosto-2006
Mensajes: 112
Antigüedad: 17 años, 7 meses
Puntos: 0
fuente en imagen php

AYUDA

Tengo un problema con las fuentes, que quiero imprimir como imagenes, en php,

<?php
header("Content-type: image/jpeg");

// constants
define("FONT_SIZE", "8");
define("FONT_FAMILY", "fuente.ttf");

// parameters
$text = isset($_REQUEST["texto"])? $_REQUEST["texto"]: "???";

// image dimensions
$box = imagettfbbox(FONT_SIZE, 0, "1.ttf", $text);
$width = FONT_SIZE + 2;
$height = $box[2] - $box[0] + 0;

// new image
$img = @imagecreate($height, $width);
imagecolorallocate($img, 0xff, 0xff, 0xff); // white

// text
$black = imagecolorallocate($img, 0x00, 0x00, 0x00); // black
imagettftext($img, FONT_SIZE, 0, 0, $width - 2, $black, FONT_FAMILY, $text);

imagejpeg($img);
imagedestroy($img);
?>

en este codigo, me sale la fuente tahoma, a tamaño 8, pero el problema es que entre caracter y caracter no hay el mismo espacio, y me he fijado en el paint cuando escribes tahoma a 8 te lo pina pixelada y con igual espacio entre caracteres, como hago para imprimir en una imagen tahoma a 8 como en el paint tahoma a 8
Gracias

Última edición por aspmasterman; 11/11/2007 a las 17:39