Text Formatting

From MSNLD Wiki

The MSN Chat Control sends a "Style" CTCP rather than a normal IRC Message.

\x01S <color><style><font>;<character set> <message>\x01

Colors[edit]

The MSN Chat Control supports 16 text colors, which are identical to the colors found in the CSS Level 1 specification. If the text color specified matches the background color (usual white), the default text color (usually black) is shown.

The MSN Chat Control allows 127 colors (1 - 127) to be specified as a single byte, with each number mapping to one of the 16 text colors shown in the table below. The mapping of colors above 16 uses an unusual algorithm that does not include aqua.

if (value != 16) { value = value % 15; }
if (value = 0) { value = 15 }
MSN Chat Colors
Name Value HTML Color Code Example
black 1 #000000 The quick brown fox jumps over the lazy dog.
white 2 #ffffff The quick brown fox jumps over the lazy dog.
maroon 3 #800000 The quick brown fox jumps over the lazy dog.
green 4 #008000 The quick brown fox jumps over the lazy dog.
navy 5 #000080 The quick brown fox jumps over the lazy dog.
olive 6 #808000 The quick brown fox jumps over the lazy dog.
purple 7 #800080 The quick brown fox jumps over the lazy dog.
teal 8 #008080 The quick brown fox jumps over the lazy dog.
silver 9 #c0c0c0 The quick brown fox jumps over the lazy dog.
gray 10 #808080 The quick brown fox jumps over the lazy dog.
red 11 #ff0000 The quick brown fox jumps over the lazy dog.
lime 12 #00ff00 The quick brown fox jumps over the lazy dog.
blue 13 #0000ff The quick brown fox jumps over the lazy dog.
yellow 14 #ffff00 The quick brown fox jumps over the lazy dog.
fuchsia 15 #ff00ff The quick brown fox jumps over the lazy dog.
aqua 16 #00ffff The quick brown fox jumps over the lazy dog.

Styles[edit]

The MSN Chat Control supports bold, italic, and underlined text, although it does not support sending underlined text. To avoid text being unreadable, if the text color specified matches the background color (usual white), the default text color (usually black) is shown instead.

The MSN Chat Control allows 127 styles (1 - 127) to be specified as a single byte bitmask, with numbers outside of that range possibly overwriting existing color information. The bitmask value is increased by one to avoid NUL being sent to/from the server.

enum enumChatFormat {
  chfNone =      0x0,
  chfBold =      0x1,
  chfItalic =    0x2,
  chfUnderline = 0x4,
}

If we wanted to make our text Bold (1), Italic (2) and Underlined (4), we would send the sum of those numbers, plus one (8) as a byte.

MSN Chat Character Sets
Value Description Preview
1 None The quick brown fox jumps over the lazy dog.
2 Bold The quick brown fox jumps over the lazy dog.
3 Italic The quick brown fox jumps over the lazy dog.
4 Bold & Italic The quick brown fox jumps over the lazy dog.
5 Underline The quick brown fox jumps over the lazy dog.
6 Bold & Underline The quick brown fox jumps over the lazy dog.
7 Italic & Underline The quick brown fox jumps over the lazy dog.
8 Bold, Italic & Underline The quick brown fox jumps over the lazy dog.

Font[edit]

Any font on the client's computer can be used to style text by specifying the font name as a string. As there is no sharing of fonts, if the recipient does not have the specified font installed, a default font such as Tahoma may be used.

Character Sets[edit]

The MSN Chat Control supports various character sets. The default character set is Ansi (0). It's recommended that any new clients send messages with the Oem (255) character set, which supports Unicode.

MSN Chat Character Sets
Name Value Description
Baltic 186 Baltic character set.
Mac 77 Characters used by Macintosh.
Russian 204 Russian character set.
EastEurope 238 Eastern European character set.
Thai 222 Thai character set.
Vietnamese 163 Vietnamese character set.
Turkish 162 Turkish character set.
Greek 161 Greek character set.
Arabic 178 Arabic character set.
Hebrew 177 Hebrew character set.
Johab 130 Korean character set.
Oem 255 Extended ASCII character set used with disk operating system (DOS) and some Microsoft Windows fonts.
ChineseBig5 136 Chinese character set used mostly in Hong Kong SAR and Taiwan.
GB2312 134 Chinese character set used in mainland China.
Hangul 129 Korean character set.
Hangeul 129 Another common spelling of the Korean character set.
ShiftJIS 128 Japanese character set.
Symbol 2 Symbol character set.
Default 1 System default character set.
Ansi 0 ASCII character set.