Vertical Writing and Printing

Depending on the purpose of your application, you might find it necessary to support vertical text. Although text that is read horizontally from left to right is becoming more common in Far Eastern countries (text in Japanese technical and business journals, for example, is often printed horizontally), many books, magazines, and newspapers still print text vertically.

As the following illustration shows, displaying text vertically doesn't mean that you simply rotate an entire line of text by 90 degrees. Most characters remain upright, but others, such as those identified by arrows, change orientation.

Fortunately, with Win32 you don't need to write code to rotate characters. To display text vertically on Windows, enumerate the available fonts as usual and select a font whose typeface name begins with the at (@) character. Then create a LOGFONT structure, setting both the escapement and the orientation to 270 degrees. Calls to TextOut are the same as for horizontal text.

The Far East Win32 SDK contains a sample application called TATE (short for tategaki, meaning "vertical writing") which demonstrates how to create fonts and display vertical text. Figure 7-22 shows a sample file displayed in TATE using a horizontal font. Selecting a vertical font from the Font dialog box (see Figure 7-23 below) causes the text to be displayed vertically. (See Figure 7-24 below.)

Figure 7-22 A horizontal font displayed using the TATE (tategaki) application in the Far East Win32 SDK.

Figure 7-23 A vertical font selected in the Font dialog box.

The Far East Win32 SDK includes the code for TATE, which is minimal; TATE doesn't allow you to enter or edit text. In your own application, you will need to add editing code to handle, for example, the progression of Japanese vertical text from right to left.

Figure 7-24 After you select a vertical font in the Font dialog box, text is displayed vertically.

Show: