[kandinsky/font] Add comment about UTF-8

This commit is contained in:
Léa Saviot
2019-01-11 11:09:07 +01:00
committed by Émilie Feral
parent 4cd28dc024
commit 42ecd20f12

View File

@@ -8,6 +8,21 @@
#include <kandinsky/unicode/codepoint.h>
#include "palette.h"
/* We use UTF-8 encoding. This means that a character is encoded as a code point
* that uses between 1 and 4 bytes. Code points can be "combining", in which
* case their glyph should be superimposed to the glyph of the previous code
* point in the string. This is for instance used to print accents: the string
* for the glyph 'è' is composed of the code point for 'e' followed by the
* combining code point for '`'.
* ASCII characters have the same encoding in ASCII and in UTF-8.
*
* We do not provide a glyph for each of the 1,112,064 valid UTF-8 code points.
* We thus have a table of the glyphs we can draw (uint32_t Codepoints[] in
* kandinsky/fonts/codepoints.h). To easily compute the index of a code point in
* the Codepoints table, we use the m_table matching table: it contains the
* CodepointIndexPairs of the first code point of each series of consecutive
* code points in the Codepoints table. */
class KDFont {
private:
static constexpr int k_bitsPerPixel = 4; // TODO: Should be generated by the rasterizer