|
|
|
@ -21,7 +21,7 @@
|
|
|
|
|
(define (has-table? this tag)
|
|
|
|
|
#;((or/c bytes? symbol?) . ->m . boolean?)
|
|
|
|
|
(define directory (force (ttf-font-directory this)))
|
|
|
|
|
(hash-has-key? (· directory tables) (match tag
|
|
|
|
|
(hash-has-key? (hash-ref directory 'tables) (match tag
|
|
|
|
|
[(? bytes?) (string->symbol (bytes->string/latin-1 tag))]
|
|
|
|
|
[_ tag])))
|
|
|
|
|
|
|
|
|
@ -34,17 +34,17 @@
|
|
|
|
|
|
|
|
|
|
(define (get-table-stream this tag)
|
|
|
|
|
(define directory (force (ttf-font-directory this)))
|
|
|
|
|
(define table (hash-ref (· directory tables) tag))
|
|
|
|
|
(and table (pos (ttf-font-port this) (· table offset)) (ttf-font-port this)))
|
|
|
|
|
(define table (hash-ref (hash-ref directory 'tables) tag))
|
|
|
|
|
(and table (pos (ttf-font-port this) (hash-ref table 'offset)) (ttf-font-port this)))
|
|
|
|
|
|
|
|
|
|
(define (decode-table this table-tag)
|
|
|
|
|
(unless (hash-has-key? table-codecs table-tag)
|
|
|
|
|
(raise-argument-error 'decode-table "decodable table" table-tag))
|
|
|
|
|
(define directory (force (ttf-font-directory this)))
|
|
|
|
|
(define table (hash-ref (· directory tables) table-tag))
|
|
|
|
|
(define table (hash-ref (hash-ref directory 'tables) table-tag))
|
|
|
|
|
;; todo: possible to avoid copying the bytes here?
|
|
|
|
|
(pos (ttf-font-port this) (· table offset))
|
|
|
|
|
(define table-bytes (open-input-bytes (peek-bytes (· table length) 0 (ttf-font-port this))))
|
|
|
|
|
(pos (ttf-font-port this) (hash-ref table 'offset))
|
|
|
|
|
(define table-bytes (open-input-bytes (peek-bytes (hash-ref table 'length) 0 (ttf-font-port this))))
|
|
|
|
|
(define table-decoder (hash-ref table-codecs table-tag))
|
|
|
|
|
(decode table-decoder table-bytes #:parent this))
|
|
|
|
|
|
|
|
|
|