# URDU on the MAC

## CONTENTS

The Mac OS X is capable of editing and word processing in Urdu. In a few simple steps, you can enable your Mac to handle Urdu documents.

Starting with MacOS10.7 (Lion), the Macintosh supports Urdu natively. If you are satisfied with the built-in Urdu keyboard, then all you need to do is go to Section Activating Urdu Input below, and in Step 4, click on the box named Urdu. But if you aim for perfection, then read on.

This page could as well have been entitled "Urdu and Persian on the Mac", because the information given here can also be used to compose Persian (Farsi) documents. The keyboard, fonts, and explanations below apply equally to Persian, but the explanations are illustrated with Urdu words. The keyboard and fonts also suffice for Punjabi (Shahmukhi or Pakistani style, written in the Arabic script), Arabic, and Ottoman Turkish. But the keyboard does not have all the symbols of Sindhi and Pushto alphabets.

## Installing the Urdu keyboard layout

[Note that we are talking about an Urdu keyboard layout, not an Urdu keyboard. You will be able to use this layout in order to type Urdu characters using the standard English keyboard that came with your Mac.]

BEFORE INSTALLATION: If the folder /Library/Keyboard Layouts contains files named UrduPhonetic.keylayout and UrduPhonetic.icns, then delete these two files. (These have now become obsolete.)

2. Double click on this zip archive to extract its files.
3. Two of these files are: keyboard layout file UrduQWERTY.keylayout and the icon file UrduQWERTY.icns. Move both these files to the folder /Library/Keyboard Layouts. If you have already installed a previous version of Urdu-QWERTY keyboard layout, then confirm that you want the old files overwritten.
4. The other extracted files are readme-mac.txt (with some instructions similar to the ones here) and UrduQWERTYkeyboardMac.pdf (a printable one-page keyboard map for reference).
5. Log out, then log in again. This will let the system install the Urdu keyboard.

## Activating Urdu Input

1. Pull down the Apple Menu in the menu bar (the apple icon on the top left of the screen) and select System Preferences.
2. Select Languages & Text (for MacOS 10.5 and above) or International (for MacOS 10.4).
3. Click on the Input Sources tab (for MacOS 10.5 and above) or Input Menu tab (for MacOS 10.4).
4. A long list will appear. Scroll the list down to find the item with the name Urdu - QWERTY. Click the box to its left so it shows a check sign in it.
5. At the bottom of the window, there is an item Show Input menu in menu bar. Click the box to its left so it shows a check sign in it.
6. Scroll up all the way. Towards the top of the list, you will see either (for MacOS 10.5 and above) a single item named Keyboard & Character Viewer, or (for MacOS 10.5) two items Character Palette and Keyboard Viewer. Click the boxes on their left so each shows a check sign.
7. Close Language & Text (for MacOS 10.5 and above) or International (for MacOS 10.4).
The pictures below correspond to MacOS 10.5 and 10.6. What you'll see in MacOS 10.4 is slightly different but the changes will be obvious.

If a US flag was not previously visible at the top right of the screen (on the menu bar), it should now be displayed. This is the Input menu (sometimes called the Keyboard menu). If you click on this flag, a menu will appear underneath it with various icons and names representing all the active keyboards. A keyboard named Urdu-QWERTY and an icon (Urdu-QWERTY Keyboard Icon) somewhat like the flag of Pakistan should now appear. If you click on it, then the keyboard icon on the top right of the screen will turn into the Pakistani flag, and any keys pressed on the Mac keyboard will produce Urdu characters. You can switch between keyboards by clicking on the flags (the keyboard icons).

## Installing Urdu Fonts

On a Mac, it is best to use Naskh fonts (which are typically used in Sindhi, Arabic and Persian publications), not the Nastaleeq fonts (which are used in most Urdu newspapers). Although Nastaleeq fonts are available for the Mac, they don't work as robustly as the Naskh fonts. But if you want to experiment with Nastaleeq fonts anyway, they are discussed in the section Nastaleeq Fonts further below.

Knut Vikor's excellent page The Arabic Macintosh has a detailed discussion of various Arabic Fonts with interesting information about them and links to obtain them.

The Mac OS comes with only one Naskh font, Geeza Pro, which can be used for Urdu, but the characters do not look particularly attractive. A free and very attractive set of fonts for Intel Macs is XB Zar distributed by the Iran Mac Users Group (IRMUG).

1. Visit IRMUG's X Series 2 page by clicking on this link .
4. Click on the the downloaded file to get a folder named Zar.
5. Move this folder to /Library/Fonts.

1. Visit the Arabic Script Unicode Fonts page on the SIL International Web site by clicking here.
2. Scroll down to the Freeware License section.
3. Download the fonts Scheherazade Regular (OpenType), Lateef Regular (OpenType), Scheherazade Regular (AAT), and Lateef Regular (AAT). TextEdit uses AAT fonts, but you might need the OT fonts for other applications.
4. The downloaded files have the suffix .zip. Click on each to unzip them, getting new files with the suffix .ttf.
5. Move the ttf files to /Library/Fonts.

## DIGRESSION: Urdu QWERTY for Windows

After having used the Urdu-QWERTY keyboard on your Mac for a while, you might be interested in using the same key settings also on your Windows computer. If so, you can download the Urdu QWERTY Keyboard Layout for Windows. (This file was updated on 2012-08-16.) Unzipping the downloaded file will produce a folder. Open this folder and follow the instructions in the file readme-win.txt. Basically, there are two steps: (1) Double-click on the file setup.exe (or just setup) to install the keyboard on your system. (2) Then activate the keyboard via the Control Panel.

The file UrduQWERTYkeyboardWin.pdf is a printable one-page map for reference showing the key assignments in Urdu QWERTY Keyboard Layout. It is also downlaodable from here. (This file was updated on 2012-06-15.)

Make sure to also install some of the fonts recommended in the sections Installing Urdu Fonts, More Naskh Fonts, and Nastaleeq Fonts. All these fonts can will properly display the symbols that this keyboard lets you type.

## The Urdu QWERTY Unicode Keyboard

The Urdu-QWERTY keyboard layout that you have downloaded has been designed to closely resemble the phonetic keyboard of InPage, a popular commercial desktop publishing application for Urdu that runs under Windows.

The advantage of a QWERTY (also called, phonetic) keyboard is that keys are assigned to letters based on letter sounds; e.g., the key "b" for the Urdu letter "bay", "p" for "pay", "k" for "kaaf", "g" for "gaaf", and so on. Such an assignment helps you remember most of the keys. As we do not have enough keys on the standard computer keyboards to assign to all Urdu characters, we need to use shifted keys for some (e.g., "shift-k" for "khay", "shift-g" for "ghain", etc.)

In addition to being phonetic, this is also a Unicode keyboard layout. Whatever you type is converted to its Unicode representation which is the modern universal character encoding used in computers for multi-lingual texts.

The Input menu (Keyboard menu) has an item Show Keyboard Viewer. If you select this item, then the system will display a picture of the keyboard on the screen. By default, the picture is very small. But you can make it larger or smaller like any window by pulling the handle at its right-bottom corner with your mouse. In this picture you can see what character each key corresponds to. The characters will change appropriately if you press the shift key or option key (or another modifier key) or select a different keyboard from the Input menu.

For reference, below are larger pictures of the Urdu-QWERTY Keyboard showing the characters corresponding to the keys in plain, shift, option, and option-shift modes. For a pdf file with printable keyboard pictures, click here. (This file was updated on 2011-11-29.) You can then print the keyboard pictures for reference.

### Urdu-QWERTY Keyboard with option and shift

Even though we have tried to make the keyboard layout as phonetic as possible, the mismatch between the Urdu alphabet and the available keys on a Western keyboard has forced us to make some unintuitive mapping between letters and keys. But with a little practice you should be able to type most letters from memory.

With one exeption, the above pictures contain all the information that there is to give about the Urdu-QWERTY key assignments. The exception is this: If the CAPS LOCK key is pressed, but the Shift and Option keys are not pressed, then the digit keys will generate Western digits. The CAPS LOCK key has no effect on other keys. So if you like to use Western digits in your numbers, then you can just leave this key depressed, and release it only to type a symbol which requires both Shift and Option keys to be pressed.

For quick reference here are some tables of useful key bindings.

### Some unobvious key bindings

Another useful key is Shift-" (i.e., the double quote key) that generates the dash-like Kasheeda character. This character is mostly used to strech horizontal components of letters. (This is described in more detail in the section The KasheedaFeature).

### Similar Letters in Urdu, Persian, and Arabic

The following tables lists the letters which are similar in Urdu, Persian, and Arabic, but are treated as different Unicode symbols. You should carefully choose the key bindings appropriate to the language of the text being typed.

Unicode Also called Languages Positional Forms Key
Name Shape Initial Medial Final Isolated
Keheh ک Kaf Urdu, Persian کـ ـکـ ـک ک k
Kaf ك Arabic كـ ـكـ ـك ك option k
Heh ه Persian, Arabic هـ ـهـ ـه ه option o
Teh Marbuta ة Persian, Arabic ـة ة option shift O
Heh Goal ہ ChoTi Heh Urdu ہـ ـہـ ـہ ه o
Teh Marbuta Goal ۃ Urdu ـۃ ة shift O
Heh Dochashmee ھ Urdu ـھـ ـھ h
Farsi Yeh ی Urdu, Persian یـ ـیـ ـی ی i
Yeh ي Arabic يـ ـيـ ـي ي option i
Alef Maksura ى Yeh KhaRa Zabar Arabic ـىٰ option u

