Printer Independent Functions

This topic introduces the printer independence feature and provides a listing of Classes 1 to 13.

Introduction to Printer Independence

Because each printer manufacturer chooses its own method for specifying printer control strings for performing special functions such as ejecting a sheet, changing fonts, and so on, it is difficult for an operating system producer to provide tables for controlling all printer types.

Reality provides a method by which a Despooler can take specially coded strings from the job print data and convert them to control data that is meaningful to a given printer.

Using the DataBasic PTR function, you can specify a printer function, such as setting line spacing to six lines per inch, that is independent of the printer used. The DataBasic compiler encodes the parameters of the PTR function into a string of characters called a Printer Independent Function Sequence (PIFS). When your print data is despooled, the system translates the PIFS into a command sequence for a particular printer.

In the PTR function you specify a function class and a function subclass. The eject-page function, for example, is in class 1, subclass 10. A DataBasic statement that specifies page eject would be:

PRINT PTR(1,10)

The system compiles this into a coded string of characters that is printer independent (PIFS). When the Despooler encounters the PIFS, it converts the PIFS into the printer dependent commands required for its printer to perform the requested function.

If the printer function requires parameters, you also specify them in the PTR function. The Set n CPI function (class 7, subclass 5) sets the character pitch to a specified value. The statement to set the character pitch to 12 is:

PRINT PTR(7,5,12)

PIFS strings are intended mainly for prologues and epilogues, which you would create using option 3 of the SPM command. However, you can embed a PIFS in print data created by a DataBasic program.

The remainder of this topic presents the classes and subclasses of printer independent functions and their parameters that you can use with the PTR function.

Printer Independent Functions

The printer independent functions for use in the PTR function are divided into thirteen classes. Each class has several subclasses. The remainder of this topic presents a table for each class with its subclasses. Each table has the subclass numbers, the function name, a description of the function, and the format to use with the PTR function.

The classes and their reference tables are as follows:

Class

Function

Table Number

1

Device Control

G-1

2

Page Format

G-2

3

Line Format

G-3

4

Tabulations

G-4

5

Horizontal Control

G-5

6

Line Spacing

G-6

7

Character Pitch

G-7

8

Form Layout

G-8

9

Special Effects

G-9

10

Typeface

G-10

11

Character Set

G-11

12

Font Selection

G-12

13

Colour

G-13

Example of a Prologue

To create a prologue for a form queue you would invoke the SPM command and enter option 3 to produce a print control string, which is a series of PIFS strings.

For this example say that each time the form queue is used to output a job to the printer all the margins are to be cleared, the left margin is to be set to 10, tabulation stops are to be set at positions 20, 35, and 50, and the alternate tray is to be selected. The information to be gleaned from the class tables is the following:

Function

Class

Subclass

PTR Format

Clear All Margins

2

8

PTR(2,8)

Set Left Margin

2

4

PTR(2,4,p)

Set Horizontal Tabulation Stops

4

1

PTR(4,1,p{,p}...)

Alternate Sheet Feeder

 

 

PTR(1,8)

Example of Using PTR in a Program

The following DataBasic statements could be the prologue:

PRINTER ON
PRINT PTR(2,8):PTR(2,4,10):PTR(4,1,20,35,50):PTR(1,8):
END

The PRINT statement ends with a colon so that a carriage return-line feed is not output as part of the sequence.

Say that you wish to print text that includes footnote numbers. You wish to print the numbers in the text as superscripted condensed characters. The class tables provide the following:

Function

Class

Subclass

PTR Format

Superscript On

9

19

PTR(9,19)

Super/Subscript Off

9

21

PTR(9,21)

Set Condensed Printing

7

10

PTR(7,10)

Cancel Condensed Printing

7

11

PTR(7,11)

The DataBasic statements to achieve this could be:

FIRSTEXT="some text"
FOOTNOTE= FOOTNOTE + 1
NEXTTEXT= "some more text:
PRINT FIRSTEXT:
PRINT PTR(9,19):PTR(7,10):FOOTNOTE:PTR(9,21):PTR(7,11):
PRINT NEXTEXT

Function Classes

Class 1: Device Control

Sub Class

Function

Description

PTR Format

1

