feature tags are byte strings

main
Matthew Butterick 6 years ago
parent 18f3962346
commit 33b97385fb

@ -13,9 +13,7 @@
HB_DIRECTION_BTT = 7))
(define (->tag bstr)
(define bs (bytes->list bstr))
(for/sum ([(b i) (in-indexed (reverse bs))])
(* b (expt 2 (* i 8)))))
(integer-bytes->integer bstr #f #;(= unsigned) 'big-endian))
(define hb-script-values
`(HB_SCRIPT_COMMON = ,(->tag #"Zyyy")

@ -182,18 +182,16 @@
(define HB_FEATURE_GLOBAL_START 0)
(define HB_FEATURE_GLOBAL_END 4294967295)
(define (tag->hb-feature tag)
(define str (symbol->string tag))
(define bs (string->bytes/utf-8 str))
(unless (= (bytes-length bs) (string-length str))
(error 'invalid-tag-char))
(define (tag->hb-feature bs)
(unless (and (bytes? bs) (= (bytes-length bs) 4))
(raise-argument-error 'tag->hb-feature "4 bytes" bs))
(hb_feature_from_string bs))
(define liga_on (tag->hb-feature 'liga))
(define liga_on (tag->hb-feature #"liga"))
(define liga_off (make-hb_feature_t (->tag #"liga") 0 0 4294967295))
(define kern_on (tag->hb-feature 'kern))
(define kern_on (tag->hb-feature #"kern"))
(define kern_off (make-hb_feature_t (->tag #"kern") 0 0 4294967295))
(define onum_on (tag->hb-feature 'onum))
(define onum_on (tag->hb-feature #"onum"))
(define onum_off (make-hb_feature_t (->tag #"onum") 0 0 4294967295))
(define (shape font text [feats null])

Loading…
Cancel
Save