From 4fbc623706743afe44deb894f551390b08542c22 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Mon, 7 Aug 2023 11:55:52 -0700 Subject: [PATCH] Expand doc comments for UnicodeCharProperties and UnicodeCharWidth. --- src/common/services/Services.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/common/services/Services.ts b/src/common/services/Services.ts index 4178a45b..8f5ec7c6 100644 --- a/src/common/services/Services.ts +++ b/src/common/services/Services.ts @@ -293,8 +293,27 @@ export interface IOscLinkService { getLinkData(linkId: number): IOscLinkData | undefined; } -/** Width and Grapheme_Cluster_Break properties of a character. */ +/* + * Width and Grapheme_Cluster_Break properties of a character as a bit mask. + * + * bit 0: shouldJoin - should combine with preceding character. + * bit 1..2: wcwidth - see UnicodeCharWidth. + * bit 3..31: class of character (currently only 4 bits are used). + * This is used to determined grapheme clustering - i.e. which codepoints + * are to be combined into a single compound character. + * + * Use the UnicodeService static function createPropertyValue to create a + * UnicodeCharProperties; use extractShouldJoin, extractWidth, and + * extractCharKind to extract the components. + */ export type UnicodeCharProperties = number; + +/** + * Width in columns of a character. + * In a CJK context, "half-width" characters (such as Latin) are width 1, + * while "full-width" characters (such as Kanji) are 2 columns wide. + * Combining characters (such as accents) are width 0. + */ export type UnicodeCharWidth = 0 | 1 | 2; export const IUnicodeService = createDecorator('UnicodeService');