From 2459a4fa8f3c006204dabd25c585591734a04021 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Fri, 14 Apr 2017 20:58:31 +0100 Subject: [PATCH] Add Unified_Ideograph support from PropList.txt. --- src/include/ucd/ucd.h | 2 ++ src/proplist.c | 21 +++++++++++++++------ tools/printdata.py | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/include/ucd/ucd.h b/src/include/ucd/ucd.h index 4fb26ee7..19815d16 100644 --- a/src/include/ucd/ucd.h +++ b/src/include/ucd/ucd.h @@ -351,6 +351,7 @@ enum UCD_PROPERTY_IDS_BINARY_OPERATOR = 0x0000000000040000ull, /**< @brief IDS_Binary_Operator */ UCD_PROPERTY_IDS_TRINARY_OPERATOR = 0x0000000000080000ull, /**< @brief IDS_Trinary_Operator */ UCD_PROPERTY_RADICAL = 0x0000000000100000ull, /**< @brief Radical */ + UCD_PROPERTY_UNIFIED_IDEOGRAPH = 0x0000000000200000ull, /**< @brief Unified_Ideograph */ }; /** @brief Return the properties of the specified codepoint. @@ -832,6 +833,7 @@ namespace ucd IDS_Binary_Operator = UCD_PROPERTY_IDS_BINARY_OPERATOR, /**< @brief IDS_Binary_Operator */ IDS_Trinary_Operator = UCD_PROPERTY_IDS_TRINARY_OPERATOR, /**< @brief IDS_Trinary_Operator */ Radical = UCD_PROPERTY_RADICAL, /**< @brief Radical */ + Unified_Ideograph = UCD_PROPERTY_UNIFIED_IDEOGRAPH, /**< @brief Unified_Ideograph */ }; /** @brief Return the properties of the specified codepoint. diff --git a/src/proplist.c b/src/proplist.c index da8b4943..2f4bcd0b 100644 --- a/src/proplist.c +++ b/src/proplist.c @@ -243,6 +243,15 @@ static int properties_Lo(codepoint_t c) if (c == 0xAAC0) return UCD_PROPERTY_DIACRITIC; if (c == 0xAAC2) return UCD_PROPERTY_DIACRITIC; break; + case 0xFA00: + if (c >= 0xFA0E && c <= 0xFA0F) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c == 0xFA11) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0xFA13 && c <= 0xFA14) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c == 0xFA1F) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c == 0xFA21) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0xFA23 && c <= 0xFA24) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0xFA27 && c <= 0xFA29) return UCD_PROPERTY_UNIFIED_IDEOGRAPH; + break; case 0x11300: if (c == 0x01135D) return UCD_PROPERTY_EXTENDER; break; @@ -257,8 +266,8 @@ static int properties_Lo_ideographic(codepoint_t c) switch (c & 0xFFFF0000) { case 0x000000: - if (c >= 0x3400 && c <= 0x4DB5) return UCD_PROPERTY_IDEOGRAPHIC; - if (c >= 0x4E00 && c <= 0x9FD5) return UCD_PROPERTY_IDEOGRAPHIC; + if (c >= 0x3400 && c <= 0x4DB5) return UCD_PROPERTY_IDEOGRAPHIC | UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0x4E00 && c <= 0x9FD5) return UCD_PROPERTY_IDEOGRAPHIC | UCD_PROPERTY_UNIFIED_IDEOGRAPH; if (c >= 0xF900 && c <= 0xFA6D) return UCD_PROPERTY_IDEOGRAPHIC; if (c >= 0xFA70 && c <= 0xFAD9) return UCD_PROPERTY_IDEOGRAPHIC; break; @@ -267,10 +276,10 @@ static int properties_Lo_ideographic(codepoint_t c) if (c >= 0x018800 && c <= 0x018AF2) return UCD_PROPERTY_IDEOGRAPHIC; break; case 0x020000: - if (c >= 0x020000 && c <= 0x02A6D6) return UCD_PROPERTY_IDEOGRAPHIC; - if (c >= 0x02A700 && c <= 0x02B734) return UCD_PROPERTY_IDEOGRAPHIC; - if (c >= 0x02B740 && c <= 0x02B81D) return UCD_PROPERTY_IDEOGRAPHIC; - if (c >= 0x02B820 && c <= 0x02CEA1) return UCD_PROPERTY_IDEOGRAPHIC; + if (c >= 0x020000 && c <= 0x02A6D6) return UCD_PROPERTY_IDEOGRAPHIC | UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0x02A700 && c <= 0x02B734) return UCD_PROPERTY_IDEOGRAPHIC | UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0x02B740 && c <= 0x02B81D) return UCD_PROPERTY_IDEOGRAPHIC | UCD_PROPERTY_UNIFIED_IDEOGRAPH; + if (c >= 0x02B820 && c <= 0x02CEA1) return UCD_PROPERTY_IDEOGRAPHIC | UCD_PROPERTY_UNIFIED_IDEOGRAPH; if (c >= 0x02F800 && c <= 0x02FA1D) return UCD_PROPERTY_IDEOGRAPHIC; break; } diff --git a/tools/printdata.py b/tools/printdata.py index 2c2c9ad0..da7bda25 100755 --- a/tools/printdata.py +++ b/tools/printdata.py @@ -142,6 +142,7 @@ def properties(data): props += (2 ** 18) * data.get('IDS_Binary_Operator', 0) props += (2 ** 19) * data.get('IDS_Trinary_Operator', 0) props += (2 ** 20) * data.get('Radical', 0) + props += (2 ** 21) * data.get('Unified_Ideograph', 0) return props if __name__ == '__main__':