diff --git a/uniseg.scm b/uniseg.scm index 002acf7..dc5aa08 100644 --- a/uniseg.scm +++ b/uniseg.scm @@ -20,18 +20,22 @@ (first pair)))) (define (grapheme-property char) - "Find the unicode grapheme cluster property, as defined by https://www.unicode.org/reports/tr44/" + "Find the Unicode grapheme cluster property, as defined by https://www.unicode.org/reports/tr44/" (or (get-prop grapheme-charsets char) 'other)) - (define (eastasian-property char) + "Find the Unicode East Asian width property, as defined by https://www.unicode.org/reports/tr11/" (define (<==> lo hi) "Create a range predicate, inclusive between two numbers" (λ (num) (and (>= num lo) (<= num hi)))) + ;; The spec requires that any values not in the table be double-width, if + ;; they are in certain ranges. So let's take care of that here. + ;; These characters are not in the char-sets as they are undesignated. + ;; See comments in unicode's EastAsianWidth.txt (define range-unified-ideographs-ext-a? (<==> #x3400 #x4DBF)) (define range-unified-ideographs? @@ -43,10 +47,6 @@ (define range-plane-3? (<==> #x30000 #x3FFFD)) - ;; The spec defines any values not in the table be wide, if - ;; they are in certain ranges. So let's take care of that here. - ;; These characters are not in the char-sets as they are undesignated. - ;; See comments in unicode's EastAsianWidth.txt (or (get-prop eastasian-charsets char) (let ((int (char->integer char))) (match int