My love-hate relationship with typeface rendering in Ubuntu

We take good, er at least reasonable, typography for granted all the time. This is especially true when it comes to personal computers because with Microsoft Windows and Mac OS X - upwards of 98 percent of the market - you get characters that are easy on the eye right out of the box.

Let's look at font rendering on Ubuntu. At first glance, it's disappointing. Every time I reinstall Ubuntu, I am bothered of the oddly tall lowercase "l" which is featured on one of the pages on ubuntu.com:

Ubuntu Applications Menu from ubuntu.com

I simply don't find this font rendering as pleasing to the eyes as font rendering on Windows or OS X.

Font Rendering GUI

Fortunately, even though fonts aren't as pretty right out of the box in Ubuntu, you can control your font rendering through an easy-to-locate GUI (System → Preferences → Appearance):

Appearance Preferences: Fonts

A lot of Ubuntu users don't seem to care that much about their font and can be satisfied by playing with the four options in this level of the GUI. The problem is that, unlike the average computer user, many people who switch over to Ubuntu are looking for something other than an operating system that works well when you surf the web or check your email. For those who want an OS that "just works," these four options may not be enough. As someone who (ignorantly?) grew up on Windows, I just couldn't find an option I liked from these four.

Beyond the fact that you don't have quite enough options, it's a lot easier to talk about fonts in terms of hinting, anti-aliasing (analogous to the Ubuntu option for grayscale smoothing), and subpixel smoothing/rendering. These three properties map directly to an aspect of how fonts are rendered on your screen.

Ubuntu's GUI-controlled font rendering options can be described in terms of these properties:

  • Monochrome: no smoothing, full hinting
  • Best Shapes: grayscale smoothing, medium hinting
  • Best Contrast: grayscale smoothing, full hinting
  • Subpixel Smoothing (LCDs): subpixel smoothing, slight hinting

I suggest having Firefox open with a word-heavy webpage you frequent, selecting your favorite of the four options, and then clicking the "Details..." button in the Appearance Preferences GUI, so that you can see what happens when you play around with these properties:

Font Rendering Details

