Upgrading Ubuntu through a Mirror

I’d begun my upgrade to Jaun­ty last night around 7pm, and woke up this morn­ing to find that the pack­age down­loads had hard­ly made any progress. This because the main Ubun­tu servers are being ham­mered due to Jaunty’s release yes­ter­day morn­ing.

I fol­lowed one tuto­r­i­al that should have set me up to down­load (and upload, I assume) all the pack­ages through a peer-to-peer pro­to­col, but that didn’t seem to help at all. It did make me more com­fort­able edit­ing my /etc/apt/sources.list file, how­ev­er, so I thought I’d try stick­ing some mir­rors in there, rather than using the gener­ic us.archive.ubuntu.com servers.

I found this list of mir­rors, and noticed that there was one at MIT, only sev­er­al blocks away from my apart­ment. I went into sources.list

sudo gedit /etc/apt/sources.list

…and did a search/replace on all instances of us.archive.ubuntu.com/ubuntu/ with ubuntu.media.mit.edu/ubuntu/. Re-ran the upgrade through update-manager, and I was down­load­ing at blaz­ing speeds that com­plet­ed in just about five min­utes.

If you’re hav­ing a rough time get­ting your upgrade to com­plete, find a near­by serv­er from this list and stick it into your sources.list file.

Look­ing for­ward to using 9.04!

Ubuntu, Font Hinting, & You: A Cautionary Tale

This post was writ­ten regard­ing Ubun­tu 8.10, Intre­pid Ibex.

This isn’t the first time I’ve encoun­tered hint­ing; I’ve seen it before in GIMP, even when I was using it in Win­dows, this font ren­der­ing option that was inex­plic­a­bly on by default, and result­ed in hor­ri­ble kern­ing and mis­shapen let­ter­forms. I don’t claim to know a lot about the tech­ni­cal­i­ties of hint­ing, but every­thing I do under­stand about it agrees that it is meant to improve the shapes of let­ters. If this is the case, some­body is doing some­thing very, very wrong. I haven’t seen a hint­ed font that looked any­thing oth­er than sick­ly and disheveled.

I’ve com­plained before about the typog­ra­phy in Ubun­tu, but my con­tention then was with the fonts that were in use by default, not with the way they were ren­dered. What I didn’t real­ize at the time is that the ren­der­ing is the bulk of the prob­lem.

applicationsmenuI found this image on the Ubun­tu site, and I am still in dis­be­lief that they choose to rep­re­sent them­selves with font ren­der­ing like this. Look at that cap­i­tal ‘A’ and ‘V’; look at the way that low­er-case ‘l’ tow­ers over its neigh­bors, noth­ing more than a sin­gle-pix­el-width ver­ti­cal line; look at the kern­ing in the ‘Rem’ of ‘Remove’ – it’s no won­der Ubun­tu has about a 2% world­wide mar­ket share. They expect peo­ple to want to look at that every day of their lives? I know these are rel­a­tive­ly sub­tle details, but their effects are sub­lim­i­nal and, I believe, psy­cho­log­i­cal­ly haz­ardous.

~/.fonts.conf

Of course, when it comes to Lin­ux, for every prob­lem there are a few dozen solu­tions – or one very, very com­pli­cat­ed solu­tion. GNOME, the default desk­top for Ubun­tu, arrives with a “Font Ren­der­ing Details” dia­log box in its appear­ance set­tings, to pla­cate the mouth-breath­ing philistines who need a GUI to get things done. And it doesn’t real­ly help much. I knew I’d have to get my hands dirty in ~/.fonts.conf, this XML file that is capa­ble (and only capa­ble) of incred­i­bly fine-tuned font tweak­ing.

[Fonts are] the #1 rea­son why Lin­ux hasn’t seen any sig­nif­i­cant adop­tion on the desktop/laptop yet. Robert Scoble

The trou­ble, as is the case with most Google results you get when look­ing for help with Lin­ux, is that there is a glut of quick fix­es, blocks of code direct­ed towards one spe­cif­ic per­son and their spe­cif­ic sys­tem, that they are then told to paste into a file or save into a direc­to­ry, with lit­tle to no expla­na­tion about why this solu­tion is going to work. Or there’s the tech­ni­cal doc­u­men­ta­tion that isn’t geared towards users. There’s no mid­dle ground (unless you count the occa­sion­al, skele­tal wiki that hasn’t been updat­ed since 2004).

