|
|
@@ -20,6 +20,30 @@ |
|
|
|
|
|
|
|
#include "ucd/ucd.h" |
|
|
|
|
|
|
|
static int properties_Cc(codepoint_t c) |
|
|
|
{ |
|
|
|
if (c >= 0x0009 && c <= 0x000D) return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
if (c == 0x0085) return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
static int properties_Cf(codepoint_t c) |
|
|
|
{ |
|
|
|
switch (c & 0xFFFFFF00) |
|
|
|
{ |
|
|
|
case 0x0600: |
|
|
|
if (c == 0x061C) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
break; |
|
|
|
case 0x2000: |
|
|
|
if (c >= 0x200C && c <= 0x200D) return UCD_PROPERTY_JOIN_CONTROL; |
|
|
|
if (c >= 0x200E && c <= 0x200F) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
if (c >= 0x202A && c <= 0x202E) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
if (c >= 0x2066 && c <= 0x2069) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
break; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
static int properties_Pd(codepoint_t c) |
|
|
|
{ |
|
|
|
switch (c & 0xFFFFFF00) |
|
|
@@ -94,45 +118,30 @@ static int properties_Sm(codepoint_t c) |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
static int properties_Zs(codepoint_t c) |
|
|
|
{ |
|
|
|
switch (c) |
|
|
|
{ |
|
|
|
case 0x00A0: // NO-BREAK SPACE |
|
|
|
case 0x2007: // FIGURE SPACE |
|
|
|
case 0x202F: // NARROW NO-BREAK SPACE |
|
|
|
return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_NO_BREAK; |
|
|
|
} |
|
|
|
return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
} |
|
|
|
|
|
|
|
ucd_property ucd_properties(codepoint_t c, ucd_category category) |
|
|
|
{ |
|
|
|
switch (category) |
|
|
|
{ |
|
|
|
case UCD_CATEGORY_Cc: |
|
|
|
switch (c) |
|
|
|
{ |
|
|
|
case 0x09: // CHARACTER TABULATION |
|
|
|
case 0x0A: // LINE FEED |
|
|
|
case 0x0B: // LINE TABULATION |
|
|
|
case 0x0C: // FORM FEED |
|
|
|
case 0x0D: // CARRIAGE RETURN |
|
|
|
case 0x85: // NEXT LINE |
|
|
|
return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
case UCD_CATEGORY_Cf: |
|
|
|
if (c == 0x061C) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
if (c >= 0x200C && c <= 0x200D) return UCD_PROPERTY_JOIN_CONTROL; |
|
|
|
if (c >= 0x200E && c <= 0x200F) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
if (c >= 0x202A && c <= 0x202E) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
if (c >= 0x2066 && c <= 0x2069) return UCD_PROPERTY_BIDI_CONTROL; |
|
|
|
return 0; |
|
|
|
case UCD_CATEGORY_Cc: return properties_Cc(c); |
|
|
|
case UCD_CATEGORY_Cf: return properties_Cf(c); |
|
|
|
case UCD_CATEGORY_Pd: return properties_Pd(c); |
|
|
|
case UCD_CATEGORY_Po: return properties_Po(c); |
|
|
|
case UCD_CATEGORY_Sm: return properties_Sm(c); |
|
|
|
case UCD_CATEGORY_Zl: |
|
|
|
case UCD_CATEGORY_Zp: |
|
|
|
return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
case UCD_CATEGORY_Zs: |
|
|
|
switch (c) |
|
|
|
{ |
|
|
|
case 0x00A0: // NO-BREAK SPACE |
|
|
|
case 0x2007: // FIGURE SPACE |
|
|
|
case 0x202F: // NARROW NO-BREAK SPACE |
|
|
|
return UCD_PROPERTY_WHITE_SPACE | UCD_PROPERTY_NO_BREAK; |
|
|
|
} |
|
|
|
return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
default: |
|
|
|
return 0; |
|
|
|
case UCD_CATEGORY_Zl: return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
case UCD_CATEGORY_Zp: return UCD_PROPERTY_WHITE_SPACE; |
|
|
|
case UCD_CATEGORY_Zs: return properties_Zs(c); |
|
|
|
default: return 0; |
|
|
|
}; |
|
|
|
} |