Note, in particular, that the key "o" is bound to the Urdu letter "Goal Heh" (also called "ChoTi Hay"), and the key "Option-o" is bound to the Arabic/Persian letter "Heh". Both letters have the same shape when standing alone i.e., in the isolated position. But their shapes in initial, medial, and final positions are different. Worse, in the medial position, they can be confused with the Urdu letter "Dochashmi Hay" (key "h"). You have to make sure to use Goal Hay and Dochashmi Hay with Urdu fonts, and Arabic Hay with Arabic and Persian fonts; otherwise the letter might not be rendered properly.

In Urdu and Persian, the letter "yeh" has two dots underneath in initial and medial positions, but none in final and isolated positions. In Arabic, this letter has those dots in all positions. You should use the key "i" when typing in Urdu or Persian, and "Option-i" when typing in Arabic.

The letter "alef maksura" (key Option-u) is always dotless. In Urdu, it appears only in Arabic words, and is treated as the same as the "ChoTi yeh" i.e. "Farsi yeh" (key "i"). It is traditioanl to decorate this letter with a "khara zabar" (key Shift-I) above it.

## Preparing Urdu Documents

### Email Messages

An email message is usually a very simple document. If you compose your email on a Mac, and your recipient is also going to read your email on a Mac, then you can try writing your messages in Urdu. In fact, the messages are readable even on any non-Mac machine that has been configured with system options for right-to-left languages and on which appropriate fonts have ben installed. An occasional character in these messages might be undecipherable, and might be replaced with its unicode icon (or some gibberish, in the worst case).

Both Gmail and YahooMail systems work admirably when the Urdu-QWERTY input is turned on and message composition is in Rich Text format with right-to-left text direction. With Hotmail, mixing right-to-left and left-to-right text in the same line seems problematic, as that seems to interfere with the correct sequencing of words. In each case, the cursor behavior is a bit erratic; the cursor sometimes shows up at the right end of the line instead of being at left next to the last word typed. But you can ignore all that since your text is still set correcly. The cursor behavior will likely be fixed by Apple and email system producers anyway.

It helps to set the Web browser preference for Default Character Encoding to Unicode (UTF-8). If you use the Firefox Web browser, then in its preferences set the Default Font to XB Zar, Size 18, all Fonts for Arabic to XB Zar, Monospace Font Size to 16, and other sizes to 18. The Safari Web browser does not allow language by language font control, so just set Standard Font to XB Zar 18. If your machine is not an Intel Mac, or for any other reason you cannot use the XB Zar font, then in its place use Scheherazade-AAT, Size 24.

Google has developed an input method based on transliteration of text typed using letters of the Latin (i.e., Roman or English) alphabet. This method, called Google Transliteration Input Method Editor (IME), is available for Urdu. It lets you enter Urdu words using Latin characters phonetically. Google Transliteration IME will convert the text, based on its sound, to Urdu characters. The conversion is quite liberal so the correct Urdu word will result from most of its reasonable phonetic Roman spellings. By the same token, the same Roman text can lead to several different Urdu words. In the latter case, you will be able to choose one of the words from a menu. For example, the Roman text "sada" can correspond to the Urdu words سادہ (meaning simple), سدا (always), صدا (sound), and possibly others. So if you type "sada" in Google Transliteration IME for Urdu, the system will display these Urdu words in a menu, from which you can select your intended word.

IME saves you the trouble of installing keyboard layouts for the languages you like to type in. But experimenting with IME is likely to convince you that it is more efficient to type Urdu text directly using the Urdu-QWERTY keyboard layout, rather than via IME. The mismatch between Roman and Urdu alphabets is so substantial that there are too many phonetic Roman spellings for the same Urdu word, and too many Urdu words result from the same Roman text. So while using IME, you are likely to be wasting much time trying and selecting alternatives.

IME is available as an option in Gmail. It is also available for MacOS as a service so you can use it with applications such as word processors.

Gmail also allows specifying Urdu as the application language. In that case all the menus, titles, warnings, etc., will be translated to Urdu. But you do not need this drastic setting in order just to read and write Urdu email messages. While keeping English as the system working language, you can type Urdu text by selecting the Urdu-QWERTY input. Of course, you can also intersperse texts in Urdu and English by simply switching back and forth between Urdu-QWERTY and English keyboards.

### Traditional Documents, Editors for Urdu

For the Mac, there are three free office suites LibreOffice, OpenOffice, and NeoOffice, each of which includes a powerful word processor that can be used to edit Urdu documents. OpenOffice is a multi-platform open-source software application with functionality very similar to that of the commercial product Microsoft Office. LibreOffice is another multi-platform application that has been developed starting from the OpenOffice code base. NeoOffice is a Mac-specific implementation of OpenOffice. If you want to install one or more of them, you can find detailed descriptions and installation instructions on their official Web sites LibreOffice, OpenOffice and NeoOffice. We will not describe their use.

A highly recommended editor is Bean for which the general information and download instructions can be found on its official Web site. This is a free, easy to use, small, and very efficient word processor. It is quite adequate for simple documents. Beware that at present it lacks some advanced word processing features such as footnotes. It is also a bit stubborn in its behavior; for example, the document line size cannot be changed simply by resizing the editor window.

The Mac's built-in application TextEdit is good enough for simple documents. TextEdit is considered a text editor rather than a word processor. Yet it can be used for composing documents with multilingual text, embedded graphics, tables, and other advanced features typically found only in large, expensive software applications. Its advantage is that it doesn't need to be installed: It is always there, and is the Mac's default editor for text files.

In Plain Text mode, TextEdit allows only a single font and a single paragraph justification style for the entire document. In Rich Text mode, you can mix various font families, font sizes, font styles (e.g., bold, outlined, shadowed), and justifications (e.g., centered text, or text justified at left or right or both sides). You need to use Rich Text since Plain Text does not work well with Urdu.

To start a new Urdu document, select the menu item File > New, then Format > Text > Writing Direction > Right to Left. Set the Input menu (Top Right) to Urdu-QWERTY. Choose fonts, font styles, size, colors, etc., as is usual with most word processors. Since the default formatting is Plain Text, switch to the Rich Text Format by doing Format > Make Rich Text. Now you can apply a different justification to each paragraph, and a different formatting style to each selection.

It is helpful to also do Format > Font > Show Fonts. This puts on the screen a font palette which is convenient for choosing font family (e.g, XB Zar, Scheherazade-AAT, or Lateef-AAT), size, color, etc. The XB Zar font family also includes typeface variants such as italic, bold, and bold italic. (But see the note in the section More Naskh Fonts about the use of italics.) The system seems to unpredictably switch the font sometimes to Geeza Pro (the "system default font" for the Arabic script). So you need to watch the font palette and, if necessary, change the font back to what you want it to be.

You can configure TextEdit to use your favorite font as the default. To do this, start TextEdit, and on the Menu bar click on TextEdit, then on Preferences, and then on the New Document tab. If the Rich Text radio button is not active, click on it. Click on the Change... button next to Rich text font: . The font dialog will open. Now, select, for example, XB Zar in the family column, and 18 in the size column, then close the dialog. Finally, close Preferences, and quit TextEdit. When you restart TextEdit, it will use the Rich Text format and the XB Zar size 18 font as the default for new documents.

Here is an image of a portion of the Mac screen during the editing of an Urdu document using TextEdit.

### TextEdit In Action

X Series 2 is a set of free, high quality, attractive Naskh fonts that support Urdu and Persian. These come with matched groups of regular, italic, bold, and bold italic characters; some even have outline and shadow variants. The X Series 2 fonts are downloadable from the Iran Mac User Group Wiki site. Particularly nice font families on that site are XB Niloofar, XB Yas, XB Kayhan, and XB Zar for general use, and XB Titre for headings.

NOTE: In the regular typeface of Naskh fonts, the "vertical" strokes of Alif, Laam, etc., are actually drawn with a slight tilt to the left. The italic Naskh typefaces of X Series 2 fonts are designed by slanting the same strokes a bit to the right. Some font families in this series also have oblique typefaces in which the strokes are slanted even more to the left than in the regular typeface. But since few Urdu letters contain prominent vertical elements, the italicized (or oblique) text in Urdu does not stand out well. (This is in contrast to the Latin alphabet where nearly every letter has vertical strokes.) The boldface text in Urdu is, of course, quite noticeable.

Dozens of free Naskh fonts can be downloaded from the Internet. But you need to experiment with them to pick the ones that are of good quality and work with the whole Urdu alphabet. Some of them have been adapted from Arabic or Persian, without extending them properly for the additional letters of Urdu. You should check, in particular, whether these fonts properly display all the needed forms of the letters "Noon Ghunna" ں, "Goal Hay" (also called "ChoTi Hay") ە, "DoChashmi Hay" ھ, and "Bari Yay" ے .

### Nastaleeq Fonts

In Mac OS 10.5 and above, it is possible, with some care, to use Nastaleeq fonts with TextEdit and Bean. Some freely available Nastaleeq fonts are:

