Codeistry

Archive for the ‘Technical’ Category

Q&A: Images of text vs. Webfonts

Friday, November 19th, 2010

A little while ago I got a question from a good friend and client of mine about using fonts on websites. This also applies to other ways of faking web fonts, like sIFR. As others have been asking me about this lately, I thought I’d put my answer up here, so that I can point poeple at it in the future:

Q:

Please remind me about images of text vs real text on websites. Search engines search alt. text so why not have a navigation with images and nice typography rather than a limited selection of web fonts?

A:

It’s true that search engines search alt. text – and you can do it that way. If you’re determined to use images, you should probably also use a hidden <span>Menu Text</span> inside the <a> element. These sort of work Ok, for the most part. The arguments for and against this are sort of like flash sites vs. real websites; one is the Right Thing To Do and one isn’t. You can make the wrong way work mostly Ok, if you work at it, but however hard you try, there are always downsides and you’re putting yourself at a slight disadvantage all the time.

Why is real text better?

There are a large number of little reasons why text is better than images; images are: harder to update when you change or add things to a site, harder to update when you change site designs or colours, much larger and slower to download, cause extra HTTP requests slowing down page loading even further, aren’t searchable (either by search engines, or users with ctrl+f), aren’t translatable, don’t zoom/re-flow as well on mobile devices, don’t render as well when zoomed or viewed as different resolutions, don’t print very well, aren’t as accessible, etc, etc…

Even better…

Also, I saved the best bit till last: You don’t need to choose any more! The ‘limited selection of web fonts’ issue has gone away – you can now use any font you like, provided that you’ve got a license to use it on a website. As far as I can see, this makes using images of text completely obsolete – I can now think of no circumstances where using images of text is even remotely justifiable. Previously, the only argument in favour of images was ‘it looks nicer’; this solitary argument in their favour is now gone.

Here are some resources that cover modern web fonts:

Here are some examples of sexy looking websites that make good use of modern web fonts. Notice that all the text is normal, selectable, searchable text, even the sexy looking stuff:

Some by me:

lots by others:

How do I actually use webfonts then?

The webfonts stuff is all just CSS, and pretty simple to use. You just tell it where the font file is, and give it a name:


@font-face {
font-family: 'DroidSansRegular';
src: url('/fonts/droidsans-regular.otf');
font-weight: normal;
font-style: normal;
}

then you just use it as normal:


p {
font-family: DroidSansRegular, Arial, sans-serif;
font-size: 18pt;
}

there are various tools which will write the (slightly more complex) cross-browser version of that. I used FontSquirrel for http://joaobarao.com/ – you can see what it generates here: http://joaobarao.com/css/joao.css – all the @font-face stuff at the top is generated for you by FontSquirrel. I used two excellent free / open fonts: Fontin and Droid Sans on the http://joaobarao.com/ site.

Portfolio updated

Monday, September 13th, 2010

I’ve just added Twinbro into the Codeistry Portfolio, another job in my queue of jobs that need adding. I’d used the Twinbro website in my Sorfolio, so I thought I’d better put them onto the main portfolio site too.

Screenshots sowing the difference between the two Inkscape Image Supersample settings

I’ve also updated all the thumbnail images in the portfolio, after I figured out which Inkscape setting was degrading the quality. If you go into Inkscape Settings, then Bitmaps and set the ‘Oversample bitmaps’ setting to ’16×16′, you’ll get much nicer anti-aliasing on your bitmaps, especially if you’re rotating or resizing them.

I also took the opportunity to resize the thumbnails to make them a bit larger and to tidy up the formatting of the older ones, which looks much better.

Choosing syntax highlighting colours for the draw spaces Gedit plugin

Monday, May 4th, 2009

I’ve recently upgraded to Ubuntu Jaunty – and therefore Gedit 2.26.1 – and I couldn’t figure out how to change the color of spaces shown by the ‘Draw Spaces’ plugin. This used to be set in the plugin configuration, but you now do it in the syntax highlighting theme – but how? What do you need to add?

The closest that I got googling was this: https://bugs.launchpad.net/ubuntu/+source/gedit-plugins/+bug/348500 – which almost tells you but misses out the crucial bit of info.

So, I asked the fine folks in the #gedit room on irc.gnome.org and they enlightened me; you need to add this to your syntax theme file:

<style name="draw-spaces" foreground="tinted_grey"/>

Where tinted_gray is one of your theme’s colours. I would put it at the top somewhere, with the rest of the global stuff. You can look in the cobalt.xml file in /usr/share/gtksourceview-2.0/styles for an example of a theme which does this. I thought I’d put this here so anyone else who get’s stuck trying to change this has a better chance of Googling an answer.

Download a modified version of the Gedit Twilight Theme, with this tweak added. To install, put the file into your ~/.gnome2/gedit/styles/ folder and restart Gedit. Then just select the Twilight theme in Preferences.

MySQL Workbench 5.1.10 beta

Friday, April 10th, 2009

The new MySQL Workbench is now in beta and is looking very good:

MySQL Workbench 5.1.10 showing a MODx 0.9.6.3 databaseYou can import create scripts (mysqldumps), build diagrams yourself, with full drag and drop etc, and export create scripts. You can also annotate with text and images and export the diagrams as SVG, PDF, PNG etc… Here’s the PDF for the MODx 0.9.6.3 diagram shown, along with the MWB (workbench) file. That diagram is just an imported mysqldump of a MODx DB – all I did was click the auto-arrange button.

It’s available for Linux (32 & 64 bit), Mac and Windows. I’ve been playing with the 64bit version in Ubuntu and it seems to work great! More info on their blog, or get it here: http://dev.mysql.com/downloads/workbench/5.1.html

gcalc: a command line version of Google Calculator

Friday, April 10th, 2009

Here’s a command line version of Google Calculator:gcalc command line tool in use

Download gcalc here: http://www.codeistry.com/assets/files/gcalc.zip

Using Google Calculator in firefox's search box.It’s a little python script that talks to Google, using it’s calculator syntax. You’ll get the same answers if you type the queries into google

To use the script, just download the zip file, extract the file inside and put it somewhere on your path; I’ve started putting these kind of things in ~/bin. I originally found the script here (http://vrai.net/page.php?block=scripts) but it didn’t work too well, so I fixed it up. I’ve tested it on Linux, but it should work anywhere Python is installed.

If you’re using that script on Linux, then chmod +x gcalc it to allow it to be executed. If you’re using Windows, you might have to add ‘.py’ to the end of the filename. Then the syntax is very simple:

gcalc “1 hour 5 minutes in seconds”
1 hour 5 minutes = 3900 seconds

gcalc “100 + 2 * 5″
100 + (2 * 5) = 110

gcalc “41000 yen in british pounds”
41,000 Japanese yen = 277.129372 British pounds

Here are complete instructions on the syntax that Google Calculator supports.

Also, in the screenshot above I’m using Fish, the Friendly Interactive SHell because it does nice syntax highlighting, amongst many other cool things. Fish is here, if you want it.

Have fun!

Codeistry blog is proudly powered by WordPress Entries (RSS) and Comments (RSS).