Microsoft KB Archive/28455

Information on How Cursor Line Drawing Works

PSS ID Number: Q28455 Article last modified on 11-02-1994

4.00 5.00 5.50 6.00

MS-DOS

= SUMMARY =

The following are two ways to take advantage of the line drawing capabilities of Word:


 * 1) The Format Border method
 * 2) The cursor line draw (CTRL+F5) method

In Word 5.50, the two ways to take advantage of line drawing are as follows:


 * 1) By choosing Paragraph from the Format menu (ALT, F, P) and then selecting Borders (ALT+D).
 * 2) By choosing Line Draw from the Utilities menu (ALT, U, L).

The Format Border method is a paragraph-based type of formatting. It is best used for drawing boxes around proportionately spaced fonts because Word adjusts for any required fractional character spacing commands.

The cursor line draw method enters ASCII extended characters directly into a document, using the mouse or cursor keys.

Each method references information from the printer driver (PRD) files differently.

= MORE INFORMATION =

When you choose the Format Border command, Word looks at the line draw flag in the header section of the printer driver (PRD) file currently installed in the Print Options menu. This is done to determine which ASCII character codes to place around the paragraph in question, the font in which to print them, and how (if at all) to adjust the paragraph’s vertical-line spacing.

The line draw flag number found in the header is the decimal equivalent of an 8-bit binary number. It is not necessary to calculate binary numbers to understand Word’s line drawing abilities.

If the line draw flag has a value between 0 and 63, inclusive, which means the seventh and eighth bits are not set (i.e., have a binary value of 0), Word will use ASCII extended characters to produce the lines for the Format Border command. Word assumes that the printer is capable of producing symbols from the IBM Extended Character Set.

Word prints the ASCII decimal values from the following table, depending on the choice selected in the “line style:” field of the Format Border menu. Word prints these characters in the font referenced in the line draw flag. For example, if the line draw flag equals four, Word will print these characters using font number 4 from the printer driver listed as F4.

Normal-Line Style Double-Line Style Description —————– —————– ———–

179 186 Vertical line 196 205 Horizontal line 218 201 Left upper corner 192 200 Left lower corner 191 187 Right upper corner 217 188 Right lower corner

If the line draw flag has a value between 64 and 255, inclusive, it is indicating how Word is, or is not, adjusting line spacing in an effort to compensate for the vertical-bar line draw characters used in Format Border.

When the line draw flag has a total value of between 64 and 255, the vertical-bar and underline line draw technique are being used in conjunction with the font defined by the first 6 bits of the line-draw flag value (interpreted as a binary number).

When the vertical-bar and underline options are used, the vertical bar (shifted backslash on an XT keyboard, ASCII decimal 124) is used instead of decimal 179 (for the single line) or decimal 186 (for the double line), to form vertical lines in Format Border.

The underline character (ASCII decimal 95) is used for the horizontal components of the border, rather than decimal 196 or 205 for single and double horizontal lines, respectively.

The vertical-bar and underline method are implemented for printers that do not have the appropriate IBM extended characters available. There is no standard vertical-bar character available across all printers. Some print a solid line, while others print a broken line. (The size of a break can vary widely.)

Therefore, Word tries to minimize the esthetic damage presented by some of the more extreme vertical bar characters.

If the line draw flag has a value between 64 and 127, inclusive (only the seventh bit is set), Word assumes the vertical bar is the same height as the other characters on the line and that it has no hole (i.e., the vertical bar character uses all 9 pins on a 9-pin dot matrix print head). In this case, Word adjusts line spacing so the top and bottom ends of the character touch, forming a solid vertical line. You can subtract 64 from the line draw flag value to determine which font number is being used.

If the line draw flag has a value between 128 and 191, inclusive (only the eighth bit is set), Word will make no attempt to adjust line spacing because the printer has no “set line spacing” sequence (found at byte 18 of the PCSD table in the printer driver). You can subtract 128 from the line draw flag value to determine which font number is being used.

