Multiline Multifont Update

Asked by Richard Virtue

Hello. I'm back again and still fiddling with the Buttonmill project coding and structure if interested.

The installation now on my site at http://virtech.org/home/buttonmill/ has been further revised to allow for the specification of different font sizes for each line of button text. Click the "recent buttons" link there to see some examples of the results. Click the source code package link in the page footer there to download your own copy if wanted.

Please note that the latest version also incorporates some other MAJOR changes to the project structure and, in particular, to the use of an index.php page as the "parent" for both the button maker page (glassy.php) and the recent buttons display page (recent.php). This allows end users to modify headers, footers and other style elements only in the index.php parent page without needing to make any changes to any core PHP code files, or to the related javascript which is now contained in its own glassy.js file.

The index.htm file and the entire ./img/ subfolder have been eliminated as unnecessary. In the latter case, only the pixel.gif image has been retained in the main folder which is the only place that it actually works anyhow.

Question information

Language:
English Edit question
Status:
Answered
For:
buttonmill Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#1

Thank you for continuing to work on this, Richard. I have updated the virtech branch with your latest code. The results of your multifont work on the virtech site are very cool.

Do you have any thoughts on making it possible to change style and font at any point in the text? I am imagining the multi-line text box but with the ability to enter html or some other convenient markup.

Revision history for this message
Richard Virtue (rvirtue) said :
#2

You're quite welcome. Been having lots of fun with it. :)

The greatest difficulty (for me at least) with variable fonts on multiple lines has been alignment and leading (line spacing), especially the latter, and most especially when combined with images that displace the text off-center. Right now, I'm using one-third of the AVERAGE font size for leading which seems to work well enough in the positioning calculation loop for each of the text lines. If sizes and styles were variable WITHIN each line, however, keeping the final result looking decent could get really tricky.

I'll give your suggestion some further thought, but I'm not very optimistic at the moment,

Revision history for this message
Richard Virtue (rvirtue) said :
#3

Just to let you know that, since your last "virtech" branch upload, I have made a few minor coding changes in the buttonincludes.php file to explicitly calculate the $leading factor and thus improve the line spacing somewhat. I've also used it to improve the horizontal relationship between images and their left/right displacement of text. The updated source code package is available in the usual place if wanted.

Incidentally, that index.htm file really should be deleted from the "virtech" branch entirely now that index.php is intended to be used as buttonmill's self-loading "parent" home page. In the circumstances, leaving index.htm there as well will only cause problems for people whose hosting services may have various defaults set for their web site's autoloading order of precedence. In fact, index.htm will now redirect them to the WRONG subordinant file location. The ./img/ subfolder can also be deleted entirely, but leaving it there causes no actual problem.

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#4

I meant to remove the img directory and index.htm. It is correct now. I will merge your additional changes eventually (just keep letting me know when your zip updates). I may wait a few days before I grab it again.

Revision history for this message
Richard Virtue (rvirtue) said :
#5

No problem at all, Eric. Just wanted to let you know about the additional changes and the possible problems for end users of retaining that index.htm file.

I'm assuming that one of your aims is to make it as univerally and as easily installable as possible. But what you do with any of my changes, if anything at all, and when you do it is entirely up to you. I'll certainly keep you informed. And I haven't forgotten about your suggestion/request. Just haven't come up with any brilliant ideas yet. I may not be able to.

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#6

I know my suggestion/request is a "tough nut". Never hurts to ask, I always say..

Easy or universal installation are excellent goals, and I think you've done a fantastic job in that respect.

The other "common" request has been for a "component" that people can easily add to existing applications. This requires thinking of buttonmill as two pieces: one is the form and user experience and the other is the button rendering code itself. I think most of that rendering piece is in buttonincludes.php, but I don't know if it could truly stand alone at this point. To me the ideal architecture of the buttonmill release would make it easy for people to use the full web site package to experiment with the button generator, then use only the rendering piece by itself in a different application.

It would also be worth investigating whether there is still a need for ImageMagick. I can't remember what problem it was solving (I remember there were lots of bugs in gd at the time). I know there is limited support for svg in the button images, so that might be part of it.

To be honest, though, requests for modifications or source code have been pretty rare over the years, so I don't imagine there is a huge pent-up demand for anything. I'm already much happier with the state of things today than I was a year ago.

Revision history for this message
Richard Virtue (rvirtue) said :
#7

Hmmm, Interesting. Now those I can get my teeth into, unlike multiple fonts per line. I'm a PHP scripter, not a graphics artist. :)

It should be no great problem creating PHP GD2 code as an alternative to ImageMagick's CONVERT and MOGRIFY execuables, although I'd suggest leaving it as a selectable configuration option rather than a replacement. Generally speaking, hosting services prefer to support ImageMagick 'cuz GD2 tends to be quite processor intensive. Anyhow, I'll have a go at that one over the next few days.

As for making buttonincludes.php into a "plugin" for other web applications, it's almost there now since everything except its actual generator functions has been stripped away and put into separate files. Perhaps they're talking about making it into some kind of PHP class rather than a series of individual funtions. That, however, ignores the reality of its inevitable need for some kind of user interface in order to actually do anything. And glassy.php provides that interface, once again without any extraneous HTML style elements which are now relocated into the "parent" index.php file.

So with the most recent mods and together with the glassy.php interface (and recent.php if wanted) buttonincludes.php could already quite easily be "plugged into" almost any content managment system's overall environment. But, just as with my own "NetQuery" module, all such environments have their own particular plugin module requirements that would have to be met for each one to be supported. That last step is primarily a job for the CMS module developers themselves.

Revision history for this message
Richard Virtue (rvirtue) said :
#8

Pretty much got the GD2 functions to replace the ImageMagick MOGRIFY items, but I'm a little unhappy with the resolution provided by the GD2 imagecopyresized() function. I'd like to use imagecopyresampled() instead if I can figure out how to maintain the transparency. The imagecolorallocatealpha() function should do it, but it's being stubborn. I'll keep fiddling and get back to you ASAP.

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#9

This was a few years ago, but I remember trying to do everything with GD but being forced to use IM for some reason. It's possible that the situation hasn't improved.

Revision history for this message
Eric Dennison (ericd-netdenizen) said :
#10

Closing this thread.

Can you help with this problem?

Provide an answer of your own, or ask Richard Virtue for more information if necessary.

To post a message you must log in.