• Jameel Noori Nastaleeq and Jameel Noori Nastaleeq Kasheeda, downloadable from here. Double clicking on the downloaded zip file will extract four files. Install the file "Jameel Noori Nastaleeq.ttf", and discard the other three files.
• Faiz Lahori Nastaleeq
• Pak Nastaleeq
• Fajer Noori Nastalique

A variety of Nastaleeq as well as Naskh fonts are available for download from Urdu Web, Urdu Jahan, and Deedahwar. Please be warned though that the InPage company alleges that some freely available Nastaleeq fonts are pirated from their work.

Note: To install a font file, copy it to /Library/Fonts. On Mac OS 10.6, you can also install a font file by double clicking on it, then clicking on the Install Font button in the dialog box presented to you. Any font installed in this way is copied to ~/Library/Fonts where it is available to the active user but not to other users.

CAUTION: Nastaleeq does not work at all in LibreOffice, OpenOffice, and NeoOffice.

OBSERVATION: Nastaleeq works satisfactorily with the message composer in Google's Gmail. You need to have the rich text style activated and the Right-to-Left text direction turned on. Since Gmail composer's font menu is fixed and there is no Nastaleeq font in it, how do you make the composer use Nastaleeq? The only way that seems to work is to start a message with some Nastaleeq text copied from another Gmail message. Then while you edit this text, Gmail preserves the current text font! But keep in mind that any text copied from elsewhere, e.g., a TextEdit window, won't be rendered in Nastaleeq, so there is no sense starting a message with such text for the purpose of composing a message in Nastaleeq.

OBSERVATION: Nastaleeq works satisfatorily with TeX, discussed below in the section Typesetting Using TeX, LaTeX, XeTeX. For best results, use Open Type (OT) fonts with TeX.

Here are some conculsions from experiments with the above fonts using TextEdit and Bean under MacOS 10.6:

Summary: Nafees is the only Urdu font that works sastisfactorily with editors like TexTEdit and Bean. IranNastaliq is undoubtedly the most elegant and stylish, but it cannot handle the letters particular to Urdu. While Jameel and Faiz have very nice quality, they fail to render many typed words, and can be quite annoying at times. Pak is not acceptable at all in its current state because of its letter shapes. Fajer is too unstable to be used with confidence, which is a pity because its shapes are nice and the failures are limited to just a few ligatures.

Details:

1. Nafees, Iran, and Pak are the only fonts which allowed without fuss the typing of the passage shown in the image below. The other fonts broke down, sometimes crashing TextEdit! Sometimes they caused the display to become garbled when a word was partially typed. When the word was typed anyway, the display became normal again. With Jameel Noori and Faiz Lahori it was possible to finish the text with those episodes of temporary failures. With Fajer Noori, it wasn't possible to continue beyond the first line. This font failed with "baRi yay" ے following most letters.
2. The only problem with Nafees under TextEdit is that words sometimes get clipped at top or bottom. Perhaps the culprit is poor management of vertical space by TextEdit. The solution is to provide more generous spacing. For this, click on the Spacing pull-down menu on the formatting bar in the TextEdit window, select the Other... menu item, and adjust the Line height multiple and Inter-line spacing values for a satisfactory display.
3. IranNastaliq, intended obviously for Persian, doesn't support the Urdu retroflex letters Tay, Daal, and Ray, and the letter variants Noon Ghunna, Dochashmi Hay, and BaRi Yay. Actually some of these letters do get displayed, but they are not properly connected. For proper rendering of Goal Hay (also called ChoTi Hay), this letter should be typed as Option-o, not o.
4. Copying the passage and trying to change its font worked with varying degree, except, again, for Fajer Noori.
5. IranNastaliq, representing the traditional Persian Nastaleeq style, is stunningly beautiful. For Urdu, Nafees, Faiz Lahori, and Jameel Noori are comparable in the calligraphic quality of shapes, with the latter two being more pleasing. The latter two look more natural and have the flair of handwritten calligraphy. But this might be a result of kerning variations and word processor functions.
6. The failure of Jameel Noori and Faiz Lahori to render some words seems unique to the Mac, since the same words that fail on the Mac get typeset correctly under the Windows operating system.
7. In Pak, the shapes of kaaf, gaaf, inital meem, medial hamza, and baRi yay are unacceptable. Several other ligatures are also quite poorly done. This font is just not usable in its present state.

By comparison with Nastaleeq fonts, Naskh fonts work much better on the Mac, and editing with them is generally trouble-free.