Disable Printer Independence

For the remainder of the present job send any PIFS to the printer as is, that is, without translation.

PTR(1,1)

2

Reset

Restore the printer to an initial setting. (Not all printers clear buffers with this command.)

PTR(1,2)

3

Initialize

Set the printer to an initial state.

PTR(1,3)

4

Queued Initialize

When the current print job is complete, set the printer to an initial state.

PTR(1,4)

5

Self Test

Execute the self test routine in the printer.

PTR(1,5)

6

Clear Buffer

Print or delete all data in the output buffer.

PTR(1,6)

7

Main Sheet Feeder

Select the primary, or default, paper tray.

PTR(1,7)

8

Alternate Sheet Feeder

Select the alternate, or secondary, paper tray.

PTR(1,8)

9

Paper Tray n

Select paper tray n.

PTR(1,9n)

10

Eject Sheet

Eject a sheet of paper.

PTR(1,10)

11

Eject and Load Sheet

Eject the current sheet and reload from the active tray.

PTR(1,11)

12

MSB as is

Accept the most significant bit of each data byte as it is.

PTR(1,12)

13

MSB = 1

Force the most significant bit of each data byte to 1.

PTR(1,13)

14

MSB = 0

Force the most significant bit of each data byte to 0.

PTR(1,14)

15

Enable Remote On-line Control

Enable on-line control at the printer.

PTR(1,15)

16

Disable Remote On-line Control

Disable on-line control at the printer

PTR(1,16)

17

Enable Print Control Sequences

Enable the printer to print the control sequences it receives. This is a diagnostic function.

PTR(1,17)

18

Disable Print Control Sequences

Disable the printer from printing the control sequences it receives. This is a diagnostic function.

PTR(1,18)

19

Time

Print the current system time in the format hh:mm:ss.

PTR(1,19)

20

Date

Print the current system date in the format dd mmm yyyy.

PTR(1,20)

Class 2: Page Format

Sub Class

Function

Description

PTR Format

1

Set Top Margin

Set the top margin to line position p.

PTR(2,1p)

2

Set Bottom Margin

Set the bottom margin to line position p.

PTR(2,2p)

3

Set Right Margin

Set the right margin to character position p.

PTR(2,3p)

4

Set Left Margin

Set the left margin to character position p.

PTR(2,4p)

5

Set Text Length

Define the number (n) of lines from the top to bottom margins.

PTR(2,5n)

6

Clear Vertical Margins

Reset the vertical margins to their default settings.

PTR(2,6)

7

Clear Horizontal Margins

Reset the horizontal margins to their default settings.

PTR(2,7)

8

Clear All Margins

Reset both the vertical and horizontal margins to their default settings.

PTR(2,8)

9

Set Top of Form

Set the current printer position at the top of form.

PTR(2,9)

10

Set Skip Over Perforation

Set the number (n) of line feeds to allow for perforations.

PTR(2,10n)

11

Clear Skip Over Perforation

Reset the skip-over-perforation value to zero.

PTR(2,11)

Class 3: Line Format

Sub Class

Function

Description

PTR Format

1

Auto-justify Off

Disable the automatic left- and right- alignment of print lines.

PTR(3,1)

2

Left-align On

Enable left-alignment of print lines.

PTR(3,2)

3

Right-align On

Enable right-alignment of print lines.

PTR(3,3)

4

Auto-Centre On

Enable the automatic centring of print lines.

PTR(3,4)

5

Auto-justify On

Enable the automatic left- and right-alignment of print lines.

PTR(3,5)

6

Auto-Linefeed On

Enable automatic advancement of paper after a carriage return.

PTR(3,6)

7

Auto-Linefeed Off

Disable automatic advancement of paper after a carriage return.

PTR(3,7)

8

Auto CR On

Enable automatic return of print head after a line feed.

PTR(3,8)

9

Auto CR Off

Disable automatic return of print head after a line feed.

PTR(3,9)

Class 4: Tabulations

Sub Class

Function

Description

PTR Format

1

Set Horizontal Tabulations Stops

Set horizontal tabulations stops at character positions p.

PTR(4,1,p{,p}...)

2

Clear All Horizontal Tabulations Stops

