Android TextView with custom Typeface support

Currently Android does not have a native View class that supports defining a custom Typeface in your layout’s XML. After inflating your layout you can obtain a reference to the TextView and call the setTypeface(android.graphics.Typeface) method from your Java code, but this results in unnecessary duplication of logic and violates the DRY principle. Continue reading

Firefox 3.0.8 Prints Garbage Fixed-Width Text [Courier]

garbage pile

Apparently Firefox has developed sporadic issues with with the Courier font-family on Windows computers. If you print the following fixed-width text examples and are using Firefox 3, then chances are you’ll see garbage text for the Courier block.

Default <pre> Font

$ whoami
$ ls -al
$ echo "hai world!"

Courier

$ whoami
$ ls -al
$ echo "hai world!"

Courier New

$ whoami
$ ls -al
$ echo "hai world!"

Fixed-Width

$ whoami
$ ls -al
$ echo "hai world!"

Monospace

$ whoami
$ ls -al
$ echo "hai world!"

I was able to easily reproduce this problem on my Windows XP desktop using Firefox 3.0.8. Oddly enough, after printing several test pages and print previews, Courier magically started printing again.

This problem has been reported elsewhere though:

Firefox 3 garbles fixed-width font printout on Laserjet
…Then I came across this mozilla support forum article and changed the Default Character Encoding from the default Western (ISO-8859-1) to Western (Windows-1252) in FF3 Tools/Options/Content/Fonts & Colors/Advanced.
cynici

I haven’t tested this solution myself, but it may be worth a shot if you’re having this problem.

Until this bug is resolved, I’d recommend web developers avoid declaring the Courier font-family in their style sheets (try "Courier New" instead).

If anyone else has an insight into this problem please do let me know.

Thanks to Matteo.Mazzoni for the great photo of garbage!