As I said on Monday, at some point there has to be the first person to blog a useful tidbit in the world of software.
So, for the second time this week, let me be the first.
I've been using ImageMagick--via RMagick--to generate dynamic PNGs on the server.
In general, it's working great, except in one case.
I'm drawing text with custom fonts. The fonts have custom kerning.
ImageMagick seems to handle this fine except when one uses baseline_shift, at which point ImageMagick forgets everything about kerning.
You can fake the baseline shift by using get_type_metrics.
Again, here's hoping this saves someone 20 minutes...or in my case, a few hours.
Wednesday, October 29, 2008
Monday, October 27, 2008
Ruby, Rails, Render, and the Content-Type HTTP header
Don't you hate it when you google for 30 minutes, trying to solve a simple problem, but for some reason the right combination of terms--or at least the combination of terms you think is right--fails.
It just happened to me with a simple problem: change the Content-Type HTTP Response Header for using standard Rails templates to be
The solution is pretty straight-forward:
Setting this hash value in your ActionController action method does the trick.
Here's hoping google picks this up and saves someone 20 minutes.
It just happened to me with a simple problem: change the Content-Type HTTP Response Header for using standard Rails templates to be
text/xml.The solution is pretty straight-forward:
response.headers["Content-Type"] = 'text/xml'...as I eventually found here.Setting this hash value in your ActionController action method does the trick.
Here's hoping google picks this up and saves someone 20 minutes.
Friday, October 24, 2008
Fun with Google Maps and JavaScript
In my last post, I mentioned some hacking with JavaScript.
While I've been finishing my first 'real' project for Jackson Fish Market, I've also been using my new knowledge of JS to dig into the Google Maps APIs.
My first sample is a simple location list. Type in an address (or just a city, zip, landmark) and hit 'Add location'. If the place can be found, it will be mapped and added to a list of locations. You can click on a location to go back to it or click on the 'X' to remove it.

Pretty simple, but also pretty cool.
And since this is the web, I don't have to post a zip file. 'View Source' will get you into see the magic.
Enjoy and happy hacking.
While I've been finishing my first 'real' project for Jackson Fish Market, I've also been using my new knowledge of JS to dig into the Google Maps APIs.
My first sample is a simple location list. Type in an address (or just a city, zip, landmark) and hit 'Add location'. If the place can be found, it will be mapped and added to a list of locations. You can click on a location to go back to it or click on the 'X' to remove it.

Pretty simple, but also pretty cool.
And since this is the web, I don't have to post a zip file. 'View Source' will get you into see the magic.
Enjoy and happy hacking.
Subscribe to:
Posts (Atom)