Trial and error really is the best way to figure out what you like. (Note: Changing subpixel order isn't important unless your LCD screen has subpixels in a different order than RGB.) You should make sure to look at a lot of different sized fonts, and if you generally see a variety of fonts, look at a variety of fonts, too.

If you're anything like me, you might be curious as to what each of these three properties actually does and why. I won't include pictures of fonts that are rendered with different properties because different people use differently sized and styled fonts, and these differences are affected somewhat differently by the same rendering options.

Hinting

Hinting, also known as instructing, adjusts the display of a font's outline so that it lines up with a rasterized grid through mathematical instructions. The more hinting, the "crisper" your font appears at small sizes because hinting instructors seek to preserving detail without risking the outline's clarity when rendering fonts. According to the TrueType Reference Manual:

A quality outline font is one that provides legibility at small sizes on low resolution devices and fidelity to the original design at large sizes and on high resolution devices. Chance effects due to interactions between the outline shape and the placement of the grid should be minimized.

I generally do not like hinting, but I know a lot of people who strongly swear by full hinting for all font sizes.

Anti-aliasing

In digital signal processing, the choice of sampling period, T, directly affects the ability to fully reconstruct the original signal. The sampling frequency is defined as \omega_s=\frac{2\pi}{T}, and if there are frequency components \omega present in the original signal such that \omega >\frac{\omega_s}{2}, artifacts from the higher frequency components of the original signal distort the version reconstructed from the sampling process.

Anti-aliasing is a technique that minimizes the affects of the distortion caused by representing a signal at a lower resolution through sampling. This technique removes the high frequency signal components, \omega >\frac{\omega_s}{2}, which would cause aliasing before sampling.

Personally, I like using anti-aliasing for most text. This isn't in the GUI, so you'll need to update your .fonts.conf.

Subpixel Smoothing

Subpixel smoothing uses the fact that each pixel on a color LCD screen is actually composed of individual red, green, and blue subpixel stripes to smooth text with greater detail. If you're still using a CRT monitor, subpixel smoothing probably won't improve your font rendering. Whether or not you enable this property is mostly a matter of personal preference, as it also causes colored pixels to appear around text.

If you do choose to use subpixel smoothing, odds are the default subpixel order (RGB) is what your LCD screen uses; you probably shouldn't change this unless your screen uses a different arrangement.

I prefer not to use subpixel smoothing.

~/.fonts.conf

While you are able to toggle these variables through the Font Rendering Details GUI, you can get a lot more control over your typeface rendering if you use the .fonts.conf XML file in your home directory.

Here is an example of a .fonts.conf file which turns off hinting and subpixel smoothing but enables antialiasing:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <!-- Turn on antialiasing -->
 <match target="font" >
  <edit mode="assign" name="antialias" >
   <bool>true</bool>
  </edit>
 </match>
 <!-- Turn off hinting -->
 <match target="font" >
  <edit mode="assign" name="autohint" >
   <bool>true</bool>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>false</bool>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintnone</const>
  </edit>
 </match>
 <!-- Turn off subpixel rendering -->
 <match target="font" >
  <edit mode="assign" name="rgba" >
   <const>none</const>
  </edit>
 </match>
</fontconfig>

The above XML handles the lion's share of the work my .fonts.conf file deals with.

While you can control the properties mentioned above through this file instead of the GUI, the real perk of the .fonts.conf file is that you can specify different properties for different font sizes and styles. For example, I prefer hinting without anti-aliasing for very small fonts, and I can control this through the .fonts.conf file.

You can certainly look at a complete manual for .fonts.conf files, but experimenting with parts of other people's .fonts.conf files is also useful because there isn't a right answer to questions of personal preference. Unfortunately, tweaking font rendering to your complete satisfaction often takes a non-trivial amount of time.

A meeting of mindsets

This spring, I finally had time in the right places in my schedule to incorporate teaching into my semester. I'm a Learning Assistant (LA) for 6.042: Mathematics for Computer Science, which offers an introduction to discrete mathematics oriented towards computer science and engineering. The class is taught in a very interactive manner: each hour and a half class session is split into a roughly half hour lecture and a roughly hour long team problem solving session. Additionally, students come from a variety of backgrounds: for many this is their first Course 6 class, whereas some students are Course 6 MEng's; some students have taken many theoretical math classes, while others have only taken one semester of calculus.

As an LA, I work on writing the problems for the class, prepare other materials for the class, coach the students during the class problem solving sessions, and hold office hours. Basically, the roles I've been personally assigned as an LA makes me a TA who doesn't have to deal with grading.

This semester's 6.042 students took their second miniquiz two Wednesdays ago, and their quiz grades were finalized this last Wednesday. The biweekly miniquizzes in 6.042 aim to test our students' understanding of the material covered in lectures, class problems, online tutor problems, and problem sets from the previous two weeks. Theoretically, students don't need to put in a lot of studying if they've been keeping up with those four areas of the course, but of course, an individual student may need more or less help. The miniquizzes typically average around 15 points out of 20, with a standard deviation of about 4 points.

Miniquiz two this semester turned out a bit differently. The histogram for total miniquiz score (I am using an image compiled by another TA, so to clarify, score values are on the x-axis and the number of occurrences is on the y-axis):

Overall Miniquiz Scores

Key statistics for miniquiz 2 grades:

  • 83 students "took" the quiz. It is important to note that 82 students actually took the quiz, and that the score of 0 is for a student who punted the quiz. (We'll be ignoring the student who punted in later statistics.)
  • The mean was 12.50 points.
  • The median was 12.50 points. (No skewness!)
  • The standard deviation was 3.93 points.

Based solely on the above histogram, the quiz scores seem to follow a fairly reasonable bell curve, just with a lower average than expected. From the perspective of the course staff, that would normally just mean we made the miniquiz a bit harder than we'd have liked, but the results of this quiz were more complicated than that because of the scores received on the last problem. The last problem was:

Let [\mathbb{N} \rightarrow \{1, 2, 3\}] be the set of infinite sequences containing only the numbers 1, 2, and 3. For example, some sequences of this kind are:

  • (1, 1, 1, 1...),
  • (2, 2, 2, 2...), and
  • (3, 2, 1, 3...).

Prove that [\mathbb{N} \rightarrow \{1, 2, 3\}] is uncountable.

Hint: One approach is to define a surjective function from [\mathbb{N} \rightarrow \{1, 2, 3\}] to the power set \mathcal{P} (\mathbb{N}).

Having seen proofs for the last six years, the mathematician part of me was not particularly concerned with the difficulty of this problem, and I quickly came up with the following solution (which did not use the hint given):

Proof: Assume that [\mathbb{N} \rightarrow \{1, 2, 3\}] is not uncountable. This means that there is a surjective function f:\mathbb{N}\rightarrow [\mathbb{N} \rightarrow \{1, 2, 3\}]. We will show that this is impossible by describing a sequence s\in [\mathbb{N} \rightarrow \{1, 2, 3\}] such that s\notin range(f).

Let f_0, f_1, f_2, \ldots be the sequences in the range of f. We define a sequence

s=(g(f_0[0]), g(f_1[1]), g(f_2[2]), \ldots),

where f_h[k] is the k^{th} element of sequence f_h and g:\{1, 2, 3\}\rightarrow\{1, 2, 3\} is a function such that g(i)\neq i for i=1, 2, 3.

By the definition of s, s[n]\neq f_n[n] for all n\in\mathbb{N}, proving that s is not in the range of f. However, s\in [\mathbb{N} \rightarrow \{1, 2, 3\}]. Thus, f is not surjective as claimed, and [\mathbb{N} \rightarrow \{1, 2, 3\}] is uncountable. \Box

A slightly different wording of my solution was included in the solutions for miniquiz two, below a solution which uses the hint given.

I was concerned that 6.042 students would find this significantly more difficult than I, but I dismissed this fear when the rest of the course staff assured me it would be okay. One could say it wasn't too terrible to have put this on the quiz, but let's look at just the results from that problem (Again, compiled by another TA; score values are on the x-axis and the number of occurrences is on the y-axis):

Problem 3 Scores

Some key statistics about the 82 student scores on problem 3:

  • The mean was 2.72 points.
  • The median was 3.00 points.
  • The standard deviation was 2.54 points.

These "key statistics" really didn't set off that many bells; they just indicate that the problem was hard. However, the way the scores were partitioned alarmed us a lot. Additionally, students who have consistently done well on problem sets, on the in class problems, and on the first miniquiz did not correlate with students who did well on this problem. How did this happen?

Students may have been ill-prepared for crafting a solution to this problem. It is true that they have only seen two proofs similar to this problem: the professor's lecture included a proof which uses an argument similar to the one suggested by the hint, and a problem set problem required a proof structured similarly to my solution. It is reasonable to assume that students are not as familiar with proofs presented during lecture as those they have worked out themselves, but this probably does not fully account for why students performed differently on this problem.

Many students who did get at least partial credit on this problem cited that they did not have enough time to think about this problem correctly as they just figured out what they would need to do too close to the end of the quiz. This is probably because the general mindset for 6.042 thus far differs significantly from the mathematical mindset required for proving problem 3's statement, which isn't too surprising given that the mind of a mathematician and the mind of a computer scientist are required to work in (at least partially) different ways. Simply put, problem 3 of the second miniquiz showed me how unnatural theoretical proofs are to computer scientists.

I wonder if this illustrates that a deep understanding of math is becoming less and less important for being a good computer scientist as many successful MIT graduates take no math courses beyond the general Institute requirements and 6.042. However, I'd like to believe that even if this is the case, difficult problems incite curiosity within my students, causing them to dive deeper into mathematics. After all, having a better understanding of mathematics can't hurt them as computer scientists. At least, the questions students have personally emailed to me since getting their quizzes back supports my claim.

gitionary: the graphical game of git guessing

I apparently have a knack for coming up with nerdy party games. Three Fridays ago, my 6.033 TA encouraged us to practice creating diagrams for our design project proposals by trying to identify UNIX commands or filesystem structures from our partner's drawings. He claims that this "6.033 pictionary" was a result of strong nudging of the course's writing staff. Given that I had been encouraged by some of my friends to learn git earlier that day, naturally, I merged the two ideas and decided that gitionary needed to be created. I told Nelson, who is quite fluent in the ways of git, and he generated the game cards so we could actually play with the idea.

gitionary cards: each has a Porcelain level command and a Plumbing level command to draw

The original premise was simple: draw the appropriate directed acyclic graph corresponding to git commands so that your friends could guess it. However, many people who would likely end up playing the game did not yet know git, myself included, so we thought it would be good to allow drawing non-DAGs, too.

Nelson generated a set of printable gitionary cards (8.5"x11", double-sided on the long edge, requires cutting into cards), and we test ran the game with a rotating "artist" and the rest of the room guessing. I've included some (semi-arbitrarily selected) highlights drawn that evening below. Many of the most successful were not drawn as directed acyclic graphs, such as git-revert:

git-revert, wdaher, 15 seconds

git-stash turned out to be difficult when initially drawn in a way that reflected what the command did, and more surprisingly still took about half a minute after the lower left-hand corner of the sheet was sketched:

git-stash, jesstess, 68 seconds

A somewhat hilarious failure mode of gitionary is that objects which would ordinarily be drawn as a combination of circles and lines inadvertently look like DAGs. This was a problem Jeff had while he was drawing a magnifying glass to represent git-show:

git-show, jbarnold, 34 seconds

You can also click through to see the rest of the drawings from the first run of gitionary:

I definitely encourage you to get a group of your favorite nerdy friends together to play the game, and maybe, you will do more than one of the plumbing commands.

Now that I've created a party game about gitionary, I think I should probably go spend some time learning git. Word on the street is that I'll think the back-end model is "cute."

To the pretty pitter, pitter, patter

I've been told that most people don't like walking through the rain and that others theoretically enjoy the process but don't walk in the rain because they dislike arriving at their destinations wet. However, unless I have something of a very pressing importance at the other end of my journey, I find that I try to catch every raindrop I can on the way.

Even underneath the scaffolding at the intersection of Main St. and Vassar St., many Cambridge residents navigate carefully to avoid the few drops of rain that might sneak through the wooden panels above them. In light of this, it shouldn't be surprising that you make great time by taking the path that maximizes the number of times you are hit by water droplets falling through the planks. Pseudo-random neuron firings (prnf to the zephyr world) worded this moment more poetically:

As I am drifting to catch raindrops who glide off the scaffolding,
I become as unnoticeable to the hustling city folk
as I have made the droplets to the setting concrete.

A couple of hours later that day, I began writing a minimalistic piece for the piano, which I finished it up last Friday. Here are a couple of phrases from the beginning:

Beginning of Raindrops score

About halfway through the piece's composition, I noted that it was eerily reminiscent of my moment deliberately walking in the rain. I was also contented to note that its relationship with a short, poetic phrase meant I didn't have to come up with a more traditional title for the little song.

You can view, or perhaps even play, the complete piano score.

(Fun fact: the title of this post is from Gilbert & Sullivan's The Gondoliers, specifically a line from "Dance a Cachuca." This was the first song I sang with my high school's concert choir.)

How communication breaks down

In a little less than a month, the MIT undergraduate body will elect new leadership for their primary advocacy group, the Undergraduate Association. Every year around later February and early March, students who consider themselves relatively politically active request an increase in transparency and engagement from the candidates, and by the time the next October rolls around, everyone is complaining that communication is broken.

I will admit that they are right: communication is definitely broken. In fact, it is broken for a large number of reasons. But I refuse to agree that the problem lies solely with their favorite scapegoats - the leaders and most active members of the advocacy group; there is a common misconception that the communicators are the primary reason for communications breakdown.

Let's get a better understanding of how communication efforts succeed or fail in light of this common misconception by looking at the interactions between an exceptional UA student representative and constituency. Of course, I cannot touch upon every communications failure through just one story, but this particular story highlights some of the more {prevalent, interesting} ways in which communications break down.

There does not exist one form of communication that works for everyone.

Often, communicators believe that employing the ways in which they garner information is sufficient for communicating with a larger group. This is an egregious mistake as people have different listening styles. Some want to hear every last detail, but others are uninterested in anything more than the bare bones. Some want to actually listen and absorb every word they hear, while others glean and retain information better through conversation. This is why this particular student representative reached out to his constituency in a variety of different ways.

The first was through the classic means of communication at MIT: email. Of course, emails he wrote communicating the latest news and best ways to get involved could be deleted upon receipt, even filtered to make them easier to ignore.

To communicate with his constituency in a more personal manner and directly tie them to the decision makers, he arranged events with administrators surrounding many of the relevant issues, such as the threat of mandatory meal plans and the future structures of student support. Numerous such events were held over the course of the fall semester, and no major topic was left untouched by some event held in the large common room of his dorm. What better way than to get the information and two-way communication you feel you deserve with both your representatives and MIT administrators than from the comforts of your very own dormitory!

Still, maybe someone was troubled by some anomalous political question that may otherwise fall through the cracks. To account for this case, he held weekly "office hours" on a rotating schedule so that anyone could bring any concern, suggestion, or question to his attention.

Were his constituents satisfied? In short, no, but the better question is "Was their lack of satisfaction his fault?"

Communication not only requires an active sender, but also an active receiver.

When there is a breakdown in communication between an organization representing significantly more people than just themselves and their representatives, it is easy to blame the failure on the organization. It's a simple numbers game, really: if this many of us don't know what the few know, then it has to be the fault of the few. More often than not, this mindset is incorrect.

Instead of applauding him for being prompt in sending thoughtful summary emails, constituents complained to each other that these emails did not include enough of the relevant information for specific issues. Instead of appreciating the extra time, effort, and expenditure of political capital to get administrators to host a forum or event in their dorm after hours, constituents secretly snarked about the inevitable shortcomings with each other. Instead of suggesting alternate times for office hours to their representative, constituents would bad mouth their representative for not happening to hold office hours during the one hour a week they were free behind his back. (Rest assured, as soon as others in the UA caught wind of these complaints, they informed him.)

It's great to communicate your desires for transparency and two-way information flow, but why bother if you don't care enough to communicate once you have an open and engaging system in place?

Perception is reality, both for the sender and the receiver.

The biggest failure in this story was not just the constituency's failure to communicate their dissatisfaction to the representative, but also the indirect effects of that action. The constituency, while primarily the receiver, gave the sender incorrect feedback surrounding his efforts. Regardless of whether or not he was in fact doing a good job, they never informed their representative that he was letting them down. This left him to draw the only conclusion he could: that they were satisfied with the level of communication he facilitated.

This disconnect can only cause the perceived communication gap to grow, because failing to improve on something deemed "unacceptable" only gets worse with time. Unsurprisingly, members of his constituency who finally admitted that they had found his strategies incomplete were more disgruntled at the end of the semester.

Communication is a long-term commitment.

As the story of our exceptional representative illustrates, communication is not just a two-way street, but one that needs to be crossed regularly. Otherwise, it will become wider and wider until it can no longer be crossed.

It is my hope that the undergraduate body at MIT never reaches that point. This is why I challenge undergraduates to take an active role in the communication they desire with their student representatives for more than just an election season towards the end of winter: hold your leaders and representatives accountable by actively taking advantage the communication they offer throughout the entire year.