Add <noBreak> support from UnicodeData.txt.

This commit is contained in:
Reece H. Dunn
2017-04-08 19:08:50 +01:00
parent 54a8ea2a70
commit 8cc80d671d
2 changed files with 18 additions and 0 deletions
+2
View File
@@ -330,6 +330,7 @@ ucd_script ucd_lookup_script(codepoint_t c);
typedef enum ucd_property_
{
UCD_PROPERTY_WHITE_SPACE = 0x0001, /**< @brief White_Space */
UCD_PROPERTY_NO_BREAK = 0x0002, /**< @brief <noBreak> */
} ucd_property;
/** @brief Return the properties of the specified codepoint.
@@ -790,6 +791,7 @@ namespace ucd
enum property
{
White_Space = UCD_PROPERTY_WHITE_SPACE, /**< @brief White_Space */
noBreak = UCD_PROPERTY_NO_BREAK, /**< @brief <noBreak> */
};
/** @brief Return the properties of the specified codepoint.
+16
View File
@@ -36,9 +36,25 @@ ucd_property ucd_properties(codepoint_t c, ucd_category category)
return UCD_PROPERTY_WHITE_SPACE;
}
return 0;
case UCD_CATEGORY_Pd:
if (c == 0x2011) // NON-BREAKING HYPHEN
return UCD_PROPERTY_NO_BREAK;
return 0;
case UCD_CATEGORY_Po:
if (c == 0x0F0C) // TIBETAN MARK DELIMITER TSHEG BSTAR
return UCD_PROPERTY_NO_BREAK;
return 0;
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;