Jump to content

Rich Text Format: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
please don't unnecessarily pockmark the middle of sentences
→‎See also: correcting small typos
Line 94: Line 94:
*[[Revisable-Form Text]] (RFT), part of IBM's Document Content Architecture (DCA)
*[[Revisable-Form Text]] (RFT), part of IBM's Document Content Architecture (DCA)
*[[TNEF]] Transport Neutral Encapsulation Format, the [[Microsoft Outlook]] default message format
*[[TNEF]] Transport Neutral Encapsulation Format, the [[Microsoft Outlook]] default message format
*[[Abiword]] - open-source rich-text editor, written in C++, inludes import and export from/to RTF file format. Might be interesting for these who need to learn how to implement RTF support in your project and link it to other application functionality.
*[[Abiword]] - open-source rich-text editor, written in C++, includes import and export from/to RTF file format. Might be interesting for those who need to learn how to implement RTF support in their project and link it to other application functionality.


==External links==
==External links==

Revision as of 23:18, 25 January 2010

Rich Text Format
Filename extension
.rtf
Internet media type
text/rtf
Type code'RTF '
Uniform Type Identifier (UTI)public.rtf
Magic number{\rtf
Developed byMicrosoft
Type of formatdocument file format
Free format?No

The Rich Text Format (often abbreviated RTF) is a document file format developed by Microsoft in 1987 for cross-platform document interchange. Most word processors are able to read and write RTF documents.[1]

It should not be confused with enriched text (mimetype "text/enriched" of RFC 1896) or its predecessor Rich Text (mimetype "text/richtext" of RFC 1341 and 1521) which are completely different specifications.

History

Richard Brodie, Charles Simonyi, and David Luebbert, members of the Microsoft Word development team, developed the original RTF in the middle to late 1980s. Its syntax was influenced by the TeX typesetting language.[citation needed] The first RTF reader and writer shipped in 1987 as part of Microsoft Word 3.0 for Macintosh, which implemented the RTF version 1.0 specification. All subsequent releases of Microsoft Word for the Macintosh and all versions for Windows can read and write files in RTF format.

Microsoft owns the intellectual property in and maintains the format.[citation needed] As of March 2008, the current version is 1.9.1. According to Microsoft's Office 2010 resource kit documentation, Microsoft is discontinuing enhancements to the RTF specification. Further, some new features in Word 2010 and later versions will not save properly to the RTF format.[2]

Version timeline

  • 1987: RTF 1.0
  • January 1994: RTF 1.3
  • April 1997: RTF 1.5
  • May 1999: RTF 1.6
  • August 2001: RTF 1.7
  • April 2004: RTF 1.8
  • March 2008: RTF 1.9.1

Code example

As an example, the following RTF code:

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
This is some {\b bold} text.\par
}

would be rendered like this when read by a program that supports RTF:

This is some bold text.

Braces ({ and }) define a group; groups can be nested. A backslash (\) starts an RTF control code. A valid RTF document is a group that starts with the \rtf control code.

In the example above, the \b control code invokes boldface type; the example uses a group to limit the scope of the boldface control code. All other text characters will be rendered as plain text. The \par control code indicates the end of a paragraph.

Character encoding

RTF is an 8-bit format. That would limit it to ASCII, but RTF can encode characters beyond ASCII by escape sequences. The character escapes are of two types: code page escapes and Unicode escapes. In a code page escape, two hexadecimal digits following an apostrophe are used for denoting a character taken from a Windows code page. For example, if control codes specifying Windows-1256 are present, the sequence \'c8 will encode the Arabic letter beh (ب).

If a Unicode escape is required, the control word \u is used, followed by a 16-bit signed decimal integer giving the Unicode codepoint number. For the benefit of programs without Unicode support, this must be followed by the nearest representation of this character in the specified code page. For example, \u1576? would give the Arabic letter beh, specifying that older programs which do not have Unicode support should render it as a question mark instead.

The control word \uc0 can be used to indicate that subsequent Unicode escape sequences within the current group do not specify a substitution character.

Human readability

Unlike most word processing formats, good RTF code can be made human-readable. When an RTF file is opened in a text editor, without formatting or processing of formatting, the alphanumeric text is legible and the markup language (formatting) elements are not too distracting or counter-intuitive. The RTF files produced by most programs, such as Microsoft Word (MS Word), will contain such a large number of control codes for compatibility with older programs that most files will easily be an order of magnitude larger than the raw text and very difficult to read. Formats such as MS Word's .doc are, in contrast, binary formats with only a few scraps of legible text.

Nowadays, human-readable XML-based formats are becoming more common. But, during RTF's initial release, its level of readability was rare among document formats. Note that the XML-based OpenDocument and Office Open XML formats are often not immediately human-readable because they are a bundle of several different files within a ZIP archive.

Common uses and interoperability

Most word processing software implementations support RTF format importing and exporting, and/or direct editing, often making it a "common" format between otherwise incompatible word processing software and operating systems. These factors contribute to its interoperability.

Overall, since 1987, RTF files may be transferred back and forth between many old and new computer systems (and now over the internet) despite differences between operating systems and their versions. This makes it a useful format for basic formatted text documents such as instruction manuals, résumés, letters, and modest information documents. These documents at minimum support bold, italic, and underline text formatting. Also typically supported are left-, center-, and right- justified text. Furthermore, font specification and document margins are supported in RTF documents.

Font and margin defaults, as well as style presets and other functions will vary according to program defaults. There may also be subtle differences perhaps between different versions of the RTF specification implemented in differing programs and program versions. Nevertheless, the RTF format is consistent enough from computer to computer to be considered highly portable and moderately acceptable for cross-platform use.[who?] For greater consistency between more modern computers, a format such as PDF may be preferred; but PDFs are not traditionally distributed as editable documents whereas RTFs are.

Unlike Microsoft Word's DOC format, as well as the newer Office Open XML and OpenDocument formats, RTF does not support macros. For this reason, RTF is recommended over these formats when the spread of computer viruses is a concern. However, having the .RTF extension does not guarantee that a file is safe, since Microsoft Word will open standard DOC files renamed with an RTF extension and run any contained macros as usual. Manual examination of a file in a plain text editor such as Notepad, or use of the file command in UNIX-like systems, is required to determine whether or not a suspect file is really RTF.[1][3]

The WordPad editor in Microsoft Windows creates RTF files by default. It once defaulted to the Microsoft Word 6.0 file format, but write support for Word documents was dropped in a security update.

The default text editor for Mac OS X, TextEdit, can also view, edit and save RTF files as well as RTFD files. TextEdit currently (as of July 2009) has limited ability to edit RTF document margins. Much older Mac word processing application programs such as MacWrite and WriteNow were able to view, edit, and save RTF files as well.

The free and open-source word processors AbiWord, OpenOffice.org, KWord, and Bean can view, edit and save RTF files.

SIL International’s Toolbox application for developing and publishing dictionaries uses RTF as its most common form of document output. RTF files produced by Toolbox are designed to be used in Microsoft Word, but can also be used by other RTF-aware word processors.

RTF is an important format for ebook readers because of its interoperability, simplicity, and low CPU processing requirements, and some devices, including BeBook, work best with this format.

See also

References

  1. ^ a b "Benefits of Rich Text Format (RTF)". Desktop Publishing, Presentations & Word Processing. ETR Associates.
  2. ^ Changes in Word 2010
  3. ^ "Avoiding Macro Viruses". SANS Institute.