# Some Safari 6 stuff

Last night I upgraded Safari on my MacBook Air to version 6 and today I did the same on my iMac. Both are still running Lion. I had a couple of problems with the way the new Safari ran, but they were both solved quickly by friendly people on Twitter.

First, Apple has removed the Appearance preference pane from Safari 6. This is the pane that allowed you to set your default fonts and default font sizes.

In its place is… nothing. I’ve read, in a discussion on MacInTouch, about some defaults write commands that supposedly do the work of the old Appearances pane, but they didn’t work for me.

These preferences are a big deal to me. As you can tell from the settings, I like a big standard font to accommodate

1. my middle-aged presbyopia;
2. the decreasing pixel size of Mac screens; and
3. the infuriating habit of shit-for-brains web designers to stick font-size: .8em, or worse, in their CSS files because bigger text offends their delicate sensibilities.

So I needed a replacement for my old preferences if I was going to stick with Safari.1 I tried setting up a style sheet to do the magnification, but things like

css:
body {
font-size: 1.2em;
}


didn’t work consistently on all sites, probably because of what the shit-for-brains were doing in their style sheets.

So I asked for help on Twitter and got this response from Kristian Freeman:

@drdrang Got it. Custom CSS with gist.github.com/3203651
— Kristian Freeman (@imkmf) Sun Jul 29 2012 9:45 PM CDT

Follow the link to his gist and you’ll see a very simple solution using the zoom property. For emphasis, Kristian goes overboard with the magnification in his gist. The style sheet I went with, called drang.css, is

css:
html {
zoom: 1.125;
}


which effectively bumps up the font size from 16 points2 to 18 points, just as my old Appearance preference did. I used the Advanced preference pane to have this style applied to all web pages.

Without the style sheet, Safari looked like this when compared with Chrome (which still honors my 18-point preference):

With the style sheet, they look the same:

Update 7/31/12
OK, I’m not sure what I did wrong yesterday, but the defaults write settings shown on MacInTouch do work on Lion. After reading Lauri Ranta’s comment below, I decided to give them another try and now my fonts are the size I want without a style sheet. Here are the commands I used:

bash:
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize 18
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily Georgia
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily 'DejaVu Sans Mono'
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize 15


Note that if you want to use a font with a multi-word name you need to put the name in quotes.

Don’t get me wrong: I’m still pissed at Apple for forcing us to use the Terminal to get functionality that ought to be handled in the GUI. This is especially true for these settings, as they are most valuable to older users who are less likely to feel comfortable with the command line.

I’m thinking of writing a little program that would allow users to pick the fonts and sizes through a GUI and would then run the appropriate defaults write commands. Is there a way to get the list of installed fonts through a scripting language?

The next problem I had was with Safari’s new omnibar. When I’d type in a search query, it’d take me directly to Google’s top hit rather than to the page of search results—basically, it was working as if I were hitting the “I’m Feeling Lucky” button. This didn’t happen on my MacBook Air but did on my iMac.

Again, a call for help on Twitter got me an answer. Several answers, and all of them were correct. The first was from Jason Foreman:

@drdrang Do you have the Safari Keyword Search extension installed? That’s what was doing it for me.
— Jason Foreman (@threeve) Mon Jul 30 2012 2:49 PM CDT

I did, in fact, have the Safari Keyword Search extension installed on the iMac, and it was the source of my trouble. I must have installed the extension after hearing good things about it, but I never used it after the first day or so of testing. Because I always used the search field for doing searches in Safari 5, Safari Keyword Search’s hijacking of the default behavior of the address field never got in my way.

Safari Keyword Search can still be used with the omnibar—delete the Default expansion—but I just disabled it. I don’t use specialized searches often enough to remember the prefix abbreviations.

Despite these two success stories, there are still some problems. The default fixed-width font is Courier, which I hate. This is an inexplicable choice by Apple, given that they have the very pleasant Menlo installed on every Lion machine. To try to fix this, I’ve added

css:
code, tt {
font-family: Menlo;
font-size: 90%;
}


to my drang.css file. The 90% part is there because Menlo is fairly large for its point size. I have a nagging suspicion this won’t handle every case, so I’m presenting it here only as a tentative solution.

Another problem I’ve noticed is that my popup footnotes don’t work reliably anymore. Sometimes the footnote pops up far from the footnote marker, sometimes it doesn’t appear at all. I’ll have to dig into the JavaScript to see what’s wrong.

