Fun with Mac OS X Preferences

| | Comments (0)
Mac OS still uses Internet Config to some extent, but it is different than in Mac OS 9 in a few ways. First, there's no UI to edit all of the fields; so if you want to edit something, and it's not provided in the Internet prefs box, you're sorta out of luck. Second, it doesn't use the same file format; it uses the XML plist format.

So my problem is that in Eudora, I like using ProFont ("Programmer's Font", similar to Monaco, but easier to read for code at small point sizes) for messages, but I check Eudora's prefs to use Internet Config (for SMTP host etc.), and there's no way to change the default screen font from Monaco to ProFont.

One solution might be to port Mac::InternetConfig, and use the API. But I tried something else.

I opened /Users/pudge/Library/Preferences/ tconfig.plist -- an XML file -- and poked around. Nothing in there for ScreenFont, the pref I want to set. I poke around a little more to figure out how to add it if I want to. A standard entry looks something like:


OK, so what's the data? It looks suspiciously familiar. The first line of the XML file, after the declaration, is:

<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList .dtd">

OK, so that file tells us:

<!ELEMENT data (#PCDATA)> <!-- Contents interpreted as Base-64 encoded -->

Nice. Sure enough:

% perl -MMIME::Base64 -le 'print ord decode_base64(shift)' ////////

OK, so now I just need to get the data for ScreenFont, in the right format, then encode it in Base64. MacPerl to the rescue!

#!perl -wl
use MIME::Base64;
use Mac::InternetConfig;
print encode_base64($RawInternetConfig{kICScreenFont()}) ;

%InternetConfig gives a sane human-readable value (in this case, ProFont). But %RawInternetConfig provides the raw packed data. I encode it and print it out:


So I reformat it a bit to have the same line lengths as the other entries in the file, and end up with:


I quit Eudora, save the plist file, and reopen Eudora, and there it is as my new screen font: ProFont, size 9.


Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on August 14, 2002 8:08 AM.

bash was the previous entry in this site.

FYI is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.