Clear all horizontal tabulation stops. On some printers this may reassert default tabulation stops.

PTR(4,2)

3

Set Vertical Tabulation Stops

Set vertical tabulation stops at line position p.

PTR(4,3,p{,p}...)

4

Set Vertical Tabulation Channel

Set vertical tabulation stops on channel c at line positions p. On some printers this may reassert default tabulation stops.

PTR(4,4,c,p{,p}...)

5

Select Vertical Channel (VFU)

Select channel c for subsequent use.

PTR(4,5,c)

6

Clear All Vertical Tabulation Stops

Clear all vertical tabulation stops.

PTR(4,6)

7

Clear Vertical Channel's Tabulation Stops (VFU)

Clear all tabulation stops on channel c.

PTR(4,7,c)

8

EVFU Load

Send an EVFU loading sequence to the printer. Each c is a channel number, and the numbers must be in line-number sequence.

PTR(4,8,c{,c}...)

Class 5: Horizontal Control

Sub Class

Function

Description

PTR Format

1

Bi-directional Printing On

Enable printing in both directions.

PTR(5,1)

2

Bi-directional Printing Off

Disable printing in both directions, allowing unidirectional printing only.

PTR(5,2)

3

Move Horizontal, Relative, in Columns

Change the position of the cursor/head on the current line to column displacement d relative to the current position.

PTR(5,3,d)

4

Move Horizontal, to Absolute Column

Change the position of the cursor/head on the current line to column displacement d from the left margin.

PTR(5,4,d)

5

Move Horizontal, Relative, in Dots

Change the position of the cursor/head on the current line to dot displacement d relative to the current position.

PTR(5,5,d)

6

Move Horizontal, Absolute, in Dots

Change the position of the cursor/head on the current line to dot displacement d from the left margin.

PTR(5,6,d)

7

Move Horizontal, Relative, in Decipoints

Change the position of the cursor/head on the current line to decipoint displacement d relative to the current position.

PTR(5,7,d)

8

Move Horizontal, Absolute, in Decipoints

Change the position of the cursor/head on the current line to decipoint displacement d from the left margin.

PTR(5,8,d)

9

Horizontal Motion Index

Set the Horizontal Motion Index (HMI), which is distance d between characters or columns.

PTR(5,9,d)

10

Backspace

Move the cursor/head over the most recently printed character.

PTR(5,10)

11

Carriage Return

Move the cursor/head to the current left margin.

PTR(5,11)

12

Horizontal Tabulation

Move the cursor/head to the next horizontal tabulation stop.

PTR(5,12)

Class 6: Line Spacing

Sub Class

Function

Description

PTR Format

1

6 LPI

