RTF를 사용하기 위하여 본문
RTF를 사용하기 위하여>동네청년< 2007. 7. 23. 21:16
About Rich Edit Controls
The original specification for rich edit controls is Microsoft Rich Edit 1.0; the current specification is Rich Edit 4.1. Each version of rich edit is a superset of the preceding one, except that only Asian builds of Rich Edit 1.0 have a vertical text option. Before creating a rich edit control, you should call the LoadLibrary function to verify which version of Rich Edit is installed. For more information, see What's New in Rich Edit.
The following table shows which DLL corresponds with which version of Rich Edit. Note that the name of the file did not change from version 2.0 to version 3.0. This allows version 2.0 to be upgraded to version 3.0 without breaking existing code.
|Rich Edit version||DLL|
The following list describes which versions of Rich Edit are included in which releases of Microsoft Windows.
|Windows XP SP1||Includes Rich Edit 4.1, Rich Edit 3.0, and a Rich Edit 1.0 emulator.|
|Windows XP||Includes Rich Edit 3.0 with a Rich Edit 1.0 emulator.|
|Windows Me||Includes Rich Edit 1.0 and 3.0.|
|Windows 2000||Includes Rich Edit 3.0 with a Rich Edit 1.0 emulator.|
|Windows NT 4.0||Includes Rich Edit 1.0 and 2.0.|
|Windows 98||Includes Rich Edit 1.0 and 2.0.|
|Windows 95||Includes only Rich Edit 1.0. However, Riched20.dll is compatible with Windows 95 and may be installed by an application that requires it.|
On Windows 95/98/Me, Rich Edit 1.0 is localized so that it works with a particular operating system that is similarly localized. For example, on Japanese versions of an operating system, Rich Edit 1.0 can display Japanese, but not Arabic.
The following topics are discussed in this section.
The following topics describe the new features introduced in each version of Rich Edit.
Rich Edit 1.0 includes the following features.
|Text entry and selection||Mostly standard (system-edit control) selection and entry of text. Selection bar support (the selection bar is an unmarked area to the left of each paragraph that when clicked, selects the line). Word-wrap and auto-word-select options. Single-, double-, and triple-click selection.|
|ANSI (single-byte character set (SBCS) and multibyte character set (MBCS)) editing||However, there is no Unicode editing.|
|Basic set of character/paragraph formatting properties||See CHARFORMAT and PARAFORMAT.|
|Character formatting properties||Font name and size, bold, italic, solid underline, strike-out, protected, link, offset, and text color.|
|Paragraph formatting properties||Start indent, right indent, subsequent line offset, bullet, alignment (left, center, right), and tabs.|
|Find forward||Includes case-insensitive and match-whole-word options.|
|Message-based interface||Almost a superset of the system edit-control message set plus two interfaces, IRichEditOle and IRichEditCallback.|
|Embedded objects||Requires client collaboration based on IRichEditOle and IRichEditCallback interfaces.|
|Right-button menu support||Uses IRichEditCallback interface.|
|Drag-and-drop editing||Drag-and-drop editing is supported.|
|Notifications||WM_COMMAND messages sent to client plus a number of others. This is a superset of common-control notifications.|
|Single-level undo/redo||Behaves similarly to the system edit control. Selecting Undo reverses the last action, and that action then becomes the new Redo action.|
|Simple vertical text||(Asian builds only).|
|Input Method Editor (IME) support||(Asian builds only).|
|WYSIWYG editing using printer metrics||This feature is needed for Microsoft WordPad, in particular.|
|Cut/Copy/Paste/StreamIn/StreamOut||With plain text (CF_TEXT) or Rich Text Format (RTF) with and without objects.|
|C code base||The code is written in C, which provides a solid and versatile foundation.|
|Different builds for different scripts||Rich Edit 1.0 addresses localization issues with different builds.|
Rich Edit 2.0 incorporated several additional features, such as support for Unicode and Asian languages, multilevel Undo, Component Object Model (COM) interfaces, and numerous user interface (UI) enhancements.
|Unicode||Unicode eases the effort in handling international text. However effort is needed to maintain compatibility with existing non-Unicode documents—that is, the ability to convert to/from non-Unicode plain and rich text. Also, substantial effort is needed to run correctly on Windows 95/98/Me.|
|General international support||General line breaking algorithm (extension of Kinsoku rules), simple font linking, keyboard font switching.|
|Asian support||Level 2 (dialog box) and 3 (inline) is supported in IMEs.|
|Find Up/Find Down support||Searching forward and backward is supported.|
|Bidirectional support||This is included in Rich Edit 2.1|
|Multilevel undo||An extensible Undo architecture allows client to participate in application-wide Undo model.|
|Magellan mouse support||This is the mouse with a roller for scrolling.|
|Dual-font support||The keyboard can automatically switch fonts when the active font is inappropriate for current keyboard, for example, Kanji characters in Times New Roman.|
|Smart font apply||Font change request does not apply Western fonts to Asian characters.|
|Improved display||An off-screen bitmap is used when multiple fonts occur on the same line. This allows, for example, the last letter of the word cool not to be chopped off.|
|Transparency support||Also in windowless mode.|
|System selection colors||Used for selecting text.|
|Automatic URL recognition||Can check for a number of URL formats (for example, http:)|
|Microsoft Word edit UI compatibility||Selection, cursor-keypad semantics.|
|Word standard EOP||The end-of-paragraph mark (CR) can also handle carriage return/line feed (CR/LF) (carriage return, line-feed).|
|Plain-text as well as rich-text functionality||Single-character format and single-paragraph format.|
|Single-line and multiline controls||Truncate at first end-of-paragraph and no wordwrap.|
|Accelerator keys||Accelerator keys are supported.|
|Password window style||Password edit controls are supplied through EM_GETPASSWORDCHAR and EM_SETPASSWORDCHAR.|
|Scalable architecture||To reduce instance size.|
|Windowless operation and interfaces||This is provided through the ITextHost and ITextServices interfaces.|
|COM dual interfaces||Text Object Model (TOM) interfaces.|
|CHARFORMAT2||Added font weight, background color, locale identifier, underline type, superscript and subscript (in addition to offset), disabled effect. For RTF roundtripping only, added amount to space between letters, twip size above which to kern character pair, animated-text type, various effects: font shadow/outline, all caps, small caps, hidden, embossed, imprint, and revised.|
|PARAFORMAT2||Added space before and after and Word line spacing. For RTF roundtripping only, added shading weight/style, numbering start/style/tab, border space/width/sides, tab alignment/leaders, various Word paragraph effects: RTL paragraph, keep, keep-next, page-break-before, no-line-number, no-widow-control, do-not-hyphenate, side-by-side.|
|More RTF roundtripping||All of the Word FormatFont and FormatParagraph properties.|
|Code stability and stabilization||Examples: parameter and object validation, function invariants, reentrancy guards, object stabilization.|
|Strong testing infrastructure||Including extensive regressions tests.|
|Improved performance||Smaller working set, faster load and redisplay times, etc.|
|C++ code base||The code is written in C++, which provides a solid foundation on which to build Rich Edit 3.0.|
With a few exceptions, Rich Edit 2.0 uses the same functions, structures, and messages as Rich Edit 1.0. Note, however, the following differences:
- The name of the Rich Edit 1.0 window class is RichEdit. Rich Edit 2.0 has both ANSI and Unicode window classes—RichEdit20A and RichEdit20W, respectively. To specify the appropriate rich edit window class, use the RICHEDIT_CLASS constant, which the Richedit.h file defines depending on the definition of the UNICODE compile flag.
- In Rich Edit 2.0, if you create a Unicode rich edit control (one that expects Unicode text messages), you must specify only Unicode data in any window messages sent to the control. Similarly, if you create an ANSI rich edit control, send only ANSI or double-byte character set (DBCS) data. You can use the IsWindowUnicode function to determine whether a rich edit control uses Unicode text messages. Note that the rich edit COM interfaces use Unicode text unless they encounter a code page argument.
- Rich Edit 1.0 used CR/LF character combinations for paragraph markers. Rich Edit 2.0 used only a carriage return character ('\r'). Rich Edit 3.0 uses only a carriage return character but can emulate Rich Edit 1.0 in this regard.
- Rich Edit 2.0 introduced the following new messages.
Message Description EM_AUTOURLDETECT Enables or disables automatic URL detection. EM_CANREDO Determines whether there are any actions in the redo queue. EM_GETIMECOMPMODE Retrieves the current input method editor (IME) mode. EM_GETLANGOPTIONS Retrieves options for IME and Asian language support. EM_GETREDONAME Retrieves the type name of the next action in the redo queue. EM_GETTEXTMODE Retrieves the text mode or undo level. EM_GETUNDONAME Retrieves the type name of the next action in the undo queue. EM_REDO Redoes the next action in the redo queue. EM_SETLANGOPTIONS Sets options for IME and Asian language support. EM_SETTEXTMODE Sets the text mode or undo level. EM_SETUNDOLIMIT Sets the maximum number of actions in the undo queue. EM_STOPGROUPTYPING Stops grouping consecutive typing actions into the current undo action.
- Rich Edit 2.0 introduced the following new structures.
Structure Description CHARFORMAT2 Contains information about character formatting. PARAFORMAT2 Contains information about paragraph formatting.
- Rich Edit versions 2.0 and 3.0 do not support the following messages that were previously supported in Asian-language versions of Rich Edit 1.0.
Rich Edit 3.0 is a single, scalable, world-wide DLL that offers high performance and compatibility with Word in a small package. New features for Rich Edit 3.0 include richer text, zoom, font binding, more powerful IME support, and rich complex script support (bidirectional, Indic, and Thai).
Rich Edit 3.0 includes the following features in addition to the features provided by Rich Edit Version 2.0.
|Zoom||The zoom factor is given by a ratio.|
|Paragraph numbering (single-level)||Numeric, upper and lower alphabetic, or Roman numeral.|
|Simple tables||Deleting and inserting rows is possible, but not resizing nor wrapping inside cells. With advanced typography turned on (see EM_GETTYPOGRAPHYOPTIONS), Rich Edit 3.0 can align columns centered or flush right, and include decimals. Cells are simulated by tabs, so text tabs and carriage returns are replaced by blanks.|
|Normal and heading styles||Built-in normal style and heading styles 1 through 9 are supported by the EM_SETPARAFORMAT and Text Object Model (TOM) interfaces.|
|More underline types||Dashed, dash-dot, dash-dot-dot, and dot underlining has been added.|
|Underline coloring||Underlined text can be tagged with one of 15 document choices for underline colors.|
|Hidden text||Marked by CHARFORMAT2 attribute. Handy for roundtripping (writing out to a file what was read in) of information that ordinarily should not be displayed.|
|More default hot keys||These hot keys function the same as those in Word. For example, European accent dead keys (U.S. keyboards only). Number hot key (CTRL+L) cycles through numbering options available, starting with bullet.|
|HexToUnicode IME||Allows a user to convert between hexadecimal and Unicode by using hot keys.|
|Smart quotes||This feature is toggled on and off by CTRL+ALT+' for U.S. keyboards.|
|Soft hyphens||For plain text, use 0xAD. For RTF, use \-.|
|Italics cursor||In addition, the mouse cursor changes to a hand when over URLs.|
|Advanced typography option||Rich Edit 3.0 can use an advanced typography option for line breaking and display (see EM_GETTYPOGRAPHYOPTIONS). This elegant option was added primarily to facilitate handling complex scripts (bidirectional, Indic, and Thai). In addition, a number of improvements occur for simple scripts. Examples are:
|Complex script support||Rich Edit 3.0 supports bidirectional (text with Arabic and/or Hebrew mixed with other scripts), Indic (Indian scripts like Devangari), and Thai text. For support of these complex scripts, the advanced typography and Uniscribe components are used.|
|Font binding||Rich Edit 3.0 will automatically choose an appropriate font for characters that clearly do not belong to the current character set stamp. This is done by assigning character sets to text runs and associating fonts with those character sets. For more information, see Font Binding.|
|Charset-specific plain-text read/write options||This allows reading a file using one charset, and writing with a different charset.|
|UTF-8 RTF||This is recommended for cutting, copying, and pasting operations. This file format is more compact than ordinary RTF, faster, and compatible with Unicode.|
|Microsoft Office 9 IME support (IME98)||This more powerful IME capability has been separated into an independent module. Features include:
|Active Input Method Manager (IMM) support||Users can invoke the Active IMM object, which enables users to enter Asian characters on U.S. systems.|
|HexToUnicode support||Users can convert between hexadecimal notation and Unicode by using hot keys.|
|More RTF roundtripping||RTF text that is read in from a file will be written back out intact.|
|Improved 1.0 compatibility mode||Rich Edit 3.0 can emulate Rich Edit 1.0 behavior. For example, it is possible to change between MBCS and Unicode character-position (cp) mappings. This feature emulates Rich Edit 1.0 in Windows 2000.|
|Increased freeze control||The display can be frozen over multiple API calls and then unfrozen to display the updates.|
|Increased undo control||Undo can be suspended and resumed (an IME requirement).|
|Increase/decrease font size||Increases or decreases font size to one of six standard values (12, 28, 36, 48, 72, and 80 points).|
New features for Rich Edit 4.1 include hyphenation, page rotation, and Text Services Framework (TSF) support.
Rich Edit 4.1 includes the following features in addition to the features provided by Rich Edit Version 3.0.
|Hyphenation||Hyphenation is supported through the following APIs: HyphenateProc, EM_SETHYPHENATEINFO, and EM_GETHYPHENATEINFO.|
|Page rotation||Top-to-bottom and bottom-to-top layout is supported through EM_SETPAGEROTATE and EM_GETPAGEROTATE.|
|Text Services Framework support||
|Additional IME support|
|Additional EM_SETEDITSTYLE settings||Besides the TSF settings, there are new settings that exclude IMEs, set bidirectional text flow, use draftmode fonts, and more.|
|Additional EM_SETCHARFORMAT settings||New flags allow the client to set the default font and font sizes for a given LCID or charset, to set the default font for the control, to prevent keyboard switching to match the font, and more.|
|Restricting input to ANSI text||Using TM_SINGLECODEPAGE in EM_SETTEXTMODE prevents Unicode input from entering a Rich Edit control.|
|Unsupported RTF keyword notification||EN_LOWFIRTF warns an application when there is an unsupported RTF keyword.|
|Additional language support||Additional languages include Armenian, Divehi, Telugu, and others.|
|Improved table support||Features include: wrapping within cells, improved handling via RTF, and improved navigation.|
|ES_VERTICAL||The ES_VERTICAL windows style is supported.|
|WM_UNICHAR Notification support||To send or post Unicode characters to ANSI windows, use WM_UNICHAR Notification. It is equivalent to WM_CHAR, but it uses (UTF)-32.|