Here is an image of the TextEdit window during the eding of a document mainly with the Nafees Nastaleeq font (size 48 for the title, size 36 for the author's name, size 22 for the text body).

### Nastaleeq Fonts Used In TextEdit

To contrast the Urdu and Persian Nastaleeq styles, here is the image of a document set in the IranNastaliq font. Notice that compared to the Urdu sample, the strokes in the Persian sample are more consistent and uniform, and the latter sample more closely resembles manually calligraphed old manuscripts. Specially pleasing to the eye are the long slanted strokes (called "markaz") of kaaf and gaaf, and the stretched horizontal parts of letters like bay, tay, kaaf, etc.

NOTE: For the Persian letter Hay (ه), type the key Option-o. The Urdu letter Goal Hay (ہ), typed with the key o, will not get properly connected within a word when a Persian font is being used.

### The Kasheeda Feature

(This section was added on 2012-07-30.)

Worth special mention is the "kasheeda" feature of Iran Nastaliq to extend the horizontal strokes of letters. Essentially, by typing the Kasheeda character (key shift-") one or more times either before or after a letter, that letter can be extended arbitrarily. The judicious application of kasheeda makes the appearance of a document more pleasing by introducing variety in the shape of letters. It is also useful for highlighting titles and headings and for visually balancing the lines in poetry. There are long established calligraphic conventions as to where kasheeda extension is permissible in nastaleeq and where it is not. (See this Persian document.)

The kasheeda feature is not specific to Nastaleeq; it can be applied to Naskh fonts as well. In Naskh fonts, all horizontal strokes and letter joints are positioned at the same level in a line of text. The kasheeda character is a horizontal dash, so it can be added essentially to any letter that has a horizontal component. In Nastaleeq fonts, even the strokes that seem horizontal are not truly horizontal but have subtle slopes and slants. Also, they keep varying in thickness, and have to curve anyway at letter joints. So the kasheeda feature is quite difficult to incorporate in Nastaleeq fonts. Undoubtedly, the handling of kasheeda in Iran Nastaliq is masterly!

The kasheeda approach of Iran Nastaliq is superior to the one taken by the special "Kasheeda fonts" of Urdu (e.g., Jameel Noori Nastaleeq Kasheeda). Iran Natstaliq allows the user to apply kasheeda extension selectively to any chosen occurrences of any chosen letters. By contrast, the Urdu Kasheeda fonts have built-in kasheeda extensions in certain letters and ligatures. These fonts also violate the Kasheeda conventions sometimes.

The sample below shows the use of Kasheeda in two different nastaleeq fonts. Unfortunately, the Kasheeda feature of Iran Nastaliq does not yet work fully under MacOS, so the sample has been prepared on a Windows machine.

### InPage Files and Their Conversion to Unicode Text

(This section was completely rewritten on 2012-06-20.)

InPage is a commercial desktop publishing application for Windows. It is widely used by publishing houses for producing Urdu publications because of its rich feature set, multi-lingual and multi-script capabilities, and robustness. Until recently, it was one of very few applications that could produce high-quality Nastaleeq documents.

Unfortunately, InPage works only on Windows and, moreover, uses proprietary document structure and fonts. Naturally, there is much interest in converting InPage files into alternate, more portable versions that could be processed on multiple computing platforms with multiple applications. So several online tools and programs have become available to convert Inpage files to Unicode text files. In fact, InPage itself has a unicode coversion facility of sorts through its copy and paste Edit menu items.

The coversion programs that I tried turned out to have errors or limitations. Some of them require you to have a running Inpage to display the file to be converted. This severely reduces their utility, since what you want is a program to simply take an InPage file as input and create an equivalent Unicode text file as output. So I had to write such a program myself. This program is available as a standard application for Windows XP/7 and a command line application for MacOS and Linux.

As I do not have access to any documentation of the inner structure of InPage documents, this program is based on guess work. Although I have run it successfully on several large documents, I do not guarantee that it will convert all InPage files correctly. Also, to use it, you need some rudimentary skills to deal with commands and with Terminal windows (in MacOS) or Unix commands (in Linux). Please let me know if you encounter any bugs. Here are the instructions for the simplest way to use it:

1. Download the file InpToUniTxt.zip from here. This file was last updated on 2012-07-26.
2. Unzip the downloaded zip file to extract the following command line applications:
• InpToUni-mac (universal binary for PowerPC and Intel macs, MacOS 10.4 and above)
• InpToUni-win.exe (Windows XP/7)
• InpToUni-lnx32 (32-bit Linux)
• InpToUni-lnx64 (64-bit Linux)
3. Keep the application that is appropriate for your operating system, and delete the others. (The files are very small, in the 10 to 50 Kbytes range, so you can also just leave them in the folder.)
4. In case of MacOS or Linux, make the application file executable.
5. Copy the application file to the directory where you keep Inpage files.
To convert an existing InPage file with the name, say, story.inp into a new Unicode text file to be created with the name story.txt, do this:

MacOS

1. Open a Terminal window by double clicking on Terminal in the /Utilties directory.
2. Use the "cd" command to get into the directory of your InPage files.
3. Type the command

./InpToUniTxt  story.inp  story.txt

and press Enter.
CAUTION: If your files or the saved application are in different directories, then make sure to use the right path for each file.

Linux (32- or 64-bit)

1. Use the "cd" command to get into the directory of your InPage files.
2. Apply one of the following commands approporiate to your operating system:

•     ./InpToUni-lnx32  story.inp  story.txt
•     ./InpToUni-lnx64  story.inp  story.txt

and press Enter.
CAUTION: If your files or the saved application are in different directories, then make sure to use the right path for each file.

Windows XP/7

1. Double-click on the InpToTxt-win (or InpToUniTxt-win) application to launch it.
2. You will be asked to choose the existing InPage file.
3. Go through the folders as usual to locate tnd select the file (say, story.inp). Then press OK.
4. You'll be asked to choose the new file where the converted Unicode Text will be written (say, story.txt). Type its name or select an existing txt file, then press OK.
5. The converted Unicode text file will be created, and the application will quit.

Processing Converted Unicode Text Files

To read/edit a converted file under MacOS:

1. Open it in TextEdit.
2. Switch TextExit's mode to RichText and the Text Direction to RightToLeft.
3. Do Edit > Select All to select the whole file in the TextEdit window.
4. Change to a font such as XB Zar, Scheherazade, Lateef, or Geeza Pro.
Note: Without the font change, some Urdu characters may not be rendered properly.
Follow a similar procedure for other word processors and for Windows and Linux. (Changing the Text Direction to right-to-left and using a proper font is crucial.)

IMPORTANT: Please be aware that the InPage document's formatting properties (justifications, fonts sizes and styles, colors, etc.) are lost during the conversion. The conversion mainly consists of text extraction.

### Typesetting Using TeX, LaTeX, XeTeX

#### Skip this section if you are not interested in programmatic typesetting.

The term TeX is used here in a generic sense for TeX or any of its derivatives, such as LaTeX, AMSTeX, ArabTeX, XeTeX, ArabXeTeX, etc. But when the discussion is about a particular derivative, that system is mentioned by name, e.g., XeTeX.

When you use a word processing system, you take formatting actions yourself, and the system keeps displaying the document as it changes in response to your actions. When you use TeX, you put the document contents (text, images, etc.) and the formatting instructions together in one or more tex files, and the system processes them to produce the desired document. The tex files you prepare constitute a TeX program. The TeX system executes this program to produce the desired document, typically in the form of a PDF file.

TeX has a steep learning curve, but once mastered it allows you to produce very complex, high-quality documents, and provides you very fine control over the look and feel of the document. TeX is widely used for producing scholarly works, and many scientific journals and conferences require that articles be submitted to them in the form of tex files.

Various distributions of TeX are available for the Mac. We highly recommend the TeX Live distribution together with the TeXShop graphics environment for using TeX. For this, download and install the full MacTeX package. The download, installation, and usage instructions are on the TeXShop Web site. The MacTeX package includes most of the components needed for processing Urdu documents. In particular, it includes the system called XeTeX which currently offers the best facilities for Urdu.

XeTeX has overcome two limitations that were not satisfactorily addressed by the previously existing derivatives of TeX, and that, in particular, greatly hampered the production of Urdu documents with TeX:

1. For its input, TeX originally used only the ASCII character set, so other characters had to be encoded as ASCII character combinations. XeTeX incorporates Unicode, thus giving access to nearly all of the world's written languages. For example, Urdu characters can now be typed directly within tex files.
2. For its output, TeX originally used only a small number of fonts. More fonts could be added but they had to be specified using METAFONT, a companion program that came with TeX. XeTeX allows one to use most of the fonts installed on one's computer. For example, the program ArabTex could previously be used for Urdu, but the output was restricted to a single, Naskh-style font. Now there are dozens of fonts in different styles that can be used in Urdu documents with XeTeX.
So for the TeX approach to typesetting Urdu documents, you have to know LaTeX and XeTeX. We will not provide any details about TeX, LaTeX, and XeTeX beyond some cursory information. You have to learn these on your own! It would make sense for you to start reading about XeTeX only after you have become sufficiently familiar with LaTeX to be able to create some documents with it! There are hundreds of books, articles, and tutorials about LaTeX. An excellent tutorial is The Not So Short Introduction to LATEX2ε. A very comprehensive on-line reference is The LaTeX wikibook. TeXShop itself has a number of online books and tutorials under its Help menu. For XeTeX, the essential reference is The XeTeX typesetting system from SIL International where the system was designed. Also a useful reference is the 100+ page online document with much historical background, examples, and practical hints, The XeTeX Companion.

TeXShop makes it very easy to edit and execute TeX programs. When you launch TeXShop, it brings up a window in which you can edit your TeX program, i.e., your tex source file. But you should first set TeXShop's Preferences. The most important preferences are in the Source and Typesetting tabs.

1. Click on the Source tab to open it. In the Editor block, check the box with Arabic in it. Under Encoding, select the item Unicode (UTF-8). In the Document Font block, select the item XB Zar - 18 (this should make the TeX source more readable).
2. Click on the Typesetting tab to open it. In the Default Command block, check the Command Listed Below radio button, and in the text field below it type "XeLaTeX". (You can change the Typesetting command to LaTeX or other choices on the editing window itself.)
In the Default Script block, make sure that the Pdftex radio button is turned on.
After the Preferences are taken care of, you are ready to edit your source file. The TeXShop editor is powerful, and yet very simple and intuitive. For typing the Urdu content, you have to use the Urdu-QWERTY keyboard layout, of course. But make sure to switch to the US English keyboard while typing TeX commands and the symbols that go with them, such as \, &, {, }, [, ], !, %, etc. When numbers and delimiter characters are mixed with Urdu alphabetic text, the sequence of symbols sometimes appears wrong. You just have to tolerate such disorder at present. To avoid confusion, it might be helpful to put Urdu and non-Urdu symbols on different lines.

Since preparing TeX files for Urdu documents requires frequent switches between the Urdu keyboard (for text) and the English keyboard (for special characters and TeX commands), you might consider setting up Keyboard shortcuts for that purpose. Refer to the section Keyboard Shortcuts for Changing Keyboards further below.

Note that TeXShop's default in the source window is to display the TeX commands in blue, comments in red, and other text in black. Also, you will notice that TeXShop uses the first character of each new line of text in the source window to determine whether to start displaying the line from the left or from the right end of the window. If the first character of the line belongs to a left-to-right script (e.g., English), then the line is started at left. But if the first character of the line belongs to a right-to-left script (e.g., Urdu or Persian or Arabic), then the line is started at right. Characters like space and certain punctuation symbols are considered belonging to left-to-right scripts, and cause the line to be started at left.

Once the editing of your tex file is complete, you should click on the Typeset button. TeXShop will process your tex file, and will display the resulting PDF file if the program ran successfully. It will also bring up a Console window with progress and error messages.

We now give an example of typesetting an Urdu ghazal using XeTeX. The first image below shows the TeX program, poemRA.tex. XeTeX (actually the program xelatex) executes this file to produce the PDF file poemRA.pdf, shown in the next image.

The TeX program uses the fontspec package to gain access to the fonts installed on the computer. The program uses Vafa Khalighi's bidi package for the text's bidirectionality (i.e., to handle left-to-right and right-to-left scripts). The bulk of the poetry formatting is done by the bidipoem package The essential TeX instructions for typesetting consist of the first seven lines and the part between \begin{document} and \end{document}. Note how simple the TeX code is in this case; it really amounts to just putting the lines of the poem within the traditionalpoem environment.

IMPORTANT: To make sure that bidipoem justifies the lines of the poem correctly, you need to typeset the document twice (that is, press the Typeset button again after running the program successfully once).

To illustrate how TeX makes it easy to add extra flair to the output, the TeX program also puts a decorative border along the page margins. This is done by the block of code in the middle section. The work is done mainly by the fancyhdr package. You need to install on your computer the free font WebOMints GD which can be downloaded from the Internet. The symbols in this font can be used for decorating documents in various ways. Here some of its symbols are being used to assemble the border shown on the output PDF file. Note that in the new font family declaration, we give a name (\w) to the WebOMints GD font, and use the Color option so that all symbols of this font will be in the designated color. The 6 hexadecimal digits represent the code for a shade of turquoise.

If you try to typeset a poem with longer lines, then you might get each of its couplets displayed on two lines, in a different poem style. Also, you might need to play with the parameters (62,-18) in the line beginning with \begin{picture} to display the border correctly.

### PDF File Produced by XeTeX, as displayed by TeXShop

More complex Urdu documents are best produced in TeX by making use of François Charette's package polyglossia. This package is intended to support texts in multiple languages, including Urdu. It runs on top of the XeLaTex derivative of TeX.

The example below shows an Urdu document typeset with the aid of polyglossia. It illustrates a number of features typically needed in an article or scholarly paper, such as: typesetting of titles and section headings; formatting of lists and tables; footnotes; and automatic numbering of sections, list items, and tables. The document also shows how to insert English text in an Urdu document.

The document style employed for the sample Urdu document is article; this can have sections and references but not such components as tables of contents. For a book length document, you should use the book or memoir document styles. These styles greatly facilitate and automate much of the work needed in the production of: title pages; table of contents; chapters with sections, subsections, subsubsections, etc.; automatic numbering of lists, figures, tables, etc.; bibliographic references; and indices.

The next two images below give the beginning and ending parts of the TeX source file to produce the sample Urdu document. The third image below shows the PDF pages of the Urdu document.

### Urdu Document in PDF, Produced Using Polyglossia

Links to obtain the above Urdu document in PDF form as well as the TeX source to generate the document:

For better legibility, the PDF file of the Urdu document can be downloaded from here. The full TeX source code to produce the Urdu document is here.

### Web Pages

#### Skip this section if you are not interested in creating Web pages with Urdu content.

Modern web browsers are quite good at interpreting and displaying multi-lingual texts from their Unicode character encodings. Of course, the browser needs to be told that it should expect Unicode material in the web document (usually, an html file) that it is being asked to execute. The Unicode character encoding for Urdu and Persian letters, along with the letters of many other languages, is called UTF-8. So to display Urdu text, you have to specify in your web document that its character set is given by UTF-8, as explained next.

The particular character set that a web document contains is specified by the meta statement. Near the beginning of your html file you will find some code that looks like this:

<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">

(This is just an example. Your character set might have a name different from "ISO-8859-1".)
You have to change the character set declaration to "UTF-8", by replacing the above meta statement by:

<meta content="text/html; charset=UTF-8" http-equiv="content-type">

Any Unicode inserted after this meta statement will be displayed as the character that the code represents. The Unicode for Urdu and Persian can be found in the Unicode Arabic page. A table which gives the standard Unicode as well as its html representation, called html numeric character reference, is given here. A very useful online tool is UTF Converter that lets you quickly convert a string of one or more characters to Unicode in various formats. UTF Converter's author, Mark Davis, has a Web site Macchiato with several other very useful Unicode-related utilities.

From the table on page 2 of Unicode Arabic page, you can check that the hexadecimal Unicode representations of the Urdu letters Alif, Re, Daal, and Vaao are, respectively, 0627, 0631, 062F, and 0648. Now the html syntax for a hexadecimal code HHHH is &#xHHHH; . So suppose in your html document you insert the following:

<center>
<big><big><big>
&#x0627;&#x0631;&#x062F;&#x0648;
</big></big></big>
</center>

The result will be the word "Urdu" (in Urdu) displayed in 3-size larger letters and centered in a line, as follows:

اردو

Typing numerical codes in this way is clearly impractical except for displaying just a few characters. Fortunately, you don't have to enter character codes manually if you use the Urdu-QWERTY keyboard layout. The characters typed on this keyboard are automatically converted to their Unicode version and placed in the input. All you have to do is to switch to Urdu-QWERTY on the Input menu at the point in your html file where you desire to insert Urdu text.

A caveat is in order here. To prepare html files, you are likely to use some special editor different from TextEdit. We have seen that, in RichText mode, TextEdit processes Urdu letters correctly, displaying the right form of the letter and connecting the letters appropritaely. Other editors, specially the so-called programmer's editors often used to prepare html files, may not do all that. For example, your typed Urdu letters might be displayed in their isolated form from left to right in the order of their entry, without being connected together. Or worse, your typed input might appear garbled in even more annoying ways! If you are looking for an excellent, free html editor that handles Unicode and UTF-8 well, and displays Urdu text correctly, try Arachnophilia.

Of course, the readers of your Web page will be able to see the Urdu text correctly only if their system has been configured for multi-lingual processing and has the Urdu fonts installed. In addition, it might be necessary for your readers to set the viewing option of their web browser for "Unicode (UTF-8)" character encoding.

### Mathematical and Technical Typing

Some mathematical symbols are so frequently needed in technical typing that they have become standard in Mac's English keyboards. So the Urdu-QWERTY keyboard also provides several of these symbols, via option and option-shift keys as usual. Note that the symbols for summation, integration, root, etc., change their orientation to match the right-to-left text direction.

In Urdu mathematical notation, the dots of the dotted letters are sometimes omitted. So the Urdu-QWERTY keyboard provides the dotless forms
ٮ for ب
ڡ for ف
ٯ for ق
Another practice in Urdu mathematical writings is to sometimes use just the stems of letters, not their full form. Such symbols can be easily generated by adding the "kasheeda" character (ـ) to a letter. For example, the symbol خـ , generated by the key sequence shift-K and shift-" , represents the "imaginary" (in Urdu, خیالی) number i.

NOTE: The keyboard suffices only for the casual typing of a few mathematical symbols in a general document. To prepare documents with elaborate mathematical content, the ideal approach is to use TeX/LaTeX/XeTeX. See the section Typesetting Using TeX, LaTeX, XeTeX.

## Keyboard Shortcuts for Changing Keyboards

NOTE: For "Changing Keyboards", the standard MacOS terminology is "Changing Input Source" or "Changing Input Method".

While editing certain documents, you need to change Keyboards quite often. For example, you may be working on a dictionary. Or, you might be preparing TeX files for Urdu documents, and need to continually switch keyboards between Urdu (for text) and English (for special characters and TeX commands).

The standard way for changing Keyboards is to select the desired keyboard in the Input menu at the right end of the Apple menu bar at the top. This is cumbersome and annoying when Keyboard changes are very frequent. So you might like to set up a Keyboard Shortcut for it.

MacOS has shortcuts programmed for Keyboard change already. These are: Command-space for toggling between keyboards and Command-shift-space for cycling through the active keyboards. But in MacOS versions 10.5 and above these are disabled by default, because exactly the same shortcuts are enabled for Spotlight searches.

If you prefer, you can disable the Spotlight shortcuts and enable the Keyboard shortcuts. To do this in MacOS 10.5 and above, go into the Finder, and select Apple > System Preferences > Keyboard. In the window that opens, click on the Keyboard Shortcuts tab. Select Spotlight in the left column, and disable the shortcut items that show up in the right column. Then select Keyboard & Text Input in the left column, and enable the input source-related items that appear in the right column.

Of the two Keyboard shortcuts Command-space and Command-shift-space, the former is certainly easier to type. If you have only two keyboards activated (say, English and Urdu), then the two shortcuts are equivalent. (You can quickly see which keyboards are active by clicking on the Input menu. An icon appears underneath it for each active keyboard.) However, if there are more than two active keyboards, then you might like to interchange the shortcuts. You can change a shortcut by double-clicking on it, and typing over it any desired combination of modifier keys (Command, Control, Shift, etc.) and a regular key (space, letter, number, etc.)

## Installation Problems

Most of the reported installation difficulties turned out to have a simple reason: during download or extraction, the file extensions got changed. Often a .txt extension was appended to one or more file names.

So first please make sure that your Mac shows extensions in file names. For this, move into Finder (for example, by clicking in a Finder window, or on the Finder icon in the Dock, or at a point on the screen which is not occupied by an application window). Then on the Menu bar (the one with the Apple icon at the left), click on Finder, then on Preferences, then on the Advanced tab. Now look at the Show all file extensions item. If the check box on its left does not have a check mark, then click on it so that a check mark appears there. Finally, close the Advanced window.

Now you can check whether the extensions of the Urdu-QWERTY files are correct. The downloaded file (UrduQWERTY-v4.zip) and the files that your unzipper extracts (UrduQWERTY.keylayout and UrduQWERTY.icns) should have exactly those names. Change their extensions if necessary, ignoring the Finder's complaint that this could render your files dysfunctional.

Another problem some people have encountered is that during editing Urdu letters show up isolated rather than connected together in the normal way. This can happen when the editor being used is different from TextEdit or Bean. For example, at present Microsoft Word does not handle the Naskh and Nastaleeq scripts correctly on the Mac. Even in TextEdit, sometimes Urdu letters appear isolated rather than correctly connected. This is usually due to TextEdit being run in the plain text mode rather than the rich text mode which Urdu editing requires.

To fix this problem, start TextEdit, and on the Menu bar click on TextEdit, then on Preferences, and then on the New Document tab. If the Rich Text radio button is not active, click on it. Now close Preferences, and quit TextEdit. When you restart TextEdit, it will use Rich Text as the default for new documents.

A related problem that has troubled some people is that in their Urdu files some letters don't seem to have correct shapes. For example, the letters "Goal Hay" or "yay" don't connect to the preceding or following letters properly. The culprit in such cases is nearly always the font used. At present only the X Series 2, Scheherazade, Lateef, and Geeza Pro among Naskh fonts, and Nafees and Jameel Noori among Nastaleeq fonts are known to work correctly with the whole Urdu alphabet. Please let me know if you discover (or design) other well-behaved fonts for Urdu.

## Orthographic Hints

### Diacritical Marks

In Urdu, short vowels (eraab) are denoted by diacritical marks that are placed above, below, or to the left of the letter involved. Although usually omitted, they are occasionally needed to remove ambiguity or to show the correct pronunciation of a word. In particular, the tashdeed and madd signs and the zer of izaafat combinations are always helpful to the reader of the text.

While composing text, you should type such a mark after typing the letter to which it belongs. The most frequently used marks are: zabar (shift->), zer (shift-<), pesh (shift-P), tashdeed (shift-_), and madd (shift-+). Alif with madd can be typed directly as shift-A. The "jazm" mark (shift-Q), which should print like a tiny "daal", doesn't have that shape in existing fonts. The alternative, also unattractive, is the "sukun" mark (/) of Arabic orthography that looks like a little circle.

A complete list of diacriticl marks is given earlier with the keyboard images.

### Yay

The I and Y keys correspond, respectively, to the maaroof and majhool forms of "yay", popularly referred to as "ChoTi yay" ی and "baRi yay" ے , respectively. (See the note below about maaroof and majhool sounds.) Thus, "galee" گلی (meaning lane) is to be typed as G, L, I, and "taaray" تارے (meaning stars) is to be typed as T, A, R, Y.

The form entered by Y does not connect to the next letter. So even a majhool "yay" letter that occurs in the middle of a word should be typed as I. For example, "bayTay" بیٹے (meaning sons) has to be typed B, I, shift-T, Y. Even though both "yay" letters occuring in this word are pronounced with the majhool sound, the first one has to be entered as I.

In Arabic, the letter "yay" has two dots underneath. In Urdu, the two dots are shown only if "yay" appears at the beginning or in the middle of a word, but not when it is the final letter of a word or when it stands alone (e.g., in an alphabet table). If needed, the "yay" with two dots ي can be typed as option-i.

### Noon Ghunna

Noon Ghunna, which appears as the letter Noon but without a dot, is entered as shift-N. Thus "maaN" ماں (mother) is typed as M, A, shift-N. Noon Ghunna adds a nasal quality to the sound of the vowel preceding it.

In the freewheeling, inconsistent way of Urdu orthography, Noon Gunna is used only at the end of a word. In the middle of a word, even where Noon Ghunna would be appropriate, Urdu just uses the ordinary Noon. Examples: "saaNp" سانپ (snake) has to be entered as S, A, N, P; or "pataNg" پتنگ (kite) has to be entered as P, T, N, G. This inconsistency is forced by the circumstance that in the middle of a word, Noon is written as a shosha with a dot above. Without a dot, such a shosha would be visually quite confusing.

In some very old books, specially Urdu instructional primers, Noon Ghunna was indicated by a tiny inverted "v" (circumflex accent) placed above the Noon. This worked both in the middle and at the end of a word. An equivalent sign, ٘ , is still available as option-n although its use in Urdu went out of style decades ago. Note that, by contrast, Hindi takes the rational approach of signifying the nasal modification by always placing a special mark above the affected letter.

### Hamza

The main forms of this letter are
1) independent ء , entered as shift-4,
2) hamza above "alif" أ , entered as the hyphen key (-),
3) hamza in the middle of a word ئ , entered as U,
4) hamza above "vaao" ؤ , entered as shift-W, and
5) hamza above "Goal Hay" ۂ , entered as the equal key (=).

