Table 4-1 shows the main printable characters you can access in RTF, as defined by the ANSI character set (also known as Code Page 1252, which is basically Latin-1 with some characters added between 128 and 159). Accessing Unicode characters is explained in the Character Formatting section of Chapter 1.
Note that while RTF escapes (\'xx
) are valid for all characters, the only characters that have to be escaped are these three characters: {
, }
, and \
, plus all the characters over code 127.
Table 4-1. ASCII-RTF character chart
ASCII code | RTF escape | Character | Character name |
---|---|---|---|
0–31 | Control characters; do not use | ||
32 | \’20 | Space | |
33 | \’21 | ! | Exclamation mark |
34 | \’22 | " | Double quote |
35 | \’23 | # | Number |
36 | \’24 | $ | Dollar |
37 | \’25 | % | Percent |
38 | \’26 | & | Ampersand |
39 | \’27 | ' | Apostrophe |
40 | \’28 | ( | Left parenthesis |
41 | \’29 | ) | Right parenthesis |
42 | \’2a | * | Asterisk |
43 | \’2b | + | Plus sign |
44 | \’2c | , | Comma |
45 | \’2d | - | Hyphen (use \_ for nonbreaking hyphen) |
46 | \’2e | . | Period |
47 | \’2f | / | Slash |
48–57 | \’30–\’39 | 0–9 | Digits 0–9 |
58 | \’3a | : | Colon |
59 | \’3b | ; | Semicolon |
60 | \’3c | < | Less-than sign |
61 | \’3d | = | Equals sign |
62 | \’3e | > | Greater-than sign |
63 | \’3f | ? | Question mark |
64 | \’40 | @ | Commercial at sign |
65 | \’41 | A | |
66 | \’42 | B | |
67 | \’43 | C | |
68 | \’44 | D | |
69 | \’45 | E | |
70 | \’46 | F | |
71 | \’47 | G | |
72 | \’48 | H | |
73 | \’49 | I | |
74 | \’4a | J | |
75 | \’4b | K | |
76 | \’4c | L | |
77 | \’4d | M | |
78 | \’4e | N | |
79 | \’4f | O | |
80 | \’50 | P | |
81 | \’51 | Q | |
82 | \’52 | R | |
83 | \’53 | S | |
84 | \’54 | T | |
85 | \’55 | U | |
86 | \’56 | V | |
87 | \’57 | W | |
88 | \’58 | X | |
89 | \’59 | Y | |
90 | \’5a | Z | |
91 | \’5b | [ | Left square bracket |
92 | \’5c | \ | Backslash |
93 | \’5d | ] | Right square bracket |
94 | \’5e | ^ | Caret |
95 | \’5f | _ | Underscore |
96 | \’60 | ` | Grave accent |
97 | \’61 | a | |
98 | \’62 | b | |
99 | \’63 | c | |
100 | \’64 | d | |
101 | \’65 | e | |
102 | \’66 | f | |
103 | \’67 | g | |
104 | \’68 | h | |
105 | \’69 | i | |
106 | \’6a | j | |
107 | \’6b | k | |
108 | \’6c | l | |
109 | \’6d | m | |
110 | \’6e | n | |
111 | \’6f | o | |
112 | \’70 | p | |
113 | \’71 | q | |
114 | \’72 | r | |
115 | \’73 | s | |
116 | \’74 | t | |
117 | \’75 | u | |
118 | \’76 | v | |
119 | \’77 | w | |
120 | \’78 | x | |
121 | \’79 | y | |
122 | \’7a | z | |
123 | \’7b | { | Left curly brace |
124 | \’7c | | | Vertical bar |
125 | \’7d | } | Right curly brace |
126 | \’7e | ~ | Tilde |
127 | \’7f | Delete character; do not use | |
128 | \’80 | Euro character | |
129 | \’81 | Unassigned | |
130 | \’82 | ͵ | Low left single quote |
131 | \’83 | ƒ | Florin |
132 | \’84 | ,, | Low left double quote |
133 | \’85 | ... | Ellipsis |
134 | \’86 | † | Dagger |
135 | \’87 | ‡ | Double dagger |
136 | \’88 | ∘ | Circumflex |
137 | \’89 | ‰ | Permil |
138 | \’8a | Š | S-caron |
139 | \’8b | ‹ | Single left guillemet |
140 | \’8c | Œ | OE-ligature |
141 | \’8d | Unassigned | |
142 | \’8e | Ž | Z-caron |
143 | \’8f | Unassigned | |
144 | \’90 | Unassigned | |
145 | \’91 | ‘ | Left single quote |
146 | \’92 | ’ | Right single quote |
147 | \’93 | “ | Left double quote |
148 | \’94 | ” | Right double quote |
149 | \’95 | • | Bullet |
150 | \’96 | – | En dash |
151 | \’97 | — | Em dash |
152 | \’98 | ~ | Tilde |
153 | \’99 | ™ | Trademark |
154 | \’9a | š | s-caron |
155 | \’9b | › | Single right guillemet |
156 | \’9c | œ | oe ligature |
157 | \’9d | Unassigned | |
158 | \’9e | ž | z-caron |
159 | \’9f | Ÿ | Y-diaeresis |
(160) | \~ | Nonbreaking space | |
161 | \'a1 | ¡ | Inverted exclamation point |
162 | \'a2 | ¢ | Cent sign |
163 | \'a3 | £ | Pound sign |
164 | \'a4 | ¤ | General currency sign |
165 | \'a5 | ¥ | Yen sign |
166 | \'a6 | ¦ | Broken vertical bar |
167 | \'a7 | § | Section sign |
168 | \'a8 | ¨ | Spacing diaeresis |
169 | \'a9 | © | Copyright |
170 | \'aa | ª | Feminine ordinal |
171 | \'ab | « | Left angle quotes |
172 | \'ac | ¬ | Not sign |
173 | \- | (-) | Soft hyphen |
174 | \'ae | ® | Registered trademark |
175 | \'af | ¯ | Macron accent |
176 | \'b0 | ° | Degree sign |
177 | \'b1 | ± | Plus or minus sign |
178 | \'b2 | ² | Superscript 2 |
179 | \'b3 | ³ | Superscript 3 |
180 | \'b4 | ´ | Acute accent |
181 | \'b5 | µ | Micro sign (Greek mu) |
182 | \'b6 | ¶ | Paragraph sign |
183 | \'b7 | · | Middle dot |
184 | \'b8 | ¸ | Cedilla |
185 | \'b9 | ¹ | Superscript 1 |
186 | \'ba | º | Masculine ordinal |
187 | \'bb | » | Right angle quotes |
188 | \'bc | ¼ | One-fourth fraction |
189 | \'bd | ½ | One-half fraction |
190 | \'be | ¾ | Three-fourths fraction |
191 | \'bf | ¿ | Inverted question mark |
192 | \'c0 | À | A-grave |
193 | \'c1 | Á | A-acute |
194 | \'c2 | Â | A-circumflex |
195 | \'c3 | Ã | A-tilde |
196 | \'c4 | Ä | A-diaeresis |
197 | \'c5 | Å | A-ring |
198 | \'c6 | Æ | AE-ligature |
199 | \'c7 | Ç | C-cedilla |
200 | \'c8 | È | E-grave |
201 | \'c9 | É | E-acute |
202 | \'ca | Ê | E-circumflex |
203 | \'cb | Ë | E-diaeresis |
204 | \'cc | Ì | I-grave |
205 | \'cd | Í | I-acute |
206 | \'ce | Î | I-circumflex |
207 | \'cf | Ï | I-diaeresis |
208 | \'d0 | Ð | Uppercase edh |
209 | \'d1 | Ñ | N-tilde |
210 | \'d2 | Ò | O-grave |
211 | \'d3 | Ó | O-acute |
212 | \'d4 | Ô | O-circumflex |
213 | \'d5 | Õ | O-tilde |
214 | \'d6 | Ö | O-diaeresis |
215 | \'d7 | × | Multiply sign |
216 | \'d8 | Ø | O-slash |
217 | \'d9 | Ù | U-grave |
218 | \'da | Ú | U-acute |
219 | \'db | Û | U-circumflex |
220 | \'dc | Ü | U-diaeresis |
221 | \'dd | Ý | Y-acute |
222 | \'de | Þ | Uppercase thorn |
223 | \'df | ß | German ess-zed |
224 | \'e0 | à | a-grave |
225 | \'e1 | á | a-acute |
226 | \'e2 | â | a-circumflex |
227 | \'e3 | ã | a-tilde |
228 | \'e4 | ä | a-diaeresis |
229 | \'e5 | å | a-ring |
230 | \'e6 | æ | ae-ligature |
231 | \'e7 | ç | c-cedilla |
232 | \'e8 | è | e-grave |
233 | \'e9 | é | e-acute |
234 | \'ea | ê | e-circumflex |
235 | \'eb | ë | e-diaeresis |
236 | \'ec | ì | i-grave |
237 | \'ed | í | i-acute |
238 | \'ee | î | i-circumflex |
239 | \'ef | ï | i-diaeresis |
240 | \'f0 | ð | Lowercase edh |
241 | \'f1 | ñ | n-tilde |
242 | \'f2 | ò | o-grave |
243 | \'f3 | ó | o-acute |
244 | \'f4 | ô | o-circumflex |
245 | \'f5 | õ | o-tilde |
246 | \'f6 | ö | o-diaeresis |
\'f7 | ÷ | Division sign | |
248 | \'f8 | ø | o-slash |
249 | \'f9 | ù | u-grave |
250 | \'fa | ú | u-acute |
251 | \'fb | û | u-circumflex |
252 | \'fc | ü | u-diaeresis |
253 | \'fd | ý | y-acute |
254 | \'fe | þ | Lowercase thorn |
255 | \'ff | ÿ | y-diaeresis |
In RTF, use the \lang
thatnumber
command with the appropriate language code to label a piece of text as a particular language; for example, this paragraph in U.S. English (1033) contains a phrase in French (1036):
{\pard\lang1033
It had a certain {\i\lang1036
je ne sais quoi}.\par}
Table 4-2 is a partial list of the most common language numbers. A complete list is located at http://www.unicode.org/unicode/onlinedat/languages.html
Note that the language values are in decimal (as used in RTF’s \lang
thatnumber
command). In most Microsoft documentation, the values are (inconveniently) listed in hexadecimal.
Table 4-2. RTF language codes
Language name | Language code (decimal) |
---|---|
Not in any language | 1024 |
Afrikaans | 1078 |
Arabic | 1025 |
Catalan | 1027 |
Chinese (Traditional) | 1028 |
Chinese (Simplified) | 2052 |
Czech | 1029 |
Danish | 1030 |
Dutch | 1043 |
Dutch (Belgian) | 2067 |
English (U.K.) | 2057 |
English (U.S.) | 1033 |
Finnish | 1035 |
French | 1036 |
French (Belgian) | 2060 |
French (Canadian) | 3084 |
French (Swiss) | 4108 |
German | 1031 |
German (Swiss) | 2055 |
Greek | 1032 |
Hebrew | 1037 |
Hungarian | 1038 |
Icelandic | 1039 |
Indonesian | 1057 |
Italian | 1040 |
Japanese | 1041 |
Korean | 1042 |
Norwegian (Bokmål) | 1044 |
Norwegian (Nynorsk) | 2068 |
Polish | 1045 |
Portuguese | 2070 |
1046 | |
Romanian | 1048 |
Russian | 1049 |
Serbo-Croatian (Cyrillic) | 2074 |
Serbo-Croatian (Latin) | 1050 |
Slovak | 1051 |
Spanish (Castilian) | 1034 |
Spanish (Mexican) | 2058 |
Swahili | 1089 |
Swedish | 1053 |
Thai | 1054 |
Turkish | 1055 |
Vietnamese | 1066 |
Measurements in RTF are generally in twips. A twip is a twentieth of a point, i.e., a 1,440th of an inch. It can lead to large numbers sometimes (like \li2160
to set the left indent to an inch and a half), but Table 4-3 should be useful for conversions. Also, see the ruler printed inside the cover of this book.
Conversions between centimeters and anything else are approximate, so figures with a preceding “~” have been rounded.
Table 4-3. Converting to twips
Inches | Twips | Points | Centimeters |
---|---|---|---|
20 tw | 1 pts | ||
40 tw | 2 pts | ||
~57 tw | .1 cm | ||
60 tw | 3 pts | ||
80 tw | 4 pts | ||
1/16″ | 90 tw | 4.5 pts | |
100 tw | 5 pts | ||
~113 tw | .2 cm | ||
1/9″ | 160 tw | 8 pts | |
~170 tw | .3 cm | ||
1/8″ | 180 tw | 9 pts | |
1/7″ | ~206 tw | ~10.3 pts | |
~227 tw | .4 cm | ||
1/6″ | 240 tw | 12 pts | |
3/16″ | 270 tw | 13.5 pts | |
~283 tw | .5 cm | ||
1/5″ | 288 tw | 14.4 pts | |
~340 tw | .6 cm | ||
1/4″ | 360 tw | 18 pts | |
~397 tw | .7 cm | ||
~454 tw | .8 cm | ||
1/3″ | 480 tw | 24 pts | |
~510 tw | .9 cm | ||
~567 tw | 1 cm | ||
1/2″ | 720 tw | 36 pts | |
~850 tw | 1.5 cm | ||
3/4 | 1080 tw | 54 pts | |
~1134 tw | 2 cm | ||
1″ | 1440 tw | 72 pts | |
~1701 tw | 3 cm | ||
1.5″ | 2160 tw | 108 pts | |
~2268 tw | 4 cm | ||
~2835 tw | 5 cm | ||
2″ | 2880 tw | 144 pts | |
~3402 tw | 6 cm | ||
2.5″ | 3600 tw | 180 pts | |
3″ | 4320 tw | 216 pts | |
~5669 tw | 10 cm | ||
4″ | 5760 tw | 288 pts | |
5″ | 7200 tw | 360 pts |
Get RTF Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.