You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/fontland/fontland/helper.rkt

32 lines
1.1 KiB
Racket

#lang racket
(require racket/runtime-path)
(provide (all-defined-out))
(define-syntax-rule (r+p ID ...)
(begin (require ID ...) (provide (all-from-out ID ...))))
(define index? (λ (x) (and (number? x) (integer? x) (not (negative? x)))))
(define-runtime-path charter-path "assets/charter.ttf")
(define-runtime-path charter-italic-path "assets/charter-italic.ttf")
(define-runtime-path fira-path "assets/fira.ttf")
(define-runtime-path fira-otf-path "assets/fira.otf")
(define-runtime-path charter-directory-path "assets/charter-directory.rktd")
(define-runtime-path charter-italic-directory-path "assets/charter-italic-directory.rktd")
(define-syntax (test-module stx)
(syntax-case stx ()
[(_ . EXPRS)
#`(module+ test
(require #,(datum->syntax stx 'rackunit) #,(datum->syntax stx 'racket/serialize))
. EXPRS)]))
(define (is-mark? codepoint)
;; mark classes = Mn Me Mc
(regexp-match #px"\\p{Mn}|\\p{Me}|\\p{Mc}" (string (integer->char codepoint))))
(module+ test
(require rackunit)
(check-true (and (is-mark? #x300) #t))
(check-false (and (is-mark? #x2ee) #t)))