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/tables.rkt

29 lines
930 B
Racket

#lang racket/base
(require (for-syntax racket/base racket/string) "helper.rkt")
(provide (all-defined-out))
#|
approximates
https://github.com/mbutterick/fontkit/blob/master/src/tables/index.js
|#
(define-syntax (define-table-codecs stx)
(syntax-case stx ()
[(_ ID TABLE-ID ...)
(with-syntax ([(TABLE-ID-STRING ...) (map (λ (s) (datum->syntax stx (string-append "table/" (string-replace (format "~a.rkt" (syntax->datum s)) "/" ""))))
(syntax->list #'(TABLE-ID ...)))])
#'(begin
(r+p TABLE-ID-STRING ...)
(define ID (make-hasheq (map cons (list 'TABLE-ID ...) (list TABLE-ID ...))))))]))
(define-table-codecs table-codecs head hhea hmtx maxp OS/2 post cvt_ fpgm loca prep glyf CFF_)
#|
Tables not supported:
cmap name
PostScript outlines:
CFF2 VORG
Advanced OpenType Tables
BASE GDEF GPOS GSUB JSTF
|#