675
edits
No edit summary |
mNo edit summary |
||
Line 18: | Line 18: | ||
== Content == | == Content == | ||
A tile is made up of 128 cells, with each cell only being able to contain one character. A cell can support a UTF-8 character with surrogate-pair handling, plus up to sixteen combining characters after it. A cell cannot have a lone surrogate pair, and it cannot have a lone combining character or start with one. A cell also cannot have any NUL (\0) characters in it. | A tile is made up of 128 cells, with each cell only being able to contain one character. A cell can support a UTF-8 character with surrogate-pair handling, plus up to sixteen combining characters after it. A cell cannot have a lone surrogate pair, and it cannot have a lone combining character or start with one. A cell also cannot have any NUL (\0) characters in it. | ||
During storage and transmission, the content is a string that must be properly split into an array of 128 strings for proper processing, | |||
Because of the ability to support surrogate pairs, a cell can support any character beyond the Basic Multilingual Plane, which includes Emoji characters. For backwards compatibility purposes, Javascript handles strings by 16-bit code points. This makes working with Emoji characters difficult whenever a string containing such characters is split using the String.prototype.split function. While a simple way to solve this problem is by using the [...string] syntax and the charCodeAt/fromCharCode functions, it's useful to know how to properly split a string containing surrogate characters. | Because of the ability to support surrogate pairs, a cell can support any character beyond the Basic Multilingual Plane, which includes Emoji characters. For backwards compatibility purposes, Javascript handles strings by 16-bit code points. This makes working with Emoji characters difficult whenever a string containing such characters is split using the String.prototype.split function. While a simple way to solve this problem is by using the [...string] syntax and the charCodeAt/fromCharCode functions, it's useful to know how to properly split a string containing surrogate characters. | ||
Line 33: | Line 35: | ||
To construct the integer, the formula <code>bold << 3 | italic << 2 | under << 1 | strike</code> is used. You must ensure that the base (0x20F0) is added to it before converting it into a character. For text decorations to work properly, the combining character must be at the very end of the cell string. If there is more than one, they must all be truncated prior to processing. | To construct the integer, the formula <code>bold << 3 | italic << 2 | under << 1 | strike</code> is used. You must ensure that the base (0x20F0) is added to it before converting it into a character. For text decorations to work properly, the combining character must be at the very end of the cell string. If there is more than one, they must all be truncated prior to processing. | ||
== Color & Background color == | |||
Each cell of a tile can have text color and background color assigned to it. An array of 128 integers is used to store the color information of a cell. The integers are 24-bit unsigned integers (0-16777215) that refer to a RGB color value. |