The rules relevant to these forms are the following:

1) If hamza is the last letter of a word, use the independent hamza form (shift-4). Examples: "ziaa" ضیاء (meaning light) is entered by typing shift-J, I, A, shift-4; "zakaa" ذكاء (intelligence) is entered by typing shift-Z, K, A, shift-4.

NOTE: The terminal hamza is usually omitted in modern Urdu publications. For example, the above two words are frequently spelled as "ziaa" ضیا and "zakaa" ذكا .

NOTE: Only the words of Arabic origin can have a terminal hamza. It is incorrect to append a hamza to the words derived from other languages. For example, the words "Asia" ایشیا , "Australia" آسٹریلیا , "Angela" اینجلا , or "boo" بو (smell) should not be spelled with a terminal hamza. An exception is made in Urdu when a hamza is needed for the "izafat" combination; e.g., "Asia-e Kuchak" ایشیائے کوچک (Little Asia) or "boo-e gul" بوئے گل (the flower's fragrance). But the hamza used in such combinations is specific to Urdu spelling; in Persian, the same combinations contain only the yay, not the hamza. So the above Urdu phrases are spelled in Persian as "Asia-e Kuchak" ایشیای کوچک or "boo-e gul" بوی گل .

2) There is a special way to spell the word combinations in which the first word ends in an alif followed by a hamza, and the second word starts with an alif; for example, "ziaa uddin" ضیأالدّین . It is then traditional to use the "hamza above alif" form. The above combination is entered as shift-J, I, -, A, L, D, shift-_, N. (This L is written but is slient, and the "daal" is pronounced with a tashdeed.)