Only after look­ing at count­less ~/.fonts.conf exam­ples was I able to glean what was going on inside them. The full pow­er of this file allows you to tar­get with amaz­ing pre­ci­sion any vari­ant or size of any font your sys­tem might dis­play and give it its own unique prop­er­ties; but there are real­ly only three(ish) of these prop­er­ties that you need to know about, and I am going to explain them here.

antialias

Anti-alias­ing is the trick that makes your pix­els not look like pix­els. You’ve noticed this when you’ve seen poor­ly resized images with jagged edges – they’re not prop­er­ly anti-aliased. Sim­i­lar­ly, if fonts are not anti-aliased, they look like black Tetris pieces on a white back­ground. Anti-alias­ing is going on all the time with­out you know­ing about it, and you’d real­ly have to make an effort not to have it, but it’s worth putting in your ~/.fonts.conf file for good mea­sure. You’ll want to apply it to all fonts on your sys­tem, so the syn­tax would be:

<match target="font">
 <edit name="antialias" mode="assign">
  <bool>true</bool>
 </edit>
</match>

You can prob­a­bly fig­ure out what these things mean, but I will link to a com­plete man­u­al for ~/.fonts.conf syn­tax at the end of this post.

rgba

This one is a mat­ter of per­son­al pref­er­ence, I guess. I don’t see how any­body of sound mind could stand to have pink, beige, and turquoise pix­els sprin­kled around the edges of their let­ters – the result of “sub-pix­el ren­der­ing” – but I guess the argu­ment is that it allows them to be sharp­er. What­ev­er.

Trust me when I say that things look best if you tell ~/.fonts.conf to dis­able sub-pix­el ren­der­ing, which is done like so:

<match target="font">
 <edit name="rgba" mode="assign">
  <const>none</const>
 </edit>
</match>

If you hap­pen to be schiz­o­phrenic, or col­or­blind or what­ev­er, then yes, fine, you can turn on sub-pix­el ren­der­ing by chang­ing none to rgb, to reflect the com­po­si­tion of your monitor’s sub­pix­els (which are almost cer­tain­ly in the order Red-Green-Blue, from left to right). Have fun scratch­ing your eye­balls out.

rgba=rgb

rgba=rgb

rgba=none

rgba=none

Admit­ted­ly it would be nice if there were some antialiasstyle prop­er­ty you could set to antialiasslight or some­thing, to light­en up those gray pix­els a lit­tle bit.

hinting / autohint / hintstyle

Put it on my tomb­stone: Turn Off Hint­ing. I’m beg­ging you. If some­body tries to tell you that this is a mat­ter of pref­er­ence, they are lying to you, and are not your friend, and are prob­a­bly bang­ing your girl­friend. If you leave hint­ing on, Geor­gia will not look like Geor­gia, Luci­da will not look like Luci­da, and Nim­bus will not look like Hel­veti­ca.

hintstyle=hintnone

hintstyle=hintnone

hinting=true, autohint=true

hinting=true, autohint=true

Here is how you Turn Off Hint­ing®:

<match target="font">
 <edit name="hinting" mode="assign">
  <bool>false</bool>
 </edit>
 <edit name="autohint" mode="assign">
  <bool>false</bool>
 </edit>
 <edit name="hintstyle" mode="assign">
  <const>hintnone</const>
 </edit>
</match>

Alter­na­tive­ly, if you pos­i­tive­ly demand more “crisp­ness” from your fonts, even at the expense of aes­thet­ics, you might want to give slight hint­ing a try. From the above code, change hinting and autohint to true, and hintstyle to hintslight:

hintstyle=hintslight

hintstyle=hintslight

That’s it, rough­ly speak­ing. It’s my under­stand­ing that some spe­cif­ic fonts do look bet­ter if specif­i­cal­ly tar­get­ed and adjust­ed with maybe slight hint­ing. But that’s for anoth­er day. If you do as I’ve instruct­ed, things will be so much bet­ter for you. Leave a com­ment if you want my Pay­Pal address.