If the line draw flag has a value between 192 and 255, inclusive (both the seventh and eighth bits are set), Word assumes the bar character has a hole in it and attempts to fill the gap by adjusting the line spacing. You can subtract 192 from the line draw flag value to determine which font number is being used.

The line draw flag can be viewed as an 8-digit binary number. The first 6 bits of the flag indicate the font used by the Format Border Box. The line draw flag in the header section of the printer driver has nothing to do with the cursor line draw method (CTRL+F5). Cursor line draw does not use the font indicated by the line draw flag.

The conversion from the binary value to the font number is actually quite simple. The font number is represented by the decimal equivalent of the first six binary digits of the available 8 bits. For example, a line draw flag of one (1) corresponds to the binary number 00000001b. The first six digits of 00000001b, 000001b, have a decimal equivalent of one. Therefore, a line draw flag of one means that Word will be using F1 when the Format Border command is used. The seventh and eighth bits, as described above, control which characters to use, create the lines with the Format Border command, and determine how (if at all) to adjust vertical-line spacing.

None of these processes is perfect. They are “best compromises” in an attempt to support a very wide range of diverse hardware. The hardware specific limitations of line draw functions may be viewed as difficult, but there are valid reasons for the way they work.

Because there is no resident symbol set within all of the HP LaserJet family of printers that support the IBM Extended-Character Set, the vertical bar and underline method are used almost exclusively on the HP LaserJet drivers. However, the HP LaserJet Series II, Series IID, and Series IIP do offer support through use of the IBM US symbol set. This is true except where a symbol set is available on cartridge or download that is mapped to the IBM Extended-Character Set.

Do not confuse cursor line draw with what is done with the Format Border command. Using cursor line draw is like typing characters from a keyboard. The characters are subject to the same remapping and limitations of the font currently selected. If you are using 12-point TimesRoman on the original Z cartridge, and you draw something with line draw (CTRL+F5) and print the document, the line drawing characters entered will not print as they appeared on the screen. This is because the Z cartridge, a 7-bit cartridge, does not support the IBM Extended-Character Set. Word will substitute the next available character.

Note that the newer Z cartridges are 8-bit cartridges, but they do not support the IBM Extended-Character Set, either.

The following is a list of the ASCII decimal values used when drawing lines, using the cursor line draw feature by pressing the CTRL+F5 key combination, and using a mouse or the cursor keys to create the lines.

The following 12 items are the default options available to select in the “linedraw character:” field of the Options command. The first three items are sets of characters that, when selected, are used to produce the line draw effect. The remaining nine are the ASCII decimal values for the single characters that are used to produce the line draw effect. The ASCII decimal values are shown in parenthesis at the location in which you would see the extended characters on screen by choosing the Options command, tabbing down to the “linedraw character:” field, and pressing the F1 key to display a list of the available options.

Single Set Double Set Hyphen-Bar (219) (178) (177) (176) (250) (249) (248) (220) (223)

The single, double, and hyphen-bar sets use several different characters to produce the horizontal lines, vertical lines, and corners. The following is a table that shows which ASCII decimal codes are used in each case:

Single Set Double Set Hyphen-Bar ———- ———- ———-

179 186 124 Vertical line 196 205 45 Horizontal line 218 201 43 Left upper corner 192 200 43 Left lower corner 191 187 43 Right upper corner 217 188 43 Right lower corner

If your printer does not support the IBM Extended-Character set, or if the printer driver remaps these characters to other values, the line(s) will be drawn using the character assigned to these ASCII values.

All of the ASCII codes listed above print in the default font of the printer driver currently installed in the Print Options menu. Many printers do not use these ASCII characters from the IBM Extended-Character Set in their default font, but still may have them available through some other font.

If this is the case, you may be able to get these ASCII characters to print by formatting them for a different font. This would consist of selecting the line draw characters on screen, choosing the Format Character command, and selecting the font that uses the IBM Extended-Character Set in the “font name:” field of the Format Character command.

You also may want to write a macro that would search your document for these ASCII values, and apply the proper character-based formatting to them.

KBCategory: kbprint KBSubcategory: Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.