It is important to understand that "hamza above alif" أ means two different things in Urdu and Arabic orthographies. In Urdu, it is a compactly written combination of two letters, the vowel alif followed by the consonant hamza. In Arabic, it stands for the consonant hamza alone (operated with the short vowel zabar), and is equivalent to Urdu's alif with zabar اَ .

3) If the letter hamza occurs in the middle of a word, use the key U for it. When typed, it is displayed as a hamza over the letter "yay" ئ. But as soon as the next letter is typed, the yay disappears, and the correct combination of hamza and the next letter is displayed. Examples: "ghaael" گھائل (wounded) entered by typing G, H, A, U, L; "chaae" چائے (tea) entered by typing C, A, U, Y; "na-i" نئی (new) entered by typing N, U, I.

4) However, even in the middle of a word if a hamza precedes a "vaao", and this pair starts an isolated subword, then the two should be typed together as the single "hamza above vaao" key (shift-W). (To start an isolated subword, this pair should come after an alif, vaao, daal, ray, etc.) Example: "gaaoN" گاؤں (village) should be entered by typing G, A, shift-W, shift-N, and not G, A, U, W, shift-N which would result in the wrong shape گائوں !

The isolated subword condition is important. Otherwise just a medial hamza form (key U) is to be used. Example: "gau maataa" گئو ماتا (Mother Cow) should be entered by typing G, U, W, space, M, A, T, A; Typing G, shift-W, space, M, A, T, A would result in the wrong shape گؤ ماتا !

5) The "hamza above Goal Hay" ۂ occurs in "izaafat" combinations derived from Persian, and it is helpful to add a "zer" sign below it. Examples: "sitaara-e shaam" ستارۂِ شام (evening star) should be entered by typing S, T, A, R, =, shift-<, space, X, A, M. Or, "naala-e dil" نالۂِ دِل (heart's cry) should be entered as N, A, L, =, shift-<, space, D, (optionally, shift-<), L.

The form of the letter "Goal Hay" with a hamza above can occur only in the terminal and isolated positions of a word, while the form without a hamza can occur in all positions---initial, medial, terminal or isolated. One should be careful in choosing the correct form of "Goal Hay" in "izaafat" combinations. The form without hamza should be used when the "Goal Hay" ending a word is pronounced as H, as in "tah" تہ (layer or bottom). The form with a hamza above should be used when the Goal Hay ending a word is pronounced as A or E, as in "gila" گلہ (complaint). This point is taken up again in the next subsection.

### Hay

"BaRi Hay" ح (humorously called "Halvay Vaali Hay") is entered by typing shift-H. Thus "muhabbat" محبّت (love) is entered by typing M, shift-H, B, (optionally shift-_ for tashdeed), T.

"Dochashmi Hay" ھ is entered by typing unshifted H. In modern Urdu orthography, this letter is used only in combination with some consonant (which precedes it), and its purpose is to modify that consonant's sound to make it an "aspirated letter".

"Goal Hay" ہ , entered by typing the letter O, is pronounced separately by itself rather than being just used to "aspirate" another consonant. For example, the "Hay" sound is pronounced independently in the word "kahaa" كہا (said); so this word is typed with a "Goal Hay", as K, O, A. This is in contrast to the word "khaa" كھا (Eat!) where the "Hay" is used to aspirate the "k" sound; so this word is spelled with a "Dochashmi Hay", as K, H, A.

In the word "majhool" مجہول even though "h" follows "j", no aspiration takes place since the two letters belong to different syllables ("maj-hool") and are pronounced independently. This word should therefore be typed as M, J, O, W, L, and not M, J, H, W, L which would appear incorrectly as مجھول ! In general, "Dochashmi Hay" should not be used in any Urdu word that is derived from Arabic or Persian, since these languages do not have aspirated letters. Aspirated letters can occur only in the words of Indic origin.

There is an exception to the rule that "Goal Hay" must be pronounced with an "h" sound. At the end of a word, "Goal Hay" is pronounced as an A or E, not as H; for example, the word تكیہ typed as T, K, I, O is pronounced as "takya" (pillow).

An exception to that exception occurs sometimes, and the terminal "Hay" is actually pronounced as H, not A or E. For example, the word "shah" شہ (meaning check [of chess]) is typed X, O. The word "shaah" شاہ (meaning king), typed as X, A, O, is another example where a terminal "Goal Hay" is pronounced with an "h" sound.

However, the oddities of Urdu orthography do not end here. In the words ending in a pronounced Goal Hay which is not isolated but connected to the previous letter, the Hay is often written twice! For example, the word "kah" (meaning say!) is often written as كہہ , entered by K, O, O; or "sah" (meaning bear!, from the verb "sahna") as سہہ , entered by S, O, O; or "faqeeh" (expert of fiq-h [jurisprudence] ) as فقیہہ , entered by F, Q, I, O, O.

The purpose of doubling the Goal Hay is ostensibly to avoid its being wrongly pronounced as A or E. For example, without the extra Goal Hay the above words "kah" كہہ and "sah" سہہ could be easily confused with the words "ke" كہ (that) and "se" سہ (Persian three), respectively, in which the terminal Goal Hay is indeed pronounced as E. But such is clearly not the case with "faqeeh" فقیہہ , where the extra Goal Hay actually introduces the hazard of this word being confused with "faqeeha" (female expert of fiq-h). The reason for writing the Goal Hay twice in this word seems to be just the whim of the scribe rather than any logical need. In general, you will find that the spelling variation of doubling the Goal Hay is practiced unpredictably and rather inconsistently!

NOTE: When using a Persian or Arabic font, use the Option-o key rather than the plain o key for the letter Goal Hay (ہ); otherwise the letter might not be rendered properly.

### Punctuation

The end of an Urdu declarative sentence is marked with a small dash rather than a period. But the period key itself generates the dash in the Urdu-QWERTY keyboard. Other punctuation symbols such as question mark, exclamation, comma, semicolon, parentheses, brackets, braces, double and single quotation marks, etc., are entered with the usual keys. Punctuation symbols are appropriately reversed or inverted to match the right-to-left flow of text.

### Numbers and Dates

The Urdu-QWERTY keyboard provides three sets of digits 0, 1, 2, ... . The plain digit keys generate the so-called Eastern Arabic digit forms, meant to be used in Persian, Urdu, etc. These are the correct digit forms for use with Nastaleeq fonts. These are also the correct digit forms for use with Persian documents, in Naskh as well as Nastaleeq. There is another variation of digit shapes known as Traditional Arabic digits. The digit keys typed with Option pressed generate the latter shapes. An Urdu document produced in a Naskh font looks better when the Traditional Arabic form is used for digits. Finally, the digit keys typed with the CAPS LOCK button depressed generate Western digit characters. (See the highlighted NOTE below.)

Most fonts display ony the digits 4, 5, and 6 differently between Traditional and Eastern numeral forms. So, if you wish, you can use the Option key only with these digits. That is what we do in the examples below; yet the display looks as if the numbers have been typed in entirety to have the Traditional Arabic digit shapes.

The decimal point sign "٫" and the thousands separator "٬" are, respectively, typed as option-period and option-comma.

Examples: One million is typed as 1, option-comma, 0, 0, 0, option-comma, 0, 0, 0, and is displayed as ۱٬۰۰۰٬۰۰۰ . The number 3.1416 is typed as 3, option-period, 1, option-4, 1, option-6, and is displayed as ۳٫۱٤۱٦ .

NOTE: Separating groups of digits by thousand, million, billion. etc., is a relatively recent practice. The more traditional separation is by hazaar, laakh (lac), karoR (crore), arab, kharab, etc., for which the separating commas are placed after 3, 5, 7, 9, 11, ... digits from the right.

It is traditional in writing dates to insert a "date separator" or "small slash" symbol ؍ (shift-3) between the day number and month word, or between the numbers designating day, month, and year. The abbreviation equivalent to "A.D." is a Hamza (which looks as the stem of the letter Ain) entered by typing shift-4.

Example: August 14, 1947 is typed as 1, option-4, shift-3, A, G, S, T, space, 1, 9, option-4, 7, shift-4, and is displayed as ١٤؍اگست ۱۹٤۷ء . Alternatively, this date can be typed as 1, option-4, shift-3, 8, shift-3, 1, 9, option-4, 7, shift-4, and is displayed as ١٤؍۸؍۱۹٤۷ء .

NOTE: The recent tendency in Urdu publications is to use Western numerals. This switch is accompanied by the British-American style of formatting numbers, that is, using a period for the decimal point and a comma for the thousands separator. To use Western numerals, there are two methods.

1. If the CAPS LOCK key is pressed, then the digit keys will generate Western digits. The CAPS LOCK key has no effect on other keys, whether shifted or unshifted, so you can just leave this key depressed, except when the Option key has to be pressed.

2. Alternatively, you can switch to the English keyboard when starting the number and return to the Urdu-QWERTY keyboard when finished with the number.

### Inter-word Spaces. (And A Lament!)

People accustomed to Nastaleeq publications will discover that the documents composed in Naskh have spaces and other punctuation separating each pair of adjacent words. This is the correct and rational approach to word processing, shared by every non-Nastaleeq word processor in the world. Nastaleeq word processors stand alone in suppressing inter-word spaces. The user, of course, still has to type spaces to signify ends of words, but those spaces are removed and the words follow each other in a continuous stream.

Just imagine reading this English page if it did not include any spaces between words. Deciphering such a character stream requires, in essence, that you already know what you are trying to learn! But that's exactly what is expected of you when you are reading a text composed in Nastaleeq. Because some Urdu letters (e.g., alif, daal, re, vao) do not connect to the next letter in a word, Urdu words consist of isolated parts that could themselves be thought of as words. For example, the word درخواست (meaning request or appeal) contains as potential words خواست , است , رخوا , خوا , رخو , درخوا , درخو , در , and many more. When inter-word spaces are used, there is no confusion between any unintended "words" and the intended words because the beginning and end of each intended word is clearly delimited. But in the text edited with current Nastaleeq word processors, the only reason you are able to skip over the unintended "words" is that you already know the intended words, not because the text display is of any help!

When computer typesetting of Nastaleeq was first introduced for Urdu in the 1980s, inter-word spaces were actually employed. The practice of suppressing them is more recent. This unwise retrogression, justified in the name of "tradition and esthetics", is an unnecessary obstacle to anyone trying to learn Urdu. The Nastaleeq script already suffers from too many complexities, obscurities, irregularities, and inconsistencies. It makes no sense to invent more barriers to the accessibility of Urdu. The practice simply prolongs the time it takes students to master the language. It is also hindering the development of optical character recognition and other important electronic processing technologies for Urdu.

Exercise for the reader: Find out what ghatrabood is, and enjoy the story.

## Urdu Transliteration of English Words

As more and more words are being imported in Urdu from English, and more and more foreign geographical and personal names are being mentioned in Urdu writings, there is increasing need to systematize the transliteration of English words into Urdu. Not everyone spells the English words in Urdu in the same way, but some common conventions are the following:

All English consonants have reasonable equivalents in the Urdu alphabet. Conventionally, the letters "D" and "T" are rendered as the Urdu letters "ڈ " and "ٹ " , respectively. Both "V" and "W" are rendered as "و " . The digraph "th" is rendered as either "د " or "تھ ". Thus, "the" is transliterated as "دی " and "three" as "تھری ".

If an English word begins with the letter "S" that is immmediately followed by one of "c", k", "m, "n", "p", "q", and "t", then the Urdu transliteration often adds an inititial "alif" to the normally expected "seen". Examaples of this rule are the transliteration of "school" as "اِسکول ","sketch" as "اِسکیچ ", "smuggler" as "اِسمگلر ","Spain" as "اِسپین ", and "Steven" as "اِسٹیوین ". However, this rule (addition of "alif") is not followed uniformly. Also the "alif" is never added when the letter following "S" is "l". Thus ""slate" is transliterated as "سلیٹ " and "slice" as "سلائِس ".

The transliteration of some English vowels is not phonetically correct, but the practices are too firmly entrenched to do anything about them. Two widely used conventions are the following:

1. The long "a", the open "o", and the diphthongs like "au" and "aw" are generally rendered as "alif". For example, "Paul" is transliterated as "پال ", even though "پَول " would be more correct phonetically. Other examples are: "Dawn" as "ڈان ", "Law" as "لا ", "lot" as "لاٹ ", "collar" as "کالر ", "hot dog" as "ہاٹ ڈاگ ", and "New York" as "نیو یارک ". The diphthong "oi" sometimes gets the same tretament. Thus, "vice" and "voice" (as in "Voice of America"!) are both transliterated as "وائس ".

2. The vowel "e" is usually rendered as "Yeh" (with a majhool sound). Thus, "Web" is transliterated as "ویب " even though "وِب " would be more correct phonetically. The rationale for using "Yeh" (with a majhool sound) for "e" is, presumably, to reserve the "zer" (–ِ) diacritic for rendering "i". For example, "bell" is transliterated as "بیل " rather than as "بـِل " so that the latter can be the transliteration of "bill". Other examples are: "set" as "سیـٹ ", "cassette" as "کیسیـٹ ", "pen" as "پین ", and "vowel" as "واویل ".

## Ottoman Turkish

The term Ottoman Turkish refers to both the language and the Arabic-based script in common use in Turkey during the Ottoman period. The Ottoman and Modern Turkish languages do not differ much, but their scripts are totally different because Modern Turkish uses a script based on Latin characters. However, since there exists a huge volume of older Turkish publications and manuscripts written in the Ottoman script, this script still remains of interest as an essential scholarly tool and is taught in most departments of Turkish Studies. It is suitable, for example, for preparing the contents of older texts for linguistic analyses.

There is exactly one character, "Saghir Nun" ڭ (key Option-g) which is unique to Ottoman Turkish and is not used in Urdu or Persian. This character has now been added to the Urdu-QWERTY keyboard layout. So with this keyboard layout installed, your computer will be ready for Ottoman Turkish texts.

To download and install this keyboard, see the earlier section Installing Urdu keyboard layout. To activate the Ottoman Turkish input, follow the steps for Activating Urdu Input. Also, you will need to install some suitable fonts in order to be able to read, edit, and produce documents in Ottoman Turkish. Some beautiful, freely available fonts are recommended in Installing Urdu Fonts. Finally, if you prefer to do the Ottoman Turkish work on a Windows computer, there is an Urdu-QWERTY keyboard layout for Windows also, with key settings identical to the Mac one. The fonts and general instructions given here will work on the Windows machines also. See DIGRESSION: Urdu QWERTY for Windows.

The Urdu-QWERTY keyboard provides the various diacritics employed in older Ottoman texts (as well as in Urdu and Persian). The following diacritics are used in a standard way:

1. Fathah –َ– (key Shift->), Kesrah –ِ– (key Shift-<), Dammah –ُ– (key Shift-P),
2. Jazm –ْ– (key /),
3. Fathatain –ً– (key Shift-~), Kesretain –ٍ– (key ), Dammatain –ٌ– (key Shift-8),
5. Teshdid –ّ– (key Shift-_),
6. Hamza above –ٔ– (key Shift-&).
Some diacritics that are used in old Ottoman Turkish texts in non-standard ways are the following:
1. "Wasla" is used over "alef" to form "alef-wasla" ٱ (key Shift-M). Alef-Wasla indicates a "silent" alef at the beginning of the second word of a two-word Arabic combination, such as "Daar-a (a)l-ilm" دارٱلعلم (House of Knowledge).
2. The "little v" –ٚ– (key Option-j) and "little inverted v" –ٛ– (key Option-h) are superscripts that are used for various purposes, e.g., for marking the letter "Vao" و (key w) as the v-sounding consonant rather than a vowel; distinguishing "rounded" vowel sounds "ö" and "ü" from "unrounded" vowel sounds "o" and "u" denoted by the same letter "Vao" و (key w); distinguishing vowel sounds "o" from "u" and "i" from "e", denoted, respectively, by the same letters "Vao" و (key w) and "Yeh" ی (key i); etc.

The example below shows a sample text typed in Ottoman Turkish (right), together with its equivalent in Modern Turkish (left). Incidentally, this entire two-column table has been prepared by using nothing else but the Mac OS's built-in TextEdit utility. The Ottoman text part that you see on the right in the table has been typed using the exquisite Lateef font, which can be downloaded and installed as described in the section Installing Urdu Fonts. The Turkish text is supposedly the translation of a French text, Jean de La Fontaine's fable La Cigale et la Fourmi (The Cicada And The Ant). Both the typed (right) and the transcribed (left) versions shown below have been taken from the Web site of the Department of Turkish Studies at the University of Michigan. There you can also see the image of the original manuscript in the Osmani calligraphic style (referred to as Nastaleeq in Urdu and Persian calligraphy).

## Comparing Persian and Urdu Alphabets

The Urdu alphabet contains the following additional symbols that do not exist in Persian:

1. The "retroflex" letters "Tay" ٹ , "Daal" ڈ , and "Ray" ڑ , each of which has a tiny "toey" mark above. These letters are typed with the keys shift-T, shift-D, and shift-R, respectively.
2. "Aspirated letters", formed by combining certain consonants with "Dochashmi Hay", e.g., "bh" بھ , "ph" پھ , "th" تھ , "Th" ٹھ , etc. Note that aspirated letters are really combinations, and do not count as letters in the Urdu alphabet.
3. "Noon Ghunna" ں (key shift-N).
4. In Urdu, it is traditional to count "Goal Hay" ہ (key O) and "Dochashmi Hay" ھ (key H) as two different letters. In Persian, these are not different letters but simply two visually different forms of the same letter. Most commonly, the "Dochashmi Hay" form is used when the letter occurs in the initial or medial position in a word, and the "Goal Hay" form is used when the letter occurs isolated or in the terminal position.
5. In Persian, "Hamza" ء (keys shift-4, -, U, shift-W, and =, depending on the context) is not considered a separate letter but a diacritical mark. Urdu and Persian diverge from Arabic in the treatment of "Hamza". In Arabic, "Alif" is a vowel, and "Hamza" is a consonant that represents the glottal stop. In Urdu and Persian, this consonant is written as an "Alif" when it starts a word and as a "Hamza" when it occurs in the middle or end of a word. Thus "Alif" is both a vowel and a consonant.
6. "BaRi Yay" ے (key Y). In Persian, this is not a different letter, but just a visual variant of "ChoTi Yay" ی . It is used for calligraphic effect in decorative writing, and is sparingly employed in computer-generated text.
7. The combination "Laam Alif" لا used to be listed as a separate letter in old Urdu primers. To continue doing that is anachronistic. That "letter" fulfills no need and serves no purpose. The Urdu-QWERTY keyboard doesn't have any single key assigned to the "Laam Alif" combination.
Here is a summary of the alphabets: Arabic has 28 letters. To those, Persian adds "pay" پ , "chay" چ , "zhay" ژ , and "gaaf" گ , and thus has a total of 32 letters. Urdu, somewhat arguably, has 39 letters, counting the following as additional letters: "Tay" ٹ , "Daal" ڈ , "Ray" ڑ , "Noon Ghunna" ں , "Hamza" ء , "Dochashmi Hay" ھ , and "BaRi Yay" ے .

"Noon Ghunna" ں , "Hamza" ء , "Dochashmi Hay" ھ , and "BaRi Yay" ے   are letters in a rather weak sense, since no Urdu word can begin with these. (Hence, Urdu dictionaries do not dedicate chapters to these as they do to regular letters.)

Urdu and Persian differ markedly in the pronunciation of vowels.

1. In Persian, the vowel "Alif" is generally pronounced like au in the English word maul. In Urdu, the same vowel is pronounced like the vowel "a" in father.
2. In Persian, the short vowels "zer" and "pesh" have majhool sounds and the long vowels "Vaao" and "Yay" have maaroof sounds. (See the note below about maaroof and majhool sounds.) In Urdu, the same vowels do double duty to represent both maaroof and majhool sounds.
These differences do not affect writing unless special marks are used to distinguish maaroof and majhool sounds.

There are minor variations in the placement of "Hamza" between Urdu and Persian orthographic styles. But the needed forms in all cases are adequately provided by the keyboard and the fonts that we have recommended.

The standard ("educated person's") pronunciation of consonants is generally identical in Urdu and Persian, and often different from Arabic. Some of the similarities and differences are as follows:

1. The consonants contain some groups of separate letters that are homophones (pronounced with the same sound) in Urdu and Persian. These groups of letters and their approximate English pronunciations are:
• [ ا , ع , ء ] pronounced as the glottal stop;
• [ ح , ہ ] pronounced as "H";
• [ ت , ط ] pronounced as "T";
• [ ث , س , ص ] pronounced as "S";
• [ ذ , ز , ض , ظ ] pronounced as "Z".
In Arabic, the letters within each of these groups have distinct pronunciations. (Note: "Alif" is a vowel, not a consonant). The Arabic pronunciation is sometimes imitated in Persian and Urdu speech by religious clerics. But in the standard Persian and Urdu pronunciation, the letters in each group have identical sounds. The Urdu-QWERTY keys for these consonants are in a table given earlier .
2. When occurring as a consonant, the letter "Vaao" و (key W) is pronounced like "v" in Urdu and Persian, but like "w" in Arabic.
3. The letter "Qaaf" ق (key Q) has the same pronunciation in Urdu and Arabic but a different one in Persian. In Persian, the letters "Qaaf" ق and "Ghain" غ (key Shift-G) are generally pronounced alike, with the same sound as that of "Ghain" غ in Arabic and Urdu.

Since we have called our keyboard phonetic, we wanted to relate the pronunciation of the alphabet letters with the keys being used to enter them. The tedious details given above will perhaps help you in remembering the keys. As you can see, some Persian and Urdu letters are hard to phonetically map to a Latin-based keyboard!

## Note on Maaroof and Majhool Vowels

There is an old classification of certain vowel sounds as maaroof (literally, well-known) or majhool (literally, unknown or unfamiliar). The difference between these can be illustrated with English words as follows:

1. Short vowel mark Zer:       pill (maaroof), pell or bell (majhool)
2. Short vowel mark Pesh:     pull (maaroof), * (majhool)
3. Long vowel letter Vaao:     pool (maaroof), pole (majhool)
4. Long vowel letter Yay:        peel (maaroof), pale (majhool).
* The majhool pesh is difficult to illustrate in English because the letter "O", which is closest to that vowel, is pronounced in several different ways. But this is the vowel sound found in the Persian words "gol" گل (meaning flower) and "sokhan" سخن (utterance). An Urdu example is "hahot" بہت (meaning very or a lot). But beware that the Hindi-influenced pronunciation of this word is "bahut" which has a maaroof, not majhool, vowel sound.

In general, note that:

1. The short majhool vowel sounds represented by Zer and Pesh occur in Urdu and Persian but not in Hindi or Arabic.
2. The long majhool vowel sounds represented by Vaao and Yay occur in Urdu and Hindi but not in Persian or Arabic.

## Acknowledgement

Urdu-QWERTY was designed with the aid of Ukelele, a keyboard layout editor for MacOS. I thank John Brownie, the author of Ukelele, for developing this melodious software and for making it available under a freeware license.

I also wish to thank
Amal Ahmed, Aaron Jakes, Muhammad Javed, Shebab Javed, Karan Misra, Knut S. Vikor, and Muhammad Yusaf