Set line spacing to six lines per inch (8/48" per line).

PTR(6,1)

2

8 LPI

Set line spacing to eight lines per inch (6/48" per line).

PTR(6,2)

3

10 LPI

Set line spacing to ten lines per inch (7/72" per line).

PTR(6,3)

4

Store a Line Spacing Value

Store line spacing fraction values as numerator (n) and denominator (d).

PTR(6,4,n,d)

5

Set Stored Line Spacing Value

Set line spacing to the previously stored line spacing values.

PTR(6,5)

6

Set n/360" Line Spacing

Change the paper feed amount to n/360" per line.

PTR(6,6,n)

7

Set n/180" Line Spacing

Change the paper feed amount to n/180" per line.

PTR(6,7,n)

8

Set n/60" Line Spacing

Change the paper feed amount to n.60" per line.

PTR(6,8,n)

9

Set n/48" Line Spacing

Change the paper feed amount to n/48" per line.

PTR(6,9,n)

10

Vertical Motion Index

Set the Vertical Motion Index (VMI), which is the distance (d) between lines or rows.

PTR(6,10,d)

11

8 Point Character Height

Set the character height to 8 points.

PTR(6,11)

12

10 Point Character Height

Set the character height to 10 points.

PTR(6,12)

13

12 Point Character Height

Set the character height to 12 points.

PTR(6,13)

14

18 Point Character Height

Set the character height to 18 points.

PTR(6,14)

15

Form Feed

Advance the paper until the top of page is at the cursor/head.

PTR(6,15)

16

Linefeed

Advance the paper until the cursor/head is at the same character position one line down.

PTR(6,16)

17

Half Linefeed

Advance paper until the cursor/head is at the same character position one-half line down.

PTR(6,17)

18

Reverse Linefeed

Reverse move the paper until cursor/head is at the same character position one line up.

PTR(6,18)

19

Vertical Tabulation

Advance the paper until the cursor/head is at the next vertical tabulation stop.

PTR(6,19)

Class 7: Character Pitch

Sub Class

Function

Description

PTR Format

1

Set 8 CPI

Set character pitch to fixed at eight characters per inch.

PTR(7,1)

2

Set 10 CPI (pics)

Set character pitch to fixed at ten characters per inch.

PTR(7,2)

3

Set 12 CPI (elite)

Set character pitch to fixed at twelve characters per inch.

PTR(7,3)

4

Set 15 CPI (micron)

Set character pitch at fifteen characters per inch.

PTR(7,4)

5

Set n CPI

Set the character pitch to n characters per inch.

PTR(7,5,n)

6

Character Pitch Offset

Define additional increment i to be added to a character's width.

PTR(7,6,i)

7

(reserved)

 

 

8

Proportional Printing On

Enable proportional spacing during printing.

PTR(7,8)

9

Proportional Printing Off

Disable proportional spacing during printing.

PTR(7,9)

10

Set Condensed Printing

Enable condensed, or compressed, printing, which reduces the character pitch.

PTR(7,10)

11

Cancel Condensed Printing

Disable condensed, or compressed, printing.

PTR(7,11)

Class 8: Form Layout

Sub Class

Function

Description

PTR Format

1

Set Form Length = n Lines

Define paper length in number of lines n.

PTR(8,1,n)

2

Set Form Length in Inches

Define paper length in number of inches n.

PTR(8,2,n)

3

Set Form for Letter Size

Define paper as letter size (8.5" X 11").

PTR(8,3)

4

Set Form for Legal Size

Define paper as legal size (8.5" X 14").

PTR(8,4)

5

Set form for A4 Size

Define paper as A4 size (210mm X 297mm).

PTR(8,5)

6

Set Form for Specified Size

Define paper as size s.

PTR(8,6,s)

7

Select Portrait Orientation

Set the printer to print across the page width.

PTR(8,7)

8

Select Landscape Orientation

Set the printer to print across the page length.

PTR(8,8)

Class 9: Special Effects

Sub Class

Function

Description

PTR Format

1

Print Double Wide

Enable printing characters twice their specified width.

PTR(9,1)

2

Cancel Double Wide

Disable printing double wide characters.

PTR(9,2)

3

Printing Double High

Enable printing characters twice their specified height.

PTR(9,3)

4

Cancel Double High

Disable printing characters twice their specified height.

PTR(9.4)

5

Print Emphasized

Enable printing each character twice, the second time a little offset from the first.

PTR(9,5)

6

Cancel Emphasized

Disable printing emphasized characters.

PTR(9.6)

7

Shadow On

Enable printing double-strike with offset.

PTR(9,7)

8

Shadow Off

Disable printing double-strike with offset.

PTR(9,8)

9

Outline On

Enable printing outline characters.

PTR(9,9)

10

Outline Off

Disable printing outline characters.

PTR(9,10)

11

Underline On

Enable printing underline.

PTR(9,11)

12

Underline Off

Disable printing underline.

PTR(9,12)

13

Bold On

Enable printing bold characters.

PTR(9,14)

14

Bold Off

Disable printing bold characters.

PTR(9,14)

15

Strikethrough On

Enable printing the strikethrough character.

PTR(9,15)

16

Strikethrough Off

Disable printing the strikethrough character.

PTR(9,16)

17

Overscore On

Enable printing overscore.

PTR(9,17)

18

Overscore Off

Disable printing overscore.

PTR(9,18)

19

Superscript On

Enable printing characters a half line above the current line.

PTR(9,19)

20

Subscript On

Enable printing characters a half line below the current line.

PTR(9,20)

21

Super/Subscript Off

Disable superscript and subscript printing.

PTR(9,21)

22

Italic Off

Disable printing italic style.

PTR(9,22)

23

Italic On

Enable printing italic style.

PTR(9,23)

24

Select Draft Quality

Enable printing in rough draft quality (usually faster than higher quality printing).

PTR(9,24)

25

Select Highest Quality

Enable printing in the printer's highest quality.

PTR(9,25)

Class 10: Typeface

Sub Class

Function

Description

PTR Format

1

Select Default Typeface

Select the printer's default typeface.

PTR(10,1)

2

Select Roman Typeface

Select Roman typeface.

PTR(10,2)

3

Select Gothic Typeface

Select Gothic typeface.

PTR(10,3)

4

Select Courier Typeface

Select Courier typeface.

PTR(10,4)

5

Select Prestige Typeface

Select Prestige typeface.

PTR(10,5)

6

Select Helvetica Typeface

Select Helvetica typeface.

PTR(10,6)

7

Select Script Typeface

Select Script typeface.

PTR(10,7)

8

Select Typeface n

Select typeface n.

PTR(10,8,n)

Class 11: Character Set

Sub Class

Function

Description

PTR Format

1

Character Set 1

Select the primary, or default, character set.

PTR(11,1)

2

Character Set 2

Select the secondary, or alternate, character set.

PTR(11,2)

3

Graphics 1

Select the primary, or default, graphics set.

PTR(11,3)

4

Graphics 2

Select the secondary, or alternate, graphics set.

PTR(11,4)

5

Select International Set

Select international character set n.

PTR(11,5,n)

6

Select Character Set n

Select character set n.

PTR(11,6,n)

7

Select Extended Characters

Select, in the current set, characters represented by numbers in the range 128 to 255.

PTR(11,7)

8

Deselect Extended Characters

Disable the use of extended characters.

PTR(11,8)

9

Select User Set

Select the character set downloaded, or defined, by the user.

PTR(11,9)

10

Deselect User Set

Deselect the user-loaded character set and re-enable the normal, or default, set.

PTR(11,10)

11

Remap User's Set

Remap user-loaded characters from positions 0-127 to positions 128-255.

PTR(11,11)

12

Enable Control Codes

Enable treating character codes 128-159 as control codes.

PTR(11,12)

13

Print Control Codes

Enable treating character codes 128-159 as printable characters.

PTR(11,13)

Class 12: Font Selection

Sub Class

Function

Description

PTR Format

1

Select Primary Font Set

Select the primary, or default, font set.

PTR(12,1)

2

Select Font Set 2

Select the secondary, or alternate, font set.

PTR(12,2)

3

Select Font Set 3

Select font set 3.

PTR(12,3)

4

Select Font Set 4

Select font set 4.

PTR(12,4)

5

Select Font Set 5

Select font set 5.

PTR(12,5)

6

Select Font Set 6

Select font set 6.

PTR(12,6)

7

Select Font Set 7

Select font set 7.

PTR(12,7)

8

Select Font Set 8

Select font set 8.

PTR(12,8)

9

Select Subfont Set 1

Select subfont 1 from a set of fonts.

PTR(12,9)

10

Select Subfont Set 2

Select subfont 2 from a set of fonts.

PTR(12,10)

11

Select Subfont Set 3

Select subfont 3 from a set of fonts.

PTR(12,11)

12

Select Subfont Set 4

Select subfont 4 from a set of fonts.

PTR(12,12)

13

Select Subfont Set 5

Select subfont 5 from a set of fonts.

PTR(12,13)

14

Select Subfont Set 6

Select subfont 6 from a set of fonts.

PTR(12,14)

15

Select Subfont Set 7

Select subfont 7 from a set of fonts.

PTR(12,15)

16

Select Subfont Set 8

Select subfont 8 from a set of fonts.

PTR(12,16)

Class 13: Colour

Sub Class

Function

Description

PTR Format

1

Black

Select printing colour black.

PTR(13,1)

2

Magenta

Select printing colour magenta.

PTR(13,2)

3

Cyan

Select printing colour cyan.

PTR(13,3)

4

Violet

Select printing colour violet.

PTR(13,4)

5

Yellow

Select printing colour yellow.

PTR(13,5)

6

Red

Select printing colour red.

PTR(13,6)

7

Green

Select printing colour green.

PTR(13,7)