check buffer settings

main
Matthew Butterick 6 years ago
parent 3cbd283d66
commit 3ee03dd3d7

@ -1,4 +1,4 @@
#lang racket/base
#lang racket/base
(require ffi/unsafe
ffi/unsafe/define
racket/draw/private/libs
@ -109,8 +109,10 @@
;; Set the script, language and direction of the buffer.
(hb_buffer_set_direction buf 'HB_DIRECTION_LTR)
(hb_buffer_get_direction buf)
(hb_buffer_set_script buf 'HB_SCRIPT_LATIN)
(hb_buffer_set_language buf (hb_language_from_string "en" -1))
(hb_buffer_get_script buf)
(hb_buffer_set_language buf (hb_language_from_string #"en" -1))
;; Create a face and a font, using FreeType for now.
(define ft-library (FT_Init_FreeType))

@ -1,18 +1,27 @@
#lang racket/base
(provide (all-defined-out))
;; computed enums
;; https://lazka.github.io/pgi-docs/HarfBuzz-0.0/enums.html
;; https://github.com/Robmaister/SharpFont.HarfBuzz/blob/master/Source/SharpFont.HarfBuzz/Script.cs
(define hb-direction-values
'(HB_DIRECTION_INVALID
HB_DIRECTION_LTR
HB_DIRECTION_RTL
HB_DIRECTION_TTB
HB_DIRECTION_BTT))
'(HB_DIRECTION_INVALID = 0
HB_DIRECTION_LTR = 4
HB_DIRECTION_RTL = 5
HB_DIRECTION_TTB = 6
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)))))
(define hb-script-values
'(HB_SCRIPT_COMMON
HB_SCRIPT_INHERITED
HB_SCRIPT_UNKNOWN
HB_SCRIPT_ARABIC
`(HB_SCRIPT_COMMON = ,(->tag #"Zyyy")
HB_SCRIPT_INHERITED = ,(->tag #"Zinh")
HB_SCRIPT_UNKNOWN = ,(->tag #"Zzzz")
HB_SCRIPT_ARABIC = ,(->tag #"Arab")
HB_SCRIPT_ARMENIAN
HB_SCRIPT_BENGALI
HB_SCRIPT_CYRILLIC
@ -28,7 +37,7 @@
HB_SCRIPT_KANNADA
HB_SCRIPT_KATAKANA
HB_SCRIPT_LAO
HB_SCRIPT_LATIN
HB_SCRIPT_LATIN = ,(->tag #"Latn")
HB_SCRIPT_MALAYALAM
HB_SCRIPT_ORIYA
HB_SCRIPT_TAMIL

Loading…
Cancel
Save