This post would not have been pos­si­ble with­out the help of these sites:

  • Arch­Wi­ki: I know noth­ing about Arch Lin­ux, but this wiki page has a lot of good info.
  • fontconfig.org: the most com­plete and recent ~/.fonts.conf ref­er­ence I’ve found.
  • Ubun­tu Wiki: con­tains an exam­ple of a very com­pre­hen­sive (if dat­ed) ~/.fonts.conf file. Study it and learn how to do oth­er stuff.
  • The Mas­ter­plan: anoth­er sam­ple ~/.fonts.conf file, and the only oth­er one that I know of that turns off hint­ing and sub­pix­el ren­der­ing.

How to Save One, Many, or All Items from a Google Reader Feed Locally

Google Read­er, employ­ing Google’s petabytes of stor­age, archives every feed item it’s ever pulled for you. This has always amazed me, as I’m sure I and every­one else must be using far more in Read­er than the 5 gigs we get from Gmail. Still, they don’t have much of a choice; it wouldn’t do any­body good if you could only see the 10 or 20 items present on a feed’s XML file at any giv­en time. And even though they’re prob­a­bly clever enough to only have to store one copy of every item for that item’s hun­dreds of thou­sands of read­ers, they’ve prac­ti­cal­ly built a third copy of the inter­net (after their cache).

A nice fall­out of this archiv­ing is that when­ev­er con­tent you’ve sub­scribed to dis­ap­pears from the web, you’ll still be able to access its (admit­ted­ly homog­e­nized) Read­er copy, for­ev­er; “for­ev­er” here mean­ing “pre­sum­ably for as long as Google is around.” When (if?) Google dies, will its data die with it? Despite my intu­ition that Google will long out­last cur­rent notions of what com­put­ers are and how they work, I still don’t like entrust­ing impor­tant data to oth­er peo­ple, not to men­tion data that is acces­si­ble only through the web. I want a local copy.

But they don’t make it easy for you. Read­er is all AJAXed out, so even sim­ple page saves don’t work. Copying/pasting would be a night­mare. Screen­shots? Too slop­py. Email­ing copies of each item? Too time-con­sum­ing. Tag­ging them with a spe­cial tag, mak­ing that tag’s feed pub­lic, then sub­scrib­ing in, like, Thun­der­bird or some­thing? Even if that weren’t absurd­ly round­about, the pub­lic feeds only have twen­ty or so items.

I’m talk­ing specif­i­cal­ly about a blog I loved, but that up and dis­ap­peared one day, com­plete­ly, leav­ing the only copies of the lost data scat­tered through­out Netvibes, News­ga­tor, Blog­lines, and Read­er. Google search­es turned up noth­ing like a straight­for­ward guide to sav­ing from Read­er, which sur­prised me. But there were clues, and using only a cou­ple tools, I final­ly got it. It’s actu­al­ly pret­ty easy, I was able to save 118 items in about ten min­utes with this method. Let me show you it.

You need Fire­fox, the two plu­g­ins Grease­mon­key and Scrap­Book, and the Grease­mon­key script Google Read­er Print But­ton. Then it’s just a mat­ter of click­ing “Print” for each item you want to save, which opens it in its own tab, then using ScrapBook’s “Cap­ture All Tabs…” func­tion, which auto­mat­i­cal­ly does a “Save Page As, Web Page, com­plete” into your %App­Da­ta% fold­er for each tab, then final­ly option­al­ly using ScrapBook’s “Com­bine Wiz­ard” (in the tools menu of the Scrap­Book side­bar [Alt+K]) to put all the items into a sin­gle fold­er with a sin­gle index.html file.

The “print­ing” part is the most cum­ber­some, but goes by pret­ty quick­ly with the rep­e­ti­tion of a series of clicks and key­strokes:

  1. Click “Print”
  2. Press Esc (to close the print dia­logue)
  3. Press Ctrl+Tab (to get back to Read­er)
  4. Press J (to go to the next feed item)

Do that mind­less­ly for a cou­ple min­utes, and they’ll all be there, wait­ing to be saved. I’m gonna put the word “disk” in here too so that any­body Googling for a solu­tion might find this.