Rich-Text Format Specification V. 2 Introduction 2 rtf syntax 2 Conventions of an rtf reader 4



Download 1.09 Mb.
Page9/15
Date conversion29.04.2016
Size1.09 Mb.
1   ...   5   6   7   8   9   10   11   12   ...   15

Bookmarks


This destination may specify one of two control words: \ *\ bkmkstart, which indicates the start of the specified bookmark, and \ *\ bkmkend, which indicates the end of the specified bookmark.

Bookmarks have the following syntax:





|



'{\ *' \ bkmkstart ( \ bkmkcolf? & \ bkmkcoll?) #PCDATA '}'



'{\ *' \ bkmkend #PCDATA '}'

A bookmark is shown in the following example:

\pard\plain \fs20 Kuhn believes that science, rather than

discovering in experience certain structured

relationships, actually creates (or already participates in)

a presupposed structure to which it fits the data.

{\bkmkstart paradigm} Kuhn calls such a presupposed

structure a paradigm.{\bkmkend paradigm}


The bookmark start and the bookmark end are matched via the bookmark tag. In the example, the bookmark tag was paradigm. Each bookmark start should have a matching bookmark end; however, the bookmark start and the bookmark end may be in any order.

\ bkmkcolfN is used to denote the first column of a table covered by a bookmark. If it is not included then the first column will be assumed. \ bkmkcollN is used to denote the last column. If it is not used then the last column will be assumed. These controls are used within the \ *\ bkmkstart destination following the \ bkmkstart control. For example, {\ *\ bkmkstart\ bkmkcolf2\ bkmkcoll5 Table1} will place the bookmark "Table1" on columns two through five of a table.

Pictures


An RTF file can include pictures created with other applications. These pictures can be in hexadecimal (default) or binary format. Pictures are destinations, and begin with the \ pict control word. A picture destination has the following syntax:




'{' \ pict (? & ? &
&
& ?) '}'




\ macpict | \ pmmetafile | \ wmetafile | \ dibitmap | \ wbitmap



\ wbmbitspixel & \ wbmplanes & \ wbmwidthbytes




( \ picw? & \ pich?) \ picscalex? & \ picscaley? & \ picscaled? & \ piccropt? & \ piccropb? & \ piccropr? & \ piccropl?



\picbmp & \picbpp



( \ bin #BDATA) | #SDATA

These control words are described in the following table (some measurements in this table are in twips; a twip is one-twentieth of a point):



Control word

Meaning

\ macpict

Source of the picture is QuickDraw.

\ pmmetafileN

Source of the picture is an OS/2 metafile; the n argument identifies the metafile type.

\ wmetafileN

Source of the picture is a Windows metafile; the n argument identifies the metafile type (default is 1).

\ dibitmapN

Source of the picture is a Windows Device Independent bitmap; the n argument identifies the bitmap type (default is 0).

\ wbitmapN

Source of the picture is a Windows Device dependent bitmap; the n argument identifies the bitmap type (default is 0 monochrome bitmap).

Bitmap information




\ wbmbitspixelN

Number of adjacent color bits on each plane needed to define a pixel (default is 1)

\ wbmplanesN

Number of bitmap color planes (default is 1).

\ wbmwidthbytesN

Specifies the number of bytes in each raster line. This value must be an even number since the Windows graphics device interface (GDI) assumes that the bit values of a bitmap form an array of integer (two-byte) values. In other words, wbmwidthbytes x 8 must be the next multiple of 16 greater than or equal to the picw (bitmap width in pixels) value.

Picture size, scaling, and cropping




\ picwN

xExt field if the picture is a metafile; picture width in pixels if the picture is a bitmap or from QuickDraw.

\ pichN

yExt field if the picture is a metafile; picture height in pixels if the picture is a bitmap or from QuickDraw.

\ picwgoalN

Desired width of the picture in twips.

\ pichgoalN

Desired height of the picture in twips.

\ picscalexN

Horizontal scaling value; the n argument is a value representing a percentage (default is 100).

\ picscaleyN

Vertical scaling value; the n argument is a value representing a percentage (default is 100).

\ picscaled

Scales the picture to fit within the specified frame; used only with \ macpict pictures.

\ piccroptN

Top cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0).

\ piccropbN

Bottom cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0).

\ piccroplN

Left cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0).

\ piccroprN

Right cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0).

Metafile information




\ picbmp

Specifies whether a metafile contains a bitmap.

\ picbppN

Specifies the bits per pixel in a metafile bitmap. Valid range is 1–32, with 1, 4, 8, and 24 being recognized.

Picture data




\ binN

Picture is in binary format; the numeric parameter n is the number of bytes that follow. Unlike all other controls, this keyword takes a 32-bit parameter.

The \ wbitmap control word is optional; if no other picture type is specified, the picture is assumed to be a Windows bitmap. If \ wmetafile is specified, the n argument can be one of the following types:



Type

n argument

MM_TEXT

1

MM_LOMETRIC

2

MM_HIMETRIC

3

MM_LOENGLISH

4

MM_HIENGLISH

5

MM_TWIPS

6

MM_ISOTROPIC

7

MM_ANISOTROPIC

8

For more information about these types, see Volume 1 of the Programmer’s Reference in the Microsoft Windows 3.1 SDK.

If \ pmmetafile is specified, the n argument can be one of the following types:

Type

n argument

PU_ARBITRARY

0x0004

PU_PELS

0x0008

PU_LOMETRIC

0x000C

PU_HIMETRIC

0x0010

PU_LOENGLISH

0x0014

PU_HIENGLISH

0x0018

PU_TWIPS

0x001C

For more information about these types, see Volume 2 of the OS/2 Programmer’s Reference.

Be careful with spaces following control words when dealing with pictures in binary format. When reading files, RTF considers the first space after a control word the delimiter and subsequent spaces part of the document text. Therefore, any extra spaces are attached to the picture, with unpredictable results.

RTF writers should not use the carriage-return/line-feed (CRLF) combination to break up pictures in binary format. If they do, the CRLF is treated as literal text and considered part of the picture data.

The picture in hexadecimal or binary format follows the picture-destination control words. The following example illustrates the destination format:

{\pict\wbitmap0\picw170\pich77\wbmbitspixel1\wbmplanes1\wmbwidthbytes22

\picwgoal505

\pichgoal221

\picscalex172

\picscaley172

49f2000000000273023d1101a030

3901000a000000000273023d98

0048000200000275

02040000200010275023e000000000

273023d000002b90002b90002

b90002b90002b9

0002b90002b90002b90002b90002b90002

b92222b90002b90002b90

002b90002b9

0002b90002b90002b90002b9000



1   ...   5   6   7   8   9   10   11   12   ...   15


The database is protected by copyright ©essaydocs.org 2016
send message

    Main page