Any way to shrink font size to fit width?

leenwebb - September 16, 2009 - 14:55
Project:Imagecache Actions
Version:6.x-1.6
Component:Text Actions Module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi all,
I continue to love this module! It makes my clients think I am VERY fancy.

One of the features I love in Signwriter is that it can dynamically change the font size in order to make text fit in a particular space. I notice that over in #375086: Automatic text wrapping there is a patch to set a text width. I was thinking of making a little hacky-mashup for myself that combined that text-width patch with the auto-font-shrinky code from Signwriter.

Are there any things I need to look out for with this approach? (Or has someone already written something like this??)

Thanks for any guidance -
Eileen

#1

dman - September 16, 2009 - 23:03

Well I'm actually working (slowly in the background) on a rewrite of the text rendering process. As in that issue, I'd like to be able to see signwriter and imagecacheactions using the same code.
However I looked at the signwriter code and decided it wasn't ripe for abstracting, so busted out
imageapi_text and signwriter2

So I'm saying that imageapi_text+textrender is where imagecache_actions is going, code-wise. If you'd like to try out imageapi_text, that would be really cool. I've not published it yet, only because I wanted to complete the use-case examples, and show how it could be used as a base api for menuwriter too...

... Still, I have not looked at text wrapping or scaling though. Wrapping can be through the attribute 'white-space' I think. I'm not sure about scale-to-fit...
In my experience, re-scaling text produced irregular results. They were correct ... but side-by-side it made the results look cheap. So I've not got to doing that.

 
 

Drupal is a registered trademark of Dries Buytaert.