Update 8/1/12
Removing the style sheet and changing the default fonts and sizes via defaults write (see earlier update above) eliminated the problems I was having with popup footnotes.

I should also mention that the font size warning messages from various Google sites, discussed by jcburns and me in the comments, have gone away. Everything seems much more normal now.

1. I’m not going to get into how Apple, which prides itself on accessibility, has just made Safari distinctly less useful for older users. Nor will I mention that being able to set your default fonts and font sizes has been a part of every browser I’ve used for the past 15+ years—going all the way back to a time before I needed the increased font size. And I won’t point out that this isn’t just some aesthetic preference where Apple can claim superior taste; it’s an important usability issue. My purpose here—unlike Apple’s—is to help those who need bigger fonts to continue to use Safari.

2. The out-of-the-box default font size for all browsers (the default default) is 16 points.

## 11 Responses to “Some Safari 6 stuff”

1. I’d be interested to hear your experience over time of using the zoom property.

I wrote a Safari extension to use that and “remember” the zoom level for each site (because, as you say, some sites use tiny fonts and some use reasonable). There are a number of sites that do not work well with my extension though (for example, any article on macworld.com).

2. The hidden preferences mentioned in the MacInTouch thread worked for me on 10.8.

I’ve also increased the default zoom level in a custom style sheet. It has a lot of annoying side-effects though; for example Google Images and Google Maps always have horizontal scrollbars. Extensions like Ceri’s ZoomBySite aren’t much better though. Others like AllPagesZoom have a small delay before the zoom level is applied.

Here’s my current CSS file:

html {
zoom: 125%;
font: 16px Georgia;
}
img, video {
zoom: 80%;
}
* {  /* wrap long strings of text without spaces */
word-wrap: break-word;
}
pre, code, tt {
white-space: pre-wrap; /* soft wrap pre blocks */
font: 14px Menlo;
}
@media print {
html {
zoom: 100%;
}
}

• Images and videos aren’t zoomed; the zoom level is reset when printing.
• pre elements that don’t contain code elements are also styled.
• Pre blocks are soft-wrapped instead of showing scroll bars. It makes line numbers get misaligned on some sites though.
• The font sizes are specified explicitly because 16 point Menlo is bigger than 16 point Courier as mentioned in the post.
3. Do you do anything clever to keep your Chrome and Safari bookmarks in sync?

4. Can you just use the “never use font sizes smaller than” feature? I know that doesn’t fix the standard font issue but it does fix the size. Not sure if this is just a Mountain Lion thing though?

Font size check box: https://skitch.com/icrizzo/ej5nq/font

5. Ben says:

That option breaks this site. I imagine it won’t be of much use for general browsing purposes.

http://i.imgur.com/w6QNI.png

6. jcburns says:

The stylesheet hack works great for many purposes but (my often-used) maps.google.com pops “Your browser’s current font size is not supported. Please reset to the standard font size.” And if you ignore it, things are generally out of whack.

On the other hand, it’s fairly simple to manually zoom out on that page rather than zoom in every other page.

7. Ben,
I did actually check my own site, and it looks fine on both of my computers. I haven’t heard from anyone else that ANIAT has problems with that stylesheet. Maybe you have an extension that’s making other changes.

jcburns,
I get the same warning from Google spreadsheets, even though the sheets look fine to me.

Christopher,
In my experience, a large value for the minimum font size screws up lots of sites. I suppose it depends on the places you visit, but for me, using that setting causes more problems than it solves.

Lauri,
I’m glad you stopped by. I’m not sure what I did wrong yesterday, but after reading your comment, I tried the defaults write tricks again, and this time it worked. I’ll be updating the post shortly.

8. Ben says:

Hi Doc,

Sorry for the confusion. I was talking about the behavior of Apple’s “minimum font size” preference.

9. My mistake, Ben. I was reading the comments in reverse order in the WordPress Dashboard and didn’t catch on that you were responding to Christopher.

10. Mike says:

I’d love it if you wrote the GUI program, as I’m tech-illiterate enough not to even be sure where to put the defaults write code. And I can’t take Times Roman much longer.

11. Anton says:

“Is there a way to get the list of installed fonts through a scripting language?”

Yes, in AppleScript: tell application “Font Book” get name of every font family end tell

osascript can be used to return this to a UNIX script. osascript -e ‘tell application “Font Book” to get name of every font family’

I hope Apple restores this functionality in 6.0.1, though!