Jump to content

[SOLVED] Can you arc a font with PHP?


phpknight

Recommended Posts

It's certainly possible if you know the trigonometry involved. You'd have to place each character individually. positioned on the curve and at an angle tangential to the curve at that point. Character spacing would also need calculating.

 

Or, as in my sig, do it by displacing pixels to follow (in this case) a sine wave

Link to comment
Share on other sites

Barand,

 

Thanks.  It seems like the latter option--getting it to follow a curve--is more like what I would be looking for since the characters themselves would be curved.  Please send any info along to help me get started--possible useful functions, etc.

 

phpknight

Link to comment
Share on other sites

You need a source image containing the text placed using

 

      http://www.php.net/imagettftext

 

and you need a destination image.

 

Loop through the rows and columns of the source image to get each individual pixel

 

      http://www.php.net/imagecolorat

 

Place them in the destination image off-setting the y position according the curve you want to follow

 

        http://www.php.net/imagesetpixel

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.