Ben Ward

Mac OSX Typography on Windows

.

One of the many fabulous things about Apple’s MacOSX is the incredible number of keyboard shortcuts for advanced typography. Left and right (so called �smart�) quotes are generated with Option+] and Option+Shift+], for example. Some word processors automatically insert them, but when you enter as much content into a web browser as I do, it’s a pain to remember a dozen different ALT+1234 style �shortcuts� to make Windows generate the same characters.

What I’ve hunted out this evening is an application called AutoHotKey. It uses scripts to perform an extensive range of macro actions in Windows. You can control specific applications with it, make the clipboard do fancy tricks and (most usefully here) you can generate text in response to key combinations.

I’ve been able to duplicate some of my favourite keyboard shortcuts from OSX using a fairly simple syntax. The method is actually quite crude (and has some big limitations that I’ll come to soon), but fundamentally: It works.

After installation, Ahk generates a single script file (AutoHotKey.ini). All I’ve done is add some single-line commands to produce the correct character in response to each key combination.

; MacOSX Typography Shortcuts (using alt key)
!]::Send {ASC 0145} ; smart sing-quotes
!}::Send {ASC 0146}

![::Send {ASC 0147} ; smart double-quotes
!{::Send {ASC 0148}

!#::Send {ASC 0171} ; French quotes
!~::Send {ASC 0187}

!;::Send {ASC 0133} ; Horizontal ellipsis

!6::Send {ASC 0167} ; Section
!8::Send {ASC 0149} ; Bullet

First up, I’ve assigned all of these to the Alt key, since that seems to make most sense (it being equivalent to Option on the Mac). The alternative would be to use the Windows key, which is the same physical location on a Windows keyboard as Option is on the Mac. Since I already have to shuffle around to use Control+C rather than Command+C, I figured I’d stick with Alt.

In the Ahk notation, ! refers to the alt key. ^ and # are �Control� and �Windows� respectively.

The {ASC 1045} part is what generates the character. It’s the equivalent of holding down the ALT key and typing in that number. Very crude, but so long as the application you’re using supports the alt+number input method, the hotkey will work too. You can get the number from Windows Character Map (the key combination is displayed on the right of the status bar).

The limitation with this method is that you can’t generate extended Unicode characters which don’t have an alt+number shortcut. Ahk also doesn’t support Unicode script files, so you can’t enter the characters directly.

I’ve sent the latter problem in the direction of the Ahk forums to see if there’s a better way of doing it and will update if there is.

I hope that some other Mac & PC users find this a useful starting point.

AutoHotKey is free software under the GPL, which is nice.

Comments

Previously, I hosted responses and commentary from readers directly on this site, but have decided not to any more. All previous comments and pingbacks are included here, but to post further responses, please refer me to a post on your own blog or other network. See instructions and recommendations of ways to do this.

  1. Excellent find Ben :) Looks like I finally have a solution to having an American keyboard, but using a British layout. The result of which is I lose my key, and remembering the ASCII code for it is a pain

  2. I’ve found a really good way to get OS X-style keyboard functionality, OS X-style security and OS X-style usability, all in one go.You can guess what it is, can’t you?

  3. Ben

    Soon you’ll have to get a job. Maybe you’ll get a job exclusively using Macs, but maybe you won’t.

    If the latter, perhaps we’ll see you back at this blog post in a few months time, eh?

You can file issues or provide corrections: View Source on Github. Contributor credits.