26 ms·
Consider the https://en.wikipedia.org/wiki/Regional_Indicator_Symbol https://en.wikipedia.org/wiki/Regional_Indicator_Symbol s. In every way that matters, these
by derefr 10y ago
Consider the https://en.wikipedia.org/wiki/Regional_Indicator_Symbol https://en.wikipedia.org/wiki/Regional_Indicator_Symbol s. In every way that matters, these "act as" one 'character': you can't set your cursor position to be between them; backspacing one should delete both; the flag takes up one terminal col (even if it is rendered as two) such that "\033[1Dx" (cursor-left 1, print "x") will overwrite the whole flag, etc.
But it's the font that controls those semantics—because it's the font that knows what flags do or do not exist. For any pair of RIS codepoints that doesn't form a flag (in the opinion of a given font), they behave like two separate characters.
Thus: one grapheme cluster, or two, depending on the font.
And another example—this one much less "idiomatic", but not specifically decried by the Unicode committee: http://kudakurage.com/ligature_symbols/ http://kudakurage.com/ligature_symbols/
That's a font, making entirely-arbitrary clusters out of codepoints. As far as I am aware, it's fully within its rights as a font to do so. There's nothing in the Unicode standard saying that the code-points ['f', 'i', 'l', 'e'], put in a row, can't combine to form a single grapheme cluster. They don't have combining behavior themselves, but—unlike, say, things in the Unicode "Separator" class—they don't have any property that says they don't combine with anything.
- mrout 10y agoCursor position is based on glyphs though, not grapheme clusters. Grapheme clusters are a well-specific Unicode concept. >Thus: one grapheme cluster, or two, depending on the font. One glyph or two depending on the font. Two grapheme clusters, always. >That's a font, making entirely-arbitrary clusters out of codepoints. As far as I am aware, it's fully within its rights as a font to do so. There's nothing in the Unicode standard saying that the code-points ['f', 'i', 'l', 'e'], put in a row, can't combine to form a single grapheme cluster. They don't have combining behavior themselves, but—unlike, say, things in the Unicode "Separator" class—they don't have any property that says they don't combine with anything. No, I think those are glyphs. 'file' is always four grapheme clusters.